diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java b/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java index cbcf006ed8..6d3afa1936 100755 --- a/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java @@ -495,6 +495,7 @@ public void onStop() { info.width = wm.getDefaultDisplay().getWidth(); info.height = wm.getDefaultDisplay().getHeight(); info.fps = DEFAULT_FPS; + info.isScreenCapture = true; info.capturer = videoCapturer; videoCapturer.startCapture(info.width, info.height, info.fps); @@ -1024,7 +1025,7 @@ private class NoSuchFieldWithNameException extends NoSuchFieldException { public void reStartCamera(IsCameraEnabled getCameraId) { for (Map.Entry item : mVideoCapturers.entrySet()) { - if (getCameraId.isEnabled(item.getKey())) { + if (!item.getValue().isScreenCapture && getCameraId.isEnabled(item.getKey())) { item.getValue().capturer.startCapture( item.getValue().width, item.getValue().height, @@ -1043,5 +1044,6 @@ public class VideoCapturerInfo { int width; int height; int fps; + boolean isScreenCapture = false; } } diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java b/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java index eced556aec..79bde667a3 100644 --- a/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java @@ -20,6 +20,7 @@ import com.cloudwebrtc.webrtc.utils.ObjectType; import org.webrtc.AudioTrack; +import org.webrtc.CryptoOptions; import org.webrtc.DefaultVideoDecoderFactory; import org.webrtc.DefaultVideoEncoderFactory; import org.webrtc.DtmfSender; @@ -924,7 +925,17 @@ private RTCConfiguration parseRTCConfiguration(ConstraintsMap map) { final boolean v = map.getBoolean("presumeWritableWhenFullyRelayed"); conf.presumeWritableWhenFullyRelayed = v; } - + // cryptoOptions + if (map.hasKey("cryptoOptions") + && map.getType("cryptoOptions") == ObjectType.Map) { + final ConstraintsMap cryptoOptions = map.getMap("cryptoOptions"); + conf.cryptoOptions = CryptoOptions.builder() + .setEnableGcmCryptoSuites(cryptoOptions.hasKey("enableGcmCryptoSuites") && cryptoOptions.getBoolean("enableGcmCryptoSuites")) + .setRequireFrameEncryption(cryptoOptions.hasKey("requireFrameEncryption") && cryptoOptions.getBoolean("requireFrameEncryption")) + .setEnableEncryptedRtpHeaderExtensions(cryptoOptions.hasKey("enableEncryptedRtpHeaderExtensions") && cryptoOptions.getBoolean("enableEncryptedRtpHeaderExtensions")) + .setEnableAes128Sha1_32CryptoCipher(cryptoOptions.hasKey("enableAes128Sha1_32CryptoCipher") && cryptoOptions.getBoolean("enableAes128Sha1_32CryptoCipher")) + .createCryptoOptions(); + } return conf; }