summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-22 20:46:28 +0100
committerwm4 <wm4@nowhere>2016-02-22 20:46:28 +0100
commitf3549ff76a082b480fbeef11a5d33d61fe75c4cd (patch)
treebd23f37ac94a44ee69e32e05b11bc044ee3c6360 /demux
parent0e298bb95a67f59c1afb4669c33d66d5ac99fc6e (diff)
downloadmpv-f3549ff76a082b480fbeef11a5d33d61fe75c4cd.tar.bz2
mpv-f3549ff76a082b480fbeef11a5d33d61fe75c4cd.tar.xz
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...)
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_mkv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 761985c204..e99d8a2c63 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -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);