Diff
Modified: trunk/Source/WTF/ChangeLog (229789 => 229790)
--- trunk/Source/WTF/ChangeLog 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WTF/ChangeLog 2018-03-21 06:26:49 UTC (rev 229790)
@@ -1,3 +1,13 @@
+2018-03-20 Tim Horton <[email protected]>
+
+ Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
+ https://bugs.webkit.org/show_bug.cgi?id=183803
+ <rdar://problem/38690487>
+
+ Reviewed by Sam Weinig.
+
+ * wtf/Platform.h:
+
2018-03-20 Brian Burg <[email protected]>
SLEEP_THREAD_FOR_DEBUGGER should not use fancy number literals
Modified: trunk/Source/WTF/wtf/Platform.h (229789 => 229790)
--- trunk/Source/WTF/wtf/Platform.h 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WTF/wtf/Platform.h 2018-03-21 06:26:49 UTC (rev 229790)
@@ -1124,9 +1124,14 @@
#if PLATFORM(IOS) || PLATFORM(MAC)
#define USE_COREMEDIA 1
+#define USE_VIDEOTOOLBOX 1
+
+#if !ENABLE(MINIMAL_SIMULATOR)
#define HAVE_AVFOUNDATION_VIDEO_OUTPUT 1
-#define USE_VIDEOTOOLBOX 1
+#define HAVE_CORE_VIDEO 1
+#define HAVE_MEDIA_PLAYER 1
#endif
+#endif
#if PLATFORM(IOS) || PLATFORM(MAC) || (OS(WINDOWS) && USE(CG))
#define HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP 1
Modified: trunk/Source/WebCore/ChangeLog (229789 => 229790)
--- trunk/Source/WebCore/ChangeLog 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/ChangeLog 2018-03-21 06:26:49 UTC (rev 229790)
@@ -1,5 +1,36 @@
2018-03-20 Tim Horton <[email protected]>
+ Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
+ https://bugs.webkit.org/show_bug.cgi?id=183803
+ <rdar://problem/38690487>
+
+ Reviewed by Sam Weinig.
+
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
+ (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
+ (-[WebMediaSessionHelper initWithCallback:]):
+ (-[WebMediaSessionHelper dealloc]):
+ (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
+ * platform/cocoa/CoreVideoSoftLink.cpp:
+ * platform/cocoa/CoreVideoSoftLink.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
+ * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
+ (WebCore::MediaSampleAVFObjC::getRGBAImageData const):
+ * platform/graphics/cv/PixelBufferConformerCV.cpp:
+ * platform/graphics/cv/PixelBufferConformerCV.h:
+ * platform/graphics/cv/TextureCacheCV.h:
+ * platform/graphics/cv/TextureCacheCV.mm:
+ * platform/graphics/cv/VideoTextureCopierCV.cpp:
+ * platform/graphics/cv/VideoTextureCopierCV.h:
+ Make it possible to disable our dependency on MediaPlayer and CoreVideo.
+
+2018-03-20 Tim Horton <[email protected]>
+
Enable the minimal simulator feature flag when appropriate
https://bugs.webkit.org/show_bug.cgi?id=183807
Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (229789 => 229790)
--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2018-03-21 06:26:49 UTC (rev 229790)
@@ -34,12 +34,8 @@
#import "SystemMemory.h"
#import "WebCoreThreadRun.h"
#import <AVFoundation/AVAudioSession.h>
-#import <MediaPlayer/MPMediaItem.h>
-#import <MediaPlayer/MPNowPlayingInfoCenter.h>
-#import <MediaPlayer/MPVolumeView.h>
#import <UIKit/UIApplication.h>
#import <objc/runtime.h>
-#import <pal/spi/ios/MediaPlayerSPI.h>
#import <wtf/BlockObjCExceptions.h>
#import <wtf/MainThread.h>
#import <wtf/RAMSize.h>
@@ -46,6 +42,13 @@
#import <wtf/RetainPtr.h>
#import <wtf/SoftLinking.h>
+#if HAVE(MEDIA_PLAYER)
+#import <MediaPlayer/MPMediaItem.h>
+#import <MediaPlayer/MPNowPlayingInfoCenter.h>
+#import <MediaPlayer/MPVolumeView.h>
+#import <pal/spi/ios/MediaPlayerSPI.h>
+#endif
+
SOFT_LINK_FRAMEWORK(AVFoundation)
SOFT_LINK_CLASS(AVFoundation, AVAudioSession)
SOFT_LINK_POINTER(AVFoundation, AVAudioSessionInterruptionNotification, NSString *)
@@ -70,6 +73,7 @@
#define UIApplicationDidBecomeActiveNotification getUIApplicationDidBecomeActiveNotification()
#define UIApplicationDidEnterBackgroundNotification getUIApplicationDidEnterBackgroundNotification()
+#if HAVE(MEDIA_PLAYER)
SOFT_LINK_FRAMEWORK(MediaPlayer)
SOFT_LINK_CLASS(MediaPlayer, MPAVRoutingController)
SOFT_LINK_CLASS(MediaPlayer, MPNowPlayingInfoCenter)
@@ -87,6 +91,7 @@
#define MPNowPlayingInfoPropertyPlaybackRate getMPNowPlayingInfoPropertyPlaybackRate()
#define MPVolumeViewWirelessRoutesAvailableDidChangeNotification getMPVolumeViewWirelessRoutesAvailableDidChangeNotification()
#define kMRMediaRemoteNowPlayingInfoUniqueIdentifier getkMRMediaRemoteNowPlayingInfoUniqueIdentifier()
+#endif // HAVE(MEDIA_PLAYER)
WEBCORE_EXPORT NSString* WebUIApplicationWillResignActiveNotification = @"WebUIApplicationWillResignActiveNotification";
WEBCORE_EXPORT NSString* WebUIApplicationWillEnterForegroundNotification = @"WebUIApplicationWillEnterForegroundNotification";
@@ -97,13 +102,20 @@
@interface WebMediaSessionHelper : NSObject {
MediaSessionManageriOS* _callback;
+
+#if HAVE(MEDIA_PLAYER)
RetainPtr<MPVolumeView> _volumeView;
RetainPtr<MPAVRoutingController> _airPlayPresenceRoutingController;
+#endif
}
- (id)initWithCallback:(MediaSessionManageriOS*)callback;
+
+#if HAVE(MEDIA_PLAYER)
- (void)allocateVolumeView;
- (void)setVolumeView:(RetainPtr<MPVolumeView>)volumeView;
+#endif
+
- (void)clearCallback;
- (void)interruption:(NSNotification *)notification;
- (void)applicationWillEnterForeground:(NSNotification *)notification;
@@ -110,8 +122,12 @@
- (void)applicationWillResignActive:(NSNotification *)notification;
- (void)applicationDidEnterBackground:(NSNotification *)notification;
- (BOOL)hasWirelessTargetsAvailable;
+
+#if HAVE(MEDIA_PLAYER)
- (void)startMonitoringAirPlayRoutes;
- (void)stopMonitoringAirPlayRoutes;
+#endif
+
@end
namespace WebCore {
@@ -173,6 +189,7 @@
void MediaSessionManageriOS::configureWireLessTargetMonitoring()
{
+#if HAVE(MEDIA_PLAYER)
bool requiresMonitoring = anyOfSessions([] (PlatformMediaSession& session, size_t) {
return session.requiresPlaybackTargetRouteMonitoring();
});
@@ -187,6 +204,7 @@
[m_objcObserver stopMonitoringAirPlayRoutes];
END_BLOCK_OBJC_EXCEPTIONS
+#endif
}
bool MediaSessionManageriOS::sessionWillBeginPlayback(PlatformMediaSession& session)
@@ -235,6 +253,7 @@
void MediaSessionManageriOS::updateNowPlayingInfo()
{
+#if HAVE(MEDIA_PLAYER)
BEGIN_BLOCK_OBJC_EXCEPTIONS
MPNowPlayingInfoCenter *nowPlaying = (MPNowPlayingInfoCenter *)[getMPNowPlayingInfoCenterClass() defaultCenter];
const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession();
@@ -282,6 +301,7 @@
m_nowPlayingActive = true;
[nowPlaying setNowPlayingInfo:info.get()];
END_BLOCK_OBJC_EXCEPTIONS
+#endif // HAVE(MEDIA_PLAYER)
}
bool MediaSessionManageriOS::sessionCanLoadMedia(const PlatformMediaSession& session) const
@@ -305,6 +325,7 @@
@implementation WebMediaSessionHelper
+#if HAVE(MEDIA_PLAYER)
- (void)allocateVolumeView
{
if (pthread_main_np()) {
@@ -335,6 +356,7 @@
if (_volumeView)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wirelessRoutesAvailableDidChange:) name:MPVolumeViewWirelessRoutesAvailableDidChangeNotification object:_volumeView.get()];
}
+#endif
- (id)initWithCallback:(MediaSessionManageriOS*)callback
{
@@ -357,7 +379,9 @@
[center addObserver:self selector:@selector(applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];
[center addObserver:self selector:@selector(applicationDidEnterBackground:) name:WebUIApplicationDidEnterBackgroundNotification object:nil];
+#if HAVE(MEDIA_PLAYER)
[self allocateVolumeView];
+#endif
// Now playing won't work unless we turn on the delivery of remote control events.
dispatch_async(dispatch_get_main_queue(), ^ {
@@ -373,6 +397,7 @@
{
LOG(Media, "-[WebMediaSessionHelper dealloc]");
+#if HAVE(MEDIA_PLAYER)
if (!isMainThread()) {
callOnMainThread([volumeView = WTFMove(_volumeView), routingController = WTFMove(_airPlayPresenceRoutingController)] () mutable {
LOG(Media, "-[WebMediaSessionHelper dealloc] - dipatched to MainThread");
@@ -386,6 +411,7 @@
routingController.clear();
});
}
+#endif
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
@@ -400,9 +426,14 @@
- (BOOL)hasWirelessTargetsAvailable
{
LOG(Media, "-[WebMediaSessionHelper hasWirelessTargetsAvailable]");
+#if HAVE(MEDIA_PLAYER)
return _volumeView ? [_volumeView areWirelessRoutesAvailable] : NO;
+#else
+ return NO;
+#endif
}
+#if HAVE(MEDIA_PLAYER)
- (void)startMonitoringAirPlayRoutes
{
if (_airPlayPresenceRoutingController)
@@ -438,6 +469,7 @@
protectedSelf->_airPlayPresenceRoutingController = nil;
});
}
+#endif // HAVE(MEDIA_PLAYER)
- (void)interruption:(NSNotification *)notification
{
Modified: trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp (229789 => 229790)
--- trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp 2018-03-21 06:26:49 UTC (rev 229790)
@@ -25,6 +25,8 @@
#include "config.h"
+#if HAVE(CORE_VIDEO)
+
#include <CoreVideo/CoreVideo.h>
#include <wtf/SoftLinking.h>
@@ -89,3 +91,4 @@
SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVPixelBufferOpenGLCompatibilityKey, CFStringRef)
#endif
+#endif // HAVE(CORE_VIDEO)
Modified: trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h (229789 => 229790)
--- trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h 2018-03-21 06:26:49 UTC (rev 229790)
@@ -23,9 +23,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CoreVideoSoftLink_h
-#define CoreVideoSoftLink_h
+#pragma once
+#if HAVE(CORE_VIDEO)
+
#include <CoreVideo/CoreVideo.h>
#include <wtf/SoftLinking.h>
@@ -142,4 +143,4 @@
#define kCVPixelBufferOpenGLCompatibilityKey get_CoreVideo_kCVPixelBufferOpenGLCompatibilityKey()
#endif
-#endif // CoreVideoSoftLink_h
+#endif // HAVE(CORE_VIDEO)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2018-03-21 06:26:49 UTC (rev 229790)
@@ -368,7 +368,9 @@
std::unique_ptr<VideoTextureCopierCV> m_videoTextureCopier;
#endif
+#if HAVE(CORE_VIDEO)
std::unique_ptr<PixelBufferConformerCV> m_pixelBufferConformer;
+#endif
#if HAVE(AVFOUNDATION_LOADER_DELEGATE)
friend class WebCoreAVFResourceLoader;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2018-03-21 06:26:49 UTC (rev 229790)
@@ -681,7 +681,7 @@
if (!m_videoLayer)
createAVPlayerLayer();
-#if USE(VIDEOTOOLBOX)
+#if USE(VIDEOTOOLBOX) && HAVE(AVFOUNDATION_VIDEO_OUTPUT)
if (!m_videoOutput)
createVideoOutput();
#endif
@@ -756,8 +756,10 @@
if (currentRenderingMode() == MediaRenderingToLayer)
return m_cachedIsReadyForDisplay;
+#if HAVE(AVFOUNDATION_VIDEO_OUTPUT)
if (m_videoOutput && (m_lastPixelBuffer || [m_videoOutput hasNewPixelBufferForItemTime:[m_avPlayerItem currentTime]]))
return true;
+#endif
return m_videoFrameHasDrawn;
}
@@ -2338,6 +2340,7 @@
void MediaPlayerPrivateAVFoundationObjC::updateLastImage()
{
+#if HAVE(CORE_VIDEO)
// Calls to copyPixelBufferForItemTime:itemTimeForDisplay: may return nil if the pixel buffer
// for the requested time has already been retrieved. In this case, the last valid image (if any)
// should be displayed.
@@ -2362,6 +2365,7 @@
#if !RELEASE_LOG_DISABLED
DEBUG_LOG(LOGIDENTIFIER, "creating buffer took ", (MonotonicTime::now() - start).seconds());
#endif
+#endif // HAVE(CORE_VIDEO)
}
void MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput(GraphicsContext& context, const FloatRect& outputRect)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm 2018-03-21 06:26:49 UTC (rev 229790)
@@ -279,6 +279,7 @@
RefPtr<JSC::Uint8ClampedArray> MediaSampleAVFObjC::getRGBAImageData() const
{
+#if HAVE(CORE_VIDEO)
const OSType imageFormat = kCVPixelFormatType_32RGBA;
RetainPtr<CFNumberRef> imageFormatNumber = adoptCF(CFNumberCreate(nullptr, kCFNumberIntType, &imageFormat));
@@ -299,6 +300,9 @@
ASSERT(status == noErr);
return result;
+#else
+ return nullptr;
+#endif
}
}
Modified: trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp 2018-03-21 06:26:49 UTC (rev 229790)
@@ -26,6 +26,8 @@
#include "config.h"
#include "PixelBufferConformerCV.h"
+#if HAVE(CORE_VIDEO)
+
#include "GraphicsContextCG.h"
#include <wtf/SoftLinking.h>
@@ -118,3 +120,5 @@
}
}
+
+#endif // HAVE(CORE_VIDEO)
Modified: trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.h (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.h 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.h 2018-03-21 06:26:49 UTC (rev 229790)
@@ -23,9 +23,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PixelBufferConformerCV_h
-#define PixelBufferConformerCV_h
+#pragma once
+#if HAVE(CORE_VIDEO)
+
#include <wtf/RetainPtr.h>
typedef struct OpaqueVTPixelBufferConformer* VTPixelBufferConformerRef;
@@ -48,4 +49,4 @@
}
-#endif // PixelBufferConformerCV_h
+#endif // HAVE(CORE_VIDEO)
Modified: trunk/Source/WebCore/platform/graphics/cv/TextureCacheCV.h (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/cv/TextureCacheCV.h 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/cv/TextureCacheCV.h 2018-03-21 06:26:49 UTC (rev 229790)
@@ -23,9 +23,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TextureCacheCV_h
-#define TextureCacheCV_h
+#pragma once
+#if HAVE(CORE_VIDEO)
+
#include "GraphicsTypes3D.h"
#include <wtf/Ref.h>
#include <wtf/RetainPtr.h>
@@ -67,4 +68,4 @@
}
-#endif // TextureCacheCV_h
+#endif // HAVE(CORE_VIDEO)
Modified: trunk/Source/WebCore/platform/graphics/cv/TextureCacheCV.mm (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/cv/TextureCacheCV.mm 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/cv/TextureCacheCV.mm 2018-03-21 06:26:49 UTC (rev 229790)
@@ -26,6 +26,8 @@
#include "config.h"
#include "TextureCacheCV.h"
+#if HAVE(CORE_VIDEO)
+
#include "GraphicsContext3D.h"
#include "CoreVideoSoftLink.h"
@@ -89,3 +91,5 @@
}
}
+
+#endif // HAVE(CORE_VIDEO)
Modified: trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp 2018-03-21 06:26:49 UTC (rev 229790)
@@ -26,6 +26,8 @@
#include "config.h"
#include "VideoTextureCopierCV.h"
+#if HAVE(CORE_VIDEO)
+
#include "FourCC.h"
#include "Logging.h"
#include "TextureCacheCV.h"
@@ -945,3 +947,5 @@
}
}
+
+#endif // HAVE(CORE_VIDEO)
Modified: trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h (229789 => 229790)
--- trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h 2018-03-21 06:26:26 UTC (rev 229789)
+++ trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h 2018-03-21 06:26:49 UTC (rev 229790)
@@ -23,9 +23,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef VideoTextureCopierCV_h
-#define VideoTextureCopierCV_h
+#pragma once
+#if HAVE(CORE_VIDEO)
+
#import "GraphicsContext3D.h"
#import <wtf/UnsafePointer.h>
@@ -102,4 +103,4 @@
}
-#endif // VideoTextureCopierCV_h
+#endif // HAVE(CORE_VIDEO)