[FFmpeg-cvslog] Move code for "ffmpeg: fix massive leak occurring when seeking" / e4841a404bdabfeafb917454d510b60d888cb761 elsewhere

Michael Niedermayer git at videolan.org
Mon Jun 6 04:47:26 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jun  6 04:03:09 2011 +0200| [580817df048fb114529cdb4a82885f551bf62c0c] | committer: Michael Niedermayer

Move code for "ffmpeg: fix massive leak occurring when seeking" / e4841a404bdabfeafb917454d510b60d888cb761 elsewhere

The picture struct is written to in the loop, so this cannot work.

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

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

 ffmpeg.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index b18224b..995c6c1 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1656,6 +1656,22 @@ static int output_packet(AVInputStream *ist, int ist_index,
             avpkt.size = 0;
         }
 
+#if CONFIG_AVFILTER
+        if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
+        if (start_time == 0 || ist->pts >= start_time) {
+            for(i=0;i<nb_ostreams;i++) {
+                ost = ost_table[i];
+                if (ost->input_video_filter && ost->source_index == ist_index) {
+                    if (!picture.sample_aspect_ratio.num)
+                        picture.sample_aspect_ratio = ist->st->sample_aspect_ratio;
+                    picture.pts = ist->pts;
+
+                    av_vsrc_buffer_add_frame(ost->input_video_filter, &picture, AV_VSRC_BUF_FLAG_OVERWRITE);
+                }
+            }
+        }
+#endif
+
         // preprocess audio (volume)
         if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
             if (audio_volume != 256) {
@@ -1686,14 +1702,6 @@ static int output_packet(AVInputStream *ist, int ist_index,
                 ost = ost_table[i];
                 if (ost->source_index == ist_index) {
 #if CONFIG_AVFILTER
-                if (ost->input_video_filter) {
-                    if (!picture.sample_aspect_ratio.num)
-                         picture.sample_aspect_ratio = ist->st->sample_aspect_ratio;
-                    picture.pts = ist->pts;
-
-                    av_vsrc_buffer_add_frame(ost->input_video_filter,
-                                             &picture, AV_VSRC_BUF_FLAG_OVERWRITE);
-                }
                 frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO ||
                     !ost->output_video_filter || avfilter_poll_frame(ost->output_video_filter->inputs[0]);
                 while (frame_available) {



More information about the ffmpeg-cvslog mailing list