Title: [252470] trunk/Source/WebCore
Revision
252470
Author
[email protected]
Date
2019-11-14 16:34:01 -0800 (Thu, 14 Nov 2019)

Log Message

[iOS] Audio capture fails when a track is unmuted
https://bugs.webkit.org/show_bug.cgi?id=204202
<rdar://problem/57005820>

Reviewed by Youenn Fablet.

Tested manually.

* platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::canProduceAudioChanged): Remove unused "client" parameter.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto.
* platform/audio/PlatformMediaSessionManager.h:

* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(MediaSessionManagerCocoa::sessionCanProduceAudioChanged): Ditto.

* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::setMuted): Change m_muted before calling start/stop so the
muted method will return the correct value.

* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::startInternal): Call sessionCanProduceAudioChanged before
starting the audio unit so the audio session category is set correctly. ASSERT if the
audio session category is incorrect.

* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::startProducingData): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252469 => 252470)


--- trunk/Source/WebCore/ChangeLog	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/ChangeLog	2019-11-15 00:34:01 UTC (rev 252470)
@@ -1,3 +1,35 @@
+2019-11-14  Eric Carlson  <[email protected]>
+
+        [iOS] Audio capture fails when a track is unmuted
+        https://bugs.webkit.org/show_bug.cgi?id=204202
+        <rdar://problem/57005820>
+
+        Reviewed by Youenn Fablet.
+
+        Tested manually.
+
+        * platform/audio/PlatformMediaSession.cpp:
+        (WebCore::PlatformMediaSession::canProduceAudioChanged): Remove unused "client" parameter.
+        * platform/audio/PlatformMediaSessionManager.cpp:
+        (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto.
+        * platform/audio/PlatformMediaSessionManager.h:
+
+        * platform/audio/cocoa/MediaSessionManagerCocoa.h:
+        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+        (MediaSessionManagerCocoa::sessionCanProduceAudioChanged): Ditto.
+
+        * platform/mediastream/RealtimeMediaSource.cpp:
+        (WebCore::RealtimeMediaSource::setMuted): Change m_muted before calling start/stop so the
+        muted method will return the correct value.
+
+        * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+        (WebCore::CoreAudioSharedUnit::startInternal): Call sessionCanProduceAudioChanged before
+        starting the audio unit so the audio session category is set correctly. ASSERT if the
+        audio session category is incorrect.
+        
+        * platform/mock/MockRealtimeAudioSource.cpp:
+        (WebCore::MockRealtimeAudioSource::startProducingData): Ditto.
+
 2019-11-14  Said Abou-Hallawa  <[email protected]>
 
         The CSSParser should not consume negative or unit-less lengths for the SVG properties 'r', 'rx' and 'ry'

Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp (252469 => 252470)


--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp	2019-11-15 00:34:01 UTC (rev 252470)
@@ -358,7 +358,7 @@
 
 void PlatformMediaSession::canProduceAudioChanged()
 {
-    PlatformMediaSessionManager::sharedManager().sessionCanProduceAudioChanged(*this);
+    PlatformMediaSessionManager::sharedManager().sessionCanProduceAudioChanged();
 }
 
 #if ENABLE(VIDEO)

Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (252469 => 252470)


--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp	2019-11-15 00:34:01 UTC (rev 252470)
@@ -407,7 +407,7 @@
         session.beginInterruption(PlatformMediaSession::EnteringBackground);
 }
 
-void PlatformMediaSessionManager::sessionCanProduceAudioChanged(PlatformMediaSession&)
+void PlatformMediaSessionManager::sessionCanProduceAudioChanged()
 {
     updateSessionState();
 }

Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (252469 => 252470)


--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h	2019-11-15 00:34:01 UTC (rev 252470)
@@ -117,7 +117,7 @@
     virtual void sessionStateChanged(PlatformMediaSession&);
     virtual void sessionDidEndRemoteScrubbing(const PlatformMediaSession&) { };
     virtual void clientCharacteristicsChanged(PlatformMediaSession&) { }
-    virtual void sessionCanProduceAudioChanged(PlatformMediaSession&);
+    virtual void sessionCanProduceAudioChanged();
 
 #if PLATFORM(IOS_FAMILY)
     virtual void configureWireLessTargetMonitoring() { }

Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h (252469 => 252470)


