qmlglsrc: Fix deadlock when stopping

This fix makes sure that streaming thread stops waiting when the
qmlglsrc element transitions from playing to paused.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2115>
This commit is contained in:
Matthias Fuchs 2022-03-11 15:13:21 +01:00 committed by GStreamer Marge Bot
parent 80e83089b5
commit 42ec223f94
3 changed files with 15 additions and 0 deletions

View file

@ -513,6 +513,8 @@ gst_qt_src_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
if (qt_src->window)
qt_window_stop (qt_src->window);
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;

View file

@ -450,3 +450,15 @@ qt_window_use_default_fbo (QtGLWindow * qt_window, gboolean useDefaultFbo)
g_mutex_unlock (&qt_window->priv->lock);
}
void
qt_window_stop(QtGLWindow* qt_window)
{
g_mutex_lock(&qt_window->priv->lock);
GST_DEBUG("stop window");
qt_window->priv->updated = TRUE;
g_cond_signal(&qt_window->priv->update_cond);
g_mutex_unlock(&qt_window->priv->lock);
}

View file

@ -64,6 +64,7 @@ gboolean qt_window_set_context (QtGLWindow * qt_window, GstGLContext * co
GstGLDisplay * qt_window_get_display (QtGLWindow * qt_window);
gboolean qt_window_is_scenegraph_initialized (QtGLWindow * qt_window);
void qt_window_use_default_fbo (QtGLWindow * qt_window, gboolean useDefaultFbo);
void qt_window_stop(QtGLWindow* qt_window);
}
#endif /* __QT_WINDOW_H__ */