<div dir="ltr"><div><div><div><div>Hi,<br></div>I'm having some troubles changing the source element while the pipeline is playing. More precisely, I'm trying with a very simplified test case: src ! videoconvert ! xvimagesink, where src element switches between 2 usb cameras in /dev/video0 and /dev/video1 (actually I also tested with only one camera and videotestsrc but nothing changes). <br></div>Every 10 secs the switching function is called:<br><br>static gboolean switchSrcVideo (gpointer user_data)<br>{<br>    GstData_t *gstData = (GstData_t*) user_data;<br>    GstElement *next;<br>    <br>    GstBus *bus_new = NULL;<br>    <br>    if(gstData->bus != NULL)<br>    {<br>        gst_bus_remove_signal_watch (gstData->bus);<br>        gstData->bus = NULL;<br>    }<br>    <br>    if( !strcmp(GST_OBJECT_NAME (gstData->src),"camera1") )<br>    {<br>        next = gstData->v4lcamera;<br>    }<br>    else if( !strcmp(GST_OBJECT_NAME (gstData->src),"camera2"))<br>    {<br>        next = gstData->testsrc; <br>    }<br><br>    g_print ("Switch from ’%s’ to ’%s’..\n", GST_OBJECT_NAME (gstData->src), GST_OBJECT_NAME (next));<br><br>    g_print("set NULL state to src..\n");<br>    gst_element_set_state (gstData->src, GST_STATE_NULL);<br>    <br>    g_print("unlink src from conv..\n");<br>    gst_element_unlink(gstData->src, gstData->conv);<br><br>    g_print("remove src..\n");<br>    gst_bin_remove (GST_BIN (gstData->pipeline), gstData->src);<br>    <br>       <br>    g_print("add next..\n");<br>    gst_bin_add (GST_BIN (gstData->pipeline), next);<br>    <br>    g_print("link next to conv..\n");<br>    gst_element_link_many ( next, gstData->conv, /*gstData->videoscale, gstData->sink,*/ NULL);<br>        <br>//     g_print("add signal watch again..\n");<br>//     bus_new = gst_pipeline_get_bus (GST_PIPELINE (gstData->pipeline));<br>//     if(bus_new!=NULL)<br>//     {<br>//          gst_bus_add_signal_watch (bus_new);<br>//          g_signal_connect (bus_new, "message::error", G_CALLBACK (cb_message_error), NULL);<br>//         gstData->bus = bus_new;<br>//     }<br><br>    g_print("set PLAY state to next..\n");<br>    gst_element_set_state (next, GST_STATE_PLAYING);<br><br>    gstData->src = next;<br><br>    g_print("..done!\n");<br><br>    return TRUE;<br>}<br><br></div>With the above code all work perfectly but, if I uncomment the signal watch part, then only the first switch (camera1 -> camera2) is performed and, when it attempts to switch again, the following message comes out:<br><br>[Invalid UTF-8] <br>Switch from \xe2\x80\x99camera2\xe2\x80\x99 to \xe2\x80\x99@y\x93\xe2\x80\x99..<br><br></div>I also noted that the problem occurs when I simply call gst_pipeline_get_bus (GST_PIPELINE (gstData->pipeline)) keeping commented the lines below.<br><div> <br></div></div>