⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 175976 in webkit


Ignore:
Timestamp:
Nov 11, 2014, 2:03:15 PM (12 years ago)
Author:
eric.carlson@apple.com
Message:

[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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r175975 r175976  
     12014-11-11  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [iOS] cleanup wireless route monitoring
     4        https://bugs.webkit.org/show_bug.cgi?id=138614
     5
     6        Reviewed by Jer Noble.
     7
     8        * html/HTMLMediaElement.cpp:
     9        (WebCore::HTMLMediaElement::clearMediaPlayer): Add logging.
     10        (WebCore::HTMLMediaElement::removeEventListener): Ditto.
     11        (WebCore::HTMLMediaElement::createMediaPlayer): Ditto.
     12
     13        * platform/audio/ios/MediaSessionManagerIOS.mm:
     14        (WebCore::MediaSessionManageriOS::resetRestrictions): Add logging.
     15        (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Ditto.
     16        (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Ditto.
     17        (-[WebMediaSessionHelper initWithCallback:]): Ditto.
     18        (-[WebMediaSessionHelper dealloc]): Always deallocate volume view and routing controller
     19            on the main thread.
     20        (-[WebMediaSessionHelper clearCallback]): Add logging.
     21        (-[WebMediaSessionHelper hasWirelessTargetsAvailable]): Ditto.
     22        (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): Always call routing controller on
     23            the main thread.
     24        (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]): Ditto.
     25        (-[WebMediaSessionHelper interruption:]): Add logging.
     26        (-[WebMediaSessionHelper applicationWillEnterForeground:]): Ditto.
     27        (-[WebMediaSessionHelper applicationDidBecomeActive:]): Ditto.
     28        (-[WebMediaSessionHelper applicationWillResignActive:]): Ditto.
     29        (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]): Ditto.
     30
    1312014-11-11  Myles C. Maxfield  <mmaxfield@apple.com>
    232
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r175777 r175976  
    46524652void HTMLMediaElement::clearMediaPlayer(int flags)
    46534653{
     4654    LOG(Media, "HTMLMediaElement::clearMediaPlayer(%p) - flags = %x", this, (unsigned)flags);
     4655
    46544656#if USE(PLATFORM_TEXT_TRACK_MENU)
    46554657    if (platformTextTrackMenu()) {
     
    48564858
    48574859    bool didRemoveLastAvailabilityChangedListener = !hasEventListeners(eventNames().webkitplaybacktargetavailabilitychangedEvent);
     4860    LOG(Media, "HTMLMediaElement::removeEventListener(%p) - removed last listener = %s", this, boolString(didRemoveLastAvailabilityChangedListener));
    48584861    if (didRemoveLastAvailabilityChangedListener)
    48594862        m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, false);
     
    53585361void HTMLMediaElement::createMediaPlayer()
    53595362{
     5363    LOG(Media, "HTMLMediaElement::createMediaPlayer(%p)", this);
     5364
    53605365#if ENABLE(WEB_AUDIO)
    53615366    if (m_audioSourceNode)
  • trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm

    r175777 r175976  
    127127void MediaSessionManageriOS::resetRestrictions()
    128128{
     129    LOG(Media, "MediaSessionManageriOS::resetRestrictions");
     130
    129131    MediaSessionManager::resetRestrictions();
    130132
     
    167169    }
    168170
     171    LOG(Media, "MediaSessionManageriOS::configureWireLessTargetMonitoring - requiresMonitoring = %s", requiresMonitoring ? "true" : "false");
     172
    169173    if (requiresMonitoring)
    170174        [m_objcObserver startMonitoringAirPlayRoutes];
     
    188192void MediaSessionManageriOS::updateNowPlayingInfo()
    189193{
     194    LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo");
     195
    190196    MPNowPlayingInfoCenter *nowPlaying = (MPNowPlayingInfoCenter *)[getMPNowPlayingInfoCenterClass() defaultCenter];
    191197    const MediaSession* currentSession = this->currentSession();
     
    225231- (id)initWithCallback:(MediaSessionManageriOS*)callback
    226232{
     233    LOG(Media, "-[WebMediaSessionHelper initWithCallback]");
     234
    227235    if (!(self = [super init]))
    228236        return nil;
     
    250258- (void)dealloc
    251259{
     260    LOG(Media, "-[WebMediaSessionHelper dealloc]");
     261
     262    if (!isMainThread()) {
     263        auto volumeView = WTF::move(_volumeView);
     264        auto routingController = WTF::move(_airPlayPresenceRoutingController);
     265
     266        callOnMainThread([volumeView, routingController] () mutable {
     267            LOG(Media, "-[WebMediaSessionHelper dealloc] - dipatched to MainThread");
     268
     269            volumeView.clear();
     270
     271            if (!routingController)
     272                return;
     273
     274            [routingController setDiscoveryMode:MPRouteDiscoveryModeDisabled];
     275            routingController.clear();
     276        });
     277    }
     278
    252279    [[NSNotificationCenter defaultCenter] removeObserver:self];
    253280    [super dealloc];
     
    256283- (void)clearCallback
    257284{
     285    LOG(Media, "-[WebMediaSessionHelper clearCallback]");
    258286    _callback = nil;
    259287}
     
    261289- (BOOL)hasWirelessTargetsAvailable
    262290{
     291    LOG(Media, "-[WebMediaSessionHelper hasWirelessTargetsAvailable]");
    263292    return [_volumeView areWirelessRoutesAvailable];
    264293}
     
    269298        return;
    270299
    271     _airPlayPresenceRoutingController = adoptNS([[getMPAVRoutingControllerClass() alloc] initWithName:@"WebCore - HTML media element checking for AirPlay route presence"]);
    272     [_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModePresence];
     300    LOG(Media, "-[WebMediaSessionHelper startMonitoringAirPlayRoutes]");
     301
     302    RetainPtr<WebMediaSessionHelper> strongSelf = self;
     303    callOnMainThread([strongSelf] () {
     304        LOG(Media, "-[WebMediaSessionHelper startMonitoringAirPlayRoutes] - dipatched to MainThread");
     305
     306        if (strongSelf->_airPlayPresenceRoutingController)
     307            return;
     308
     309        strongSelf->_airPlayPresenceRoutingController = adoptNS([[getMPAVRoutingControllerClass() alloc] initWithName:@"WebCore - HTML media element checking for AirPlay route presence"]);
     310        [strongSelf->_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModePresence];
     311    });
    273312}
    274313
     
    278317        return;
    279318
    280     [_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModeDisabled];
    281     _airPlayPresenceRoutingController = nil;
     319    LOG(Media, "-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]");
     320
     321    RetainPtr<WebMediaSessionHelper> strongSelf = self;
     322    callOnMainThread([strongSelf] () {
     323        LOG(Media, "-[WebMediaSessionHelper stopMonitoringAirPlayRoutes] - dipatched to MainThread");
     324
     325        if (!strongSelf->_airPlayPresenceRoutingController)
     326            return;
     327
     328        [strongSelf->_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModeDisabled];
     329        strongSelf->_airPlayPresenceRoutingController = nil;
     330    });
    282331}
    283332
     
    289338    NSUInteger type = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue];
    290339    MediaSession::EndInterruptionFlags flags = MediaSession::NoFlags;
     340
     341    LOG(Media, "-[WebMediaSessionHelper interruption] - type = %i", (int)type);
    291342
    292343    if (type == AVAudioSessionInterruptionTypeEnded && [[[notification userInfo] objectForKey:AVAudioSessionInterruptionOptionKey] unsignedIntegerValue] == AVAudioSessionInterruptionOptionShouldResume)
     
    312363        return;
    313364
     365    LOG(Media, "-[WebMediaSessionHelper applicationWillEnterForeground]");
     366
    314367    WebThreadRun(^{
    315368        if (!_callback)
     
    327380        return;
    328381
     382    LOG(Media, "-[WebMediaSessionHelper applicationDidBecomeActive]");
     383
    329384    WebThreadRun(^{
    330385        if (!_callback)
     
    341396    if (!_callback)
    342397        return;
    343    
     398
     399    LOG(Media, "-[WebMediaSessionHelper applicationWillResignActive]");
     400
    344401    WebThreadRun(^{
    345402        if (!_callback)
     
    357414        return;
    358415
     416    LOG(Media, "-[WebMediaSessionHelper wirelessRoutesAvailableDidChange]");
     417
    359418    WebThreadRun(^{
    360419        if (!_callback)
Note: See TracChangeset for help on using the changeset viewer.