[1.0.13] disconnect signal handler 59/285159/2
authorEunhye Choi <eunhae1.choi@samsung.com>
Wed, 7 Dec 2022 04:27:32 +0000 (13:27 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Wed, 7 Dec 2022 06:41:54 +0000 (15:41 +0900)
- disconnect signal handler before unref the element

Change-Id: I7191295f62500f27cff1b34cc260148de1d53949

include/MediaTransporterGst.h
packaging/capi-media-transporter.spec
src/MediaTransporterGst.cpp
src/MediaTransporterReceiverRist.cpp
src/MediaTransporterReceiverRtsp.cpp
src/MediaTransporterReceiverSrt.cpp
src/MediaTransporterSenderSrt.cpp

index 005cafdde120cd8b2b6259de308d3da25bd882a4..98a093309ca3ad90f09b4764cb7d30ee0103e7de 100644 (file)
@@ -90,6 +90,7 @@ void _clearElements(GstElements& elements);
 void _removeElement(GstElements& elements, GstElement* removeElement);
 GstElement*_createElement(std::string factory_name, std::string name ="");
 void _connectAndAppendSignal(GList** signals, GObject* obj, const char* sig_name, GCallback cb, gpointer user_data);
+void _disconnectSignal(GList** signals, GObject* obj);
 void _disconnectSignal(gpointer data);
 bool _addNoTargetGhostpad(GstBin* bin, GstPad** new_pad, bool is_src);
 bool _setGhostpadTarget(GstPad* ghost_pad, GstElement* target_element, bool is_src);
index 71e31e7ba0e92effce768dc86ef677a045863416..38df1897cfe3ba02d059b2271446eeed2f2b3ed4 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-transporter
 Summary:    A Media Transporter library in Tizen Native API
-Version:    1.0.12
+Version:    1.0.13
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 0eed11e8c405e0abf9d1d7ed9ba963bc21eeab5a..9ec7137530db012f2f0ef1fc46c9056c5be8631c 100644 (file)
@@ -69,6 +69,24 @@ void gst::_connectAndAppendSignal(GList** signals, GObject* obj, const char* sig
                        sig_name, sig_data->signal_id, GST_OBJECT_NAME(sig_data->obj));
 }
 
+void gst::_disconnectSignal(GList** signals, GObject* obj)
+{
+       GList* tmp = *signals;
+
+       while (tmp) {
+               auto sig_data = static_cast<gst::mtprSignal*>(tmp->data);
+               RET_IF(!sig_data, "sig_data is NULL");
+
+               tmp = g_list_next(tmp);
+
+               if (sig_data->obj != obj)
+                       continue;
+
+               *signals = g_list_remove(*signals, sig_data);
+               _disconnectSignal(sig_data);
+       }
+}
+
 void gst::_disconnectSignal(gpointer data)
 {
        auto sig_data = static_cast<gst::mtprSignal*>(data);
@@ -851,4 +869,4 @@ void gst::_updateEncCaps(GstElement* element, const param::audioInfo& aInfo)
                g_object_set(G_OBJECT(element), "caps", newCaps, NULL);
 
        gst_caps_unref(newCaps);
-}
\ No newline at end of file
+}
index 073f7da32b07382fcb2319bc3c73b5e37ab78401..b062ceb7067a7a718811489725e024806c0b3edf 100644 (file)
@@ -108,6 +108,8 @@ void MediaTransporterReceiverRist::buildPipeline()
        } catch (const MediaTransporterException& e) {
                LOG_ERROR("%s", e.what());
 
+               gst::_disconnectSignal(&_gst.signals, G_OBJECT(tsdemux));
+
                gst::_destroyElementFromParent(src);
                gst::_destroyElementFromParent(rtpmp2tdepay);
                gst::_destroyElementFromParent(queue);
index 1d6b059ed5c2c13a4f024cdd045a20a54d440944..aeb644df0a68d7e48eefb6417eb80f0b5be7b32c 100644 (file)
@@ -94,6 +94,8 @@ void MediaTransporterReceiverRtsp::_srcPadAddedCallback(GstElement* src, GstPad
 
 ERROR:
        if (decodebin) {
+               gst::_disconnectSignal(&rtsp->_gst.signals, G_OBJECT(decodebin));
+
                gst_element_set_state(decodebin, GST_STATE_NULL);
                if (!gst_bin_remove(GST_BIN(rtsp->_gst.pipeline), decodebin))
                        gst_object_unref(decodebin);
@@ -191,6 +193,8 @@ void MediaTransporterReceiverRtsp::buildPipeline()
 
        } catch (const MediaTransporterException& e) {
                LOG_ERROR("%s", e.what());
+
+               gst::_disconnectSignal(&_gst.signals, G_OBJECT(src));
                gst::_destroyElementFromParent(src);
                throw;
        }
index 9d58d640faef8b7572c0cbecf3d800ca067d2b11..2d60276ef18f84ea0da05fde4755597de03c3961 100644 (file)
@@ -121,6 +121,8 @@ void MediaTransporterReceiverSrt::buildPipeline()
        } catch (const MediaTransporterException& e) {
                LOG_ERROR("%s", e.what());
 
+               gst::_disconnectSignal(&_gst.signals, G_OBJECT(tsdemux));
+
                gst::_destroyElementFromParent(src);
                gst::_destroyElementFromParent(queue);
                gst::_destroyElementFromParent(tsdemux);
index 3f77e81c4c4f7c5f4373583a63d2f99f453725e2..aae5349f55498b2ebc6493012aba13183f66041c 100644 (file)
@@ -191,6 +191,8 @@ void MediaTransporterSenderSrt::buildPipeline()
        } catch (const MediaTransporterException& e) {
                LOG_ERROR("%s", e.what());
 
+               gst::_disconnectSignal(&_gst.signals, G_OBJECT(sink));
+
                gst::_destroyElementFromParent(mux);
                gst::_destroyElementFromParent(sink);