Diff
Modified: trunk/LayoutTests/ChangeLog (225641 => 225642)
--- trunk/LayoutTests/ChangeLog 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/LayoutTests/ChangeLog 2017-12-07 21:04:21 UTC (rev 225642)
@@ -1,3 +1,15 @@
+2017-12-07 Jer Noble <jer.no...@apple.com>
+
+ [EME] Support the 'encrypted' event for FPS encrypted streams
+ https://bugs.webkit.org/show_bug.cgi?id=180480
+
+ Reviewed by Eric Carlson.
+
+ * platform/mac/TestExpectations:
+ * platform/mac/media/encrypted-media/content/fps-cbcs.mp4: Added.
+ * platform/mac/media/encrypted-media/fps-encrypted-event-expected.txt: Added.
+ * platform/mac/media/encrypted-media/fps-encrypted-event.html: Added.
+
2017-12-07 Myles C. Maxfield <mmaxfi...@apple.com>
[Cocoa] Add SPI to disallow user-installed fonts
Modified: trunk/LayoutTests/platform/mac/TestExpectations (225641 => 225642)
--- trunk/LayoutTests/platform/mac/TestExpectations 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2017-12-07 21:04:21 UTC (rev 225642)
@@ -1747,6 +1747,7 @@
[ ElCapitan Sierra ] platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html [ Skip ]
[ ElCapitan Sierra ] platform/mac/media/encrypted-media/fps-createSession.html [ Skip ]
[ ElCapitan Sierra ] platform/mac/media/encrypted-media/fps-generateRequest.html [ Skip ]
+[ ElCapitan Sierra ] platform/mac/media/encrypted-media/fps-encrypted-event.html [ Skip ]
# rdar://problem/35395437
[ HighSierra+ ] imported/w3c/web-platform-tests/media-source/mediasource-play.html [ Failure ]
Added: trunk/LayoutTests/platform/mac/media/encrypted-media/content/fps-cbcs.mp4 (0 => 225642)
--- trunk/LayoutTests/platform/mac/media/encrypted-media/content/fps-cbcs.mp4 (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/content/fps-cbcs.mp4 2017-12-07 21:04:21 UTC (rev 225642)
@@ -0,0 +1,7 @@
+ ftypmp42mp41mp42isomhlsf*moovlmvhd՝"r՝"r \xC4@+trak\tkhd՝"r՝"r@\xA9mdia mdhd՝"r՝"r\xACD\xC71hdlrsounCore Media AudioPminfsmhd$dinfdrefurl stbl\xC8stsd\xB8enca\xACD3esds\x80\x80\x80"\x80\x80\x80@\xF4\xF4\x80\x80\x80\x80\x80\x80asinffrmamp4aschmcbcs9schi1tenc
\xDC(.>\xFB\x8C(\xF00\xDD*\x8Aj\x8Fsttsstscstszstcoatrak\tkhd՝"r՝"r@@\xF0\xFDmdia mdhd՝"r՝"r \xC4\xC71hdlrv
ideCore Media Video\xA4minfvmhd$dinfdrefurl dstblstsdencv@\xF0HH\xFF\xFFasinffrmaavc1schmcbcs9schi1tenc\xDC(.>\xFB\x8C(\xF00\xDD*\x8Aj\x8F*avcCM@+\xFF'M@+\xA9(>`+A\x80A\xAD\xB0\xAD{\xDF(\xDE \x88colrnclx
+fiel
+chrmsttsstscstszstcoHmvex trex trex
\ No newline at end of file
Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-encrypted-event-expected.txt (0 => 225642)
--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-encrypted-event-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-encrypted-event-expected.txt 2017-12-07 21:04:21 UTC (rev 225642)
@@ -0,0 +1,10 @@
+
+RUN(video.srcObject = mediaSource)
+EVENT(sourceopen)
+RUN(sourceBuffer = mediaSource.addSourceBuffer("video/mp4"))
+RUN(sourceBuffer.appendBuffer(mediaData))
+EVENT(encrypted)
+EXPECTED (event.initData != 'null') OK
+EXPECTED (event.initDataType == 'sinf') OK
+END OF TEST
+
Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-encrypted-event.html (0 => 225642)
--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-encrypted-event.html (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-encrypted-event.html 2017-12-07 21:04:21 UTC (rev 225642)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>fps-encrypted-event</title>
+ <script src=""
+ <script>
+ var mediaData;
+ var mediaSource;
+ var sourceBuffer;
+
+ function startTest() {
+ video = document.querySelector('video');
+ mediaSource = new MediaSource();
+ waitForEvent('sourceopen', sourceOpen, false, false, mediaSource);
+ waitForEventAndFail('error');
+ run('video.srcObject = mediaSource');
+ }
+
+ async function sourceOpen(event) {
+ try {
+ run('sourceBuffer = mediaSource.addSourceBuffer("video/mp4")');
+ var mediaResponse = await fetch('content/fps-cbcs.mp4');
+ mediaData = await mediaResponse.arrayBuffer();
+ waitForEvent('encrypted', encrypted);
+ run('sourceBuffer.appendBuffer(mediaData)');
+ } catch(e) {
+ failTest();
+ }
+ }
+
+ function encrypted(event) {
+ window.event = event;
+ testExpected('event.initData', 'null', '!=');
+ testExpected('event.initDataType', 'sinf');
+ endTest();
+ }
+
+ window.addEventListener('load', startTest);
+ </script>
+</head>
+<body>
+ <video controls></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (225641 => 225642)
--- trunk/Source/WebCore/ChangeLog 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/Source/WebCore/ChangeLog 2017-12-07 21:04:21 UTC (rev 225642)
@@ -1,3 +1,31 @@
+2017-12-07 Jer Noble <jer.no...@apple.com>
+
+ [EME] Support the 'encrypted' event for FPS encrypted streams
+ https://bugs.webkit.org/show_bug.cgi?id=180480
+
+ Reviewed by Eric Carlson.
+
+ Test: platform/mac/media/encrypted-media/fps-encrypted-event.html
+
+ Pass initData and initDataType up to HTMLMediaElement from SourceBufferPrivateAVFObjC.
+
+ Drive-by fix: initialize the initData and initDataType values of MediaEncryptedEvent from
+ values in its initializer struct.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
+ (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
+ * html/MediaEncryptedEvent.cpp:
+ (WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
+ (WebCore::MediaEncryptedEvent::initDataType): Deleted.
+ (WebCore::MediaEncryptedEvent::initData): Deleted.
+ * html/MediaEncryptedEvent.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
+ * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+ (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
+
2017-12-07 Myles C. Maxfield <mmaxfi...@apple.com>
[Cocoa] Add SPI to disallow user-installed fonts
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (225641 => 225642)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-12-07 21:04:21 UTC (rev 225642)
@@ -2584,7 +2584,13 @@
if (!RuntimeEnabledFeatures::sharedFeatures().legacyEncryptedMediaAPIEnabled())
return false;
- if (!hasEventListeners("webkitneedkey")) {
+ if (!hasEventListeners("webkitneedkey")
+#if ENABLE(ENCRYPTED_MEDIA)
+ // Only fire an error if ENCRYPTED_MEDIA is not enabled, to give clients of the
+ // "encrypted" event a chance to handle it without resulting in a synthetic error.
+ && !RuntimeEnabledFeatures::sharedFeatures().encryptedMediaAPIEnabled()
+#endif
+ ) {
m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED);
scheduleEvent(eventNames().errorEvent);
return false;
@@ -2718,6 +2724,9 @@
void HTMLMediaElement::mediaPlayerInitializationDataEncountered(const String& initDataType, RefPtr<ArrayBuffer>&& initData)
{
+ if (!RuntimeEnabledFeatures::sharedFeatures().encryptedMediaAPIEnabled())
+ return;
+
// https://w3c.github.io/encrypted-media/#initdata-encountered
// W3C Editor's Draft 23 June 2017
Modified: trunk/Source/WebCore/html/MediaEncryptedEvent.cpp (225641 => 225642)
--- trunk/Source/WebCore/html/MediaEncryptedEvent.cpp 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/Source/WebCore/html/MediaEncryptedEvent.cpp 2017-12-07 21:04:21 UTC (rev 225642)
@@ -37,6 +37,8 @@
MediaEncryptedEvent::MediaEncryptedEvent(const AtomicString& type, const MediaEncryptedEventInit& initializer, IsTrusted isTrusted)
: Event(type, initializer, isTrusted)
+ , m_initDataType(initializer.initDataType)
+ , m_initData(initializer.initData)
{
}
@@ -47,18 +49,6 @@
return MediaEncryptedEventInterfaceType;
}
-String MediaEncryptedEvent::initDataType()
-{
- notImplemented();
- return emptyString();
-}
-
-ArrayBuffer* MediaEncryptedEvent::initData()
-{
- notImplemented();
- return nullptr;
-}
-
} // namespace WebCore
#endif // ENABLE(ENCRYPTED_MEDIA)
Modified: trunk/Source/WebCore/html/MediaEncryptedEvent.h (225641 => 225642)
--- trunk/Source/WebCore/html/MediaEncryptedEvent.h 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/Source/WebCore/html/MediaEncryptedEvent.h 2017-12-07 21:04:21 UTC (rev 225642)
@@ -50,8 +50,8 @@
virtual ~MediaEncryptedEvent();
- String initDataType();
- JSC::ArrayBuffer* initData();
+ String initDataType() { return m_initDataType; }
+ JSC::ArrayBuffer* initData() { return m_initData.get(); }
private:
MediaEncryptedEvent(const AtomicString&, const MediaEncryptedEventInit&, IsTrusted);
@@ -58,6 +58,9 @@
// Event
EventInterface eventInterface() const override;
+
+ String m_initDataType;
+ RefPtr<JSC::ArrayBuffer> m_initData;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (225641 => 225642)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2017-12-07 21:04:21 UTC (rev 225642)
@@ -126,6 +126,9 @@
CDMSessionMediaSourceAVFObjC* cdmSession() const { return m_session; }
void keyNeeded(Uint8Array*);
#endif
+#if ENABLE(ENCRYPTED_MEDIA)
+ void initializationDataEncountered(const String&, RefPtr<ArrayBuffer>&&);
+#endif
const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const;
bool shouldCheckHardwareSupport() const;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (225641 => 225642)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2017-12-07 21:04:21 UTC (rev 225642)
@@ -957,6 +957,13 @@
}
#endif
+#if ENABLE(ENCRYPTED_MEDIA)
+void MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered(const String& initDataType, RefPtr<ArrayBuffer>&& initData)
+{
+ m_player->initializationDataEncountered(initDataType, WTFMove(initData));
+}
+#endif
+
const Vector<ContentType>& MediaPlayerPrivateMediaSourceAVFObjC::mediaContentTypesRequiringHardwareSupport() const
{
return m_player->mediaContentTypesRequiringHardwareSupport();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (225641 => 225642)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2017-12-07 20:29:03 UTC (rev 225641)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2017-12-07 21:04:21 UTC (rev 225642)
@@ -40,6 +40,7 @@
#import "MediaSampleAVFObjC.h"
#import "MediaSourcePrivateAVFObjC.h"
#import "NotImplemented.h"
+#import "SharedBuffer.h"
#import "SourceBufferPrivateClient.h"
#import "TimeRanges.h"
#import "VideoTrackPrivateMediaSourceAVFObjC.h"
@@ -672,7 +673,16 @@
dispatch_semaphore_signal(m_hasSessionSemaphore.get());
m_hasSessionSemaphore = hasSessionSemaphore;
}
-#else
+#endif
+
+#if ENABLE(ENCRYPTED_MEDIA)
+ if (m_mediaSource) {
+ auto initDataBuffer = SharedBuffer::create(initData);
+ m_mediaSource->player()->initializationDataEncountered("sinf", initDataBuffer->tryCreateArrayBuffer());
+ }
+#endif
+
+#if !ENABLE(ENCRYPTED_MEDIA) && !ENABLE(LEGACY_ENCRYPTED_MEDIA)
UNUSED_PARAM(initData);
UNUSED_PARAM(trackID);
UNUSED_PARAM(hasSessionSemaphore);