From: Sangchul Lee Date: Mon, 22 Jul 2024 03:44:48 +0000 (+0900) Subject: dtlsdec: Check if pad is linked before pushing buffer X-Git-Tag: accepted/tizen/unified/20240723.034823^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=727a4f9ccf277f9ead16e796e9d00dbc25d58248;p=platform%2Fupstream%2Fgstreamer.git dtlsdec: Check if pad is linked before pushing buffer 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 --- diff --git a/packaging/gstreamer.spec b/packaging/gstreamer.spec index 070affe50a..298a09ab01 100644 --- a/packaging/gstreamer.spec +++ b/packaging/gstreamer.spec @@ -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 diff --git a/subprojects/gst-plugins-bad/ext/dtls/gstdtlsdec.c b/subprojects/gst-plugins-bad/ext/dtls/gstdtlsdec.c index ca9f8fd6b7..45fa0dfc3b 100644 --- a/subprojects/gst-plugins-bad/ext/dtls/gstdtlsdec.c +++ b/subprojects/gst-plugins-bad/ext/dtls/gstdtlsdec.c @@ -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 { diff --git a/subprojects/gst-plugins-bad/meson.build b/subprojects/gst-plugins-bad/meson.build index ffb6a928e7..895a42d34e 100644 --- a/subprojects/gst-plugins-bad/meson.build +++ b/subprojects/gst-plugins-bad/meson.build @@ -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)