Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1789)

Unified Diff: content/browser/renderer_host/media/audio_input_device_manager.cc

Issue 260073013: Added automatic mode to FakeInputAudioStream to generate automatic beeps (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/audio/fake_audio_input_stream.h » ('j') | media/audio/fake_audio_input_stream.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/audio_input_device_manager.cc
diff --git a/content/browser/renderer_host/media/audio_input_device_manager.cc b/content/browser/renderer_host/media/audio_input_device_manager.cc
index 8d0377d859d63edd85d6da7fb5eae98370c143be..112d796e3ac80759a3179b2666d6fbfa13669214 100644
--- a/content/browser/renderer_host/media/audio_input_device_manager.cc
+++ b/content/browser/renderer_host/media/audio_input_device_manager.cc
@@ -19,6 +19,9 @@ namespace content {
const int AudioInputDeviceManager::kFakeOpenSessionId = 1;
+const char kFakeDeviceName[] = "Fake Audio";
+const char kFakeDeviceId[] = "fake_audio";
+
namespace {
// Starting id for the first capture session.
const int kFirstSessionId = AudioInputDeviceManager::kFakeOpenSessionId + 1;
@@ -32,8 +35,8 @@ AudioInputDeviceManager::AudioInputDeviceManager(
audio_manager_(audio_manager) {
// TODO(xians): Remove this fake_device after the unittests do not need it.
StreamDeviceInfo fake_device(MEDIA_DEVICE_AUDIO_CAPTURE,
- media::AudioManagerBase::kDefaultDeviceName,
- media::AudioManagerBase::kDefaultDeviceId,
+ kFakeDeviceName,
+ kFakeDeviceName,
DaleCurtis 2014/04/29 17:33:31 FakeDeviceId?
no longer working on chromium 2014/05/02 14:30:47 Done.
44100, media::CHANNEL_LAYOUT_STEREO,
0);
fake_device.session_id = kFakeOpenSessionId;
@@ -139,19 +142,18 @@ void AudioInputDeviceManager::EnumerateOnDeviceThread(
}
scoped_ptr<StreamDeviceInfoArray> devices(new StreamDeviceInfoArray());
- for (media::AudioDeviceNames::iterator it = device_names.begin();
- it != device_names.end(); ++it) {
- // Add device information to device vector.
- devices->push_back(StreamDeviceInfo(
- stream_type, it->device_name, it->unique_id));
- }
-
- // If the |use_fake_device_| flag is on, inject the fake device if there is
- // no available device on the OS.
- if (use_fake_device_ && devices->empty()) {
- devices->push_back(StreamDeviceInfo(
- stream_type, media::AudioManagerBase::kDefaultDeviceName,
- media::AudioManagerBase::kDefaultDeviceId));
+ // If the |use_fake_device_| flag is on or there is no available device on
+ // the OS, inject the fake device.
+ if (use_fake_device_ || devices->empty()) {
DaleCurtis 2014/04/29 17:33:31 Won't devices() always be empty()? You're construc
phoglund_chromium 2014/04/30 08:03:49 Yeah, looks like the else branch will never be tak
no longer working on chromium 2014/05/02 14:30:47 Ah, right, I just missed that devices were differe
no longer working on chromium 2014/05/02 14:30:47 That was what I was thinking but realized that it
+ devices->push_back(StreamDeviceInfo(stream_type, kFakeDeviceName,
+ kFakeDeviceId));
+ } else {
+ for (media::AudioDeviceNames::iterator it = device_names.begin();
+ it != device_names.end(); ++it) {
+ // Add device information to device vector.
+ devices->push_back(StreamDeviceInfo(
+ stream_type, it->device_name, it->unique_id));
+ }
DaleCurtis 2014/04/29 17:33:31 You're no longer injecting a fake device if no dev
no longer working on chromium 2014/05/02 14:30:47 We don't inject the fake device in production. The
}
// Return the device list through the listener by posting a task on
« no previous file with comments | « no previous file | media/audio/fake_audio_input_stream.h » ('j') | media/audio/fake_audio_input_stream.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698