[FFmpeg-cvslog] libspeex: allow custom sample rates again.

Reimar Döffinger git at videolan.org
Mon Dec 3 19:59:41 CET 2012


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Wed Nov 28 16:39:07 2012 +0100| [e2fc6a01f66243da458cdb9352f35f87dd6cad34] | committer: Reimar Döffinger

libspeex: allow custom sample rates again.

This was broken by 3b061c5e10f78caaf3b2a45cf7a92e50d4d20bfb
Fixes trac issue #1974.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2fc6a01f66243da458cdb9352f35f87dd6cad34
---

 libavcodec/libspeexdec.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
index deed7e9..935bebb 100644
--- a/libavcodec/libspeexdec.c
+++ b/libavcodec/libspeexdec.c
@@ -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 */



More information about the ffmpeg-cvslog mailing list