Message ID | 20200429212942.28797-2-andriy.gelman@gmail.com |
---|---|
State | Accepted |
Commit | c76b2bf0b4e752455e5ffbd7dee12e935c2eaccd |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec/v4l2_context: Drop empty packet while draining | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
> From: Andriy Gelman <andriy.gelman@gmail.com> > > 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" > > Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com> > --- > libavcodec/v4l2_context.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index > f0ecc18ebd..da802405e4 100644 > --- a/libavcodec/v4l2_context.c > +++ b/libavcodec/v4l2_context.c > @@ -400,6 +400,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]; > -- > 2.25.1 > Lgtm
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index f0ecc18ebd..da802405e4 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -400,6 +400,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];