| 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/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 if (!writer->Init()) { | 266 if (!writer->Init()) { |
| 267 SendErrorMessage(stream_id); | 267 SendErrorMessage(stream_id); |
| 268 return; | 268 return; |
| 269 } | 269 } |
| 270 | 270 |
| 271 // If we have successfully created the SyncWriter then assign it to the | 271 // If we have successfully created the SyncWriter then assign it to the |
| 272 // entry and construct an AudioInputController. | 272 // entry and construct an AudioInputController. |
| 273 entry->writer.reset(writer.release()); | 273 entry->writer.reset(writer.release()); |
| 274 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { | 274 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { |
| 275 entry->controller = media::AudioInputController::CreateForStream( | 275 entry->controller = media::AudioInputController::CreateForStream( |
| 276 audio_manager_->GetMessageLoop(), | 276 audio_manager_->GetTaskRunner(), |
| 277 this, | 277 this, |
| 278 WebContentsAudioInputStream::Create(device_id, | 278 WebContentsAudioInputStream::Create( |
| 279 audio_params, | 279 device_id, |
| 280 audio_manager_->GetWorkerLoop(), | 280 audio_params, |
| 281 audio_mirroring_manager_), | 281 audio_manager_->GetWorkerTaskRunner(), |
| 282 audio_mirroring_manager_), |
| 282 entry->writer.get(), | 283 entry->writer.get(), |
| 283 user_input_monitor_); | 284 user_input_monitor_); |
| 284 } else { | 285 } else { |
| 285 // TODO(henrika): replace CreateLowLatency() with Create() as soon | 286 // TODO(henrika): replace CreateLowLatency() with Create() as soon |
| 286 // as satish has ensured that Speech Input also uses the default low- | 287 // as satish has ensured that Speech Input also uses the default low- |
| 287 // latency path. See crbug.com/112472 for details. | 288 // latency path. See crbug.com/112472 for details. |
| 288 entry->controller = | 289 entry->controller = |
| 289 media::AudioInputController::CreateLowLatency(audio_manager_, | 290 media::AudioInputController::CreateLowLatency(audio_manager_, |
| 290 this, | 291 this, |
| 291 audio_params, | 292 audio_params, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // TODO(hclam): Implement a faster look up method. | 410 // TODO(hclam): Implement a faster look up method. |
| 410 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 411 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
| 411 i != audio_entries_.end(); ++i) { | 412 i != audio_entries_.end(); ++i) { |
| 412 if (controller == i->second->controller.get()) | 413 if (controller == i->second->controller.get()) |
| 413 return i->second; | 414 return i->second; |
| 414 } | 415 } |
| 415 return NULL; | 416 return NULL; |
| 416 } | 417 } |
| 417 | 418 |
| 418 } // namespace content | 419 } // namespace content |
| OLD | NEW |