Diff
Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (242885 => 242886)
--- trunk/Source/ThirdParty/libwebrtc/ChangeLog 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog 2019-03-13 17:14:18 UTC (rev 242886)
@@ -1,3 +1,18 @@
+2019-03-13 Youenn Fablet <[email protected]>
+
+ Enable libwebrtc logging control through WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=195658
+
+ Reviewed by Eric Carlson.
+
+ Add a callback to get access to libwebrtc log messages.
+
+ * Configurations/libwebrtc.iOS.exp:
+ * Configurations/libwebrtc.iOSsim.exp:
+ * Configurations/libwebrtc.mac.exp:
+ * Source/webrtc/rtc_base/logging.cc:
+ * Source/webrtc/rtc_base/logging.h:
+
2019-03-07 Youenn Fablet <[email protected]>
Skip compilation of unused audio device files for Mac and iOS
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp (242885 => 242886)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp 2019-03-13 17:14:18 UTC (rev 242886)
@@ -246,3 +246,4 @@
__ZN6webrtc16RtpFecParametersD1Ev
__ZN6webrtc16RtpRtxParametersC1ERKS0_
__ZN6webrtc16RtpRtxParametersD1Ev
+__ZN3rtc10LogMessage12SetLogOutputENS_15LoggingSeverityEPFvS1_PKcE
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp (242885 => 242886)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp 2019-03-13 17:14:18 UTC (rev 242886)
@@ -247,3 +247,4 @@
__ZN6webrtc16RtpFecParametersD1Ev
__ZN6webrtc16RtpRtxParametersC1ERKS0_
__ZN6webrtc16RtpRtxParametersD1Ev
+__ZN3rtc10LogMessage12SetLogOutputENS_15LoggingSeverityEPFvS1_PKcE
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp (242885 => 242886)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp 2019-03-13 17:14:18 UTC (rev 242886)
@@ -247,3 +247,4 @@
__ZN6webrtc16RtpFecParametersD1Ev
__ZN6webrtc16RtpRtxParametersC1ERKS0_
__ZN6webrtc16RtpRtxParametersD1Ev
+__ZN3rtc10LogMessage12SetLogOutputENS_15LoggingSeverityEPFvS1_PKcE
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc (242885 => 242886)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc 2019-03-13 17:14:18 UTC (rev 242886)
@@ -52,7 +52,9 @@
static LoggingSeverity g_min_sev = LS_NONE;
static LoggingSeverity g_dbg_sev = LS_NONE;
#endif
+static LogMessage::LogOutputCallback g_log_output_callback = nullptr;
+
// Return the filename portion of the string (that following the last slash).
const char* FilenameFromPath(const char* file) {
const char* end1 = ::strrchr(file, '/');
@@ -269,6 +271,14 @@
UpdateMinLogSeverity();
}
+void LogMessage::SetLogOutput(LoggingSeverity min_sev, LogOutputCallback callback)
+{
+ g_dbg_sev = min_sev;
+ CritScope cs(&logCriticalScope());
+ UpdateMinLogSeverity();
+ g_log_output_callback = callback;
+}
+
void LogMessage::SetLogToStderr(bool log_to_stderr) {
log_to_stderr_ = log_to_stderr;
}
@@ -456,6 +466,8 @@
}
#endif // WEBRTC_ANDROID
if (log_to_stderr) {
+ if (g_log_output_callback)
+ g_log_output_callback(severity, str.c_str());
fprintf(stderr, "%s", str.c_str());
fflush(stderr);
}
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h (242885 => 242886)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h 2019-03-13 17:14:18 UTC (rev 242886)
@@ -430,6 +430,9 @@
// These are the available logging channels
// Debug: Debug console on Windows, otherwise stderr
static void LogToDebug(LoggingSeverity min_sev);
+
+ typedef void (*LogOutputCallback)(LoggingSeverity severity, const char*);
+ static void SetLogOutput(LoggingSeverity min_sev, LogOutputCallback);
static LoggingSeverity GetLogToDebug();
// Sets whether logs will be directed to stderr in debug mode.
Modified: trunk/Source/WebCore/ChangeLog (242885 => 242886)
--- trunk/Source/WebCore/ChangeLog 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/WebCore/ChangeLog 2019-03-13 17:14:18 UTC (rev 242886)
@@ -1,3 +1,26 @@
+2019-03-13 Youenn Fablet <[email protected]>
+
+ Enable libwebrtc logging control through WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=195658
+
+ Reviewed by Eric Carlson.
+
+ Add support for WebCore logging of libwebrtc messages.
+ This is controlled by WebRTC log channel state and level.
+ In case of private browsing mode, any logging is disabled.
+ This will stay for the lifetime of the process.
+ No change of behavior.
+
+ * Modules/mediastream/RTCPeerConnection.cpp:
+ (WebCore::RTCPeerConnection::create):
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+ (WebCore::doReleaseLogging):
+ (WebCore::setLogging):
+ (WebCore::computeLogLevel):
+ (WebCore::initializePeerConnectionFactoryAndThreads):
+ (WebCore::LibWebRTCProvider::setEnableLogging):
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
+
2019-03-13 Thibault Saunier <[email protected]>
[GStreamer][WebRTC] Do not sync encoder on the clock
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (242885 => 242886)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2019-03-13 17:14:18 UTC (rev 242886)
@@ -70,8 +70,10 @@
// Let's make it uncollectable until the pc is closed by JS or the page stops it.
if (!peerConnection->isClosed()) {
peerConnection->m_pendingActivity = peerConnection->makePendingActivity(peerConnection.get());
- if (auto* page = downcast<Document>(context).page())
+ if (auto* page = downcast<Document>(context).page()) {
peerConnection->registerToController(page->rtcController());
+ page->libWebRTCProvider().setEnableLogging(!context.sessionID().isEphemeral());
+ }
}
return peerConnection;
}
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (242885 => 242886)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2019-03-13 17:14:18 UTC (rev 242886)
@@ -120,20 +120,49 @@
void OnMessage(rtc::Message*);
};
-static void initializePeerConnectionFactoryAndThreads(PeerConnectionFactoryAndThreads& factoryAndThreads)
+static void doReleaseLogging(rtc::LoggingSeverity severity, const char* message)
{
- ASSERT(!factoryAndThreads.networkThread);
+ if (severity == rtc::LS_ERROR)
+ RELEASE_LOG_ERROR(WebRTC, "LibWebRTC error: %{public}s", message);
+ else
+ RELEASE_LOG(WebRTC, "LibWebRTC message: %{public}s", message);
+}
+static void setLogging(rtc::LoggingSeverity level)
+{
+ rtc::LogMessage::SetLogOutput(level, (level == rtc::LS_NONE) ? nullptr : doReleaseLogging);
+}
+
+static rtc::LoggingSeverity computeLogLevel()
+{
#if defined(NDEBUG)
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- rtc::LogMessage::LogToDebug(LogWebRTC.state != WTFLogChannelOn ? rtc::LS_NONE : rtc::LS_INFO);
+ if (LogWebRTC.state != WTFLogChannelOn)
+ return rtc::LS_ERROR;
+
+ switch (LogWebRTC.level) {
+ case WTFLogLevelAlways:
+ case WTFLogLevelError:
+ return rtc::LS_ERROR;
+ case WTFLogLevelWarning:
+ return rtc::LS_WARNING;
+ case WTFLogLevelInfo:
+ return rtc::LS_INFO;
+ case WTFLogLevelDebug:
+ return rtc::LS_VERBOSE;
+ }
#else
- rtc::LogMessage::LogToDebug(rtc::LS_NONE);
+ return rtc::LS_NONE;
#endif
#else
- rtc::LogMessage::LogToDebug(LogWebRTC.state != WTFLogChannelOn ? rtc::LS_WARNING : rtc::LS_INFO);
+ return (LogWebRTC.state != WTFLogChannelOn) ? rtc::LS_WARNING : rtc::LS_INFO;
#endif
+}
+static void initializePeerConnectionFactoryAndThreads(PeerConnectionFactoryAndThreads& factoryAndThreads)
+{
+ ASSERT(!factoryAndThreads.networkThread);
+
factoryAndThreads.networkThread = factoryAndThreads.networkThreadWithSocketServer ? rtc::Thread::CreateWithSocketServer() : rtc::Thread::Create();
factoryAndThreads.networkThread->SetName("WebKitWebRTCNetwork", nullptr);
bool result = factoryAndThreads.networkThread->Start();
@@ -194,6 +223,14 @@
threads.signalingThread->Post(RTC_FROM_HERE, &threads, 1, new ThreadMessageData(WTFMove(callback)));
}
+void LibWebRTCProvider::setEnableLogging(bool enableLogging)
+{
+ if (!m_enableLogging)
+ return;
+ m_enableLogging = enableLogging;
+ setLogging(enableLogging ? computeLogLevel() : rtc::LS_NONE);
+}
+
webrtc::PeerConnectionFactoryInterface* LibWebRTCProvider::factory()
{
if (m_factory)
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h (242885 => 242886)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2019-03-13 17:11:27 UTC (rev 242885)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2019-03-13 17:14:18 UTC (rev 242886)
@@ -115,6 +115,8 @@
void clearFactory() { m_factory = nullptr; }
+ void setEnableLogging(bool);
+
protected:
LibWebRTCProvider() = default;
@@ -131,6 +133,7 @@
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> m_factory;
bool m_disableNonLocalhostConnections { false };
bool m_supportsVP8 { false };
+ bool m_enableLogging { true };
#endif
};