Android: Split out audio device targets
This CL splits out the audio device module Java code into a separate target, and also splits up the audio device module implementations into three different build targets, one for OpenSLES, AAudio, and the Java based implementation. Bug: webrtc:7452, webrtc:9048 Change-Id: I8ec09c73580b468837223ddd420fb29ca61fdea5 Reviewed-on: https://webrtc-review.googlesource.com/66461 Reviewed-by: Paulina Hensman <phensman@webrtc.org> Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22727}
This commit is contained in:
committed by
Commit Bot
parent
571e6c9105
commit
e2be7ee2e8
@ -116,6 +116,7 @@ if (is_android) {
|
|||||||
":AppRTCMobile_resources",
|
":AppRTCMobile_resources",
|
||||||
"../modules/audio_device:audio_device_java",
|
"../modules/audio_device:audio_device_java",
|
||||||
"../rtc_base:base_java",
|
"../rtc_base:base_java",
|
||||||
|
"../sdk/android:audio_java",
|
||||||
"../sdk/android:base_java",
|
"../sdk/android:base_java",
|
||||||
"../sdk/android:hwcodecs_java",
|
"../sdk/android:hwcodecs_java",
|
||||||
"../sdk/android:libjingle_peerconnection_java",
|
"../sdk/android:libjingle_peerconnection_java",
|
||||||
|
|||||||
@ -145,21 +145,27 @@ rtc_source_set("native_api_audio_device_module") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":audio_device_jni",
|
":audio_device_base_jni",
|
||||||
":base_jni",
|
":base_jni",
|
||||||
|
":java_audio_device_jni",
|
||||||
|
":opensles_audio_device_jni",
|
||||||
"../../modules/audio_device:audio_device",
|
"../../modules/audio_device:audio_device",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
"../../system_wrappers:metrics_api",
|
"../../system_wrappers:metrics_api",
|
||||||
]
|
]
|
||||||
|
if (rtc_enable_android_aaudio) {
|
||||||
|
deps += [ ":aaudio_audio_device_jni" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (!build_with_chromium && is_clang) {
|
if (!build_with_chromium && is_clang) {
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_source_set("audio_device_jni") {
|
rtc_source_set("audio_device_base_jni") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
@ -168,12 +174,54 @@ rtc_source_set("audio_device_jni") {
|
|||||||
"src/jni/audio_device/audio_device_module.h",
|
"src/jni/audio_device/audio_device_module.h",
|
||||||
"src/jni/audio_device/audio_manager.cc",
|
"src/jni/audio_device/audio_manager.cc",
|
||||||
"src/jni/audio_device/audio_manager.h",
|
"src/jni/audio_device/audio_manager.h",
|
||||||
"src/jni/audio_device/audio_record_jni.cc",
|
|
||||||
"src/jni/audio_device/audio_record_jni.h",
|
|
||||||
"src/jni/audio_device/audio_track_jni.cc",
|
|
||||||
"src/jni/audio_device/audio_track_jni.h",
|
|
||||||
"src/jni/audio_device/build_info.cc",
|
"src/jni/audio_device/build_info.cc",
|
||||||
"src/jni/audio_device/build_info.h",
|
"src/jni/audio_device/build_info.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
":base_jni",
|
||||||
|
":generated_audio_device_base_jni",
|
||||||
|
":native_api_jni",
|
||||||
|
"../../api:optional",
|
||||||
|
"../../modules/audio_device:audio_device",
|
||||||
|
"../../modules/audio_device:audio_device_buffer",
|
||||||
|
"../../rtc_base:checks",
|
||||||
|
"../../rtc_base:rtc_base_approved",
|
||||||
|
"../../system_wrappers:metrics_api",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rtc_enable_android_aaudio) {
|
||||||
|
rtc_source_set("aaudio_audio_device_jni") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
defines = [ "AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO" ]
|
||||||
|
sources = [
|
||||||
|
"src/jni/audio_device/aaudio_player.cc",
|
||||||
|
"src/jni/audio_device/aaudio_player.h",
|
||||||
|
"src/jni/audio_device/aaudio_recorder.cc",
|
||||||
|
"src/jni/audio_device/aaudio_recorder.h",
|
||||||
|
"src/jni/audio_device/aaudio_wrapper.cc",
|
||||||
|
"src/jni/audio_device/aaudio_wrapper.h",
|
||||||
|
]
|
||||||
|
libs = [ "aaudio" ]
|
||||||
|
deps = [
|
||||||
|
":audio_device_base_jni",
|
||||||
|
":base_jni",
|
||||||
|
"../../api:array_view",
|
||||||
|
"../../api:optional",
|
||||||
|
"../../modules/audio_device:audio_device",
|
||||||
|
"../../modules/audio_device:audio_device_buffer",
|
||||||
|
"../../rtc_base:checks",
|
||||||
|
"../../rtc_base:rtc_base",
|
||||||
|
"../../rtc_base:rtc_base_approved",
|
||||||
|
"../../system_wrappers",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rtc_source_set("opensles_audio_device_jni") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
sources = [
|
||||||
"src/jni/audio_device/opensles_common.cc",
|
"src/jni/audio_device/opensles_common.cc",
|
||||||
"src/jni/audio_device/opensles_common.h",
|
"src/jni/audio_device/opensles_common.h",
|
||||||
"src/jni/audio_device/opensles_player.cc",
|
"src/jni/audio_device/opensles_player.cc",
|
||||||
@ -182,37 +230,38 @@ rtc_source_set("audio_device_jni") {
|
|||||||
"src/jni/audio_device/opensles_recorder.h",
|
"src/jni/audio_device/opensles_recorder.h",
|
||||||
]
|
]
|
||||||
libs = [ "OpenSLES" ]
|
libs = [ "OpenSLES" ]
|
||||||
if (rtc_enable_android_aaudio) {
|
|
||||||
defines = [ "AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO" ]
|
|
||||||
sources += [
|
|
||||||
"src/jni/audio_device/aaudio_player.cc",
|
|
||||||
"src/jni/audio_device/aaudio_player.h",
|
|
||||||
"src/jni/audio_device/aaudio_recorder.cc",
|
|
||||||
"src/jni/audio_device/aaudio_recorder.h",
|
|
||||||
"src/jni/audio_device/aaudio_wrapper.cc",
|
|
||||||
"src/jni/audio_device/aaudio_wrapper.h",
|
|
||||||
]
|
|
||||||
libs += [ "aaudio" ]
|
|
||||||
}
|
|
||||||
deps = [
|
deps = [
|
||||||
|
":audio_device_base_jni",
|
||||||
":base_jni",
|
":base_jni",
|
||||||
":generated_audio_jni",
|
|
||||||
":native_api_jni",
|
|
||||||
"../../api:array_view",
|
"../../api:array_view",
|
||||||
"../../api:optional",
|
"../../api:optional",
|
||||||
"../../modules/audio_device:audio_device",
|
"../../modules/audio_device:audio_device",
|
||||||
"../../modules/audio_device:audio_device_buffer",
|
"../../modules/audio_device:audio_device_buffer",
|
||||||
"../../modules/utility:utility",
|
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base",
|
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../system_wrappers",
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
rtc_source_set("java_audio_device_jni") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"src/jni/audio_device/audio_record_jni.cc",
|
||||||
|
"src/jni/audio_device/audio_record_jni.h",
|
||||||
|
"src/jni/audio_device/audio_track_jni.cc",
|
||||||
|
"src/jni/audio_device/audio_track_jni.h",
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
":audio_device_base_jni",
|
||||||
|
":base_jni",
|
||||||
|
":generated_java_audio_device_jni",
|
||||||
|
"../../api:optional",
|
||||||
|
"../../modules/audio_device:audio_device",
|
||||||
|
"../../modules/audio_device:audio_device_buffer",
|
||||||
|
"../../rtc_base:checks",
|
||||||
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../system_wrappers:metrics_api",
|
"../../system_wrappers:metrics_api",
|
||||||
]
|
]
|
||||||
if (!build_with_chromium && is_clang) {
|
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
|
||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_static_library("null_audio_jni") {
|
rtc_static_library("null_audio_jni") {
|
||||||
@ -225,10 +274,17 @@ rtc_static_library("null_audio_jni") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_jni("generated_audio_jni") {
|
generate_jni("generated_audio_device_base_jni") {
|
||||||
sources = [
|
sources = [
|
||||||
"src/java/org/webrtc/audio/BuildInfo.java",
|
"src/java/org/webrtc/audio/BuildInfo.java",
|
||||||
"src/java/org/webrtc/audio/WebRtcAudioManager.java",
|
"src/java/org/webrtc/audio/WebRtcAudioManager.java",
|
||||||
|
]
|
||||||
|
jni_package = ""
|
||||||
|
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_jni("generated_java_audio_device_jni") {
|
||||||
|
sources = [
|
||||||
"src/java/org/webrtc/audio/WebRtcAudioRecord.java",
|
"src/java/org/webrtc/audio/WebRtcAudioRecord.java",
|
||||||
"src/java/org/webrtc/audio/WebRtcAudioTrack.java",
|
"src/java/org/webrtc/audio/WebRtcAudioTrack.java",
|
||||||
]
|
]
|
||||||
@ -595,10 +651,11 @@ rtc_static_library("peerconnection_jni") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":audio_device_jni",
|
":audio_device_base_jni",
|
||||||
":base_jni",
|
":base_jni",
|
||||||
":generated_external_classes_jni",
|
":generated_external_classes_jni",
|
||||||
":generated_peerconnection_jni",
|
":generated_peerconnection_jni",
|
||||||
|
":java_audio_device_jni",
|
||||||
":native_api_jni",
|
":native_api_jni",
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../api:libjingle_peerconnection_api",
|
"../../api:libjingle_peerconnection_api",
|
||||||
@ -711,6 +768,7 @@ dist_jar("libwebrtc") {
|
|||||||
no_build_hooks = true
|
no_build_hooks = true
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
":audio_java",
|
||||||
":base_java",
|
":base_java",
|
||||||
":hwcodecs_java",
|
":hwcodecs_java",
|
||||||
":libjingle_peerconnection_java",
|
":libjingle_peerconnection_java",
|
||||||
@ -765,7 +823,6 @@ rtc_android_library("base_java") {
|
|||||||
"api/org/webrtc/VideoSink.java",
|
"api/org/webrtc/VideoSink.java",
|
||||||
"api/org/webrtc/YuvConverter.java",
|
"api/org/webrtc/YuvConverter.java",
|
||||||
"api/org/webrtc/YuvHelper.java",
|
"api/org/webrtc/YuvHelper.java",
|
||||||
"api/org/webrtc/audio/JavaAudioDeviceModule.java",
|
|
||||||
"src/java/org/webrtc/AndroidVideoTrackSourceObserver.java",
|
"src/java/org/webrtc/AndroidVideoTrackSourceObserver.java",
|
||||||
"src/java/org/webrtc/CalledByNative.java",
|
"src/java/org/webrtc/CalledByNative.java",
|
||||||
"src/java/org/webrtc/CalledByNativeUnchecked.java",
|
"src/java/org/webrtc/CalledByNativeUnchecked.java",
|
||||||
@ -790,16 +847,27 @@ rtc_android_library("base_java") {
|
|||||||
"src/java/org/webrtc/WrappedNativeI420Buffer.java",
|
"src/java/org/webrtc/WrappedNativeI420Buffer.java",
|
||||||
"src/java/org/webrtc/WrappedNativeVideoEncoder.java",
|
"src/java/org/webrtc/WrappedNativeVideoEncoder.java",
|
||||||
"src/java/org/webrtc/WrappedNativeVideoDecoder.java",
|
"src/java/org/webrtc/WrappedNativeVideoDecoder.java",
|
||||||
|
]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"//rtc_base:base_java",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
rtc_android_library("audio_java") {
|
||||||
|
java_files = [
|
||||||
|
"api/org/webrtc/audio/JavaAudioDeviceModule.java",
|
||||||
|
"src/java/org/webrtc/audio/VolumeLogger.java",
|
||||||
"src/java/org/webrtc/audio/BuildInfo.java",
|
"src/java/org/webrtc/audio/BuildInfo.java",
|
||||||
"src/java/org/webrtc/audio/WebRtcAudioEffects.java",
|
"src/java/org/webrtc/audio/WebRtcAudioEffects.java",
|
||||||
"src/java/org/webrtc/audio/WebRtcAudioManager.java",
|
"src/java/org/webrtc/audio/WebRtcAudioManager.java",
|
||||||
"src/java/org/webrtc/audio/VolumeLogger.java",
|
|
||||||
"src/java/org/webrtc/audio/WebRtcAudioRecord.java",
|
"src/java/org/webrtc/audio/WebRtcAudioRecord.java",
|
||||||
"src/java/org/webrtc/audio/WebRtcAudioTrack.java",
|
"src/java/org/webrtc/audio/WebRtcAudioTrack.java",
|
||||||
"src/java/org/webrtc/audio/WebRtcAudioUtils.java",
|
"src/java/org/webrtc/audio/WebRtcAudioUtils.java",
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
":base_java",
|
||||||
"//rtc_base:base_java",
|
"//rtc_base:base_java",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -889,6 +957,7 @@ rtc_android_library("libjingle_peerconnection_java") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
":audio_java",
|
||||||
":base_java",
|
":base_java",
|
||||||
":hwcodecs_java",
|
":hwcodecs_java",
|
||||||
"//modules/audio_device:audio_device_java",
|
"//modules/audio_device:audio_device_java",
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class AAudioPlayer final : public AudioOutput,
|
|||||||
public rtc::MessageHandler {
|
public rtc::MessageHandler {
|
||||||
public:
|
public:
|
||||||
explicit AAudioPlayer(AudioManager* audio_manager);
|
explicit AAudioPlayer(AudioManager* audio_manager);
|
||||||
~AAudioPlayer();
|
~AAudioPlayer() override;
|
||||||
|
|
||||||
int Init() override;
|
int Init() override;
|
||||||
int Terminate() override;
|
int Terminate() override;
|
||||||
|
|||||||
@ -66,6 +66,10 @@ int AAudioRecorder::InitRecording() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AAudioRecorder::RecordingIsInitialized() const {
|
||||||
|
return initialized_;
|
||||||
|
}
|
||||||
|
|
||||||
int AAudioRecorder::StartRecording() {
|
int AAudioRecorder::StartRecording() {
|
||||||
RTC_LOG(INFO) << "StartRecording";
|
RTC_LOG(INFO) << "StartRecording";
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
@ -98,6 +102,10 @@ int AAudioRecorder::StopRecording() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AAudioRecorder::Recording() const {
|
||||||
|
return recording_;
|
||||||
|
}
|
||||||
|
|
||||||
void AAudioRecorder::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
|
void AAudioRecorder::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
|
||||||
RTC_LOG(INFO) << "AttachAudioBuffer";
|
RTC_LOG(INFO) << "AttachAudioBuffer";
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
|
|||||||
@ -48,17 +48,17 @@ class AAudioRecorder : public AudioInput,
|
|||||||
public rtc::MessageHandler {
|
public rtc::MessageHandler {
|
||||||
public:
|
public:
|
||||||
explicit AAudioRecorder(AudioManager* audio_manager);
|
explicit AAudioRecorder(AudioManager* audio_manager);
|
||||||
~AAudioRecorder();
|
~AAudioRecorder() override;
|
||||||
|
|
||||||
int Init() override;
|
int Init() override;
|
||||||
int Terminate() override;
|
int Terminate() override;
|
||||||
|
|
||||||
int InitRecording() override;
|
int InitRecording() override;
|
||||||
bool RecordingIsInitialized() const override { return initialized_; }
|
bool RecordingIsInitialized() const override;
|
||||||
|
|
||||||
int StartRecording() override;
|
int StartRecording() override;
|
||||||
int StopRecording() override;
|
int StopRecording() override;
|
||||||
bool Recording() const override { return recording_; }
|
bool Recording() const override;
|
||||||
|
|
||||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
|||||||
thread_checker_.DetachFromThread();
|
thread_checker_.DetachFromThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~AndroidAudioDeviceModule() { RTC_LOG(INFO) << __FUNCTION__; }
|
~AndroidAudioDeviceModule() override { RTC_LOG(INFO) << __FUNCTION__; }
|
||||||
|
|
||||||
int32_t ActiveAudioLayer(
|
int32_t ActiveAudioLayer(
|
||||||
AudioDeviceModule::AudioLayer* audioLayer) const override {
|
AudioDeviceModule::AudioLayer* audioLayer) const override {
|
||||||
|
|||||||
@ -20,20 +20,11 @@
|
|||||||
#include "rtc_base/refcount.h"
|
#include "rtc_base/refcount.h"
|
||||||
#include "rtc_base/refcountedobject.h"
|
#include "rtc_base/refcountedobject.h"
|
||||||
|
|
||||||
#include "sdk/android/generated_audio_jni/jni/WebRtcAudioManager_jni.h"
|
#include "sdk/android/generated_audio_device_base_jni/jni/WebRtcAudioManager_jni.h"
|
||||||
#include "sdk/android/src/jni/audio_device/audio_common.h"
|
#include "sdk/android/src/jni/audio_device/audio_common.h"
|
||||||
#include "sdk/android/src/jni/jni_helpers.h"
|
|
||||||
|
|
||||||
#if defined(AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO)
|
|
||||||
#include "sdk/android/src/jni/audio_device/aaudio_player.h"
|
|
||||||
#include "sdk/android/src/jni/audio_device/aaudio_recorder.h"
|
|
||||||
#endif
|
|
||||||
#include "sdk/android/src/jni/audio_device/audio_device_module.h"
|
#include "sdk/android/src/jni/audio_device/audio_device_module.h"
|
||||||
#include "sdk/android/src/jni/audio_device/audio_manager.h"
|
#include "sdk/android/src/jni/audio_device/audio_manager.h"
|
||||||
#include "sdk/android/src/jni/audio_device/audio_record_jni.h"
|
#include "sdk/android/src/jni/jni_helpers.h"
|
||||||
#include "sdk/android/src/jni/audio_device/audio_track_jni.h"
|
|
||||||
#include "sdk/android/src/jni/audio_device/opensles_player.h"
|
|
||||||
#include "sdk/android/src/jni/audio_device/opensles_recorder.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
#ifndef SDK_ANDROID_SRC_JNI_AUDIO_DEVICE_AUDIO_MANAGER_H_
|
#ifndef SDK_ANDROID_SRC_JNI_AUDIO_DEVICE_AUDIO_MANAGER_H_
|
||||||
#define SDK_ANDROID_SRC_JNI_AUDIO_DEVICE_AUDIO_MANAGER_H_
|
#define SDK_ANDROID_SRC_JNI_AUDIO_DEVICE_AUDIO_MANAGER_H_
|
||||||
|
|
||||||
#include <SLES/OpenSLES.h>
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -20,7 +19,6 @@
|
|||||||
#include "rtc_base/thread_checker.h"
|
#include "rtc_base/thread_checker.h"
|
||||||
#include "sdk/android/native_api/jni/scoped_java_ref.h"
|
#include "sdk/android/native_api/jni/scoped_java_ref.h"
|
||||||
#include "sdk/android/src/jni/audio_device/audio_common.h"
|
#include "sdk/android/src/jni/audio_device/audio_common.h"
|
||||||
#include "sdk/android/src/jni/audio_device/opensles_common.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
#include "rtc_base/platform_thread.h"
|
#include "rtc_base/platform_thread.h"
|
||||||
#include "rtc_base/timeutils.h"
|
#include "rtc_base/timeutils.h"
|
||||||
#include "sdk/android/generated_audio_jni/jni/WebRtcAudioRecord_jni.h"
|
#include "sdk/android/generated_java_audio_device_jni/jni/WebRtcAudioRecord_jni.h"
|
||||||
#include "sdk/android/src/jni/audio_device/audio_common.h"
|
#include "sdk/android/src/jni/audio_device/audio_common.h"
|
||||||
#include "sdk/android/src/jni/jni_helpers.h"
|
#include "sdk/android/src/jni/jni_helpers.h"
|
||||||
#include "system_wrappers/include/metrics.h"
|
#include "system_wrappers/include/metrics.h"
|
||||||
@ -115,6 +115,10 @@ int32_t AudioRecordJni::InitRecording() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudioRecordJni::RecordingIsInitialized() const {
|
||||||
|
return initialized_;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t AudioRecordJni::StartRecording() {
|
int32_t AudioRecordJni::StartRecording() {
|
||||||
RTC_LOG(INFO) << "StartRecording";
|
RTC_LOG(INFO) << "StartRecording";
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
@ -153,6 +157,10 @@ int32_t AudioRecordJni::StopRecording() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudioRecordJni::Recording() const {
|
||||||
|
return recording_;
|
||||||
|
}
|
||||||
|
|
||||||
void AudioRecordJni::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
|
void AudioRecordJni::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
|
||||||
RTC_LOG(INFO) << "AttachAudioBuffer";
|
RTC_LOG(INFO) << "AttachAudioBuffer";
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
|
|||||||
@ -51,11 +51,11 @@ class AudioRecordJni : public AudioInput {
|
|||||||
int32_t Terminate() override;
|
int32_t Terminate() override;
|
||||||
|
|
||||||
int32_t InitRecording() override;
|
int32_t InitRecording() override;
|
||||||
bool RecordingIsInitialized() const override { return initialized_; }
|
bool RecordingIsInitialized() const override;
|
||||||
|
|
||||||
int32_t StartRecording() override;
|
int32_t StartRecording() override;
|
||||||
int32_t StopRecording() override;
|
int32_t StopRecording() override;
|
||||||
bool Recording() const override { return recording_; }
|
bool Recording() const override;
|
||||||
|
|
||||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sdk/android/src/jni/audio_device/audio_track_jni.h"
|
#include "sdk/android/src/jni/audio_device/audio_track_jni.h"
|
||||||
#include "sdk/android/src/jni/audio_device/audio_manager.h"
|
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -18,7 +17,8 @@
|
|||||||
#include "rtc_base/format_macros.h"
|
#include "rtc_base/format_macros.h"
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
#include "rtc_base/platform_thread.h"
|
#include "rtc_base/platform_thread.h"
|
||||||
#include "sdk/android/generated_audio_jni/jni/WebRtcAudioTrack_jni.h"
|
#include "sdk/android/generated_java_audio_device_jni/jni/WebRtcAudioTrack_jni.h"
|
||||||
|
#include "sdk/android/src/jni/audio_device/audio_manager.h"
|
||||||
#include "sdk/android/src/jni/jni_helpers.h"
|
#include "sdk/android/src/jni/jni_helpers.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -80,6 +80,10 @@ int32_t AudioTrackJni::InitPlayout() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudioTrackJni::PlayoutIsInitialized() const {
|
||||||
|
return initialized_;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t AudioTrackJni::StartPlayout() {
|
int32_t AudioTrackJni::StartPlayout() {
|
||||||
RTC_LOG(INFO) << "StartPlayout";
|
RTC_LOG(INFO) << "StartPlayout";
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
@ -117,6 +121,10 @@ int32_t AudioTrackJni::StopPlayout() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudioTrackJni::Playing() const {
|
||||||
|
return playing_;
|
||||||
|
}
|
||||||
|
|
||||||
bool AudioTrackJni::SpeakerVolumeIsAvailable() {
|
bool AudioTrackJni::SpeakerVolumeIsAvailable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,11 +48,11 @@ class AudioTrackJni : public AudioOutput {
|
|||||||
int32_t Terminate() override;
|
int32_t Terminate() override;
|
||||||
|
|
||||||
int32_t InitPlayout() override;
|
int32_t InitPlayout() override;
|
||||||
bool PlayoutIsInitialized() const override { return initialized_; }
|
bool PlayoutIsInitialized() const override;
|
||||||
|
|
||||||
int32_t StartPlayout() override;
|
int32_t StartPlayout() override;
|
||||||
int32_t StopPlayout() override;
|
int32_t StopPlayout() override;
|
||||||
bool Playing() const override { return playing_; }
|
bool Playing() const override;
|
||||||
|
|
||||||
bool SpeakerVolumeIsAvailable() override;
|
bool SpeakerVolumeIsAvailable() override;
|
||||||
int SetSpeakerVolume(uint32_t volume) override;
|
int SetSpeakerVolume(uint32_t volume) override;
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "sdk/android/src/jni/audio_device/build_info.h"
|
#include "sdk/android/src/jni/audio_device/build_info.h"
|
||||||
|
|
||||||
#include "sdk/android/generated_audio_jni/jni/BuildInfo_jni.h"
|
#include "sdk/android/generated_audio_device_base_jni/jni/BuildInfo_jni.h"
|
||||||
#include "sdk/android/src/jni/jni_helpers.h"
|
#include "sdk/android/src/jni/jni_helpers.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|||||||
@ -106,6 +106,8 @@ OpenSLEngineManager::OpenSLEngineManager() {
|
|||||||
thread_checker_.DetachFromThread();
|
thread_checker_.DetachFromThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenSLEngineManager::~OpenSLEngineManager() = default;
|
||||||
|
|
||||||
SLObjectItf OpenSLEngineManager::GetOpenSLEngine() {
|
SLObjectItf OpenSLEngineManager::GetOpenSLEngine() {
|
||||||
RTC_LOG(INFO) << "GetOpenSLEngine";
|
RTC_LOG(INFO) << "GetOpenSLEngine";
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
|
|||||||
@ -70,6 +70,7 @@ typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf;
|
|||||||
class OpenSLEngineManager {
|
class OpenSLEngineManager {
|
||||||
public:
|
public:
|
||||||
OpenSLEngineManager();
|
OpenSLEngineManager();
|
||||||
|
~OpenSLEngineManager();
|
||||||
SLObjectItf GetOpenSLEngine();
|
SLObjectItf GetOpenSLEngine();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -114,6 +114,10 @@ int OpenSLESPlayer::InitPlayout() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OpenSLESPlayer::PlayoutIsInitialized() const {
|
||||||
|
return initialized_;
|
||||||
|
}
|
||||||
|
|
||||||
int OpenSLESPlayer::StartPlayout() {
|
int OpenSLESPlayer::StartPlayout() {
|
||||||
ALOGD("StartPlayout[tid=%d]", rtc::CurrentThreadId());
|
ALOGD("StartPlayout[tid=%d]", rtc::CurrentThreadId());
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
@ -168,6 +172,10 @@ int OpenSLESPlayer::StopPlayout() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OpenSLESPlayer::Playing() const {
|
||||||
|
return playing_;
|
||||||
|
}
|
||||||
|
|
||||||
bool OpenSLESPlayer::SpeakerVolumeIsAvailable() {
|
bool OpenSLESPlayer::SpeakerVolumeIsAvailable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,11 +68,11 @@ class OpenSLESPlayer : public AudioOutput {
|
|||||||
int Terminate() override;
|
int Terminate() override;
|
||||||
|
|
||||||
int InitPlayout() override;
|
int InitPlayout() override;
|
||||||
bool PlayoutIsInitialized() const override { return initialized_; }
|
bool PlayoutIsInitialized() const override;
|
||||||
|
|
||||||
int StartPlayout() override;
|
int StartPlayout() override;
|
||||||
int StopPlayout() override;
|
int StopPlayout() override;
|
||||||
bool Playing() const override { return playing_; }
|
bool Playing() const override;
|
||||||
|
|
||||||
bool SpeakerVolumeIsAvailable() override;
|
bool SpeakerVolumeIsAvailable() override;
|
||||||
int SetSpeakerVolume(uint32_t volume) override;
|
int SetSpeakerVolume(uint32_t volume) override;
|
||||||
|
|||||||
@ -110,6 +110,10 @@ int OpenSLESRecorder::InitRecording() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OpenSLESRecorder::RecordingIsInitialized() const {
|
||||||
|
return initialized_;
|
||||||
|
}
|
||||||
|
|
||||||
int OpenSLESRecorder::StartRecording() {
|
int OpenSLESRecorder::StartRecording() {
|
||||||
ALOGD("StartRecording[tid=%d]", rtc::CurrentThreadId());
|
ALOGD("StartRecording[tid=%d]", rtc::CurrentThreadId());
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
@ -168,6 +172,10 @@ int OpenSLESRecorder::StopRecording() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OpenSLESRecorder::Recording() const {
|
||||||
|
return recording_;
|
||||||
|
}
|
||||||
|
|
||||||
void OpenSLESRecorder::AttachAudioBuffer(AudioDeviceBuffer* audio_buffer) {
|
void OpenSLESRecorder::AttachAudioBuffer(AudioDeviceBuffer* audio_buffer) {
|
||||||
ALOGD("AttachAudioBuffer");
|
ALOGD("AttachAudioBuffer");
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
|
|||||||
@ -71,11 +71,11 @@ class OpenSLESRecorder : public AudioInput {
|
|||||||
int Terminate() override;
|
int Terminate() override;
|
||||||
|
|
||||||
int InitRecording() override;
|
int InitRecording() override;
|
||||||
bool RecordingIsInitialized() const override { return initialized_; }
|
bool RecordingIsInitialized() const override;
|
||||||
|
|
||||||
int StartRecording() override;
|
int StartRecording() override;
|
||||||
int StopRecording() override;
|
int StopRecording() override;
|
||||||
bool Recording() const override { return recording_; }
|
bool Recording() const override;
|
||||||
|
|
||||||
void AttachAudioBuffer(AudioDeviceBuffer* audio_buffer) override;
|
void AttachAudioBuffer(AudioDeviceBuffer* audio_buffer) override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user