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

Unified Diff: media/mojo/services/mojo_renderer_service.cc

Issue 2282633002: Integrate Surface requests with MediaPlayerRenderer (Closed)
Patch Set: Updated InitiateScopedSurfaceRequest Created 4 years, 2 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/services/mojo_renderer_service.h ('k') | media/mojo/services/service_factory_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/mojo_renderer_service.cc
diff --git a/media/mojo/services/mojo_renderer_service.cc b/media/mojo/services/mojo_renderer_service.cc
index deec2d1d543e3663bd45ac08e04f55eda27e9c76..b964a6ce8c0d62ef78ef32b21248cfce23b2e4b2 100644
--- a/media/mojo/services/mojo_renderer_service.cc
+++ b/media/mojo/services/mojo_renderer_service.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/optional.h"
#include "media/base/audio_renderer_sink.h"
#include "media/base/media_keys.h"
#include "media/base/media_url_demuxer.h"
@@ -24,13 +25,15 @@ MojoRendererService::MojoRendererService(
base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context,
scoped_refptr<AudioRendererSink> audio_sink,
std::unique_ptr<VideoRendererSink> video_sink,
- std::unique_ptr<media::Renderer> renderer)
+ std::unique_ptr<media::Renderer> renderer,
+ InitiateSurfaceRequestCB initiate_surface_request_cb)
: mojo_cdm_service_context_(mojo_cdm_service_context),
state_(STATE_UNINITIALIZED),
playback_rate_(0),
audio_sink_(std::move(audio_sink)),
video_sink_(std::move(video_sink)),
renderer_(std::move(renderer)),
+ initiate_surface_request_cb_(initiate_surface_request_cb),
weak_factory_(this) {
DVLOG(1) << __FUNCTION__;
DCHECK(renderer_);
@@ -238,4 +241,15 @@ void MojoRendererService::OnCdmAttached(
callback.Run(success);
}
+void MojoRendererService::InitiateScopedSurfaceRequest(
+ const InitiateScopedSurfaceRequestCallback& callback) {
+ if (initiate_surface_request_cb_.is_null()) {
+ // |renderer_| is likely not of type MediaPlayerRenderer.
+ // This is an unexpected call, and the connection should be closed.
dcheng 2016/10/05 07:18:40 Still might be nice to call mojo::ReportBadMessage
tguilbert 2016/10/05 19:20:53 I'm not sure what the proper mojo::ReportBadMessag
dcheng 2016/10/05 20:04:13 Right: if it's hooked up, it'll do something usefu
tguilbert 2016/10/05 22:21:45 Ok, done!
+ delete this;
dcheng 2016/10/05 07:18:40 delete this is problematic, since this is wrapped
tguilbert 2016/10/05 19:20:53 I thought "delete this" was pretty much the only w
dcheng 2016/10/05 20:04:13 I confirmed with rockot@ that this code is unsafe:
tguilbert 2016/10/05 22:21:45 Done.
+ return;
+ }
+
+ callback.Run(initiate_surface_request_cb_.Run());
+}
} // namespace media
« no previous file with comments | « media/mojo/services/mojo_renderer_service.h ('k') | media/mojo/services/service_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698