avcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set
authorAndriy Gelman <andriy.gelman@gmail.com>
Sat, 9 May 2020 23:34:06 +0000 (19:34 -0400)
committerAndriy Gelman <andriy.gelman@gmail.com>
Sat, 9 May 2020 23:35:05 +0000 (19:35 -0400)
commitc76b2bf0b4e752455e5ffbd7dee12e935c2eaccd
tree960af26e9dc2bcf4004bad184c62057b71f20f48
parente3b49aaa4eed7955e243b110e1209960ba5aaf74
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.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
libavcodec/v4l2_context.c