Chromium Code Reviews| 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_RENDERER_MEDIA_AUDIO_OUTPUT_CLIENT_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_CLIENT_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/files/file.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/shared_memory_handle.h" | |
| 15 #include "base/sync_socket.h" | |
| 16 #include "base/threading/thread_checker.h" | |
| 17 #include "content/common/content_export.h" | |
| 18 #include "media/mojo/interfaces/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 SingleThreadTaskRunner; | |
| 24 } | |
| 25 | |
| 26 namespace media { | |
| 27 class AudioParameters; | |
| 28 } | |
| 29 | |
| 30 namespace content { | |
| 31 | |
| 32 class AudioMessageFilter; | |
| 33 class ServiceRegistry; | |
| 34 | |
| 35 | |
| 36 class CONTENT_EXPORT AudioOutputClient { | |
| 37 public: | |
| 38 explicit AudioOutputClient(ServiceRegistry* service_registry, | |
| 39 AudioMessageFilter* audio_message_filter); | |
| 40 | |
| 41 | |
| 42 ~AudioOutputClient(); | |
| 43 | |
| 44 void CreateStream(int stream_id, | |
|
Henrik Grunell
2016/04/19 15:36:09
Add comments to all functions.
rchtara
2016/04/21 09:10:18
Done.
| |
| 45 int render_frame_id, | |
| 46 const media::AudioParameters& params); | |
| 47 void CreateStreamOnMainThread(int stream_id, | |
| 48 int render_frame_id, | |
| 49 const media::AudioParameters& params); | |
| 50 void CreateStreamCallback(mojom::AudioOutputStreamPtr stream, | |
| 51 int stream_id, | |
| 52 mojo::ScopedSharedBufferHandle shared_buffer, | |
| 53 mojo::ScopedHandle socket_descriptor); | |
| 54 void CreateStreamOnIOThread( | |
| 55 mojom::AudioOutputStreamPtr* const stream, | |
| 56 base::SharedMemoryHandle handle, | |
| 57 base::SyncSocket::TransitDescriptor socket_descriptor, | |
| 58 uint32_t length); | |
| 59 | |
| 60 void CloseStream(int stream_id); | |
| 61 void CloseStreamOnMainThread(int stream_id); | |
| 62 | |
| 63 void OnStreamError(int stream_id); | |
| 64 void ReportErrorOnIOThread(int stream_id); | |
| 65 | |
| 66 private: | |
| 67 // Mojo connection error handler. | |
| 68 void OnConnectionError(); | |
| 69 | |
| 70 // The Mojo service for registering observers to listen for enable/disable | |
| 71 // events. | |
| 72 mojom::AudioOutputPtr service_; | |
| 73 std::map<int, scoped_ptr<mojom::AudioOutputStreamPtr>> streams_; | |
| 74 | |
| 75 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | |
| 76 AudioMessageFilter* audio_message_filter_; | |
|
Henrik Grunell
2016/04/19 15:36:09
How is it guaranteed that the filter outlives this
rchtara
2016/04/21 09:10:18
I will replace it by scoped_refptr<AudioMessageFil
| |
| 77 DISALLOW_COPY_AND_ASSIGN(AudioOutputClient); | |
| 78 }; | |
| 79 | |
| 80 } // namespace content | |
| 81 | |
| 82 #endif // CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_CLIENT_H_ | |
| OLD | NEW |