ret = __complete_mediapacketsrc_from_raw_format(webrtc, source);
else
ret = __complete_mediapacketsrc_from_encoded_format(webrtc, source);
-
if (ret != WEBRTC_ERROR_NONE) {
LOG_ERROR("failed to complete mediapacketsrc");
- media_format_unref(format);
- source->media_format = NULL;
- return ret;
+ goto error;
}
- return __link_source_with_webrtcbin(source, webrtc->gst.webrtcbin);
+ ret = __link_source_with_webrtcbin(source, webrtc->gst.webrtcbin);
+ if (ret != WEBRTC_ERROR_NONE)
+ goto error;
+
+ return ret;
+
+error:
+ media_format_unref(format);
+ source->media_format = NULL;
+ return ret;
}
static gboolean __check_format_is_not_set_cb(gpointer key, gpointer value, gpointer user_data)