Skip to content
Permalink
Browse files
[WebCodecs] schedule dequeue event when encoder queue size decreases
https://bugs.webkit.org/show_bug.cgi?id=247000
rdar://problem/101539115

Reviewed by Eric Carlson.

Schedule event as per spec.

* LayoutTests/imported/w3c/web-platform-tests/webcodecs/video-encoder.https.any-expected.txt:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoEncoder.cpp:
(WebCore::WebCodecsVideoEncoder::encode):

Canonical link: https://commits.webkit.org/255962@main
  • Loading branch information
youennf committed Oct 25, 2022
1 parent 6efba45 commit 9676c2c46c92a89dd7585c5e25f1eba6de2ee1ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
@@ -2,7 +2,7 @@
PASS Test VideoEncoder construction
PASS Test VideoEncoder.configure()
FAIL Test successful configure(), encode(), and flush() promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'decoderConfig.colorSpace.primaries')"
FAIL encodeQueueSize test assert_equals: expected 0 but got Infinity
PASS encodeQueueSize test
PASS Test successful reset() and re-confiugre()
PASS Test successful encode() after re-configure().
PASS Verify closed VideoEncoder operations
@@ -210,6 +210,7 @@ ExceptionOr<void> WebCodecsVideoEncoder::encode(Ref<WebCodecsVideoFrame>&& frame
++m_encodeQueueSize;
queueControlMessageAndProcess([this, internalFrame = internalFrame.releaseNonNull(), timestamp = frame->timestamp(), duration = frame->duration(), options = WTFMove(options)]() mutable {
--m_encodeQueueSize;
scheduleDequeueEvent();
m_internalEncoder->encode({ WTFMove(internalFrame), timestamp, duration }, options.keyFrame, [this, weakedThis = WeakPtr { *this }](auto&& result) {
if (!weakedThis)
return;

0 comments on commit 9676c2c

Please sign in to comment.