[webkit-changes] [WebKit/WebKit] 31557c: Move MediaStreamTrack capture state handling to Do...

youennf noreply at github.com
Fri Jan 19 06:04:35 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 31557cfb95e2fbd2e27f4ca6de470b2b91bf56e1
      https://github.com/WebKit/WebKit/commit/31557cfb95e2fbd2e27f4ca6de470b2b91bf56e1
  Author: Youenn Fablet <youennf at gmail.com>
  Date:   2024-01-19 (Fri, 19 Jan 2024)

  Changed paths:
    M Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
    M Source/WebCore/Modules/mediastream/MediaStreamTrack.h
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.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
    M Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp

  Log Message:
  -----------
  Move MediaStreamTrack capture state handling to Document
https://bugs.webkit.org/show_bug.cgi?id=267325
rdar://120776008

Reviewed by Jean-Yves Avenard and Eric Carlson.

MediaStreamTrack may be transferred from a document to a worker.
As per spec, transferring a track does not transfer the ownership of source.
This ensures UA capture states remain the same even if a track gets transferred.

To align with this and prepare track transfer, we are moving capture state handling to Document.
A document will own directly RealtimeMediaSource instead of going through MediaStreamTrack, since a transferred MediaStreamTrack gets closed.
We introduce the possibility for a Document to register itself as an owner of a RealtimeMediaSource.
The RealtimeMediaSource will notify the Document when it either starts or ends.
The Document updates its capture state based on this signal.

When the document goes away, it will stop all sources like would have been done previously with any remaining MediaStreamTrack.

We continue updating code to limit access to a MediaStreamTrack source.

* Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::create):
(WebCore::MediaStreamTrack::MediaStreamTrack):
(WebCore::MediaStreamTrack::~MediaStreamTrack):
(WebCore::trackCaptureState):
(WebCore::MediaStreamTrack::mediaState const):
(WebCore::MediaStreamTrack::trackEnded):
(WebCore::MediaStreamTrack::trackMutedChanged):
(): Deleted.
(WebCore::sourceCaptureState): Deleted.
(WebCore::MediaStreamTrack::captureState): Deleted.
(WebCore::MediaStreamTrack::updateCaptureAccordingToMutedState): Deleted.
(WebCore::MediaStreamTrack::updateVideoCaptureAccordingMicrophoneInterruption): Deleted.
(WebCore::MediaStreamTrack::updateToPageMutedState): Deleted.
(WebCore::trackTypeForMediaProducerCaptureKind): Deleted.
(WebCore::MediaStreamTrack::endCapture): Deleted.
* Source/WebCore/Modules/mediastream/MediaStreamTrack.h:
(WebCore::MediaStreamTrack::isDetached const):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::commonTeardown):
(WebCore::Document::visibilityStateChanged):
(WebCore::captureSourceState):
(WebCore::Document::computeCaptureState const):
(WebCore::Document::updateIsPlayingMedia):
(WebCore::Document::pageMutedStateDidChange):
(WebCore::updateCaptureSourceToPageMutedState):
(WebCore::Document::addCaptureSource):
(WebCore::Document::captureSourceStateChanged):
(WebCore::Document::updateCaptureAccordingToMutedState):
(WebCore::trackTypeForMediaProducerCaptureKind):
(WebCore::Document::stopMediaCapture):
(WebCore::Document::updateVideoCaptureAccordingMicrophoneInterruption):
* Source/WebCore/dom/Document.h:
* Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::start):
(WebCore::RealtimeMediaSource::end):
(WebCore::RealtimeMediaSource::registerOwnerCallback):
* Source/WebCore/platform/mediastream/RealtimeMediaSource.h:
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
(WebKit::RemoteRealtimeVideoSource::clone):

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




More information about the webkit-changes mailing list