fixup! webrtc: Fix to have valid values of RTCPeerConnectionStats 49/273649/2
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 7 Apr 2022 16:35:21 +0000 (01:35 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 11 Apr 2022 10:54:48 +0000 (10:54 +0000)
Change-Id: Iff88f892279ae622e1407f620abdef69c7932950

subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c
subprojects/gst-plugins-bad/ext/webrtc/webrtcdatachannel.c
subprojects/gst-plugins-bad/gst-libs/gst/webrtc/datachannel.c
subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc-priv.h

index 30d624cd5394c1705d2e8fa0ee2e74c73669fedb..069ea3c1082571c500b22edee02ca15deb1f31eb 100644 (file)
@@ -2391,14 +2391,11 @@ _on_data_channel_ready_state (WebRTCDataChannel * channel,
         channel);
   } else if (ready_state == GST_WEBRTC_DATA_CHANNEL_STATE_CLOSED) {
     gboolean found;
-#ifdef TIZEN_FEATURE_WEBRTC_MODIFICATION
-    int i;
-#endif
 
     DC_LOCK (webrtc);
 #ifdef TIZEN_FEATURE_WEBRTC_MODIFICATION
-    for (i = 0; i < webrtc->priv->data_channels->len; i++)
-      if (g_ptr_array_index (webrtc->priv->data_channels, i) == channel)
+    if (channel->parent.prev_ready_state == GST_WEBRTC_DATA_CHANNEL_STATE_OPEN ||
+        channel->parent.prev_ready_state == GST_WEBRTC_DATA_CHANNEL_STATE_CLOSING)
         webrtc->priv->data_channels_closed++;
 
 #endif
index 891e0933aa259c0149a5ab6841598fca8478fcde..033ad4721bb2f67d3d097ccd211729f81f9358e7 100644 (file)
@@ -344,6 +344,9 @@ _close_procedure (WebRTCDataChannel * channel, gpointer user_data)
     _channel_enqueue_task (channel, (ChannelTask) _transport_closed, NULL,
         NULL);
   } else if (channel->parent.ready_state == GST_WEBRTC_DATA_CHANNEL_STATE_OPEN) {
+#ifdef TIZEN_FEATURE_WEBRTC_MODIFICATION
+    channel->parent.prev_ready_state = channel->parent.ready_state;
+#endif
     channel->parent.ready_state = GST_WEBRTC_DATA_CHANNEL_STATE_CLOSING;
     GST_WEBRTC_DATA_CHANNEL_UNLOCK (channel);
     g_object_notify (G_OBJECT (channel), "ready-state");
index b97a38bc99a4c7ba5b40f7d1954788ad1144b8cd..0e0f28c000a9e4ee22defc2773e9dba30416df33 100644 (file)
@@ -390,6 +390,9 @@ gst_webrtc_data_channel_on_open (GstWebRTCDataChannel * channel)
   }
 
   if (channel->ready_state != GST_WEBRTC_DATA_CHANNEL_STATE_OPEN) {
+#ifdef TIZEN_FEATURE_WEBRTC_MODIFICATION
+    channel->prev_ready_state = channel->ready_state;
+#endif
     channel->ready_state = GST_WEBRTC_DATA_CHANNEL_STATE_OPEN;
     GST_WEBRTC_DATA_CHANNEL_UNLOCK (channel);
     g_object_notify (G_OBJECT (channel), "ready-state");
@@ -424,6 +427,9 @@ gst_webrtc_data_channel_on_close (GstWebRTCDataChannel * channel)
     return;
   }
 
+#ifdef TIZEN_FEATURE_WEBRTC_MODIFICATION
+  channel->prev_ready_state = channel->ready_state;
+#endif
   channel->ready_state = GST_WEBRTC_DATA_CHANNEL_STATE_CLOSED;
   GST_WEBRTC_DATA_CHANNEL_UNLOCK (channel);
 
index 7366006b72d130ce1bafb45618bfae8014f9fa7d..58a25f46173ba0691f8895c7f3699cf9cca90c78 100644 (file)
@@ -248,6 +248,9 @@ struct _GstWebRTCDataChannel
   gint                              id;
   GstWebRTCPriorityType             priority;
   GstWebRTCDataChannelState         ready_state;
+#ifdef TIZEN_FEATURE_WEBRTC_MODIFICATION
+  GstWebRTCDataChannelState         prev_ready_state;
+#endif
   guint64                           buffered_amount;
   guint64                           buffered_amount_low_threshold;