[webkit-changes] [WebKit/WebKit] 11c16a: WebCodecs hardware encoders may loose a frame in c...

youennf noreply at github.com
Mon Sep 11 09:47:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 11c16abe0e925e42914d86836716d1941f355231
      https://github.com/WebKit/WebKit/commit/11c16abe0e925e42914d86836716d1941f355231
  Author: Youenn Fablet <youennf at gmail.com>
  Date:   2023-09-11 (Mon, 11 Sep 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any.js
    M LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any.worker_h264_annexb-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any.worker_h264_avc-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any.worker_vp9_p2-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any_h264_annexb-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any_h264_avc-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any_vp9_p2-expected.txt
    M Source/WebKit/WebProcess/GPU/media/RemoteVideoCodecFactory.cpp
    M Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp
    M Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.h

  Log Message:
  -----------
  WebCodecs hardware encoders may loose a frame in case of calling configure and encoding a frame just after
https://bugs.webkit.org/show_bug.cgi?id=261385
rdar://115252749

Reviewed by Eric Carlson.

Before the patch, we were creating the encoder, and once done initializing it and setting the bitrate.
We were then running the process queue which could mean encoding a frame.

The initializing step was going to main thread then to LibWebRTCCodecs work queue.
The encoding of a frame would go directly to the LibWebRTCCodecs work queue,
which means there would be cases where the encoding of the frame would happen in GPUProcess sooner than initializing the encoder.

To prevent this, we make sure to send the initialize IPC message at the time the encoder gets created.

We provide bitrate estimates at initialization time like done for WebRTC.
We also fix the bitrate parameters which needs to be given as kbps and not bps.

* LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any.js:
(promise_setup):
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any.worker_h264_annexb-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any.worker_h264_avc-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any.worker_vp9_p2-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any_h264_annexb-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any_h264_avc-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/reconfiguring-encoder.https.any_vp9_p2-expected.txt:
* Source/WebKit/WebProcess/GPU/media/RemoteVideoCodecFactory.cpp:
(WebKit::RemoteVideoCodecFactory::createEncoder):
(WebKit::RemoteVideoEncoder::RemoteVideoEncoder):
* Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::createEncoderAndWaitUntilInitialized):
(WebKit::LibWebRTCCodecs::initializeEncoder):
(WebKit::LibWebRTCCodecs::initializeEncoderInternal):
(WebKit::LibWebRTCCodecs::createEncoderAndWaitUntilReady): Deleted.
* Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
(WebKit::LibWebRTCCodecs::initializeEncoder):

Canonical link: https://commits.webkit.org/267865@main




More information about the webkit-changes mailing list