From 67e17f1104761cd27cfa690d1d5f69d99db081ed Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 2 Nov 2019 23:00:49 +0100 Subject: vd_lavc: don't keep packets for fallbacks if errors are tolerated The user can raise the number of tolerated hardware decoding errors. On the other hand, we have a static limit on packets that are "saved" for fallback handling (and that's a good idea to avoid unbounded memory usage). In this case, it could happen that the start of a file was fine after a fallback, but after that buffered amount of data, it would suddenly skip. It's more useful to skip buffering entirely if the number of tolerated decoding errors exceeds the fixed buffer. (And also, I'm sure nobody gives a shit about this feature.) --- video/decode/vd_lavc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'video/decode/vd_lavc.c') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index fbb0e9c137..92065fde0c 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -993,7 +993,9 @@ static int send_packet(struct mp_filter *vd, struct demux_packet *pkt) if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) return ret; - if (ctx->hw_probing && ctx->num_sent_packets < 32) { + if (ctx->hw_probing && ctx->num_sent_packets < 32 && + ctx->opts->software_fallback <= 32) + { pkt = pkt ? demux_copy_packet(pkt) : NULL; MP_TARRAY_APPEND(ctx, ctx->sent_packets, ctx->num_sent_packets, pkt); } -- cgit v1.2.3