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:
@@ -63,8 +63,9 @@ video_buffer_swap_frames(struct video_buffer *vb) {
|
||||
vb->rendering_frame = tmp;
|
||||
}
|
||||
|
||||
bool
|
||||
video_buffer_offer_decoded_frame(struct video_buffer *vb) {
|
||||
void
|
||||
video_buffer_offer_decoded_frame(struct video_buffer *vb,
|
||||
bool *previous_frame_skipped) {
|
||||
mutex_lock(vb->mutex);
|
||||
#ifndef SKIP_FRAMES
|
||||
// if SKIP_FRAMES is disabled, then the decoder must wait for the current
|
||||
@@ -80,11 +81,10 @@ video_buffer_offer_decoded_frame(struct video_buffer *vb) {
|
||||
|
||||
video_buffer_swap_frames(vb);
|
||||
|
||||
bool previous_frame_consumed = vb->rendering_frame_consumed;
|
||||
*previous_frame_skipped = !vb->rendering_frame_consumed;
|
||||
vb->rendering_frame_consumed = false;
|
||||
|
||||
mutex_unlock(vb->mutex);
|
||||
return previous_frame_consumed;
|
||||
}
|
||||
|
||||
const AVFrame *
|
||||
|
||||
Reference in New Issue
Block a user