From a6cf067742c1206c073b5e0fe26386a09fda8769 Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Tue, 12 Apr 2022 16:15:15 +0900 Subject: [PATCH] webrtcdatachannel: Emit 'on-close' signal when calling 'close' action signal Previously, peer_closed variable set in _on_sctp_stream_reset() was a condition to trigger the 'on-close' signal. To emit the 'on-close' signal also when after calling 'close' action, the condition is removed. [Version] 1.20.0-15 [Issue Type] Improvement Change-Id: Ia592f005031490119996ed38ecdada703cf11cc0 Signed-off-by: Sangchul Lee --- packaging/gstreamer.spec | 2 +- subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.c | 10 ++++++++++ subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packaging/gstreamer.spec b/packaging/gstreamer.spec index d6e4646..381d9aa 100644 --- a/packaging/gstreamer.spec +++ b/packaging/gstreamer.spec @@ -59,7 +59,7 @@ Name: %{_name} Version: 1.20.0 -Release: 14 +Release: 15 Summary: Streaming-Media Framework Runtime License: LGPL-2.0+ Group: Multimedia/Framework diff --git a/subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.c b/subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.c index 033ad47..ffe8a8b 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.c @@ -284,24 +284,32 @@ static void _transport_closed (WebRTCDataChannel * channel) { GError *error; +#ifndef TIZEN_FEATURE_WEBRTC_MODIFICATION gboolean both_sides_closed; +#endif GST_WEBRTC_DATA_CHANNEL_LOCK (channel); error = channel->stored_error; channel->stored_error = NULL; +#ifndef TIZEN_FEATURE_WEBRTC_MODIFICATION both_sides_closed = channel->peer_closed && channel->parent.buffered_amount <= 0; if (both_sides_closed || error) { channel->peer_closed = FALSE; } +#endif GST_WEBRTC_DATA_CHANNEL_UNLOCK (channel); if (error) { gst_webrtc_data_channel_on_error (GST_WEBRTC_DATA_CHANNEL (channel), error); g_clear_error (&error); } +#ifdef TIZEN_FEATURE_WEBRTC_MODIFICATION + if (channel->parent.buffered_amount <= 0 || error) { +#else if (both_sides_closed || error) { +#endif gst_webrtc_data_channel_on_close (GST_WEBRTC_DATA_CHANNEL (channel)); } } @@ -370,10 +378,12 @@ _on_sctp_stream_reset (WebRTCSCTPTransport * sctp, guint stream_id, "Received channel close for SCTP stream %i label \"%s\"", channel->parent.id, channel->parent.label); +#ifndef TIZEN_FEATURE_WEBRTC_MODIFICATION GST_WEBRTC_DATA_CHANNEL_LOCK (channel); channel->peer_closed = TRUE; GST_WEBRTC_DATA_CHANNEL_UNLOCK (channel); +#endif _channel_enqueue_task (channel, (ChannelTask) _close_procedure, GUINT_TO_POINTER (stream_id), NULL); } diff --git a/subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.h b/subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.h index a0b38a7..13e01da 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.h +++ b/subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.h @@ -53,7 +53,9 @@ struct _WebRTCDataChannel gboolean opened; gulong src_probe; GError *stored_error; +#ifndef TIZEN_FEATURE_WEBRTC_MODIFICATION gboolean peer_closed; +#endif gpointer _padding[GST_PADDING]; }; -- 2.7.4