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

Side by Side Diff: media/audio/audio_manager_base.cc

Issue 9691001: Audio software mixer. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "media/audio/audio_manager_base.h" 5 #include "media/audio/audio_manager_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h"
8 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
9 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
10 #include "media/audio/audio_output_dispatcher.h" 11 #include "media/audio/audio_output_dispatcher_impl.h"
12 #include "media/audio/audio_output_mixer.h"
11 #include "media/audio/audio_output_proxy.h" 13 #include "media/audio/audio_output_proxy.h"
12 #include "media/audio/fake_audio_input_stream.h" 14 #include "media/audio/fake_audio_input_stream.h"
13 #include "media/audio/fake_audio_output_stream.h" 15 #include "media/audio/fake_audio_output_stream.h"
16 #include "media/base/media_switches.h"
14 17
15 static const int kStreamCloseDelaySeconds = 5; 18 static const int kStreamCloseDelaySeconds = 5;
16 19
17 // Default maximum number of output streams that can be open simultaneously 20 // Default maximum number of output streams that can be open simultaneously
18 // for all platforms. 21 // for all platforms.
19 static const int kDefaultMaxOutputStreams = 16; 22 static const int kDefaultMaxOutputStreams = 16;
20 23
21 // Default maximum number of input streams that can be open simultaneously 24 // Default maximum number of input streams that can be open simultaneously
22 // for all platforms. 25 // for all platforms.
23 static const int kDefaultMaxInputStreams = 16; 26 static const int kDefaultMaxInputStreams = 16;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 130
128 return stream; 131 return stream;
129 } 132 }
130 133
131 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy( 134 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy(
132 const AudioParameters& params) { 135 const AudioParameters& params) {
133 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); 136 DCHECK(GetMessageLoop()->BelongsToCurrentThread());
134 137
135 scoped_refptr<AudioOutputDispatcher>& dispatcher = 138 scoped_refptr<AudioOutputDispatcher>& dispatcher =
136 output_dispatchers_[params]; 139 output_dispatchers_[params];
137 if (!dispatcher) 140 if (!dispatcher) {
138 dispatcher = new AudioOutputDispatcher( 141 base::TimeDelta close_delay =
139 this, params, base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds)); 142 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds);
143 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
144 if (cmd_line->HasSwitch(switches::kEnableAudioMixer)) {
145 dispatcher = new AudioOutputMixer(this, params, close_delay);
146 } else {
147 dispatcher = new AudioOutputDispatcherImpl(this, params, close_delay);
148 }
149 }
140 return new AudioOutputProxy(dispatcher); 150 return new AudioOutputProxy(dispatcher);
141 } 151 }
142 152
143 bool AudioManagerBase::CanShowAudioInputSettings() { 153 bool AudioManagerBase::CanShowAudioInputSettings() {
144 return false; 154 return false;
145 } 155 }
146 156
147 void AudioManagerBase::ShowAudioInputSettings() { 157 void AudioManagerBase::ShowAudioInputSettings() {
148 } 158 }
149 159
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // both physical audio stream objects that belong to the dispatcher as 229 // both physical audio stream objects that belong to the dispatcher as
220 // well as the message loop of the audio thread that will soon go away. 230 // well as the message loop of the audio thread that will soon go away.
221 // So, better crash now than later. 231 // So, better crash now than later.
222 CHECK(dispatcher->HasOneRef()) << "AudioOutputProxies are still alive"; 232 CHECK(dispatcher->HasOneRef()) << "AudioOutputProxies are still alive";
223 dispatcher = NULL; 233 dispatcher = NULL;
224 } 234 }
225 } 235 }
226 236
227 output_dispatchers_.clear(); 237 output_dispatchers_.clear();
228 } 238 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698