mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-23 21:09:00 +00:00
Update to webrtc M64
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
@@ -40,6 +41,7 @@ import org.thoughtcrime.securesms.service.RotateSignedPreKeyListener;
|
||||
import org.thoughtcrime.securesms.service.UpdateApkRefreshListener;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.webrtc.PeerConnectionFactory;
|
||||
import org.webrtc.PeerConnectionFactory.InitializationOptions;
|
||||
import org.webrtc.voiceengine.WebRtcAudioManager;
|
||||
import org.webrtc.voiceengine.WebRtcAudioUtils;
|
||||
import org.whispersystems.jobqueue.JobManager;
|
||||
@@ -171,22 +173,23 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
add("Pixel XL");
|
||||
}};
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
|
||||
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
|
||||
}
|
||||
|
||||
if (!OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
|
||||
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
||||
}
|
||||
|
||||
PeerConnectionFactory.initializeAndroidGlobals(this, true, true, true);
|
||||
if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
|
||||
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
|
||||
}
|
||||
|
||||
if (!OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
|
||||
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
||||
}
|
||||
|
||||
PeerConnectionFactory.initialize(InitializationOptions.builder(this)
|
||||
.setEnableVideoHwAcceleration(true)
|
||||
.createInitializationOptions());
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private void initializeCircumvention() {
|
||||
AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
|
@@ -584,6 +584,7 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
||||
|
||||
setCallInProgressNotification(TYPE_ESTABLISHED, recipient);
|
||||
|
||||
this.peerConnection.setCommunicationMode();
|
||||
this.peerConnection.setAudioEnabled(microphoneEnabled);
|
||||
this.peerConnection.setVideoEnabled(localVideoEnabled);
|
||||
|
||||
@@ -1044,7 +1045,7 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
||||
}
|
||||
|
||||
if (stream.videoTracks != null && stream.videoTracks.size() == 1) {
|
||||
VideoTrack videoTrack = stream.videoTracks.getFirst();
|
||||
VideoTrack videoTrack = stream.videoTracks.get(0);
|
||||
videoTrack.setEnabled(true);
|
||||
videoTrack.addRenderer(new VideoRenderer(remoteRenderer));
|
||||
}
|
||||
|
@@ -69,6 +69,9 @@ public class PeerConnectionWrapper {
|
||||
audioConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
|
||||
|
||||
this.peerConnection = factory.createPeerConnection(configuration, constraints, observer);
|
||||
this.peerConnection.setAudioPlayout(false);
|
||||
this.peerConnection.setAudioRecording(false);
|
||||
|
||||
this.videoCapturer = createVideoCapturer(context);
|
||||
|
||||
MediaStream mediaStream = factory.createLocalMediaStream("ARDAMS");
|
||||
@@ -107,6 +110,11 @@ public class PeerConnectionWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
public void setCommunicationMode() {
|
||||
this.peerConnection.setAudioPlayout(true);
|
||||
this.peerConnection.setAudioRecording(true);
|
||||
}
|
||||
|
||||
public void setAudioEnabled(boolean enabled) {
|
||||
this.audioTrack.setEnabled(enabled);
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
|
||||
public class SignalAudioManager {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = SignalAudioManager.class.getSimpleName();
|
||||
|
||||
private final Context context;
|
||||
@@ -61,11 +62,7 @@ public class SignalAudioManager {
|
||||
audioManager.setSpeakerphoneOn(false);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
} else {
|
||||
audioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
}
|
||||
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
|
||||
outgoingRinger.start(type);
|
||||
}
|
||||
@@ -80,11 +77,7 @@ public class SignalAudioManager {
|
||||
incomingRinger.stop();
|
||||
outgoingRinger.stop();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
} else {
|
||||
audioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
}
|
||||
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
|
||||
if (!preserveSpeakerphone) {
|
||||
audioManager.setSpeakerphoneOn(false);
|
||||
|
Reference in New Issue
Block a user