Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4aa58c3908a0aa119de1ca6c1712154db4c6d515
      
https://github.com/WebKit/WebKit/commit/4aa58c3908a0aa119de1ca6c1712154db4c6d515
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2024-09-01 (Sun, 01 Sep 2024)

  Changed paths:
    M LayoutTests/media/media-source/content/test-48kHz-new-track-id.m4a
    M 
LayoutTests/media/media-source/content/test-48khz-new-track-id-manifest.json
    A 
LayoutTests/media/media-source/media-source-audio-track-id-switch-play-expected.txt
    A 
LayoutTests/media/media-source/media-source-audio-track-id-switch-play.html
    M 
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm

  Log Message:
  -----------
  [MSE] MediaSource playback rapidly loops after changing audio track
https://bugs.webkit.org/show_bug.cgi?id=276421
rdar://131577794

Reviewed by Youenn Fablet.

The MediaPlayerPrivateMediaSourceAVFObjC wait for all audio and video renderers 
to
contain samples before changing the AVSampleBufferRenderSynchronizer's rate or
set it to 0 if one was missing data. This is used to force playback to stall
if we are missing decoded data.

We should normally only have one AVSampleBufferAudioRenderer when there is only
one active audio track.
This AVSampleBufferAudioRenderers is stored in a hash map using the TrackID as 
key.
When a new init segment is processed that changed the TrackID rather than re-use
the existing AVSampleBufferAudioRenderer we would end up creating a new one.
This would cause an infinite stall due to the condition described above as
we are waiting for all audio renderers to have data.
When the TrackID change mid-flight, the SourceBuffer notifies the 
SourceBufferPrivate
via a call to `updateTrackIds`. We create a local override to update the map
of audio renderers with the new trackID so that we don't incorrectly create a 
new one
and re-use the existing one.

Added test: we add data from two audio tracks with different ID and make sure 
that the video's currentTime
progresses.

* LayoutTests/media/media-source/content/test-48kHz-new-track-id.m4a: File was 
invalid, only init segment was correct
* LayoutTests/media/media-source/content/test-48khz-new-track-id-manifest.json: 
Update media segment offsets which were incorrect.
* 
LayoutTests/media/media-source/media-source-audio-track-id-switch-play-expected.txt:
 Added.
* LayoutTests/media/media-source/media-source-audio-track-id-switch-play.html: 
Added.
* 
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
 Add audioRendererForTrackID convenience method.
When we only have one audio track, we should ignore the TrackID when looking 
for the audio renderer as it can change over time.
* 
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::isMediaSampleAllowed const):
(WebCore::SourceBufferPrivateAVFObjC::updateTrackIds):
(WebCore::SourceBufferPrivateAVFObjC::appendInternal):
(WebCore::SourceBufferPrivateAVFObjC::flush):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to