[FFmpeg-cvslog] avformat/utils: Open decoder even if there are no packets if parameters are missing

Michael Niedermayer git at videolan.org
Thu Jun 9 19:42:07 CEST 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun  9 19:11:18 2016 +0200| [218bb8b3f370c00b2dba2e6bb1ce4628e6870ad5] | committer: Michael Niedermayer

avformat/utils: Open decoder even if there are no packets if parameters are missing

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index db699de..ff52b52 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3602,14 +3602,23 @@ FF_ENABLE_DEPRECATION_WARNINGS
         count++;
     }
 
-    if (eof_reached && ic->internal->packet_buffer) {
+    if (eof_reached) {
         int stream_index;
         for (stream_index = 0; stream_index < ic->nb_streams; stream_index++) {
             st = ic->streams[stream_index];
+            avctx = st->internal->avctx;
+            if (!has_codec_parameters(st, NULL)) {
+                AVCodec *codec = find_decoder(ic, st, st->codecpar->codec_id);
+                if (codec && !avctx->codec) {
+                    if (avcodec_open2(avctx, codec, (options && stream_index < orig_nb_streams) ? &options[stream_index] : NULL) < 0)
+                        av_log(ic, AV_LOG_WARNING,
+                            "Failed to open codec in av_find_stream_info\n");
+                }
+            }
 
             // EOF already reached while reading the stream above.
             // So continue with reoordering DTS with whatever delay we have.
-            if (!has_decode_delay_been_guessed(st)) {
+            if (ic->internal->packet_buffer && !has_decode_delay_been_guessed(st)) {
                 update_dts_from_pts(ic, stream_index, ic->internal->packet_buffer);
             }
         }



More information about the ffmpeg-cvslog mailing list