summaryrefslogtreecommitdiff
path: root/libavfilter/avfilter.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2017-01-29 10:10:40 +0100
committerNicolas George <george@nsup.org>2017-01-29 18:53:11 +0100
commit383057f8e744efeaaa3648a59bc577b25b055835 (patch)
tree03e096d662f3814c292e3a3a153a6a8bf7071730 /libavfilter/avfilter.c
parente05d2dd86abc2fdbadfc7ec9a84c22013be62da2 (diff)
lavfi: make ff_framequeue_skip_samples() more useful.
Instead of just updating statistics and leaving the work to the call site, have it actually do the work. Also: skip the samples by updating the frame data pointers instead of moving the samples. More efficient and avoid writing into shared frames. Found-By: Muhammad Faiz <mfcc64@gmail.com>
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c12d4912a8..b431990edc 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1235,13 +1235,7 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max,
frame = ff_framequeue_peek(&link->fifo, 0);
av_samples_copy(buf->extended_data, frame->extended_data, p, 0, n,
link->channels, link->format);
- frame->nb_samples -= n;
- av_samples_copy(frame->extended_data, frame->extended_data, 0, n,
- frame->nb_samples, link->channels, link->format);
- if (frame->pts != AV_NOPTS_VALUE)
- frame->pts += av_rescale_q(n, av_make_q(1, link->sample_rate), link->time_base);
- ff_framequeue_update_peeked(&link->fifo, 0);
- ff_framequeue_skip_samples(&link->fifo, n);
+ ff_framequeue_skip_samples(&link->fifo, n, link->time_base);
}
*rframe = buf;