mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 13:38:48 +00:00
nvenc: release the frames and list when searching for an output buffer
Fixes a massive leak in: videotestsrc ! nvh264enc ! fakesink
This commit is contained in:
parent
c086540291
commit
b48049a171
1 changed files with 14 additions and 4 deletions
|
@ -511,23 +511,33 @@ gst_nv_base_enc_finalize (GObject * obj)
|
||||||
static GstVideoCodecFrame *
|
static GstVideoCodecFrame *
|
||||||
_find_frame_with_output_buffer (GstNvBaseEnc * nvenc, NV_ENC_OUTPUT_PTR out_buf)
|
_find_frame_with_output_buffer (GstNvBaseEnc * nvenc, NV_ENC_OUTPUT_PTR out_buf)
|
||||||
{
|
{
|
||||||
GList *l = gst_video_encoder_get_frames (GST_VIDEO_ENCODER (nvenc));
|
GList *l, *walk = gst_video_encoder_get_frames (GST_VIDEO_ENCODER (nvenc));
|
||||||
|
GstVideoCodecFrame *ret = NULL;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (; l; l = l->next) {
|
for (l = walk; l; l = l->next) {
|
||||||
GstVideoCodecFrame *frame = (GstVideoCodecFrame *) l->data;
|
GstVideoCodecFrame *frame = (GstVideoCodecFrame *) l->data;
|
||||||
struct frame_state *state = frame->user_data;
|
struct frame_state *state = frame->user_data;
|
||||||
|
|
||||||
|
if (!state)
|
||||||
|
continue;
|
||||||
|
|
||||||
for (i = 0; i < N_BUFFERS_PER_FRAME; i++) {
|
for (i = 0; i < N_BUFFERS_PER_FRAME; i++) {
|
||||||
|
|
||||||
if (!state->out_bufs[i])
|
if (!state->out_bufs[i])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (state->out_bufs[i] == out_buf)
|
if (state->out_bufs[i] == out_buf)
|
||||||
return frame;
|
ret = frame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
if (ret)
|
||||||
|
gst_video_codec_frame_ref (ret);
|
||||||
|
|
||||||
|
g_list_free_full (walk, (GDestroyNotify) gst_video_codec_frame_unref);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
|
|
Loading…
Reference in a new issue