diff options
-rw-r--r-- | ext/rtmp/gstrtmpsink.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/ext/rtmp/gstrtmpsink.c b/ext/rtmp/gstrtmpsink.c index 47c3d6088..aed5ab412 100644 --- a/ext/rtmp/gstrtmpsink.c +++ b/ext/rtmp/gstrtmpsink.c @@ -239,17 +239,14 @@ gst_rtmp_sink_render (GstBaseSink * bsink, GstBuffer * buf) if (sink->first) { /* open the connection */ if (!RTMP_IsConnected (sink->rtmp)) { - if (!RTMP_Connect (sink->rtmp, NULL) - || !RTMP_ConnectStream (sink->rtmp, 0)) { - GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL), - ("Could not connect to RTMP stream \"%s\" for writing", sink->uri)); - RTMP_Free (sink->rtmp); - sink->rtmp = NULL; - g_free (sink->rtmp_uri); - sink->rtmp_uri = NULL; - sink->have_write_error = TRUE; - return GST_FLOW_ERROR; + if (!RTMP_Connect (sink->rtmp, NULL)) + goto connection_failed; + + if (!RTMP_ConnectStream (sink->rtmp, 0)) { + RTMP_Close (sink->rtmp); + goto connection_failed; } + GST_DEBUG_OBJECT (sink, "Opened connection to %s", sink->rtmp_uri); } @@ -290,6 +287,19 @@ write_failed: sink->have_write_error = TRUE; return GST_FLOW_ERROR; } + +connection_failed: + { + GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL), + ("Could not connect to RTMP stream \"%s\" for writing", sink->uri)); + RTMP_Free (sink->rtmp); + sink->rtmp = NULL; + g_free (sink->rtmp_uri); + sink->rtmp_uri = NULL; + sink->have_write_error = TRUE; + + return GST_FLOW_ERROR; + } } /* |