Expose skipped frames to the consumer

A skipped frame is detected when the producer offers a frame while the
current pending frame has not been consumed.

However, the producer (in practice the decoder) is not interested in the
fact that a frame has been skipped, only the consumer (the renderer) is.
Therefore, expose the skipped count in consumer_take_frame() instead of
a flag in the producer_offer_frame().

This allows to manage the skipped and rendered frames count at the same
place, and remove fps_counter from decoder.
This commit is contained in:
Romain Vimont
2021-02-19 22:31:44 +01:00
parent b1c7c71160
commit 6627459cc5
8 changed files with 31 additions and 26 deletions

View File

@@ -453,8 +453,11 @@ update_texture(struct screen *screen, const AVFrame *frame) {
static bool
screen_update_frame(struct screen *screen) {
const AVFrame *frame = video_buffer_consumer_take_frame(screen->vb);
unsigned skipped;
const AVFrame *frame =
video_buffer_consumer_take_frame(screen->vb, &skipped);
fps_counter_add_skipped_frames(screen->fps_counter, skipped);
fps_counter_add_rendered_frame(screen->fps_counter);
struct size new_frame_size = {frame->width, frame->height};