changeset 17995:92c4247cc902

Trust the demuxer instead of the decoder for samplerate detection. Fixes the ffmp3_bad_rate_detection.avi sample. patch by qwen dux qwendu__at__gmail__.__com
author diego
date Thu, 30 Mar 2006 08:47:09 +0000
parents 6927fabaef92
children ef5993b66969
files libmpcodecs/ad_ffmpeg.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c	Thu Mar 30 06:40:58 2006 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Thu Mar 30 08:47:09 2006 +0000
@@ -109,15 +109,14 @@
    x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size);
    if(x>0) sh_audio->a_buffer_len=x;
 
-#if 1
   sh_audio->channels=lavc_context->channels;
   sh_audio->samplerate=lavc_context->sample_rate;
   sh_audio->i_bps=lavc_context->bit_rate/8;
-#else
-  sh_audio->channels=sh_audio->wf->nChannels;
-  sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
-  sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
-#endif
+  if(sh_audio->wf){
+      sh_audio->channels=sh_audio->wf->nChannels;
+      sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
+      sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
+  }
   sh_audio->samplesize=2;
   return 1;
 }