| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 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_MEDIA_AUDIO_OUTPUT_IMPL_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/id_map.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/thread_checker.h" |
| 15 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 16 #include "content/common/content_export.h" |
| 17 #include "content/common/media/audio_output.mojom.h" |
| 18 #include "mojo/public/cpp/bindings/binding.h" |
| 19 #include "mojo/public/cpp/bindings/interface_request.h" |
| 20 |
| 21 namespace base { |
| 22 class FilePath; |
| 23 } |
| 24 |
| 25 namespace content { |
| 26 |
| 27 class AudioOutputStreamImpl : public mojom::AudioOutputStream { |
| 28 public: |
| 29 explicit AudioOutputStreamImpl( |
| 30 mojo::InterfaceRequest<mojom::AudioOutputStream> request, |
| 31 AudioEntry* entry, |
| 32 int stream_id, |
| 33 AudioRendererHost* audio_renderer_host); |
| 34 void set(int a) override; |
| 35 void Play(const PlayCallback& callback) override; |
| 36 ~AudioOutputStreamImpl() override; |
| 37 |
| 38 private: |
| 39 int a_; |
| 40 mojo::Binding<mojom::AudioOutputStream> binding_; |
| 41 AudioEntry* entry_; |
| 42 int stream_id_; |
| 43 AudioRendererHost* audio_renderer_host_; |
| 44 DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamImpl); |
| 45 }; |
| 46 |
| 47 // This class must always be accessed from the creation thread. |
| 48 class CONTENT_EXPORT AudioOutputImpl |
| 49 : NON_EXPORTED_BASE(public mojom::AudioOutput) { |
| 50 public: |
| 51 AudioOutputImpl(AudioRendererHost* audio_renderer_host, |
| 52 mojom::AudioOutputRequest request); |
| 53 |
| 54 ~AudioOutputImpl() override; |
| 55 |
| 56 static void Create(scoped_refptr<AudioRendererHost> audio_renderer_host, |
| 57 mojom::AudioOutputRequest request) { |
| 58 new AudioOutputImpl(audio_renderer_host.get(), std::move(request)); |
| 59 } |
| 60 |
| 61 int render_host_id() const { return render_host_id_; } |
| 62 void InitMojo(mojo::InterfaceRequest<mojom::AudioOutput> request); |
| 63 |
| 64 static mojom::AudioOutputStreamPtr* CreateStream(AudioEntry* entry, |
| 65 int stream_id); |
| 66 |
| 67 // static scoped_ptr<AudioOutputStreamImpl> stream_ptr; |
| 68 private: |
| 69 void CloseStream(int32_t id) override; |
| 70 void CreateStream(int stream_id, |
| 71 int render_frame_id, |
| 72 mojom::AudioOutputStreamParametersPtr params, |
| 73 const CreateStreamCallback& callback) override; |
| 74 void DoCloseStream(int32_t id); |
| 75 |
| 76 // Mojo connection error callback. |
| 77 void OnDisconnect(AudioOutputImpl* impl); |
| 78 |
| 79 // Render process host ID. |
| 80 int render_host_id_; |
| 81 |
| 82 static AudioRendererHost* audio_renderer_host_; |
| 83 |
| 84 base::ThreadChecker thread_checker_; |
| 85 mojo::Binding<AudioOutput> binding_; |
| 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(AudioOutputImpl); |
| 88 }; |
| 89 |
| 90 } // namespace content |
| 91 |
| 92 #endif // CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_IMPL_H_ |
| OLD | NEW |