Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c5cf5b7adef53ed9941565a6b1086dc601a8517a
      
https://github.com/WebKit/WebKit/commit/c5cf5b7adef53ed9941565a6b1086dc601a8517a
  Author: Cameron McCormack <[email protected]>
  Date:   2026-08-31 (Mon, 31 Aug 2026)

  Changed paths:
    A 
LayoutTests/http/wpt/mediarecorder/MediaRecorder-single-frame-timeslice-expected.txt
    A 
LayoutTests/http/wpt/mediarecorder/MediaRecorder-single-frame-timeslice.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/platform/mediarecorder/MediaRecorderPrivateEncoder.cpp

  Log Message:
  -----------
  Let a lone video keyframe start a MediaRecorder segment rather than holding 
it back indefinitely.
https://bugs.webkit.org/show_bug.cgi?id=322960
rdar://186229843

Reviewed by Jean-Yves Avenard.

MediaRecorderPrivateEncoder::flushToEndSegment holds back the last video 
keyframe
so it can start the next segment, because MP4 requires segments to begin with
one. When that keyframe is the only thing in the queue, which is what a source
producing a single frame gives, nothing is muxed: m_interleavedFrames stays
empty, the write condition fails, fetchData returns a zero-byte buffer, and
MediaRecorder::requestDataInternal suppresses dataavailable for an empty buffer.
The timeslice timer restarts and repeats that indefinitely.

The intermittency comes from partiallyFlushEncodedQueues, which muxes without 
the
hold-back but bails while a flush is pending. VideoToolbox emits the single
compressed frame around a second after submission, so whether it lands before or
inside the timeslice flush decides the outcome.

Let the keyframe start the current segment when holding it back would mux 
nothing
at all: empty pending segment, empty encoded-audio queue, and the keyframe at 
the
head of the video queue. WebM is unaffected because it does not require segments
to start with a keyframe, and the audio-queue condition leaves the interleaving
path alone.

The defect is wider than this test: any canvas recorded at roughly one frame or
fewer per timeslice emits no data until stop(). A regression test covering that
directly is added, using captureStream(0) so the frame count is exact and
specified.

Test: http/wpt/mediarecorder/MediaRecorder-single-frame-timeslice.html

* 
LayoutTests/http/wpt/mediarecorder/MediaRecorder-single-frame-timeslice-expected.txt:
 Added.
* LayoutTests/http/wpt/mediarecorder/MediaRecorder-single-frame-timeslice.html: 
Added.
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebCore/platform/mediarecorder/MediaRecorderPrivateEncoder.cpp:
(WebCore::MediaRecorderPrivateEncoder::flushToEndSegment):
* LayoutTests/platform/glib/TestExpectations:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to