Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 57e44bb6ce39e7a8f586dc69aac4715ac835d67e
https://github.com/WebKit/WebKit/commit/57e44bb6ce39e7a8f586dc69aac4715ac835d67e
Author: Jean-Yves Avenard <[email protected]>
Date: 2026-05-18 (Mon, 18 May 2026)
Changed paths:
M Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm
Log Message:
-----------
(313296@main) ASSERTION FAILED:
m_samples.decodeOrder().findSampleWithDecodeKey
https://bugs.webkit.org/show_bug.cgi?id=314997
rdar://177312155
Reviewed by Youenn Fablet.
Change 313296@main exposed a real problem where samples could be silently
dropped by the MediaPlayerPrivateWebM which at best resulted in invalid
memory tracking and at worse with decoding errors.
The content generated by the MediaRecorder could include content where
the format is changing mid-streams.
MediaRecorder-generated WebM streams can carry consecutive audio packets
with identical (DTS, PTS) keys in their compressed output. The
AudioSampleBufferConverter that produced them sets
OutputPresentationTimeStamp on each compressed packet using a running
m_currentOutputPresentationTimeStamp that only advances by each
packet's OutputDuration (native duration minus TrimDurationAtStart);
during a converter's priming phase that delta is zero, so several
consecutive primed packets emerge with the same OutputPT. This is most
visible immediately after an audio-track reconfiguration because
MediaRecorderPrivateEncoder spins up a fresh converter, which goes
through its own priming with the new format.
The SampleMap is keyed on (DTS, PTS) and accounts for sizeInBytes()
unconditionally for eviction; a duplicate key would either trip the
ASSERT in TrackBuffer::addSample or, worse, silently no-op the
insert and skew accounting, for video is would lead to decoding error.
Bump the incoming sample by one microsecond past the colliding entry
so each priming packet remains addressable in the buffer (they are
required as decoder pre-roll); the bump is well withing timeFudgeFactor()
and does not affect seek behaviour.
Covered by existing tests
* Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm:
(WebCore::MediaPlayerPrivateWebM::didProvideMediaDataForTrackId):
Canonical link: https://commits.webkit.org/313413@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications