1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-19 09:57:34 +00:00

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.)
This commit is contained in:
wm4 2019-11-02 23:00:49 +01:00
parent 0e1cfe0c42
commit 67e17f1104
2 changed files with 8 additions and 1 deletions
DOCS/man
video/decode

View File

@ -1388,6 +1388,11 @@ Video
(default: 3). If this is a number, then fallback will be triggered if
N frames fail to decode in a row. 1 is equivalent to ``yes``.
Setting this to a higher number might break the playback start fallback: if
a fallback happens, parts of the file will be skipped, approximately by to
the number of packets that could not be decoded. Values below an unspecified
count will not have this problem, because mpv retains the packets.
``--vd-lavc-dr=<yes|no>``
Enable direct rendering (default: yes). If this is set to ``yes``, the
video will be decoded directly to GPU video memory (or staging buffers).

View File

@ -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);
}