WebKit icon indicating copy to clipboard operation
WebKit copied to clipboard

Calling configure on WebCodecs Video Encoder triggers a new key frame each time even if the configuration is only changing the bitrate

Open youennf opened this issue 2 years ago โ€ข 5 comments

c2c3eedb8d201a9fd6da3207279cd9e75a501687

Calling configure on WebCodecs Video Encoder triggers a new key frame each time even if the configuration is only changing the bitrate
https://bugs.webkit.org/show_bug.cgi?id=261402
rdar://115482127

Reviewed by NOBODY (OOPS!).

Check the new configuration is the same as the new one, except for bitrate and framerate.
If that is the case, we call setRate instead of recreating the encoder.
Implement setRate for VPX and remote encoders.

Covered by newly added test.

* LayoutTests/http/wpt/webcodecs/encode-bitrate-change-expected.txt: Added.
* LayoutTests/http/wpt/webcodecs/encode-bitrate-change.html: Added.
* Source/WebCore/Modules/webcodecs/WebCodecsVideoEncoder.cpp:
(WebCore::isSameConfigurationExceptBitrateAndFramerate):
(WebCore::WebCodecsVideoEncoder::updateRates):
(WebCore::WebCodecsVideoEncoder::configure):
* Source/WebCore/Modules/webcodecs/WebCodecsVideoEncoder.h:
* Source/WebCore/platform/VideoEncoder.h:
* Source/WebCore/platform/libwebrtc/LibWebRTCVPXVideoEncoder.cpp:
(WebCore::LibWebRTCVPXVideoEncoder::setRates):
(WebCore::computeAllocation):
(WebCore::LibWebRTCVPXInternalVideoEncoder::initialize):
(WebCore::LibWebRTCVPXInternalVideoEncoder::encode):
(WebCore::LibWebRTCVPXInternalVideoEncoder::setRates):
* Source/WebCore/platform/libwebrtc/LibWebRTCVPXVideoEncoder.h:
* Source/WebKit/WebProcess/GPU/media/RemoteVideoCodecFactory.cpp:
(WebKit::RemoteVideoEncoder::setRates):
(WebKit::RemoteVideoEncoder::flush):
* Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::setEncodeRatesCallback):
(WebKit::LibWebRTCCodecs::setEncodeRates):
* Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.h:

https://github.com/WebKit/WebKit/commit/13e81c02da2e01337c2eb8ab165a2ed2a00f2a11

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
โœ… ๐Ÿงช style โœ… ๐Ÿ›  ios โœ… ๐Ÿ›  mac โœ… ๐Ÿ›  wpe โœ… ๐Ÿ›  wincairo
โœ… ๐Ÿงช bindings โœ… ๐Ÿ›  ios-sim โœ… ๐Ÿ›  mac-AS-debug โŒ ๐Ÿงช wpe-wk2 โœ… ๐Ÿงช wincairo-tests
โœ… ๐Ÿงช webkitperl โœ… ๐Ÿงช ios-wk2 โœ… ๐Ÿงช api-mac โœ… ๐Ÿงช api-wpe
โœ… ๐Ÿงช ios-wk2-wpt โœ… ๐Ÿงช mac-wk1 โœ… ๐Ÿ›  wpe-cairo
โœ… ๐Ÿงช api-ios โœ… ๐Ÿงช mac-wk2 โœ… ๐Ÿ›  gtk
โœ… ๐Ÿ›  vision โœ… ๐Ÿงช mac-AS-debug-wk2 โŒ ๐Ÿงช gtk-wk2
โœ… ๐Ÿ›  vision-sim โœ… ๐Ÿงช mac-wk2-stress โœ… ๐Ÿงช api-gtk
โœ… ๐Ÿงช vision-wk2
โœ… ๐Ÿ›  tv
โœ… ๐Ÿ›  tv-sim
โœ… ๐Ÿ›  watch
โœ… ๐Ÿ›  watch-sim

youennf avatar Dec 08 '23 12:12 youennf

Commit message contains (OOPS!), blocking PR #21499

webkit-commit-queue avatar Jul 08 '24 16:07 webkit-commit-queue

Commit message contains (OOPS!), blocking PR #21499

webkit-commit-queue avatar Jul 09 '24 07:07 webkit-commit-queue

Committed 280771@main (37dfb4fa3c73): https://commits.webkit.org/280771@main

Reviewed commits have been landed. Closing PR #21499 and removing active labels.

webkit-commit-queue avatar Jul 09 '24 12:07 webkit-commit-queue