mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
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>
This commit is contained in:
parent
e05d2dd86a
commit
383057f8e7
3 changed files with 33 additions and 13 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue