summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/renderer/render_frame_impl.cc62
-rw-r--r--content/renderer/render_frame_impl.h1
-rw-r--r--media/base/media.cc9
-rw-r--r--media/base/media.h6
-rw-r--r--media/filters/stream_parser_factory.cc8
-rw-r--r--media/media_options.gni2
-rw-r--r--third_party/WebKit/Source/core/html/HTMLMediaElement.cpp2
-rw-r--r--third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp2
-rw-r--r--third_party/WebKit/Source/core/loader/EmptyClients.cpp3
-rw-r--r--third_party/WebKit/Source/core/loader/EmptyClients.h3
-rw-r--r--third_party/WebKit/Source/core/loader/FrameLoaderClient.h4
-rw-r--r--third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp5
-rw-r--r--third_party/WebKit/Source/web/FrameLoaderClientImpl.h2
-rw-r--r--third_party/WebKit/public/web/WebFrameClient.h4
14 files changed, 53 insertions, 60 deletions
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index d7eaf80..d51a402 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -215,7 +215,9 @@
#if defined(ENABLE_PEPPER_CDMS)
#include "content/renderer/media/cdm/pepper_cdm_wrapper_impl.h"
+#include "content/renderer/media/cdm/render_cdm_factory.h"
#elif defined(ENABLE_BROWSER_CDMS)
+#include "content/renderer/media/cdm/render_cdm_factory.h"
#include "content/renderer/media/cdm/renderer_cdm_manager.h"
#endif
@@ -225,8 +227,6 @@
#if defined(ENABLE_MOJO_CDM)
#include "media/mojo/services/mojo_cdm_factory.h" // nogncheck
-#else
-#include "content/renderer/media/cdm/render_cdm_factory.h"
#endif
#if defined(ENABLE_MOJO_RENDERER)
@@ -755,17 +755,13 @@ bool IsContentWithCertificateErrorsRelevantToUI(
//
// Note that HLS and MP4 detection are pre-redirect and path-based. It is
// possible to load such a URL and find different content.
-bool UseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type,
- const GURL& url) {
- if (load_type == blink::WebMediaPlayer::LoadTypeMediaSource)
- return media::IsUnifiedMediaPipelineEnabledForMse();
-
+bool UseWebMediaPlayerImpl(const GURL& url) {
// WMPI does not support HLS.
if (media::MediaCodecUtil::IsHLSPath(url))
return false;
// Don't use WMPI if the container likely contains a codec we can't decode in
- // software and hardware decoders are not available.
+ // software and platform decoders are not available.
if (base::EndsWith(url.path(), ".mp4",
base::CompareCase::INSENSITIVE_ASCII) &&
!media::HasPlatformDecoderSupport()) {
@@ -777,6 +773,24 @@ bool UseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type,
}
#endif // defined(OS_ANDROID)
+#if defined(ENABLE_MOJO_CDM)
+// Returns whether mojo CDM should be used at runtime. Note that even when mojo
+// CDM is enabled at compile time (ENABLE_MOJO_CDM is defined), there are cases
+// where we want to choose other CDM types. For example, on Android when we use
+// WebMediaPlayerAndroid, we still want to use ProxyMediaKeys. In the future,
+// when we experiment mojo CDM on desktop, we will choose between mojo CDM and
+// pepper CDM at runtime.
+// TODO(xhwang): Remove this when we use mojo CDM for all remote CDM cases by
+// default.
+bool UseMojoCdm() {
+#if defined(OS_ANDROID)
+ return media::IsUnifiedMediaPipelineEnabled();
+#else
+ return true;
+#endif
+}
+#endif // defined(ENABLE_MOJO_CDM)
+
} // namespace
// static
@@ -2383,7 +2397,6 @@ blink::WebPlugin* RenderFrameImpl::createPlugin(
}
blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
- blink::WebMediaPlayer::LoadType load_type,
const blink::WebURL& url,
WebMediaPlayerClient* client,
WebMediaPlayerEncryptedMediaClient* encrypted_client,
@@ -2430,7 +2443,7 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
initial_cdm, media_surface_manager_, media_session);
#if defined(OS_ANDROID)
- if (!UseWebMediaPlayerImpl(load_type, url))
+ if (!UseWebMediaPlayerImpl(url))
return CreateAndroidWebMediaPlayer(client, encrypted_client, params);
#endif // defined(OS_ANDROID)
@@ -5902,26 +5915,25 @@ bool RenderFrameImpl::AreSecureCodecsSupported() {
}
media::CdmFactory* RenderFrameImpl::GetCdmFactory() {
-#if defined(ENABLE_BROWSER_CDMS)
- if (!cdm_manager_)
- cdm_manager_ = new RendererCdmManager(this);
-#endif // defined(ENABLE_BROWSER_CDMS)
-
- if (!cdm_factory_) {
- DCHECK(frame_);
+ if (cdm_factory_)
+ return cdm_factory_.get();
#if defined(ENABLE_MOJO_CDM)
+ if (UseMojoCdm()) {
cdm_factory_.reset(new media::MojoCdmFactory(GetMediaInterfaceProvider()));
-#else
- cdm_factory_.reset(new RenderCdmFactory(
+ return cdm_factory_.get();
+ }
+#endif // defined(ENABLE_MOJO_CDM)
+
#if defined(ENABLE_PEPPER_CDMS)
- base::Bind(&PepperCdmWrapperImpl::Create, frame_)
+ DCHECK(frame_);
+ cdm_factory_.reset(
+ new RenderCdmFactory(base::Bind(&PepperCdmWrapperImpl::Create, frame_)));
#elif defined(ENABLE_BROWSER_CDMS)
- cdm_manager_
-#endif
- ));
-#endif // defined(ENABLE_MOJO_CDM)
- }
+ if (!cdm_manager_)
+ cdm_manager_ = new RendererCdmManager(this);
+ cdm_factory_.reset(new RenderCdmFactory(cdm_manager_));
+#endif // defined(ENABLE_PEPPER_CDMS)
return cdm_factory_.get();
}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index f392f2d..729c949 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -414,7 +414,6 @@ class CONTENT_EXPORT RenderFrameImpl
blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
const blink::WebPluginParams& params) override;
blink::WebMediaPlayer* createMediaPlayer(
- blink::WebMediaPlayer::LoadType load_type,
const blink::WebURL& url,
blink::WebMediaPlayerClient* client,
blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
diff --git a/media/base/media.cc b/media/base/media.cc
index b2e1c45..954fb19 100644
--- a/media/base/media.cc
+++ b/media/base/media.cc
@@ -107,15 +107,6 @@ bool IsUnifiedMediaPipelineEnabled() {
base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
}
-bool IsUnifiedMediaPipelineEnabledForMse() {
- // Don't check IsUnifiedMediaPipelineEnabled() here since we don't want MSE to
- // be enabled via experiment yet; only when the existing implementation can't
- // be used (i.e. MediaCodec unavailable).
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableUnifiedMediaPipeline) ||
- !MediaCodecUtil::IsMediaCodecAvailable();
-}
-
bool ArePlatformDecodersAvailable() {
return IsUnifiedMediaPipelineEnabled()
? HasPlatformDecoderSupport()
diff --git a/media/base/media.h b/media/base/media.h
index b6cccc4..ca5a8175 100644
--- a/media/base/media.h
+++ b/media/base/media.h
@@ -41,12 +41,6 @@ MEDIA_EXPORT bool PlatformHasVp9Support();
// unified media pipeline is supported everywhere. http://crbug.com/580626.
MEDIA_EXPORT bool IsUnifiedMediaPipelineEnabled();
-// Similar to IsUnifiedMediaPipelineEnabled() but will also return true if
-// MediaCodec is not available (allowing the unified pipeline to take over for
-// cases where existing pipeline has no support). As above, codecs requiring
-// platform support may not be available.
-MEDIA_EXPORT bool IsUnifiedMediaPipelineEnabledForMse();
-
// Returns whether the platform decoders are available for use.
// This includes decoders being available on the platform and accessible, such
// as via the GPU process. Should only be used for actual decoders
diff --git a/media/filters/stream_parser_factory.cc b/media/filters/stream_parser_factory.cc
index 92ccbf4..0247098 100644
--- a/media/filters/stream_parser_factory.cc
+++ b/media/filters/stream_parser_factory.cc
@@ -334,7 +334,7 @@ static bool VerifyCodec(
// TODO(wolenetz, dalecurtis): This should instead use MimeUtil() to avoid
// duplication of subtle Android behavior. http://crbug.com/587303.
if (codec_info->tag == CodecInfo::HISTOGRAM_H264) {
- if (media::IsUnifiedMediaPipelineEnabledForMse() &&
+ if (media::IsUnifiedMediaPipelineEnabled() &&
!media::HasPlatformDecoderSupport()) {
return false;
}
@@ -344,17 +344,17 @@ static bool VerifyCodec(
}
if (codec_info->tag == CodecInfo::HISTOGRAM_VP8 &&
!media::MediaCodecUtil::IsVp8DecoderAvailable() &&
- !media::IsUnifiedMediaPipelineEnabledForMse()) {
+ !media::IsUnifiedMediaPipelineEnabled()) {
return false;
}
if (codec_info->tag == CodecInfo::HISTOGRAM_VP9 &&
!media::PlatformHasVp9Support() &&
- !media::IsUnifiedMediaPipelineEnabledForMse()) {
+ !media::IsUnifiedMediaPipelineEnabled()) {
return false;
}
if (codec_info->tag == CodecInfo::HISTOGRAM_OPUS &&
!media::PlatformHasOpusSupport() &&
- !media::IsUnifiedMediaPipelineEnabledForMse()) {
+ !media::IsUnifiedMediaPipelineEnabled()) {
return false;
}
#endif
diff --git a/media/media_options.gni b/media/media_options.gni
index cedcdf7..0390f21 100644
--- a/media/media_options.gni
+++ b/media/media_options.gni
@@ -72,7 +72,7 @@ declare_args() {
# |mojo_media_services|). When enabled, selected mojo paths will be enabled in
# the media pipeline and corresponding services will hosted in the selected
# remote process (e.g. "utility" process, see |mojo_media_host|).
- enable_mojo_media = false
+ enable_mojo_media = is_android
# Enable the TestMojoMediaClient to be used in MojoMediaApplication. This is
# for testing only and will override the default platform MojoMediaClient.
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 4d4e353..6dcd96d 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -1057,7 +1057,7 @@ void HTMLMediaElement::startPlayerLoad()
}
KURL kurl(ParsedURLString, requestURL);
- m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(*this, loadType(), kurl, this);
+ m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(*this, kurl, this);
if (!m_webMediaPlayer) {
mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
return;
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
index 4a605ce..70a4498 100644
--- a/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
@@ -63,7 +63,7 @@ public:
return adoptPtrWillBeNoop(new StubFrameLoaderClient);
}
- PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, WebMediaPlayer::LoadType, const WebURL&, WebMediaPlayerClient*) override
+ PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebURL&, WebMediaPlayerClient*) override
{
return adoptPtr(new MockWebMediaPlayer);
}
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.cpp b/third_party/WebKit/Source/core/loader/EmptyClients.cpp
index 592a5c7..9b44813 100644
--- a/third_party/WebKit/Source/core/loader/EmptyClients.cpp
+++ b/third_party/WebKit/Source/core/loader/EmptyClients.cpp
@@ -36,6 +36,7 @@
#include "platform/Widget.h"
#include "public/platform/Platform.h"
#include "public/platform/WebApplicationCacheHost.h"
+#include "public/platform/WebMediaPlayer.h"
#include "public/platform/modules/mediasession/WebMediaSession.h"
#include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h"
#include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h"
@@ -152,7 +153,7 @@ PassRefPtrWillBeRawPtr<Widget> EmptyFrameLoaderClient::createPlugin(HTMLPlugInEl
return nullptr;
}
-PassOwnPtr<WebMediaPlayer> EmptyFrameLoaderClient::createWebMediaPlayer(HTMLMediaElement&, WebMediaPlayer::LoadType, const WebURL&, WebMediaPlayerClient*)
+PassOwnPtr<WebMediaPlayer> EmptyFrameLoaderClient::createWebMediaPlayer(HTMLMediaElement&, const WebURL&, WebMediaPlayerClient*)
{
return nullptr;
}
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.h b/third_party/WebKit/Source/core/loader/EmptyClients.h
index 911a8c5..da0e924 100644
--- a/third_party/WebKit/Source/core/loader/EmptyClients.h
+++ b/third_party/WebKit/Source/core/loader/EmptyClients.h
@@ -47,7 +47,6 @@
#include "platform/text/TextCheckerClient.h"
#include "public/platform/WebFocusType.h"
#include "public/platform/WebFrameScheduler.h"
-#include "public/platform/WebMediaPlayer.h"
#include "public/platform/WebScreenInfo.h"
#include "wtf/Forward.h"
#include <v8.h>
@@ -247,7 +246,7 @@ public:
PassRefPtrWillBeRawPtr<LocalFrame> createFrame(const FrameLoadRequest&, const AtomicString&, HTMLFrameOwnerElement*) override;
PassRefPtrWillBeRawPtr<Widget> createPlugin(HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool, DetachedPluginPolicy) override;
bool canCreatePluginWithoutRenderer(const String& mimeType) const override { return false; }
- PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, WebMediaPlayer::LoadType, const WebURL&, WebMediaPlayerClient*) override;
+ PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebURL&, WebMediaPlayerClient*) override;
PassOwnPtr<WebMediaSession> createWebMediaSession() override;
ObjectContentType getObjectContentType(const KURL&, const String&, bool) override { return ObjectContentType(); }
diff --git a/third_party/WebKit/Source/core/loader/FrameLoaderClient.h b/third_party/WebKit/Source/core/loader/FrameLoaderClient.h
index 4e0afca..fb99716 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoaderClient.h
+++ b/third_party/WebKit/Source/core/loader/FrameLoaderClient.h
@@ -41,7 +41,6 @@
#include "platform/heap/Handle.h"
#include "platform/network/ResourceLoadPriority.h"
#include "platform/weborigin/Referrer.h"
-#include "public/platform/WebMediaPlayer.h"
#include "wtf/Forward.h"
#include "wtf/Vector.h"
#include <v8.h>
@@ -68,6 +67,7 @@ class SubstituteData;
class WebApplicationCacheHost;
class WebApplicationCacheHostClient;
class WebCookieJar;
+class WebMediaPlayer;
class WebMediaPlayerClient;
class WebMediaSession;
class WebRTCPeerConnectionHandler;
@@ -161,7 +161,7 @@ public:
virtual bool canCreatePluginWithoutRenderer(const String& mimeType) const = 0;
virtual PassRefPtrWillBeRawPtr<Widget> createPlugin(HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually, DetachedPluginPolicy) = 0;
- virtual PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, WebMediaPlayer::LoadType, const WebURL&, WebMediaPlayerClient*) = 0;
+ virtual PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebURL&, WebMediaPlayerClient*) = 0;
virtual PassOwnPtr<WebMediaSession> createWebMediaSession() = 0;
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
index a89a59d..06eb954 100644
--- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
+++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
@@ -75,7 +75,6 @@
#include "platform/plugins/PluginData.h"
#include "public/platform/Platform.h"
#include "public/platform/WebApplicationCacheHost.h"
-#include "public/platform/WebMediaPlayer.h"
#include "public/platform/WebMimeRegistry.h"
#include "public/platform/WebRTCPeerConnectionHandler.h"
#include "public/platform/WebSecurityOrigin.h"
@@ -821,7 +820,6 @@ PassRefPtrWillBeRawPtr<Widget> FrameLoaderClientImpl::createPlugin(
PassOwnPtr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer(
HTMLMediaElement& htmlMediaElement,
- WebMediaPlayer::LoadType loadType,
const WebURL& url,
WebMediaPlayerClient* client)
{
@@ -837,8 +835,7 @@ PassOwnPtr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer(
HTMLMediaElementEncryptedMedia& encryptedMedia = HTMLMediaElementEncryptedMedia::from(htmlMediaElement);
WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement));
- return adoptPtr(webFrame->client()->createMediaPlayer(loadType, url,
- client, &encryptedMedia,
+ return adoptPtr(webFrame->client()->createMediaPlayer(url, client, &encryptedMedia,
encryptedMedia.contentDecryptionModule(), sinkId, webMediaSession));
}
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.h b/third_party/WebKit/Source/web/FrameLoaderClientImpl.h
index ee342a9..9ff9d19 100644
--- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.h
+++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.h
@@ -129,7 +129,7 @@ public:
HTMLPlugInElement*, const KURL&,
const Vector<WTF::String>&, const Vector<WTF::String>&,
const WTF::String&, bool loadManually, DetachedPluginPolicy) override;
- PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, WebMediaPlayer::LoadType, const WebURL&, WebMediaPlayerClient*) override;
+ PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebURL&, WebMediaPlayerClient*) override;
PassOwnPtr<WebMediaSession> createWebMediaSession() override;
ObjectContentType getObjectContentType(
const KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages) override;
diff --git a/third_party/WebKit/public/web/WebFrameClient.h b/third_party/WebKit/public/web/WebFrameClient.h
index b136f79..8ac6ce0f 100644
--- a/third_party/WebKit/public/web/WebFrameClient.h
+++ b/third_party/WebKit/public/web/WebFrameClient.h
@@ -48,7 +48,6 @@
#include "public/platform/WebCommon.h"
#include "public/platform/WebFileSystem.h"
#include "public/platform/WebFileSystemType.h"
-#include "public/platform/WebMediaPlayer.h"
#include "public/platform/WebSecurityOrigin.h"
#include "public/platform/WebSetSinkIdCallbacks.h"
#include "public/platform/WebStorageQuotaCallbacks.h"
@@ -76,6 +75,7 @@ class WebExternalPopupMenuClient;
class WebFormElement;
class WebGeolocationClient;
class WebInstalledAppClient;
+class WebMediaPlayer;
class WebMediaPlayerClient;
class WebMediaPlayerEncryptedMediaClient;
class WebMediaSession;
@@ -114,7 +114,7 @@ public:
// May return null.
// WebContentDecryptionModule* may be null if one has not yet been set.
- virtual WebMediaPlayer* createMediaPlayer(WebMediaPlayer::LoadType, const WebURL&, WebMediaPlayerClient*, WebMediaPlayerEncryptedMediaClient*, WebContentDecryptionModule*, const WebString& sinkId, WebMediaSession*) { return 0; }
+ virtual WebMediaPlayer* createMediaPlayer(const WebURL&, WebMediaPlayerClient*, WebMediaPlayerEncryptedMediaClient*, WebContentDecryptionModule*, const WebString& sinkId, WebMediaSession*) { return 0; }
// May return null.
virtual WebMediaSession* createMediaSession() { return 0; }