[FFmpeg-cvslog] flvdec: Make sure sample_rate is set to the updated value

Martin Storsjö git at videolan.org
Fri May 25 00:52:46 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed May 23 16:28:25 2012 +0300| [1e8561e36931d6e2c4294702907ca0beb4cba3b6] | committer: Martin Storsjö

flvdec: Make sure sample_rate is set to the updated value

The sample_rate variable is used for checks for audio format
changes at the end of the function.

This fixes cases where the sample rate was set from the codec
id by flv_set_audio_codec (as for nellymoser 8 kHz/16 kHz),
so the value set to last_sample_rate wasn't equal to sample_rate
at this point. This caused the demuxer otherwise reports a spurious
change to 5512 Hz and back to the correct one.

Updating channels in the same way is only done for consistency.
Currently, flv_set_audio_codec doesn't update that value.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/flvdec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 7c4b792..b9d65a6 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -571,8 +571,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
         }
         if(!st->codec->codec_id){
             flv_set_audio_codec(s, st, st->codec, flags & FLV_AUDIO_CODECID_MASK);
-            flv->last_sample_rate = st->codec->sample_rate;
-            flv->last_channels    = st->codec->channels;
+            flv->last_sample_rate = sample_rate = st->codec->sample_rate;
+            flv->last_channels    = channels    = st->codec->channels;
         } else {
             AVCodecContext ctx;
             ctx.sample_rate = sample_rate;



More information about the ffmpeg-cvslog mailing list