Allow clients to specify a list of codecs which should require hardware decode support.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Jun 2017 22:40:30 +0000 (22:40 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Jun 2017 22:40:30 +0000 (22:40 +0000)
commit1c37cb3f453444019f44144b94a07edd44a8173b
tree21fd86537ba75f1fdf2b2243580f7f28d1015eef
parent2b42fbddcfb5fa84ea52bbec853d39d8fec2266a
Allow clients to specify a list of codecs which should require hardware decode support.
https://bugs.webkit.org/show_bug.cgi?id=172787

Reviewed by Alex Christensen.

Source/WebCore:

Add a new setting, checked by HTMLMediaElement, which allows MediaPlayerPrivate implementation
to require that the specified codecs have hardware support. This requirement will be supported
in the normal media loading path and the MSE path on Cocoa ports.

* WebCore.xcodeproj/project.pbxproj:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaCodecsRequiringHardwareSupport):
* html/HTMLMediaElement.h:
* page/Settings.cpp:
(WebCore::Settings::setMediaCodecsRequiringHardwareSupport):
* page/Settings.h:
(WebCore::Settings::mediaCodecsRequiringHardwareSupport):
* platform/cocoa/VideoToolboxSoftLink.cpp:
* platform/cocoa/VideoToolboxSoftLink.h:
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaCodecsRequiringHardwareSupport):
* platform/graphics/avfoundation/objc/AVAssetTrackUtilities.h: Added.
* platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm: Added.
(WebCore::assetTrackMeetsHardwareDecodeRequirements):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
(WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):

Source/WebKit2:

Add a WKWebPageConfiguration (and associated WebPreferences and WKPreferencesRef) properties
allowing clients to require specified codecs have hardware decode support. Also open up the
sandbox on Cocoa ports to services required to check for hardware decode availability.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetMediaCodecsRequiringHardwareSupport):
(WKPreferencesCopyMediaCodecsRequiringHardwareSupport):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _mediaCodecsRequiringHardwareSupport]):
(-[WKWebViewConfiguration _setMediaCodecsRequiringHardwareSupport:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* WebProcess/com.apple.WebProcess.sb.in:

Source/WTF:

Add a couple of convenience methods:
- a String::split() that returns a vector (rather than taking an out-reference to a vector).
- A Vector::map() template which takes a Callable and returns a Vector of a different type.

* wtf/Vector.h:
(WTF::Vector::map):
* wtf/text/WTFString.h:
(WTF::String::split):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217799 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Vector.h
Source/WTF/wtf/text/WTFString.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/platform/ContentType.h
Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp
Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h
Source/WebCore/platform/graphics/FourCC.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/FourCC.h [new file with mode: 0644]
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
Source/WebCore/platform/graphics/avfoundation/objc/AVAssetTrackUtilities.h [new file with mode: 0644]
Source/WebCore/platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm [new file with mode: 0644]
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h
Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in