2015-03-27 10:56:23 +01: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.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
|
#ifndef MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_
|
|
|
|
|
|
#define MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_
|
2015-03-27 10:56:23 +01:00
|
|
|
|
|
2016-05-31 07:03:17 -07:00
|
|
|
|
#include <SLES/OpenSLES.h>
|
2015-03-27 10:56:23 +01:00
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
2018-03-16 10:09:49 +01:00
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
|
#include "modules/audio_device/android/audio_common.h"
|
|
|
|
|
|
#include "modules/audio_device/android/opensles_common.h"
|
|
|
|
|
|
#include "modules/audio_device/audio_device_config.h"
|
|
|
|
|
|
#include "modules/audio_device/audio_device_generic.h"
|
|
|
|
|
|
#include "modules/audio_device/include/audio_device_defines.h"
|
|
|
|
|
|
#include "modules/utility/include/helpers_android.h"
|
|
|
|
|
|
#include "modules/utility/include/jvm_android.h"
|
|
|
|
|
|
#include "rtc_base/thread_checker.h"
|
2015-03-27 10:56:23 +01:00
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
|
|
// Implements support for functions in the WebRTC audio stack for Android that
|
|
|
|
|
|
// relies on the AudioManager in android.media. It also populates an
|
|
|
|
|
|
// AudioParameter structure with native audio parameters detected at
|
|
|
|
|
|
// construction. This class does not make any audio-related modifications
|
|
|
|
|
|
// unless Init() is called. Caching audio parameters makes no changes but only
|
|
|
|
|
|
// reads data from the Java side.
|
|
|
|
|
|
class AudioManager {
|
|
|
|
|
|
public:
|
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
|
|
|
|
// Wraps the Java specific parts of the AudioManager into one helper class.
|
|
|
|
|
|
// Stores method IDs for all supported methods at construction and then
|
|
|
|
|
|
// allows calls like JavaAudioManager::Close() while hiding the Java/JNI
|
|
|
|
|
|
// parts that are associated with this call.
|
|
|
|
|
|
class JavaAudioManager {
|
|
|
|
|
|
public:
|
|
|
|
|
|
JavaAudioManager(NativeRegistration* native_registration,
|
2016-02-24 05:00:36 -08:00
|
|
|
|
std::unique_ptr<GlobalRef> audio_manager);
|
2015-05-28 14:18:33 +02:00
|
|
|
|
~JavaAudioManager();
|
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
|
|
|
|
|
2015-05-28 14:18:33 +02:00
|
|
|
|
bool Init();
|
|
|
|
|
|
void Close();
|
2015-06-05 11:45:56 +02:00
|
|
|
|
bool IsCommunicationModeEnabled();
|
2015-06-09 10:45:09 +02:00
|
|
|
|
bool IsDeviceBlacklistedForOpenSLESUsage();
|
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
|
|
|
|
|
2015-05-28 14:18:33 +02:00
|
|
|
|
private:
|
2016-02-24 05:00:36 -08:00
|
|
|
|
std::unique_ptr<GlobalRef> audio_manager_;
|
2015-05-28 14:18:33 +02:00
|
|
|
|
jmethodID init_;
|
|
|
|
|
|
jmethodID dispose_;
|
2015-06-05 11:45:56 +02:00
|
|
|
|
jmethodID is_communication_mode_enabled_;
|
2015-06-09 10:45:09 +02:00
|
|
|
|
jmethodID is_device_blacklisted_for_open_sles_usage_;
|
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
|
|
|
|
};
|
2015-03-27 10:56:23 +01:00
|
|
|
|
|
|
|
|
|
|
AudioManager();
|
|
|
|
|
|
~AudioManager();
|
|
|
|
|
|
|
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
|
|
|
|
// Sets the currently active audio layer combination. Must be called before
|
|
|
|
|
|
// Init().
|
|
|
|
|
|
void SetActiveAudioLayer(AudioDeviceModule::AudioLayer audio_layer);
|
|
|
|
|
|
|
2016-05-31 07:03:17 -07:00
|
|
|
|
// Creates and realizes the main (global) Open SL engine object and returns
|
|
|
|
|
|
// a reference to it. The engine object is only created at the first call
|
|
|
|
|
|
// since OpenSL ES for Android only supports a single engine per application.
|
|
|
|
|
|
// Subsequent calls returns the already created engine. The SL engine object
|
|
|
|
|
|
// is destroyed when the AudioManager object is deleted. It means that the
|
|
|
|
|
|
// engine object will be the first OpenSL ES object to be created and last
|
|
|
|
|
|
// object to be destroyed.
|
|
|
|
|
|
// Note that NULL will be returned unless the audio layer is specified as
|
|
|
|
|
|
// AudioDeviceModule::kAndroidOpenSLESAudio or
|
|
|
|
|
|
// AudioDeviceModule::kAndroidJavaInputAndOpenSLESOutputAudio.
|
|
|
|
|
|
SLObjectItf GetOpenSLEngine();
|
|
|
|
|
|
|
2015-04-10 11:46:55 +02:00
|
|
|
|
// Initializes the audio manager and stores the current audio mode.
|
2015-03-27 10:56:23 +01:00
|
|
|
|
bool Init();
|
|
|
|
|
|
// Revert any setting done by Init().
|
|
|
|
|
|
bool Close();
|
|
|
|
|
|
|
2015-06-05 11:45:56 +02:00
|
|
|
|
// Returns true if current audio mode is AudioManager.MODE_IN_COMMUNICATION.
|
|
|
|
|
|
bool IsCommunicationModeEnabled() const;
|
2015-04-10 11:46:55 +02:00
|
|
|
|
|
2015-03-27 10:56:23 +01:00
|
|
|
|
// Native audio parameters stored during construction.
|
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 AudioParameters& GetPlayoutAudioParameters();
|
|
|
|
|
|
const AudioParameters& GetRecordAudioParameters();
|
|
|
|
|
|
|
2015-09-23 14:08:33 +02:00
|
|
|
|
// Returns true if the device supports built-in audio effects for AEC, AGC
|
|
|
|
|
|
// and NS. Some devices can also be blacklisted for use in combination with
|
|
|
|
|
|
// platform effects and these devices will return false.
|
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
|
|
|
|
// Can currently only be used in combination with a Java based audio backend
|
|
|
|
|
|
// for the recoring side (i.e. using the android.media.AudioRecord API).
|
|
|
|
|
|
bool IsAcousticEchoCancelerSupported() const;
|
2015-09-23 14:08:33 +02:00
|
|
|
|
bool IsAutomaticGainControlSupported() const;
|
|
|
|
|
|
bool IsNoiseSuppressorSupported() const;
|
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
|
|
|
|
|
|
|
|
|
|
// Returns true if the device supports the low-latency audio paths in
|
|
|
|
|
|
// combination with OpenSL ES.
|
|
|
|
|
|
bool IsLowLatencyPlayoutSupported() const;
|
2016-09-19 15:44:09 +02:00
|
|
|
|
bool IsLowLatencyRecordSupported() const;
|
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
|
|
|
|
|
2017-09-11 01:25:55 -07:00
|
|
|
|
// Returns true if the device supports (and has been configured for) stereo.
|
|
|
|
|
|
// Call the Java API WebRtcAudioManager.setStereoOutput/Input() with true as
|
|
|
|
|
|
// paramter to enable stereo. Default is mono in both directions and the
|
|
|
|
|
|
// setting is set once and for all when the audio manager object is created.
|
|
|
|
|
|
// TODO(henrika): stereo is not supported in combination with OpenSL ES.
|
|
|
|
|
|
bool IsStereoPlayoutSupported() const;
|
|
|
|
|
|
bool IsStereoRecordSupported() const;
|
|
|
|
|
|
|
2016-05-25 05:15:10 -07:00
|
|
|
|
// Returns true if the device supports pro-audio features in combination with
|
|
|
|
|
|
// OpenSL ES.
|
|
|
|
|
|
bool IsProAudioSupported() const;
|
|
|
|
|
|
|
2018-03-16 10:09:49 +01:00
|
|
|
|
// Returns true if the device supports AAudio.
|
|
|
|
|
|
bool IsAAudioSupported() const;
|
|
|
|
|
|
|
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
|
|
|
|
// Returns the estimated total delay of this device. Unit is in milliseconds.
|
|
|
|
|
|
// The vaule is set once at construction and never changes after that.
|
|
|
|
|
|
// Possible values are webrtc::kLowLatencyModeDelayEstimateInMilliseconds and
|
|
|
|
|
|
// webrtc::kHighLatencyModeDelayEstimateInMilliseconds.
|
|
|
|
|
|
int GetDelayEstimateInMilliseconds() const;
|
2015-03-27 10:56:23 +01:00
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
// Called from Java side so we can cache the native audio parameters.
|
|
|
|
|
|
// This method will be called by the WebRtcAudioManager constructor, i.e.
|
|
|
|
|
|
// on the same thread that this object is created on.
|
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
|
|
|
|
static void JNICALL CacheAudioParameters(JNIEnv* env,
|
|
|
|
|
|
jobject obj,
|
|
|
|
|
|
jint sample_rate,
|
2016-11-16 06:30:46 -08:00
|
|
|
|
jint output_channels,
|
|
|
|
|
|
jint input_channels,
|
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
|
|
|
|
jboolean hardware_aec,
|
2015-09-23 14:08:33 +02:00
|
|
|
|
jboolean hardware_agc,
|
|
|
|
|
|
jboolean hardware_ns,
|
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
|
|
|
|
jboolean low_latency_output,
|
2016-09-19 15:44:09 +02:00
|
|
|
|
jboolean low_latency_input,
|
2016-05-25 05:15:10 -07:00
|
|
|
|
jboolean pro_audio,
|
2018-03-16 10:09:49 +01:00
|
|
|
|
jboolean a_audio,
|
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
|
|
|
|
jint output_buffer_size,
|
|
|
|
|
|
jint input_buffer_size,
|
|
|
|
|
|
jlong native_audio_manager);
|
|
|
|
|
|
void OnCacheAudioParameters(JNIEnv* env,
|
|
|
|
|
|
jint sample_rate,
|
2016-11-16 06:30:46 -08:00
|
|
|
|
jint output_channels,
|
|
|
|
|
|
jint input_channels,
|
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
|
|
|
|
jboolean hardware_aec,
|
2015-09-23 14:08:33 +02:00
|
|
|
|
jboolean hardware_agc,
|
|
|
|
|
|
jboolean hardware_ns,
|
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
|
|
|
|
jboolean low_latency_output,
|
2016-09-19 15:44:09 +02:00
|
|
|
|
jboolean low_latency_input,
|
2016-05-25 05:15:10 -07:00
|
|
|
|
jboolean pro_audio,
|
2018-03-16 10:09:49 +01:00
|
|
|
|
jboolean a_audio,
|
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
|
|
|
|
jint output_buffer_size,
|
2015-11-03 04:27:58 -08:00
|
|
|
|
jint input_buffer_size);
|
2015-03-27 10:56:23 +01:00
|
|
|
|
|
|
|
|
|
|
// Stores thread ID in the constructor.
|
|
|
|
|
|
// We can then use ThreadChecker::CalledOnValidThread() to ensure that
|
|
|
|
|
|
// other methods are called from the same thread.
|
|
|
|
|
|
rtc::ThreadChecker thread_checker_;
|
|
|
|
|
|
|
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
|
|
|
|
// Calls AttachCurrentThread() if this thread is not attached at construction.
|
|
|
|
|
|
// Also ensures that DetachCurrentThread() is called at destruction.
|
|
|
|
|
|
AttachCurrentThreadIfNeeded attach_thread_if_needed_;
|
|
|
|
|
|
|
2015-05-25 10:11:27 +02:00
|
|
|
|
// Wraps the JNI interface pointer and methods associated with it.
|
2016-02-24 05:00:36 -08:00
|
|
|
|
std::unique_ptr<JNIEnvironment> j_environment_;
|
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
|
|
|
|
|
2015-05-25 10:11:27 +02:00
|
|
|
|
// Contains factory method for creating the Java object.
|
2016-02-24 05:00:36 -08:00
|
|
|
|
std::unique_ptr<NativeRegistration> j_native_registration_;
|
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
|
|
|
|
|
2015-05-25 10:11:27 +02:00
|
|
|
|
// Wraps the Java specific parts of the AudioManager.
|
2016-02-24 05:00:36 -08:00
|
|
|
|
std::unique_ptr<AudioManager::JavaAudioManager> j_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
|
|
|
|
|
2016-05-31 07:03:17 -07:00
|
|
|
|
// Contains the selected audio layer specified by the AudioLayer enumerator
|
|
|
|
|
|
// in the AudioDeviceModule class.
|
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
|
|
|
|
AudioDeviceModule::AudioLayer audio_layer_;
|
2015-03-27 10:56:23 +01:00
|
|
|
|
|
2016-05-31 07:03:17 -07:00
|
|
|
|
// This object is the global entry point of the OpenSL ES API.
|
|
|
|
|
|
// After creating the engine object, the application can obtain this object‘s
|
|
|
|
|
|
// SLEngineItf interface. This interface contains creation methods for all
|
|
|
|
|
|
// the other object types in the API. None of these interface are realized
|
|
|
|
|
|
// by this class. It only provides access to the global engine object.
|
|
|
|
|
|
webrtc::ScopedSLObjectItf engine_object_;
|
|
|
|
|
|
|
2015-03-27 10:56:23 +01:00
|
|
|
|
// Set to true by Init() and false by Close().
|
|
|
|
|
|
bool initialized_;
|
|
|
|
|
|
|
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
|
|
|
|
// True if device supports hardware (or built-in) AEC.
|
|
|
|
|
|
bool hardware_aec_;
|
2015-09-23 14:08:33 +02:00
|
|
|
|
// True if device supports hardware (or built-in) AGC.
|
|
|
|
|
|
bool hardware_agc_;
|
|
|
|
|
|
// True if device supports hardware (or built-in) NS.
|
|
|
|
|
|
bool hardware_ns_;
|
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
|
|
|
|
|
2016-09-19 15:44:09 +02:00
|
|
|
|
// True if device supports the low-latency OpenSL ES audio path for output.
|
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
|
|
|
|
bool low_latency_playout_;
|
|
|
|
|
|
|
2016-09-19 15:44:09 +02:00
|
|
|
|
// True if device supports the low-latency OpenSL ES audio path for input.
|
|
|
|
|
|
bool low_latency_record_;
|
|
|
|
|
|
|
2016-05-25 05:15:10 -07:00
|
|
|
|
// True if device supports the low-latency OpenSL ES pro-audio path.
|
|
|
|
|
|
bool pro_audio_;
|
|
|
|
|
|
|
2018-03-16 10:09:49 +01:00
|
|
|
|
// True if device supports the low-latency AAudio audio path.
|
|
|
|
|
|
bool a_audio_;
|
|
|
|
|
|
|
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
|
|
|
|
// The delay estimate can take one of two fixed values depending on if the
|
|
|
|
|
|
// device supports low-latency output or not.
|
|
|
|
|
|
int delay_estimate_in_milliseconds_;
|
|
|
|
|
|
|
2015-03-27 10:56:23 +01:00
|
|
|
|
// Contains native parameters (e.g. sample rate, channel configuration).
|
|
|
|
|
|
// Set at construction in OnCacheAudioParameters() which is called from
|
|
|
|
|
|
// Java on the same thread as this object is created on.
|
|
|
|
|
|
AudioParameters playout_parameters_;
|
|
|
|
|
|
AudioParameters record_parameters_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
|
#endif // MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_
|