From f53f9b89b10bec6e6c5bcc1d8add0577698bd0e4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 24 May 2019 20:18:55 +0200 Subject: demux: add a special case for backward demuxing of opus Make --audio-backward-overlap default to 2 for Opus. I have no idea why this is needed. It seems to fix backward decoding though (going purely by listening). Normally, this should not be needed, since initial padding is completely contained within the first packet (normally, and in the case I tested). So the 2nd packet/frame should be fine, but for some unknown reason it works only with the 3rd. --- demux/demux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index 481b87e0c7..028f6dcef3 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -953,8 +953,11 @@ static void demux_add_sh_stream_locked(struct demux_internal *in, switch (ds->type) { case STREAM_AUDIO: ds->back_preroll = in->opts->audio_back_preroll; - if (ds->back_preroll < 0) // auto + if (ds->back_preroll < 0) { // auto ds->back_preroll = mp_codec_is_lossless(sh->codec->codec) ? 0 : 1; + if (sh->codec->codec && strcmp(sh->codec->codec, "opus") == 0) + ds->back_preroll = 2; + } break; case STREAM_VIDEO: ds->back_preroll = in->opts->video_back_preroll; -- cgit v1.2.3