[FFmpeg-devel] [PATCH] avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver

Ming Qian ming.qian at nxp.com
Mon Mar 16 04:02:08 EET 2020


the draining is set when the output port is finished,
but it doesn't mean the capture port is finished.
especially for decoder, there may be a stream buffer to store several
frames.
so the decoder still need capture buffer even if the draining is set.

Signed-off-by: Ming Qian <ming.qian at nxp.com>
---
 libavcodec/v4l2_buffers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index dc1b9eaf24..02f23d954b 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -222,7 +222,7 @@ static void v4l2_free_buffer(void *opaque, uint8_t *unused)
             if (!atomic_load(&s->refcount))
                 sem_post(&s->refsync);
         } else {
-            if (s->draining) {
+            if (s->draining && V4L2_TYPE_IS_OUTPUT(avbuf->context->type)) {
                 /* no need to queue more buffers to the driver */
                 avbuf->status = V4L2BUF_AVAILABLE;
             }
-- 
2.25.1



More information about the ffmpeg-devel mailing list