Changeset 249008 in webkit
- Timestamp:
- Aug 22, 2019, 8:45:26 AM (7 years ago)
- Location:
- branches/safari-608-branch/Source/WebCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
Modules/mediastream/MediaStream.h (modified) (1 diff)
-
platform/audio/PlatformMediaSession.cpp (modified) (1 diff)
-
platform/audio/PlatformMediaSession.h (modified) (2 diffs)
-
platform/audio/ios/MediaSessionManagerIOS.h (modified) (1 diff)
-
platform/audio/ios/MediaSessionManagerIOS.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-608-branch/Source/WebCore/ChangeLog
r248988 r249008 1 2019-08-21 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r248962. rdar://problem/54579627 4 5 Adopt AVSystemController_ActiveAudioRouteDidChangeNotification 6 https://bugs.webkit.org/show_bug.cgi?id=200992 7 <rdar://problem/54408993> 8 9 Reviewed by Eric Carlson. 10 11 When the system notifies us that the active audio route has changed in such a way 12 that necessitates pausing, pause all media sessions, exempting those that are 13 associated with WebRTC, since "pausing" an active audio conference isn't really 14 possible. 15 16 * Modules/mediastream/MediaStream.h: 17 * platform/audio/PlatformMediaSession.cpp: 18 (WebCore::PlatformMediaSession::shouldOverridePauseDuringRouteChange const): 19 * platform/audio/PlatformMediaSession.h: 20 (WebCore::PlatformMediaSessionClient::shouldOverridePauseDuringRouteChange const): 21 * platform/audio/ios/MediaSessionManagerIOS.h: 22 * platform/audio/ios/MediaSessionManagerIOS.mm: 23 (WebCore::MediaSessionManageriOS::activeRouteDidChange): 24 (-[WebMediaSessionHelper initWithCallback:]): 25 (-[WebMediaSessionHelper activeAudioRouteDidChange:]): 26 27 28 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248962 268f45cc-cd09-0410-ab3c-d52691b4dbfc 29 30 2019-08-21 Jer Noble <jer.noble@apple.com> 31 32 Adopt AVSystemController_ActiveAudioRouteDidChangeNotification 33 https://bugs.webkit.org/show_bug.cgi?id=200992 34 <rdar://problem/54408993> 35 36 Reviewed by Eric Carlson. 37 38 When the system notifies us that the active audio route has changed in such a way 39 that necessitates pausing, pause all media sessions, exempting those that are 40 associated with WebRTC, since "pausing" an active audio conference isn't really 41 possible. 42 43 * Modules/mediastream/MediaStream.h: 44 * platform/audio/PlatformMediaSession.cpp: 45 (WebCore::PlatformMediaSession::shouldOverridePauseDuringRouteChange const): 46 * platform/audio/PlatformMediaSession.h: 47 (WebCore::PlatformMediaSessionClient::shouldOverridePauseDuringRouteChange const): 48 * platform/audio/ios/MediaSessionManagerIOS.h: 49 * platform/audio/ios/MediaSessionManagerIOS.mm: 50 (WebCore::MediaSessionManageriOS::activeRouteDidChange): 51 (-[WebMediaSessionHelper initWithCallback:]): 52 (-[WebMediaSessionHelper activeAudioRouteDidChange:]): 53 1 54 2019-08-21 Kocsen Chung <kocsen_chung@apple.com> 2 55 -
branches/safari-608-branch/Source/WebCore/Modules/mediastream/MediaStream.h
r246470 r249008 166 166 Document* hostingDocument() const final { return document(); } 167 167 bool processingUserGestureForMedia() const final; 168 bool shouldOverridePauseDuringRouteChange() const { return true; } 168 169 169 170 // ActiveDOMObject API. -
branches/safari-608-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp
r245712 r249008 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 -
branches/safari-608-branch/Source/WebCore/platform/audio/PlatformMediaSession.h
r247118 r249008 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; -
branches/safari-608-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
r245947 r249008 51 51 void carPlayServerDied(); 52 52 void updateCarPlayIsConnected(Optional<bool>&&); 53 void activeRouteDidChange(Optional<bool>&&); 53 54 #endif 54 55 -
branches/safari-608-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r245947 r249008 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.