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

Unified Diff: media/mojo/clients/mojo_renderer.cc

Issue 2230583002: Add MediaPlayerRenderer/MediaPlayerRendererClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added MEDIA_EXPORT. Created 4 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 | « media/mojo/clients/mojo_renderer.h ('k') | media/mojo/interfaces/renderer.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/clients/mojo_renderer.cc
diff --git a/media/mojo/clients/mojo_renderer.cc b/media/mojo/clients/mojo_renderer.cc
index 95ee0c67d725255c45c467a17b984fcd1bec1573..b2145035a0876e7c2481bf256ddf1384ca425710 100644
--- a/media/mojo/clients/mojo_renderer.cc
+++ b/media/mojo/clients/mojo_renderer.cc
@@ -55,6 +55,21 @@ void MojoRenderer::Initialize(DemuxerStreamProvider* demuxer_stream_provider,
demuxer_stream_provider_ = demuxer_stream_provider;
init_cb_ = init_cb;
+ switch (demuxer_stream_provider_->GetType()) {
+ case DemuxerStreamProvider::Type::STREAM:
+ InitializeRendererFromStreams(client);
+ break;
+ case DemuxerStreamProvider::Type::URL:
+ InitializeRendererFromUrl(client);
+ break;
+ }
+}
+
+void MojoRenderer::InitializeRendererFromStreams(
+ media::RendererClient* client) {
+ DVLOG(1) << __FUNCTION__;
+ DCHECK(task_runner_->BelongsToCurrentThread());
+
// Create audio and video mojom::DemuxerStream and bind its lifetime to
// the pipe.
DemuxerStream* const audio =
@@ -93,7 +108,22 @@ void MojoRenderer::Initialize(DemuxerStreamProvider* demuxer_stream_provider,
// |remote_renderer_| is destroyed.
remote_renderer_->Initialize(
binding_.CreateInterfacePtrAndBind(), std::move(audio_stream),
- std::move(video_stream),
+ std::move(video_stream), base::nullopt,
+ base::Bind(&MojoRenderer::OnInitialized, base::Unretained(this), client));
+}
+
+void MojoRenderer::InitializeRendererFromUrl(media::RendererClient* client) {
+ DVLOG(2) << __FUNCTION__;
+ DCHECK(task_runner_->BelongsToCurrentThread());
+
+ BindRemoteRendererIfNeeded();
+
+ // Using base::Unretained(this) is safe because |this| owns
+ // |remote_renderer_|, and the callback won't be dispatched if
+ // |remote_renderer_| is destroyed.
+ remote_renderer_->Initialize(
+ binding_.CreateInterfacePtrAndBind(), mojom::DemuxerStreamPtr(),
+ mojom::DemuxerStreamPtr(), demuxer_stream_provider_->GetUrl(),
base::Bind(&MojoRenderer::OnInitialized, base::Unretained(this), client));
}
@@ -182,6 +212,11 @@ bool MojoRenderer::HasAudio() {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(remote_renderer_.is_bound());
+ if (demuxer_stream_provider_->GetType() == DemuxerStreamProvider::Type::URL) {
+ NOTIMPLEMENTED();
+ return false;
+ }
+
return !!demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO);
}
@@ -190,6 +225,11 @@ bool MojoRenderer::HasVideo() {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(remote_renderer_.is_bound());
+ if (demuxer_stream_provider_->GetType() == DemuxerStreamProvider::Type::URL) {
+ NOTIMPLEMENTED();
+ return false;
+ }
+
return !!demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO);
}
« no previous file with comments | « media/mojo/clients/mojo_renderer.h ('k') | media/mojo/interfaces/renderer.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698