]> git.sesse.net Git - vlc/commitdiff
Fixed support of G726.
authorLaurent Aimar <fenrir@videolan.org>
Sat, 12 May 2012 18:59:35 +0000 (20:59 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 23 May 2012 20:00:59 +0000 (22:00 +0200)
The bit per samples must be exact for the avcodec decoder.
It closes #6799.

modules/codec/avcodec/avcodec.c

index 4eefc7155b38c80d0c7731454828ee37668912de..d91793fc4daf011a9254af5e934511df8b1f5edd 100644 (file)
@@ -463,6 +463,11 @@ int ffmpeg_OpenCodec( decoder_t *p_dec )
         p_sys->p_context->block_align = p_dec->fmt_in.audio.i_blockalign;
         p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
         p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.audio.i_bitspersample;
+        if( p_sys->i_codec_id == CODEC_ID_ADPCM_G726 &&
+            p_sys->p_context->bit_rate > 0 &&
+            p_sys->p_context->sample_rate >  0)
+            p_sys->p_context->bits_per_coded_sample = p_sys->p_context->bit_rate /
+                                                      p_sys->p_context->sample_rate;
     }
     int ret;
     vlc_avcodec_lock();