diff options
author | wm4 <wm4@nowhere> | 2013-07-16 22:44:15 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-16 22:44:15 +0200 |
commit | 66a9eb570d8ab086ecd29c244dc99c5c6b85cd03 (patch) | |
tree | 7a74008c12573c87d213f1879ab5694ee5b283ff /audio | |
parent | 6230e0b896f2f022a83f034e401d18c259f22012 (diff) | |
download | mpv-66a9eb570d8ab086ecd29c244dc99c5c6b85cd03.tar.bz2 mpv-66a9eb570d8ab086ecd29c244dc99c5c6b85cd03.tar.xz |
demux_mkv: never force output sample rate
Matroska has an output sample rate (OutputSamplingFrequency), which in
theory should be forced instead of whatever the decoder outputs. But it
appears no software (other than mplayer2 and mpv until now) actually
respects this. Even worse, there were broken files around, which played
correctly with (in theory) broken software, but not mplayer2/mpv. Hacks
were added to our code to play these files correctly, but they didn't
catch all cases.
Simplify this by doing what everyone else does, and always use the
decoder's sample rate instead. In particular, we try to handle all
sample rate issues like libavformat's Matroska demuxer does.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/decode/ad_lavc.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index e78e26f208..96d176eaa0 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -160,16 +160,12 @@ static int setup_format(sh_audio_t *sh_audio, struct priv *priv = sh_audio->context; int sample_format = af_from_avformat(av_get_packed_sample_fmt(lavc_context->sample_fmt)); - bool broken_srate = false; int samplerate = lavc_context->sample_rate; - int container_samplerate = sh_audio->container_out_samplerate; - if (!container_samplerate && sh_audio->wf) - container_samplerate = sh_audio->wf->nSamplesPerSec; - if (lavc_context->codec_id == AV_CODEC_ID_AAC - && samplerate == 2 * container_samplerate) - broken_srate = true; - else if (container_samplerate) - samplerate = container_samplerate; + // If not set, try container samplerate + if (!samplerate && sh_audio->wf) { + samplerate = sh_audio->wf->nSamplesPerSec; + mp_tmsg(MSGT_DECAUDIO, MSGL_V, "ad_lavc: using container rate.\n"); + } struct mp_chmap lavc_chmap; mp_chmap_from_lavc(&lavc_chmap, lavc_context->channel_layout); @@ -188,9 +184,6 @@ static int setup_format(sh_audio_t *sh_audio, sh_audio->samplerate = samplerate; sh_audio->sample_format = sample_format; sh_audio->samplesize = af_fmt2bits(sh_audio->sample_format) / 8; - if (broken_srate) - mp_msg(MSGT_DECAUDIO, MSGL_WARN, - "Ignoring broken container sample rate for AAC with SBR\n"); return 1; } return 0; |