[Cocoa] Adopt -preventDisplaySleepForVideoPlayback
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Aug 2019 21:39:32 +0000 (21:39 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Aug 2019 21:39:32 +0000 (21:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200774

Reviewed by Eric Carlson.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248747 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm

index ea9f00d..44de280 100644 (file)
@@ -1,3 +1,13 @@
+2019-08-15  Jer Noble  <jer.noble@apple.com>
+
+        [Cocoa] Adopt -preventDisplaySleepForVideoPlayback
+        https://bugs.webkit.org/show_bug.cgi?id=200774
+
+        Reviewed by Eric Carlson.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
+
 2019-08-15  Robin Morisset  <rmorisset@apple.com>
 
         [WHLSL] Don't accept operator&& or operator|| in the Lexer
index f195156..72d1af1 100644 (file)
 - (instancetype)initWithStorageDirectoryAtURL:(NSURL *)storageDirectory;
 @end
 
+@interface AVSampleBufferDisplayLayer (WebCorePrivate)
+@property (assign, nonatomic) BOOL preventDisplaySleepForVideoPlayback;
+@end
+
 namespace WebCore {
 using namespace PAL;
 
@@ -758,6 +762,9 @@ void MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer()
         return;
     }
 
+    if ([m_sampleBufferDisplayLayer respondsToSelector:@selector(setPreventDisplaySleepForVideoPlayback:)])
+        m_sampleBufferDisplayLayer.get().preventDisplaySleepForVideoPlayback = NO;
+
     [m_synchronizer addRenderer:m_sampleBufferDisplayLayer.get()];
     if (m_mediaSourcePrivate)
         m_mediaSourcePrivate->setVideoLayer(m_sampleBufferDisplayLayer.get());