diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-06-30 19:14:32 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-07-09 11:59:32 +0200 |
commit | fc3e28f1e9be65e4c41812a84e86fbade7317847 (patch) | |
tree | 197c7d7f77cb7a144b37d3f231a024f0b48f097c /video | |
parent | bf77f1ae742e9c64926261daf2ddf5c363113025 (diff) | |
download | mpv-fc3e28f1e9be65e4c41812a84e86fbade7317847.tar.bz2 mpv-fc3e28f1e9be65e4c41812a84e86fbade7317847.tar.xz |
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.
Diffstat (limited to 'video')
-rw-r--r-- | video/decode/vd_lavc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index b18e06deb0..8c5c7e8af5 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -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); |