From: Aman Gupta <a...@tmm1.net> Signed-off-by: Aman Gupta <a...@tmm1.net> --- libavcodec/v4l2_context.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index 6924760840..070988b4c3 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -264,8 +264,8 @@ static V4L2Buffer* v4l2_dequeue_v4l2buf(V4L2Context *ctx, int timeout) }; int i, ret; - /* if we are draining and there are no more capture buffers queued in the driver we are done */ - if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx_to_m2mctx(ctx)->draining) { + /* if there are no more capture buffers queued in the driver, skip polling */ + if (!V4L2_TYPE_IS_OUTPUT(ctx->type)) { for (i = 0; i < ctx->num_buffers; i++) { /* capture buffer initialization happens during decode hence * detection happens at runtime @@ -276,7 +276,9 @@ static V4L2Buffer* v4l2_dequeue_v4l2buf(V4L2Context *ctx, int timeout) if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER) goto start; } - ctx->done = 1; + /* if we were waiting to drain, all done! */ + if (ctx_to_m2mctx(ctx)->draining) + ctx->done = 1; return NULL; } -- 2.20.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".