--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h	2019-11-15 00:34:01 UTC (rev 252470)
@@ -56,7 +56,7 @@
     void sessionWillEndPlayback(PlatformMediaSession&) override;
     void sessionDidEndRemoteScrubbing(const PlatformMediaSession&) override;
     void clientCharacteristicsChanged(PlatformMediaSession&) override;
-    void sessionCanProduceAudioChanged(PlatformMediaSession&) override;
+    void sessionCanProduceAudioChanged() override;
 
     virtual void providePresentingApplicationPIDIfNecessary() { }
 

Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm (252469 => 252470)


--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm	2019-11-15 00:34:01 UTC (rev 252470)
@@ -173,9 +173,9 @@
     scheduleUpdateNowPlayingInfo();
 }
 
-void MediaSessionManagerCocoa::sessionCanProduceAudioChanged(PlatformMediaSession& session)
+void MediaSessionManagerCocoa::sessionCanProduceAudioChanged()
 {
-    PlatformMediaSessionManager::sessionCanProduceAudioChanged(session);
+    PlatformMediaSessionManager::sessionCanProduceAudioChanged();
     scheduleUpdateNowPlayingInfo();
 }
 

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (252469 => 252470)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2019-11-15 00:34:01 UTC (rev 252470)
@@ -90,18 +90,19 @@
 
 void RealtimeMediaSource::setMuted(bool muted)
 {
+    if (!muted && interrupted()) {
+        ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, "ignoring unmute because of interruption");
+        return;
+    }
+
     ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, muted);
 
+    // Changed m_muted before calling start/stop so muted() will reflect the correct state.
+    notifyMutedChange(muted);
     if (muted)
         stop();
-    else {
-        if (interrupted())
-            return;
-
+    else
         start();
-    }
-
-    notifyMutedChange(muted);
 }
 
 void RealtimeMediaSource::notifyMutedChange(bool muted)

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


--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp	2019-11-15 00:34:01 UTC (rev 252470)
@@ -34,6 +34,7 @@
 #include "CoreAudioCaptureDevice.h"
 #include "CoreAudioCaptureDeviceManager.h"
 #include "Logging.h"
+#include "PlatformMediaSessionManager.h"
 #include "Timer.h"
 #include "WebAudioSourceProviderAVFObjC.h"
 #include <AudioToolbox/AudioConverter.h>
@@ -665,6 +666,11 @@
 
     unduck();
 
+#if PLATFORM(IOS_FAMILY)
+    PlatformMediaSessionManager::sharedManager().sessionCanProduceAudioChanged();
+    ASSERT(AudioSession::sharedSession().category() == AudioSession::PlayAndRecord);
+#endif
+
     err = AudioOutputUnitStart(m_ioUnit);
     if (err) {
         RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::start(%p) AudioOutputUnitStart failed with error %d (%.4s)", this, (int)err, (char*)&err);

Modified: trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp (252469 => 252470)


--- trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp	2019-11-15 00:31:01 UTC (rev 252469)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp	2019-11-15 00:34:01 UTC (rev 252470)
@@ -32,11 +32,13 @@
 #include "MockRealtimeAudioSource.h"
 
 #if ENABLE(MEDIA_STREAM)
+#include "AudioSession.h"
 #include "CaptureDevice.h"
 #include "Logging.h"
 #include "MediaConstraints.h"
 #include "MockRealtimeMediaSourceCenter.h"
 #include "NotImplemented.h"
+#include "PlatformMediaSessionManager.h"
 #include "RealtimeMediaSourceSettings.h"
 #include <wtf/UUID.h>
 
@@ -133,6 +135,8 @@
 {
 #if PLATFORM(IOS_FAMILY)
     RealtimeMediaSourceCenter::singleton().audioCaptureFactory().setActiveSource(*this);
+    PlatformMediaSessionManager::sharedManager().sessionCanProduceAudioChanged();
+    ASSERT(AudioSession::sharedSession().category() == AudioSession::PlayAndRecord);
 #endif
 
     if (!sampleRate())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to