ffmpeg | branch: master | Andriy Gelman <andriy.gel...@gmail.com> | Sat May  9 
19:34:06 2020 -0400| [c76b2bf0b4e752455e5ffbd7dee12e935c2eaccd] | committer: 
Andriy Gelman

avcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set

V4L2 api can indicate that flushing of the capture buffers is completed
by setting the V4L2_BUF_FLAG_LAST flag.
Use guards because the flag was only defined in Linux v4.2.

Reference:
linux/Documentation/media/uapi/v4l/dev-decoder.rst

    "The client must continue to handle both queues independently,
     similarly to normal decode operation. This includes:
     ...
     - queuing and dequeuing CAPTURE buffers, until a buffer marked with
       the V4L2_BUF_FLAG_LAST flag is dequeued"

Reviewed-by: Ming Qian <ming.q...@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gel...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c76b2bf0b4e752455e5ffbd7dee12e935c2eaccd
---

 libavcodec/v4l2_context.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 52dedb119f..29b144ed73 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -412,6 +412,10 @@ dequeue:
                 ctx->done = 1;
                 return NULL;
             }
+#ifdef V4L2_BUF_FLAG_LAST
+            if (buf.flags & V4L2_BUF_FLAG_LAST)
+                ctx->done = 1;
+#endif
         }
 
         avbuf = &ctx->buffers[buf.index];

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to