Title: [258506] trunk/Source/WebCore
- Revision
- 258506
- Author
- [email protected]
- Date
- 2020-03-16 09:51:06 -0700 (Mon, 16 Mar 2020)
Log Message
Make CoreAudioCaptureSourceFactoryIOS an AudioSession::InterruptionObserver
https://bugs.webkit.org/show_bug.cgi?id=209138
Reviewed by Eric Carlson.
Instead of listening to Audiosession interruptions, CoreAudioCaptureSourceFactoryIOS is now relying on AudioSession directly.
This allows removing some duplicate code.
No change of behavior.
* platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
* platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
(-[WebCoreAudioCaptureSourceIOSListener initWithCallback:]):
(WebCore::CoreAudioCaptureSourceFactoryIOS::CoreAudioCaptureSourceFactoryIOS):
(WebCore::CoreAudioCaptureSourceFactoryIOS::~CoreAudioCaptureSourceFactoryIOS):
(-[WebCoreAudioCaptureSourceIOSListener handleInterruption:]): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (258505 => 258506)
--- trunk/Source/WebCore/ChangeLog 2020-03-16 16:44:20 UTC (rev 258505)
+++ trunk/Source/WebCore/ChangeLog 2020-03-16 16:51:06 UTC (rev 258506)
@@ -1,5 +1,23 @@
2020-03-16 Youenn Fablet <[email protected]>
+ Make CoreAudioCaptureSourceFactoryIOS an AudioSession::InterruptionObserver
+ https://bugs.webkit.org/show_bug.cgi?id=209138
+
+ Reviewed by Eric Carlson.
+
+ Instead of listening to Audiosession interruptions, CoreAudioCaptureSourceFactoryIOS is now relying on AudioSession directly.
+ This allows removing some duplicate code.
+ No change of behavior.
+
+ * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
+ * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
+ (-[WebCoreAudioCaptureSourceIOSListener initWithCallback:]):
+ (WebCore::CoreAudioCaptureSourceFactoryIOS::CoreAudioCaptureSourceFactoryIOS):
+ (WebCore::CoreAudioCaptureSourceFactoryIOS::~CoreAudioCaptureSourceFactoryIOS):
+ (-[WebCoreAudioCaptureSourceIOSListener handleInterruption:]): Deleted.
+
+2020-03-16 Youenn Fablet <[email protected]>
+
Apply rotation at source level if WebRTC sink ask so
https://bugs.webkit.org/show_bug.cgi?id=205645
Modified: trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.h (258505 => 258506)
--- trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.h 2020-03-16 16:44:20 UTC (rev 258505)
+++ trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.h 2020-03-16 16:51:06 UTC (rev 258506)
@@ -27,6 +27,7 @@
#if ENABLE(MEDIA_STREAM) && PLATFORM(IOS_FAMILY)
+#include "AudioSession.h"
#include "CoreAudioCaptureSource.h"
OBJC_CLASS WebCoreAudioCaptureSourceIOSListener;
@@ -33,12 +34,16 @@
namespace WebCore {
-class CoreAudioCaptureSourceFactoryIOS final : public CoreAudioCaptureSourceFactory {
+class CoreAudioCaptureSourceFactoryIOS final : public CoreAudioCaptureSourceFactory, public AudioSession::InterruptionObserver {
public:
CoreAudioCaptureSourceFactoryIOS();
~CoreAudioCaptureSourceFactoryIOS();
private:
+ // AudioSession::InterruptionObserver.
+ void beginAudioSessionInterruption() { beginInterruption(); }
+ void endAudioSessionInterruption(AudioSession::MayResume) { endInterruption(); }
+
RetainPtr<WebCoreAudioCaptureSourceIOSListener> m_listener;
};
Modified: trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm (258505 => 258506)
--- trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm 2020-03-16 16:44:20 UTC (rev 258505)
+++ trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm 2020-03-16 16:51:06 UTC (rev 258506)
@@ -41,7 +41,6 @@
}
- (void)invalidate;
-- (void)handleInterruption:(NSNotification*)notification;
- (void)sessionMediaServicesWereReset:(NSNotification*)notification;
@end
@@ -57,7 +56,6 @@
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
AVAudioSession* session = [PAL::getAVAudioSessionClass() sharedInstance];
- [center addObserver:self selector:@selector(handleInterruption:) name:AVAudioSessionInterruptionNotification object:session];
[center addObserver:self selector:@selector(sessionMediaServicesWereReset:) name:AVAudioSessionMediaServicesWereResetNotification object:session];
return self;
@@ -69,30 +67,6 @@
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
-- (void)handleInterruption:(NSNotification*)notification
-{
- ASSERT(_callback);
- if (!_callback)
- return;
-
- if ([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] intValue] == AVAudioSessionInterruptionTypeBegan) {
- _callback->beginInterruption();
- return;
- }
-
- if ([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] intValue] == AVAudioSessionInterruptionTypeEnded) {
- NSError *error = nil;
- [[PAL::getAVAudioSessionClass() sharedInstance] setActive:YES error:&error];
-
-#if !LOG_DISABLED
- if (error)
- LOG(Media, "-[WebCoreAudioCaptureSourceIOSListener handleInterruption] (%p) - error = %s", self, [[error localizedDescription] UTF8String]);
-#endif
-
- _callback->endInterruption();
- }
-}
-
- (void)sessionMediaServicesWereReset:(NSNotification*)notification
{
UNUSED_PARAM(notification);
@@ -112,10 +86,12 @@
CoreAudioCaptureSourceFactoryIOS::CoreAudioCaptureSourceFactoryIOS()
: m_listener(adoptNS([[WebCoreAudioCaptureSourceIOSListener alloc] initWithCallback:this]))
{
+ AudioSession::sharedSession().addInterruptionObserver(*this);
}
CoreAudioCaptureSourceFactoryIOS::~CoreAudioCaptureSourceFactoryIOS()
{
+ AudioSession::sharedSession().removeInterruptionObserver(*this);
[m_listener invalidate];
m_listener = nullptr;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes