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

Unified Diff: media/mojo/clients/mojo_audio_renderer_sink_impl.h

Issue 2640003002: Implement MojoAudioRendererSink and use it in UtilityMojoMediaClient (Closed)
Patch Set: Rebase Created 3 years, 10 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/BUILD.gn ('k') | media/mojo/clients/mojo_audio_renderer_sink_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/clients/mojo_audio_renderer_sink_impl.h
diff --git a/media/mojo/clients/mojo_audio_renderer_sink_impl.h b/media/mojo/clients/mojo_audio_renderer_sink_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..ca5722f4b9abdd38ff6b62e5b500115812e8c10d
--- /dev/null
+++ b/media/mojo/clients/mojo_audio_renderer_sink_impl.h
@@ -0,0 +1,67 @@
+// Copyright 2017 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_CLIENTS_MOJO_AUDIO_RENDERER_SINK_IMPL_H_
+#define MEDIA_MOJO_CLIENTS_MOJO_AUDIO_RENDERER_SINK_IMPL_H_
+
+#include <memory>
+
+#include "media/base/audio_renderer_sink.h"
+#include "media/mojo/interfaces/audio_renderer_sink.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace media {
+
+class MojoAudioRendererSinkImpl
+ : public NON_EXPORTED_BASE(media::AudioRendererSink::RenderCallback),
+ public mojom::AudioRendererSink {
+ public:
+ MojoAudioRendererSinkImpl(
+ const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
+ media::AudioRendererSink* sink,
+ mojo::InterfaceRequest<mojom::AudioRendererSink> request);
+ ~MojoAudioRendererSinkImpl() override;
+
+ // AudioRendererSink::RenderCallback implementation.
+ int Render(base::TimeDelta delay,
+ base::TimeTicks delay_timestamp,
+ int prior_frames_skipped,
+ AudioBus* dest) override;
+ void OnRenderError() override;
+
+ // mojom::AudioRendererSink implementation.
+ void Initialize(
+ const media::AudioParameters& params,
+ mojom::AudioRendererSinkRenderCallbackPtr render_callback) final;
+ void Start() final;
+ void Stop() final;
+ void Pause() final;
+ void Play() final;
+ void SetVolume(double volume, const SetVolumeCallback& callback) final;
+ void GetOutputDeviceInfo(const GetOutputDeviceInfoCallback& callback) final;
+ void CurrentThreadIsRenderingThread(
+ const CurrentThreadIsRenderingThreadCallback& callback) final;
+
+ // Sets an error handler that will be called if a connection error occurs on
+ // the bound message pipe.
+ void set_connection_error_handler(const base::Closure& error_handler) {
+ binding_.set_connection_error_handler(error_handler);
+ }
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> audio_device_task_runner_;
+
+ mojo::Binding<mojom::AudioRendererSink> binding_;
+
+ media::AudioRendererSink* sink_;
+ bool started_;
+
+ mojom::AudioRendererSinkRenderCallbackPtrInfo callback_info_;
+ mojom::AudioRendererSinkRenderCallbackPtr callback_;
+};
+
+} // namespace media
+
+#endif // MEDIA_MOJO_CLIENTS_MOJO_AUDIO_RENDERER_SINK_IMPL_H_
« no previous file with comments | « media/mojo/clients/BUILD.gn ('k') | media/mojo/clients/mojo_audio_renderer_sink_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698