Skip to content

Commit 6804ca0

Browse files
committed
Add internal flag to enable/disable H264 hardware encoder
https://bugs.webkit.org/show_bug.cgi?id=216534 Reviewed by Eric Carlson. Source/WebCore: Update process-wide hardware H264 boolean flag based on internal feature flag. No change of behavior. * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::LibWebRTCProvider::setH264HardwareEncoderAllowed): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProvider::setH264HardwareEncoderAllowed): (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa): (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed): Deleted. * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setH264HardwareEncoderAllowed): Source/WebKit: * Shared/WebPreferencesInternal.yaml: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Canonical link: https://commits.webkit.org/229508@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267249 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 379ffc3 commit 6804ca0

9 files changed

Lines changed: 53 additions & 12 deletions

File tree

Source/WebCore/ChangeLog

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
2020-09-18 Youenn Fablet <youenn@apple.com>
2+
3+
Add internal flag to enable/disable H264 hardware encoder
4+
https://bugs.webkit.org/show_bug.cgi?id=216534
5+
6+
Reviewed by Eric Carlson.
7+
8+
Update process-wide hardware H264 boolean flag based on internal feature flag.
9+
No change of behavior.
10+
11+
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
12+
(WebCore::LibWebRTCProvider::setH264HardwareEncoderAllowed):
13+
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
14+
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
15+
(WebCore::LibWebRTCProvider::setH264HardwareEncoderAllowed):
16+
(WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
17+
(WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed): Deleted.
18+
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
19+
* testing/Internals.cpp:
20+
(WebCore::Internals::resetToConsistentState):
21+
(WebCore::Internals::setH264HardwareEncoderAllowed):
22+
123
2020-09-18 Youenn Fablet <youenn@apple.com>
224

325
Hash deviceIds in WebProcess instead of UIProcess to allow audio output device IDs in WebProcess

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ bool LibWebRTCProvider::webRTCAvailable()
6969
void LibWebRTCProvider::registerWebKitVP9Decoder()
7070
{
7171
}
72+
73+
void LibWebRTCProvider::setH264HardwareEncoderAllowed(bool)
74+
{
75+
}
7276
#endif
7377

7478
void LibWebRTCProvider::setActive(bool)

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ class WEBCORE_EXPORT LibWebRTCProvider {
7373

7474
static bool webRTCAvailable();
7575
static void registerWebKitVP9Decoder();
76+
static void setH264HardwareEncoderAllowed(bool);
7677

7778
virtual void setActive(bool);
7879

79-
virtual void setH264HardwareEncoderAllowed(bool) { }
80-
8180
using IPAddressOrError = Expected<String, MDNSRegisterError>;
8281
using MDNSNameOrError = Expected<String, MDNSRegisterError>;
8382

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ UniqueRef<LibWebRTCProvider> LibWebRTCProvider::create()
4646
return makeUniqueRef<LibWebRTCProviderCocoa>();
4747
}
4848

49-
LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa()
49+
void LibWebRTCProvider::setH264HardwareEncoderAllowed(bool allowed)
5050
{
51+
webrtc::setH264HardwareEncoderAllowed(allowed);
5152
}
5253

53-
void LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed(bool allowed)
54+
LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa()
5455
{
55-
webrtc::setH264HardwareEncoderAllowed(allowed);
5656
}
5757

5858
std::unique_ptr<webrtc::VideoDecoderFactory> LibWebRTCProviderCocoa::createDecoderFactory()

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class WEBCORE_EXPORT LibWebRTCProviderCocoa : public LibWebRTCProvider {
4646
private:
4747
void setActive(bool) final;
4848
std::unique_ptr<webrtc::VideoEncoderFactory> createEncoderFactory() final;
49-
50-
void setH264HardwareEncoderAllowed(bool allowed) final;
5149
};
5250

5351
} // namespace WebCore

Source/WebCore/testing/Internals.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void Internals::resetToConsistentState(Page& page)
563563
auto& rtcProvider = page.libWebRTCProvider();
564564
WebCore::useRealRTCPeerConnectionFactory(rtcProvider);
565565
rtcProvider.disableNonLocalhostConnections();
566-
rtcProvider.setH264HardwareEncoderAllowed(true);
566+
LibWebRTCProvider::setH264HardwareEncoderAllowed(true);
567567
RuntimeEnabledFeatures::sharedFeatures().setWebRTCH265CodecEnabled(true);
568568
page.settings().setWebRTCEncryptionEnabled(true);
569569
#endif
@@ -5179,10 +5179,7 @@ bool Internals::isPageActive() const
51795179
#if ENABLE(WEB_RTC)
51805180
void Internals::setH264HardwareEncoderAllowed(bool allowed)
51815181
{
5182-
auto* document = contextDocument();
5183-
if (!document || !document->page())
5184-
return;
5185-
document->page()->libWebRTCProvider().setH264HardwareEncoderAllowed(allowed);
5182+
LibWebRTCProvider::setH264HardwareEncoderAllowed(allowed);
51865183
}
51875184
#endif
51885185

Source/WebKit/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2020-09-18 Youenn Fablet <youenn@apple.com>
2+
3+
Add internal flag to enable/disable H264 hardware encoder
4+
https://bugs.webkit.org/show_bug.cgi?id=216534
5+
6+
Reviewed by Eric Carlson.
7+
8+
* Shared/WebPreferencesInternal.yaml:
9+
* WebProcess/WebPage/WebPage.cpp:
10+
(WebKit::WebPage::updatePreferences):
11+
112
2020-09-18 Youenn Fablet <youenn@apple.com>
213

314
Hash deviceIds in WebProcess instead of UIProcess to allow audio output device IDs in WebProcess

Source/WebKit/Shared/WebPreferencesInternal.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ WebRTCH264SimulcastEnabled:
5555
humanReadableName: "WebRTC H264 Simulcast"
5656
humanReadableDescription: "Enable WebRTC H264 Simulcast"
5757

58+
WebRTCH264HardwareEncoderEnabled:
59+
type: bool
60+
defaultValue: true
61+
webcoreBinding: none
62+
condition: ENABLE(WEB_RTC)
63+
humanReadableName: "WebRTC H264 Hardware encoder"
64+
humanReadableDescription: "Enable H264 Hardware encoder"
65+
category: internal
66+
5867
WebRTCMDNSICECandidatesEnabled:
5968
type: bool
6069
defaultValue: true

Source/WebKit/WebProcess/WebPage/WebPage.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3780,6 +3780,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
37803780
#if USE(LIBWEBRTC)
37813781
m_page->libWebRTCProvider().setH265Support(RuntimeEnabledFeatures::sharedFeatures().webRTCH265CodecEnabled());
37823782
m_page->libWebRTCProvider().setVP9Support(RuntimeEnabledFeatures::sharedFeatures().webRTCVP9CodecEnabled());
3783+
LibWebRTCProvider::setH264HardwareEncoderAllowed(store.getBoolValueForKey(WebPreferencesKey::webRTCH264HardwareEncoderEnabledKey()));
37833784
#endif
37843785

37853786
#if ENABLE(GPU_PROCESS)

0 commit comments

Comments
 (0)