1 /*
2  *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 package org.webrtc.audio;
12 
13 import org.webrtc.voiceengine.WebRtcAudioRecord;
14 import org.webrtc.voiceengine.WebRtcAudioTrack;
15 
16 /**
17  * This class represents the legacy AudioDeviceModule that is currently hardcoded into C++ WebRTC.
18  * It will return a null native AudioDeviceModule pointer, leading to an internal object being
19  * created inside WebRTC that is controlled by static calls to the classes under the voiceengine
20  * package. Please use the new JavaAudioDeviceModule instead of this class.
21  */
22 @Deprecated
23 public class LegacyAudioDeviceModule implements AudioDeviceModule {
24   @Override
getNativeAudioDeviceModulePointer()25   public long getNativeAudioDeviceModulePointer() {
26     // Returning a null pointer will make WebRTC construct the built-in legacy AudioDeviceModule for
27     // Android internally.
28     return 0;
29   }
30 
31   @Override
release()32   public void release() {
33     // All control for this ADM goes through static global methods and the C++ object is owned
34     // internally by WebRTC.
35   }
36 
37   @Override
setSpeakerMute(boolean mute)38   public void setSpeakerMute(boolean mute) {
39     WebRtcAudioTrack.setSpeakerMute(mute);
40   }
41 
42   @Override
setMicrophoneMute(boolean mute)43   public void setMicrophoneMute(boolean mute) {
44     WebRtcAudioRecord.setMicrophoneMute(mute);
45   }
46 }
47