diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-06-03 19:03:44 +0200 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-06-05 13:32:33 +0200 |
commit | e4841a404bdabfeafb917454d510b60d888cb761 (patch) | |
tree | 60b2f0daf2fb8f17ec64915da85431df35a6b591 | |
parent | cea87fb2c38f175b9a0bd2a46617c155e67d4794 (diff) | |
download | ffmpeg-e4841a404bdabfeafb917454d510b60d888cb761.tar.gz |
ffmpeg: fix massive leak occurring when seeking
Avoid to add frames to the vsrc_buffer in the case ist->pts <
start_time, as these frames are unused (and never released). In
particular this condition is verified with commands of the kind:
ffmpeg -i INPUT -ss TIME OUTPUT
Also allow a minor simplification.
-rw-r--r-- | ffmpeg.c | 22 |
1 files changed, 7 insertions, 15 deletions
@@ -1656,21 +1656,6 @@ static int output_packet(AVInputStream *ist, int ist_index, avpkt.size = 0; } -#if CONFIG_AVFILTER - if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - 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); - } - } - } -#endif - // preprocess audio (volume) if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if (audio_volume != 256) { @@ -1701,6 +1686,13 @@ 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); + } 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) { |