Release frame data as soon as possible
During a frame swap, one of the two frames involved can be released.
This commit is contained in:
parent
86ae6955c6
commit
9e737a1bef
@ -92,6 +92,7 @@ video_buffer_producer_offer_frame(struct video_buffer *vb) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
av_frame_unref(vb->pending_frame);
|
||||||
swap_frames(&vb->producer_frame, &vb->pending_frame);
|
swap_frames(&vb->producer_frame, &vb->pending_frame);
|
||||||
|
|
||||||
bool skipped = !vb->pending_frame_consumed;
|
bool skipped = !vb->pending_frame_consumed;
|
||||||
@ -117,6 +118,7 @@ video_buffer_consumer_take_frame(struct video_buffer *vb, unsigned *skipped) {
|
|||||||
vb->pending_frame_consumed = true;
|
vb->pending_frame_consumed = true;
|
||||||
|
|
||||||
swap_frames(&vb->consumer_frame, &vb->pending_frame);
|
swap_frames(&vb->consumer_frame, &vb->pending_frame);
|
||||||
|
av_frame_unref(vb->pending_frame);
|
||||||
|
|
||||||
if (vb->wait_consumer) {
|
if (vb->wait_consumer) {
|
||||||
// unblock video_buffer_offer_decoded_frame()
|
// unblock video_buffer_offer_decoded_frame()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user