Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1293253003: Fix autoplay during prerendering for media elements on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@defer_media
Patch Set: Rename test class. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 856862627ff46d8fe4bae0d3a0a1fa12f9217404..0a03ee7391b8ec20f8f06daa371c34597185fe71 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -113,7 +113,6 @@
#include "media/base/media_log.h"
#include "media/blink/webencryptedmediaclient_impl.h"
#include "media/blink/webmediaplayer_impl.h"
-#include "media/blink/webmediaplayer_params.h"
#include "media/renderers/gpu_video_accelerator_factories.h"
#include "mojo/common/url_type_converters.h"
#include "net/base/data_url.h"
@@ -2065,24 +2064,31 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
if (!web_stream.isNull())
return CreateWebMediaPlayerForMediaStream(client);
+ RenderThreadImpl* render_thread = RenderThreadImpl::current();
+
#if defined(OS_ANDROID) && !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
- return CreateAndroidWebMediaPlayer(client, encrypted_client,
- GetMediaPermission(), initial_cdm);
+ scoped_refptr<media::AudioRendererSink> audio_renderer_sink;
+ media::WebMediaPlayerParams::Context3DCB context_3d_cb;
#else
- scoped_refptr<media::MediaLog> media_log(new RenderMediaLog());
+ scoped_refptr<media::AudioRendererSink> audio_renderer_sink =
+ render_thread->GetAudioRendererMixerManager()->CreateInput(routing_id_);
+ media::WebMediaPlayerParams::Context3DCB context_3d_cb =
+ base::Bind(&GetSharedMainThreadContext3D);
+#endif // defined(OS_ANDROID) && !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
- RenderThreadImpl* render_thread = RenderThreadImpl::current();
+ scoped_refptr<media::MediaLog> media_log(new RenderMediaLog());
media::WebMediaPlayerParams params(
base::Bind(&ContentRendererClient::DeferMediaLoad,
base::Unretained(GetContentClient()->renderer()),
static_cast<RenderFrame*>(this), has_played_media_),
- render_thread->GetAudioRendererMixerManager()->CreateInput(routing_id_),
- media_log, render_thread->GetMediaThreadTaskRunner(),
+ audio_renderer_sink, media_log, render_thread->GetMediaThreadTaskRunner(),
render_thread->GetWorkerTaskRunner(),
- render_thread->compositor_task_runner(),
- base::Bind(&GetSharedMainThreadContext3D), GetMediaPermission(),
- initial_cdm);
+ render_thread->compositor_task_runner(), context_3d_cb,
+ GetMediaPermission(), initial_cdm);
+#if defined(OS_ANDROID) && !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
+ return CreateAndroidWebMediaPlayer(client, encrypted_client, params);
+#else
#if defined(ENABLE_MOJO_MEDIA)
scoped_ptr<media::RendererFactory> media_renderer_factory(
new media::MojoRendererFactory(GetMediaServiceFactory()));
@@ -4994,12 +5000,10 @@ NavigationState* RenderFrameImpl::CreateNavigationStateFromPending() {
}
#if defined(OS_ANDROID)
-
WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer(
WebMediaPlayerClient* client,
WebMediaPlayerEncryptedMediaClient* encrypted_client,
- media::MediaPermission* media_permission,
- WebContentDecryptionModule* initial_cdm) {
+ const media::WebMediaPlayerParams& params) {
scoped_refptr<StreamTextureFactory> stream_texture_factory;
if (SynchronousCompositorFactory* factory =
SynchronousCompositorFactory::GetInstance()) {
@@ -5028,10 +5032,7 @@ WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer(
return new WebMediaPlayerAndroid(
frame_, client, encrypted_client, weak_factory_.GetWeakPtr(),
- GetMediaPlayerManager(), GetCdmFactory(), media_permission, initial_cdm,
- stream_texture_factory,
- RenderThreadImpl::current()->GetMediaThreadTaskRunner(),
- new RenderMediaLog());
+ GetMediaPlayerManager(), GetCdmFactory(), stream_texture_factory, params);
}
RendererMediaPlayerManager* RenderFrameImpl::GetMediaPlayerManager() {
@@ -5039,7 +5040,6 @@ RendererMediaPlayerManager* RenderFrameImpl::GetMediaPlayerManager() {
media_player_manager_ = new RendererMediaPlayerManager(this);
return media_player_manager_;
}
-
#endif // defined(OS_ANDROID)
media::MediaPermission* RenderFrameImpl::GetMediaPermission() {
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698