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

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

Issue 16286010: Removed the IsRecordingInProcess check for speech since it is not needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed unused error code and relevant resource, cleaned up include Created 7 years, 6 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
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_output_proxy_unittest.cc » ('j') | 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/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 dispatcher_->output_params == dispatcher_in->output_params && 67 dispatcher_->output_params == dispatcher_in->output_params &&
68 (!dispatcher_->input_params.input_channels() || 68 (!dispatcher_->input_params.input_channels() ||
69 dispatcher_->input_device_id == dispatcher_in->input_device_id)); 69 dispatcher_->input_device_id == dispatcher_in->input_device_id));
70 } 70 }
71 71
72 private: 72 private:
73 const DispatcherParams* dispatcher_; 73 const DispatcherParams* dispatcher_;
74 }; 74 };
75 75
76 AudioManagerBase::AudioManagerBase() 76 AudioManagerBase::AudioManagerBase()
77 : num_active_input_streams_(0), 77 : max_num_output_streams_(kDefaultMaxOutputStreams),
78 max_num_output_streams_(kDefaultMaxOutputStreams),
79 max_num_input_streams_(kDefaultMaxInputStreams), 78 max_num_input_streams_(kDefaultMaxInputStreams),
80 num_output_streams_(0), 79 num_output_streams_(0),
81 num_input_streams_(0), 80 num_input_streams_(0),
82 // TODO(dalecurtis): Switch this to an ObserverListThreadSafe, so we don't 81 // TODO(dalecurtis): Switch this to an ObserverListThreadSafe, so we don't
83 // block the UI thread when swapping devices. 82 // block the UI thread when swapping devices.
84 output_listeners_( 83 output_listeners_(
85 ObserverList<AudioDeviceListener>::NOTIFY_EXISTING_ONLY), 84 ObserverList<AudioDeviceListener>::NOTIFY_EXISTING_ONLY),
86 audio_thread_(new base::Thread("AudioThread")) { 85 audio_thread_(new base::Thread("AudioThread")) {
87 #if defined(OS_WIN) 86 #if defined(OS_WIN)
88 audio_thread_->init_com_with_mta(true); 87 audio_thread_->init_com_with_mta(true);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 delete stream; 303 delete stream;
305 } 304 }
306 305
307 void AudioManagerBase::ReleaseInputStream(AudioInputStream* stream) { 306 void AudioManagerBase::ReleaseInputStream(AudioInputStream* stream) {
308 DCHECK(stream); 307 DCHECK(stream);
309 // TODO(xians) : Have a clearer destruction path for the AudioInputStream. 308 // TODO(xians) : Have a clearer destruction path for the AudioInputStream.
310 --num_input_streams_; 309 --num_input_streams_;
311 delete stream; 310 delete stream;
312 } 311 }
313 312
314 void AudioManagerBase::IncreaseActiveInputStreamCount() {
315 base::AtomicRefCountInc(&num_active_input_streams_);
316 }
317
318 void AudioManagerBase::DecreaseActiveInputStreamCount() {
319 DCHECK(IsRecordingInProcess());
320 base::AtomicRefCountDec(&num_active_input_streams_);
321 }
322
323 bool AudioManagerBase::IsRecordingInProcess() {
324 return !base::AtomicRefCountIsZero(&num_active_input_streams_);
325 }
326
327 void AudioManagerBase::Shutdown() { 313 void AudioManagerBase::Shutdown() {
328 // To avoid running into deadlocks while we stop the thread, shut it down 314 // To avoid running into deadlocks while we stop the thread, shut it down
329 // via a local variable while not holding the audio thread lock. 315 // via a local variable while not holding the audio thread lock.
330 scoped_ptr<base::Thread> audio_thread; 316 scoped_ptr<base::Thread> audio_thread;
331 { 317 {
332 base::AutoLock lock(audio_thread_lock_); 318 base::AutoLock lock(audio_thread_lock_);
333 audio_thread_.swap(audio_thread); 319 audio_thread_.swap(audio_thread);
334 } 320 }
335 321
336 if (!audio_thread) 322 if (!audio_thread)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 return GetPreferredOutputStreamParameters(AudioParameters()); 385 return GetPreferredOutputStreamParameters(AudioParameters());
400 } 386 }
401 387
402 AudioParameters AudioManagerBase::GetInputStreamParameters( 388 AudioParameters AudioManagerBase::GetInputStreamParameters(
403 const std::string& device_id) { 389 const std::string& device_id) {
404 NOTREACHED(); 390 NOTREACHED();
405 return AudioParameters(); 391 return AudioParameters();
406 } 392 }
407 393
408 } // namespace media 394 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_output_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698