summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_manager_base.cc
blob: d0614f47525127027fd683b9c993d6f63df4d199 (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
// 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) {
}

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) {
}