]> git.sesse.net Git - ffmpeg/commitdiff
libspeex: allow custom sample rates again.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Wed, 28 Nov 2012 15:39:07 +0000 (16:39 +0100)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Mon, 3 Dec 2012 18:59:04 +0000 (19:59 +0100)
This was broken by 3b061c5e10f78caaf3b2a45cf7a92e50d4d20bfb
Fixes trac issue #1974.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
libavcodec/libspeexdec.c

index deed7e9eb59986f7e939e234a76668673d857710..935bebb1cedaf115a6f46a467729c705c20998d6 100644 (file)
@@ -51,6 +51,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
             av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n");
     }
     if (header) {
+        avctx->sample_rate = header->rate;
         avctx->channels    = header->nb_channels;
         spx_mode           = header->mode;
         speex_header_free(header);
@@ -73,8 +74,9 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", spx_mode);
         return AVERROR_INVALIDDATA;
     }
-    avctx->sample_rate = 8000 << spx_mode;
     s->frame_size      =  160 << spx_mode;
+    if (!avctx->sample_rate)
+        avctx->sample_rate = 8000 << spx_mode;
 
     if (avctx->channels < 1 || avctx->channels > 2) {
         /* libspeex can handle mono or stereo if initialized as stereo */