demux_mkv: fix opus gapless behavior (2)

Commit 943f76e6, which already tried this, was very stupid: it didn't
actually override the samplerate for Opus, but overrode it for all
codecs other than Opus. And even then, it failed to use the overridden
samplerate. (Sigh...)
This commit is contained in:
wm4 2016-02-22 20:46:28 +01:00
parent 0e298bb95a
commit f3549ff76a
1 changed files with 2 additions and 2 deletions

View File

@ -1679,7 +1679,7 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track)
AV_WL32(data + 10, track->a_osfreq);
// Bogus: last frame won't be played.
AV_WL32(data + 14, 0);
} else if (strcmp(codec, "opus")) {
} else if (!strcmp(codec, "opus")) {
// Hardcode the rate libavcodec's opus decoder outputs, so that
// AV_PKT_DATA_SKIP_SAMPLES actually works. The Matroska header only
// has an arbitrary "input" samplerate, while libavcodec is fixed to
@ -2467,7 +2467,7 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
if (i == 0)
dp->duration = block_duration / 1e9;
if (stream->type == STREAM_AUDIO) {
unsigned int srate = track->a_sfreq;
unsigned int srate = stream->codec->samplerate;
demux_packet_set_padding(dp,
mkv_d->a_skip_preroll ? track->codec_delay * srate : 0,
block_info->discardpadding / 1e9 * srate);