From faea4ef439b92972e01cade158ca9bff839e297b Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sun, 21 Mar 2010 18:45:20 +0200 Subject: [PATCH] ad_ffmpeg: prefer codec to container samplerate for ffaac Container-level information can be unreliable for AAC because of SBR handling problems, so use the samplerate value from the codec instead. --- libmpcodecs/ad_ffmpeg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index b2cd4573bc..c954fb2311 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -142,7 +142,12 @@ static int init(sh_audio_t *sh_audio) mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Unsupported sample format\n"); return 0; } - if(sh_audio->wf){ + /* If the audio is AAC the container level data may be unreliable + * because of SBR handling problems (possibly half real sample rate at + * container level). Default AAC decoding with ad_faad has used codec-level + * values for a long time without generating complaints so it should be OK. + */ + if (sh_audio->wf && lavc_context->codec_id != CODEC_ID_AAC) { // If the decoder uses the wrong number of channels all is lost anyway. // sh_audio->channels=sh_audio->wf->nChannels; if (sh_audio->wf->nSamplesPerSec) -- 2.11.4.GIT