Chromium Code Reviews| 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" |
| 11 #include "content/browser/media/capture/web_contents_audio_input_stream.h" | |
| 12 #include "content/browser/media/capture/web_contents_capture_util.h" | |
| 11 #include "content/browser/media/media_internals.h" | 13 #include "content/browser/media/media_internals.h" |
| 12 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 14 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
| 13 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" | 15 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" |
| 14 #include "content/browser/renderer_host/media/media_stream_manager.h" | 16 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 15 #include "content/browser/renderer_host/media/web_contents_audio_input_stream.h" | |
| 16 #include "content/browser/renderer_host/media/web_contents_capture_util.h" | |
| 17 #include "media/audio/audio_manager_base.h" | 17 #include "media/audio/audio_manager_base.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 struct AudioInputRendererHost::AudioEntry { | 21 struct AudioInputRendererHost::AudioEntry { |
| 22 AudioEntry(); | 22 AudioEntry(); |
| 23 ~AudioEntry(); | 23 ~AudioEntry(); |
| 24 | 24 |
| 25 // The AudioInputController that manages the audio input stream. | 25 // The AudioInputController that manages the audio input stream. |
| 26 scoped_refptr<media::AudioInputController> controller; | 26 scoped_refptr<media::AudioInputController> controller; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 return; | 271 return; |
| 272 } | 272 } |
| 273 | 273 |
| 274 // If we have successfully created the SyncWriter then assign it to the | 274 // If we have successfully created the SyncWriter then assign it to the |
| 275 // entry and construct an AudioInputController. | 275 // entry and construct an AudioInputController. |
| 276 entry->writer.reset(writer.release()); | 276 entry->writer.reset(writer.release()); |
| 277 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { | 277 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { |
| 278 entry->controller = media::AudioInputController::CreateForStream( | 278 entry->controller = media::AudioInputController::CreateForStream( |
| 279 audio_manager_->GetTaskRunner(), | 279 audio_manager_->GetTaskRunner(), |
| 280 this, | 280 this, |
| 281 WebContentsAudioInputStream::Create( | 281 WebContentsAudioInputStream::Create( |
|
scherkus (not reviewing)
2014/02/20 18:46:56
I forget the details of the renderer_host-can't-de
miu
2014/02/20 21:29:03
I forget the details too. ;-) My understanding,
| |
| 282 device_id, | 282 device_id, |
| 283 audio_params, | 283 audio_params, |
| 284 audio_manager_->GetWorkerTaskRunner(), | 284 audio_manager_->GetWorkerTaskRunner(), |
| 285 audio_mirroring_manager_), | 285 audio_mirroring_manager_), |
| 286 entry->writer.get(), | 286 entry->writer.get(), |
| 287 user_input_monitor_); | 287 user_input_monitor_); |
| 288 } else { | 288 } else { |
| 289 // TODO(henrika): replace CreateLowLatency() with Create() as soon | 289 // TODO(henrika): replace CreateLowLatency() with Create() as soon |
| 290 // as satish has ensured that Speech Input also uses the default low- | 290 // as satish has ensured that Speech Input also uses the default low- |
| 291 // latency path. See crbug.com/112472 for details. | 291 // latency path. See crbug.com/112472 for details. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 // TODO(hclam): Implement a faster look up method. | 417 // TODO(hclam): Implement a faster look up method. |
| 418 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 418 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
| 419 i != audio_entries_.end(); ++i) { | 419 i != audio_entries_.end(); ++i) { |
| 420 if (controller == i->second->controller.get()) | 420 if (controller == i->second->controller.get()) |
| 421 return i->second; | 421 return i->second; |
| 422 } | 422 } |
| 423 return NULL; | 423 return NULL; |
| 424 } | 424 } |
| 425 | 425 |
| 426 } // namespace content | 426 } // namespace content |
| OLD | NEW |