| 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_RECORDING_IMPL_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/threading/thread_checker.h" |
| 16 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 17 #include "content/common/content_export.h" |
| 18 #include "content/common/media/audio_output.mojom.h" |
| 19 #include "mojo/public/cpp/bindings/binding.h" |
| 20 #include "mojo/public/cpp/bindings/interface_request.h" |
| 21 |
| 22 namespace base { |
| 23 class FilePath; |
| 24 } |
| 25 |
| 26 namespace content { |
| 27 |
| 28 // This class must always be accessed from the creation thread. |
| 29 class CONTENT_EXPORT AudioOutputImpl : NON_EXPORTED_BASE(public AudioOutput) { |
| 30 public: |
| 31 AudioOutputImpl(scoped_refptr<AudioRendererHost> audio_renderer_host, |
| 32 AudioOutputRequest request); |
| 33 |
| 34 ~AudioOutputImpl() override; |
| 35 |
| 36 static void Create(scoped_refptr<AudioRendererHost> audio_renderer_host, |
| 37 AudioOutputRequest request) { |
| 38 new AudioOutputImpl(audio_renderer_host, std::move(request)); |
| 39 } |
| 40 |
| 41 int render_host_id() const { return render_host_id_; } |
| 42 void InitMojo(mojo::InterfaceRequest<AudioOutput> request); |
| 43 |
| 44 private: |
| 45 void CloseStream(int32_t id) override; |
| 46 void CreateStream(int stream_id_, |
| 47 int render_frame_id_, |
| 48 AudioOutputStreamParametersPtr params, |
| 49 const CreateStreamCallback& callback) override; |
| 50 void DoCloseStream(int32_t id); |
| 51 |
| 52 // Mojo connection error callback. |
| 53 void OnDisconnect(AudioOutputImpl* impl); |
| 54 |
| 55 // Render process host ID. |
| 56 int render_host_id_; |
| 57 |
| 58 scoped_refptr<AudioRendererHost> audio_renderer_host_; |
| 59 |
| 60 base::ThreadChecker thread_checker_; |
| 61 mojo::Binding<AudioOutput> binding_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(AudioOutputImpl); |
| 64 }; |
| 65 |
| 66 } // namespace content |
| 67 |
| 68 #endif // CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_IMPL_H_ |
| OLD | NEW |