Diff
Modified: trunk/Source/WebCore/ChangeLog (277170 => 277171)
--- trunk/Source/WebCore/ChangeLog 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebCore/ChangeLog 2021-05-07 12:31:26 UTC (rev 277171)
@@ -1,3 +1,26 @@
+2021-05-07 Youenn Fablet <[email protected]>
+
+ Add WebRTC logging control in GPUProcess
+ https://bugs.webkit.org/show_bug.cgi?id=225346
+
+ Reviewed by Eric Carlson.
+
+ Migrate setEnableLogging to setLoggingLevel as a virtual method so that it can be implemented by WebKit to send logging level to GPUProcess.
+ Simplify WebCore::LibWebRTCProvider::setLoggingLevel to not differentiate debug from non debug builds.
+ Manually tested.
+
+ * Modules/mediastream/RTCPeerConnection.cpp:
+ (WebCore::RTCPeerConnection::create):
+ * page/Page.cpp:
+ (WebCore::Page::configureLoggingChannel):
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+ (WebCore::computeLogLevel):
+ (WebCore::LibWebRTCProvider::setRTCLogging):
+ (WebCore::LibWebRTCProvider::setLoggingLevel):
+ (WebCore::setLogging): Deleted.
+ (WebCore::LibWebRTCProvider::setEnableLogging): Deleted.
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
+
2021-05-07 Frédéric Wang <[email protected]>
Crash in InsertTextCommand::positionInsideTextNode
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (277170 => 277171)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2021-05-07 12:31:26 UTC (rev 277171)
@@ -89,7 +89,10 @@
if (!peerConnection->isClosed()) {
if (auto* page = document.page()) {
peerConnection->registerToController(page->rtcController());
- page->libWebRTCProvider().setEnableLogging(!page->sessionID().isEphemeral());
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+ if (!page->sessionID().isEphemeral())
+ page->libWebRTCProvider().setLoggingLevel(LogWebRTC.level);
+#endif
}
}
return peerConnection;
Modified: trunk/Source/WebCore/page/Page.cpp (277170 => 277171)
--- trunk/Source/WebCore/page/Page.cpp 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebCore/page/Page.cpp 2021-05-07 12:31:26 UTC (rev 277171)
@@ -3379,8 +3379,8 @@
channel->level = level;
#if USE(LIBWEBRTC)
- if (channel == &LogWebRTC && m_mainFrame->document())
- libWebRTCProvider().setEnableLogging(!sessionID().isEphemeral());
+ if (channel == &LogWebRTC && m_mainFrame->document() && !sessionID().isEphemeral())
+ libWebRTCProvider().setLoggingLevel(LogWebRTC.level);
#endif
}
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (277170 => 277171)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2021-05-07 12:31:26 UTC (rev 277171)
@@ -143,19 +143,10 @@
#endif
}
-static void setLogging(rtc::LoggingSeverity level)
+static rtc::LoggingSeverity computeLogLevel(WTFLogLevel level)
{
- rtc::LogMessage::SetLogOutput(level, (level == rtc::LS_NONE) ? nullptr : doReleaseLogging);
-}
-
-static rtc::LoggingSeverity computeLogLevel()
-{
-#if defined(NDEBUG)
-#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- if (LogWebRTC.state != WTFLogChannelState::On)
- return rtc::LS_ERROR;
-
- switch (LogWebRTC.level) {
+#if !RELEASE_LOG_DISABLED
+ switch (level) {
case WTFLogLevel::Always:
case WTFLogLevel::Error:
return rtc::LS_ERROR;
@@ -166,16 +157,19 @@
case WTFLogLevel::Debug:
return rtc::LS_VERBOSE;
}
- RELEASE_ASSERT_NOT_REACHED();
- return rtc::LS_NONE;
+ ASSERT_NOT_REACHED();
#else
+ UNUSED_PARAM(level);
+#endif
return rtc::LS_NONE;
-#endif
-#else
- return (LogWebRTC.state != WTFLogChannelState::On) ? rtc::LS_WARNING : rtc::LS_INFO;
-#endif
}
+void LibWebRTCProvider::setRTCLogging(WTFLogLevel level)
+{
+ auto rtcLevel = computeLogLevel(level);
+ rtc::LogMessage::SetLogOutput(rtcLevel, (rtcLevel == rtc::LS_NONE) ? nullptr : doReleaseLogging);
+}
+
static void initializePeerConnectionFactoryAndThreads(PeerConnectionFactoryAndThreads& factoryAndThreads)
{
ASSERT(!factoryAndThreads.networkThread);
@@ -244,12 +238,9 @@
threads.signalingThread->Post(RTC_FROM_HERE, &threads, 1, new ThreadMessageData(WTFMove(callback)));
}
-void LibWebRTCProvider::setEnableLogging(bool enableLogging)
+void LibWebRTCProvider::setLoggingLevel(WTFLogLevel level)
{
- if (!m_enableLogging)
- return;
- m_enableLogging = enableLogging;
- setLogging(enableLogging ? computeLogLevel() : rtc::LS_NONE);
+ setRTCLogging(level);
}
webrtc::PeerConnectionFactoryInterface* LibWebRTCProvider::factory()
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h (277170 => 277171)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2021-05-07 12:31:26 UTC (rev 277171)
@@ -78,6 +78,7 @@
static void registerWebKitVP9Decoder();
static void registerWebKitVP8Decoder();
static void setH264HardwareEncoderAllowed(bool);
+ static void setRTCLogging(WTFLogLevel);
virtual void setActive(bool);
@@ -128,7 +129,7 @@
void clearFactory() { m_factory = nullptr; }
- void setEnableLogging(bool);
+ virtual void setLoggingLevel(WTFLogLevel);
void setEnableWebRTCEncryption(bool);
void setUseDTLS10(bool);
@@ -163,7 +164,6 @@
bool m_supportsVP9Profile0 { false };
bool m_supportsVP9Profile2 { false };
bool m_supportsVP9VTB { false };
- bool m_enableLogging { true };
bool m_useDTLS10 { false };
#endif
};
Modified: trunk/Source/WebKit/ChangeLog (277170 => 277171)
--- trunk/Source/WebKit/ChangeLog 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/ChangeLog 2021-05-07 12:31:26 UTC (rev 277171)
@@ -1,3 +1,28 @@
+2021-05-07 Youenn Fablet <[email protected]>
+
+ Add WebRTC logging control in GPUProcess
+ https://bugs.webkit.org/show_bug.cgi?id=225346
+
+ Reviewed by Eric Carlson.
+
+ Implement setting of WebRTC log level using LibWebRTCCodecs and LibWebRTCCodecsProxy.
+ This will help debugging issues with GPU-running webrtc codecs.
+
+ * GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
+ * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in:
+ * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
+ (WebKit::toWebRTCVideoRotation):
+ (WebKit::LibWebRTCCodecsProxy::setRTCLoggingLevel):
+ * SourcesCocoa.txt:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
+ (WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionOnMainThread):
+ (WebKit::LibWebRTCCodecs::setLoggingLevel):
+ * WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
+ * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
+ (WebKit::LibWebRTCProvider::setLoggingLevel):
+ * WebProcess/Network/webrtc/LibWebRTCProvider.h:
+
2021-05-07 Wenson Hsieh <[email protected]>
[iOS] Safari sometimes hangs underneath `WebKit::UIDelegate::UIClient::createNewPage`
Modified: trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.h (277170 => 277171)
--- trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.h 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.h 2021-05-07 12:31:26 UTC (rev 277171)
@@ -81,6 +81,7 @@
void initializeEncoder(RTCEncoderIdentifier, uint16_t width, uint16_t height, unsigned startBitrate, unsigned maxBitrate, unsigned minBitrate, uint32_t maxFramerate);
void encodeFrame(RTCEncoderIdentifier, WebCore::RemoteVideoSample&&, uint32_t timeStamp, bool shouldEncodeAsKeyFrame);
void setEncodeRates(RTCEncoderIdentifier, uint32_t bitRate, uint32_t frameRate);
+ void setRTCLoggingLevel(WTFLogLevel);
CFDictionaryRef ioSurfacePixelBufferCreationOptions(IOSurfaceRef);
Modified: trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in (277170 => 277171)
--- trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in 2021-05-07 12:31:26 UTC (rev 277171)
@@ -36,6 +36,7 @@
InitializeEncoder(WebKit::RTCEncoderIdentifier id, uint16_t width, uint16_t height, unsigned startBitrate, unsigned maxBitrate, unsigned minBitrate, uint32_t maxFramerate)
EncodeFrame(WebKit::RTCEncoderIdentifier id, WebCore::RemoteVideoSample sample, uint32_t timeStamp, bool shouldEncodeAsKeyFrame)
SetEncodeRates(WebKit::RTCEncoderIdentifier id, uint32_t bitRate, uint32_t frameRate)
+ SetRTCLoggingLevel(WTFLogLevel level)
}
#endif
Modified: trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm (277170 => 277171)
--- trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm 2021-05-07 12:31:26 UTC (rev 277171)
@@ -29,10 +29,11 @@
#if USE(LIBWEBRTC) && PLATFORM(COCOA) && ENABLE(GPU_PROCESS)
#import "GPUConnectionToWebProcess.h"
+#import "GPUProcess.h"
#import "LibWebRTCCodecsMessages.h"
#import "LibWebRTCCodecsProxyMessages.h"
#import "WebCoreArgumentCoders.h"
-#import <WebCore/LibWebRTCMacros.h>
+#import <WebCore/LibWebRTCProvider.h>
#import <WebCore/RemoteVideoSample.h>
#import <webrtc/sdk/WebKit/WebKitDecoder.h>
#import <webrtc/sdk/WebKit/WebKitEncoder.h>
@@ -174,16 +175,16 @@
webrtc::initializeLocalEncoder(encoder, width, height, startBitrate, maxBitrate, minBitrate, maxFramerate);
}
-static inline webrtc::VideoRotation toWebRTCVideoRotation(MediaSample::VideoRotation rotation)
+static inline webrtc::VideoRotation toWebRTCVideoRotation(WebCore::MediaSample::VideoRotation rotation)
{
switch (rotation) {
- case MediaSample::VideoRotation::None:
+ case WebCore::MediaSample::VideoRotation::None:
return webrtc::kVideoRotation_0;
- case MediaSample::VideoRotation::UpsideDown:
+ case WebCore::MediaSample::VideoRotation::UpsideDown:
return webrtc::kVideoRotation_180;
- case MediaSample::VideoRotation::Right:
+ case WebCore::MediaSample::VideoRotation::Right:
return webrtc::kVideoRotation_90;
- case MediaSample::VideoRotation::Left:
+ case WebCore::MediaSample::VideoRotation::Left:
return webrtc::kVideoRotation_270;
}
ASSERT_NOT_REACHED();
@@ -224,6 +225,11 @@
return m_encoders.isEmpty() && m_decoders.isEmpty();
}
+void LibWebRTCCodecsProxy::setRTCLoggingLevel(WTFLogLevel level)
+{
+ WebCore::LibWebRTCProvider::setRTCLogging(level);
}
+}
+
#endif
Modified: trunk/Source/WebKit/SourcesCocoa.txt (277170 => 277171)
--- trunk/Source/WebKit/SourcesCocoa.txt 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2021-05-07 12:31:26 UTC (rev 277171)
@@ -67,7 +67,7 @@
GPUProcess/media/RemoteImageDecoderAVFProxy.cpp
GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm
GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp
-GPUProcess/webrtc/LibWebRTCCodecsProxy.mm
+GPUProcess/webrtc/LibWebRTCCodecsProxy.mm @no-unify
Platform/cf/ModuleCF.cpp
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (277170 => 277171)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-05-07 12:31:26 UTC (rev 277171)
@@ -939,6 +939,7 @@
41897ED11F415D680016FA42 /* WebCacheStorageConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 41897ECD1F415D5C0016FA42 /* WebCacheStorageConnection.h */; };
41897ED81F415D8A0016FA42 /* CacheStorageEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 41897ED21F415D850016FA42 /* CacheStorageEngine.h */; };
41897EDA1F415D8A0016FA42 /* CacheStorageEngineConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 41897ED41F415D850016FA42 /* CacheStorageEngineConnection.h */; };
+ 41A0EB142641714900794471 /* LibWebRTCCodecsProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41E0A7C823B6397900561060 /* LibWebRTCCodecsProxy.mm */; };
41C5379021F15B55008B1FAD /* _WKWebsiteDataStoreDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 41C5378F21F1362D008B1FAD /* _WKWebsiteDataStoreDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
41D129DA1F3D101800D15E47 /* WebCacheStorageProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D129D91F3D101400D15E47 /* WebCacheStorageProvider.h */; };
41DC45961E3D6E2200B11F51 /* NetworkRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DC45941E3D6E1E00B11F51 /* NetworkRTCProvider.h */; };
@@ -14112,6 +14113,7 @@
C1710CF724AA643200D7C112 /* LaunchServicesDatabaseObserver.mm in Sources */,
2984F588164BA095004BC0C6 /* LegacyCustomProtocolManagerMessageReceiver.cpp in Sources */,
2984F57C164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessageReceiver.cpp in Sources */,
+ 41A0EB142641714900794471 /* LibWebRTCCodecsProxy.mm in Sources */,
51F060E11654318500F3281C /* LibWebRTCNetworkMessageReceiver.cpp in Sources */,
449D90DA21FDC30B00F677C0 /* LocalAuthenticationSoftLink.mm in Sources */,
2D92A779212B6A6100F493FD /* Logging.cpp in Sources */,
Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp (277170 => 277171)
--- trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp 2021-05-07 12:31:26 UTC (rev 277171)
@@ -185,6 +185,9 @@
gpuConnection.addClient(*this);
m_connection = makeRef(gpuConnection.connection());
m_connection->addThreadMessageReceiver(Messages::LibWebRTCCodecs::messageReceiverName(), this);
+
+ if (m_loggingLevel)
+ m_connection->send(Messages::LibWebRTCCodecsProxy::SetRTCLoggingLevel(*m_loggingLevel), 0);
}
// May be called on any thread.
@@ -530,6 +533,13 @@
});
}
+void LibWebRTCCodecs::setLoggingLevel(WTFLogLevel level)
+{
+ m_loggingLevel = level;
+ if (m_connection)
+ m_connection->send(Messages::LibWebRTCCodecsProxy::SetRTCLoggingLevel(level), 0);
}
+}
+
#endif
Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.h (277170 => 277171)
--- trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.h 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.h 2021-05-07 12:31:26 UTC (rev 277171)
@@ -117,6 +117,7 @@
void setVP9VTBSupport(bool supportVP9VTB) { m_supportVP9VTB = supportVP9VTB; }
bool supportVP9VTB() const { return m_supportVP9VTB; }
+ void setLoggingLevel(WTFLogLevel);
private:
LibWebRTCCodecs();
@@ -154,6 +155,7 @@
size_t m_pixelBufferPoolWidth { 0 };
size_t m_pixelBufferPoolHeight { 0 };
bool m_supportVP9VTB { false };
+ Optional<WTFLogLevel> m_loggingLevel;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp (277170 => 277171)
--- trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp 2021-05-07 12:31:26 UTC (rev 277171)
@@ -160,6 +160,14 @@
return &RTCDataChannelRemoteManager::sharedManager().remoteHandlerConnection();
}
+void LibWebRTCProvider::setLoggingLevel(WTFLogLevel level)
+{
+ WebCore::LibWebRTCProvider::setLoggingLevel(level);
+#if PLATFORM(COCOA)
+ WebProcess::singleton().libWebRTCCodecs().setLoggingLevel(level);
+#endif
+}
+
} // namespace WebKit
#endif // USE(LIBWEBRTC)
Modified: trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.h (277170 => 277171)
--- trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.h 2021-05-07 12:17:18 UTC (rev 277170)
+++ trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.h 2021-05-07 12:31:26 UTC (rev 277171)
@@ -61,6 +61,7 @@
void disableNonLocalhostConnections() final;
void startedNetworkThread() final;
RefPtr<WebCore::RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final;
+ void setLoggingLevel(WTFLogLevel) final;
#if ENABLE(GPU_PROCESS) && PLATFORM(COCOA) && !PLATFORM(MACCATALYST)
WebPage& m_webPage;