diff mbox

[FFmpeg-devel] avformat/utils: Update codec_id before using it in the parser init

Message ID 20161008163229.13100-1-michael@niedermayer.cc
State Accepted
Commit 987690799dd86433bf98b897aaa4c8d93ade646d
Headers show

Commit Message

Michael Niedermayer Oct. 8, 2016, 4:32 p.m. UTC
Fixes assertion failure

Fixes: input.avi

Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/utils.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Michael Niedermayer Oct. 9, 2016, 10:29 p.m. UTC | #1
On Sat, Oct 08, 2016 at 06:32:29PM +0200, Michael Niedermayer wrote:
> Fixes assertion failure
> 
> Fixes: input.avi
> 
> Found-by: 连一汉 <lianyihan@360.cn>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/utils.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)

applied


[...]
diff mbox

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1aa3b50..8a51aea 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3383,6 +3383,17 @@  int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
             if (!avctx->time_base.num)
                 avctx->time_base = st->time_base;
         }
+
+        /* check if the caller has overridden the codec id */
+#if FF_API_LAVF_AVCTX
+FF_DISABLE_DEPRECATION_WARNINGS
+        if (st->codec->codec_id != st->internal->orig_codec_id) {
+            st->codecpar->codec_id   = st->codec->codec_id;
+            st->codecpar->codec_type = st->codec->codec_type;
+            st->internal->orig_codec_id = st->codec->codec_id;
+        }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
         // only for the split stuff
         if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE) && st->request_probe <= 0) {
             st->parser = av_parser_init(st->codecpar->codec_id);
@@ -3399,16 +3410,6 @@  int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
             }
         }
 
-        /* check if the caller has overridden the codec id */
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
-        if (st->codec->codec_id != st->internal->orig_codec_id) {
-            st->codecpar->codec_id   = st->codec->codec_id;
-            st->codecpar->codec_type = st->codec->codec_type;
-            st->internal->orig_codec_id = st->codec->codec_id;
-        }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
         if (st->codecpar->codec_id != st->internal->orig_codec_id)
             st->internal->orig_codec_id = st->codecpar->codec_id;