Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_IMPL_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_IMPL_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/single_thread_task_runner.h" | |
| 12 #include "content/browser/renderer_host/media/audio_output_delegate.h" | |
| 13 #include "content/common/content_export.h" | |
| 14 #include "media/mojo/interfaces/audio_output.mojom.h" | |
| 15 #include "mojo/public/cpp/bindings/binding.h" | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 class CONTENT_EXPORT AudioOutputImpl | |
| 20 : public media::mojom::AudioOutput, | |
| 21 public AudioOutputDelegate::EventHandler { | |
|
o1ka
2017/01/25 15:15:21
Can we use aggregation instead of inheritance (whe
| |
| 22 public: | |
| 23 using DelegateFactoryCallback = | |
|
o1ka
2017/01/25 15:15:21
CreateAudioOutputDelegateCallback maybe? Oe Create
| |
| 24 base::OnceCallback<AudioOutputDelegate::UniquePtr( | |
| 25 AudioOutputDelegate::EventHandler*, | |
| 26 const media::AudioParameters&)>; | |
| 27 | |
| 28 using FinishedCallback = base::OnceCallback<void(AudioOutputImpl*)>; | |
|
o1ka
2017/01/25 15:15:21
What this name stands for?
| |
| 29 | |
| 30 AudioOutputImpl(media::mojom::AudioOutputRequest request, | |
| 31 FinishedCallback finished_callback, | |
| 32 DelegateFactoryCallback delegate_factory_callback); | |
| 33 | |
| 34 ~AudioOutputImpl() override; | |
| 35 | |
| 36 // media::mojom::AudioOutput implementation. | |
| 37 // May only be called via mojo, not directly. | |
|
o1ka
2017/01/25 15:15:21
What does it mean?
| |
| 38 void Start(const media::AudioParameters& params, | |
| 39 const StartCallback& callback) override; | |
| 40 void Play() override; | |
| 41 void Pause() override; | |
| 42 void SetVolume(double volume) override; | |
| 43 | |
| 44 // AudioOutputDelegate::EventHandler implementation. | |
| 45 void OnStreamStateChanged(bool playing) override; | |
| 46 void OnStreamCreated(int stream_id, | |
| 47 base::SharedMemory* shared_memory, | |
| 48 base::CancelableSyncSocket* foreign_socket) override; | |
| 49 void OnStreamError(int stream_id) override; | |
| 50 | |
| 51 private: | |
| 52 // Closes connection to client and notifies owner. | |
| 53 void OnError(); | |
| 54 | |
| 55 StartCallback start_callback_; | |
| 56 DelegateFactoryCallback delegate_factory_callback_; | |
| 57 FinishedCallback finished_callback_; | |
| 58 mojo::Binding<AudioOutput> binding_; | |
| 59 AudioOutputDelegate::UniquePtr delegate_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(AudioOutputImpl); | |
| 62 }; | |
| 63 | |
| 64 } // namespace content | |
| 65 | |
| 66 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_IMPL_H_ | |
| OLD | NEW |