glimagesink: Properly handle compsositor life time

Should be created in READY_TO_PAUSED, not PAUSED_TO_PLAYING.
Should be cleared in PAUSED_TO_READY.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
This commit is contained in:
Nicolas Dufresne 2015-07-21 18:47:56 -04:00
parent 3bf12a1b9f
commit e8c31619c4

View file

@ -623,9 +623,6 @@ gst_glimage_sink_finalize (GObject * object)
g_return_if_fail (GST_IS_GLIMAGE_SINK (object));
glimage_sink = GST_GLIMAGE_SINK (object);
gst_object_unref (glimage_sink->overlay_compositor);
g_mutex_clear (&glimage_sink->drawing_lock);
GST_DEBUG ("finalized");
@ -912,11 +909,12 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
if (!_ensure_gl_setup (glimage_sink))
return GST_STATE_CHANGE_FAILURE;
glimage_sink->overlay_compositor =
gst_gl_overlay_compositor_new (glimage_sink->context);
g_atomic_int_set (&glimage_sink->to_quit, 0);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
glimage_sink->overlay_compositor =
gst_gl_overlay_compositor_new (glimage_sink->context);
break;
default:
break;
@ -986,6 +984,9 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
g_signal_handler_disconnect (window, glimage_sink->mouse_sig_id);
glimage_sink->mouse_sig_id = 0;
gst_object_unref (glimage_sink->overlay_compositor);
glimage_sink->overlay_compositor = NULL;
gst_object_unref (window);
gst_object_unref (glimage_sink->context);
glimage_sink->context = NULL;
@ -1285,7 +1286,6 @@ prepare_next_buffer (GstGLImageSink * glimage_sink)
info = &glimage_sink->in_info;
}
if (glimage_sink->overlay_compositor)
gst_gl_overlay_compositor_upload_overlays (glimage_sink->overlay_compositor,
next_buffer, glimage_sink->attr_position, glimage_sink->attr_texture,
glimage_sink->window_width, glimage_sink->window_height);
@ -1880,7 +1880,6 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
if (gl_sink->overlay_compositor)
gst_gl_overlay_compositor_draw_overlays (gl_sink->overlay_compositor,
gl_sink->redisplay_shader);