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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (!writer->Init()) { | 261 if (!writer->Init()) { |
262 SendErrorMessage(stream_id); | 262 SendErrorMessage(stream_id); |
263 return; | 263 return; |
264 } | 264 } |
265 | 265 |
266 // If we have successfully created the SyncWriter then assign it to the | 266 // If we have successfully created the SyncWriter then assign it to the |
267 // entry and construct an AudioInputController. | 267 // entry and construct an AudioInputController. |
268 entry->writer.reset(writer.release()); | 268 entry->writer.reset(writer.release()); |
269 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { | 269 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { |
270 entry->controller = media::AudioInputController::CreateForStream( | 270 entry->controller = media::AudioInputController::CreateForStream( |
271 audio_manager_->GetWorkerLoop(), | 271 audio_manager_->GetMessageLoop(), |
272 this, | 272 this, |
273 WebContentsAudioInputStream::Create( | 273 WebContentsAudioInputStream::Create( |
274 device_id, audio_params, audio_manager_->GetWorkerLoop()), | 274 device_id, audio_params, audio_manager_->GetWorkerLoop()), |
275 entry->writer.get()); | 275 entry->writer.get()); |
276 } else { | 276 } else { |
277 // TODO(henrika): replace CreateLowLatency() with Create() as soon | 277 // TODO(henrika): replace CreateLowLatency() with Create() as soon |
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_, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.get()) | 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 |