mirror of https://github.com/mpv-player/mpv
vd_lavc: fix delay_queue for videos with frames < max_delay_queue
In case there are no packets from demuxer we cannot send EAGAIN, because we will not proceed and get stuck with one frame in queue and never output it. Just respect avcodec_receive_frame ret code and act accordingly. The only case to care about is EOF when we have to drain already queued frames. Fixes playback of 1-2 frame videos.
This commit is contained in:
parent
bf77f1ae74
commit
fc3e28f1e9
|
@ -1215,11 +1215,11 @@ static int receive_frame(struct mp_filter *vd, struct mp_frame *out_frame)
|
|||
if (ret == AVERROR(EAGAIN) && ctx->num_requeue_packets)
|
||||
return 0; // force retry, so send_queued_packet() gets called
|
||||
|
||||
if (!ctx->num_delay_queue)
|
||||
if (ctx->num_delay_queue <= ctx->max_delay_queue && ret != AVERROR_EOF)
|
||||
return ret;
|
||||
|
||||
if (ctx->num_delay_queue <= ctx->max_delay_queue && ret != AVERROR_EOF)
|
||||
return AVERROR(EAGAIN);
|
||||
if (!ctx->num_delay_queue)
|
||||
return ret;
|
||||
|
||||
struct mp_image *res = ctx->delay_queue[0];
|
||||
MP_TARRAY_REMOVE_AT(ctx->delay_queue, ctx->num_delay_queue, 0);
|
||||
|
|
Loading…
Reference in New Issue