Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 96e956dd67b6d6a941f922bcee5e653dd5bb42df
      
https://github.com/WebKit/WebKit/commit/96e956dd67b6d6a941f922bcee5e653dd5bb42df
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2026-05-05 (Tue, 05 May 2026)

  Changed paths:
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm
    M Source/WebCore/platform/graphics/cocoa/CMUtilities.h
    M Source/WebCore/platform/graphics/cocoa/CMUtilities.mm
    M Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.h
    M Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A 
Tools/TestWebKitAPI/Tests/WebCore/cocoa/WebCoreDecompressionSessionTests.mm

  Log Message:
  -----------
  https://bugs.webkit.org/show_bug.cgi?id=314035
rdar://176222723
[MSE] WebCoreDecompressionSession should drop frames until keyframe after 
format change instead of failing fatally

Reviewed by Youenn Fablet.

When a video format description change is detected on a non-keyframe,
WebCoreDecompressionSession previously returned kVTVideoDecoderBadDataErr,
which propagated as a fatal decode error tearing down the entire MediaSource.
This could occur during adaptive bitrate switches on live streams (e.g. Twitch)
where format changes don't always align with keyframe boundaries due to an
issue with AVStreamDataParser that will accept media segments before an init 
segments.
This will be fixed in a follow-up in webkit.org/b/314045

Instead, drop frames until the next keyframe arrives, then create a new
VTDecompressionSession with the updated format. Also require a keyframe
after every flush, matching decoder expectations.

Extract isCMSampleBufferRandomAccess from MediaSampleAVFObjC into
CMUtilities to avoid allocating a MediaSampleAVFObjC just to check
the sync flag.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::isCMSampleBufferRandomAccess): Deleted.
* Source/WebCore/platform/graphics/cocoa/CMUtilities.h:
* Source/WebCore/platform/graphics/cocoa/CMUtilities.mm:
(WebCore::isCMSampleBufferRandomAccess):
* Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.h:
(WebCore::WebCoreDecompressionSession::WTF_GUARDED_BY_CAPABILITY):
* Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::ensureDecoderForSample):
(WebCore::WebCoreDecompressionSession::decodeSampleInternal):
(WebCore::WebCoreDecompressionSession::flush):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:

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



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

Reply via email to