diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index f70e151ec8..52dedb119f 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -405,6 +405,15 @@ dequeue: return NULL; } + if (ctx_to_m2mctx(ctx)->draining && !V4L2_TYPE_IS_OUTPUT(ctx->type)) { + int bytesused = V4L2_TYPE_IS_MULTIPLANAR(buf.type) ? + buf.m.planes[0].bytesused : buf.bytesused; + if (bytesused == 0) { + ctx->done = 1; + return NULL; + } + } + avbuf = &ctx->buffers[buf.index]; avbuf->status = V4L2BUF_AVAILABLE; avbuf->buf = buf;