| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if (!writer->Init()) { | 262 if (!writer->Init()) { |
| 263 SendErrorMessage(stream_id); | 263 SendErrorMessage(stream_id); |
| 264 return; | 264 return; |
| 265 } | 265 } |
| 266 | 266 |
| 267 // If we have successfully created the SyncWriter then assign it to the | 267 // If we have successfully created the SyncWriter then assign it to the |
| 268 // entry and construct an AudioInputController. | 268 // entry and construct an AudioInputController. |
| 269 entry->writer.reset(writer.release()); | 269 entry->writer.reset(writer.release()); |
| 270 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { | 270 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { |
| 271 entry->controller = media::AudioInputController::CreateForStream( | 271 entry->controller = media::AudioInputController::CreateForStream( |
| 272 audio_manager_->GetMessageLoop(), | 272 audio_manager_->GetTaskRunner(), |
| 273 this, | 273 this, |
| 274 WebContentsAudioInputStream::Create(device_id, | 274 WebContentsAudioInputStream::Create( |
| 275 audio_params, | 275 device_id, |
| 276 audio_manager_->GetWorkerLoop(), | 276 audio_params, |
| 277 audio_mirroring_manager_), | 277 audio_manager_->GetWorkerTaskRunner(), |
| 278 audio_mirroring_manager_), |
| 278 entry->writer.get(), | 279 entry->writer.get(), |
| 279 user_input_monitor_); | 280 user_input_monitor_); |
| 280 } else { | 281 } else { |
| 281 // TODO(henrika): replace CreateLowLatency() with Create() as soon | 282 // TODO(henrika): replace CreateLowLatency() with Create() as soon |
| 282 // as satish has ensured that Speech Input also uses the default low- | 283 // as satish has ensured that Speech Input also uses the default low- |
| 283 // latency path. See crbug.com/112472 for details. | 284 // latency path. See crbug.com/112472 for details. |
| 284 entry->controller = | 285 entry->controller = |
| 285 media::AudioInputController::CreateLowLatency(audio_manager_, | 286 media::AudioInputController::CreateLowLatency(audio_manager_, |
| 286 this, | 287 this, |
| 287 audio_params, | 288 audio_params, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // TODO(hclam): Implement a faster look up method. | 401 // TODO(hclam): Implement a faster look up method. |
| 401 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 402 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
| 402 i != audio_entries_.end(); ++i) { | 403 i != audio_entries_.end(); ++i) { |
| 403 if (controller == i->second->controller.get()) | 404 if (controller == i->second->controller.get()) |
| 404 return i->second; | 405 return i->second; |
| 405 } | 406 } |
| 406 return NULL; | 407 return NULL; |
| 407 } | 408 } |
| 408 | 409 |
| 409 } // namespace content | 410 } // namespace content |
| OLD | NEW |