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_input_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_input_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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 << stream_id << ", session_id = " << session_id << ")"; | 176 << stream_id << ", session_id = " << session_id << ")"; |
177 | 177 |
178 // Add the session entry to the map. | 178 // Add the session entry to the map. |
179 session_entries_[session_id] = stream_id; | 179 session_entries_[session_id] = stream_id; |
180 | 180 |
181 // Start the device with the session_id. If the device is started | 181 // Start the device with the session_id. If the device is started |
182 // successfully, OnDeviceStarted() callback will be triggered. | 182 // successfully, OnDeviceStarted() callback will be triggered. |
183 media_stream_manager_->audio_input_device_manager()->Start(session_id, this); | 183 media_stream_manager_->audio_input_device_manager()->Start(session_id, this); |
184 } | 184 } |
185 | 185 |
| 186 // TODO(miu): AudioInputRendererHost will keep track of the render_view_id |
| 187 // associated with the created audio stream in a soon-upcoming change. |
186 void AudioInputRendererHost::OnCreateStream( | 188 void AudioInputRendererHost::OnCreateStream( |
187 int stream_id, const media::AudioParameters& params, | 189 int render_view_id, int stream_id, const media::AudioParameters& params, |
188 const std::string& device_id, bool automatic_gain_control) { | 190 const std::string& device_id, bool automatic_gain_control) { |
189 VLOG(1) << "AudioInputRendererHost::OnCreateStream(stream_id=" | |
190 << stream_id << ")"; | |
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
192 DCHECK(LookupById(stream_id) == NULL); | 192 DCHECK(LookupById(stream_id) == NULL); |
193 | 193 |
| 194 // TODO(miu): There is still code in the renderer which has been stubbed out, |
| 195 // and should be implemented to plumb in the source render_view_id. See |
| 196 // http://crbug.com/156535. In debug mode, log a WARNING until this is |
| 197 // resolved. |
| 198 DLOG_IF(WARNING, render_view_id <= 0) |
| 199 << ("FIXME: AudioInputRendererHost::OnCreateStream called with unknown " |
| 200 "render view."); |
| 201 DVLOG(1) << "AudioInputRendererHost@" << this |
| 202 << "::OnCreateStream(render_view_id=" << render_view_id |
| 203 << ", stream_id=" << stream_id << ")"; |
| 204 |
194 media::AudioParameters audio_params(params); | 205 media::AudioParameters audio_params(params); |
195 | 206 |
196 DCHECK_GT(audio_params.frames_per_buffer(), 0); | 207 DCHECK_GT(audio_params.frames_per_buffer(), 0); |
197 uint32 buffer_size = audio_params.GetBytesPerBuffer(); | 208 uint32 buffer_size = audio_params.GetBytesPerBuffer(); |
198 | 209 |
199 // Create a new AudioEntry structure. | 210 // Create a new AudioEntry structure. |
200 scoped_ptr<AudioEntry> entry(new AudioEntry()); | 211 scoped_ptr<AudioEntry> entry(new AudioEntry()); |
201 | 212 |
202 uint32 mem_size = sizeof(media::AudioInputBufferParameters) + buffer_size; | 213 uint32 mem_size = sizeof(media::AudioInputBufferParameters) + buffer_size; |
203 | 214 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 411 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
401 | 412 |
402 for (SessionEntryMap::iterator it = session_entries_.begin(); | 413 for (SessionEntryMap::iterator it = session_entries_.begin(); |
403 it != session_entries_.end(); ++it) { | 414 it != session_entries_.end(); ++it) { |
404 if (stream_id == it->second) { | 415 if (stream_id == it->second) { |
405 return it->first; | 416 return it->first; |
406 } | 417 } |
407 } | 418 } |
408 return 0; | 419 return 0; |
409 } | 420 } |
OLD | NEW |