<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[259824] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/259824">259824</a></dd>
<dt>Author</dt> <dd>jacob_uphoff@apple.com</dd>
<dt>Date</dt> <dd>2020-04-09 13:49:04 -0700 (Thu, 09 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, reverting <a href="http://trac.webkit.org/projects/webkit/changeset/259816">r259816</a>.

This commit broke the webkit build for macOS and iOS

Reverted changeset:

"Introduce a RealtimeMediaSource observer dedicated to
receiving audio samples"
https://bugs.webkit.org/show_bug.cgi?id=210180
https://trac.webkit.org/changeset/259816</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediarecorderMediaRecordercpp">trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediarecorderMediaRecorderh">trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediarecorderMediaRecorderProvidercpp">trunk/Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediarecorderMediaRecorderProviderh">trunk/Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.h</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientscpp">trunk/Source/WebCore/loader/EmptyClients.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivatecpp">trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateh">trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateAVFImplcpp">trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateAVFImplh">trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateMockcpp">trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateMockh">trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamAudioTrackPrivateMediaStreamcpp">trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamAudioTrackPrivateMediaStreamh">trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamPrivatecpp">trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamPrivateh">trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivatecpp">trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivateh">trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeMediaSourcecpp">trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceh">trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeOutgoingAudioSourcecpp">trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeOutgoingAudioSourceh">trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamWebAudioSourceProviderh">trunk/Source/WebCore/platform/mediastream/WebAudioSourceProvider.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamgstreamerGStreamerMediaStreamSourcecpp">trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacWebAudioSourceProviderAVFObjCh">trunk/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacWebAudioSourceProviderAVFObjCmm">trunk/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessCocoaUserMediaCaptureManagerProxycpp">trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUwebrtcMediaRecorderPrivatecpp">trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUwebrtcMediaRecorderPrivateh">trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUwebrtcMediaRecorderProvidercpp">trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUwebrtcMediaRecorderProviderh">trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/ChangeLog      2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2020-04-09  Jacob Uphoff  <jacob_uphoff@apple.com>
+
+        Unreviewed, reverting r259816.
+
+        This commit broke the webkit build for macOS and iOS
+
+        Reverted changeset:
+
+        "Introduce a RealtimeMediaSource observer dedicated to
+        receiving audio samples"
+        https://bugs.webkit.org/show_bug.cgi?id=210180
+        https://trac.webkit.org/changeset/259816
+
</ins><span class="cx"> 2020-04-09  Daniel Bates  <dabates@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [ macOS debug wk2 ] REGRESSION(r259762): ASSERTION FAILED: !needsLayout() on fast/events/scroll-subframe-in-rendering-update.html
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediarecorderMediaRecordercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp     2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp        2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> WTF_MAKE_ISO_ALLOCATED_IMPL(MediaRecorder);
</span><span class="cx"> 
</span><del>-MediaRecorder::CreatorFunction MediaRecorder::m_customCreator = nullptr;
</del><ins>+creatorFunction MediaRecorder::m_customCreator = nullptr;
</ins><span class="cx"> 
</span><span class="cx"> ExceptionOr<Ref<MediaRecorder>> MediaRecorder::create(Document& document, Ref<MediaStream>&& stream, Options&& options)
</span><span class="cx"> {
</span><span class="lines">@@ -59,15 +59,15 @@
</span><span class="cx">     return recorder;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaRecorder::setCustomPrivateRecorderCreator(CreatorFunction creator)
</del><ins>+void MediaRecorder::setCustomPrivateRecorderCreator(creatorFunction creator)
</ins><span class="cx"> {
</span><span class="cx">     m_customCreator = creator;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr<MediaRecorderPrivate> MediaRecorder::createMediaRecorderPrivate(Document& document, MediaStreamPrivate& stream)
</del><ins>+std::unique_ptr<MediaRecorderPrivate> MediaRecorder::createMediaRecorderPrivate(Document& document, const MediaStreamPrivate& stream)
</ins><span class="cx"> {
</span><span class="cx">     if (m_customCreator)
</span><del>-        return m_customCreator(stream);
</del><ins>+        return m_customCreator();
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     auto* page = document.page();
</span><span class="lines">@@ -227,6 +227,11 @@
</span><span class="cx">     m_private->sampleBufferUpdated(track, mediaSample);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MediaRecorder::audioSamplesAvailable(MediaStreamTrackPrivate& track, const MediaTime& mediaTime, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t sampleCount)
+{
+    m_private->audioSamplesAvailable(track, mediaTime, audioData, description, sampleCount);
+}
+
</ins><span class="cx"> bool MediaRecorder::virtualHasPendingActivity() const
</span><span class="cx"> {
</span><span class="cx">     return m_state != RecordingState::Inactive;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediarecorderMediaRecorderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h       2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h  2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -38,6 +38,8 @@
</span><span class="cx"> class Document;
</span><span class="cx"> class MediaRecorderPrivate;
</span><span class="cx"> 
</span><ins>+typedef std::unique_ptr<MediaRecorderPrivate>(*creatorFunction)();
+
</ins><span class="cx"> class MediaRecorder final
</span><span class="cx">     : public ActiveDOMObject
</span><span class="cx">     , public RefCounted<MediaRecorder>
</span><span class="lines">@@ -60,9 +62,7 @@
</span><span class="cx">     
</span><span class="cx">     static ExceptionOr<Ref<MediaRecorder>> create(Document&, Ref<MediaStream>&&, Options&& = { });
</span><span class="cx">     
</span><del>-    using CreatorFunction = std::unique_ptr<MediaRecorderPrivate>(*)(MediaStreamPrivate&);
-
-    WEBCORE_EXPORT static void setCustomPrivateRecorderCreator(CreatorFunction);
</del><ins>+    WEBCORE_EXPORT static void setCustomPrivateRecorderCreator(creatorFunction);
</ins><span class="cx">     
</span><span class="cx">     RecordingState state() const { return m_state; }
</span><span class="cx">     
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> private:
</span><span class="cx">     MediaRecorder(Document&, Ref<MediaStream>&&, std::unique_ptr<MediaRecorderPrivate>&&, Options&& = { });
</span><span class="cx"> 
</span><del>-    static std::unique_ptr<MediaRecorderPrivate> createMediaRecorderPrivate(Document&, MediaStreamPrivate&);
</del><ins>+    static std::unique_ptr<MediaRecorderPrivate> createMediaRecorderPrivate(Document&, const MediaStreamPrivate&);
</ins><span class="cx">     
</span><span class="cx">     Document* document() const;
</span><span class="cx"> 
</span><span class="lines">@@ -107,9 +107,10 @@
</span><span class="cx">     void trackSettingsChanged(MediaStreamTrackPrivate&) final { };
</span><span class="cx">     void trackEnabledChanged(MediaStreamTrackPrivate&) final { };
</span><span class="cx">     void sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample&) final;
</span><del>-
-    static CreatorFunction m_customCreator;
</del><ins>+    void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
</ins><span class="cx">     
</span><ins>+    static creatorFunction m_customCreator;
+    
</ins><span class="cx">     Options m_options;
</span><span class="cx">     Ref<MediaStream> m_stream;
</span><span class="cx">     std::unique_ptr<MediaRecorderPrivate> m_private;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediarecorderMediaRecorderProvidercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.cpp     2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.cpp        2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-std::unique_ptr<MediaRecorderPrivate> MediaRecorderProvider::createMediaRecorderPrivate(MediaStreamPrivate& stream)
</del><ins>+std::unique_ptr<MediaRecorderPrivate> MediaRecorderProvider::createMediaRecorderPrivate(const MediaStreamPrivate& stream)
</ins><span class="cx"> {
</span><span class="cx">     return MediaRecorderPrivateAVFImpl::create(stream);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediarecorderMediaRecorderProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.h       2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/Modules/mediarecorder/MediaRecorderProvider.h  2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">     virtual ~MediaRecorderProvider() = default;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA)
</span><del>-    virtual std::unique_ptr<MediaRecorderPrivate> createMediaRecorderPrivate(MediaStreamPrivate&);
</del><ins>+    virtual std::unique_ptr<MediaRecorderPrivate> createMediaRecorderPrivate(const MediaStreamPrivate&);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void setUseGPUProcess(bool value) { m_useGPUProcess = value; }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.cpp     2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp        2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -582,7 +582,7 @@
</span><span class="cx">     EmptyMediaRecorderProvider() = default;
</span><span class="cx"> private:
</span><span class="cx"> #if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA)
</span><del>-    std::unique_ptr<MediaRecorderPrivate> createMediaRecorderPrivate(MediaStreamPrivate&) final { return nullptr; }
</del><ins>+    std::unique_ptr<MediaRecorderPrivate> createMediaRecorderPrivate(const MediaStreamPrivate&) final { return nullptr; }
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm 2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm    2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -560,7 +560,7 @@
</span><span class="cx">     ALWAYS_LOG(LOGIDENTIFIER, volume);
</span><span class="cx">     m_volume = volume;
</span><span class="cx">     for (const auto& track : m_audioTrackMap.values())
</span><del>-        track->setVolume(m_volume);
</del><ins>+        track->setVolume(m_muted ? 0 : m_volume);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaPlayerPrivateMediaStreamAVFObjC::setMuted(bool muted)
</span><span class="lines">@@ -571,7 +571,7 @@
</span><span class="cx">     ALWAYS_LOG(LOGIDENTIFIER, muted);
</span><span class="cx">     m_muted = muted;
</span><span class="cx">     for (const auto& track : m_audioTrackMap.values())
</span><del>-        track->setMuted(m_muted);
</del><ins>+        track->setVolume(m_muted ? 0 : m_volume);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool MediaPlayerPrivateMediaStreamAVFObjC::hasVideo() const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.cpp     2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.cpp        2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-MediaRecorderPrivate::AudioVideoSelectedTracks MediaRecorderPrivate::selectTracks(MediaStreamPrivate& stream)
</del><ins>+MediaRecorderPrivate::AudioVideoSelectedTracks MediaRecorderPrivate::selectTracks(const MediaStreamPrivate& stream)
</ins><span class="cx"> {
</span><span class="cx">     AudioVideoSelectedTracks selectedTracks;
</span><span class="cx">     stream.forEachTrack([&](auto& track) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.h       2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.h  2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> #include <wtf/CompletionHandler.h>
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include "Exception.h"
</span><del>-#include "RealtimeMediaSource.h"
</del><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><span class="lines">@@ -44,53 +43,29 @@
</span><span class="cx"> class PlatformAudioData;
</span><span class="cx"> class SharedBuffer;
</span><span class="cx"> 
</span><del>-class MediaRecorderPrivate :
-    public RealtimeMediaSource::AudioSampleObserver {
</del><ins>+class MediaRecorderPrivate {
</ins><span class="cx"> public:
</span><del>-    ~MediaRecorderPrivate();
</del><ins>+    virtual ~MediaRecorderPrivate() = default;
</ins><span class="cx"> 
</span><span class="cx">     struct AudioVideoSelectedTracks {
</span><del>-        MediaStreamTrackPrivate* audioTrack { nullptr };
-        MediaStreamTrackPrivate* videoTrack { nullptr };
</del><ins>+        const MediaStreamTrackPrivate* audioTrack { nullptr };
+        const MediaStreamTrackPrivate* videoTrack { nullptr };
</ins><span class="cx">     };
</span><del>-    WEBCORE_EXPORT static AudioVideoSelectedTracks selectTracks(MediaStreamPrivate&);
</del><ins>+    WEBCORE_EXPORT static AudioVideoSelectedTracks selectTracks(const MediaStreamPrivate&);
</ins><span class="cx"> 
</span><span class="cx">     virtual void sampleBufferUpdated(const MediaStreamTrackPrivate&, MediaSample&) = 0;
</span><ins>+    virtual void audioSamplesAvailable(const MediaStreamTrackPrivate&, const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) = 0;
</ins><span class="cx"> 
</span><del>-    using FetchDataCallback = CompletionHandler<void(RefPtr<SharedBuffer>&&, const String& mimeType)>;
-    virtual void fetchData(FetchDataCallback&&) = 0;
-    virtual void stopRecording() = 0;
</del><ins>+    virtual void fetchData(CompletionHandler<void(RefPtr<SharedBuffer>&&, const String& mimeType)>&&) = 0;
+    virtual void stopRecording() { };
</ins><span class="cx"> 
</span><span class="cx">     using ErrorCallback = Function<void(Optional<Exception>&&)>;
</span><span class="cx">     void setErrorCallback(ErrorCallback&& errorCallback) { m_errorCallback = WTFMove(errorCallback); }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    void setAudioSource(RefPtr<RealtimeMediaSource>&&);
-
-protected:
</del><span class="cx">     ErrorCallback m_errorCallback;
</span><del>-
-private:
-    RefPtr<RealtimeMediaSource> m_audioSource;
</del><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline void MediaRecorderPrivate::setAudioSource(RefPtr<RealtimeMediaSource>&& audioSource)
-{
-    if (m_audioSource)
-        m_audioSource->removeAudioSampleObserver(*this);
-
-    m_audioSource = WTFMove(audioSource);
-
-    if (m_audioSource)
-        m_audioSource->addAudioSampleObserver(*this);
-}
-
-inline MediaRecorderPrivate::~MediaRecorderPrivate()
-{
-    if (m_audioSource)
-        m_audioSource->removeAudioSampleObserver(*this);
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateAVFImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp      2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp 2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-std::unique_ptr<MediaRecorderPrivateAVFImpl> MediaRecorderPrivateAVFImpl::create(MediaStreamPrivate& stream)
</del><ins>+std::unique_ptr<MediaRecorderPrivateAVFImpl> MediaRecorderPrivateAVFImpl::create(const MediaStreamPrivate& stream)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: we will need to implement support for multiple audio/video tracks
</span><span class="cx">     // Currently we only choose the first track as the recorded track.
</span><span class="lines">@@ -51,15 +51,11 @@
</span><span class="cx">     String audioTrackId;
</span><span class="cx">     if (selectedTracks.audioTrack)
</span><span class="cx">         audioTrackId = selectedTracks.audioTrack->id();
</span><del>-
</del><span class="cx">     String videoTrackId;
</span><span class="cx">     if (selectedTracks.videoTrack)
</span><span class="cx">         videoTrackId = selectedTracks.videoTrack->id();
</span><span class="cx"> 
</span><del>-    auto recorder = makeUnique<MediaRecorderPrivateAVFImpl>(writer.releaseNonNull(), WTFMove(audioTrackId), WTFMove(videoTrackId));
-    if (selectedTracks.audioTrack)
-        recorder->setAudioSource(&selectedTracks.audioTrack->source());
-    return recorder;
</del><ins>+    return makeUnique<MediaRecorderPrivateAVFImpl>(writer.releaseNonNull(), WTFMove(audioTrackId), WTFMove(videoTrackId));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaRecorderPrivateAVFImpl::MediaRecorderPrivateAVFImpl(Ref<MediaRecorderPrivateWriter>&& writer, String&& audioTrackId, String&& videoTrackId)
</span><span class="lines">@@ -69,11 +65,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaRecorderPrivateAVFImpl::~MediaRecorderPrivateAVFImpl()
-{
-    setAudioSource(nullptr);
-}
-
</del><span class="cx"> void MediaRecorderPrivateAVFImpl::sampleBufferUpdated(const MediaStreamTrackPrivate& track, MediaSample& sampleBuffer)
</span><span class="cx"> {
</span><span class="cx">     if (track.id() != m_recordedVideoTrackID)
</span><span class="lines">@@ -81,8 +72,10 @@
</span><span class="cx">     m_writer->appendVideoSampleBuffer(sampleBuffer.platformSample().sample.cmSampleBuffer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaRecorderPrivateAVFImpl::audioSamplesAvailable(const WTF::MediaTime& mediaTime, const PlatformAudioData& data, const AudioStreamDescription& description, size_t sampleCount)
</del><ins>+void MediaRecorderPrivateAVFImpl::audioSamplesAvailable(const MediaStreamTrackPrivate& track, const WTF::MediaTime& mediaTime, const PlatformAudioData& data, const AudioStreamDescription& description, size_t sampleCount)
</ins><span class="cx"> {
</span><ins>+    if (track.id() != m_recordedAudioTrackID)
+        return;
</ins><span class="cx">     ASSERT(is<WebAudioBufferList>(data));
</span><span class="cx">     ASSERT(description.platformDescription().type == PlatformDescription::CAAudioStreamBasicType);
</span><span class="cx">     m_writer->appendAudioSampleBuffer(data, description, mediaTime, sampleCount);
</span><span class="lines">@@ -90,11 +83,10 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaRecorderPrivateAVFImpl::stopRecording()
</span><span class="cx"> {
</span><del>-    setAudioSource(nullptr);
</del><span class="cx">     m_writer->stopRecording();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaRecorderPrivateAVFImpl::fetchData(FetchDataCallback&& completionHandler)
</del><ins>+void MediaRecorderPrivateAVFImpl::fetchData(CompletionHandler<void(RefPtr<SharedBuffer>&&, const String&)>&& completionHandler)
</ins><span class="cx"> {
</span><span class="cx">     m_writer->fetchData([completionHandler = WTFMove(completionHandler), mimeType = mimeType()](auto&& buffer) mutable {
</span><span class="cx">         completionHandler(WTFMove(buffer), mimeType);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateAVFImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h        2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h   2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -33,12 +33,10 @@
</span><span class="cx"> 
</span><span class="cx"> class MediaStreamPrivate;
</span><span class="cx"> 
</span><del>-class MediaRecorderPrivateAVFImpl final
-    : public MediaRecorderPrivate {
</del><ins>+class MediaRecorderPrivateAVFImpl final : public MediaRecorderPrivate {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    static std::unique_ptr<MediaRecorderPrivateAVFImpl> create(MediaStreamPrivate&);
-    ~MediaRecorderPrivateAVFImpl();
</del><ins>+    static std::unique_ptr<MediaRecorderPrivateAVFImpl> create(const MediaStreamPrivate&);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     MediaRecorderPrivateAVFImpl(Ref<MediaRecorderPrivateWriter>&&, String&& audioTrackId, String&& videoTrackId);
</span><span class="lines">@@ -45,14 +43,12 @@
</span><span class="cx"> 
</span><span class="cx">     friend std::unique_ptr<MediaRecorderPrivateAVFImpl> std::make_unique<MediaRecorderPrivateAVFImpl>(Ref<MediaRecorderPrivateWriter>&&, String&&, String&&);
</span><span class="cx"> 
</span><del>-    // MediaRecorderPrivate
</del><span class="cx">     void sampleBufferUpdated(const MediaStreamTrackPrivate&, MediaSample&) final;
</span><del>-    void fetchData(FetchDataCallback&&) final;
-    void audioSamplesAvailable(const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
-
</del><ins>+    void audioSamplesAvailable(const MediaStreamTrackPrivate&, const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
+    void fetchData(CompletionHandler<void(RefPtr<SharedBuffer>&&, const String&)>&&) final;
</ins><span class="cx">     const String& mimeType();
</span><span class="cx">     void stopRecording();
</span><del>-
</del><ins>+    
</ins><span class="cx">     Ref<MediaRecorderPrivateWriter> m_writer;
</span><span class="cx">     String m_recordedAudioTrackID;
</span><span class="cx">     String m_recordedVideoTrackID;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateMockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.cpp 2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.cpp    2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -33,51 +33,30 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-MediaRecorderPrivateMock::MediaRecorderPrivateMock(MediaStreamPrivate& stream)
</del><ins>+void MediaRecorderPrivateMock::sampleBufferUpdated(const MediaStreamTrackPrivate& track, MediaSample&)
</ins><span class="cx"> {
</span><del>-    auto selectedTracks = MediaRecorderPrivate::selectTracks(stream);
-    if (selectedTracks.audioTrack) {
-        m_audioTrackID = selectedTracks.audioTrack->id();
-        setAudioSource(&selectedTracks.audioTrack->source());
-    }
-    if (selectedTracks.videoTrack)
-        m_videoTrackID = selectedTracks.videoTrack->id();
</del><ins>+    generateMockString(track);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaRecorderPrivateMock::~MediaRecorderPrivateMock()
</del><ins>+void MediaRecorderPrivateMock::audioSamplesAvailable(const MediaStreamTrackPrivate& track, const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t)
</ins><span class="cx"> {
</span><del>-    setAudioSource(nullptr);
</del><ins>+    generateMockString(track);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaRecorderPrivateMock::stopRecording()
</del><ins>+void MediaRecorderPrivateMock::generateMockString(const MediaStreamTrackPrivate& track)
</ins><span class="cx"> {
</span><del>-    setAudioSource(nullptr);
-}
-
-void MediaRecorderPrivateMock::sampleBufferUpdated(const MediaStreamTrackPrivate&, MediaSample&)
-{
</del><span class="cx">     auto locker = holdLock(m_bufferLock);
</span><del>-    m_buffer.append("Video Track ID: ");
-    m_buffer.append(m_videoTrackID);
-    generateMockCounterString();
-}
-
-void MediaRecorderPrivateMock::audioSamplesAvailable(const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t)
-{
-    auto locker = holdLock(m_bufferLock);
-    m_buffer.append("Audio Track ID: ");
-    m_buffer.append(m_audioTrackID);
-    generateMockCounterString();
-}
-
-void MediaRecorderPrivateMock::generateMockCounterString()
-{
</del><ins>+    if (track.type() == RealtimeMediaSource::Type::Audio)
+        m_buffer.append("Audio Track ID: ");
+    else
+        m_buffer.append("Video Track ID: ");
+    m_buffer.append(track.id());
</ins><span class="cx">     m_buffer.append(" Counter: ");
</span><span class="cx">     m_buffer.appendNumber(++m_counter);
</span><span class="cx">     m_buffer.append("\r\n---------\r\n");
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaRecorderPrivateMock::fetchData(FetchDataCallback&& completionHandler)
</del><ins>+void MediaRecorderPrivateMock::fetchData(CompletionHandler<void(RefPtr<SharedBuffer>&&, const String&)>&& completionHandler)
</ins><span class="cx"> {
</span><span class="cx">     auto locker = holdLock(m_bufferLock);
</span><span class="cx">     Vector<uint8_t> value(m_buffer.length());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediarecorderMediaRecorderPrivateMockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.h   2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.h      2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -34,27 +34,18 @@
</span><span class="cx"> 
</span><span class="cx"> class MediaStreamTrackPrivate;
</span><span class="cx"> 
</span><del>-class WEBCORE_EXPORT MediaRecorderPrivateMock final
-    : public MediaRecorderPrivate {
-public:
-    explicit MediaRecorderPrivateMock(MediaStreamPrivate&);
-    ~MediaRecorderPrivateMock();
-
</del><ins>+class WEBCORE_EXPORT MediaRecorderPrivateMock final : public MediaRecorderPrivate {
</ins><span class="cx"> private:
</span><del>-    // MediaRecorderPrivate
</del><span class="cx">     void sampleBufferUpdated(const MediaStreamTrackPrivate&, MediaSample&) final;
</span><del>-    void fetchData(FetchDataCallback&&) final;
-    void audioSamplesAvailable(const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
-    void stopRecording() final;
-
</del><ins>+    void audioSamplesAvailable(const MediaStreamTrackPrivate&, const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
+    void fetchData(CompletionHandler<void(RefPtr<SharedBuffer>&&, const String&)>&&) final;
</ins><span class="cx">     const String& mimeType();
</span><del>-    void generateMockCounterString();
</del><ins>+    
+    void generateMockString(const MediaStreamTrackPrivate&);
</ins><span class="cx"> 
</span><span class="cx">     mutable Lock m_bufferLock;
</span><span class="cx">     StringBuilder m_buffer;
</span><span class="cx">     unsigned m_counter { 0 };
</span><del>-    String m_audioTrackID;
-    String m_videoTrackID;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamAudioTrackPrivateMediaStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.cpp       2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.cpp  2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -35,9 +35,9 @@
</span><span class="cx"> 
</span><span class="cx"> AudioTrackPrivateMediaStream::AudioTrackPrivateMediaStream(MediaStreamTrackPrivate& track)
</span><span class="cx">     : m_streamTrack(track)
</span><del>-    , m_audioSource(track.source())
</del><span class="cx">     , m_id(track.id())
</span><span class="cx">     , m_label(track.label())
</span><ins>+    , m_timelineOffset(MediaTime::invalidTime())
</ins><span class="cx">     , m_renderer { AudioMediaStreamTrackRenderer::create() }
</span><span class="cx"> {
</span><span class="cx">     track.addObserver(*this);
</span><span class="lines">@@ -62,36 +62,45 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_isCleared = true;
</span><ins>+    streamTrack().removeObserver(*this);
</ins><span class="cx"> 
</span><ins>+    m_renderer->clear();
+}
+
+void AudioTrackPrivateMediaStream::playInternal()
+{
+    ASSERT(isMainThread());
+
</ins><span class="cx">     if (m_isPlaying)
</span><del>-        m_audioSource->removeAudioSampleObserver(*this);
</del><ins>+        return;
</ins><span class="cx"> 
</span><del>-    streamTrack().removeObserver(*this);
-    m_renderer->clear();
</del><ins>+    m_isPlaying = true;
+    m_autoPlay = false;
+
+    m_renderer->start();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AudioTrackPrivateMediaStream::play()
</span><span class="cx"> {
</span><del>-    m_shouldPlay = true;
-    updateRenderer();
</del><ins>+    playInternal();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AudioTrackPrivateMediaStream::pause()
</span><span class="cx"> {
</span><del>-    m_shouldPlay = false;
-    updateRenderer();
-}
</del><ins>+    ASSERT(isMainThread());
</ins><span class="cx"> 
</span><del>-void AudioTrackPrivateMediaStream::setMuted(bool muted)
-{
-    m_muted = muted;
-    updateRenderer();
</del><ins>+    if (!m_isPlaying)
+        return;
+
+    m_isPlaying = false;
+    m_autoPlay = false;
+
+    m_renderer->stop();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AudioTrackPrivateMediaStream::setVolume(float volume)
</span><span class="cx"> {
</span><span class="cx">     m_renderer->setVolume(volume);
</span><del>-    updateRenderer();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> float AudioTrackPrivateMediaStream::volume() const
</span><span class="lines">@@ -100,57 +109,48 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // May get called on a background thread.
</span><del>-void AudioTrackPrivateMediaStream::audioSamplesAvailable(const MediaTime& sampleTime, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t sampleCount)
</del><ins>+void AudioTrackPrivateMediaStream::audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime& sampleTime, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t sampleCount)
</ins><span class="cx"> {
</span><ins>+    if (!m_isPlaying) {
+        m_renderer->stop();
+        return;
+    }
+
</ins><span class="cx">     m_renderer->pushSamples(sampleTime, audioData, description, sampleCount);
</span><ins>+
+    if (m_autoPlay && !m_hasStartedAutoplay) {
+        m_hasStartedAutoplay = true;
+        callOnMainThread([this, protectedThis = makeRef(*this)] {
+            if (m_autoPlay)
+                playInternal();
+        });
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AudioTrackPrivateMediaStream::trackMutedChanged(MediaStreamTrackPrivate&)
</span><span class="cx"> {
</span><del>-    updateRenderer();
</del><ins>+    updateRendererMutedState();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AudioTrackPrivateMediaStream::trackEnabledChanged(MediaStreamTrackPrivate&)
</span><span class="cx"> {
</span><del>-    updateRenderer();
</del><ins>+    updateRendererMutedState();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AudioTrackPrivateMediaStream::trackEnded(MediaStreamTrackPrivate&)
</del><ins>+void AudioTrackPrivateMediaStream::updateRendererMutedState()
</ins><span class="cx"> {
</span><del>-    updateRenderer();
-}
-
-void AudioTrackPrivateMediaStream::updateRenderer()
-{
-    if (!m_shouldPlay || !volume() || m_muted || streamTrack().muted() || streamTrack().ended() || !streamTrack().enabled()) {
-        stopRenderer();
</del><ins>+    if (streamTrack().muted() || streamTrack().ended() || !streamTrack().enabled()) {
+        pause();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    startRenderer();
</del><ins>+    play();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AudioTrackPrivateMediaStream::startRenderer()
</del><ins>+void AudioTrackPrivateMediaStream::trackEnded(MediaStreamTrackPrivate&)
</ins><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
-    if (m_isPlaying)
-        return;
-
-    m_isPlaying = true;
-    m_audioSource->addAudioSampleObserver(*this);
-    m_renderer->start();
</del><ins>+    pause();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AudioTrackPrivateMediaStream::stopRenderer()
-{
-    ASSERT(isMainThread());
-    if (!m_isPlaying)
-        return;
-
-    m_isPlaying = false;
-    m_audioSource->removeAudioSampleObserver(*this);
-    m_renderer->stop();
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(VIDEO_TRACK) && ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamAudioTrackPrivateMediaStreamh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.h 2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.h    2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -34,10 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> class AudioMediaStreamTrackRenderer;
</span><span class="cx"> 
</span><del>-class AudioTrackPrivateMediaStream final
-    : public AudioTrackPrivate
-    , private MediaStreamTrackPrivate::Observer
-    , private RealtimeMediaSource::AudioSampleObserver {
</del><ins>+class AudioTrackPrivateMediaStream final : public AudioTrackPrivate, private MediaStreamTrackPrivate::Observer {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(AudioTrackPrivateMediaStream)
</span><span class="cx"> public:
</span><span class="cx">     static RefPtr<AudioTrackPrivateMediaStream> create(MediaStreamTrackPrivate& streamTrack)
</span><span class="lines">@@ -50,6 +47,9 @@
</span><span class="cx"> 
</span><span class="cx">     MediaStreamTrackPrivate& streamTrack() { return m_streamTrack.get(); }
</span><span class="cx"> 
</span><ins>+    MediaTime timelineOffset() const { return m_timelineOffset; }
+    void setTimelineOffset(const MediaTime& offset) { m_timelineOffset = offset; }
+
</ins><span class="cx">     void clear();
</span><span class="cx"> 
</span><span class="cx">     void play();
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx">     void setVolume(float);
</span><span class="cx">     float volume() const;
</span><span class="cx"> 
</span><del>-    void setMuted(bool);
</del><ins>+    void setMuted(bool muted) { m_muted = muted; }
</ins><span class="cx">     bool muted() const { return m_muted; }
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="lines">@@ -77,32 +77,30 @@
</span><span class="cx">     int trackIndex() const final { return m_index; }
</span><span class="cx"> 
</span><span class="cx">     // MediaStreamTrackPrivate::Observer
</span><ins>+    void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
</ins><span class="cx">     void trackEnded(MediaStreamTrackPrivate&) final;
</span><span class="cx">     void trackMutedChanged(MediaStreamTrackPrivate&)  final;
</span><span class="cx">     void trackEnabledChanged(MediaStreamTrackPrivate&)  final;
</span><span class="cx">     void trackSettingsChanged(MediaStreamTrackPrivate&) final { }
</span><span class="cx"> 
</span><del>-    // RealtimeMediaSource::AudioSampleObserver
-    void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
</del><ins>+    void playInternal();
+    void updateRendererMutedState();
</ins><span class="cx"> 
</span><del>-    void startRenderer();
-    void stopRenderer();
-    void updateRenderer();
-
</del><span class="cx">     // Main thread writable members
</span><span class="cx">     bool m_isPlaying { false };
</span><del>-    bool m_shouldPlay { false };
</del><ins>+    bool m_autoPlay { false };
</ins><span class="cx">     bool m_muted { false };
</span><span class="cx">     bool m_isCleared { false };
</span><span class="cx"> 
</span><span class="cx">     Ref<MediaStreamTrackPrivate> m_streamTrack;
</span><del>-    Ref<RealtimeMediaSource> m_audioSource;
</del><span class="cx">     AtomString m_id;
</span><span class="cx">     AtomString m_label;
</span><span class="cx">     int m_index { 0 };
</span><ins>+    MediaTime m_timelineOffset;
</ins><span class="cx"> 
</span><span class="cx">     // Audio thread members
</span><span class="cx">     std::unique_ptr<AudioMediaStreamTrackRenderer> m_renderer;
</span><ins>+    bool m_hasStartedAutoplay { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp 2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp    2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -121,12 +121,6 @@
</span><span class="cx">         callback(*track);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamPrivate::forEachTrack(const Function<void(MediaStreamTrackPrivate&)>& callback)
-{
-    for (auto& track : m_trackSet.values())
-        callback(*track);
-}
-
</del><span class="cx"> void MediaStreamPrivate::updateActiveState(NotifyClientOption notifyClientOption)
</span><span class="cx"> {
</span><span class="cx">     bool newActiveState = false;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h   2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h      2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -84,7 +84,6 @@
</span><span class="cx">     MediaStreamTrackPrivateVector tracks() const;
</span><span class="cx">     bool hasTracks() const { return !m_trackSet.isEmpty(); }
</span><span class="cx">     void forEachTrack(const Function<void(const MediaStreamTrackPrivate&)>&) const;
</span><del>-    void forEachTrack(const Function<void(MediaStreamTrackPrivate&)>&);
</del><span class="cx">     MediaStreamTrackPrivate* activeVideoTrack() { return m_activeVideoTrack; }
</span><span class="cx"> 
</span><span class="cx">     bool active() const { return m_isActive; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp    2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp       2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -78,10 +78,16 @@
</span><span class="cx">     m_source->removeObserver(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamTrackPrivate::forEachObserver(const Function<void(Observer&)>& apply) const
</del><ins>+void MediaStreamTrackPrivate::forEachObserver(const WTF::Function<void(Observer&)>& apply) const
</ins><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
-    for (auto* observer : copyToVector(m_observers)) {
</del><ins>+    Vector<Observer*> observersCopy;
+    {
+        auto locker = holdLock(m_observersLock);
+        observersCopy = copyToVector(m_observers);
+    }
+    for (auto* observer : observersCopy) {
+        auto locker = holdLock(m_observersLock);
+        // Make sure the observer has not been destroyed.
</ins><span class="cx">         if (!m_observers.contains(observer))
</span><span class="cx">             continue;
</span><span class="cx">         apply(*observer);
</span><span class="lines">@@ -90,13 +96,13 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStreamTrackPrivate::addObserver(MediaStreamTrackPrivate::Observer& observer)
</span><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
</del><ins>+    auto locker = holdLock(m_observersLock);
</ins><span class="cx">     m_observers.add(&observer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaStreamTrackPrivate::removeObserver(MediaStreamTrackPrivate::Observer& observer)
</span><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
</del><ins>+    auto locker = holdLock(m_observersLock);
</ins><span class="cx">     m_observers.remove(&observer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -255,12 +261,26 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamTrackPrivate::hasStartedProducingAudioData()
</del><ins>+// May get called on a background thread.
+void MediaStreamTrackPrivate::audioSamplesAvailable(const MediaTime& mediaTime, const PlatformAudioData& data, const AudioStreamDescription& description, size_t sampleCount)
</ins><span class="cx"> {
</span><del>-    if (m_haveProducedData)
</del><ins>+    if (!m_hasSentStartProducedData) {
+        callOnMainThread([this, weakThis = makeWeakPtr(this)] {
+            if (!weakThis)
+                return;
+
+            if (!m_haveProducedData) {
+                m_haveProducedData = true;
+                updateReadyState();
+            }
+            m_hasSentStartProducedData = true;
+        });
</ins><span class="cx">         return;
</span><del>-    m_haveProducedData = true;
-    updateReadyState();
</del><ins>+    }
+
+    forEachObserver([&](auto& observer) {
+        observer.audioSamplesAvailable(*this, mediaTime, data, description, sampleCount);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaStreamTrackPrivate::updateReadyState()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h      2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h 2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -62,6 +62,9 @@
</span><span class="cx">         virtual void trackEnabledChanged(MediaStreamTrackPrivate&) = 0;
</span><span class="cx">         virtual void sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample&) { };
</span><span class="cx">         virtual void readyStateChanged(MediaStreamTrackPrivate&) { };
</span><ins>+
+        // May get called on a background thread.
+        virtual void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) { };
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     static Ref<MediaStreamTrackPrivate> create(Ref<const Logger>&&, Ref<RealtimeMediaSource>&&);
</span><span class="lines">@@ -97,7 +100,6 @@
</span><span class="cx">     Ref<MediaStreamTrackPrivate> clone();
</span><span class="cx"> 
</span><span class="cx">     RealtimeMediaSource& source() { return m_source.get(); }
</span><del>-    const RealtimeMediaSource& source() const { return m_source.get(); }
</del><span class="cx">     WEBCORE_EXPORT RealtimeMediaSource::Type type() const;
</span><span class="cx"> 
</span><span class="cx">     void endTrack();
</span><span class="lines">@@ -130,7 +132,7 @@
</span><span class="cx"> private:
</span><span class="cx">     MediaStreamTrackPrivate(Ref<const Logger>&&, Ref<RealtimeMediaSource>&&, String&& id);
</span><span class="cx"> 
</span><del>-    // RealtimeMediaSource::Observer
</del><ins>+    // RealtimeMediaSourceObserver
</ins><span class="cx">     void sourceStarted() final;
</span><span class="cx">     void sourceStopped() final;
</span><span class="cx">     void sourceMutedChanged() final;
</span><span class="lines">@@ -137,8 +139,8 @@
</span><span class="cx">     void sourceSettingsChanged() final;
</span><span class="cx">     bool preventSourceFromStopping() final;
</span><span class="cx">     void videoSampleAvailable(MediaSample&) final;
</span><ins>+    void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
</ins><span class="cx">     void audioUnitWillStart() final;
</span><del>-    void hasStartedProducingAudioData() final;
</del><span class="cx"> 
</span><span class="cx">     void updateReadyState();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeMediaSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp        2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp   2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -60,29 +60,15 @@
</span><span class="cx">     m_hashedID = RealtimeMediaSourceCenter::singleton().hashStringWithSalt(m_persistentID, m_idHashSalt);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RealtimeMediaSource::addAudioSampleObserver(RealtimeMediaSource::AudioSampleObserver& observer)
-{
-    ASSERT(isMainThread());
-    auto locker = holdLock(m_audioSampleObserversLock);
-    m_audioSampleObservers.add(&observer);
-}
-
-void RealtimeMediaSource::removeAudioSampleObserver(RealtimeMediaSource::AudioSampleObserver& observer)
-{
-    ASSERT(isMainThread());
-    auto locker = holdLock(m_audioSampleObserversLock);
-    m_audioSampleObservers.remove(&observer);
-}
-
</del><span class="cx"> void RealtimeMediaSource::addObserver(RealtimeMediaSource::Observer& observer)
</span><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
</del><ins>+    auto locker = holdLock(m_observersLock);
</ins><span class="cx">     m_observers.add(&observer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RealtimeMediaSource::removeObserver(RealtimeMediaSource::Observer& observer)
</span><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
</del><ins>+    auto locker = holdLock(m_observersLock);
</ins><span class="cx">     m_observers.remove(&observer);
</span><span class="cx">     if (m_observers.isEmpty())
</span><span class="cx">         stopBeingObserved();
</span><span class="lines">@@ -130,10 +116,16 @@
</span><span class="cx">     notifyMutedChange(interrupted);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RealtimeMediaSource::forEachObserver(const Function<void(Observer&)>& apply) const
</del><ins>+void RealtimeMediaSource::forEachObserver(const WTF::Function<void(Observer&)>& apply) const
</ins><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
-    for (auto* observer : copyToVector(m_observers)) {
</del><ins>+    Vector<Observer*> observersCopy;
+    {
+        auto locker = holdLock(m_observersLock);
+        observersCopy = copyToVector(m_observers);
+    }
+    for (auto* observer : observersCopy) {
+        auto locker = holdLock(m_observersLock);
+        // Make sure the observer has not been destroyed.
</ins><span class="cx">         if (!m_observers.contains(observer))
</span><span class="cx">             continue;
</span><span class="cx">         apply(*observer);
</span><span class="lines">@@ -190,22 +182,9 @@
</span><span class="cx"> 
</span><span class="cx"> void RealtimeMediaSource::audioSamplesAvailable(const MediaTime& time, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t numberOfFrames)
</span><span class="cx"> {
</span><del>-    if (!m_hasSentStartProducedAudioData) {
-        callOnMainThread([this, weakThis = makeWeakPtr(this)] {
-            if (!weakThis)
-                return;
-            if (m_hasSentStartProducedAudioData)
-                return;
-            m_hasSentStartProducedAudioData = true;
-            forEachObserver([&](auto& observer) {
-                observer.hasStartedProducingAudioData();
-            });
-        });
-    }
-
-    auto locker = holdLock(m_audioSampleObserversLock);
-    for (auto* observer : m_audioSampleObservers)
-        observer->audioSamplesAvailable(time, audioData, description, numberOfFrames);
</del><ins>+    forEachObserver([&](auto& observer) {
+        observer.audioSamplesAvailable(time, audioData, description, numberOfFrames);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RealtimeMediaSource::start()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h  2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h     2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> 
</span><span class="cx"> class WEBCORE_EXPORT RealtimeMediaSource
</span><span class="cx">     : public ThreadSafeRefCounted<RealtimeMediaSource, WTF::DestructionThread::MainRunLoop>
</span><del>-    , public CanMakeWeakPtr<RealtimeMediaSource, WeakPtrFactoryInitialization::Eager>
</del><ins>+    , public CanMakeWeakPtr<RealtimeMediaSource>
</ins><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     , protected LoggerHelper
</span><span class="cx"> #endif
</span><span class="lines">@@ -92,14 +92,8 @@
</span><span class="cx">         // Called on the main thread.
</span><span class="cx">         virtual void videoSampleAvailable(MediaSample&) { }
</span><span class="cx"> 
</span><del>-        virtual void hasStartedProducingAudioData() { }
-    };
-    class AudioSampleObserver {
-    public:
-        virtual ~AudioSampleObserver() = default;
-
</del><span class="cx">         // May be called on a background thread.
</span><del>-        virtual void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t /*numberOfFrames*/) = 0;
</del><ins>+        virtual void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t /*numberOfFrames*/) { }
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     virtual ~RealtimeMediaSource() = default;
</span><span class="lines">@@ -137,9 +131,6 @@
</span><span class="cx">     WEBCORE_EXPORT void addObserver(Observer&);
</span><span class="cx">     WEBCORE_EXPORT void removeObserver(Observer&);
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT void addAudioSampleObserver(AudioSampleObserver&);
-    WEBCORE_EXPORT void removeAudioSampleObserver(AudioSampleObserver&);
-
</del><span class="cx">     const IntSize size() const;
</span><span class="cx">     void setSize(const IntSize&);
</span><span class="cx"> 
</span><span class="lines">@@ -262,11 +253,8 @@
</span><span class="cx">     String m_persistentID;
</span><span class="cx">     Type m_type;
</span><span class="cx">     String m_name;
</span><ins>+    mutable RecursiveLock m_observersLock;
</ins><span class="cx">     HashSet<Observer*> m_observers;
</span><del>-
-    mutable RecursiveLock m_audioSampleObserversLock;
-    HashSet<AudioSampleObserver*> m_audioSampleObservers;
-
</del><span class="cx">     IntSize m_size;
</span><span class="cx">     IntSize m_intrinsicSize;
</span><span class="cx">     double m_frameRate { 30 };
</span><span class="lines">@@ -284,7 +272,6 @@
</span><span class="cx">     bool m_interrupted { false };
</span><span class="cx">     bool m_captureDidFailed { false };
</span><span class="cx">     bool m_isEnded { false };
</span><del>-    bool m_hasSentStartProducedAudioData { false };
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct CaptureSourceOrError {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeOutgoingAudioSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp        2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp   2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> 
</span><span class="cx"> RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource()
</span><span class="cx"> {
</span><del>-    ASSERT(!m_audioSource->hasObserver(*this));
</del><ins>+ASSERT(!m_audioSource->hasObserver(*this));
</ins><span class="cx"> #if ASSERT_ENABLED
</span><span class="cx">     auto locker = holdLock(m_sinksLock);
</span><span class="cx"> #endif
</span><span class="lines">@@ -58,13 +58,11 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_audioSource->hasObserver(*this));
</span><span class="cx">     m_audioSource->addObserver(*this);
</span><del>-    m_audioSource->source().addAudioSampleObserver(*this);
</del><span class="cx">     initializeConverter();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RealtimeOutgoingAudioSource::unobserveSource()
</span><span class="cx"> {
</span><del>-    m_audioSource->source().removeAudioSampleObserver(*this);
</del><span class="cx">     m_audioSource->removeObserver(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeOutgoingAudioSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h  2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h     2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -55,7 +55,6 @@
</span><span class="cx">     : public ThreadSafeRefCounted<RealtimeOutgoingAudioSource, WTF::DestructionThread::Main>
</span><span class="cx">     , public webrtc::AudioSourceInterface
</span><span class="cx">     , private MediaStreamTrackPrivate::Observer
</span><del>-    , private RealtimeMediaSource::AudioSampleObserver
</del><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     , private LoggerHelper
</span><span class="cx"> #endif
</span><span class="lines">@@ -109,6 +108,7 @@
</span><span class="cx"> 
</span><span class="cx">     void sourceMutedChanged();
</span><span class="cx">     void sourceEnabledChanged();
</span><ins>+    virtual void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) { };
</ins><span class="cx"> 
</span><span class="cx">     virtual bool isReachingBufferedAudioDataHighLimit() { return false; };
</span><span class="cx">     virtual bool isReachingBufferedAudioDataLowLimit() { return false; };
</span><span class="lines">@@ -118,6 +118,7 @@
</span><span class="cx">     // MediaStreamTrackPrivate::Observer API
</span><span class="cx">     void trackMutedChanged(MediaStreamTrackPrivate&) final { sourceMutedChanged(); }
</span><span class="cx">     void trackEnabledChanged(MediaStreamTrackPrivate&) final { sourceEnabledChanged(); }
</span><ins>+    void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime& mediaTime, const PlatformAudioData& data, const AudioStreamDescription& description, size_t sampleCount) { audioSamplesAvailable(mediaTime, data, description, sampleCount); }
</ins><span class="cx">     void trackEnded(MediaStreamTrackPrivate&) final { }
</span><span class="cx">     void trackSettingsChanged(MediaStreamTrackPrivate&) final { }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamWebAudioSourceProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/WebAudioSourceProvider.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/WebAudioSourceProvider.h       2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/WebAudioSourceProvider.h  2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class WebAudioSourceProvider : public ThreadSafeRefCounted<WebAudioSourceProvider, WTF::DestructionThread::Main>, public AudioSourceProvider {
</del><ins>+class WebAudioSourceProvider : public ThreadSafeRefCounted<WebAudioSourceProvider>, public AudioSourceProvider {
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamgstreamerGStreamerMediaStreamSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp       2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp  2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -106,8 +106,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class WebKitMediaStreamTrackObserver
</span><del>-    : public MediaStreamTrackPrivate::Observer
-    , public RealtimeMediaSource::AudioSampleObserver {
</del><ins>+    : public MediaStreamTrackPrivate::Observer {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     virtual ~WebKitMediaStreamTrackObserver() { };
</span><span class="lines">@@ -132,7 +131,7 @@
</span><span class="cx">         webkitMediaStreamSrcPushVideoSample(m_mediaStreamSrc, gstsample);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void audioSamplesAvailable(const MediaTime&, const PlatformAudioData& audioData, const AudioStreamDescription&, size_t) final
</del><ins>+    void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime&, const PlatformAudioData& audioData, const AudioStreamDescription&, size_t) final
</ins><span class="cx">     {
</span><span class="cx">         auto audiodata = static_cast<const GStreamerAudioData&>(audioData);
</span><span class="cx"> 
</span><span class="lines">@@ -376,10 +375,9 @@
</span><span class="cx"> 
</span><span class="cx">     GST_OBJECT_LOCK(self);
</span><span class="cx">     if (self->stream) {
</span><del>-        for (auto& track : self->stream->tracks()) {
-            track->source().removeAudioSampleObserver(*self->mediaStreamTrackObserver.get());
</del><ins>+        for (auto& track : self->stream->tracks())
</ins><span class="cx">             track->removeObserver(*self->mediaStreamTrackObserver.get());
</span><del>-        }
</del><ins>+
</ins><span class="cx">         self->stream->removeObserver(*self->mediaStreamObserver);
</span><span class="cx">         self->stream = nullptr;
</span><span class="cx">     }
</span><span class="lines">@@ -398,14 +396,10 @@
</span><span class="cx"> 
</span><span class="cx">         GST_OBJECT_LOCK(self);
</span><span class="cx">         if (self->stream) {
</span><del>-            for (auto& track : self->stream->tracks()) {
-                track->source().removeAudioSampleObserver(*self->mediaStreamTrackObserver.get());
</del><ins>+            for (auto& track : self->stream->tracks())
</ins><span class="cx">                 track->removeObserver(*self->mediaStreamTrackObserver.get());
</span><del>-            }
-        } else if (self->track) {
-            self->track->source().removeAudioSampleObserver(*self->mediaStreamTrackObserver.get());
</del><ins>+        } else if (self->track)
</ins><span class="cx">             self->track->removeObserver(*self->mediaStreamTrackObserver.get());
</span><del>-        }
</del><span class="cx">         GST_OBJECT_UNLOCK(self);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -549,10 +543,9 @@
</span><span class="cx">     } else
</span><span class="cx">         webkitMediaStreamSrcAddPad(self, pad.get(), pad_template);
</span><span class="cx"> 
</span><del>-    if (observe_track) {
</del><ins>+    if (observe_track)
</ins><span class="cx">         track->addObserver(*self->mediaStreamTrackObserver.get());
</span><del>-        track->source().addAudioSampleObserver(*self->mediaStreamTrackObserver.get());
-    }
</del><ins>+
</ins><span class="cx">     gst_element_sync_state_with_parent(element);
</span><span class="cx">     return TRUE;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacWebAudioSourceProviderAVFObjCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h    2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h       2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -46,10 +46,7 @@
</span><span class="cx"> class AudioSampleDataSource;
</span><span class="cx"> class CAAudioStreamDescription;
</span><span class="cx"> 
</span><del>-class WEBCORE_EXPORT WebAudioSourceProviderAVFObjC final
-    : public WebAudioSourceProvider
-    , MediaStreamTrackPrivate::Observer
-    , RealtimeMediaSource::AudioSampleObserver {
</del><ins>+class WEBCORE_EXPORT WebAudioSourceProviderAVFObjC final : public WebAudioSourceProvider, MediaStreamTrackPrivate::Observer {
</ins><span class="cx"> public:
</span><span class="cx">     static Ref<WebAudioSourceProviderAVFObjC> create(MediaStreamTrackPrivate&);
</span><span class="cx">     virtual ~WebAudioSourceProviderAVFObjC();
</span><span class="lines">@@ -65,14 +62,12 @@
</span><span class="cx">     void setClient(AudioSourceProviderClient*) final;
</span><span class="cx"> 
</span><span class="cx">     // MediaStreamTrackPrivate::Observer
</span><ins>+    void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
</ins><span class="cx">     void trackEnded(MediaStreamTrackPrivate&) final { }
</span><span class="cx">     void trackMutedChanged(MediaStreamTrackPrivate&) final { }
</span><span class="cx">     void trackSettingsChanged(MediaStreamTrackPrivate&) final { }
</span><del>-    void trackEnabledChanged(MediaStreamTrackPrivate&) final;
</del><ins>+    void trackEnabledChanged(MediaStreamTrackPrivate&) final { }
</ins><span class="cx"> 
</span><del>-    // RealtimeMediaSource::AudioSampleObserver
-    void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
-
</del><span class="cx">     size_t m_listBufferSize { 0 };
</span><span class="cx">     Optional<CAAudioStreamDescription> m_inputDescription;
</span><span class="cx">     Optional<CAAudioStreamDescription> m_outputDescription;
</span><span class="lines">@@ -82,10 +77,8 @@
</span><span class="cx">     uint64_t m_readCount { 0 };
</span><span class="cx">     AudioSourceProviderClient* m_client { nullptr };
</span><span class="cx">     MediaStreamTrackPrivate* m_captureSource { nullptr };
</span><del>-    Ref<RealtimeMediaSource> m_source;
</del><span class="cx">     Lock m_mutex;
</span><span class="cx">     bool m_connected { false };
</span><del>-    bool m_enabled { true };
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacWebAudioSourceProviderAVFObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm   2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm      2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -54,16 +54,11 @@
</span><span class="cx"> 
</span><span class="cx"> WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC(MediaStreamTrackPrivate& source)
</span><span class="cx">     : m_captureSource(&source)
</span><del>-    , m_source(source.source())
-    , m_enabled(source.enabled())
</del><span class="cx"> {
</span><del>-    m_source->addAudioSampleObserver(*this);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC()
</span><span class="cx"> {
</span><del>-    m_source->removeAudioSampleObserver(*this);
-
</del><span class="cx">     auto locker = holdLock(m_mutex);
</span><span class="cx"> 
</span><span class="cx">     if (m_connected && m_captureSource)
</span><span class="lines">@@ -170,15 +165,10 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebAudioSourceProviderAVFObjC::trackEnabledChanged(MediaStreamTrackPrivate& track)
-{
-    m_enabled = track.enabled();
-}
-
</del><span class="cx"> // May get called on a background thread.
</span><del>-void WebAudioSourceProviderAVFObjC::audioSamplesAvailable(const MediaTime&, const PlatformAudioData& data, const AudioStreamDescription& description, size_t frameCount)
</del><ins>+void WebAudioSourceProviderAVFObjC::audioSamplesAvailable(MediaStreamTrackPrivate& track, const MediaTime&, const PlatformAudioData& data, const AudioStreamDescription& description, size_t frameCount)
</ins><span class="cx"> {
</span><del>-    if (!m_enabled || !m_connected)
</del><ins>+    if (!track.enabled())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     ASSERT(description.platformDescription().type == PlatformDescription::CAAudioStreamBasicType);
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp       2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/testing/Internals.cpp  2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -466,10 +466,8 @@
</span><span class="cx"> Internals::~Internals()
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><del>-    if (m_trackSource) {
-        m_trackSource->removeObserver(*this);
-        m_trackSource->removeAudioSampleObserver(*this);
-    }
</del><ins>+    if (m_track)
+        m_track->source().removeObserver(*this);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1641,9 +1639,9 @@
</span><span class="cx">         page->settings().setMediaCaptureRequiresSecureConnection(enabled);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static std::unique_ptr<MediaRecorderPrivate> createRecorderMockSource(MediaStreamPrivate& stream)
</del><ins>+static std::unique_ptr<MediaRecorderPrivate> createRecorderMockSource()
</ins><span class="cx"> {
</span><del>-    return std::unique_ptr<MediaRecorderPrivateMock>(new MediaRecorderPrivateMock(stream));
</del><ins>+    return std::unique_ptr<MediaRecorderPrivateMock>(new MediaRecorderPrivateMock);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Internals::setCustomPrivateRecorderCreator()
</span><span class="lines">@@ -4927,9 +4925,8 @@
</span><span class="cx"> 
</span><span class="cx"> void Internals::observeMediaStreamTrack(MediaStreamTrack& track)
</span><span class="cx"> {
</span><del>-    m_trackSource = &track.source();
-    m_trackSource->addObserver(*this);
-    m_trackSource->addAudioSampleObserver(*this);
</del><ins>+    m_track = &track;
+    m_track->source().addObserver(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Internals::grabNextMediaStreamTrackFrame(TrackFramePromise&& promise)
</span><span class="lines">@@ -4943,7 +4940,7 @@
</span><span class="cx">     if (!m_nextTrackFramePromise)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto& videoSettings = m_trackSource->settings();
</del><ins>+    auto& videoSettings = m_track->source().settings();
</ins><span class="cx">     if (!videoSettings.width() || !videoSettings.height())
</span><span class="cx">         return;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h 2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebCore/testing/Internals.h    2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -123,7 +123,6 @@
</span><span class="cx"> class Internals final : public RefCounted<Internals>, private ContextDestructionObserver
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx">     , private RealtimeMediaSource::Observer
</span><del>-    , private RealtimeMediaSource::AudioSampleObserver
</del><span class="cx"> #endif
</span><span class="cx">     {
</span><span class="cx"> public:
</span><span class="lines">@@ -970,16 +969,15 @@
</span><span class="cx"> 
</span><span class="cx">     ExceptionOr<RenderedDocumentMarker*> markerAt(Node&, const String& markerType, unsigned index);
</span><span class="cx"> 
</span><ins>+    // RealtimeMediaSource::Observer API
</ins><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><del>-    // RealtimeMediaSource::Observer API
</del><span class="cx">     void videoSampleAvailable(MediaSample&) final;
</span><del>-    // RealtimeMediaSource::AudioSampleObserver API
</del><span class="cx">     void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final { m_trackAudioSampleCount++; }
</span><span class="cx"> 
</span><span class="cx">     OrientationNotifier m_orientationNotifier;
</span><span class="cx">     unsigned long m_trackVideoSampleCount { 0 };
</span><span class="cx">     unsigned long m_trackAudioSampleCount { 0 };
</span><del>-    RefPtr<RealtimeMediaSource> m_trackSource;
</del><ins>+    RefPtr<MediaStreamTrack> m_track;
</ins><span class="cx">     std::unique_ptr<TrackFramePromise> m_nextTrackFramePromise;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebKit/ChangeLog       2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2020-04-09  Jacob Uphoff  <jacob_uphoff@apple.com>
+
+        Unreviewed, reverting r259816.
+
+        This commit broke the webkit build for macOS and iOS
+
+        Reverted changeset:
+
+        "Introduce a RealtimeMediaSource observer dedicated to
+        receiving audio samples"
+        https://bugs.webkit.org/show_bug.cgi?id=210180
+        https://trac.webkit.org/changeset/259816
+
</ins><span class="cx"> 2020-04-09  Simon Fraser  <simon.fraser@apple.com>
</span><span class="cx"> 
</span><span class="cx">         eventSender.monitorWheelEvents() should clear latching state
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessCocoaUserMediaCaptureManagerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp     2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp        2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -50,7 +50,6 @@
</span><span class="cx"> 
</span><span class="cx"> class UserMediaCaptureManagerProxy::SourceProxy
</span><span class="cx">     : public RealtimeMediaSource::Observer
</span><del>-    , public RealtimeMediaSource::AudioSampleObserver
</del><span class="cx">     , public SharedRingBufferStorage::Client {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="lines">@@ -61,13 +60,11 @@
</span><span class="cx">         , m_ringBuffer(makeUniqueRef<SharedRingBufferStorage>(makeUniqueRef<SharedRingBufferStorage>(this)))
</span><span class="cx">     {
</span><span class="cx">         m_source->addObserver(*this);
</span><del>-        m_source->addAudioSampleObserver(*this);
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ~SourceProxy()
</span><span class="cx">     {
</span><span class="cx">         storage().invalidate();
</span><del>-        m_source->removeAudioSampleObserver(*this);
</del><span class="cx">         m_source->removeObserver(*this);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUwebrtcMediaRecorderPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp       2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp  2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-MediaRecorderPrivate::MediaRecorderPrivate(MediaStreamPrivate& stream)
</del><ins>+MediaRecorderPrivate::MediaRecorderPrivate(const MediaStreamPrivate& stream)
</ins><span class="cx">     : m_identifier(MediaRecorderIdentifier::generate())
</span><span class="cx">     , m_connection(WebProcess::singleton().ensureGPUProcessConnection().connection())
</span><span class="cx"> {
</span><span class="lines">@@ -64,19 +64,15 @@
</span><span class="cx">         width = selectedTracks.videoTrack->settings().width();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_connection->sendWithAsyncReply(Messages::RemoteMediaRecorderManager::CreateRecorder { m_identifier, !!selectedTracks.audioTrack, width, height }, [this, weakThis = makeWeakPtr(this), audioTrack = makeRefPtr(selectedTracks.audioTrack)](auto&& exception) {
-        if (!weakThis)
</del><ins>+    m_connection->sendWithAsyncReply(Messages::RemoteMediaRecorderManager::CreateRecorder { m_identifier, !!selectedTracks.audioTrack, width, height }, [this, weakThis = makeWeakPtr(this)](auto&& exception) {
+        if (!weakThis || !exception)
</ins><span class="cx">             return;
</span><del>-        if (exception)
-            return m_errorCallback(Exception { exception->code, WTFMove(exception->message) });
-        if (audioTrack)
-            setAudioSource(&audioTrack->source());
</del><ins>+        m_errorCallback(Exception { exception->code, WTFMove(exception->message) });
</ins><span class="cx">     }, 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaRecorderPrivate::~MediaRecorderPrivate()
</span><span class="cx"> {
</span><del>-    setAudioSource(nullptr);
</del><span class="cx">     m_connection->send(Messages::RemoteMediaRecorderManager::ReleaseRecorder { m_identifier }, 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -92,8 +88,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaRecorderPrivate::audioSamplesAvailable(const MediaTime& time, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t numberOfFrames)
</del><ins>+void MediaRecorderPrivate::audioSamplesAvailable(const WebCore::MediaStreamTrackPrivate& track, const MediaTime& time, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t numberOfFrames)
</ins><span class="cx"> {
</span><ins>+    if (track.id() != m_recordedAudioTrackID)
+        return;
+
</ins><span class="cx">     if (m_description != description) {
</span><span class="cx">         ASSERT(description.platformDescription().type == PlatformDescription::CAAudioStreamBasicType);
</span><span class="cx">         m_description = *WTF::get<const AudioStreamBasicDescription*>(description.platformDescription().description);
</span><span class="lines">@@ -131,7 +130,6 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaRecorderPrivate::stopRecording()
</span><span class="cx"> {
</span><del>-    setAudioSource(nullptr);
</del><span class="cx">     m_connection->send(Messages::RemoteMediaRecorder::StopRecording { }, m_identifier);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUwebrtcMediaRecorderPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h 2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h    2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -44,21 +44,18 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-class MediaRecorderPrivate final
-    : public WebCore::MediaRecorderPrivate
-    , public SharedRingBufferStorage::Client
-    , public CanMakeWeakPtr<MediaRecorderPrivate> {
</del><ins>+class MediaRecorderPrivate final : public WebCore::MediaRecorderPrivate, public SharedRingBufferStorage::Client, public CanMakeWeakPtr<MediaRecorderPrivate> {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    explicit MediaRecorderPrivate(WebCore::MediaStreamPrivate&);
</del><ins>+    explicit MediaRecorderPrivate(const WebCore::MediaStreamPrivate&);
</ins><span class="cx">     ~MediaRecorderPrivate();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     // WebCore::MediaRecorderPrivate
</span><span class="cx">     void sampleBufferUpdated(const WebCore::MediaStreamTrackPrivate&, WebCore::MediaSample&) final;
</span><ins>+    void audioSamplesAvailable(const WebCore::MediaStreamTrackPrivate&, const WTF::MediaTime&, const WebCore::PlatformAudioData&, const WebCore::AudioStreamDescription&, size_t) final;
</ins><span class="cx">     void fetchData(CompletionHandler<void(RefPtr<WebCore::SharedBuffer>&&, const String& mimeType)>&&) final;
</span><span class="cx">     void stopRecording() final;
</span><del>-    void audioSamplesAvailable(const WTF::MediaTime&, const WebCore::PlatformAudioData&, const WebCore::AudioStreamDescription&, size_t) final;
</del><span class="cx"> 
</span><span class="cx">     // SharedRingBufferStorage::Client
</span><span class="cx">     void storageChanged(SharedMemory*);
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUwebrtcMediaRecorderProvidercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.cpp (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.cpp      2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.cpp 2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-std::unique_ptr<WebCore::MediaRecorderPrivate> MediaRecorderProvider::createMediaRecorderPrivate(MediaStreamPrivate& stream)
</del><ins>+std::unique_ptr<WebCore::MediaRecorderPrivate> MediaRecorderProvider::createMediaRecorderPrivate(const MediaStreamPrivate& stream)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(GPU_PROCESS)
</span><span class="cx">     if (m_useGPUProcess)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUwebrtcMediaRecorderProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.h (259823 => 259824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.h        2020-04-09 20:43:05 UTC (rev 259823)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.h   2020-04-09 20:49:04 UTC (rev 259824)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx"> #if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA)
</span><del>-    std::unique_ptr<WebCore::MediaRecorderPrivate> createMediaRecorderPrivate(WebCore::MediaStreamPrivate&) final;
</del><ins>+    std::unique_ptr<WebCore::MediaRecorderPrivate> createMediaRecorderPrivate(const WebCore::MediaStreamPrivate&) final;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>