From 4d3f2b06355c9f853093bd655fc222769ac72ee1 Mon Sep 17 00:00:00 2001 From: Ilya Konstantinov Date: Thu, 9 Apr 2015 07:56:48 +0300 Subject: [PATCH] gst: improve error when agent/stream/component is unset --- gst/gstnicesink.c | 12 ++++++++++++ gst/gstnicesrc.c | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gst/gstnicesink.c b/gst/gstnicesink.c index a6f099d..7ef0b05 100644 --- a/gst/gstnicesink.c +++ b/gst/gstnicesink.c @@ -368,6 +368,18 @@ gst_nice_sink_change_state (GstElement * element, GstStateChange transition) "Trying to start Nice sink without an agent set"); return GST_STATE_CHANGE_FAILURE; } + else if (sink->stream_id == 0) + { + GST_ERROR_OBJECT (element, + "Trying to start Nice sink without a stream set"); + return GST_STATE_CHANGE_FAILURE; + } + else if (sink->component_id == 0) + { + GST_ERROR_OBJECT (element, + "Trying to start Nice sink without a component set"); + return GST_STATE_CHANGE_FAILURE; + } break; case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_PAUSED_TO_PLAYING: diff --git a/gst/gstnicesrc.c b/gst/gstnicesrc.c index 0c75c18..c28c480 100644 --- a/gst/gstnicesrc.c +++ b/gst/gstnicesrc.c @@ -401,12 +401,24 @@ gst_nice_src_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: - if (src->agent == NULL || src->stream_id == 0 || src->component_id == 0) + if (src->agent == NULL) { GST_ERROR_OBJECT (element, "Trying to start Nice source without an agent set"); return GST_STATE_CHANGE_FAILURE; } + else if (src->stream_id == 0) + { + GST_ERROR_OBJECT (element, + "Trying to start Nice source without a stream set"); + return GST_STATE_CHANGE_FAILURE; + } + else if (src->component_id == 0) + { + GST_ERROR_OBJECT (element, + "Trying to start Nice source without a component set"); + return GST_STATE_CHANGE_FAILURE; + } else { nice_agent_attach_recv (src->agent, src->stream_id, src->component_id, -- 2.2.1