Files
platform-external-webrtc/sdk/android/api/org/webrtc/audio/AudioDeviceModule.java
Magnus Jedvert 66f1e9eb34 Android: Add AudioDeviceModule interface and clean up implementation code
This CL introduces sdk/android/api/org/webrtc/audio/AudioDeviceModule.java,
which is the new interface for audio device modules on Android.

This CL also refactors the main AudioDeviceModule implementation, which
is sdk/android/api/org/webrtc/audio/JavaAudioDeviceModule.java and makes
it conform to the new interface. The old code used global static methods
to configure the audio device code. This CL gets rid of all that and uses
a builder pattern in JavaAudioDeviceModule instead. The only two dynamic
methods left in the interface are setSpeakerMute() and setMicrophoneMute().
Removing the global static methods allowed a significant cleanup, and e.g.
the file sdk/android/src/jni/audio_device/audio_manager.cc has been
completely removed.

The PeerConnectionFactory interface is also updated to allow passing in
an external AudioDeviceModule. The current built-in ADM is encapsulated
under LegacyAudioDeviceModule.java, which is the default for now to
ensure backwards compatibility.

Bug: webrtc:7452
Change-Id: I64d5f4dba9a004da001f1acb2bd0c1b1f2b64f21
Reviewed-on: https://webrtc-review.googlesource.com/65360
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22765}
2018-04-06 10:13:02 +00:00

39 lines
1.4 KiB
Java

/*
* Copyright 2018 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.
*/
package org.webrtc.audio;
/**
* This interface is a thin wrapper on top of a native C++ webrtc::AudioDeviceModule (ADM). The
* reason for basing it on a native ADM instead of a pure Java interface is that we have two native
* Android implementations (OpenSLES and AAudio) that does not make sense to wrap through JNI.
*
* <p>Note: This class is still under development and may change without notice.
*/
public interface AudioDeviceModule {
/**
* Returns a C++ pointer to a webrtc::AudioDeviceModule. Caller does _not_ take ownership and
* lifetime is handled through the release() call.
*/
long getNativeAudioDeviceModulePointer();
/**
* Release resources for this AudioDeviceModule, including native resources. The object should not
* be used after this call.
*/
void release();
/** Control muting/unmuting the speaker. */
void setSpeakerMute(boolean mute);
/** Control muting/unmuting the microphone. */
void setMicrophoneMute(boolean mute);
}