mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
gl: fix multi gl object leaks
1. fix FBO leaks in decide_allocation 2. fix texture leaks in decide_allocation and reset 3. fix texture leaks in FBO incomplete error path
This commit is contained in:
parent
7c62b9ceaa
commit
2ce11e4bac
5 changed files with 44 additions and 0 deletions
|
@ -197,6 +197,12 @@ gst_gl_effects_init_gl_resources (GstGLFilter * filter)
|
|||
gint i = 0;
|
||||
|
||||
for (i = 0; i < NEEDED_TEXTURES; i++) {
|
||||
|
||||
if (effects->midtexture[i]) {
|
||||
gl->DeleteTextures (1, &effects->midtexture[i]);
|
||||
effects->midtexture[i] = 0;
|
||||
}
|
||||
|
||||
gl->GenTextures (1, &effects->midtexture[i]);
|
||||
gl->BindTexture (GL_TEXTURE_2D, effects->midtexture[i]);
|
||||
gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8,
|
||||
|
|
|
@ -641,6 +641,12 @@ gst_gl_mixer_decide_allocation (GstGLMixer * mix, GstQuery * query)
|
|||
out_width = GST_VIDEO_INFO_WIDTH (&vagg->info);
|
||||
out_height = GST_VIDEO_INFO_HEIGHT (&vagg->info);
|
||||
|
||||
if (mix->fbo) {
|
||||
gst_gl_context_del_fbo (mix->context, mix->fbo, mix->depthbuffer);
|
||||
mix->fbo = 0;
|
||||
mix->depthbuffer = 0;
|
||||
}
|
||||
|
||||
if (!gst_gl_context_gen_fbo (mix->context, out_width, out_height,
|
||||
&mix->fbo, &mix->depthbuffer))
|
||||
goto context_error;
|
||||
|
|
|
@ -1137,6 +1137,9 @@ _init_convert_fbo (GstGLColorConvert * convert)
|
|||
if (!gst_gl_context_check_framebuffer_status (convert->context)) {
|
||||
gst_gl_context_set_error (convert->context,
|
||||
"GL framebuffer status incomplete");
|
||||
|
||||
gl->DeleteTextures (1, &fake_texture);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,6 +268,17 @@ gst_gl_filter_reset (GstGLFilter * filter)
|
|||
gst_gl_context_del_fbo (filter->context, filter->fbo,
|
||||
filter->depthbuffer);
|
||||
}
|
||||
|
||||
if (filter->in_tex_id) {
|
||||
gst_gl_context_del_texture (filter->context, &filter->in_tex_id);
|
||||
filter->in_tex_id = 0;
|
||||
}
|
||||
|
||||
if (filter->out_tex_id) {
|
||||
gst_gl_context_del_texture (filter->context, &filter->out_tex_id);
|
||||
filter->out_tex_id = 0;
|
||||
}
|
||||
|
||||
gst_object_unref (filter->context);
|
||||
filter->context = NULL;
|
||||
}
|
||||
|
@ -1070,6 +1081,21 @@ gst_gl_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query)
|
|||
out_width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
|
||||
out_height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
|
||||
|
||||
if (filter->fbo) {
|
||||
gst_gl_context_del_fbo (filter->context, filter->fbo, filter->depthbuffer);
|
||||
filter->fbo = 0;
|
||||
filter->depthbuffer = 0;
|
||||
}
|
||||
|
||||
if (filter->in_tex_id) {
|
||||
gst_gl_context_del_texture (filter->context, &filter->in_tex_id);
|
||||
filter->in_tex_id = 0;
|
||||
}
|
||||
|
||||
if (filter->out_tex_id) {
|
||||
gst_gl_context_del_texture (filter->context, &filter->out_tex_id);
|
||||
filter->out_tex_id = 0;
|
||||
}
|
||||
//blocking call, generate a FBO
|
||||
if (!gst_gl_context_gen_fbo (filter->context, out_width, out_height,
|
||||
&filter->fbo, &filter->depthbuffer))
|
||||
|
|
|
@ -149,6 +149,9 @@ gst_gl_framebuffer_generate (GstGLFramebuffer * frame, gint width, gint height,
|
|||
if (gl->CheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
gst_gl_context_set_error (frame->context,
|
||||
"GL framebuffer status incomplete");
|
||||
|
||||
gl->DeleteTextures (1, &fake_texture);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue