Title: [238601] trunk/Source/WebCore
Revision
238601
Author
you...@apple.com
Date
2018-11-27 20:48:30 -0800 (Tue, 27 Nov 2018)

Log Message

Log WebRTC stats in inspector console only when setting is verbose
https://bugs.webkit.org/show_bug.cgi?id=192014

Reviewed by Eric Carlson.

Add a WebRTCStats channel that is used by default to output WebRTC stats in console.
When WebRTC Debug logging is enabled, log WebRTC stats in WebRTC channel,
so that they appear as debug information in Web Inspector.

No change of JS behavior.
Covered by manually testing what is logged in inspector and console.

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
* platform/Logging.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238600 => 238601)


--- trunk/Source/WebCore/ChangeLog	2018-11-28 03:05:16 UTC (rev 238600)
+++ trunk/Source/WebCore/ChangeLog	2018-11-28 04:48:30 UTC (rev 238601)
@@ -1,3 +1,21 @@
+2018-11-27  Youenn Fablet  <you...@apple.com>
+
+        Log WebRTC stats in inspector console only when setting is verbose
+        https://bugs.webkit.org/show_bug.cgi?id=192014
+
+        Reviewed by Eric Carlson.
+
+        Add a WebRTCStats channel that is used by default to output WebRTC stats in console.
+        When WebRTC Debug logging is enabled, log WebRTC stats in WebRTC channel,
+        so that they appear as debug information in Web Inspector.
+
+        No change of JS behavior.
+        Covered by manually testing what is logged in inspector and console.
+
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
+        * platform/Logging.h:
+
 2018-11-27  Simon Fraser  <simon.fra...@apple.com>
 
         Fix the mis-spelled "m_clienstWaitingForAsyncDecoding"

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


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2018-11-28 03:05:16 UTC (rev 238600)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2018-11-28 04:48:30 UTC (rev 238601)
@@ -854,8 +854,18 @@
             m_statsLogTimer.startRepeating(statsLogInterval(timestamp));
         }
 
-        for (auto iterator = report->begin(); iterator != report->end(); ++iterator)
-            ALWAYS_LOG(Logger::LogSiteIdentifier("LibWebRTCMediaEndpoint", "OnStatsDelivered", logIdentifier()), RTCStatsLogger { *iterator });
+        for (auto iterator = report->begin(); iterator != report->end(); ++iterator) {
+            if (logger().willLog(logChannel(), WTFLogLevelDebug)) {
+                // Stats are very verbose, let's only display them in inspector console in verbose mode.
+                logger().debug(LogWebRTC,
+                    Logger::LogSiteIdentifier("LibWebRTCMediaEndpoint", "OnStatsDelivered", logIdentifier()),
+                    RTCStatsLogger { *iterator });
+            } else {
+                logger().logAlways(LogWebRTCStats,
+                    Logger::LogSiteIdentifier("LibWebRTCMediaEndpoint", "OnStatsDelivered", logIdentifier()),
+                    RTCStatsLogger { *iterator });
+            }
+        }
     });
 #else
     UNUSED_PARAM(report);

Modified: trunk/Source/WebCore/platform/Logging.h (238600 => 238601)


--- trunk/Source/WebCore/platform/Logging.h	2018-11-28 03:05:16 UTC (rev 238600)
+++ trunk/Source/WebCore/platform/Logging.h	2018-11-28 04:48:30 UTC (rev 238601)
@@ -103,6 +103,7 @@
     M(WebGPU) \
     M(WebMetal) \
     M(WebRTC) \
+    M(WebRTCStats) \
     M(WheelEventTestTriggers) \
 
 #undef DECLARE_LOG_CHANNEL
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to