Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8b6f92de7d153ceed3dca1e96907c0884f4c3430
      
https://github.com/WebKit/WebKit/commit/8b6f92de7d153ceed3dca1e96907c0884f4c3430
  Author: Eric Carlson <[email protected]>
  Date:   2026-05-28 (Thu, 28 May 2026)

  Changed paths:
    M LayoutTests/media/media-source/mp4-generator.js
    A LayoutTests/media/track/caption-generator.js
    A LayoutTests/media/track/track-inband-cea608-cue-endtime-expected.txt
    A LayoutTests/media/track/track-inband-cea608-cue-endtime.html
    M 
Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp

  Log Message:
  -----------
  [Cocoa] Update the current cue's endTime when legible output sends an empty 
or NULL attributed array
https://bugs.webkit.org/show_bug.cgi?id=315790
rdar://172758610

Reviewed by Jer Noble.

Add layout test for CEA-608 cue endTime being set by an EDM clear

InbandTextTrackPrivateAVF::processCue() was guarding the call to
processAttributedStrings() with CFArrayGetCount(), which dropped the
null or empty attributed-string array AVFoundation delivers when captions
provided to the AVPlayerItemLegibleOutput delegate are cleared.
processAttributedStrings() already handles that case by calling
updateCurrentCueEndTimes(), so the last cue's endTime was never set.
Fix: always call `processAttributedStrings()`.

The new test (track-inband-cea608-cue-endtime.html) builds a
self-contained fMP4 in JavaScript using two helpers:

- caption-generator.js encodes CEA-608 byte sequences and packages
  them as cdat-box caption samples. CEA608.popOn() and CEA608.paintOn()
  produce complete caption events (mode + position + text), and
  Captions.buildPopOnCueSamples() / buildPaintOnCueSamples() return
  arrays of {data, duration} samples including a final EDM clear.

- mp4-generator.js is extended with a 'captions' track type that emits
  a c608 sample entry, a null media header, and uses sample.data
  directly in trun / mdat when supplied by the caller.

The generated fMP4 is played via a blob URL; the test waits for at
least one cue to arrive, then waits for the final EDM clear to set the
last cue's endTime before asserting endTime < video.duration.

Test: media/track/track-inband-cea608-cue-endtime.html

* LayoutTests/media/media-source/mp4-generator.js:
* LayoutTests/media/track/caption-generator.js: Added.
* LayoutTests/media/track/track-inband-cea608-cue-endtime-expected.txt: Added.
* LayoutTests/media/track/track-inband-cea608-cue-endtime.html: Added.
* Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processCue):
(WebCore::InbandTextTrackPrivateAVF::processAttributedStrings):

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Canonical link: https://commits.webkit.org/314110@main



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

Reply via email to