diff options
author | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-12 17:59:24 +0000 |
---|---|---|
committer | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-12 17:59:24 +0000 |
commit | 10cf237d493610e5ce75e05afe7e2c679f93975d (patch) | |
tree | d3ee20799e2f03a392653d50c635f0629e795778 /content/renderer | |
parent | 9b3f7e24be4d7417ddb409470818cbfebc722a40 (diff) | |
download | chromium_src-10cf237d493610e5ce75e05afe7e2c679f93975d.zip chromium_src-10cf237d493610e5ce75e05afe7e2c679f93975d.tar.gz chromium_src-10cf237d493610e5ce75e05afe7e2c679f93975d.tar.bz2 |
Enable audio capture on Android
Patch by leozwang@chromium.org (https://codereview.chromium.org/12218036/).
This CL JUST enables audio capture on Android, further tunning and
making audio work better might take extra time, I think it's better to
first enable it. A few TODOs are added and minor changes are added into
CL too.
BUG=161417
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181948 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/media/webrtc_audio_capturer.cc | 3 | ||||
-rw-r--r-- | content/renderer/media/webrtc_audio_device_unittest.cc | 28 | ||||
-rw-r--r-- | content/renderer/media/webrtc_audio_renderer.cc | 4 |
3 files changed, 31 insertions, 4 deletions
diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc index 976b9ed..8aad07e3 100644 --- a/content/renderer/media/webrtc_audio_capturer.cc +++ b/content/renderer/media/webrtc_audio_capturer.cc @@ -52,6 +52,9 @@ static int GetBufferSizeForSampleRate(int sample_rate) { // TODO(henrika): It might be possible to reduce the input buffer // size and reduce the delay even more. buffer_size = 2 * sample_rate / 100; +#elif defined(OS_ANDROID) + // TODO(leozwang): Tune and adjust buffer size on Android. + buffer_size = 2 * sample_rate / 100; #endif return buffer_size; diff --git a/content/renderer/media/webrtc_audio_device_unittest.cc b/content/renderer/media/webrtc_audio_device_unittest.cc index 159da0d..42e9c6d 100644 --- a/content/renderer/media/webrtc_audio_device_unittest.cc +++ b/content/renderer/media/webrtc_audio_device_unittest.cc @@ -322,7 +322,15 @@ TEST_F(WebRTCAudioDeviceTest, DISABLED_StartPlayout) { // to send encoded packets to the network. Our main interest here is to ensure // that the audio capturing starts as it should. // Disabled when running headless since the bots don't have the required config. -TEST_F(WebRTCAudioDeviceTest, StartRecording) { + +// TODO(leozwang): Because ExternalMediaProcessing is disabled in webrtc, +// disable this unit test on Android for now. +#if defined(OS_ANDROID) +#define MAYBE_StartRecording DISABLED_StartRecording +#else +#define MAYBE_StartRecording StartRecording +#endif +TEST_F(WebRTCAudioDeviceTest, MAYBE_StartRecording) { if (!has_input_devices_ || !has_output_devices_) { LOG(WARNING) << "Missing audio devices."; return; @@ -466,7 +474,13 @@ TEST_F(WebRTCAudioDeviceTest, DISABLED_PlayLocalFile) { // Disabled when running headless since the bots don't have the required config. // TODO(henrika): improve quality by using a wideband codec, enabling noise- // suppressions etc. -TEST_F(WebRTCAudioDeviceTest, FullDuplexAudioWithAGC) { +// FullDuplexAudioWithAGC is flaky on Android, disable it for now. +#if defined(OS_ANDROID) +#define MAYBE_FullDuplexAudioWithAGC DISABLED_FullDuplexAudioWithAGC +#else +#define MAYBE_FullDuplexAudioWithAGC FullDuplexAudioWithAGC +#endif +TEST_F(WebRTCAudioDeviceTest, MAYBE_FullDuplexAudioWithAGC) { if (!has_output_devices_ || !has_input_devices_) { LOG(WARNING) << "Missing audio devices."; return; @@ -505,11 +519,19 @@ TEST_F(WebRTCAudioDeviceTest, FullDuplexAudioWithAGC) { ScopedWebRTCPtr<webrtc::VoEAudioProcessing> audio_processing(engine.get()); ASSERT_TRUE(audio_processing.valid()); +#if defined(OS_ANDROID) + // On Android, by default AGC is off. + bool enabled = true; + webrtc::AgcModes agc_mode = webrtc::kAgcDefault; + EXPECT_EQ(0, audio_processing->GetAgcStatus(enabled, agc_mode)); + EXPECT_FALSE(enabled); +#else bool enabled = false; - webrtc::AgcModes agc_mode = webrtc::kAgcDefault; + webrtc::AgcModes agc_mode = webrtc::kAgcDefault; EXPECT_EQ(0, audio_processing->GetAgcStatus(enabled, agc_mode)); EXPECT_TRUE(enabled); EXPECT_EQ(agc_mode, webrtc::kAgcAdaptiveAnalog); +#endif int ch = base->CreateChannel(); EXPECT_NE(-1, ch); diff --git a/content/renderer/media/webrtc_audio_renderer.cc b/content/renderer/media/webrtc_audio_renderer.cc index c04a4c1..b668f80 100644 --- a/content/renderer/media/webrtc_audio_renderer.cc +++ b/content/renderer/media/webrtc_audio_renderer.cc @@ -34,7 +34,9 @@ const int kValidOutputRates[] = {96000, 48000, 44100, 32000, 16000}; #elif defined(OS_LINUX) || defined(OS_OPENBSD) const int kValidOutputRates[] = {48000, 44100}; #elif defined(OS_ANDROID) -// On Android, the most popular sampling rate is 16000. +// TODO(leozwang): We want to use native sampling rate on Android to achieve +// low latency, currently 16000 is used to work around audio problem on some +// Android devices. const int kValidOutputRates[] = {48000, 44100, 16000}; #else const int kValidOutputRates[] = {44100}; |