dtlsdec: Check if pad is linked before pushing buffer 50/314850/2 accepted/tizen_unified accepted/tizen_unified_dev accepted/tizen_unified_x accepted/tizen/unified/20240723.034823 accepted/tizen/unified/dev/20240724.110144 accepted/tizen/unified/x/20240723.090007
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 22 Jul 2024 03:44:48 +0000 (12:44 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 22 Jul 2024 08:21:55 +0000 (17:21 +0900)
This defensive condition is only for the dtlsdec of dtlssrtpdec
in transportreceivebin which is normally used for webrtcbin.

[Version] 1.22.8-13
[Issue Type] Improvement

Change-Id: I1d06a5d3910a9b482a9c54cca9239b89df742c1d
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/gstreamer.spec
subprojects/gst-plugins-bad/ext/dtls/gstdtlsdec.c
subprojects/gst-plugins-bad/meson.build

index 070affe..298a09a 100644 (file)
@@ -62,7 +62,7 @@
 
 Name:           %{_name}
 Version:        1.22.8
-Release:        12
+Release:        13
 Summary:        Streaming-Media Framework Runtime
 License:        LGPL-2.0+
 Group:          Multimedia/Framework
index ca9f8fd..45fa0df 100644 (file)
@@ -596,6 +596,43 @@ sink_chain_list (GstPad * pad, GstObject * parent, GstBufferList * list)
   return process_list_data.flow_ret;
 }
 
+#ifdef TIZEN_FEATURE_DTLS_MODIFICATION
+static void
+find_data_src_pad_linked (GstPad * pad, void * user_data)
+{
+  gboolean *linked = (gboolean *)user_data;
+
+  if (!g_strrstr(GST_PAD_NAME(pad), "data_src") || GST_PAD_IS_LINKED(pad))
+    return;
+
+  if (linked)
+    *linked = FALSE;
+
+  GST_WARNING("'%s' pad is not linked", GST_PAD_NAME(pad));
+}
+
+static gboolean check_if_pad_linked (GstElement * self)
+{
+  GstElement *parent = GST_ELEMENT_PARENT(self);
+  GstElement *grand_parent;
+  gboolean linked = TRUE;
+
+  /* Check whether if this element comes from 'dtlssrtpdec -
+   * transportreceivebin', otherwise just return true. */
+  if (!parent || !g_strrstr(GST_ELEMENT_NAME(parent), "dtlssrtpdec"))
+    return TRUE;
+
+  grand_parent = GST_ELEMENT_PARENT(parent);
+  if (!grand_parent || !g_strrstr(GST_ELEMENT_NAME(grand_parent),
+    "transportreceivebin"))
+    return TRUE;
+
+  g_list_foreach (GST_ELEMENT_PADS(grand_parent),
+    (GFunc) find_data_src_pad_linked, &linked);
+
+  return linked;
+}
+#endif
 static GstFlowReturn
 sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
 {
@@ -630,7 +667,12 @@ sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
   if (other_pad) {
     gboolean was_eos = (ret == GST_FLOW_EOS);
 
+#ifdef TIZEN_FEATURE_DTLS_MODIFICATION
+    if (gst_buffer_get_size (buffer) > 0 &&
+      check_if_pad_linked(GST_ELEMENT(self))) {
+#else
     if (gst_buffer_get_size (buffer) > 0) {
+#endif
       GST_LOG_OBJECT (self, "pushing buffer");
       ret = gst_pad_push (other_pad, buffer);
     } else {
index ffb6a92..895a42d 100644 (file)
@@ -511,6 +511,7 @@ cdata.set('TIZEN_FEATURE_HLSDEMUX_DISCONT', true)
 cdata.set('TIZEN_FEATURE_WEBRTC_MODIFICATION', true)
 cdata.set('TIZEN_FEATURE_WEBRTC_IMPORT_NETSIM', true)
 cdata.set('TIZEN_FEATURE_WEBRTC_SSRC_TIMEOUT_NOTIFICATION', true)
+cdata.set('TIZEN_FEATURE_DTLS_MODIFICATION', true)
 cdata.set('TIZEN_FEATURE_PITCH_AUDIO_META', true)
 cdata.set('TIZEN_FEATURE_SRT_LATENCY', true)
 cdata.set('TIZEN_FEATURE_BUG_FIX', true)