Chromium Code Reviews| Index: media/audio/android/audio_manager_android.cc |
| =================================================================== |
| --- media/audio/android/audio_manager_android.cc (revision 181622) |
| +++ media/audio/android/audio_manager_android.cc (working copy) |
| @@ -8,6 +8,7 @@ |
| #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 { |
| @@ -32,9 +33,37 @@ |
| } |
| bool AudioManagerAndroid::HasAudioInputDevices() { |
| + return true; |
| +} |
| + |
| +bool AudioManagerAndroid::CanShowAudioInputSettings() { |
| return false; |
| } |
| +void AudioManagerAndroid::GetAudioInputDeviceNames( |
| + media::AudioDeviceNames* device_names) { |
| + if (device_names->empty()) { |
| + device_names->push_front(media::AudioDeviceName( |
| + kDefaultDeviceName, kDefaultDeviceId)); |
| + } |
|
tommi (sloooow) - chröme
2013/02/11 09:52:58
This implementation is making a few assumptions th
leozwang1
2013/02/11 18:03:43
Done.
|
| +} |
| + |
| +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); |
|
tommi (sloooow) - chröme
2013/02/11 09:52:58
Is audio always 16 bit?
leozwang1
2013/02/11 18:03:43
opensl only supports 8bit or 16bit, webrtc uses 16
|
| +} |
| + |
| AudioOutputStream* AudioManagerAndroid::MakeLinearOutputStream( |
| const AudioParameters& params) { |
| DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); |