Skip to content

Commit

Permalink
Release frame data as soon as possible
Browse files Browse the repository at this point in the history
During a frame swap, one of the two frames involved can be released.
  • Loading branch information
rom1v committed Mar 6, 2021
1 parent 386f017 commit eb7e107
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/video_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ video_buffer_producer_offer_frame(struct video_buffer *vb) {
}
}

av_frame_unref(vb->pending_frame);
swap_frames(&vb->producer_frame, &vb->pending_frame);

bool skipped = !vb->pending_frame_consumed;
Expand All @@ -122,6 +123,7 @@ video_buffer_consumer_take_frame(struct video_buffer *vb) {
vb->pending_frame_consumed = true;

swap_frames(&vb->consumer_frame, &vb->pending_frame);
av_frame_unref(vb->pending_frame);

if (vb->wait_consumer) {
// unblock video_buffer_offer_decoded_frame()
Expand Down

0 comments on commit eb7e107

Please sign in to comment.