mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-24 10:14:13 -05:00
shared/media-playback: Unref sw_frame before reuse
By not performing an unref on sw_frame before using it again, a memory "leak" was being created if the frame had side data. This removes a previously-added check that optionally unrefs sw_frame, and just does it every tick. Co-authored-by: pkviet <pkv@obsproject.com>
This commit is contained in:
committed by
Lain
co-authored by
pkviet
parent
19abab097d
commit
7b2a6351b0
@@ -337,16 +337,7 @@ static int decode_packet(struct mp_decode *d, int *got_frame)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* does not check for color format or other parameter changes which would require frame buffer realloc */
|
||||
if (d->sw_frame->data[0] &&
|
||||
(d->sw_frame->width != d->hw_frame->width ||
|
||||
d->sw_frame->height != d->hw_frame->height)) {
|
||||
blog(LOG_DEBUG,
|
||||
"MP: hardware frame size changed from %dx%d to %dx%d. reallocating frame",
|
||||
d->sw_frame->width, d->sw_frame->height,
|
||||
d->hw_frame->width, d->hw_frame->height);
|
||||
av_frame_unref(d->sw_frame);
|
||||
}
|
||||
av_frame_unref(d->sw_frame);
|
||||
|
||||
int err = av_hwframe_transfer_data(d->sw_frame, d->hw_frame, 0);
|
||||
if (err == 0) {
|
||||
|
||||
Reference in New Issue
Block a user