summaryrefslogtreecommitdiffstats
path: root/media/audio/android/audio_manager_android.cc
blob: 0170675a43442425ab0e0d83597ec848707282a1 (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
// 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/android/audio_manager_android.h"

#include "base/logging.h"
#include "media/audio/android/audio_track_output_android.h"
#include "media/audio/audio_manager.h"
#include "media/audio/fake_audio_input_stream.h"
#include "media/audio/fake_audio_output_stream.h"

AudioManager* CreateAudioManager() {
  return new AudioManagerAndroid();
}

AudioManagerAndroid::AudioManagerAndroid() {}

AudioManagerAndroid::~AudioManagerAndroid() {
  audio_thread_->Stop();
}

bool AudioManagerAndroid::HasAudioOutputDevices() {
  return true;
}

bool AudioManagerAndroid::HasAudioInputDevices() {
  return false;
}

AudioOutputStream* AudioManagerAndroid::MakeAudioOutputStream(
    const AudioParameters& params) {
  if (!params.IsValid())
    return NULL;

  if (params.format == AudioParameters::AUDIO_MOCK)
    return FakeAudioOutputStream::MakeFakeStream(params);
  if (params.format == AudioParameters::AUDIO_PCM_LINEAR ||
      params.format == AudioParameters::AUDIO_PCM_LOW_LATENCY)
    return AudioTrackOutputStream::MakeStream(params);

  return NULL;
}

AudioInputStream* AudioManagerAndroid::MakeAudioInputStream(
    const AudioParameters& params, const std::string& device_id) {
  return FakeAudioInputStream::MakeFakeStream(params);
}

void AudioManagerAndroid::MuteAll() {
  NOTIMPLEMENTED();
}

void AudioManagerAndroid::UnMuteAll() {
  NOTIMPLEMENTED();
}