From 755ec08ddc74feaf0e9c07ee1cb6590cb5ed9780 Mon Sep 17 00:00:00 2001 From: Arun Menon Date: Mon, 14 Dec 2015 17:47:56 -0800 Subject: mm-video-v4l2: vidc: Do not queue output buffer if flush is in progress Skip queuing of output buffer to driver if output flush is in progress. Without this change, there is an issue when a output FBD with drop flag is received by omx component and requeued back to the driver and never returned. This change will fix the issue and avoid losing the output buffer when flush is in progress. Change-Id: I3560914f526066f7570d7784d7ac635bdc70ef29 --- mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp index dcccc411..19873865 100644 --- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp +++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp @@ -7259,8 +7259,8 @@ OMX_ERRORTYPE omx_vdec::fill_this_buffer_proxy( } buf.m.planes = plane; buf.length = drv_ctx.num_planes; - DEBUG_PRINT_LOW("SENDING FTB TO F/W - fd[0] = %d fd[1] = %d offset[1] = %d", - plane[0].reserved[0],plane[extra_idx].reserved[0], plane[extra_idx].reserved[1]); + DEBUG_PRINT_LOW("SENDING FTB TO F/W - fd[0] = %d fd[1] = %d offset[1] = %d in_flush = %d", + plane[0].reserved[0],plane[extra_idx].reserved[0], plane[extra_idx].reserved[1], output_flush_progress); rc = ioctl(drv_ctx.video_driver_fd, VIDIOC_QBUF, &buf); if (rc) { @@ -8291,6 +8291,7 @@ int omx_vdec::async_message_process (void *context, void* message) } if (omxhdr && (v4l2_buf_ptr->flags & V4L2_QCOM_BUF_DROP_FRAME) && + !omx->output_flush_progress && !(v4l2_buf_ptr->flags & V4L2_QCOM_BUF_FLAG_DECODEONLY) && !(v4l2_buf_ptr->flags & V4L2_QCOM_BUF_FLAG_EOS)) { unsigned int index = v4l2_buf_ptr->index; @@ -8322,6 +8323,8 @@ int omx_vdec::async_message_process (void *context, void* message) return -1; } + DEBUG_PRINT_LOW("SENDING FTB TO F/W from async_message_process - fd[0] = %d fd[1] = %d offset[1] = %d in_flush = %d", + plane[0].reserved[0],plane[extra_idx].reserved[0], plane[extra_idx].reserved[1], omx->output_flush_progress); if(ioctl(omx->drv_ctx.video_driver_fd, VIDIOC_QBUF, v4l2_buf_ptr)) { DEBUG_PRINT_ERROR("Failed to queue buffer back to driver: %d, %d, %d", v4l2_buf_ptr->length, v4l2_buf_ptr->m.planes[0].reserved[0], v4l2_buf_ptr->m.planes[1].reserved[0]); return -1; -- cgit v1.2.3