When AVFMT_FLAG_NOBUFFER is set, the packets are not added to the
AVFormatContext packet list, so they need to be freed when they are
no longer needed.
---
 libavformat/utils.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 83c8fe1..15346c5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2319,6 +2319,8 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
             if (av_rescale_q(pkt->dts - st->info->fps_first_dts, st->time_base,
                              AV_TIME_BASE_Q) >= ic->max_analyze_duration) {
                 av_log(ic, AV_LOG_WARNING, "max_analyze_duration reached\n");
+                if (ic->flags & AVFMT_FLAG_NOBUFFER)
+                    av_free_packet(pkt);
                 break;
             }
         }
@@ -2345,6 +2347,9 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
         */
         try_decode_frame(st, pkt, (options && i < orig_nb_streams ) ? 
&options[i] : NULL);
 
+        if (ic->flags & AVFMT_FLAG_NOBUFFER)
+            av_free_packet(pkt);
+
         st->codec_info_nb_frames++;
         count++;
     }
-- 
1.8.1.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to