Skip to content

Commit

Permalink
VideoEncoder does not call output callback on FullHD configuration
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=258669
rdar://111685821

Reviewed by Eric Carlson.

Extract the profile level id from the codec string for H.264 and send it to GPUProcess for proper initialization.

* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/http/wpt/webcodecs/videoFrame-colorSpace-expected.txt:
* LayoutTests/http/wpt/webcodecs/videoFrame-colorSpace.html:
* Source/WebKit/WebProcess/GPU/media/RemoteVideoCodecFactory.cpp:
(WebKit::RemoteVideoCodecFactory::createEncoder):

Canonical link: https://commits.webkit.org/265792@main
  • Loading branch information
youennf committed Jul 6, 2023
1 parent 1e1eecd commit 9879838
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
PASS VP8 decoded frame color space
PASS VP9 decoded frame color space
PASS H.264 decoded frame color space
PASS H.264 high profile decoded frame color space

7 changes: 4 additions & 3 deletions LayoutTests/http/wpt/webcodecs/videoFrame-colorSpace.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
return promise;
}

function doTest(codec, title)
function doTest(codec, title, width = 320, height = 200)
{
const config = { codec };
config.width = 320;
config.height = 200;
config.width = width;
config.height = height;
config.bitrate = 1000000;
config.framerate = 30;

Expand All @@ -81,6 +81,7 @@
doTest('vp8', "VP8 decoded frame color space");
doTest('vp09.00.10.08', "VP9 decoded frame color space");
doTest('avc1.42001E', "H.264 decoded frame color space");
doTest('avc1.64000b', "H.264 high profile decoded frame color space", 1000, 1000);
</script>
</body>
</html>
2 changes: 2 additions & 0 deletions LayoutTests/platform/glib/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,8 @@ imported/w3c/web-platform-tests/webcodecs/temporal-svc-encoding.https.any.html?v

imported/w3c/web-platform-tests/webcodecs/videoFrame-createImageBitmap.any.worker.html [ Pass ]

http/wpt/webcodecs/videoFrame-colorSpace.html [ Skip ]

# Likely bugs related with dav1ddec.
imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.html?av1 [ Failure ]
imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.worker.html?av1 [ Failure ]
Expand Down
10 changes: 9 additions & 1 deletion Source/WebKit/WebProcess/GPU/media/RemoteVideoCodecFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ void RemoteVideoCodecFactory::createEncoder(const String& codec, const WebCore::
return;
}

WebProcess::singleton().libWebRTCCodecs().createEncoderAndWaitUntilReady(*type, { }, config.isRealtime, config.useAnnexB, [config, createCallback = WTFMove(createCallback), descriptionCallback = WTFMove(descriptionCallback), outputCallback = WTFMove(outputCallback), postTaskCallback = WTFMove(postTaskCallback)](auto& internalEncoder) mutable {
std::map<std::string, std::string> parameters;
if (type == VideoCodecType::H264) {
if (auto position = codec.find('.');position != notFound && position != codec.length()) {
auto profileLevelId = StringView(codec).substring(position + 1);
parameters["profile-level-id"] = std::string(reinterpret_cast<const char*>(profileLevelId.characters8()), profileLevelId.length());
}
}

WebProcess::singleton().libWebRTCCodecs().createEncoderAndWaitUntilReady(*type, parameters, config.isRealtime, config.useAnnexB, [config, createCallback = WTFMove(createCallback), descriptionCallback = WTFMove(descriptionCallback), outputCallback = WTFMove(outputCallback), postTaskCallback = WTFMove(postTaskCallback)](auto& internalEncoder) mutable {
auto callbacks = RemoteVideoEncoderCallbacks::create(WTFMove(descriptionCallback), WTFMove(outputCallback), WTFMove(postTaskCallback));
UniqueRef<VideoEncoder> encoder = makeUniqueRef<RemoteVideoEncoder>(internalEncoder, config, callbacks.copyRef());
callbacks->postTask([createCallback = WTFMove(createCallback), encoder = WTFMove(encoder)]() mutable {
Expand Down

0 comments on commit 9879838

Please sign in to comment.