changeset 32390:b33aed46ecda

Avoid printing AAC with SBR warning on every decode call, instead print it only after every decoder reconfiguration.
author reimar
date Sat, 09 Oct 2010 17:52:35 +0000
parents 4fb3f810de30
children b4c3659d16b1
files libmpcodecs/ad_ffmpeg.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c	Sat Oct 09 15:55:09 2010 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Sat Oct 09 17:52:35 2010 +0000
@@ -55,6 +55,7 @@
 
 static int setup_format(sh_audio_t *sh_audio, const AVCodecContext *lavc_context)
 {
+    int broken_srate = 0;
     int samplerate    = lavc_context->sample_rate;
     int sample_format = sh_audio->sample_format;
     switch (lavc_context->sample_fmt) {
@@ -71,8 +72,7 @@
 
         if (lavc_context->codec_id == CODEC_ID_AAC &&
             samplerate == 2*sh_audio->wf->nSamplesPerSec) {
-            mp_msg(MSGT_DECAUDIO, MSGL_WARN,
-                   "Ignoring broken container sample rate for AAC with SBR\n");
+            broken_srate = 1;
         } else if (sh_audio->wf->nSamplesPerSec)
             samplerate=sh_audio->wf->nSamplesPerSec;
     }
@@ -83,6 +83,9 @@
         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;