Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: media/audio/android/audio_manager_android.cc

Issue 12218036: Enable audio capture on Android (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: solve unit test Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());

Powered by Google App Engine
This is Rietveld 408576698