OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Audio rendering unit utilizing audio output stream provided by browser | 5 // Audio rendering unit utilizing audio output stream provided by browser |
6 // process through IPC. | 6 // process through IPC. |
7 // | 7 // |
8 // Relationship of classes. | 8 // Relationship of classes. |
9 // | 9 // |
10 // AudioOutputController AudioOutputDevice | 10 // AudioOutputController AudioOutputDevice |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // Implementation notes: | 55 // Implementation notes: |
56 // - The user must call Stop() before deleting the class instance. | 56 // - The user must call Stop() before deleting the class instance. |
57 | 57 |
58 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ | 58 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ |
59 #define MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ | 59 #define MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ |
60 | 60 |
61 #include "base/basictypes.h" | 61 #include "base/basictypes.h" |
62 #include "base/bind.h" | 62 #include "base/bind.h" |
63 #include "base/memory/scoped_ptr.h" | 63 #include "base/memory/scoped_ptr.h" |
64 #include "base/memory/shared_memory.h" | 64 #include "base/memory/shared_memory.h" |
65 #include "base/message_loop/message_loop.h" | |
66 #include "media/audio/audio_device_thread.h" | 65 #include "media/audio/audio_device_thread.h" |
67 #include "media/audio/audio_output_ipc.h" | 66 #include "media/audio/audio_output_ipc.h" |
68 #include "media/audio/audio_parameters.h" | 67 #include "media/audio/audio_parameters.h" |
69 #include "media/audio/scoped_loop_observer.h" | 68 #include "media/audio/scoped_task_runner_observer.h" |
70 #include "media/base/audio_renderer_sink.h" | 69 #include "media/base/audio_renderer_sink.h" |
71 #include "media/base/media_export.h" | 70 #include "media/base/media_export.h" |
72 | 71 |
73 namespace media { | 72 namespace media { |
74 | 73 |
75 class MEDIA_EXPORT AudioOutputDevice | 74 class MEDIA_EXPORT AudioOutputDevice |
76 : NON_EXPORTED_BASE(public AudioRendererSink), | 75 : NON_EXPORTED_BASE(public AudioRendererSink), |
77 NON_EXPORTED_BASE(public AudioOutputIPCDelegate), | 76 NON_EXPORTED_BASE(public AudioOutputIPCDelegate), |
78 NON_EXPORTED_BASE(public ScopedLoopObserver) { | 77 NON_EXPORTED_BASE(public ScopedTaskRunnerObserver) { |
79 public: | 78 public: |
80 // NOTE: Clients must call Initialize() before using. | 79 // NOTE: Clients must call Initialize() before using. |
81 AudioOutputDevice(scoped_ptr<AudioOutputIPC> ipc, | 80 AudioOutputDevice( |
82 const scoped_refptr<base::MessageLoopProxy>& io_loop); | 81 scoped_ptr<AudioOutputIPC> ipc, |
| 82 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
83 | 83 |
84 // Initialize function for clients wishing to have unified input and | 84 // Initialize function for clients wishing to have unified input and |
85 // output, |params| may specify |input_channels| > 0, representing a | 85 // output, |params| may specify |input_channels| > 0, representing a |
86 // number of input channels which will be at the same sample-rate | 86 // number of input channels which will be at the same sample-rate |
87 // and buffer-size as the output as specified in |params|. |session_id| is | 87 // and buffer-size as the output as specified in |params|. |session_id| is |
88 // used for the browser to select the correct input device. | 88 // used for the browser to select the correct input device. |
89 // In this case, the callback's RenderIO() method will be called instead | 89 // In this case, the callback's RenderIO() method will be called instead |
90 // of Render(), providing the synchronized input data at the same time as | 90 // of Render(), providing the synchronized input data at the same time as |
91 // when new output data is to be rendered. | 91 // when new output data is to be rendered. |
92 void InitializeUnifiedStream(const AudioParameters& params, | 92 void InitializeUnifiedStream(const AudioParameters& params, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // TODO(scherkus): Replace this by changing AudioRendererSink to either accept | 176 // TODO(scherkus): Replace this by changing AudioRendererSink to either accept |
177 // the callback via Start(). See http://crbug.com/151051 for details. | 177 // the callback via Start(). See http://crbug.com/151051 for details. |
178 bool stopping_hack_; | 178 bool stopping_hack_; |
179 | 179 |
180 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); | 180 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); |
181 }; | 181 }; |
182 | 182 |
183 } // namespace media | 183 } // namespace media |
184 | 184 |
185 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ | 185 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ |
OLD | NEW |