1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-02 21:12:23 +00:00

vd_lavc: fix recently broken hardware decode fallback

This is a dataflow issue caused by the filters change. When the fallback
happens, vd_lavc does not return a frame, but also does not accept a new
packet, which confuses lavc_process(). Fix this by immediately retrying
to feed the buffered packet and decode a frame on fallback.

Fixes #5489.
This commit is contained in:
wm4 2018-02-04 19:00:28 +01:00 committed by Kevin Mitchell
parent 59f9547fb5
commit beb8d27912

View File

@ -976,18 +976,24 @@ static bool do_send_packet(struct mp_filter *vd, struct demux_packet *pkt)
return true;
}
static bool send_packet(struct mp_filter *vd, struct demux_packet *pkt)
static bool send_queued(struct mp_filter *vd)
{
vd_ffmpeg_ctx *ctx = vd->priv;
if (ctx->num_requeue_packets) {
if (do_send_packet(vd, ctx->requeue_packets[0])) {
talloc_free(ctx->requeue_packets[0]);
MP_TARRAY_REMOVE_AT(ctx->requeue_packets, ctx->num_requeue_packets, 0);
}
return false;
while (ctx->num_requeue_packets && do_send_packet(vd, ctx->requeue_packets[0]))
{
talloc_free(ctx->requeue_packets[0]);
MP_TARRAY_REMOVE_AT(ctx->requeue_packets, ctx->num_requeue_packets, 0);
}
return ctx->num_requeue_packets == 0;
}
static bool send_packet(struct mp_filter *vd, struct demux_packet *pkt)
{
if (!send_queued(vd))
return false;
return do_send_packet(vd, pkt);
}
@ -1052,6 +1058,9 @@ static bool receive_frame(struct mp_filter *vd, struct mp_frame *out_frame)
ctx->requeue_packets = pkts;
ctx->num_requeue_packets = num_pkts;
send_queued(vd);
progress = decode_frame(vd);
}
if (!ctx->num_delay_queue)