[Win] Enable Encrypted Media Support
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Oct 2014 20:09:09 +0000 (20:09 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Oct 2014 20:09:09 +0000 (20:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137710
<rdar://problem/18652699>

Reviewed by Jer Noble.

Source/WebCore:

This feature is covered by existing media tests.

* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::destroyAVFWrapper): Remove redundant ASSERT.
* platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
(displayOnMainThreadContext::displayOnMainThreadContext): Added.
(redispatchOnMainQueue): Added.
(PlatformCALayerWinInternal::displayCallback): Check if a display
call is happening on a background queue, and re-dispatch on the
main thread if necessary.

WebKitLibraries:

* win/tools/vsprops/FeatureDefines.props: Activate the
ENCRYPTED_MEDIA_V2 flag on Windows.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
WebKitLibraries/ChangeLog
WebKitLibraries/win/tools/vsprops/FeatureDefines.props

index 6c443b2..5647e21 100644 (file)
@@ -1,3 +1,22 @@
+2014-10-14  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Enable Encrypted Media Support
+        https://bugs.webkit.org/show_bug.cgi?id=137710
+        <rdar://problem/18652699>
+
+        Reviewed by Jer Noble.
+
+        This feature is covered by existing media tests.
+
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::destroyAVFWrapper): Remove redundant ASSERT.
+        * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
+        (displayOnMainThreadContext::displayOnMainThreadContext): Added.
+        (redispatchOnMainQueue): Added.
+        (PlatformCALayerWinInternal::displayCallback): Check if a display
+        call is happening on a background queue, and re-dispatch on the
+        main thread if necessary.
+
 2014-10-14  Chris Dumez  <cdumez@apple.com>
 
         [Mac] Avoid unnecessary dictionary lookup in ImageSource::isSizeAvailable()
