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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 IPC_MESSAGE_HANDLER(AudioHostMsg_PauseStream, OnPauseStream) | 187 IPC_MESSAGE_HANDLER(AudioHostMsg_PauseStream, OnPauseStream) |
188 IPC_MESSAGE_HANDLER(AudioHostMsg_FlushStream, OnFlushStream) | 188 IPC_MESSAGE_HANDLER(AudioHostMsg_FlushStream, OnFlushStream) |
189 IPC_MESSAGE_HANDLER(AudioHostMsg_CloseStream, OnCloseStream) | 189 IPC_MESSAGE_HANDLER(AudioHostMsg_CloseStream, OnCloseStream) |
190 IPC_MESSAGE_HANDLER(AudioHostMsg_SetVolume, OnSetVolume) | 190 IPC_MESSAGE_HANDLER(AudioHostMsg_SetVolume, OnSetVolume) |
191 IPC_MESSAGE_UNHANDLED(handled = false) | 191 IPC_MESSAGE_UNHANDLED(handled = false) |
192 IPC_END_MESSAGE_MAP_EX() | 192 IPC_END_MESSAGE_MAP_EX() |
193 | 193 |
194 return handled; | 194 return handled; |
195 } | 195 } |
196 | 196 |
197 // TODO(miu): AudioRendererHost will keep track of the render_view_id associated | |
198 // with the created audio stream in a soon-upcoming change. | |
197 void AudioRendererHost::OnCreateStream( | 199 void AudioRendererHost::OnCreateStream( |
198 int stream_id, const media::AudioParameters& params, int input_channels) { | 200 int render_view_id, int stream_id, const media::AudioParameters& params, |
201 int input_channels) { | |
199 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
200 DCHECK(LookupById(stream_id) == NULL); | 203 DCHECK(LookupById(stream_id) == NULL); |
201 | 204 |
205 // TODO(miu): There is still code in the renderer which has been stubbed out, | |
206 // and should be implemented to plumb in the source render_view_id. In debug | |
207 // mode, log a WARNING until this is resolved. | |
208 DLOG_IF(WARNING, render_view_id <= 0) | |
209 << ("FIXME: AudioRendererHost::OnCreateStream called with unknown render " | |
210 "view."); | |
211 VLOG(1) << "AudioRendererHost@" << this | |
Chris Rogers
2012/10/17 20:43:11
DVLOG
miu
2012/10/17 22:06:30
Done.
| |
212 << "::OnCreateStream(render_view_id=" << render_view_id | |
213 << ", stream_id=" << stream_id << ")"; | |
214 | |
202 media::AudioParameters audio_params(params); | 215 media::AudioParameters audio_params(params); |
203 uint32 buffer_size = media::AudioBus::CalculateMemorySize(audio_params); | 216 uint32 buffer_size = media::AudioBus::CalculateMemorySize(audio_params); |
204 DCHECK_GT(buffer_size, 0U); | 217 DCHECK_GT(buffer_size, 0U); |
205 DCHECK_LE(buffer_size, | 218 DCHECK_LE(buffer_size, |
206 static_cast<uint32>(media::limits::kMaxPacketSizeInBytes)); | 219 static_cast<uint32>(media::limits::kMaxPacketSizeInBytes)); |
207 | 220 |
208 DCHECK_GE(input_channels, 0); | 221 DCHECK_GE(input_channels, 0); |
209 DCHECK_LT(input_channels, media::limits::kMaxChannels); | 222 DCHECK_LT(input_channels, media::limits::kMaxChannels); |
210 | 223 |
211 // Calculate output and input memory size. | 224 // Calculate output and input memory size. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 | 410 |
398 // Iterate the map of entries. | 411 // Iterate the map of entries. |
399 // TODO(hclam): Implement a faster look up method. | 412 // TODO(hclam): Implement a faster look up method. |
400 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 413 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
401 i != audio_entries_.end(); ++i) { | 414 i != audio_entries_.end(); ++i) { |
402 if (!i->second->pending_close && controller == i->second->controller.get()) | 415 if (!i->second->pending_close && controller == i->second->controller.get()) |
403 return i->second; | 416 return i->second; |
404 } | 417 } |
405 return NULL; | 418 return NULL; |
406 } | 419 } |
OLD | NEW |