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 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 IPC_MESSAGE_HANDLER(AudioHostMsg_FlushStream, OnFlushStream) | 185 IPC_MESSAGE_HANDLER(AudioHostMsg_FlushStream, OnFlushStream) |
186 IPC_MESSAGE_HANDLER(AudioHostMsg_CloseStream, OnCloseStream) | 186 IPC_MESSAGE_HANDLER(AudioHostMsg_CloseStream, OnCloseStream) |
187 IPC_MESSAGE_HANDLER(AudioHostMsg_SetVolume, OnSetVolume) | 187 IPC_MESSAGE_HANDLER(AudioHostMsg_SetVolume, OnSetVolume) |
188 IPC_MESSAGE_UNHANDLED(handled = false) | 188 IPC_MESSAGE_UNHANDLED(handled = false) |
189 IPC_END_MESSAGE_MAP_EX() | 189 IPC_END_MESSAGE_MAP_EX() |
190 | 190 |
191 return handled; | 191 return handled; |
192 } | 192 } |
193 | 193 |
194 void AudioRendererHost::OnCreateStream( | 194 void AudioRendererHost::OnCreateStream( |
195 int stream_id, const media::AudioParameters& params) { | 195 int render_view_id, |
| 196 int stream_id, |
| 197 const media::AudioParameters& params) { |
196 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
197 DCHECK(LookupById(stream_id) == NULL); | 199 DCHECK(LookupById(stream_id) == NULL); |
198 | 200 |
199 media::AudioParameters audio_params(params); | 201 media::AudioParameters audio_params(params); |
200 DCHECK_GT(audio_params.frames_per_buffer(), 0); | 202 DCHECK_GT(audio_params.frames_per_buffer(), 0); |
201 | 203 |
202 uint32 buffer_size = audio_params.GetBytesPerBuffer(); | 204 uint32 buffer_size = audio_params.GetBytesPerBuffer(); |
203 | 205 |
204 scoped_ptr<AudioEntry> entry(new AudioEntry()); | 206 scoped_ptr<AudioEntry> entry(new AudioEntry()); |
205 | 207 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 378 |
377 // Iterate the map of entries. | 379 // Iterate the map of entries. |
378 // TODO(hclam): Implement a faster look up method. | 380 // TODO(hclam): Implement a faster look up method. |
379 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 381 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
380 i != audio_entries_.end(); ++i) { | 382 i != audio_entries_.end(); ++i) { |
381 if (!i->second->pending_close && controller == i->second->controller.get()) | 383 if (!i->second->pending_close && controller == i->second->controller.get()) |
382 return i->second; | 384 return i->second; |
383 } | 385 } |
384 return NULL; | 386 return NULL; |
385 } | 387 } |
OLD | NEW |