Changeset 206193 in webkit


Ignore:
Timestamp:
Sep 20, 2016 6:10:18 PM (8 years ago)
Author:
jer.noble@apple.com
Message:

Adopt MRMediaRemoteSetParentApplication.
https://bugs.webkit.org/show_bug.cgi?id=162259
<rdar://problem/28376161>

Reviewed by Anders Carlsson.

Allow MediaSessionManagerMac to retrieve the correct parent application identifier
from a PlatformMediaSession so that it can pass that identifier through to MediaRemote
via MRMediaRemoteSetParentApplication.

  • Modules/webaudio/AudioContext.cpp:

(WebCore::AudioContext::sourceApplicationIdentifier):

  • Modules/webaudio/AudioContext.h:
  • platform/audio/PlatformMediaSession.cpp:

(WebCore::PlatformMediaSession::sourceApplicationIdentifier):

  • platform/audio/PlatformMediaSession.h:

(WebCore::PlatformMediaSession::resetPlaybackSessionState): Deleted.

  • platform/audio/mac/MediaSessionManagerMac.mm:

(WebCore::MediaSessionManagerMac::updateNowPlayingInfo):

  • platform/mac/MediaRemoteSoftLink.cpp:
  • platform/mac/MediaRemoteSoftLink.h:
Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206190 r206193  
     12016-09-20  Jer Noble  <jer.noble@apple.com>
     2
     3        Adopt MRMediaRemoteSetParentApplication.
     4        https://bugs.webkit.org/show_bug.cgi?id=162259
     5        <rdar://problem/28376161>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        Allow MediaSessionManagerMac to retrieve the correct parent application identifier
     10        from a PlatformMediaSession so that it can pass that identifier through to MediaRemote
     11        via MRMediaRemoteSetParentApplication.
     12
     13        * Modules/webaudio/AudioContext.cpp:
     14        (WebCore::AudioContext::sourceApplicationIdentifier):
     15        * Modules/webaudio/AudioContext.h:
     16        * platform/audio/PlatformMediaSession.cpp:
     17        (WebCore::PlatformMediaSession::sourceApplicationIdentifier):
     18        * platform/audio/PlatformMediaSession.h:
     19        (WebCore::PlatformMediaSession::resetPlaybackSessionState): Deleted.
     20        * platform/audio/mac/MediaSessionManagerMac.mm:
     21        (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
     22        * platform/mac/MediaRemoteSoftLink.cpp:
     23        * platform/mac/MediaRemoteSoftLink.h:
     24
     25
    1262016-09-20  Nan Wang  <n_wang@apple.com>
    227
  • trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp

    r205088 r206193  
    4949#include "ExceptionCode.h"
    5050#include "FFTFrame.h"
     51#include "Frame.h"
    5152#include "GainNode.h"
    5253#include "GenericEventQueue.h"
     
    5455#include "HRTFPanner.h"
    5556#include "JSDOMPromise.h"
     57#include "NetworkingContext.h"
    5658#include "OfflineAudioCompletionEvent.h"
    5759#include "OfflineAudioDestinationNode.h"
     
    354356}
    355357
     358String AudioContext::sourceApplicationIdentifier() const
     359{
     360    Document* document = this->document();
     361    if (Frame* frame = document ? document->frame() : nullptr) {
     362        if (NetworkingContext* networkingContext = frame->loader().networkingContext())
     363            return networkingContext->sourceApplicationIdentifier();
     364    }
     365    return emptyString();
     366}
     367
    356368RefPtr<AudioBuffer> AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode& ec)
    357369{
  • trunk/Source/WebCore/Modules/webaudio/AudioContext.h

    r205088 r206193  
    318318    bool supportsSeeking() const override { return false; }
    319319    bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override { return false; }
     320    String sourceApplicationIdentifier() const override;
    320321
    321322    // EventTarget
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r206146 r206193  
    65196519}
    65206520
    6521 String HTMLMediaElement::mediaPlayerSourceApplicationIdentifier() const
     6521String HTMLMediaElement::sourceApplicationIdentifier() const
    65226522{
    65236523    if (Frame* frame = document().frame()) {
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r206127 r206193  
    628628    bool mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&) override;
    629629    void mediaPlayerHandlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType command) override { didReceiveRemoteControlCommand(command, nullptr); }
    630     String mediaPlayerSourceApplicationIdentifier() const override;
     630    String sourceApplicationIdentifier() const override;
     631    String mediaPlayerSourceApplicationIdentifier() const override { return sourceApplicationIdentifier(); }
    631632    Vector<String> mediaPlayerPreferredAudioCharacteristics() const override;
    632633
  • trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp

    r203982 r206193  
    290290}
    291291
     292String PlatformMediaSession::sourceApplicationIdentifier() const
     293{
     294    return m_client.sourceApplicationIdentifier();
     295}
     296
    292297bool PlatformMediaSession::isHidden() const
    293298{
  • trunk/Source/WebCore/platform/audio/PlatformMediaSession.h

    r205412 r206193  
    167167    void scheduleClientDataBufferingCheck();
    168168    virtual void resetPlaybackSessionState() { }
     169    String sourceApplicationIdentifier() const;
    169170
    170171protected:
     
    225226
    226227    virtual const Document* hostingDocument() const = 0;
     228    virtual String sourceApplicationIdentifier() const = 0;
    227229
    228230protected:
  • trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm

    r203706 r206193  
    113113        return;
    114114
    115     if (!MRMediaRemoteSetCanBeNowPlayingApplication(true)) {
    116         LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetCanBeNowPlayingApplication(true) failed");
    117         return;
    118     }
    119 
    120115    const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession();
    121116
     
    124119    if (!currentSession) {
    125120        if (m_nowPlayingActive) {
     121            MRMediaRemoteSetCanBeNowPlayingApplication(false);
    126122            LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - clearing now playing info");
    127123            MRMediaRemoteSetNowPlayingInfo(nullptr);
     
    136132        }
    137133
     134        return;
     135    }
     136
     137    if (!MRMediaRemoteSetCanBeNowPlayingApplication(true)) {
     138        LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetCanBeNowPlayingApplication(true) failed");
    138139        return;
    139140    }
     
    173174        title.utf8().data(), rate, duration, currentTime);
    174175
     176    String parentApplication = currentSession->sourceApplicationIdentifier();
     177    if (canLoad_MediaRemote_MRMediaRemoteSetParentApplication() && !parentApplication.isEmpty())
     178        MRMediaRemoteSetParentApplication(MRMediaRemoteGetLocalOrigin(), parentApplication.createCFString().get());
     179
    175180    m_nowPlayingActive = true;
    176181    MRPlaybackState playbackState = (currentSession->state() == PlatformMediaSession::Playing) ? kMRPlaybackStatePlaying : kMRPlaybackStatePaused;
  • trunk/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp

    r203982 r206193  
    4343SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingInfo, void, (CFDictionaryRef info), (info))
    4444SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin, void, (MROriginRef origin, MRPlaybackState playbackState, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError)), (origin, playbackState, replyQ, completion))
     45SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetParentApplication, void, (MROriginRef origin, CFStringRef parentAppDisplayID), (origin, parentAppDisplayID))
    4546SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoTitle, CFStringRef);
    4647SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoDuration, CFStringRef);
  • trunk/Source/WebCore/platform/mac/MediaRemoteSoftLink.h

    r203982 r206193  
    5454SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin, void, (MROriginRef origin, MRPlaybackState playbackState, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError)), (origin, playbackState, replyQ, completion))
    5555#define MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin softLink_MediaRemote_MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin
     56SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteSetParentApplication, void, (MROriginRef origin, CFStringRef parentAppDisplayID), (origin, parentAppDisplayID))
     57#define MRMediaRemoteSetParentApplication softLink_MediaRemote_MRMediaRemoteSetParentApplication
    5658SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoTitle, CFStringRef);
    5759#define kMRMediaRemoteNowPlayingInfoTitle get_MediaRemote_kMRMediaRemoteNowPlayingInfoTitle()
Note: See TracChangeset for help on using the changeset viewer.