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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // as satish has ensured that Speech Input also uses the default low- | 278 // as satish has ensured that Speech Input also uses the default low- |
279 // latency path. See crbug.com/112472 for details. | 279 // latency path. See crbug.com/112472 for details. |
280 entry->controller = media::AudioInputController::CreateLowLatency( | 280 entry->controller = media::AudioInputController::CreateLowLatency( |
281 audio_manager_, | 281 audio_manager_, |
282 this, | 282 this, |
283 audio_params, | 283 audio_params, |
284 device_id, | 284 device_id, |
285 entry->writer.get()); | 285 entry->writer.get()); |
286 } | 286 } |
287 | 287 |
288 if (!entry->controller) { | 288 if (!entry->controller.get()) { |
289 SendErrorMessage(stream_id); | 289 SendErrorMessage(stream_id); |
290 return; | 290 return; |
291 } | 291 } |
292 | 292 |
293 // Set the initial AGC state for the audio input stream. Note that, the AGC | 293 // Set the initial AGC state for the audio input stream. Note that, the AGC |
294 // is only supported in AUDIO_PCM_LOW_LATENCY mode. | 294 // is only supported in AUDIO_PCM_LOW_LATENCY mode. |
295 if (config.params.format() == media::AudioParameters::AUDIO_PCM_LOW_LATENCY) | 295 if (config.params.format() == media::AudioParameters::AUDIO_PCM_LOW_LATENCY) |
296 entry->controller->SetAutomaticGainControl(config.automatic_gain_control); | 296 entry->controller->SetAutomaticGainControl(config.automatic_gain_control); |
297 | 297 |
298 // Since the controller was created successfully, create an entry and add it | 298 // Since the controller was created successfully, create an entry and add it |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } | 388 } |
389 | 389 |
390 AudioInputRendererHost::AudioEntry* AudioInputRendererHost::LookupByController( | 390 AudioInputRendererHost::AudioEntry* AudioInputRendererHost::LookupByController( |
391 media::AudioInputController* controller) { | 391 media::AudioInputController* controller) { |
392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
393 | 393 |
394 // Iterate the map of entries. | 394 // Iterate the map of entries. |
395 // TODO(hclam): Implement a faster look up method. | 395 // TODO(hclam): Implement a faster look up method. |
396 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 396 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
397 i != audio_entries_.end(); ++i) { | 397 i != audio_entries_.end(); ++i) { |
398 if (controller == i->second->controller) | 398 if (controller == i->second->controller.get()) |
399 return i->second; | 399 return i->second; |
400 } | 400 } |
401 return NULL; | 401 return NULL; |
402 } | 402 } |
403 | 403 |
404 } // namespace content | 404 } // namespace content |
OLD | NEW |