Chromium Code Reviews| Index: media/audio/android/audio_manager_android.cc |
| =================================================================== |
| --- media/audio/android/audio_manager_android.cc (revision 180886) |
| +++ media/audio/android/audio_manager_android.cc (working copy) |
| @@ -8,10 +8,14 @@ |
| #include "media/audio/android/opensles_input.h" |
| #include "media/audio/android/opensles_output.h" |
| #include "media/audio/audio_manager.h" |
| +#include "media/audio/audio_util.h" |
| #include "media/audio/fake_audio_input_stream.h" |
| namespace media { |
| +static const char kAndroidInputDeviceName[] = "Mic"; |
| +static const char kAndroidInputDeviceId[] = "mic"; |
|
wjia(left Chromium)
2013/02/06 18:17:05
move these 2 into anonymous namespace and remove s
leozwang1
2013/02/11 08:05:00
I removed these defines because unit test assume t
|
| + |
| // Maximum number of output streams that can be open simultaneously. |
| static const int kMaxOutputStreams = 10; |
| @@ -32,9 +36,40 @@ |
| } |
| bool AudioManagerAndroid::HasAudioInputDevices() { |
| + return true; |
| +} |
| + |
| +bool AudioManagerAndroid::CanShowAudioInputSettings() { |
| return false; |
| } |
| +void AudioManagerAndroid::ShowAudioInputSettings() { |
|
wjia(left Chromium)
2013/02/06 18:17:05
Do you need a no-op override here? It's same def a
leozwang1
2013/02/11 08:05:00
Done.
|
| +} |
| + |
| +void AudioManagerAndroid::GetAudioInputDeviceNames( |
| + media::AudioDeviceNames* device_names) { |
| + if (device_names->empty()) { |
| + device_names->push_front(media::AudioDeviceName( |
| + kAndroidInputDeviceName, kAndroidInputDeviceId)); |
| + } |
| +} |
| + |
| +AudioParameters |
| +AudioManagerAndroid::GetPreferredLowLatencyOutputStreamParameters( |
| + const AudioParameters& input_params) { |
| + // TODO(leozwang): Android defines the minimal buffer size requirment |
| + // we should follow it. From Android 4.1, a new audio low latency api |
| + // set was introduced and is under development, we want to take advantage |
| + // of it. |
| + int buffer_size = GetAudioHardwareBufferSize(); |
| + if (input_params.frames_per_buffer() < buffer_size) |
| + buffer_size = input_params.frames_per_buffer(); |
| + |
| + return AudioParameters( |
| + AudioParameters::AUDIO_PCM_LOW_LATENCY, input_params.channel_layout(), |
| + input_params.sample_rate(), 16, buffer_size); |
| +} |
| + |
| AudioOutputStream* AudioManagerAndroid::MakeLinearOutputStream( |
| const AudioParameters& params) { |
| DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); |