Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-02-24 05:00:36 -08:00
|
|
|
#include <memory>
|
|
|
|
|
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
2015-08-28 17:31:03 -07:00
|
|
|
#include "webrtc/base/format_macros.h"
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
#include "webrtc/modules/audio_device/android/build_info.h"
|
|
|
|
|
#include "webrtc/modules/audio_device/android/audio_manager.h"
|
|
|
|
|
#include "webrtc/modules/audio_device/android/ensure_initialized.h"
|
|
|
|
|
|
|
|
|
|
#define PRINT(...) fprintf(stderr, __VA_ARGS__);
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
static const char kTag[] = " ";
|
|
|
|
|
|
|
|
|
|
class AudioManagerTest : public ::testing::Test {
|
|
|
|
|
protected:
|
|
|
|
|
AudioManagerTest() {
|
|
|
|
|
// One-time initialization of JVM and application context. Ensures that we
|
|
|
|
|
// can do calls between C++ and Java.
|
|
|
|
|
webrtc::audiodevicemodule::EnsureInitialized();
|
|
|
|
|
audio_manager_.reset(new AudioManager());
|
|
|
|
|
SetActiveAudioLayer();
|
|
|
|
|
playout_parameters_ = audio_manager()->GetPlayoutAudioParameters();
|
|
|
|
|
record_parameters_ = audio_manager()->GetRecordAudioParameters();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AudioManager* audio_manager() const { return audio_manager_.get(); }
|
|
|
|
|
|
|
|
|
|
// A valid audio layer must always be set before calling Init(), hence we
|
|
|
|
|
// might as well make it a part of the test fixture.
|
|
|
|
|
void SetActiveAudioLayer() {
|
|
|
|
|
EXPECT_EQ(0, audio_manager()->GetDelayEstimateInMilliseconds());
|
|
|
|
|
audio_manager()->SetActiveAudioLayer(AudioDeviceModule::kAndroidJavaAudio);
|
|
|
|
|
EXPECT_NE(0, audio_manager()->GetDelayEstimateInMilliseconds());
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 05:00:36 -08:00
|
|
|
std::unique_ptr<AudioManager> audio_manager_;
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
AudioParameters playout_parameters_;
|
|
|
|
|
AudioParameters record_parameters_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TEST_F(AudioManagerTest, ConstructDestruct) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(AudioManagerTest, InitClose) {
|
|
|
|
|
EXPECT_TRUE(audio_manager()->Init());
|
|
|
|
|
EXPECT_TRUE(audio_manager()->Close());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(AudioManagerTest, IsAcousticEchoCancelerSupported) {
|
|
|
|
|
PRINT("%sAcoustic Echo Canceler support: %s\n", kTag,
|
|
|
|
|
audio_manager()->IsAcousticEchoCancelerSupported() ? "Yes" : "No");
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-23 14:08:33 +02:00
|
|
|
TEST_F(AudioManagerTest, IsAutomaticGainControlSupported) {
|
|
|
|
|
PRINT("%sAutomatic Gain Control support: %s\n", kTag,
|
|
|
|
|
audio_manager()->IsAutomaticGainControlSupported() ? "Yes" : "No");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(AudioManagerTest, IsNoiseSuppressorSupported) {
|
|
|
|
|
PRINT("%sNoise Suppressor support: %s\n", kTag,
|
|
|
|
|
audio_manager()->IsNoiseSuppressorSupported() ? "Yes" : "No");
|
|
|
|
|
}
|
|
|
|
|
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
TEST_F(AudioManagerTest, IsLowLatencyPlayoutSupported) {
|
|
|
|
|
PRINT("%sLow latency output support: %s\n", kTag,
|
|
|
|
|
audio_manager()->IsLowLatencyPlayoutSupported() ? "Yes" : "No");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(AudioManagerTest, ShowAudioParameterInfo) {
|
|
|
|
|
const bool low_latency_out = audio_manager()->IsLowLatencyPlayoutSupported();
|
|
|
|
|
PRINT("PLAYOUT:\n");
|
|
|
|
|
PRINT("%saudio layer: %s\n", kTag,
|
|
|
|
|
low_latency_out ? "Low latency OpenSL" : "Java/JNI based AudioTrack");
|
|
|
|
|
PRINT("%ssample rate: %d Hz\n", kTag, playout_parameters_.sample_rate());
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
PRINT("%schannels: %" PRIuS "\n", kTag, playout_parameters_.channels());
|
2015-08-28 17:31:03 -07:00
|
|
|
PRINT("%sframes per buffer: %" PRIuS " <=> %.2f ms\n", kTag,
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
playout_parameters_.frames_per_buffer(),
|
|
|
|
|
playout_parameters_.GetBufferSizeInMilliseconds());
|
|
|
|
|
PRINT("RECORD: \n");
|
|
|
|
|
PRINT("%saudio layer: %s\n", kTag, "Java/JNI based AudioRecord");
|
|
|
|
|
PRINT("%ssample rate: %d Hz\n", kTag, record_parameters_.sample_rate());
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
PRINT("%schannels: %" PRIuS "\n", kTag, record_parameters_.channels());
|
2015-08-28 17:31:03 -07:00
|
|
|
PRINT("%sframes per buffer: %" PRIuS " <=> %.2f ms\n", kTag,
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
record_parameters_.frames_per_buffer(),
|
|
|
|
|
record_parameters_.GetBufferSizeInMilliseconds());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add device-specific information to the test for logging purposes.
|
|
|
|
|
TEST_F(AudioManagerTest, ShowDeviceInfo) {
|
|
|
|
|
BuildInfo build_info;
|
|
|
|
|
PRINT("%smodel: %s\n", kTag, build_info.GetDeviceModel().c_str());
|
|
|
|
|
PRINT("%sbrand: %s\n", kTag, build_info.GetBrand().c_str());
|
|
|
|
|
PRINT("%smanufacturer: %s\n",
|
|
|
|
|
kTag, build_info.GetDeviceManufacturer().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add Android build information to the test for logging purposes.
|
|
|
|
|
TEST_F(AudioManagerTest, ShowBuildInfo) {
|
|
|
|
|
BuildInfo build_info;
|
|
|
|
|
PRINT("%sbuild release: %s\n", kTag, build_info.GetBuildRelease().c_str());
|
|
|
|
|
PRINT("%sbuild id: %s\n", kTag, build_info.GetAndroidBuildId().c_str());
|
|
|
|
|
PRINT("%sbuild type: %s\n", kTag, build_info.GetBuildType().c_str());
|
|
|
|
|
PRINT("%sSDK version: %s\n", kTag, build_info.GetSdkVersion().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Basic test of the AudioParameters class using default construction where
|
|
|
|
|
// all members are set to zero.
|
|
|
|
|
TEST_F(AudioManagerTest, AudioParametersWithDefaultConstruction) {
|
|
|
|
|
AudioParameters params;
|
|
|
|
|
EXPECT_FALSE(params.is_valid());
|
|
|
|
|
EXPECT_EQ(0, params.sample_rate());
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
EXPECT_EQ(0U, params.channels());
|
2015-08-28 17:31:03 -07:00
|
|
|
EXPECT_EQ(0U, params.frames_per_buffer());
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
EXPECT_EQ(0U, params.frames_per_10ms_buffer());
|
2015-08-28 17:31:03 -07:00
|
|
|
EXPECT_EQ(0U, params.GetBytesPerFrame());
|
|
|
|
|
EXPECT_EQ(0U, params.GetBytesPerBuffer());
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
EXPECT_EQ(0U, params.GetBytesPer10msBuffer());
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
EXPECT_EQ(0.0f, params.GetBufferSizeInMilliseconds());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Basic test of the AudioParameters class using non default construction.
|
|
|
|
|
TEST_F(AudioManagerTest, AudioParametersWithNonDefaultConstruction) {
|
|
|
|
|
const int kSampleRate = 48000;
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
const size_t kChannels = 1;
|
2015-08-28 17:31:03 -07:00
|
|
|
const size_t kFramesPerBuffer = 480;
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
const size_t kFramesPer10msBuffer = 480;
|
2015-08-28 17:31:03 -07:00
|
|
|
const size_t kBytesPerFrame = 2;
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
const float kBufferSizeInMs = 10.0f;
|
|
|
|
|
AudioParameters params(kSampleRate, kChannels, kFramesPerBuffer);
|
|
|
|
|
EXPECT_TRUE(params.is_valid());
|
|
|
|
|
EXPECT_EQ(kSampleRate, params.sample_rate());
|
|
|
|
|
EXPECT_EQ(kChannels, params.channels());
|
|
|
|
|
EXPECT_EQ(kFramesPerBuffer, params.frames_per_buffer());
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
EXPECT_EQ(static_cast<size_t>(kSampleRate / 100),
|
|
|
|
|
params.frames_per_10ms_buffer());
|
Adding support for OpenSL ES output in native WebRTC
BUG=4573,2982,2175,3590
TEST=modules_unittests --gtest_filter=AudioDevice*, AppRTCDemo and WebRTCDemo
Summary:
- Removes dependency of the 'enable_android_opensl' compiler flag.
Instead, OpenSL ES is always supported, and will enabled for devices that
supports low-latency output.
- WebRTC no longer supports OpenSL ES for the input/recording side.
- Removes old code and demos using OpenSL ES for audio input.
- Improves accuracy of total delay estimates (better AEC performance).
- Reduces roundtrip audio latency; especially when OpenSL can be used.
Performance verified on: Nexus 5, 6, 7 and 9. Samsung Galaxy S4 and S6.
Android One device.
R=magjed@webrtc.org, phoglund@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/51759004
Cr-Commit-Position: refs/heads/master@{#9208}
2015-05-18 16:49:16 +02:00
|
|
|
EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame());
|
|
|
|
|
EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer());
|
|
|
|
|
EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer,
|
|
|
|
|
params.GetBytesPer10msBuffer());
|
|
|
|
|
EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|