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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_AUDIO_RENDERER_SINK_IMPL_H_
6 #define MEDIA_MOJO_CLIENTS_MOJO_AUDIO_RENDERER_SINK_IMPL_H_
7
8 #include <memory>
9
10 #include "media/base/audio_renderer_sink.h"
11 #include "media/mojo/interfaces/audio_renderer_sink.mojom.h"
12 #include "mojo/public/cpp/bindings/binding.h"
13
14 namespace media {
15
16 class MojoAudioRendererSinkImpl
17 : public NON_EXPORTED_BASE(media::AudioRendererSink::RenderCallback),
18 public mojom::AudioRendererSink {
19 public:
20 MojoAudioRendererSinkImpl(
21 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
22 media::AudioRendererSink* sink,
23 mojo::InterfaceRequest<mojom::AudioRendererSink> request);
24 ~MojoAudioRendererSinkImpl() override;
25
26 // AudioRendererSink::RenderCallback implementation.
27 int Render(base::TimeDelta delay,
28 base::TimeTicks delay_timestamp,
29 int prior_frames_skipped,
30 AudioBus* dest) override;
31 void OnRenderError() override;
32
33 // mojom::AudioRendererSink implementation.
34 void Initialize(
35 const media::AudioParameters& params,
36 mojom::AudioRendererSinkRenderCallbackPtr render_callback) final;
37 void Start() final;
38 void Stop() final;
39 void Pause() final;
40 void Play() final;
41 void SetVolume(double volume, const SetVolumeCallback& callback) final;
42 void GetOutputDeviceInfo(const GetOutputDeviceInfoCallback& callback) final;
43 void CurrentThreadIsRenderingThread(
44 const CurrentThreadIsRenderingThreadCallback& callback) final;
45
46 // Sets an error handler that will be called if a connection error occurs on
47 // the bound message pipe.
48 void set_connection_error_handler(const base::Closure& error_handler) {
49 binding_.set_connection_error_handler(error_handler);
50 }
51
52 private:
53 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
54 scoped_refptr<base::SingleThreadTaskRunner> audio_device_task_runner_;
55
56 mojo::Binding<mojom::AudioRendererSink> binding_;
57
58 media::AudioRendererSink* sink_;
59 bool started_;
60
61 mojom::AudioRendererSinkRenderCallbackPtrInfo callback_info_;
62 mojom::AudioRendererSinkRenderCallbackPtr callback_;
63 };
64
65 } // namespace media
66
67 #endif // MEDIA_MOJO_CLIENTS_MOJO_AUDIO_RENDERER_SINK_IMPL_H_
OLDNEW
« 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