WebKit Bugzilla
Attachment 348450 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
0001-Enable-USE_MEDIASOURCE-on-iOS.patch (text/plain), 46.69 KB, created by
Jer Noble
on 2018-08-29 16:51:17 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-08-29 16:51:17 PDT
Size:
46.69 KB
patch
obsolete
>From f22f8cd38655692a18a8671f3eabf5ffeefd55f7 Mon Sep 17 00:00:00 2001 >From: Jer Noble <jer.noble@apple.com> >Date: Wed, 29 Aug 2018 14:05:01 -0700 >Subject: Enable USE_MEDIASOURCE on iOS > https://bugs.webkit.org/show_bug.cgi?id=189096 > >Reviewed by NOBODY (OOPS!). > >Source/WebCore: > >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. > >Source/WTF: > >* wtf/Platform.h: >--- > Source/WTF/ChangeLog | 9 ++ > Source/WTF/wtf/Platform.h | 2 +- > Source/WebCore/ChangeLog | 39 +++++ > Source/WebCore/SourcesCocoa.txt | 3 +- > .../WebCore/WebCore.xcodeproj/project.pbxproj | 14 +- > .../audio/cocoa/MediaSessionManagerCocoa.cpp | 101 ------------- > .../audio/cocoa/MediaSessionManagerCocoa.h | 35 +++++ > .../MediaSessionManagerCocoa.mm} | 136 ++++++++++++------ > .../audio/ios/MediaSessionManagerIOS.h | 25 ---- > .../audio/ios/MediaSessionManagerIOS.mm | 120 ---------------- > .../audio/mac/MediaSessionManagerMac.h | 79 ---------- > 11 files changed, 187 insertions(+), 376 deletions(-) > delete mode 100644 Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp > rename Source/WebCore/platform/audio/{mac/MediaSessionManagerMac.mm => cocoa/MediaSessionManagerCocoa.mm} (56%) > delete mode 100644 Source/WebCore/platform/audio/mac/MediaSessionManagerMac.h > >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 30235ff9c5d..23b755bc831 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,12 @@ >+2018-08-29 Jer Noble <jer.noble@apple.com> >+ >+ Enable USE_MEDIASOURCE on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=189096 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/Platform.h: >+ > 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 0c6efb86298..281bfecce69 100644 >--- a/Source/WTF/wtf/Platform.h >+++ b/Source/WTF/wtf/Platform.h >@@ -1302,7 +1302,7 @@ > #endif > #endif > >-#if PLATFORM(MAC) >+#if PLATFORM(MAC) || PLATFORM(IOS) > #define USE_MEDIAREMOTE 1 > #endif > >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0940467d483..5b59b09b4fa 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,42 @@ >+2018-08-29 Jer Noble <jer.noble@apple.com> >+ >+ Enable USE_MEDIASOURCE on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=189096 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt >index 66f7f16bd64..e1c6811f58e 100644 >--- a/Source/WebCore/SourcesCocoa.txt >+++ b/Source/WebCore/SourcesCocoa.txt >@@ -158,7 +158,7 @@ page/scrolling/mac/ScrollingTreeStickyNode.mm > > platform/audio/AudioSession.cpp > >-platform/audio/cocoa/MediaSessionManagerCocoa.cpp >+platform/audio/cocoa/MediaSessionManagerCocoa.mm > > platform/audio/ios/AudioDestinationIOS.cpp @no-unify > platform/audio/ios/AudioFileReaderIOS.cpp @no-unify >@@ -174,7 +174,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 b9122d60601..6a4b9163199 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -3945,6 +3945,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 */; }; >@@ -5419,7 +5420,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>"; }; >@@ -13101,6 +13101,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>"; }; >@@ -13166,8 +13167,7 @@ > 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>"; }; >- CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaSessionManagerCocoa.cpp; path = cocoa/MediaSessionManagerCocoa.cpp; sourceTree = "<group>"; }; >- CD669D671D232E10004D1866 /* MediaSessionManagerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerMac.h; sourceTree = "<group>"; }; >+ CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MediaSessionManagerCocoa.mm; path = cocoa/MediaSessionManagerCocoa.mm; 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>"; }; >@@ -18118,6 +18118,7 @@ > 538EC8791F993F31004D22A8 /* UnifiedSource60.cpp */, > DE5F863A1FA2AF07006DB63B /* UnifiedSource61-mm.mm */, > 538EC87E1F993F33004D22A8 /* UnifiedSource61.cpp */, >+ CD17A459213740160079EC7B /* UnifiedSource62-mm.mm */, > 538EC85A1F993F20004D22A8 /* UnifiedSource62.cpp */, > 538EC8611F993F24004D22A8 /* UnifiedSource63.cpp */, > 538EC8421F993F14004D22A8 /* UnifiedSource64.cpp */, >@@ -24535,7 +24536,7 @@ > CD669D651D232DF4004D1866 /* cocoa */ = { > isa = PBXGroup; > children = ( >- CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.cpp */, >+ CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.mm */, > CD227E362113AEFA00D285AF /* MediaSessionManagerCocoa.h */, > CDE667A21E4BBF1500E8154A /* WebAudioBufferList.cpp */, > CDE667A31E4BBF1500E8154A /* WebAudioBufferList.h */, >@@ -26777,8 +26778,6 @@ > CDC734121977896C0046BFC5 /* CARingBuffer.cpp */, > CDC734131977896C0046BFC5 /* CARingBuffer.h */, > FD3160BA12B0272A00C1A359 /* FFTFrameMac.cpp */, >- CD669D671D232E10004D1866 /* MediaSessionManagerMac.h */, >- 07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.mm */, > ); > path = mac; > sourceTree = "<group>"; >@@ -31151,7 +31150,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; >@@ -31570,6 +31569,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 03a96bdeaa0..00000000000 >--- 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 41fea1454d7..47c1fdfc9f8 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/mac/MediaSessionManagerMac.mm b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm >similarity index 56% >rename from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm >rename to Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm >index 19625692fb4..cb3dfc77d41 100644 >--- a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm >+++ b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2016-2017 Apple Inc. All rights reserved. >+ * 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 >@@ -23,29 +23,34 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#import "config.h" >-#import "MediaSessionManagerMac.h" >+#include "config.h" >+#include "MediaSessionManagerCocoa.h" > >-#if PLATFORM(MAC) >+#if USE(AUDIO_SESSION) && PLATFORM(COCOA) > >-#import "HTMLMediaElement.h" >-#import "Logging.h" >-#import "MediaPlayer.h" >-#import "PlatformMediaSession.h" >-#import <wtf/BlockObjCExceptions.h> >+#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> > >-#import "MediaRemoteSoftLink.h" >+#include "MediaRemoteSoftLink.h" > > using namespace WebCore; > >-namespace WebCore { >+static const size_t kWebAudioBufferSize = 128; >+static const size_t kLowPowerVideoBufferSize = 4096; > >-static MediaSessionManagerMac* platformMediaSessionManager = nullptr; >+#if PLATFORM(MAC) >+static MediaSessionManagerCocoa* platformMediaSessionManager = nullptr; > > PlatformMediaSessionManager& PlatformMediaSessionManager::sharedManager() > { > if (!platformMediaSessionManager) >- platformMediaSessionManager = new MediaSessionManagerMac; >+ platformMediaSessionManager = new MediaSessionManagerCocoa; > return *platformMediaSessionManager; > } > >@@ -53,65 +58,116 @@ PlatformMediaSessionManager* PlatformMediaSessionManager::sharedManagerIfExists( > { > return platformMediaSessionManager; > } >+#endif > >-MediaSessionManagerMac::MediaSessionManagerMac() >- : MediaSessionManagerCocoa() >+void MediaSessionManagerCocoa::updateSessionState() > { >- resetRestrictions(); >+ 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); > } > >-MediaSessionManagerMac::~MediaSessionManagerMac() >+void MediaSessionManagerCocoa::beginInterruption(PlatformMediaSession::InterruptionType type) > { >+ if (type == PlatformMediaSession::InterruptionType::SystemInterruption) { >+ forEachSession([] (PlatformMediaSession& session, size_t) { >+ session.clearHasPlayedSinceLastInterruption(); >+ }); >+ } >+ >+ PlatformMediaSessionManager::beginInterruption(type); > } > >-void MediaSessionManagerMac::scheduleUpdateNowPlayingInfo() >+void MediaSessionManagerCocoa::scheduleUpdateNowPlayingInfo() > { > if (!m_nowPlayingUpdateTaskQueue.hasPendingTasks()) >- m_nowPlayingUpdateTaskQueue.enqueueTask(std::bind(&MediaSessionManagerMac::updateNowPlayingInfo, this)); >+ m_nowPlayingUpdateTaskQueue.enqueueTask(std::bind(&MediaSessionManagerCocoa::updateNowPlayingInfo, this)); > } > >-bool MediaSessionManagerMac::sessionWillBeginPlayback(PlatformMediaSession& session) >+bool MediaSessionManagerCocoa::sessionWillBeginPlayback(PlatformMediaSession& session) > { > if (!PlatformMediaSessionManager::sessionWillBeginPlayback(session)) > return false; >- >- LOG(Media, "MediaSessionManagerMac::sessionWillBeginPlayback"); >+ >+ LOG(Media, "MediaSessionManagerCocoa::sessionWillBeginPlayback"); > scheduleUpdateNowPlayingInfo(); > return true; > } > >-void MediaSessionManagerMac::sessionDidEndRemoteScrubbing(const PlatformMediaSession&) >+void MediaSessionManagerCocoa::sessionDidEndRemoteScrubbing(const PlatformMediaSession&) > { > scheduleUpdateNowPlayingInfo(); > } > >-void MediaSessionManagerMac::removeSession(PlatformMediaSession& session) >+void MediaSessionManagerCocoa::removeSession(PlatformMediaSession& session) > { > PlatformMediaSessionManager::removeSession(session); >- LOG(Media, "MediaSessionManagerMac::removeSession"); >+ LOG(Media, "MediaSessionManagerCocoa::removeSession"); > scheduleUpdateNowPlayingInfo(); > } > >-void MediaSessionManagerMac::sessionWillEndPlayback(PlatformMediaSession& session) >+void MediaSessionManagerCocoa::sessionWillEndPlayback(PlatformMediaSession& session) > { > PlatformMediaSessionManager::sessionWillEndPlayback(session); >- LOG(Media, "MediaSessionManagerMac::sessionWillEndPlayback"); >+ LOG(Media, "MediaSessionManagerCocoa::sessionWillEndPlayback"); > updateNowPlayingInfo(); > } > >-void MediaSessionManagerMac::clientCharacteristicsChanged(PlatformMediaSession&) >+void MediaSessionManagerCocoa::clientCharacteristicsChanged(PlatformMediaSession&) > { >- LOG(Media, "MediaSessionManagerMac::clientCharacteristicsChanged"); >+ LOG(Media, "MediaSessionManagerCocoa::clientCharacteristicsChanged"); > scheduleUpdateNowPlayingInfo(); > } >- >-void MediaSessionManagerMac::sessionCanProduceAudioChanged(PlatformMediaSession& session) >+ >+void MediaSessionManagerCocoa::sessionCanProduceAudioChanged(PlatformMediaSession& session) > { > PlatformMediaSessionManager::sessionCanProduceAudioChanged(session); > scheduleUpdateNowPlayingInfo(); > } > >-PlatformMediaSession* MediaSessionManagerMac::nowPlayingEligibleSession() >+PlatformMediaSession* MediaSessionManagerCocoa::nowPlayingEligibleSession() > { > if (auto element = HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager(MediaElementSession::PlaybackControlsPurpose::NowPlaying)) > return &element->mediaSession(); >@@ -119,7 +175,7 @@ PlatformMediaSession* MediaSessionManagerMac::nowPlayingEligibleSession() > return nullptr; > } > >-void MediaSessionManagerMac::updateNowPlayingInfo() >+void MediaSessionManagerCocoa::updateNowPlayingInfo() > { > #if USE(MEDIAREMOTE) > if (!isMediaRemoteFrameworkAvailable()) >@@ -129,13 +185,13 @@ void MediaSessionManagerMac::updateNowPlayingInfo() > > const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession(); > >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - currentSession = %p", currentSession); >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - currentSession = %p", currentSession); > > if (!currentSession) { > if (canLoad_MediaRemote_MRMediaRemoteSetNowPlayingVisibility()) > MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), MRNowPlayingClientVisibilityNeverVisible); > >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - clearing now playing info"); >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - clearing now playing info"); > > MRMediaRemoteSetCanBeNowPlayingApplication(false); > m_registeredAsNowPlayingApplication = false; >@@ -151,7 +207,7 @@ void MediaSessionManagerMac::updateNowPlayingInfo() > UNUSED_PARAM(error); > #else > if (error) >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(stopped) failed with error %ud", error); >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(stopped) failed with error %ud", error); > #endif > }); > >@@ -193,7 +249,7 @@ void MediaSessionManagerMac::updateNowPlayingInfo() > m_lastUpdatedNowPlayingElapsedTime = currentTime; > } > >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f", >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f", > title.utf8().data(), rate, duration, currentTime); > > String parentApplication = currentSession->sourceApplicationIdentifier(); >@@ -206,7 +262,7 @@ void MediaSessionManagerMac::updateNowPlayingInfo() > #if LOG_DISABLED > UNUSED_PARAM(error); > #else >- LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(playing) failed with error %ud", error); >+ LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(playing) failed with error %ud", error); > #endif > }); > MRMediaRemoteSetNowPlayingInfo(info.get()); >@@ -219,6 +275,4 @@ void MediaSessionManagerMac::updateNowPlayingInfo() > #endif // USE(MEDIAREMOTE) > } > >-} // namespace WebCore >- >-#endif // PLATFORM(MAC) >+#endif // USE(AUDIO_SESSION) >diff --git a/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h b/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h >index b9a86084eec..4ec08f14f38 100644 >--- a/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h >+++ b/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h >@@ -53,34 +53,9 @@ 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 1cbfc6592d0..383e241c0a2 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 44cd9c7750c..00000000000 >--- 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)
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