index b182a0f..3a1ae6b 100644 (file)
@@ -1408,7 +1408,6 @@ void AVFWrapper::scheduleDisconnectAndDelete()
 static void destroyAVFWrapper(void* context)
 {
     ASSERT(isMainThread());
-    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     AVFWrapper* avfWrapper = static_cast<AVFWrapper*>(context);
     if (!avfWrapper)
         return;
index eb915df..572751a 100644 (file)
@@ -69,9 +69,35 @@ PlatformCALayerWinInternal::~PlatformCALayerWinInternal()
 {
 }
 
-void PlatformCALayerWinInternal::displayCallback(CACFLayerRef caLayer, CGContextRef context)
+struct DisplayOnMainThreadContext {
+    RetainPtr<CACFLayerRef> layer;
+    RetainPtr<CGContextRef> context;
+
+    DisplayOnMainThreadContext(CACFLayerRef caLayer, CGContextRef caContext)
+        : layer(caLayer)
+        , context(caContext)
+    {
+    }
+};
+
+static void redispatchOnMainQueue(void* context)
 {
     ASSERT(isMainThread());
+    std::unique_ptr<DisplayOnMainThreadContext> retainedContext(reinterpret_cast<DisplayOnMainThreadContext*>(context));
+    if (!retainedContext)
+        return;
+
+    PlatformCALayerWinInternal* self = static_cast<PlatformCALayerWinInternal*>(CACFLayerGetUserData(retainedContext->layer.get()));
+
+    self->displayCallback(retainedContext->layer.get(), retainedContext->context.get());
+}
+
+void PlatformCALayerWinInternal::displayCallback(CACFLayerRef caLayer, CGContextRef context)
+{
+    if (!isMainThread()) {
+        dispatch_async_f(dispatch_get_main_queue(), new DisplayOnMainThreadContext(caLayer, context), redispatchOnMainQueue);
+        return;
+    }
     
     if (!owner() || !owner()->owner())
         return;
index 3591e1b..53f54a9 100644 (file)
@@ -1,3 +1,14 @@
+2014-10-14  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Enable Encrypted Media Support
+        https://bugs.webkit.org/show_bug.cgi?id=137710
+        <rdar://problem/18652699>
+
+        Reviewed by Jer Noble.
+
+        * win/tools/vsprops/FeatureDefines.props: Activate the
+        ENCRYPTED_MEDIA_V2 flag on Windows.
+
 2014-10-01  Mark Rowe  <mrowe@apple.com>
 
         <https://webkit.org/b/137308> WebKit should build on OS X Yosemite for external users
index 1b35a53..822533f 100644 (file)
@@ -27,6 +27,7 @@
     <ENABLE_DETAILS_ELEMENT>ENABLE_DETAILS_ELEMENT</ENABLE_DETAILS_ELEMENT>
     <ENABLE_DEVICE_ORIENTATION />
     <ENABLE_DIRECTORY_UPLOAD />
+    <ENABLE_ENCRYPTED_MEDIA_V2>ENABLE_ENCRYPTED_MEDIA_V2</ENABLE_ENCRYPTED_MEDIA_V2>
     <ENABLE_FILE_SYSTEM />
     <ENABLE_FULLSCREEN_API>ENABLE_FULLSCREEN_API</ENABLE_FULLSCREEN_API>
     <ENABLE_GAMEPAD />
@@ -87,7 +88,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-<PreprocessorDefinitions>$(ENABLE_CSP_NEXT);$(ENABLE_PROMISES);$(ENABLE_REQUEST_ANIMATION_FRAME);$(ENABLE_3D_RENDERING);$(ENABLE_ACCELERATED_2D_CANVAS);$(ENABLE_ACCELERATED_OVERFLOW_SCROLLING);$(ENABLE_CANVAS_PATH);$(ENABLE_CANVAS_PROXY);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CSS3_CONDITIONAL_RULES);$(ENABLE_CSS_IMAGE_SET);$(ENABLE_CSS3_TEXT);$(ENABLE_CSS_BOX_DECORATION_BREAK);$(ENABLE_CSS_GRID_LAYOUT);$(ENABLE_CSS_SHADERS);$(ENABLE_CSS_COMPOSITING);$(ENABLE_CSS_REGIONS);$(ENABLE_CSS_SELECTORS_LEVEL4);$(ENABLE_CSS_SHAPES);$(ENABLE_CSS_SHAPE_INSIDE);$(ENABLE_CSS_TRANSFORMS_ANIMATIONS_TRANSITIONS_UNPREFIXED);$(ENABLE_CUSTOM_SCHEME_HANDLER);$(ENABLE_DATAGRID);$(ENABLE_DATALIST_ELEMENT);$(ENABLE_DATA_TRANSFER_ITEMS);$(ENABLE_DETAILS_ELEMENT);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DIRECTORY_UPLOAD);$(ENABLE_FILE_SYSTEM);$(ENABLE_FULLSCREEN_API);$(ENABLE_GAMEPAD);$(ENABLE_GEOLOCATION);$(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING);$(ENABLE_HIGH_DPI_CANVAS);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_INPUT_TYPE_COLOR);$(ENABLE_INPUT_SPEECH);$(ENABLE_INPUT_TYPE_DATE);$(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE);$(ENABLE_INPUT_TYPE_DATETIMELOCAL);$(ENABLE_INPUT_TYPE_MONTH);$(ENABLE_INPUT_TYPE_TIME);$(ENABLE_INPUT_TYPE_WEEK);$(ENABLE_LEGACY_CSS_VENDOR_PREFIXES);$(ENABLE_LEGACY_NOTIFICATIONS);$(ENABLE_LINK_PREFETCH);$(ENABLE_LINK_PRERENDER);$(ENABLE_MATHML);$(ENABLE_METER_ELEMENT);$(ENABLE_MICRODATA);$(ENABLE_MOUSE_CURSOR_SCALE);$(ENABLE_NOTIFICATIONS);$(ENABLE_PROXIMITY_EVENTS);$(ENABLE_QUOTA);$(ENABLE_NAVIGATOR_CONTENT_UTILS);$(ENABLE_SCRIPTED_SPEECH);$(ENABLE_SHADOW_DOM);$(ENABLE_SHARED_WORKERS);$(ENABLE_MEDIA_CONTROLS_SCRIPT);$(ENABLE_MEDIA_SOURCE);$(ENABLE_MEDIA_STATISTICS);$(ENABLE_SQL_DATABASE);$(ENABLE_STYLE_SCOPED);$(ENABLE_SUBPIXEL_LAYOUT);$(ENABLE_SVG);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_TEMPLATE_ELEMENT);$(ENABLE_TEXT_AUTOSIZING);$(ENABLE_VIDEO);$(ENABLE_VIDEO_TRACK);$(ENABLE_VIEW_MODE_CSS_MEDIA);$(ENABLE_WEB_AUDIO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WEB_TIMING);$(ENABLE_WEBVTT_REGIONS);$(ENABLE_XHR_TIMEOUT);$(ENABLE_XSLT);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+<PreprocessorDefinitions>$(ENABLE_CSP_NEXT);$(ENABLE_PROMISES);$(ENABLE_REQUEST_ANIMATION_FRAME);$(ENABLE_3D_RENDERING);$(ENABLE_ACCELERATED_2D_CANVAS);$(ENABLE_ACCELERATED_OVERFLOW_SCROLLING);$(ENABLE_CANVAS_PATH);$(ENABLE_CANVAS_PROXY);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CSS3_CONDITIONAL_RULES);$(ENABLE_CSS_IMAGE_SET);$(ENABLE_CSS3_TEXT);$(ENABLE_CSS_BOX_DECORATION_BREAK);$(ENABLE_CSS_GRID_LAYOUT);$(ENABLE_CSS_SHADERS);$(ENABLE_CSS_COMPOSITING);$(ENABLE_CSS_REGIONS);$(ENABLE_CSS_SELECTORS_LEVEL4);$(ENABLE_CSS_SHAPES);$(ENABLE_CSS_SHAPE_INSIDE);$(ENABLE_CSS_TRANSFORMS_ANIMATIONS_TRANSITIONS_UNPREFIXED);$(ENABLE_CUSTOM_SCHEME_HANDLER);$(ENABLE_DATAGRID);$(ENABLE_DATALIST_ELEMENT);$(ENABLE_DATA_TRANSFER_ITEMS);$(ENABLE_DETAILS_ELEMENT);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DIRECTORY_UPLOAD);$(ENABLE_ENCRYPTED_MEDIA_V2);$(ENABLE_FILE_SYSTEM);$(ENABLE_FULLSCREEN_API);$(ENABLE_GAMEPAD);$(ENABLE_GEOLOCATION);$(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING);$(ENABLE_HIGH_DPI_CANVAS);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_INPUT_TYPE_COLOR);$(ENABLE_INPUT_SPEECH);$(ENABLE_INPUT_TYPE_DATE);$(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE);$(ENABLE_INPUT_TYPE_DATETIMELOCAL);$(ENABLE_INPUT_TYPE_MONTH);$(ENABLE_INPUT_TYPE_TIME);$(ENABLE_INPUT_TYPE_WEEK);$(ENABLE_LEGACY_CSS_VENDOR_PREFIXES);$(ENABLE_LEGACY_NOTIFICATIONS);$(ENABLE_LINK_PREFETCH);$(ENABLE_LINK_PRERENDER);$(ENABLE_MATHML);$(ENABLE_METER_ELEMENT);$(ENABLE_MICRODATA);$(ENABLE_MOUSE_CURSOR_SCALE);$(ENABLE_NOTIFICATIONS);$(ENABLE_PROXIMITY_EVENTS);$(ENABLE_QUOTA);$(ENABLE_NAVIGATOR_CONTENT_UTILS);$(ENABLE_SCRIPTED_SPEECH);$(ENABLE_SHADOW_DOM);$(ENABLE_SHARED_WORKERS);$(ENABLE_MEDIA_CONTROLS_SCRIPT);$(ENABLE_MEDIA_SOURCE);$(ENABLE_MEDIA_STATISTICS);$(ENABLE_SQL_DATABASE);$(ENABLE_STYLE_SCOPED);$(ENABLE_SUBPIXEL_LAYOUT);$(ENABLE_SVG);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_TEMPLATE_ELEMENT);$(ENABLE_TEXT_AUTOSIZING);$(ENABLE_VIDEO);$(ENABLE_VIDEO_TRACK);$(ENABLE_VIEW_MODE_CSS_MEDIA);$(ENABLE_WEB_AUDIO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WEB_TIMING);$(ENABLE_WEBVTT_REGIONS);$(ENABLE_XHR_TIMEOUT);$(ENABLE_XSLT);%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
       <Value>$(ENABLE_DIRECTORY_UPLOAD)</Value>
       <EnvironmentVariable>true</EnvironmentVariable>
     </BuildMacro>
+    <BuildMacro Include="ENABLE_ENCRYPTED_MEDIA_V2">
+      <Value>$(ENABLE_ENCRYPTED_MEDIA_V2)</Value>
+      <EnvironmentVariable>true</EnvironmentVariable>
+    </BuildMacro>
     <BuildMacro Include="ENABLE_FILE_SYSTEM">
       <Value>$(ENABLE_FILE_SYSTEM)</Value>
       <EnvironmentVariable>true</EnvironmentVariable>