Title: [258988] branches/safari-609-branch/Source/WebCore/platform/mediastream/mac
- Revision
- 258988
- Author
- repst...@apple.com
- Date
- 2020-03-25 09:49:28 -0700 (Wed, 25 Mar 2020)
Log Message
Apply patch. rdar://problem/60827023
Modified Paths
Diff
Modified: branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp (258987 => 258988)
--- branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp 2020-03-25 16:32:00 UTC (rev 258987)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp 2020-03-25 16:49:28 UTC (rev 258988)
@@ -61,6 +61,9 @@
if (m_dataSource)
m_dataSource->setPaused(true);
+ m_isAudioUnitStarted = false;
+ m_isPlaying = false;
+
if (m_remoteIOUnit) {
AudioOutputUnitStop(m_remoteIOUnit);
AudioComponentInstanceDispose(m_remoteIOUnit);
@@ -84,6 +87,11 @@
if (m_dataSource)
m_dataSource->setPaused(false);
+
+ if (m_isCleared) {
+ streamTrack().source().addObserver(*this);
+ m_isCleared = false;
+ }
}
void AudioTrackPrivateMediaStreamCocoa::play()
@@ -98,6 +106,8 @@
if (!m_isPlaying)
return;
+ clear();
+
m_isPlaying = false;
m_autoPlay = false;
@@ -256,6 +266,19 @@
pause();
}
+void AudioTrackPrivateMediaStreamCocoa::sourceMutedChanged()
+{
+ if (streamTrack().muted())
+ return;
+
+ if (!m_isPlaying)
+ return;
+
+ // If we we want to play and were muted, we restart from scratch by doing a pause/start.
+ pause();
+ play();
+}
+
OSStatus AudioTrackPrivateMediaStreamCocoa::render(UInt32 sampleCount, AudioBufferList& ioData, UInt32 /*inBusNumber*/, const AudioTimeStamp& timeStamp, AudioUnitRenderActionFlags& actionFlags)
{
// This function is called on a high-priority background thread. The following protectedThis object ensures the object is not
Modified: branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h (258987 => 258988)
--- branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h 2020-03-25 16:32:00 UTC (rev 258987)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h 2020-03-25 16:49:28 UTC (rev 258988)
@@ -63,6 +63,7 @@
// RealtimeMediaSource::Observer
void sourceStopped() final;
+ void sourceMutedChanged() final;
void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final;
static OSStatus inputProc(void*, AudioUnitRenderActionFlags*, const AudioTimeStamp*, UInt32 inBusNumber, UInt32 numberOfFrames, AudioBufferList*);
@@ -72,6 +73,7 @@
void cleanup();
void zeroBufferList(AudioBufferList&, size_t);
void playInternal();
+ void stop();
#if !RELEASE_LOG_DISABLED
const char* logClassName() const final { return "AudioTrackPrivateMediaStreamCocoa"; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes