Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c7f5f3f3145ecc0b648168c2e3f2d19741363e92
      
https://github.com/WebKit/WebKit/commit/c7f5f3f3145ecc0b648168c2e3f2d19741363e92
  Author: Youenn Fablet <[email protected]>
  Date:   2026-03-17 (Tue, 17 Mar 2026)

  Changed paths:
    A 
LayoutTests/http/wpt/mediastream/videotrackgenerator-track-settings-after-transfer-expected.txt
    A 
LayoutTests/http/wpt/mediastream/videotrackgenerator-track-settings-after-transfer.html
    M Source/WebCore/platform/mediastream/MediaStreamTrackDataHolder.cpp
    M Source/WebCore/platform/mediastream/MediaStreamTrackDataHolder.h
    M Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp
    M Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h
    M Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
    M Source/WebCore/platform/mediastream/RealtimeMediaSource.h

  Log Message:
  -----------
  MediaStreamTrack may have wrong settings if source settings change while 
track is transferred
rdar://172657570
https://bugs.webkit.org/show_bug.cgi?id=310017

Reviewed by Jean-Yves Avenard.

When transferring a track, we take a snapshot of settings, that is used to 
initialize the track created from the transfer.
That track is then registering to the source to get updates on settings changes.
If settings change between the start of the transfer and the end of the 
transfer, the track will not be notified of those changes.

To fix that issue, we keep track in RealtimeMediaSource and 
MediaStreamTrackPrivate of a counter of settings change.
Whenever settings change, RealtimeMediaSource increments its counter and 
notifies its observer, including MediaStreamTrackPrivate that will update its 
counter as well.

Whenever transferring, we store the current counter and initialize the newly 
created MediaStreamTrackPrivate counter with that counter.
When registering the MediaStreamTrackPrivate to the source, in  
MediaStreamTrackPrivateSourceObserverSourceProxy::initialize, we compare the 
track and source counters.
If they do not match, we automatically update the MediaStreamTrackPrivate 
settings.

Covered by added test.

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



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

Reply via email to