Title: [219359] trunk/Source/WebCore
Revision
219359
Author
[email protected]
Date
2017-07-11 13:46:24 -0700 (Tue, 11 Jul 2017)

Log Message

[WebRTC] Hanging under LibWebRTCMediaEndpoint::getStats
https://bugs.webkit.org/show_bug.cgi?id=174377

Patch by Youenn Fablet <[email protected]> on 2017-07-11
Reviewed by Eric Carlson.

No change of behavior.
Moving calls to libwebrtc getStats in the signalling thread since doing it in the main thread
would block the main thread until the signalling thread is ready to handle getStats.
Reducing stat logging since this may be too much for some devices.

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::getStats):
(WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging):
(WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
(WebCore::LibWebRTCMediaEndpoint::startLoggingStats):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219358 => 219359)


--- trunk/Source/WebCore/ChangeLog	2017-07-11 20:42:11 UTC (rev 219358)
+++ trunk/Source/WebCore/ChangeLog	2017-07-11 20:46:24 UTC (rev 219359)
@@ -1,3 +1,21 @@
+2017-07-11  Youenn Fablet  <[email protected]>
+
+        [WebRTC] Hanging under LibWebRTCMediaEndpoint::getStats
+        https://bugs.webkit.org/show_bug.cgi?id=174377
+
+        Reviewed by Eric Carlson.
+
+        No change of behavior.
+        Moving calls to libwebrtc getStats in the signalling thread since doing it in the main thread
+        would block the main thread until the signalling thread is ready to handle getStats.
+        Reducing stat logging since this may be too much for some devices.
+
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::getStats):
+        (WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging):
+        (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
+        (WebCore::LibWebRTCMediaEndpoint::startLoggingStats):
+
 2017-07-11  Michael Catanzaro  <[email protected]>
 
         Remove unused OpenGL files

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (219358 => 219359)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2017-07-11 20:42:11 UTC (rev 219358)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2017-07-11 20:46:24 UTC (rev 219359)
@@ -270,9 +270,11 @@
 
 void LibWebRTCMediaEndpoint::getStats(MediaStreamTrack* track, const DeferredPromise& promise)
 {
-    UNUSED_PARAM(track);
-    UNUSED_PARAM(promise);
-    m_backend->GetStats(StatsCollector::create(*this, promise, track).get());
+    auto collector = StatsCollector::create(*this, promise, track);
+    LibWebRTCProvider::callOnWebRTCSignalingThread([protectedThis = makeRef(*this), collector = WTFMove(collector)] {
+        if (protectedThis->m_backend)
+            protectedThis->m_backend->GetStats(collector.get());
+    });
 }
 
 LibWebRTCMediaEndpoint::StatsCollector::StatsCollector(Ref<LibWebRTCMediaEndpoint>&& endpoint, const DeferredPromise& promise, MediaStreamTrack* track)
@@ -1040,9 +1042,10 @@
 
 void LibWebRTCMediaEndpoint::gatherStatsForLogging()
 {
-    ASSERT(m_backend);
-    if (m_backend)
-        m_backend->GetStats(this);
+    LibWebRTCProvider::callOnWebRTCSignalingThread([protectedThis = makeRef(*this)] {
+        if (protectedThis->m_backend)
+            protectedThis->m_backend->GetStats(protectedThis.ptr());
+    });
 }
 
 void LibWebRTCMediaEndpoint::OnStatsDelivered(const rtc::scoped_refptr<const webrtc::RTCStatsReport>& report)
@@ -1049,9 +1052,9 @@
 {
     if (!m_statsTimestamp)
         m_statsTimestamp = report->timestamp_us();
-    else if (m_statsLogTimer.repeatInterval() == 1_s && (report->timestamp_us() - m_statsTimestamp) > 30000000) {
+    else if (m_statsLogTimer.repeatInterval() == 2_s && (report->timestamp_us() - m_statsTimestamp) > 15000000) {
         callOnMainThread([protectedThis = makeRef(*this)] {
-            protectedThis->m_statsLogTimer.augmentRepeatInterval(4_s);
+            protectedThis->m_statsLogTimer.augmentRepeatInterval(9_s);
         });
     }
 
@@ -1072,7 +1075,7 @@
 #if !RELEASE_LOG_DISABLED
     if (m_statsLogTimer.isActive())
         m_statsLogTimer.stop();
-    m_statsLogTimer.startRepeating(1_s);
+    m_statsLogTimer.startRepeating(2_s);
 #endif
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to