Dear all,<br><br>I had an odd problem with a QT application in windows that exploits gstreamer (OSSBUILD).<br><br>I have a QT widget that host a Gstreamer pipeline. This application is a kind of playlist player, so after the first video a second video should be displayed through the GNonLin library.<br>
<br>In Linux the program runs perfectly but in Windows it doesn't.<br><br>According to the GST_DEBUG log differences when the first video send the EOS signal the gnlcomposition freezes. As far as I understand, the problem could be the<br>
"gnlcomposition" element. In fact, the problem and solution is already identified in the problematic function under a FIXME comment.<br><br>/-----------------------------------------------/<br>gnlcomposition.c released code:<br>
<br>static gboolean<br>ghost_event_probe_handler (GstPad * ghostpad G_GNUC_UNUSED, GstEvent * event,<br> GnlComposition * comp)<br>{<br> gboolean keepit = TRUE;<br><br> GST_DEBUG_OBJECT (comp, "event: %s", GST_EVENT_TYPE_NAME (event));<br>
<br> switch (GST_EVENT_TYPE (event)) {<br> case GST_EVENT_NEWSEGMENT:{<br> COMP_FLUSHING_LOCK (comp);<br> if (comp->priv->pending_idle) {<br> GST_DEBUG_OBJECT (comp, "removing pending seek for main thread");<br>
g_source_remove (comp->priv->pending_idle);<br> }<br> comp->priv->pending_idle = 0;<br> comp->priv->flushing = FALSE;<br> COMP_FLUSHING_UNLOCK (comp);<br> }<br> break;<br>
case GST_EVENT_EOS:{<br> COMP_FLUSHING_LOCK (comp);<br> if (comp->priv->flushing) {<br> GST_DEBUG_OBJECT (comp, "flushing, bailing out");<br> COMP_FLUSHING_UNLOCK (comp);<br> keepit = FALSE;<br>
break;<br> }<br> COMP_FLUSHING_UNLOCK (comp);<br><br> GST_DEBUG_OBJECT (comp, "Adding eos handling to main thread");<br> if (comp->priv->pending_idle) {<br> GST_WARNING_OBJECT (comp,<br>
"There was already a pending eos in main thread !");<br> g_source_remove (comp->priv->pending_idle);<br> }<br><br> /* FIXME : This should be switched to using a g_thread_create() instead<br>
* of a g_idle_add(). EXTENSIVE TESTING AND ANALYSIS REQUIRED BEFORE<br> * DOING THE SWITCH !!! */<br> comp->priv->pending_idle =<br> g_idle_add ((GSourceFunc) eos_main_thread, (gpointer) comp);<br>
<br> keepit = FALSE;<br> }<br> break;<br> default:<br> break;<br> }<br><br> return keepit;<br>}<br>/-----------------------------------------------/<br><br>I think that this is the tricky point, because in the QT application I don't create any g_main_loop, so I think that g_idle_add doesn't work properly in this context in windows.<br>
<br>So for the problem is only for live performance (QT player), because when we simply create a file video with the performed result according to a defined timeline, through a g_main_loop for the pipeline, it works perfectly.<br>
<br>So please find below the proposed solution (already checked in Windows):<br><br>/-----------------------------------------------/<br>
gnlcomposition.c released code:<br>
<br>static gboolean<br>
ghost_event_probe_handler (GstPad * ghostpad G_GNUC_UNUSED, GstEvent * event,<br>
GnlComposition * comp)<br>
{<br>
gboolean keepit = TRUE;<br>
<br>
GST_DEBUG_OBJECT (comp, "event: %s", GST_EVENT_TYPE_NAME (event));<br>
<br>
switch (GST_EVENT_TYPE (event)) {<br>
case GST_EVENT_NEWSEGMENT:{<br>
COMP_FLUSHING_LOCK (comp);<br>
if (comp->priv->pending_idle) {<br>
GST_DEBUG_OBJECT (comp, "removing pending seek for main thread");<br>
g_source_remove (comp->priv->pending_idle);<br>
}<br>
comp->priv->pending_idle = 0;<br>
comp->priv->flushing = FALSE;<br>
COMP_FLUSHING_UNLOCK (comp);<br>
}<br>
break;<br>
case GST_EVENT_EOS:{<br>
COMP_FLUSHING_LOCK (comp);<br>
if (comp->priv->flushing) {<br>
GST_DEBUG_OBJECT (comp, "flushing, bailing out");<br>
COMP_FLUSHING_UNLOCK (comp);<br>
keepit = FALSE;<br>
break;<br>
}<br>
COMP_FLUSHING_UNLOCK (comp);<br>
<br>
GST_DEBUG_OBJECT (comp, "Adding eos handling to main thread");<br>
if (comp->priv->pending_idle) {<br>
GST_WARNING_OBJECT (comp,<br>
"There was already a pending eos in main thread !");<br>
//g_source_remove (comp->priv->pending_idle);<br> // FIXING<br> g_thread_join((GThread *)comp->priv->pending_idle);<br>
}<br>
<br>
/* FIXME : This should be switched to using a g_thread_create() instead<br>
* of a g_idle_add(). EXTENSIVE TESTING AND ANALYSIS REQUIRED BEFORE<br>
* DOING THE SWITCH !!! */<br>
//comp->priv->pending_idle =<br>
// g_idle_add ((GSourceFunc) eos_main_thread, (gpointer) comp);<br> // FIXING<br> comp->priv->pending_idle = <br> (guint)g_thread_create((GThreadFunc) eos_main_thread, (gpointer) comp, TRUE, NULL );<br>
<br>
keepit = FALSE;<br>
}<br>
break;<br>
default:<br>
break;<br>
}<br>
<br>
return keepit;<br>
}<br>
/-----------------------------------------------/<br><br>My feeling is that this change should fit in Linux and Windows developments.<br><br>
Thank you.<br><br>Best Regards.<br>
<br>
Angel<br clear="all"><br>-- <br><pre>Ángel Martín Navas<br>Investigador / Researcher<br>Televisión Digital y Servicios Multimedia / Digital TV & Multimedia Services<br><br>Vicomtech - Visual Interaction Communication Technologies<br>
Mikeletegi Pasealekua, 57 - Parque Tecnológico<br>20009 Donostia - San Sebastián - Spain<br>Tel: <a href="tel:%2B%5B34%5D%20943%2030%2092%2030" value="+34943309230" target="_blank">+[34] 943 30 92 30</a><br>Fax: <a href="tel:%2B%5B34%5D%20943%2030%2093%2093" value="+34943309393" target="_blank">+[34] 943 30 93 93</a><br>
e-mail: <a href="mailto:amartin@vicomtech.org" target="_blank">amartin@vicomtech.org</a><br>
<a href="http://www.vicomtech.org" target="_blank">www.vicomtech.org</a><br><br>*** member of IK4 Research Alliance ****<br><a href="http://www.ik4.es/" target="_blank">www.ik4.es</a><br>*** member of GraphicsMedia.net ****<br>
<a href="http://www.graphicsmedia.net" target="_blank">www.graphicsmedia.net</a><br><br><br><br>-----------------------------------------------------<br>Vicomtech is an ISO 9001:2000 certified institute<br>-----------------------------------------------------<br>
</pre>