Changeset 248962 in webkit
- Timestamp:
- Aug 21, 2019 2:29:52 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r248960 r248962 1 2019-08-21 Jer Noble <jer.noble@apple.com> 2 3 Adopt AVSystemController_ActiveAudioRouteDidChangeNotification 4 https://bugs.webkit.org/show_bug.cgi?id=200992 5 <rdar://problem/54408993> 6 7 Reviewed by Eric Carlson. 8 9 When the system notifies us that the active audio route has changed in such a way 10 that necessitates pausing, pause all media sessions, exempting those that are 11 associated with WebRTC, since "pausing" an active audio conference isn't really 12 possible. 13 14 * Modules/mediastream/MediaStream.h: 15 * platform/audio/PlatformMediaSession.cpp: 16 (WebCore::PlatformMediaSession::shouldOverridePauseDuringRouteChange const): 17 * platform/audio/PlatformMediaSession.h: 18 (WebCore::PlatformMediaSessionClient::shouldOverridePauseDuringRouteChange const): 19 * platform/audio/ios/MediaSessionManagerIOS.h: 20 * platform/audio/ios/MediaSessionManagerIOS.mm: 21 (WebCore::MediaSessionManageriOS::activeRouteDidChange): 22 (-[WebMediaSessionHelper initWithCallback:]): 23 (-[WebMediaSessionHelper activeAudioRouteDidChange:]): 24 1 25 2019-08-21 Ryosuke Niwa <rniwa@webkit.org> 2 26 -
trunk/Source/WebCore/Modules/mediastream/MediaStream.h
r248467 r248962 160 160 Document* hostingDocument() const final { return document(); } 161 161 bool processingUserGestureForMedia() const final; 162 bool shouldOverridePauseDuringRouteChange() const { return true; } 162 163 163 164 // ActiveDOMObject API. -
trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp
r248846 r248962 394 394 } 395 395 396 bool PlatformMediaSession::shouldOverridePauseDuringRouteChange() const 397 { 398 return m_client.shouldOverridePauseDuringRouteChange(); 399 } 400 396 401 #if !RELEASE_LOG_DISABLED 397 402 WTFLogChannel& PlatformMediaSession::logChannel() const -
trunk/Source/WebCore/platform/audio/PlatformMediaSession.h
r247118 r248962 193 193 194 194 bool canPlayConcurrently(const PlatformMediaSession&) const; 195 bool shouldOverridePauseDuringRouteChange() const; 195 196 196 197 protected: … … 262 263 virtual void processIsSuspendedChanged() { } 263 264 265 virtual bool shouldOverridePauseDuringRouteChange() const { return false; } 266 264 267 protected: 265 268 virtual ~PlatformMediaSessionClient() = default; -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
r245947 r248962 51 51 void carPlayServerDied(); 52 52 void updateCarPlayIsConnected(Optional<bool>&&); 53 void activeRouteDidChange(Optional<bool>&&); 53 54 #endif 54 55 -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r245947 r248962 61 61 SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_CarPlayIsConnectedNotificationParameter, NSString *) 62 62 SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_ServerConnectionDiedNotification, NSString *) 63 SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_ActiveAudioRouteDidChangeNotification, NSString *) 64 SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_ActiveAudioRouteDidChangeNotificationParameter_ShouldPause, NSString *) 63 65 #endif 64 66 … … 223 225 224 226 setIsPlayingToAutomotiveHeadUnit([[[getAVSystemControllerClass() sharedAVSystemController] attributeForKey:getAVSystemController_CarPlayIsConnectedAttribute()] boolValue]); 227 } 228 229 void MediaSessionManageriOS::activeRouteDidChange(Optional<bool>&& shouldPause) 230 { 231 if (!shouldPause || !shouldPause.value()) 232 return; 233 234 forEachSession([](auto& session) { 235 if (!session.shouldOverridePauseDuringRouteChange()) 236 session.pauseSession(); 237 }); 225 238 } 226 239 #endif … … 255 268 if (canLoadAVSystemController_CarPlayIsConnectedDidChangeNotification()) 256 269 [center addObserver:self selector:@selector(carPlayIsConnectedDidChange:) name:getAVSystemController_CarPlayIsConnectedDidChangeNotification() object:nil]; 270 if (canLoadAVSystemController_ActiveAudioRouteDidChangeNotification()) 271 [center addObserver:self selector:@selector(activeAudioRouteDidChange:) name:getAVSystemController_ActiveAudioRouteDidChangeNotification() object:nil]; 257 272 #endif 258 273 … … 485 500 }); 486 501 } 502 503 - (void)activeAudioRouteDidChange:(NSNotification *)notification 504 { 505 if (!_callback) 506 return; 507 508 UNUSED_PARAM(notification); 509 Optional<bool> shouldPause; 510 if (notification && canLoadAVSystemController_ActiveAudioRouteDidChangeNotificationParameter_ShouldPause()) { 511 NSNumber* nsShouldPause = [notification.userInfo valueForKey:getAVSystemController_ActiveAudioRouteDidChangeNotificationParameter_ShouldPause()]; 512 if (nsShouldPause) 513 shouldPause = nsShouldPause.boolValue; 514 } 515 516 callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self), shouldPause = WTFMove(shouldPause)]() mutable { 517 if (auto* callback = protectedSelf->_callback) 518 callback->activeRouteDidChange(WTFMove(shouldPause)); 519 }); 520 521 } 487 522 #endif // HAVE(CELESTIAL) 488 523 @end
Note: See TracChangeset
for help on using the changeset viewer.