mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-18 05:54:20 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user