blob: 7bb2402acca6db1840bed2d8c42b8599f7ec9c70 (
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
|
// Copyright (c) 2010 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.h"
#include "base/at_exit.h"
#include "base/logging.h"
namespace {
AudioManager* g_audio_manager = NULL;
// NullAudioManager is the audio manager used on the systems that have no
// audio support.
class NullAudioManager : public AudioManager {
public:
NullAudioManager() { }
// Implementation of AudioManager.
virtual bool HasAudioOutputDevices() { return false; }
virtual bool HasAudioInputDevices() { return false; }
virtual AudioOutputStream* MakeAudioOutputStream(AudioParameters params) {
NOTIMPLEMENTED();
return NULL;
}
virtual AudioInputStream* MakeAudioInputStream(AudioParameters params,
uint32 samples_per_packet) {
NOTIMPLEMENTED();
return NULL;
}
virtual void MuteAll() { NOTIMPLEMENTED(); }
virtual void UnMuteAll() { NOTIMPLEMENTED(); }
private:
DISALLOW_COPY_AND_ASSIGN(NullAudioManager);
};
} // namespace
// static
void AudioManager::Destroy(void* not_used) {
delete g_audio_manager;
g_audio_manager = NULL;
}
// static
AudioManager* AudioManager::GetAudioManager() {
if (!g_audio_manager) {
g_audio_manager = CreateAudioManager();
g_audio_manager->Init();
base::AtExitManager::RegisterCallback(&AudioManager::Destroy, NULL);
}
return g_audio_manager;
}
|