mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
gst-source: handle state change errors better
This commit is contained in:
parent
7aa3032710
commit
c875141e69
1 changed files with 20 additions and 2 deletions
|
|
@ -170,9 +170,15 @@ start_pipeline (PinosGstSource *source, GError **error)
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
gchar *address;
|
gchar *address;
|
||||||
gint port;
|
gint port;
|
||||||
|
GstStateChangeReturn ret;
|
||||||
|
|
||||||
gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
|
ret = gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
|
||||||
gst_element_get_state (priv->pipeline, NULL, NULL, -1);
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
||||||
|
goto paused_failed;
|
||||||
|
|
||||||
|
ret = gst_element_get_state (priv->pipeline, NULL, NULL, -1);
|
||||||
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
||||||
|
goto paused_failed;
|
||||||
|
|
||||||
query = gst_query_new_caps (NULL);
|
query = gst_query_new_caps (NULL);
|
||||||
gst_element_query (priv->element, query);
|
gst_element_query (priv->element, query);
|
||||||
|
|
@ -197,6 +203,18 @@ start_pipeline (PinosGstSource *source, GError **error)
|
||||||
gst_object_unref (clock);
|
gst_object_unref (clock);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
paused_failed:
|
||||||
|
{
|
||||||
|
GST_ERROR_OBJECT (source, "failed state change");
|
||||||
|
gst_element_set_state (priv->pipeline, GST_STATE_NULL);
|
||||||
|
if (error)
|
||||||
|
*error = g_error_new (G_IO_ERROR,
|
||||||
|
G_IO_ERROR_FAILED,
|
||||||
|
"Failed to start pipeline");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue