Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / media / audio / fake_audio_manager.cc
blob3d7640144a96cf393d03c4c62fee6d7f16220b4c
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/audio/fake_audio_manager.h"
7 namespace media {
9 namespace {
11 const int kDefaultInputBufferSize = 1024;
12 const int kDefaultSampleRate = 48000;
14 } // namespace
16 FakeAudioManager::FakeAudioManager(AudioLogFactory* audio_log_factory)
17 : AudioManagerBase(audio_log_factory) {}
19 FakeAudioManager::~FakeAudioManager() {
20 Shutdown();
23 // Implementation of AudioManager.
24 bool FakeAudioManager::HasAudioOutputDevices() { return false; }
26 bool FakeAudioManager::HasAudioInputDevices() { return false; }
28 // Implementation of AudioManagerBase.
29 AudioOutputStream* FakeAudioManager::MakeLinearOutputStream(
30 const AudioParameters& params) {
31 return FakeAudioOutputStream::MakeFakeStream(this, params);
34 AudioOutputStream* FakeAudioManager::MakeLowLatencyOutputStream(
35 const AudioParameters& params,
36 const std::string& device_id) {
37 return FakeAudioOutputStream::MakeFakeStream(this, params);
40 AudioInputStream* FakeAudioManager::MakeLinearInputStream(
41 const AudioParameters& params,
42 const std::string& device_id) {
43 return FakeAudioInputStream::MakeFakeStream(this, params);
46 AudioInputStream* FakeAudioManager::MakeLowLatencyInputStream(
47 const AudioParameters& params,
48 const std::string& device_id) {
49 return FakeAudioInputStream::MakeFakeStream(this, params);
52 AudioParameters FakeAudioManager::GetPreferredOutputStreamParameters(
53 const std::string& output_device_id,
54 const AudioParameters& input_params) {
55 static const int kDefaultOutputBufferSize = 2048;
56 static const int kDefaultSampleRate = 48000;
57 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
58 int sample_rate = kDefaultSampleRate;
59 int buffer_size = kDefaultOutputBufferSize;
60 int bits_per_sample = 16;
61 if (input_params.IsValid()) {
62 sample_rate = input_params.sample_rate();
63 bits_per_sample = input_params.bits_per_sample();
64 channel_layout = input_params.channel_layout();
65 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size);
68 return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
69 sample_rate, bits_per_sample, buffer_size);
72 AudioParameters FakeAudioManager::GetInputStreamParameters(
73 const std::string& device_id) {
74 return AudioParameters(
75 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
76 kDefaultSampleRate, 16, kDefaultInputBufferSize);
79 } // namespace media