Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ed70932184c2b8c38885f95cc2785e8bdb0f4906
https://github.com/WebKit/WebKit/commit/ed70932184c2b8c38885f95cc2785e8bdb0f4906
Author: Jean-Yves Avenard <[email protected]>
Date: 2026-06-08 (Mon, 08 Jun 2026)
Changed paths:
A LayoutTests/media/media-source/content/test-aac-shared-format.mp4
A LayoutTests/media/media-source/content/test-adts.aac
A
LayoutTests/media/media-source/media-managedmse-aac-shared-format-expected.txt
A LayoutTests/media/media-source/media-managedmse-aac-shared-format.html
A LayoutTests/media/media-source/media-managedmse-adts-aac-expected.txt
A LayoutTests/media/media-source/media-managedmse-adts-aac.html
M LayoutTests/platform/glib/TestExpectations
M Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm
Log Message:
-----------
[MSE][iOS] Silent audio under MediaContainmentEnabled when AVStreamDataParser
emits AAC CMSampleBuffers without a
sample-size array
https://bugs.webkit.org/show_bug.cgi?id=316425
rdar://178041154
Reviewed by Jer Noble.
For some AAC content, AVStreamDataParser emits multi-sample audio
CMSampleBuffers whose CMSampleBufferGetSampleSizeArray returns
kCMSampleBufferError_BufferHasNoSampleSizes; per-packet sizes are carried
in the audio stream packet description array instead.
MediaSampleAVFObjC::divide() subdivided buffers using
CMSampleBufferCallBlockForEachSample, which cannot operate on that shape
and returns with kCMSampleBufferError_CannotSubdivide before invoking its
callback. divide() therefore returned an empty Vector. With
MediaContainmentEnabled the IPC encode path
(samplesBlockFromCMSampleBuffer -> divide() -> per-packet MediaSampleItems)
shipped an empty MediaSamplesBlock to the GPU process; the rebuilt
CMSampleBuffer carried no decodable packets, so the audio renderer played
silence while the synchronizer's timebase still advanced -- currentTime
progressed but no audio was heard.
Fixed by detecting the BufferHasNoSampleSizes shape in
MediaSampleAVFObjC::divide() and walking the audio stream packet
description array directly, building per-packet sub-CMSampleBuffers whose
data buffers reference the source block buffer (zero-copy via
CMBlockBufferAppendBufferReference) instead of relying on
CMSampleBufferCallBlockForEachSample.
Those MediaSample aren't correctly handled by other related methods in
MediaSampleAVFObjC and will cause incorrect handling when removed or
seeked into. We will handle those in webkit.org/b/316467
* Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::divide): When the source CMSampleBuffer
reports BufferHasNoSampleSizes, walk getPacketDescriptions() and build
per-packet sub-CMSampleBuffers referencing the source block buffer.
* LayoutTests/media/media-source/content/test-aac-shared-format.mp4: Added.
* LayoutTests/media/media-source/content/test-adts.aac: Added.
* LayoutTests/media/media-source/media-managedmse-aac-shared-format.html: Added.
* LayoutTests/media/media-source/media-managedmse-adts-aac.html: Added.
Canonical link: https://commits.webkit.org/314771@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications