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:
Nicolas George
2017-01-29 10:10:40 +01:00
parent e05d2dd86a
commit 383057f8e7
3 changed files with 33 additions and 13 deletions
+5 -6
View File
@@ -161,14 +161,13 @@ static inline void ff_framequeue_update_peeked(FFFrameQueue *fq, size_t idx)
}
/**
* Update the sample count in the queue.
* Skip samples from the first frame in the queue.
*
* This function must be used when the first frame was accessed using
* ff_framequeue_peek() and samples were removed from it.
* ff_framequeue_peek() and samples were consumed from it.
* It adapts the data pointers and timestamps of the head frame to account
* for the skipped samples.
*/
static inline void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t n)
{
fq->total_samples_tail += n;
}
void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t samples, AVRational time_base);
#endif /* AVFILTER_FRAMEQUEUE_H */