Changeset 186519 in webkit


Ignore:
Timestamp:
Jul 8, 2015 11:54:34 AM (9 years ago)
Author:
eric.carlson@apple.com
Message:

[Mac] Two clicks required to enable AirPlay at youtube.com
https://bugs.webkit.org/show_bug.cgi?id=146733
<rdar://problem/21556356>

Reviewed by Brent Fulgham.

  • Modules/mediasession/WebMediaSessionManager.cpp:

(WebCore::WebMediaSessionManager::clientStateDidChange): Only log when state has changed.

Don't steal the route if another client is actively playing to the device.

(WebCore::WebMediaSessionManager::setPlaybackTarget): Set m_targetChanged.
(WebCore::WebMediaSessionManager::configurePlaybackTargetClients): Don't consider the

requestedPicker flag until after a target change.

  • Modules/mediasession/WebMediaSessionManager.h:
  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): Add logging.
(WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget): Ditto.

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): Always log.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r186509 r186519  
     12015-07-08  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Mac] Two clicks required to enable AirPlay at youtube.com
     4        https://bugs.webkit.org/show_bug.cgi?id=146733
     5        <rdar://problem/21556356>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        * Modules/mediasession/WebMediaSessionManager.cpp:
     10        (WebCore::WebMediaSessionManager::clientStateDidChange): Only log when state has changed.
     11          Don't steal the route if another client is actively playing to the device.
     12        (WebCore::WebMediaSessionManager::setPlaybackTarget): Set m_targetChanged.
     13        (WebCore::WebMediaSessionManager::configurePlaybackTargetClients): Don't consider the
     14          requestedPicker flag until after a target change.
     15        * Modules/mediasession/WebMediaSessionManager.h:
     16
     17        * html/HTMLMediaElement.cpp:
     18        (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): Add logging.
     19        (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget): Ditto.
     20
     21        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     22        (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): Always log.
     23
    1242015-07-08  Zalan Bujtas  <zalan@apple.com>
    225
  • trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp

    r186361 r186519  
    166166    auto& changedClientState = m_clientState[index];
    167167    MediaProducer::MediaStateFlags oldFlags = changedClientState->flags;
     168    if (newFlags == oldFlags)
     169        return;
     170
    168171    LOG(Media, "WebMediaSessionManager::clientStateDidChange(%p + %llu) - new flags = %s, old flags = %s", &client, contextId, mediaProducerStateString(newFlags).utf8().data(), mediaProducerStateString(oldFlags).utf8().data());
    169     if (newFlags == oldFlags)
    170         return;
    171172
    172173    changedClientState->flags = newFlags;
     
    200201    }
    201202
    202     // Do not take the target if another client has it and the client reporting a state change is not playing.
    203     if (anotherClientHasActiveTarget && !flagsAreSet(newFlags, MediaProducer::IsPlayingVideo))
     203    if (anotherClientHasActiveTarget || !flagsAreSet(newFlags, MediaProducer::IsPlayingVideo))
    204204        return;
    205205
     
    219219{
    220220    m_playbackTarget = WTF::move(target);
     221    m_targetChanged = true;
    221222    scheduleDelayedTask(TargetClientsConfigurationTask);
    222223}
     
    256257        auto& state = m_clientState[i];
    257258
    258         if (state->requestedPicker)
     259        if (m_targetChanged && state->requestedPicker)
    259260            indexOfClientThatRequestedPicker = i;
    260261
     
    278279
    279280        state->configurationRequired = false;
    280         state->requestedPicker = false;
     281        if (m_targetChanged)
     282            state->requestedPicker = false;
    281283    }
    282284
     
    287289    }
    288290
     291    m_targetChanged = false;
    289292    configureWatchdogTimer();
    290293}
  • trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.h

    r186361 r186519  
    6565
    6666    size_t find(WebMediaSessionManagerClient*, uint64_t);
     67
    6768    void configurePlaybackTargetClients();
    6869    void configureNewClients();
     
    9394    double m_currentWatchdogInterval { 0 };
    9495    bool m_externalOutputDeviceAvailable { false };
     96    bool m_targetChanged { false };
    9597};
    9698
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r186388 r186519  
    49814981void HTMLMediaElement::webkitShowPlaybackTargetPicker()
    49824982{
     4983    LOG(Media, "HTMLMediaElement::webkitShowPlaybackTargetPicker(%p)", this);
    49834984    m_mediaSession->showPlaybackTargetPicker(*this);
    49844985}
     
    50875088void HTMLMediaElement::setShouldPlayToPlaybackTarget(bool shouldPlay)
    50885089{
     5090    LOG(Media, "HTMLMediaElement::setShouldPlayToPlaybackTarget(%p) - shouldPlay = %s", this, boolString(shouldPlay));
     5091
    50895092    if (m_player)
    50905093        m_player->setShouldPlayToPlaybackTarget(shouldPlay);
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r186020 r186519  
    28232823    m_shouldPlayToPlaybackTarget = shouldPlay;
    28242824
     2825    AVOutputContext *newContext = shouldPlay ? m_outputContext.get() : nil;
     2826    LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget(%p) - target = %p, shouldPlay = %s", this, newContext, boolString(shouldPlay));
     2827
    28252828    if (!m_avPlayer)
    28262829        return;
    28272830
    2828     AVOutputContext *newContext = shouldPlay ? m_outputContext.get() : nil;
    28292831    RetainPtr<AVOutputContext> currentContext = m_avPlayer.get().outputContext;
    2830 
    2831     LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget(%p) - target = %p, shouldPlay = %s", this, newContext, boolString(shouldPlay));
    2832 
    28332832    if ((!newContext && !currentContext.get()) || [currentContext.get() isEqual:newContext])
    28342833        return;
Note: See TracChangeset for help on using the changeset viewer.