Is it necessary to unref separately created videosink?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Is it necessary to unref separately created videosink?

wl2776
Administrator
I am using the following code to make gstreamer draw a video in area, which my application has created.

m_player = gst_element_factory_make("playbin2","playbin0");
m_videosink = gst_element_factory_make("directdrawsink","videosink");
if(m_videosink){
    g_object_set(m_videosink,"sync",TRUE,NULL);
    gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (m_videosink),m_hwnd);
    g_object_set(G_OBJECT(m_player),"video-sink",m_videosink,NULL);
}
m_loop = g_main_loop_new(NULL,FALSE);

Is my following destruction code correct?

g_main_loop_quit(m_loop);
gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_NULL);

gst_object_unref(m_player);
gst_object_unref(m_loop);

m_player=NULL;
m_videosink=NULL;
m_loop=NULL;

In other words, does playbin2 unref the videosink?
I tried also to unref it, before m_player, but seen the error message.