blob: 5053e879ace6394e5c8aa889743a25abc96fb16b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/audio/audio_manager_base.h"
#include "media/audio/audio_output_dispatcher.h"
#include "media/audio/audio_output_proxy.h"
static const int kStreamCloseDelayMs = 5000;
const char AudioManagerBase::kDefaultDeviceName[] = "Default";
AudioManagerBase::AudioManagerBase()
: audio_thread_("AudioThread"),
initialized_(false),
num_active_input_streams_(0) {
}
AudioManagerBase::~AudioManagerBase() {
DCHECK(!audio_thread_.IsRunning());
}
void AudioManagerBase::Init() {
initialized_ = audio_thread_.Start();
}
void AudioManagerBase::Cleanup() {
if (initialized_) {
initialized_ = false;
audio_thread_.Stop();
}
}
string16 AudioManagerBase::GetAudioInputDeviceModel() {
return string16();
}
MessageLoop* AudioManagerBase::GetMessageLoop() {
DCHECK(initialized_);
return audio_thread_.message_loop();
}
AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy(
const AudioParameters& params) {
if (!initialized_)
return NULL;
scoped_refptr<AudioOutputDispatcher>& dispatcher =
output_dispatchers_[params];
if (!dispatcher)
dispatcher = new AudioOutputDispatcher(this, params, kStreamCloseDelayMs);
return new AudioOutputProxy(dispatcher);
}
bool AudioManagerBase::CanShowAudioInputSettings() {
return false;
}
void AudioManagerBase::ShowAudioInputSettings() {
}
void AudioManagerBase::GetAudioInputDeviceNames(
media::AudioDeviceNames* device_names) {
}
void AudioManagerBase::IncreaseActiveInputStreamCount() {
base::AutoLock auto_lock(active_input_streams_lock_);
++num_active_input_streams_;
}
void AudioManagerBase::DecreaseActiveInputStreamCount() {
base::AutoLock auto_lock(active_input_streams_lock_);
DCHECK_GT(num_active_input_streams_, 0);
--num_active_input_streams_;
}
bool AudioManagerBase::IsRecordingInProcess() {
base::AutoLock auto_lock(active_input_streams_lock_);
return num_active_input_streams_ > 0;
}
|