return WEBRTC_ERROR_INVALID_OPERATION;
}
-void _gst_destroy_pipeline(webrtc_s *webrtc)
+static void __destroy_sink_pipeline(webrtc_s *webrtc)
{
- if (!webrtc)
- return;
+ RET_IF(webrtc == NULL, "webrtc is NULL");
- if (webrtc->track_build_contexts) {
- g_hash_table_destroy(webrtc->track_build_contexts);
- webrtc->track_build_contexts = NULL;
- }
if (webrtc->gst.sink_slots) {
g_hash_table_destroy(webrtc->gst.sink_slots);
webrtc->gst.sink_slots = NULL;
}
+}
+
+static void __destroy_source_pipeline(webrtc_s *webrtc)
+{
+ RET_IF(webrtc == NULL, "webrtc is NULL");
+
if (webrtc->gst.source_slots) {
g_hash_table_destroy(webrtc->gst.source_slots);
webrtc->gst.source_slots = NULL;
}
+}
+
+void _gst_destroy_pipeline(webrtc_s *webrtc)
+{
+ RET_IF(webrtc == NULL, "webrtc is NULL");
+
+ if (webrtc->track_build_contexts) {
+ g_hash_table_destroy(webrtc->track_build_contexts);
+ webrtc->track_build_contexts = NULL;
+ }
+ __destroy_sink_pipeline(webrtc);
+ __destroy_source_pipeline(webrtc);
if (webrtc->gst.bus_watcher > 0) {
gst_bus_remove_watch(webrtc->gst.bus);
webrtc->gst.bus_watcher = 0;
ret = _release_all_resources(webrtc);
RET_VAL_WITH_UNLOCK_IF(ret != WEBRTC_ERROR_NONE, ret, &webrtc->mutex, "failed to release all resources");
#endif
+
+ __destroy_sink_pipeline(webrtc);
+
__post_state_cb_in_idle(webrtc, WEBRTC_STATE_IDLE);
LOG_INFO("webrtc[%p] is stopped", webrtc);