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

Unified Diff: media/mojo/services/mojo_renderer_impl.h

Issue 551963004: media: scaffolding and plumbing for MojoRenderer{Impl, Service} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: media/mojo/services/mojo_renderer_impl.h
diff --git a/media/mojo/services/mojo_renderer_impl.h b/media/mojo/services/mojo_renderer_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..37e7d76bf0dd543f51ed39120d527e69884f3023
--- /dev/null
+++ b/media/mojo/services/mojo_renderer_impl.h
@@ -0,0 +1,87 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_
+#define MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "media/base/renderer.h"
+#include "media/mojo/interfaces/media_renderer.mojom.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace mojo {
+class ServiceProvider;
+}
+
+namespace media {
+class Demuxer;
+
+// A media::Renderer that proxies to a mojo::MediaRenderer. That
+// mojo::MediaRenderer proxies back to the MojoRendererImpl via the
+// mojo::MediaRendererClient interface.
+//
+// MojoRendererImpl implements media::Renderer for use as either an audio
+// or video renderer.
+//
+// TODO(tim): Only audio is currently supported. Bug 410451.
scherkus (not reviewing) 2014/09/09 20:35:33 URLify bugs http://crbug.com/410451
tim (not reviewing) 2014/09/10 23:08:30 Done.
+class MojoRendererImpl : public Renderer, public mojo::MediaRendererClient {
+ public:
+ // |task_runner| is the TaskRunner on which all methods are invoked.
+ // |demuxer| provides encoded streams for decoding and rendering.
+ // |audio_renderer_provider| is a ServiceProvider from a connected
+ // Application that is hosting a mojo::MediaRenderer.
+ MojoRendererImpl(
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
+ Demuxer* demuxer,
+ mojo::ServiceProvider* audio_renderer_provider);
+ virtual ~MojoRendererImpl();
+
+ // Renderer implementation.
+ virtual void Initialize(const base::Closure& init_cb,
+ const StatisticsCB& statistics_cb,
+ const base::Closure& ended_cb,
+ const PipelineStatusCB& error_cb,
+ const BufferingStateCB& buffering_state_cb,
+ const TimeDeltaCB& get_duration_cb) OVERRIDE;
+ virtual void Flush(const base::Closure& flush_cb) OVERRIDE;
+ virtual void StartPlayingFrom(base::TimeDelta time) OVERRIDE;
+ virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
+ virtual void SetVolume(float volume) OVERRIDE;
+ virtual base::TimeDelta GetMediaTime() OVERRIDE;
+ virtual bool HasAudio() OVERRIDE;
+ virtual bool HasVideo() OVERRIDE;
+ virtual void SetCdm(MediaKeys* cdm) OVERRIDE;
+
+ // mojo::MediaRendererClient implementation.
+ virtual void OnTimeUpdate(int64_t time_usec,
+ int64_t max_time_usec) MOJO_OVERRIDE;
+ virtual void OnBufferingStateChange(
+ mojo::BufferingState state) MOJO_OVERRIDE;
+ virtual void OnEnded() MOJO_OVERRIDE;
+ virtual void OnError() MOJO_OVERRIDE;
+
+ private:
+ // Task runner used to execute pipeline tasks.
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+
+ Demuxer* demuxer_;
+ mojo::MediaRendererPtr remote_audio_renderer_;
xhwang 2014/09/10 00:00:52 s/remote_audio_renderer_/remote_renderer_/ ?
tim (not reviewing) 2014/09/10 23:08:30 Hmm. I was thinking of this as the analog to the
xhwang 2014/09/15 04:57:29 I see your point here. Let's keep this and iterate
tim (not reviewing) 2014/09/15 21:52:51 Acknowledged.
+
+ // Callbacks passed to Initialize that we forward messages from
scherkus (not reviewing) 2014/09/09 20:35:32 Initialize()
tim (not reviewing) 2014/09/10 23:08:30 Dang it! I thought I caught all of these :)
+ // |remote_audio_renderer_| through.
+ base::Closure ended_cb_;
+ PipelineStatusCB error_cb_;
+ BufferingStateCB buffering_state_cb_;
+
+ base::WeakPtrFactory<MojoRendererImpl> weak_factory_;
+ DISALLOW_COPY_AND_ASSIGN(MojoRendererImpl);
+};
+
+} // namespace media
+
+#endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698