[FFmpeg-cvslog] avformat/utils: Check avcodec_open2() return code in av_find_stream_info()

Michael Niedermayer git at videolan.org
Wed Dec 11 20:39:51 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Dec 11 20:30:21 2013 +0100| [81c1197494f5b9c10453e3bb1dd37f35e9742877] | committer: Michael Niedermayer

avformat/utils: Check avcodec_open2() return code in av_find_stream_info()

Fixes CID1135750

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

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

 libavformat/utils.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index fc4de4c..838ee18 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2857,15 +2857,16 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
 
         /* Ensure that subtitle_header is properly set. */
         if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE
-            && codec && !st->codec->codec)
-            avcodec_open2(st->codec, codec, options ? &options[i]
-                              : &thread_opt);
+            && codec && !st->codec->codec) {
+            if (avcodec_open2(st->codec, codec, options ? &options[i] : &thread_opt) < 0)
+                av_log(ic, AV_LOG_WARNING, "Failed to open codec in av_find_stream_info\n");
+        }
 
         //try to just open decoders, in case this is enough to get parameters
         if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) {
             if (codec && !st->codec->codec)
-                avcodec_open2(st->codec, codec, options ? &options[i]
-                              : &thread_opt);
+                if (avcodec_open2(st->codec, codec, options ? &options[i] : &thread_opt) < 0)
+                    av_log(ic, AV_LOG_WARNING, "Failed to open codec in av_find_stream_info\n");
         }
         if (!options)
             av_dict_free(&thread_opt);



More information about the ffmpeg-cvslog mailing list