Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (179067 => 179068)
--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog 2015-01-24 18:57:44 UTC (rev 179067)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog 2015-01-24 19:14:44 UTC (rev 179068)
@@ -1,5 +1,39 @@
2015-01-24 David Kilzer <[email protected]>
+ Merge r175976.
+
+ 2014-11-11 Eric Carlson <[email protected]>
+
+ [iOS] cleanup wireless route monitoring
+ https://bugs.webkit.org/show_bug.cgi?id=138614
+
+ Reviewed by Jer Noble.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::clearMediaPlayer): Add logging.
+ (WebCore::HTMLMediaElement::removeEventListener): Ditto.
+ (WebCore::HTMLMediaElement::createMediaPlayer): Ditto.
+
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::resetRestrictions): Add logging.
+ (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Ditto.
+ (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Ditto.
+ (-[WebMediaSessionHelper initWithCallback:]): Ditto.
+ (-[WebMediaSessionHelper dealloc]): Always deallocate volume view and routing controller
+ on the main thread.
+ (-[WebMediaSessionHelper clearCallback]): Add logging.
+ (-[WebMediaSessionHelper hasWirelessTargetsAvailable]): Ditto.
+ (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): Always call routing controller on
+ the main thread.
+ (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]): Ditto.
+ (-[WebMediaSessionHelper interruption:]): Add logging.
+ (-[WebMediaSessionHelper applicationWillEnterForeground:]): Ditto.
+ (-[WebMediaSessionHelper applicationDidBecomeActive:]): Ditto.
+ (-[WebMediaSessionHelper applicationWillResignActive:]): Ditto.
+ (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]): Ditto.
+
+2015-01-24 David Kilzer <[email protected]>
+
Merge r175585.
2014-11-04 Reza Abbasian <[email protected]>
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/html/HTMLMediaElement.cpp (179067 => 179068)
--- branches/safari-600.1.4.15-branch/Source/WebCore/html/HTMLMediaElement.cpp 2015-01-24 18:57:44 UTC (rev 179067)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/html/HTMLMediaElement.cpp 2015-01-24 19:14:44 UTC (rev 179068)
@@ -4652,6 +4652,8 @@
void HTMLMediaElement::clearMediaPlayer(int flags)
{
+ LOG(Media, "HTMLMediaElement::clearMediaPlayer(%p) - flags = %x", this, (unsigned)flags);
+
#if USE(PLATFORM_TEXT_TRACK_MENU)
if (platformTextTrackMenu()) {
m_platformMenu->setClient(0);
@@ -4853,6 +4855,7 @@
return false;
bool didRemoveLastAvailabilityChangedListener = !hasEventListeners(eventNames().webkitplaybacktargetavailabilitychangedEvent);
+ LOG(Media, "HTMLMediaElement::removeEventListener(%p) - removed last listener = %s", this, boolString(didRemoveLastAvailabilityChangedListener));
if (didRemoveLastAvailabilityChangedListener)
m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, false);
@@ -5343,6 +5346,8 @@
void HTMLMediaElement::createMediaPlayer()
{
+ LOG(Media, "HTMLMediaElement::createMediaPlayer(%p)", this);
+
#if ENABLE(WEB_AUDIO)
if (m_audioSourceNode)
m_audioSourceNode->lock();
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (179067 => 179068)
--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-01-24 18:57:44 UTC (rev 179067)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-01-24 19:14:44 UTC (rev 179068)
@@ -127,6 +127,8 @@
void MediaSessionManageriOS::resetRestrictions()
{
+ LOG(Media, "MediaSessionManageriOS::resetRestrictions");
+
MediaSessionManager::resetRestrictions();
static wkDeviceClass deviceClass = iosDeviceClass();
@@ -181,6 +183,8 @@
void MediaSessionManageriOS::updateNowPlayingInfo()
{
+ LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo");
+
MPNowPlayingInfoCenter *nowPlaying = (MPNowPlayingInfoCenter *)[getMPNowPlayingInfoCenterClass() defaultCenter];
const MediaSession* currentSession = this->currentSession();
@@ -230,6 +234,8 @@
- (id)initWithCallback:(MediaSessionManageriOS*)callback
{
+ LOG(Media, "-[WebMediaSessionHelper initWithCallback]");
+
if (!(self = [super init]))
return nil;
@@ -255,17 +261,38 @@
- (void)dealloc
{
+ LOG(Media, "-[WebMediaSessionHelper dealloc]");
+
+ if (!isMainThread()) {
+ auto volumeView = WTF::move(_volumeView);
+ auto routingController = WTF::move(_airPlayPresenceRoutingController);
+
+ callOnMainThread([volumeView, routingController] () mutable {
+ LOG(Media, "-[WebMediaSessionHelper dealloc] - dipatched to MainThread");
+
+ volumeView.clear();
+
+ if (!routingController)
+ return;
+
+ [routingController setDiscoveryMode:MPRouteDiscoveryModeDisabled];
+ routingController.clear();
+ });
+ }
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
- (void)clearCallback
{
+ LOG(Media, "-[WebMediaSessionHelper clearCallback]");
_callback = nil;
}
- (BOOL)hasWirelessTargetsAvailable
{
+ LOG(Media, "-[WebMediaSessionHelper hasWirelessTargetsAvailable]");
return [_volumeView areWirelessRoutesAvailable];
}
@@ -274,8 +301,18 @@
if (_airPlayPresenceRoutingController)
return;
- _airPlayPresenceRoutingController = adoptNS([[getMPAVRoutingControllerClass() alloc] initWithName:@"WebCore - HTML media element checking for AirPlay route presence"]);
- [_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModePresence];
+ LOG(Media, "-[WebMediaSessionHelper startMonitoringAirPlayRoutes]");
+
+ RetainPtr<WebMediaSessionHelper> strongSelf = self;
+ callOnMainThread([strongSelf] () {
+ LOG(Media, "-[WebMediaSessionHelper startMonitoringAirPlayRoutes] - dipatched to MainThread");
+
+ if (strongSelf->_airPlayPresenceRoutingController)
+ return;
+
+ strongSelf->_airPlayPresenceRoutingController = adoptNS([[getMPAVRoutingControllerClass() alloc] initWithName:@"WebCore - HTML media element checking for AirPlay route presence"]);
+ [strongSelf->_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModePresence];
+ });
}
- (void)stopMonitoringAirPlayRoutes
@@ -283,8 +320,18 @@
if (!_airPlayPresenceRoutingController)
return;
- [_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModeDisabled];
- _airPlayPresenceRoutingController = nil;
+ LOG(Media, "-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]");
+
+ RetainPtr<WebMediaSessionHelper> strongSelf = self;
+ callOnMainThread([strongSelf] () {
+ LOG(Media, "-[WebMediaSessionHelper stopMonitoringAirPlayRoutes] - dipatched to MainThread");
+
+ if (!strongSelf->_airPlayPresenceRoutingController)
+ return;
+
+ [strongSelf->_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModeDisabled];
+ strongSelf->_airPlayPresenceRoutingController = nil;
+ });
}
- (void)interruption:(NSNotification *)notification
@@ -295,6 +342,8 @@
NSUInteger type = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue];
MediaSession::EndInterruptionFlags flags = MediaSession::NoFlags;
+ LOG(Media, "-[WebMediaSessionHelper interruption] - type = %i", (int)type);
+
if (type == AVAudioSessionInterruptionTypeEnded && [[[notification userInfo] objectForKey:AVAudioSessionInterruptionOptionKey] unsignedIntegerValue] == AVAudioSessionInterruptionOptionShouldResume)
flags = MediaSession::MayResumePlaying;
@@ -317,6 +366,8 @@
if (!_callback)
return;
+ LOG(Media, "-[WebMediaSessionHelper applicationWillEnterForeground]");
+
WebThreadRun(^{
if (!_callback)
return;
@@ -332,6 +383,8 @@
if (!_callback)
return;
+ LOG(Media, "-[WebMediaSessionHelper applicationDidBecomeActive]");
+
WebThreadRun(^{
if (!_callback)
return;
@@ -346,7 +399,9 @@
if (!_callback)
return;
-
+
+ LOG(Media, "-[WebMediaSessionHelper applicationWillResignActive]");
+
WebThreadRun(^{
if (!_callback)
return;
@@ -362,6 +417,8 @@
if (!_callback)
return;
+ LOG(Media, "-[WebMediaSessionHelper wirelessRoutesAvailableDidChange]");
+
WebThreadRun(^{
if (!_callback)
return;