[FFmpeg-cvslog] flvdec: Check avpriv_mpeg4audio_get_config() return

Michael Niedermayer git at videolan.org
Sat Dec 31 05:20:03 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Dec 31 03:39:22 2011 +0100| [5500e65342a2afc5caa8fe38496aa1a3b1f28cbc] | committer: Michael Niedermayer

flvdec: Check avpriv_mpeg4audio_get_config() return

value before using its output.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/flvdec.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 2ebef63..1fdcc4d 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -591,8 +591,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
                 return ret;
             if (st->codec->codec_id == CODEC_ID_AAC) {
                 MPEG4AudioConfig cfg;
-                avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
-                                             st->codec->extradata_size * 8, 1);
+                if (avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
+                                             st->codec->extradata_size * 8, 1) >= 0) {
                 st->codec->channels = cfg.channels;
                 if (cfg.ext_sample_rate)
                     st->codec->sample_rate = cfg.ext_sample_rate;
@@ -600,6 +600,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
                     st->codec->sample_rate = cfg.sample_rate;
                 av_dlog(s, "mp4a config channels %d sample rate %d\n",
                         st->codec->channels, st->codec->sample_rate);
+                }
             }
 
             ret = AVERROR(EAGAIN);



More information about the ffmpeg-cvslog mailing list