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.
Unified · Split
| @@ -1656,21 +1656,6 @@ static int output_packet(AVInputStream *ist, int ist_index, · 1655 unmodified lines | ||
| 1656 | 1656 | avpkt.size = 0; |
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 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 | − | |
| 1674 | 1659 | // preprocess audio (volume) |
| 1675 | 1660 | if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { |
| 1676 | 1661 | if (audio_volume != 256) { |
| @@ -1701,6 +1686,13 @@ static int output_packet(AVInputStream *ist, int ist_index, · 24 unmodified lines | ||
| 1701 | 1686 | ost = ost_table[i]; |
| 1702 | 1687 | if (ost->source_index == ist_index) { |
| 1703 | 1688 | #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 | + } | |
| 1704 | 1696 | frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO || |
| 1705 | 1697 | !ost->output_video_filter || avfilter_poll_frame(ost->output_video_filter->inputs[0]); |
| 1706 | 1698 | while (frame_available) { |