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

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: 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
« no previous file with comments | « media/audio/android/audio_manager_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « media/audio/android/audio_manager_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698