Instead of just updating statistics and leaving the work to the call site, have it actually do the work.
Showing the changes to libavfilter/avfilter.c (1 of 3 files). Show all
Unified · Split
| @@ -1235,13 +1235,7 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max, · 1234 unmodified lines | ||
| 1235 | 1235 | frame = ff_framequeue_peek(&link->fifo, 0); |
| 1236 | 1236 | av_samples_copy(buf->extended_data, frame->extended_data, p, 0, n, |
| 1237 | 1237 | link->channels, link->format); |
| 1238 | − frame->nb_samples -= n; | |
| 1239 | − av_samples_copy(frame->extended_data, frame->extended_data, 0, n, | |
| 1240 | − frame->nb_samples, link->channels, link->format); | |
| 1241 | − if (frame->pts != AV_NOPTS_VALUE) | |
| 1242 | − frame->pts += av_rescale_q(n, av_make_q(1, link->sample_rate), link->time_base); | |
| 1243 | − ff_framequeue_update_peeked(&link->fifo, 0); | |
| 1244 | − ff_framequeue_skip_samples(&link->fifo, n); | |
| 1238 | + ff_framequeue_skip_samples(&link->fifo, n, link->time_base); | |
| 1245 | 1239 | } |
| 1246 | 1240 | |
| 1247 | 1241 | *rframe = buf; |