WebKit Bugzilla
Attachment 349904 Details for
Bug 189096
: Enable USE_MEDIAREMOTE on iOS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-189096-20180917105136.patch (text/plain), 61.62 KB, created by
Jer Noble
on 2018-09-17 10:51:37 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-09-17 10:51:37 PDT
Size:
61.62 KB
patch
obsolete
>Subversion Revision: 236018 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 3e74f45862e2d53bd7d6f603d35a551191ba330a..0461988bd7275865156ca93baf690def8f163e7e 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,12 @@ >+2018-08-29 Jer Noble <jer.noble@apple.com> >+ >+ Enable USE_MEDIAREMOTE on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=189096 >+ >+ Reviewed by Eric Carlson. >+ >+ * wtf/Platform.h: >+ > 2018-08-22 Jer Noble <jer.noble@apple.com> > > Refactoring: eliminate raw pointer usage in Fullscreen code >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 54219a80c74af5528f396b7e921ef9b45eaaa599..3cdbedc2603dd5ed75325ac42bb67361c06c8229 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,42 @@ >+2018-08-29 Jer Noble <jer.noble@apple.com> >+ >+ Enable USE_MEDIAREMOTE on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=189096 >+ >+ Reviewed by Eric Carlson. >+ >+ Migrate to using MediaRemote.framework on iOS from MediaPlayer.framework. This unifies the >+ Now Playing implementation on iOS and Mac. >+ >+ * SourcesCocoa.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: Removed. >+ * platform/audio/cocoa/MediaSessionManagerCocoa.h: >+ * platform/audio/cocoa/MediaSessionManagerCocoa.mm: Renamed from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm. >+ (PlatformMediaSessionManager::sharedManager): >+ (PlatformMediaSessionManager::sharedManagerIfExists): >+ (MediaSessionManagerCocoa::updateSessionState): >+ (MediaSessionManagerCocoa::beginInterruption): >+ (MediaSessionManagerCocoa::scheduleUpdateNowPlayingInfo): >+ (MediaSessionManagerCocoa::sessionWillBeginPlayback): >+ (MediaSessionManagerCocoa::sessionDidEndRemoteScrubbing): >+ (MediaSessionManagerCocoa::removeSession): >+ (MediaSessionManagerCocoa::sessionWillEndPlayback): >+ (MediaSessionManagerCocoa::clientCharacteristicsChanged): >+ (MediaSessionManagerCocoa::sessionCanProduceAudioChanged): >+ (MediaSessionManagerCocoa::nowPlayingEligibleSession): >+ (MediaSessionManagerCocoa::updateNowPlayingInfo): >+ * platform/audio/ios/MediaSessionManagerIOS.h: >+ (): Deleted. >+ * platform/audio/ios/MediaSessionManagerIOS.mm: >+ (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession): Deleted. >+ (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Deleted. >+ (WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Deleted. >+ (WebCore::MediaSessionManageriOS::removeSession): Deleted. >+ (WebCore::MediaSessionManageriOS::sessionWillEndPlayback): Deleted. >+ (WebCore::MediaSessionManageriOS::clientCharacteristicsChanged): Deleted. >+ * platform/audio/mac/MediaSessionManagerMac.h: Removed. >+ > 2018-08-22 Jer Noble <jer.noble@apple.com> > > Refactoring: eliminate raw pointer usage in Fullscreen code >diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h >index 88bf034a40b2f348dfcc8337997cc5fc9fa4545e..12a1e938fbf095842f4ba726fecb653fac2c9c31 100644 >--- a/Source/WTF/wtf/Platform.h >+++ b/Source/WTF/wtf/Platform.h >@@ -1303,7 +1303,7 @@ > #endif > #endif > >-#if PLATFORM(MAC) >+#if PLATFORM(MAC) || PLATFORM(IOS) > #define USE_MEDIAREMOTE 1 > #endif > >diff --git a/Source/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt >index 6a78661d4f3b555669c28410b8651e084539ec0f..8033a36a1e645a4d4bc516ac8fe7a56f1e419f49 100644 >--- a/Source/WebCore/SourcesCocoa.txt >+++ b/Source/WebCore/SourcesCocoa.txt >@@ -159,7 +159,7 @@ page/scrolling/mac/ScrollingTreeStickyNode.mm > > platform/audio/AudioSession.cpp > >-platform/audio/cocoa/MediaSessionManagerCocoa.cpp >+platform/audio/cocoa/MediaSessionManagerCocoa.mm > platform/audio/cocoa/WebAudioBufferList.cpp > > platform/audio/ios/AudioDestinationIOS.cpp @no-unify >@@ -176,7 +176,6 @@ platform/audio/mac/AudioHardwareListenerMac.cpp > platform/audio/mac/AudioSessionMac.cpp > platform/audio/mac/CARingBuffer.cpp > platform/audio/mac/FFTFrameMac.cpp >-platform/audio/mac/MediaSessionManagerMac.mm > > platform/cf/CFURLExtras.cpp > platform/cf/FileSystemCF.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 684644f7aff7a45b7ace085498a6ebb4867ce1b2..7b3ce3348ab7724d0cb4b7bb6481e163ce063328 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -3966,6 +3966,7 @@ > CD063F831E23FA8900812BE3 /* InitDataRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = CD063F811E23FA8900812BE3 /* InitDataRegistry.h */; }; > CD0EEE0E14743F39003EAFA2 /* AudioDestinationIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD0EEE0B14743E35003EAFA2 /* AudioDestinationIOS.cpp */; }; > CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ CD17A45D213740810079EC7B /* UnifiedSource62-mm.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD17A459213740160079EC7B /* UnifiedSource62-mm.mm */; }; > CD19A2681A13E700008D650E /* DiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CD19A2671A13E700008D650E /* DiagnosticLoggingClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; > CD19FEA81F573972000C42FB /* ImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = CD19FEA61F573972000C42FB /* ImageDecoder.h */; }; > CD19FEAE1F574B6D000C42FB /* ImageDecoderAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CD19FEAC1F574B6D000C42FB /* ImageDecoderAVFObjC.h */; }; >@@ -5443,7 +5444,6 @@ > 07E3DFD01A9E786500764CA8 /* MediaPlaybackTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlaybackTarget.h; sourceTree = "<group>"; }; > 07E9E12D18F5E2760011A3A4 /* InbandMetadataTextTrackPrivateAVF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandMetadataTextTrackPrivateAVF.h; sourceTree = "<group>"; }; > 07E9E12F18F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InbandMetadataTextTrackPrivateAVF.cpp; sourceTree = "<group>"; }; >- 07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSessionManagerMac.mm; sourceTree = "<group>"; }; > 07EE76E91BE96DB000F89133 /* MockRealtimeVideoSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockRealtimeVideoSource.cpp; sourceTree = "<group>"; }; > 07EE76EA1BE96DB000F89133 /* MockRealtimeVideoSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockRealtimeVideoSource.h; sourceTree = "<group>"; }; > 07EE76ED1BEA619800F89133 /* MockRealtimeVideoSourceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockRealtimeVideoSourceMac.h; sourceTree = "<group>"; }; >@@ -7284,7 +7284,7 @@ > 417F0D7E1FFEE14E008EF303 /* ServiceWorkerInternals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerInternals.h; sourceTree = "<group>"; }; > 417F0D801FFEE14F008EF303 /* ServiceWorkerInternals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerInternals.cpp; sourceTree = "<group>"; }; > 417F0D811FFEE150008EF303 /* ServiceWorkerInternals.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ServiceWorkerInternals.idl; sourceTree = "<group>"; }; >- 417F7AEA2139BF6400FBA7EC /* MediaSessionManagerCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSessionManagerCocoa.cpp; sourceTree = "<group>"; }; >+ 417F7AEA2139BF6400FBA7EC /* MediaSessionManagerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSessionManagerCocoa.mm; sourceTree = "<group>"; }; > 417F7AEB2139BF6400FBA7EC /* WebAudioBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebAudioBufferList.cpp; sourceTree = "<group>"; }; > 417F7AEC2139BF6500FBA7EC /* WebAudioBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAudioBufferList.h; sourceTree = "<group>"; }; > 417F7AED2139BF6500FBA7EC /* MediaSessionManagerCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerCocoa.h; sourceTree = "<group>"; }; >@@ -13191,6 +13191,7 @@ > CD0EEE0B14743E35003EAFA2 /* AudioDestinationIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioDestinationIOS.cpp; sourceTree = "<group>"; }; > CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWindow.h; sourceTree = "<group>"; }; > CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWindow.mm; sourceTree = "<group>"; }; >+ CD17A459213740160079EC7B /* UnifiedSource62-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource62-mm.mm"; sourceTree = "<group>"; }; > CD19A2671A13E700008D650E /* DiagnosticLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagnosticLoggingClient.h; sourceTree = "<group>"; }; > CD19FEA61F573972000C42FB /* ImageDecoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageDecoder.h; sourceTree = "<group>"; }; > CD19FEA71F573972000C42FB /* ImageDecoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoder.cpp; sourceTree = "<group>"; }; >@@ -13255,7 +13256,6 @@ > CD641EB11818F5ED00EE4C41 /* MediaSourcePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSourcePrivate.h; sourceTree = "<group>"; }; > CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivate.h; sourceTree = "<group>"; }; > CD641EC7181ED60100EE4C41 /* MediaSample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaSample.h; sourceTree = "<group>"; }; >- CD669D671D232E10004D1866 /* MediaSessionManagerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerMac.h; sourceTree = "<group>"; }; > CD78A2EC1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CDMInstanceFairPlayStreamingAVFObjC.mm; sourceTree = "<group>"; }; > CD78A2EE1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDMInstanceFairPlayStreamingAVFObjC.h; sourceTree = "<group>"; }; > CD7D33411C7A123F00041293 /* PixelBufferConformerCV.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PixelBufferConformerCV.cpp; sourceTree = "<group>"; }; >@@ -18248,6 +18248,7 @@ > 538EC8791F993F31004D22A8 /* UnifiedSource60.cpp */, > DE5F863A1FA2AF07006DB63B /* UnifiedSource61-mm.mm */, > 538EC87E1F993F33004D22A8 /* UnifiedSource61.cpp */, >+ CD17A459213740160079EC7B /* UnifiedSource62-mm.mm */, > 538EC85A1F993F20004D22A8 /* UnifiedSource62.cpp */, > 538EC8611F993F24004D22A8 /* UnifiedSource63.cpp */, > 538EC8421F993F14004D22A8 /* UnifiedSource64.cpp */, >@@ -24706,7 +24707,7 @@ > CD669D651D232DF4004D1866 /* cocoa */ = { > isa = PBXGroup; > children = ( >- 417F7AEA2139BF6400FBA7EC /* MediaSessionManagerCocoa.cpp */, >+ 417F7AEA2139BF6400FBA7EC /* MediaSessionManagerCocoa.mm */, > 417F7AED2139BF6500FBA7EC /* MediaSessionManagerCocoa.h */, > 417F7AEB2139BF6400FBA7EC /* WebAudioBufferList.cpp */, > 417F7AEC2139BF6500FBA7EC /* WebAudioBufferList.h */, >@@ -26942,8 +26943,6 @@ > CDC734121977896C0046BFC5 /* CARingBuffer.cpp */, > CDC734131977896C0046BFC5 /* CARingBuffer.h */, > FD3160BA12B0272A00C1A359 /* FFTFrameMac.cpp */, >- CD669D671D232E10004D1866 /* MediaSessionManagerMac.h */, >- 07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.mm */, > ); > path = mac; > sourceTree = "<group>"; >@@ -31333,7 +31332,7 @@ > ); > runOnlyForDeploymentPostprocessing = 0; > shellPath = /bin/sh; >- shellScript = "set -e\n\ncd $SRCROOT\n\nif [ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]; then\nBUILD_SCRIPTS_DIR=\"${SDKROOT}${WK_ALTERNATE_WEBKIT_SDK_PATH}/usr/local/include/wtf/Scripts\"\nelse\nBUILD_SCRIPTS_DIR=\"${BUILT_PRODUCTS_DIR}/usr/local/include/wtf/Scripts\"\nfi\n\nUnifiedSourceCppFileCount=530\nUnifiedSourceMmFileCount=61\n\necho \"Using unified source list files: Sources.txt, SourcesCocoa.txt\"\n\n/usr/bin/env ruby \"${BUILD_SCRIPTS_DIR}/generate-unified-source-bundles.rb\" \"--derived-sources-path\" \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\" \"--source-tree-path\" \"${SRCROOT}\" \"--feature-flags\" \"${FEATURE_DEFINES}\" \"--max-cpp-bundle-count\" \"${UnifiedSourceCppFileCount}\" \"--max-obj-c-bundle-count\" \"${UnifiedSourceMmFileCount}\" \"Sources.txt\" \"SourcesCocoa.txt\" > /dev/null\n"; >+ shellScript = "set -e\n\ncd $SRCROOT\n\nif [ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]; then\nBUILD_SCRIPTS_DIR=\"${SDKROOT}${WK_ALTERNATE_WEBKIT_SDK_PATH}/usr/local/include/wtf/Scripts\"\nelse\nBUILD_SCRIPTS_DIR=\"${BUILT_PRODUCTS_DIR}/usr/local/include/wtf/Scripts\"\nfi\n\nUnifiedSourceCppFileCount=530\nUnifiedSourceMmFileCount=62\n\necho \"Using unified source list files: Sources.txt, SourcesCocoa.txt\"\n\n/usr/bin/env ruby \"${BUILD_SCRIPTS_DIR}/generate-unified-source-bundles.rb\" \"--derived-sources-path\" \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\" \"--source-tree-path\" \"${SRCROOT}\" \"--feature-flags\" \"${FEATURE_DEFINES}\" \"--max-cpp-bundle-count\" \"${UnifiedSourceCppFileCount}\" \"--max-obj-c-bundle-count\" \"${UnifiedSourceMmFileCount}\" \"Sources.txt\" \"SourcesCocoa.txt\" > /dev/null\n"; > }; > 5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */ = { > isa = PBXShellScriptBuildPhase; >@@ -31758,6 +31757,7 @@ > DE5F86591FA2AF24006DB63B /* UnifiedSource61-mm.mm in Sources */, > 538EC8AE1F993F9D004D22A8 /* UnifiedSource61.cpp in Sources */, > 538EC8AF1F993F9D004D22A8 /* UnifiedSource62.cpp in Sources */, >+ CD17A45D213740810079EC7B /* UnifiedSource62-mm.mm in Sources */, > 538EC8B01F993F9D004D22A8 /* UnifiedSource63.cpp in Sources */, > 538EC8B11F993F9D004D22A8 /* UnifiedSource64.cpp in Sources */, > 538EC8B21F993F9D004D22A8 /* UnifiedSource65.cpp in Sources */, >diff --git a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp >deleted file mode 100644 >index 03a96bdeaa09549261a41f6fe0359c8cc0f3ec78..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp >+++ /dev/null >@@ -1,101 +0,0 @@ >-/* >- * Copyright (C) 2013-2014 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "MediaSessionManagerCocoa.h" >- >-#if USE(AUDIO_SESSION) >- >-#include "AudioSession.h" >-#include "DeprecatedGlobalSettings.h" >-#include "Logging.h" >-#include <wtf/Function.h> >- >-using namespace WebCore; >- >-static const size_t kWebAudioBufferSize = 128; >-static const size_t kLowPowerVideoBufferSize = 4096; >- >-void MediaSessionManagerCocoa::updateSessionState() >-{ >- LOG(Media, "PlatformMediaSessionManager::scheduleUpdateSessionState() - types: Video(%d), Audio(%d), WebAudio(%d)", count(PlatformMediaSession::Video), count(PlatformMediaSession::Audio), count(PlatformMediaSession::WebAudio)); >- >- if (has(PlatformMediaSession::WebAudio)) >- AudioSession::sharedSession().setPreferredBufferSize(kWebAudioBufferSize); >- // In case of audio capture, we want to grab 20 ms chunks to limit the latency so that it is not noticeable by users >- // while having a large enough buffer so that the audio rendering remains stable, hence a computation based on sample rate. >- else if (has(PlatformMediaSession::MediaStreamCapturingAudio)) >- AudioSession::sharedSession().setPreferredBufferSize(AudioSession::sharedSession().sampleRate() / 50); >- else if ((has(PlatformMediaSession::VideoAudio) || has(PlatformMediaSession::Audio)) && DeprecatedGlobalSettings::lowPowerVideoAudioBufferSizeEnabled()) { >- // FIXME: <http://webkit.org/b/116725> Figure out why enabling the code below >- // causes media LayoutTests to fail on 10.8. >- >- size_t bufferSize; >- if (audioHardwareListener() && audioHardwareListener()->outputDeviceSupportsLowPowerMode()) >- bufferSize = kLowPowerVideoBufferSize; >- else >- bufferSize = kWebAudioBufferSize; >- >- AudioSession::sharedSession().setPreferredBufferSize(bufferSize); >- } >- >- if (!DeprecatedGlobalSettings::shouldManageAudioSessionCategory()) >- return; >- >- bool hasWebAudioType = false; >- bool hasAudibleAudioOrVideoMediaType = false; >- bool hasAudioCapture = anyOfSessions([&hasWebAudioType, &hasAudibleAudioOrVideoMediaType] (PlatformMediaSession& session, size_t) mutable { >- auto type = session.mediaType(); >- if (type == PlatformMediaSession::WebAudio) >- hasWebAudioType = true; >- if ((type == PlatformMediaSession::VideoAudio || type == PlatformMediaSession::Audio) && session.canProduceAudio() && session.hasPlayedSinceLastInterruption()) >- hasAudibleAudioOrVideoMediaType = true; >- if (session.isPlayingToWirelessPlaybackTarget()) >- hasAudibleAudioOrVideoMediaType = true; >- return (type == PlatformMediaSession::MediaStreamCapturingAudio); >- }); >- >- if (hasAudioCapture) >- AudioSession::sharedSession().setCategory(AudioSession::PlayAndRecord); >- else if (hasAudibleAudioOrVideoMediaType) >- AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback); >- else if (hasWebAudioType) >- AudioSession::sharedSession().setCategory(AudioSession::AmbientSound); >- else >- AudioSession::sharedSession().setCategory(AudioSession::None); >-} >- >-void MediaSessionManagerCocoa::beginInterruption(PlatformMediaSession::InterruptionType type) >-{ >- if (type == PlatformMediaSession::InterruptionType::SystemInterruption) { >- forEachSession([] (PlatformMediaSession& session, size_t) { >- session.clearHasPlayedSinceLastInterruption(); >- }); >- } >- >- PlatformMediaSessionManager::beginInterruption(type); >-} >- >-#endif // USE(AUDIO_SESSION) >diff --git a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h >index 41fea1454d7dbd1d535ecd7570cf2b990f030f91..47c1fdfc9f80eb9460f53e11c3b8627c7bd1908c 100644 >--- a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h >+++ b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h >@@ -27,14 +27,49 @@ > > #if PLATFORM(COCOA) > >+#include "GenericTaskQueue.h" > #include "PlatformMediaSessionManager.h" > > namespace WebCore { > > class MediaSessionManagerCocoa : public PlatformMediaSessionManager { > public: >+ virtual ~MediaSessionManagerCocoa() = default; >+ > void updateSessionState() override; > void beginInterruption(PlatformMediaSession::InterruptionType) override; >+ >+ bool hasActiveNowPlayingSession() const final { return m_nowPlayingActive; } >+ String lastUpdatedNowPlayingTitle() const final { return m_lastUpdatedNowPlayingTitle; } >+ double lastUpdatedNowPlayingDuration() const final { return m_lastUpdatedNowPlayingDuration; } >+ double lastUpdatedNowPlayingElapsedTime() const final { return m_lastUpdatedNowPlayingElapsedTime; } >+ uint64_t lastUpdatedNowPlayingInfoUniqueIdentifier() const final { return m_lastUpdatedNowPlayingInfoUniqueIdentifier; } >+ bool registeredAsNowPlayingApplication() const final { return m_registeredAsNowPlayingApplication; } >+ >+protected: >+ void scheduleUpdateNowPlayingInfo() override; >+ void updateNowPlayingInfo(); >+ void removeSession(PlatformMediaSession&) override; >+ >+ bool sessionWillBeginPlayback(PlatformMediaSession&) override; >+ void sessionWillEndPlayback(PlatformMediaSession&) override; >+ void sessionDidEndRemoteScrubbing(const PlatformMediaSession&) override; >+ void clientCharacteristicsChanged(PlatformMediaSession&) override; >+ void sessionCanProduceAudioChanged(PlatformMediaSession&) override; >+ >+ PlatformMediaSession* nowPlayingEligibleSession(); >+ >+private: >+ bool m_nowPlayingActive { false }; >+ bool m_registeredAsNowPlayingApplication { false }; >+ >+ // For testing purposes only. >+ String m_lastUpdatedNowPlayingTitle; >+ double m_lastUpdatedNowPlayingDuration { NAN }; >+ double m_lastUpdatedNowPlayingElapsedTime { NAN }; >+ uint64_t m_lastUpdatedNowPlayingInfoUniqueIdentifier { 0 }; >+ >+ GenericTaskQueue<Timer> m_nowPlayingUpdateTaskQueue; > }; > > } >diff --git a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..cb3dfc77d411f3a83fee32a9942236335b1a88e7 >--- /dev/null >+++ b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm >@@ -0,0 +1,278 @@ >+/* >+ * Copyright (C) 2013-2014 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "MediaSessionManagerCocoa.h" >+ >+#if USE(AUDIO_SESSION) && PLATFORM(COCOA) >+ >+#include "AudioSession.h" >+#include "DeprecatedGlobalSettings.h" >+#include "HTMLMediaElement.h" >+#include "Logging.h" >+#include "MediaPlayer.h" >+#include "PlatformMediaSession.h" >+#include <wtf/BlockObjCExceptions.h> >+#include <wtf/Function.h> >+ >+#include "MediaRemoteSoftLink.h" >+ >+using namespace WebCore; >+ >+static const size_t kWebAudioBufferSize = 128; >+static const size_t kLowPowerVideoBufferSize = 4096; >+ >+#if PLATFORM(MAC) >+static MediaSessionManagerCocoa* platformMediaSessionManager = nullptr; >+ >+PlatformMediaSessionManager& PlatformMediaSessionManager::sharedManager() >+{ >+ if (!platformMediaSessionManager) >+ platformMediaSessionManager = new MediaSessionManagerCocoa; >+ return *platformMediaSessionManager; >+} >+ >+PlatformMediaSessionManager* PlatformMediaSessionManager::sharedManagerIfExists() >+{ >+ return platformMediaSessionManager; >+} >+#endif >+ >+void MediaSessionManagerCocoa::updateSessionState() >+{ >+ LOG(Media, "PlatformMediaSessionManager::scheduleUpdateSessionState() - types: Video(%d), Audio(%d), WebAudio(%d)", count(PlatformMediaSession::Video), count(PlatformMediaSession::Audio), count(PlatformMediaSession::WebAudio)); >+ >+ if (has(PlatformMediaSession::WebAudio)) >+ AudioSession::sharedSession().setPreferredBufferSize(kWebAudioBufferSize); >+ // In case of audio capture, we want to grab 20 ms chunks to limit the latency so that it is not noticeable by users >+ // while having a large enough buffer so that the audio rendering remains stable, hence a computation based on sample rate. >+ else if (has(PlatformMediaSession::MediaStreamCapturingAudio)) >+ AudioSession::sharedSession().setPreferredBufferSize(AudioSession::sharedSession().sampleRate() / 50); >+ else if ((has(PlatformMediaSession::VideoAudio) || has(PlatformMediaSession::Audio)) && DeprecatedGlobalSettings::lowPowerVideoAudioBufferSizeEnabled()) { >+ // FIXME: <http://webkit.org/b/116725> Figure out why enabling the code below >+ // causes media LayoutTests to fail on 10.8. >+ >+ size_t bufferSize; >+ if (audioHardwareListener() && audioHardwareListener()->outputDeviceSupportsLowPowerMode()) >+ bufferSize = kLowPowerVideoBufferSize; >+ else >+ bufferSize = kWebAudioBufferSize; >+ >+ AudioSession::sharedSession().setPreferredBufferSize(bufferSize); >+ } >+ >+ if (!DeprecatedGlobalSettings::shouldManageAudioSessionCategory()) >+ return; >+ >+ bool hasWebAudioType = false; >+ bool hasAudibleAudioOrVideoMediaType = false; >+ bool hasAudioCapture = anyOfSessions([&hasWebAudioType, &hasAudibleAudioOrVideoMediaType] (PlatformMediaSession& session, size_t) mutable { >+ auto type = session.mediaType(); >+ if (type == PlatformMediaSession::WebAudio) >+ hasWebAudioType = true; >+ if ((type == PlatformMediaSession::VideoAudio || type == PlatformMediaSession::Audio) && session.canProduceAudio() && session.hasPlayedSinceLastInterruption()) >+ hasAudibleAudioOrVideoMediaType = true; >+ if (session.isPlayingToWirelessPlaybackTarget()) >+ hasAudibleAudioOrVideoMediaType = true; >+ return (type == PlatformMediaSession::MediaStreamCapturingAudio); >+ }); >+ >+ if (hasAudioCapture) >+ AudioSession::sharedSession().setCategory(AudioSession::PlayAndRecord); >+ else if (hasAudibleAudioOrVideoMediaType) >+ AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback); >+ else if (hasWebAudioType) >+ AudioSession::sharedSession().setCategory(AudioSession::AmbientSound); >+ else >+ AudioSession::sharedSession().setCategory(AudioSession::None); >+} >+ >+void MediaSessionManagerCocoa::beginInterruption(PlatformMediaSession::InterruptionType type) >+{ >+ if (type == PlatformMediaSession::InterruptionType::SystemInterruption) { >+ forEachSession([] (PlatformMediaSession& session, size_t) { >+ session.clearHasPlayedSinceLastInterruption(); >+ }); >+ } >+ >+ PlatformMediaSessionManager::beginInterruption(type); >+} >+ >+void MediaSessionManagerCocoa::scheduleUpdateNowPlayingInfo() >+{ >+ if (!m_nowPlayingUpdateTaskQueue.hasPendingTasks()) >+ m_nowPlayingUpdateTaskQueue.enqueueTask(std::bind(&MediaSessionManagerCocoa::updateNowPlayingInfo, this)); >+} >+ >+bool MediaSessionManagerCocoa::sessionWillBeginPlayback(PlatformMediaSession& session) >+{ >+ if (!PlatformMediaSessionManager::sessionWillBeginPlayback(session)) >+ return false; >+ >+ LOG(Media, "MediaSessionManagerCocoa::sessionWillBeginPlayback"); >+ scheduleUpdateNowPlayingInfo(); >+ return true; >+} >+ >+void MediaSessionManagerCocoa::sessionDidEndRemoteScrubbing(const PlatformMediaSession&) >+{ >+ scheduleUpdateNowPlayingInfo(); >+} >+ >+void MediaSessionManagerCocoa::removeSession(PlatformMediaSession& session) >+{ >+ PlatformMediaSessionManager::removeSession(session); >+ LOG(Media, "MediaSessionManagerCocoa::removeSession"); >+ scheduleUpdateNowPlayingInfo(); >+} >+ >+void MediaSessionManagerCocoa::sessionWillEndPlayback(PlatformMediaSession& session) >+{ >+ PlatformMediaSessionManager::sessionWillEndPlayback(session); >+ LOG(Media, "MediaSessionManagerCocoa::sessionWillEndPlayback"); >+ updateNowPlayingInfo(); >+} >+ >+void MediaSessionManagerCocoa::clientCharacteristicsChanged(PlatformMediaSession&) >+{ >+ LOG(Media, "MediaSessionManagerCocoa::clientCharacteristicsChanged"); >+ scheduleUpdateNowPlayingInfo(); >+} >+ >+void MediaSessionManagerCocoa::sessionCanProduceAudioChanged(PlatformMediaSession& session) >+{ >+ PlatformMediaSessionManager::sessionCanProduceAudioChanged(session); >+ scheduleUpdateNowPlayingInfo(); >+} >+ >+PlatformMediaSession* MediaSessionManagerCocoa::nowPlayingEligibleSession() >+{ >+ if (auto element = HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager(MediaElementSession::PlaybackControlsPurpose::NowPlaying)) >+ return &element->mediaSession(); >+ >+ return nullptr; >+} >+ >+void MediaSessionManagerCocoa::updateNowPlayingInfo() >+{ >+#if USE(MEDIAREMOTE) >+ if (!isMediaRemoteFrameworkAvailable()) >+ return; >+ >+ BEGIN_BLOCK_OBJC_EXCEPTIONS >+ >+ const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession(); >+ >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - currentSession = %p", currentSession); >+ >+ if (!currentSession) { >+ if (canLoad_MediaRemote_MRMediaRemoteSetNowPlayingVisibility()) >+ MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), MRNowPlayingClientVisibilityNeverVisible); >+ >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - clearing now playing info"); >+ >+ MRMediaRemoteSetCanBeNowPlayingApplication(false); >+ m_registeredAsNowPlayingApplication = false; >+ >+ MRMediaRemoteSetNowPlayingInfo(nullptr); >+ m_nowPlayingActive = false; >+ m_lastUpdatedNowPlayingTitle = emptyString(); >+ m_lastUpdatedNowPlayingDuration = NAN; >+ m_lastUpdatedNowPlayingElapsedTime = NAN; >+ m_lastUpdatedNowPlayingInfoUniqueIdentifier = 0; >+ MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), kMRPlaybackStateStopped, dispatch_get_main_queue(), ^(MRMediaRemoteError error) { >+#if LOG_DISABLED >+ UNUSED_PARAM(error); >+#else >+ if (error) >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(stopped) failed with error %ud", error); >+#endif >+ }); >+ >+ return; >+ } >+ >+ if (!m_registeredAsNowPlayingApplication) { >+ m_registeredAsNowPlayingApplication = true; >+ MRMediaRemoteSetCanBeNowPlayingApplication(true); >+ } >+ >+ String title = currentSession->title(); >+ double duration = currentSession->supportsSeeking() ? currentSession->duration() : MediaPlayer::invalidTime(); >+ double rate = currentSession->state() == PlatformMediaSession::Playing ? 1 : 0; >+ auto info = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); >+ >+ if (!title.isEmpty()) { >+ CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoTitle, title.createCFString().get()); >+ m_lastUpdatedNowPlayingTitle = title; >+ } >+ >+ if (std::isfinite(duration) && duration != MediaPlayer::invalidTime()) { >+ auto cfDuration = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &duration)); >+ CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoDuration, cfDuration.get()); >+ m_lastUpdatedNowPlayingDuration = duration; >+ } >+ >+ auto cfRate = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &rate)); >+ CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoPlaybackRate, cfRate.get()); >+ >+ m_lastUpdatedNowPlayingInfoUniqueIdentifier = currentSession->uniqueIdentifier(); >+ auto cfIdentifier = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberLongLongType, &m_lastUpdatedNowPlayingInfoUniqueIdentifier)); >+ CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoUniqueIdentifier, cfIdentifier.get()); >+ >+ double currentTime = currentSession->currentTime(); >+ if (std::isfinite(currentTime) && currentTime != MediaPlayer::invalidTime() && currentSession->supportsSeeking()) { >+ auto cfCurrentTime = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, ¤tTime)); >+ CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoElapsedTime, cfCurrentTime.get()); >+ m_lastUpdatedNowPlayingElapsedTime = currentTime; >+ } >+ >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f", >+ title.utf8().data(), rate, duration, currentTime); >+ >+ String parentApplication = currentSession->sourceApplicationIdentifier(); >+ if (canLoad_MediaRemote_MRMediaRemoteSetParentApplication() && !parentApplication.isEmpty()) >+ MRMediaRemoteSetParentApplication(MRMediaRemoteGetLocalOrigin(), parentApplication.createCFString().get()); >+ >+ m_nowPlayingActive = currentSession->allowsNowPlayingControlsVisibility(); >+ MRPlaybackState playbackState = (currentSession->state() == PlatformMediaSession::Playing) ? kMRPlaybackStatePlaying : kMRPlaybackStatePaused; >+ MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), playbackState, dispatch_get_main_queue(), ^(MRMediaRemoteError error) { >+#if LOG_DISABLED >+ UNUSED_PARAM(error); >+#else >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(playing) failed with error %ud", error); >+#endif >+ }); >+ MRMediaRemoteSetNowPlayingInfo(info.get()); >+ >+ if (canLoad_MediaRemote_MRMediaRemoteSetNowPlayingVisibility()) { >+ MRNowPlayingClientVisibility visibility = currentSession->allowsNowPlayingControlsVisibility() ? MRNowPlayingClientVisibilityAlwaysVisible : MRNowPlayingClientVisibilityNeverVisible; >+ MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), visibility); >+ } >+ END_BLOCK_OBJC_EXCEPTIONS >+#endif // USE(MEDIAREMOTE) >+} >+ >+#endif // USE(AUDIO_SESSION) >diff --git a/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h b/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h >index b9a86084eec2be93196e77d050f5b27d3d860380..65daeedd1f4dfdc6ec9020431ef12263a1f982f2 100644 >--- a/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h >+++ b/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h >@@ -53,34 +53,11 @@ private: > > MediaSessionManageriOS(); > >- void removeSession(PlatformMediaSession&) override; >- >- bool sessionWillBeginPlayback(PlatformMediaSession&) override; >- void sessionWillEndPlayback(PlatformMediaSession&) override; >- void clientCharacteristicsChanged(PlatformMediaSession&) override; >- >- void updateNowPlayingInfo(); >- > void resetRestrictions() override; > > void configureWireLessTargetMonitoring() override; > >- bool hasActiveNowPlayingSession() const final { return m_nowPlayingActive; } >- String lastUpdatedNowPlayingTitle() const final { return m_reportedTitle; } >- double lastUpdatedNowPlayingDuration() const final { return m_reportedDuration; } >- double lastUpdatedNowPlayingElapsedTime() const final { return m_reportedCurrentTime; } >- uint64_t lastUpdatedNowPlayingInfoUniqueIdentifier() const final { return m_lastUpdatedNowPlayingInfoUniqueIdentifier; } >- bool registeredAsNowPlayingApplication() const final { return m_nowPlayingActive; } >- >- PlatformMediaSession* nowPlayingEligibleSession(); >- > RetainPtr<WebMediaSessionHelper> m_objcObserver; >- double m_reportedRate { 0 }; >- double m_reportedDuration { 0 }; >- double m_reportedCurrentTime { 0 }; >- uint64_t m_lastUpdatedNowPlayingInfoUniqueIdentifier { 0 }; >- String m_reportedTitle; >- bool m_nowPlayingActive { false }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm b/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm >index 1cbfc6592d049f72a47ae74bb044dd9a9c4f0a1d..383e241c0a2543629c3e5ab31d3fb752a5d7f8b9 100644 >--- a/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm >+++ b/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm >@@ -43,12 +43,6 @@ > #import <wtf/RetainPtr.h> > #import <wtf/SoftLinking.h> > >-#if HAVE(MEDIA_PLAYER) >-#import <MediaPlayer/MPMediaItem.h> >-#import <MediaPlayer/MPNowPlayingInfoCenter.h> >-#import <pal/spi/ios/MediaPlayerSPI.h> >-#endif >- > SOFT_LINK_FRAMEWORK(AVFoundation) > SOFT_LINK_CLASS(AVFoundation, AVAudioSession) > SOFT_LINK_CONSTANT(AVFoundation, AVAudioSessionInterruptionNotification, NSString *) >@@ -78,22 +72,6 @@ SOFT_LINK_CONSTANT(UIKit, UIApplicationDidEnterBackgroundNotification, NSString > #define UIApplicationDidBecomeActiveNotification getUIApplicationDidBecomeActiveNotification() > #define UIApplicationDidEnterBackgroundNotification getUIApplicationDidEnterBackgroundNotification() > >-#if HAVE(MEDIA_PLAYER) >-SOFT_LINK_FRAMEWORK(MediaPlayer) >-SOFT_LINK_CLASS(MediaPlayer, MPNowPlayingInfoCenter) >-SOFT_LINK_CONSTANT(MediaPlayer, MPMediaItemPropertyTitle, NSString *) >-SOFT_LINK_CONSTANT(MediaPlayer, MPMediaItemPropertyPlaybackDuration, NSString *) >-SOFT_LINK_CONSTANT(MediaPlayer, MPNowPlayingInfoPropertyElapsedPlaybackTime, NSString *) >-SOFT_LINK_CONSTANT(MediaPlayer, MPNowPlayingInfoPropertyPlaybackRate, NSString *) >-SOFT_LINK_CONSTANT(MediaPlayer, kMRMediaRemoteNowPlayingInfoUniqueIdentifier, NSString *) >- >-#define MPMediaItemPropertyTitle getMPMediaItemPropertyTitle() >-#define MPMediaItemPropertyPlaybackDuration getMPMediaItemPropertyPlaybackDuration() >-#define MPNowPlayingInfoPropertyElapsedPlaybackTime getMPNowPlayingInfoPropertyElapsedPlaybackTime() >-#define MPNowPlayingInfoPropertyPlaybackRate getMPNowPlayingInfoPropertyPlaybackRate() >-#define kMRMediaRemoteNowPlayingInfoUniqueIdentifier getkMRMediaRemoteNowPlayingInfoUniqueIdentifier() >-#endif // HAVE(MEDIA_PLAYER) >- > WEBCORE_EXPORT NSString* WebUIApplicationWillResignActiveNotification = @"WebUIApplicationWillResignActiveNotification"; > WEBCORE_EXPORT NSString* WebUIApplicationWillEnterForegroundNotification = @"WebUIApplicationWillEnterForegroundNotification"; > WEBCORE_EXPORT NSString* WebUIApplicationDidBecomeActiveNotification = @"WebUIApplicationDidBecomeActiveNotification"; >@@ -204,104 +182,6 @@ void MediaSessionManageriOS::configureWireLessTargetMonitoring() > #endif > } > >-bool MediaSessionManageriOS::sessionWillBeginPlayback(PlatformMediaSession& session) >-{ >- if (!PlatformMediaSessionManager::sessionWillBeginPlayback(session)) >- return false; >- >- LOG(Media, "MediaSessionManageriOS::sessionWillBeginPlayback"); >- updateNowPlayingInfo(); >- return true; >-} >- >-void MediaSessionManageriOS::removeSession(PlatformMediaSession& session) >-{ >- PlatformMediaSessionManager::removeSession(session); >- LOG(Media, "MediaSessionManageriOS::removeSession"); >- updateNowPlayingInfo(); >-} >- >-void MediaSessionManageriOS::sessionWillEndPlayback(PlatformMediaSession& session) >-{ >- PlatformMediaSessionManager::sessionWillEndPlayback(session); >- LOG(Media, "MediaSessionManageriOS::sessionWillEndPlayback"); >- updateNowPlayingInfo(); >-} >- >-void MediaSessionManageriOS::clientCharacteristicsChanged(PlatformMediaSession&) >-{ >- LOG(Media, "MediaSessionManageriOS::clientCharacteristicsChanged"); >- updateNowPlayingInfo(); >-} >- >-PlatformMediaSession* MediaSessionManageriOS::nowPlayingEligibleSession() >-{ >- return findSession([] (PlatformMediaSession& session, size_t) { >- PlatformMediaSession::MediaType type = session.mediaType(); >- if (type != PlatformMediaSession::VideoAudio && type != PlatformMediaSession::Audio) >- return false; >- >- if (session.characteristics() & PlatformMediaSession::HasAudio) >- return true; >- >- return false; >- }); >-} >- >-void MediaSessionManageriOS::updateNowPlayingInfo() >-{ >-#if HAVE(MEDIA_PLAYER) >- BEGIN_BLOCK_OBJC_EXCEPTIONS >- MPNowPlayingInfoCenter *nowPlaying = (MPNowPlayingInfoCenter *)[getMPNowPlayingInfoCenterClass() defaultCenter]; >- const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession(); >- >- LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - currentSession = %p", currentSession); >- >- if (!currentSession) { >- if (m_nowPlayingActive) { >- LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - clearing now playing info"); >- [nowPlaying setNowPlayingInfo:nil]; >- m_nowPlayingActive = false; >- } >- >- return; >- } >- >- String title = currentSession->title(); >- double duration = currentSession->duration(); >- double rate = currentSession->state() == PlatformMediaSession::Playing ? 1 : 0; >- double currentTime = currentSession->currentTime(); >- if (m_reportedTitle == title && m_reportedRate == rate && m_reportedDuration == duration) { >- LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - nothing new to show"); >- return; >- } >- >- m_reportedRate = rate; >- m_reportedDuration = duration; >- m_reportedTitle = title; >- m_reportedCurrentTime = currentTime; >- m_lastUpdatedNowPlayingInfoUniqueIdentifier = currentSession->uniqueIdentifier(); >- >- auto info = adoptNS([[NSMutableDictionary alloc] init]); >- if (!title.isEmpty()) >- info.get()[MPMediaItemPropertyTitle] = static_cast<NSString *>(title); >- if (std::isfinite(duration) && duration != MediaPlayer::invalidTime()) >- info.get()[MPMediaItemPropertyPlaybackDuration] = @(duration); >- info.get()[MPNowPlayingInfoPropertyPlaybackRate] = @(rate); >- info.get()[kMRMediaRemoteNowPlayingInfoUniqueIdentifier] = @(title.impl() ? title.impl()->hash() : 0); >- >- if (std::isfinite(currentTime) && currentTime != MediaPlayer::invalidTime()) >- info.get()[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @(currentTime); >- >- LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f", >- title.utf8().data(), rate, duration, currentTime); >- >- m_nowPlayingActive = true; >- [nowPlaying setNowPlayingInfo:info.get()]; >- END_BLOCK_OBJC_EXCEPTIONS >-#endif // HAVE(MEDIA_PLAYER) >-} >- > void MediaSessionManageriOS::externalOutputDeviceAvailableDidChange() > { > BEGIN_BLOCK_OBJC_EXCEPTIONS >diff --git a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.h b/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.h >deleted file mode 100644 >index 44cd9c7750c10b33f1fe1aae0ad291698eca4bc9..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.h >+++ /dev/null >@@ -1,79 +0,0 @@ >-/* >- * Copyright (C) 2016-2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if PLATFORM(MAC) >- >-#include "GenericTaskQueue.h" >-#include "MediaSessionManagerCocoa.h" >- >-namespace WebCore { >- >-class MediaSessionManagerMac : public MediaSessionManagerCocoa { >-public: >- virtual ~MediaSessionManagerMac(); >- >- bool hasActiveNowPlayingSession() const final { return m_nowPlayingActive; } >- String lastUpdatedNowPlayingTitle() const final { return m_lastUpdatedNowPlayingTitle; } >- double lastUpdatedNowPlayingDuration() const final { return m_lastUpdatedNowPlayingDuration; } >- double lastUpdatedNowPlayingElapsedTime() const final { return m_lastUpdatedNowPlayingElapsedTime; } >- uint64_t lastUpdatedNowPlayingInfoUniqueIdentifier() const final { return m_lastUpdatedNowPlayingInfoUniqueIdentifier; } >- bool registeredAsNowPlayingApplication() const final { return m_registeredAsNowPlayingApplication; } >- >-private: >- friend class PlatformMediaSessionManager; >- >- MediaSessionManagerMac(); >- >- void scheduleUpdateNowPlayingInfo() override; >- void removeSession(PlatformMediaSession&) override; >- >- bool sessionWillBeginPlayback(PlatformMediaSession&) override; >- void sessionWillEndPlayback(PlatformMediaSession&) override; >- void sessionDidEndRemoteScrubbing(const PlatformMediaSession&) override; >- void clientCharacteristicsChanged(PlatformMediaSession&) override; >- void sessionCanProduceAudioChanged(PlatformMediaSession&) override; >- >- void updateNowPlayingInfo(); >- >- PlatformMediaSession* nowPlayingEligibleSession(); >- >- bool m_nowPlayingActive { false }; >- bool m_isInBackground { false }; >- bool m_registeredAsNowPlayingApplication { false }; >- >- // For testing purposes only. >- String m_lastUpdatedNowPlayingTitle; >- double m_lastUpdatedNowPlayingDuration { NAN }; >- double m_lastUpdatedNowPlayingElapsedTime { NAN }; >- uint64_t m_lastUpdatedNowPlayingInfoUniqueIdentifier { 0 }; >- >- GenericTaskQueue<Timer> m_nowPlayingUpdateTaskQueue; >-}; >- >-} // namespace WebCore >- >-#endif // PLATFORM(MAC) >diff --git a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm b/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm >deleted file mode 100644 >index 19625692fb4fccd46f0b0cc4cf114f2fc63acacd..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm >+++ /dev/null >@@ -1,224 +0,0 @@ >-/* >- * Copyright (C) 2016-2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#import "config.h" >-#import "MediaSessionManagerMac.h" >- >-#if PLATFORM(MAC) >- >-#import "HTMLMediaElement.h" >-#import "Logging.h" >-#import "MediaPlayer.h" >-#import "PlatformMediaSession.h" >-#import <wtf/BlockObjCExceptions.h> >- >-#import "MediaRemoteSoftLink.h" >- >-using namespace WebCore; >- >-namespace WebCore { >- >-static MediaSessionManagerMac* platformMediaSessionManager = nullptr; >- >-PlatformMediaSessionManager& PlatformMediaSessionManager::sharedManager() >-{ >- if (!platformMediaSessionManager) >- platformMediaSessionManager = new MediaSessionManagerMac; >- return *platformMediaSessionManager; >-} >- >-PlatformMediaSessionManager* PlatformMediaSessionManager::sharedManagerIfExists() >-{ >- return platformMediaSessionManager; >-} >- >-MediaSessionManagerMac::MediaSessionManagerMac() >- : MediaSessionManagerCocoa() >-{ >- resetRestrictions(); >-} >- >-MediaSessionManagerMac::~MediaSessionManagerMac() >-{ >-} >- >-void MediaSessionManagerMac::scheduleUpdateNowPlayingInfo() >-{ >- if (!m_nowPlayingUpdateTaskQueue.hasPendingTasks()) >- m_nowPlayingUpdateTaskQueue.enqueueTask(std::bind(&MediaSessionManagerMac::updateNowPlayingInfo, this)); >-} >- >-bool MediaSessionManagerMac::sessionWillBeginPlayback(PlatformMediaSession& session) >-{ >- if (!PlatformMediaSessionManager::sessionWillBeginPlayback(session)) >- return false; >- >- LOG(Media, "MediaSessionManagerMac::sessionWillBeginPlayback"); >- scheduleUpdateNowPlayingInfo(); >- return true; >-} >- >-void MediaSessionManagerMac::sessionDidEndRemoteScrubbing(const PlatformMediaSession&) >-{ >- scheduleUpdateNowPlayingInfo(); >-} >- >-void MediaSessionManagerMac::removeSession(PlatformMediaSession& session) >-{ >- PlatformMediaSessionManager::removeSession(session); >- LOG(Media, "MediaSessionManagerMac::removeSession"); >- scheduleUpdateNowPlayingInfo(); >-} >- >-void MediaSessionManagerMac::sessionWillEndPlayback(PlatformMediaSession& session) >-{ >- PlatformMediaSessionManager::sessionWillEndPlayback(session); >- LOG(Media, "MediaSessionManagerMac::sessionWillEndPlayback"); >- updateNowPlayingInfo(); >-} >- >-void MediaSessionManagerMac::clientCharacteristicsChanged(PlatformMediaSession&) >-{ >- LOG(Media, "MediaSessionManagerMac::clientCharacteristicsChanged"); >- scheduleUpdateNowPlayingInfo(); >-} >- >-void MediaSessionManagerMac::sessionCanProduceAudioChanged(PlatformMediaSession& session) >-{ >- PlatformMediaSessionManager::sessionCanProduceAudioChanged(session); >- scheduleUpdateNowPlayingInfo(); >-} >- >-PlatformMediaSession* MediaSessionManagerMac::nowPlayingEligibleSession() >-{ >- if (auto element = HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager(MediaElementSession::PlaybackControlsPurpose::NowPlaying)) >- return &element->mediaSession(); >- >- return nullptr; >-} >- >-void MediaSessionManagerMac::updateNowPlayingInfo() >-{ >-#if USE(MEDIAREMOTE) >- if (!isMediaRemoteFrameworkAvailable()) >- return; >- >- BEGIN_BLOCK_OBJC_EXCEPTIONS >- >- const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession(); >- >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - currentSession = %p", currentSession); >- >- if (!currentSession) { >- if (canLoad_MediaRemote_MRMediaRemoteSetNowPlayingVisibility()) >- MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), MRNowPlayingClientVisibilityNeverVisible); >- >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - clearing now playing info"); >- >- MRMediaRemoteSetCanBeNowPlayingApplication(false); >- m_registeredAsNowPlayingApplication = false; >- >- MRMediaRemoteSetNowPlayingInfo(nullptr); >- m_nowPlayingActive = false; >- m_lastUpdatedNowPlayingTitle = emptyString(); >- m_lastUpdatedNowPlayingDuration = NAN; >- m_lastUpdatedNowPlayingElapsedTime = NAN; >- m_lastUpdatedNowPlayingInfoUniqueIdentifier = 0; >- MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), kMRPlaybackStateStopped, dispatch_get_main_queue(), ^(MRMediaRemoteError error) { >-#if LOG_DISABLED >- UNUSED_PARAM(error); >-#else >- if (error) >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(stopped) failed with error %ud", error); >-#endif >- }); >- >- return; >- } >- >- if (!m_registeredAsNowPlayingApplication) { >- m_registeredAsNowPlayingApplication = true; >- MRMediaRemoteSetCanBeNowPlayingApplication(true); >- } >- >- String title = currentSession->title(); >- double duration = currentSession->supportsSeeking() ? currentSession->duration() : MediaPlayer::invalidTime(); >- double rate = currentSession->state() == PlatformMediaSession::Playing ? 1 : 0; >- auto info = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); >- >- if (!title.isEmpty()) { >- CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoTitle, title.createCFString().get()); >- m_lastUpdatedNowPlayingTitle = title; >- } >- >- if (std::isfinite(duration) && duration != MediaPlayer::invalidTime()) { >- auto cfDuration = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &duration)); >- CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoDuration, cfDuration.get()); >- m_lastUpdatedNowPlayingDuration = duration; >- } >- >- auto cfRate = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &rate)); >- CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoPlaybackRate, cfRate.get()); >- >- m_lastUpdatedNowPlayingInfoUniqueIdentifier = currentSession->uniqueIdentifier(); >- auto cfIdentifier = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberLongLongType, &m_lastUpdatedNowPlayingInfoUniqueIdentifier)); >- CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoUniqueIdentifier, cfIdentifier.get()); >- >- double currentTime = currentSession->currentTime(); >- if (std::isfinite(currentTime) && currentTime != MediaPlayer::invalidTime() && currentSession->supportsSeeking()) { >- auto cfCurrentTime = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, ¤tTime)); >- CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoElapsedTime, cfCurrentTime.get()); >- m_lastUpdatedNowPlayingElapsedTime = currentTime; >- } >- >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f", >- title.utf8().data(), rate, duration, currentTime); >- >- String parentApplication = currentSession->sourceApplicationIdentifier(); >- if (canLoad_MediaRemote_MRMediaRemoteSetParentApplication() && !parentApplication.isEmpty()) >- MRMediaRemoteSetParentApplication(MRMediaRemoteGetLocalOrigin(), parentApplication.createCFString().get()); >- >- m_nowPlayingActive = currentSession->allowsNowPlayingControlsVisibility(); >- MRPlaybackState playbackState = (currentSession->state() == PlatformMediaSession::Playing) ? kMRPlaybackStatePlaying : kMRPlaybackStatePaused; >- MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), playbackState, dispatch_get_main_queue(), ^(MRMediaRemoteError error) { >-#if LOG_DISABLED >- UNUSED_PARAM(error); >-#else >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(playing) failed with error %ud", error); >-#endif >- }); >- MRMediaRemoteSetNowPlayingInfo(info.get()); >- >- if (canLoad_MediaRemote_MRMediaRemoteSetNowPlayingVisibility()) { >- MRNowPlayingClientVisibility visibility = currentSession->allowsNowPlayingControlsVisibility() ? MRNowPlayingClientVisibilityAlwaysVisible : MRNowPlayingClientVisibilityNeverVisible; >- MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), visibility); >- } >- END_BLOCK_OBJC_EXCEPTIONS >-#endif // USE(MEDIAREMOTE) >-} >- >-} // namespace WebCore >- >-#endif // PLATFORM(MAC) >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/NowPlaying.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/NowPlaying.mm >index 9389476f3ce88e77fff710274bdc596fbb0a4b88..6c4ab23661269f5c1ac10e176c7edc1081a9351b 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/NowPlaying.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/NowPlaying.mm >@@ -25,10 +25,11 @@ > > #include "config.h" > >-#if WK_API_ENABLED && USE(MEDIAREMOTE) && (PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101304)) >+#if WK_API_ENABLED && USE(MEDIAREMOTE) && !PLATFORM(IOS_SIMULATOR) && (PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101304)) > > #import "PlatformUtilities.h" > #import "TestWKWebView.h" >+#import <WebKit/WKWebViewConfigurationPrivate.h> > #import <WebKit/WKWebViewPrivate.h> > #import <pal/spi/mac/MediaRemoteSPI.h> > #import <wtf/Function.h> >@@ -89,6 +90,10 @@ public: > > _configuration = adoptNS([[WKWebViewConfiguration alloc] init]); > [_configuration setMediaTypesRequiringUserActionForPlayback:WKAudiovisualMediaTypeAudio]; >+#if PLATFORM(IOS) >+ [_configuration setAllowsInlineMediaPlayback:YES]; >+ [_configuration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:NO]; >+#endif > > _webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:_configuration.get() addToWindow:YES]); > } >diff --git a/LayoutTests/media/hevc-codec-parameters-expected.txt b/LayoutTests/media/hevc-codec-parameters-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f6def5859a9e4f8fc7d4c8727fb317936ffd1eae >--- /dev/null >+++ b/LayoutTests/media/hevc-codec-parameters-expected.txt >@@ -0,0 +1,9 @@ >+EXPECTED (internals.parseHEVCCodecParameters("bad-parameter") == 'null') OK >+EXPECTED (internals.parseHEVCCodecParameters("hvc1") == 'null') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.1.6.L93") === '{ 0, 1, 6, false, 93 }') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.A4.41.H120") === '{ 1, 4, 65, true, 120 }') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.B1.4.L63") === '{ 2, 1, 4, false, 63 }') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.D1.4.L63") == 'null') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.B1.4.L68000") == 'null') OK >+END OF TEST >+ >diff --git a/LayoutTests/media/hevc-codec-parameters.html b/LayoutTests/media/hevc-codec-parameters.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1ddcd9cf9c711017969ee02070ac08b64772c7e6 >--- /dev/null >+++ b/LayoutTests/media/hevc-codec-parameters.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="video-test.js"></script> >+ <script> >+ function HEVCParameterSetToString(set) { >+ return `{ ${set.generalProfileSpace }, ${set.generalProfileIDC }, ${set.generalProfileCompatibilityFlags }, ${set.generalTierFlag }, ${set.generalLevelIDC } }`; >+ } >+ function isEqualHEVCParameterSet(setA, setB) { >+ return setA.generalProfileSpace === setB.generalProfileSpace >+ && setA.generalProfileIDC === setB.generalProfileIDC >+ && setA.generalProfileCompatibilityFlags === setB.generalProfileCompatibilityFlags >+ && setA.generalTierFlag === setB.generalTierFlag >+ && setA.generalLevelIDC === setB.generalLevelIDC >+ } >+ function makeHEVCParameterSet(generalProfileSpace, generalProfileIDC, generalProfileCompatibilityFlags, generalTierFlag, generalLevelIDC) >+ { >+ return { >+ generalProfileSpace: generalProfileSpace, >+ generalProfileIDC: generalProfileIDC, >+ generalProfileCompatibilityFlags: generalProfileCompatibilityFlags, >+ generalTierFlag: generalTierFlag, >+ generalLevelIDC: generalLevelIDC, >+ }; >+ } >+ function testExpectedHEVCParameterSet(testFuncString, expected) >+ { >+ let observed = eval(testFuncString); >+ let success = isEqualHEVCParameterSet(observed, expected); >+ reportExpected(success, testFuncString, '===', HEVCParameterSetToString(expected), HEVCParameterSetToString(observed)); >+ } >+ window.addEventListener('load', event => { >+ testExpected('internals.parseHEVCCodecParameters("bad-parameter")', null); >+ testExpected('internals.parseHEVCCodecParameters("hvc1")', null); >+ testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.1.6.L93")', makeHEVCParameterSet(0, 1, 6, false, 93)); >+ testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.A4.41.H120")', makeHEVCParameterSet(1, 4, 65, true, 120)); >+ testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.B1.4.L63")', makeHEVCParameterSet(2, 1, 4, false, 63)); >+ testExpected('internals.parseHEVCCodecParameters("hev1.D1.4.L63")', null); >+ testExpected('internals.parseHEVCCodecParameters("hev1.B1.4.L68000")', null); >+ endTest(); >+ }, { once: true }); >+ </script> >+</head> >+<body> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189096
:
348430
|
348444
|
348450
|
348530
|
348553
|
348644
|
348645
|
349316
|
349408
|
349442
|
349446
|
349896
|
349897
|
349898
|
349904
|
349909