History

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.

Stefano Sabatini committed 15 years ago

Commit e4841a41 parent cea87fb1 file · +7 −15Browse files

Unified · Split

ffmpeg.c+7−15
@@ -1656,21 +1656,6 @@ static int output_packet(AVInputStream *ist, int ist_index, · 1655 unmodified lines
16561656 avpkt.size = 0;
16571657 }
16581658
1659−#if CONFIG_AVFILTER
1660− if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
1661− for(i=0;i<nb_ostreams;i++) {
1662− ost = ost_table[i];
1663− if (ost->input_video_filter && ost->source_index == ist_index) {
1664− if (!picture.sample_aspect_ratio.num)
1665− picture.sample_aspect_ratio = ist->st->sample_aspect_ratio;
1666− picture.pts = ist->pts;
1667−
1668− av_vsrc_buffer_add_frame(ost->input_video_filter, &picture);
1669− }
1670− }
1671− }
1672−#endif
1673−
16741659 // preprocess audio (volume)
16751660 if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
16761661 if (audio_volume != 256) {
@@ -1701,6 +1686,13 @@ static int output_packet(AVInputStream *ist, int ist_index, · 24 unmodified lines
17011686 ost = ost_table[i];
17021687 if (ost->source_index == ist_index) {
17031688 #if CONFIG_AVFILTER
1689+ if (ost->input_video_filter) {
1690+ if (!picture.sample_aspect_ratio.num)
1691+ picture.sample_aspect_ratio = ist->st->sample_aspect_ratio;
1692+ picture.pts = ist->pts;
1693+
1694+ av_vsrc_buffer_add_frame(ost->input_video_filter, &picture);
1695+ }
17041696 frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO ||
17051697 !ost->output_video_filter || avfilter_poll_frame(ost->output_video_filter->inputs[0]);
17061698 while (frame_available) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t