Use explicit output parameter for skipped frame

The function video_buffer_offer_decoded_frame() returned a bool to
indicate whether the previous frame had been consumed.

This was confusing, because we could expect the returned bool report
whether the action succeeded.

Make the semantic explicit by using an output parameter.

Also revert the flag (report if the frame has been skipped instead of
consumed) to avoid confusion for the first frame (the previous is
neither skipped nor consumed because there is no previous frame).
This commit is contained in:
Romain Vimont
2019-03-03 00:26:48 +01:00
parent 9ef345fdd0
commit 8595862005
3 changed files with 12 additions and 10 deletions

View File

@@ -20,9 +20,10 @@
// set the decoded frame as ready for rendering, and notify
static void
push_frame(struct decoder *decoder) {
bool previous_frame_consumed =
video_buffer_offer_decoded_frame(decoder->video_buffer);
if (!previous_frame_consumed) {
bool previous_frame_skipped;
video_buffer_offer_decoded_frame(decoder->video_buffer,
&previous_frame_skipped);
if (previous_frame_skipped) {
// the previous EVENT_NEW_FRAME will consume this frame
return;
}