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 1384983002: Revert of Check the current thread in AudioManagerBase::MakeAudio{Output,Input}Stream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Lazily start the worker thread. 131 // Lazily start the worker thread.
132 if (!audio_thread_.IsRunning()) 132 if (!audio_thread_.IsRunning())
133 CHECK(audio_thread_.Start()); 133 CHECK(audio_thread_.Start());
134 134
135 return audio_thread_.task_runner(); 135 return audio_thread_.task_runner();
136 } 136 }
137 137
138 AudioOutputStream* AudioManagerBase::MakeAudioOutputStream( 138 AudioOutputStream* AudioManagerBase::MakeAudioOutputStream(
139 const AudioParameters& params, 139 const AudioParameters& params,
140 const std::string& device_id) { 140 const std::string& device_id) {
141 DCHECK(task_runner_->BelongsToCurrentThread()); 141 // TODO(miu): Fix ~50 call points across several unit test modules to call
142 // this method on the audio thread, then uncomment the following:
143 // DCHECK(task_runner_->BelongsToCurrentThread());
142 144
143 if (!params.IsValid()) { 145 if (!params.IsValid()) {
144 DLOG(ERROR) << "Audio parameters are invalid"; 146 DLOG(ERROR) << "Audio parameters are invalid";
145 return NULL; 147 return NULL;
146 } 148 }
147 149
148 // Limit the number of audio streams opened. This is to prevent using 150 // Limit the number of audio streams opened. This is to prevent using
149 // excessive resources for a large number of audio streams. More 151 // excessive resources for a large number of audio streams. More
150 // importantly it prevents instability on certain systems. 152 // importantly it prevents instability on certain systems.
151 // See bug: http://crbug.com/30242. 153 // See bug: http://crbug.com/30242.
(...skipping 26 matching lines...) Expand all
178 if (stream) { 180 if (stream) {
179 ++num_output_streams_; 181 ++num_output_streams_;
180 } 182 }
181 183
182 return stream; 184 return stream;
183 } 185 }
184 186
185 AudioInputStream* AudioManagerBase::MakeAudioInputStream( 187 AudioInputStream* AudioManagerBase::MakeAudioInputStream(
186 const AudioParameters& params, 188 const AudioParameters& params,
187 const std::string& device_id) { 189 const std::string& device_id) {
188 DCHECK(task_runner_->BelongsToCurrentThread()); 190 // TODO(miu): Fix ~20 call points across several unit test modules to call
191 // this method on the audio thread, then uncomment the following:
192 // DCHECK(task_runner_->BelongsToCurrentThread());
189 193
190 if (!params.IsValid() || (params.channels() > kMaxInputChannels) || 194 if (!params.IsValid() || (params.channels() > kMaxInputChannels) ||
191 device_id.empty()) { 195 device_id.empty()) {
192 DLOG(ERROR) << "Audio parameters are invalid for device " << device_id; 196 DLOG(ERROR) << "Audio parameters are invalid for device " << device_id;
193 return NULL; 197 return NULL;
194 } 198 }
195 199
196 if (num_input_streams_ >= max_num_input_streams_) { 200 if (num_input_streams_ >= max_num_input_streams_) {
197 DLOG(ERROR) << "Number of opened input audio streams " 201 DLOG(ERROR) << "Number of opened input audio streams "
198 << num_input_streams_ 202 << num_input_streams_
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( 408 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog(
405 AudioLogFactory::AudioComponent component) { 409 AudioLogFactory::AudioComponent component) {
406 return audio_log_factory_->CreateAudioLog(component); 410 return audio_log_factory_->CreateAudioLog(component);
407 } 411 }
408 412
409 void AudioManagerBase::SetHasKeyboardMic() { 413 void AudioManagerBase::SetHasKeyboardMic() {
410 NOTREACHED(); 414 NOTREACHED();
411 } 415 }
412 416
413 } // namespace media 417 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698