8000 Do not call reStartCamera() for screen capture by XuanTung95 · Pull Request #552 · flutter-webrtc/flutter-webrtc · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1024,7 +1025,7 @@ private class NoSuchFieldWithNameException extends NoSuchFieldException {

public void reStartCamera(IsCameraEnabled getCameraId) {
for (Map.Entry<String, VideoCapturerInfo> 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,
Expand All @@ -1043,5 +1044,6 @@ public class VideoCapturerInfo {
int width;
int height;
int fps;
boolean isScreenCapture = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
0