mirror of
https://github.com/mpv-player/mpv
synced 2025-01-06 23:20:15 +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:
parent
59f9547fb5
commit
beb8d27912
@ -976,18 +976,24 @@ static bool do_send_packet(struct mp_filter *vd, struct demux_packet *pkt)
|
|||||||
return true;
|
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;
|
vd_ffmpeg_ctx *ctx = vd->priv;
|
||||||
|
|
||||||
if (ctx->num_requeue_packets) {
|
while (ctx->num_requeue_packets && do_send_packet(vd, ctx->requeue_packets[0]))
|
||||||
if (do_send_packet(vd, ctx->requeue_packets[0])) {
|
{
|
||||||
talloc_free(ctx->requeue_packets[0]);
|
talloc_free(ctx->requeue_packets[0]);
|
||||||
MP_TARRAY_REMOVE_AT(ctx->requeue_packets, ctx->num_requeue_packets, 0);
|
MP_TARRAY_REMOVE_AT(ctx->requeue_packets, ctx->num_requeue_packets, 0);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
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);
|
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->requeue_packets = pkts;
|
||||||
ctx->num_requeue_packets = num_pkts;
|
ctx->num_requeue_packets = num_pkts;
|
||||||
|
|
||||||
|
send_queued(vd);
|
||||||
|
progress = decode_frame(vd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctx->num_delay_queue)
|
if (!ctx->num_delay_queue)
|
||||||
|
Loading…
Reference in New Issue
Block a user