libgsmdec: fix decoding of non 8khz gsm files
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 2 Nov 2012 23:40:19 +0000 (00:40 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 2 Nov 2012 23:50:22 +0000 (00:50 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/libgsm.c

index 0ce174a..e90bdf0 100644 (file)
@@ -156,7 +156,8 @@ static av_cold int libgsm_decode_init(AVCodecContext *avctx) {
 
     avctx->channels       = 1;
     avctx->channel_layout = AV_CH_LAYOUT_MONO;
 
     avctx->channels       = 1;
     avctx->channel_layout = AV_CH_LAYOUT_MONO;
-    avctx->sample_rate    = 8000;
+    if (!avctx->sample_rate)
+        avctx->sample_rate = 8000;
     avctx->sample_fmt     = AV_SAMPLE_FMT_S16;
 
     s->state = gsm_create();
     avctx->sample_fmt     = AV_SAMPLE_FMT_S16;
 
     s->state = gsm_create();