OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // AudioRendererHost serves audio related requests from AudioRenderer which | 5 // AudioRendererHost serves audio related requests from AudioRenderer which |
6 // lives inside the render process and provide access to audio hardware. It maps | 6 // lives inside the render process and provide access to audio hardware. It maps |
7 // an internal ID to AudioRendererHost::IPCAudioSource in a map, which is the | 7 // an internal ID to AudioRendererHost::IPCAudioSource in a map, which is the |
8 // actual object providing audio packets through IPC. It creates the actual | 8 // actual object providing audio packets through IPC. It creates the actual |
9 // AudioOutputStream object when requested by the renderer provided with | 9 // AudioOutputStream object when requested by the renderer provided with |
10 // render view id and stream id. | 10 // render view id and stream id. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 AudioRendererHost* host, // Host of this source. | 173 AudioRendererHost* host, // Host of this source. |
174 int process_id, // Process ID of renderer. | 174 int process_id, // Process ID of renderer. |
175 int route_id, // Routing ID to RenderView. | 175 int route_id, // Routing ID to RenderView. |
176 int stream_id, // ID of this source. | 176 int stream_id, // ID of this source. |
177 base::ProcessHandle process_handle, // Process handle of renderer. | 177 base::ProcessHandle process_handle, // Process handle of renderer. |
178 AudioManager::Format format, // Format of the stream. | 178 AudioManager::Format format, // Format of the stream. |
179 int channels, // Number of channels. | 179 int channels, // Number of channels. |
180 int sample_rate, // Sampling frequency/rate. | 180 int sample_rate, // Sampling frequency/rate. |
181 char bits_per_sample, // Number of bits per sample. | 181 char bits_per_sample, // Number of bits per sample. |
182 uint32 decoded_packet_size, // Number of bytes per packet. | 182 uint32 decoded_packet_size, // Number of bytes per packet. |
183 uint32 buffer_capacity // Number of bytes in the buffer. | 183 uint32 buffer_capacity, // Number of bytes in the buffer. |
| 184 bool low_latency // Use low-latency (socket) code |
184 ); | 185 ); |
185 ~IPCAudioSource(); | 186 ~IPCAudioSource(); |
186 | 187 |
187 // Methods to control playback of the stream. | 188 // Methods to control playback of the stream. |
188 // Starts the playback of this audio output stream. The internal state will | 189 // Starts the playback of this audio output stream. The internal state will |
189 // be updated to AudioOutputStream::STATE_STARTED and the state update is | 190 // be updated to AudioOutputStream::STATE_STARTED and the state update is |
190 // sent to the renderer. | 191 // sent to the renderer. |
191 void Play(); | 192 void Play(); |
192 | 193 |
193 // Pause this audio output stream. The audio output stream will stop | 194 // Pause this audio output stream. The audio output stream will stop |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // Returns true if the message is an audio related message and should be | 282 // Returns true if the message is an audio related message and should be |
282 // handled by this class. | 283 // handled by this class. |
283 bool IsAudioRendererHostMessage(const IPC::Message& message); | 284 bool IsAudioRendererHostMessage(const IPC::Message& message); |
284 | 285 |
285 // Audio related IPC message handlers. | 286 // Audio related IPC message handlers. |
286 // Creates an audio output stream with the specified format. If this call is | 287 // Creates an audio output stream with the specified format. If this call is |
287 // successful this object would keep an internal entry of the stream for the | 288 // successful this object would keep an internal entry of the stream for the |
288 // required properties. See IPCAudioSource::CreateIPCAudioSource() for more | 289 // required properties. See IPCAudioSource::CreateIPCAudioSource() for more |
289 // details. | 290 // details. |
290 void OnCreateStream(const IPC::Message& msg, int stream_id, | 291 void OnCreateStream(const IPC::Message& msg, int stream_id, |
291 const ViewHostMsg_Audio_CreateStream_Params& params); | 292 const ViewHostMsg_Audio_CreateStream_Params& params, |
| 293 bool low_latency); |
292 | 294 |
293 // Starts buffering for the audio output stream. Delegates the start method | 295 // Starts buffering for the audio output stream. Delegates the start method |
294 // call to the corresponding IPCAudioSource::Play(). | 296 // call to the corresponding IPCAudioSource::Play(). |
295 // ViewMsg_NotifyAudioStreamStateChanged with | 297 // ViewMsg_NotifyAudioStreamStateChanged with |
296 // AudioOutputStream::AUDIO_STREAM_ERROR is sent back to renderer if the | 298 // AudioOutputStream::AUDIO_STREAM_ERROR is sent back to renderer if the |
297 // required IPCAudioSource is not found. | 299 // required IPCAudioSource is not found. |
298 void OnPlayStream(const IPC::Message& msg, int stream_id); | 300 void OnPlayStream(const IPC::Message& msg, int stream_id); |
299 | 301 |
300 // Pauses the audio output stream. Delegates the pause method call to the | 302 // Pauses the audio output stream. Delegates the pause method call to the |
301 // corresponding IPCAudioSource::Pause(), | 303 // corresponding IPCAudioSource::Pause(), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 360 |
359 // A map of id to audio sources. | 361 // A map of id to audio sources. |
360 typedef std::pair<int32, int32> SourceID; | 362 typedef std::pair<int32, int32> SourceID; |
361 typedef std::map<SourceID, IPCAudioSource*> SourceMap; | 363 typedef std::map<SourceID, IPCAudioSource*> SourceMap; |
362 SourceMap sources_; | 364 SourceMap sources_; |
363 | 365 |
364 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 366 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
365 }; | 367 }; |
366 | 368 |
367 #endif // CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ | 369 #endif // CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ |
OLD | NEW |