summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-02-04 19:00:28 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-04 16:24:17 -0800
commitbeb8d27912cb8d831962ac386b26d7b02929307d (patch)
treea20e42bfd09dd3c05ab6151ada0d555fd4faebae
parent59f9547fb56b93356625c663dfe9978cbbf168ff (diff)
downloadmpv-beb8d27912cb8d831962ac386b26d7b02929307d.tar.bz2
mpv-beb8d27912cb8d831962ac386b26d7b02929307d.tar.xz
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.
-rw-r--r--video/decode/vd_lavc.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 1aaca6b335..b306e57ffa 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -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)