Title: [288302] trunk/Source/WebCore
Revision
288302
Author
[email protected]
Date
2022-01-20 10:06:49 -0800 (Thu, 20 Jan 2022)

Log Message

Reconfiguring the CoreAudioSharedUnit should take into account that there is a speaker sample producer
https://bugs.webkit.org/show_bug.cgi?id=235397

Reviewed by Eric Carlson.

Manually tested.

* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
When using VPIO to render speaker samples, we might have to reconfigure the VPIO unit to take into account the speaker format.
In that case, we might have a speaker sample producer and we should not stop the audio unit if getting samples from the producer at the same time.
To prevent this, we set the producer temporarily, stop the audio unit, then set back the producer.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288301 => 288302)


--- trunk/Source/WebCore/ChangeLog	2022-01-20 17:55:40 UTC (rev 288301)
+++ trunk/Source/WebCore/ChangeLog	2022-01-20 18:06:49 UTC (rev 288302)
@@ -1,3 +1,17 @@
+2022-01-20  Youenn Fablet  <[email protected]>
+
+        Reconfiguring the CoreAudioSharedUnit should take into account that there is a speaker sample producer
+        https://bugs.webkit.org/show_bug.cgi?id=235397
+
+        Reviewed by Eric Carlson.
+
+        Manually tested.
+
+        * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+        When using VPIO to render speaker samples, we might have to reconfigure the VPIO unit to take into account the speaker format.
+        In that case, we might have a speaker sample producer and we should not stop the audio unit if getting samples from the producer at the same time.
+        To prevent this, we set the producer temporarily, stop the audio unit, then set back the producer.
+
 2022-01-20  Sihui Liu  <[email protected]>
 
         Make LocalStorage prewarming async

Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (288301 => 288302)


--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp	2022-01-20 17:55:40 UTC (rev 288301)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp	2022-01-20 18:06:49 UTC (rev 288302)
@@ -446,12 +446,24 @@
 
 OSStatus CoreAudioSharedUnit::reconfigureAudioUnit()
 {
+    ASSERT(isMainThread());
     OSStatus err;
     if (!hasAudioUnit())
         return 0;
 
     if (m_ioUnitStarted) {
+        CoreAudioSpeakerSamplesProducer* speakerSamplesProducer;
+        {
+            Locker locker { m_speakerSamplesProducerLock };
+            speakerSamplesProducer = m_speakerSamplesProducer;
+            m_speakerSamplesProducer = nullptr;
+        }
         err = PAL::AudioOutputUnitStop(m_ioUnit);
+        {
+            Locker locker { m_speakerSamplesProducerLock };
+            m_speakerSamplesProducer = speakerSamplesProducer;
+        }
+
         if (err) {
             RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::reconfigureAudioUnit(%p) AudioOutputUnitStop failed with error %d (%.4s)", this, (int)err, (char*)&err);
             return err;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to