|
@@ -15,6 +15,8 @@ import android.util.Log;
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+
|
|
|
import com.wdkl.ncs.janus.render.ProxyVideoSink;
|
|
|
import com.wdkl.ncs.janus.rtc.observer.CreatePeerConnectionCallback;
|
|
|
import com.wdkl.ncs.janus.util.Constant;
|
|
@@ -38,6 +40,9 @@ import org.webrtc.SurfaceViewRenderer;
|
|
|
import org.webrtc.VideoCapturer;
|
|
|
import org.webrtc.VideoDecoderFactory;
|
|
|
import org.webrtc.VideoEncoderFactory;
|
|
|
+import org.webrtc.VideoFrame;
|
|
|
+import org.webrtc.VideoProcessor;
|
|
|
+import org.webrtc.VideoSink;
|
|
|
import org.webrtc.VideoSource;
|
|
|
import org.webrtc.VideoTrack;
|
|
|
import org.webrtc.audio.AudioDeviceModule;
|
|
@@ -74,8 +79,8 @@ public class WebRTCEngine {
|
|
|
private static final String VIDEO_CODEC_VP8 = "VP8";
|
|
|
private static final String VIDEO_CODEC_VP9 = "VP9";
|
|
|
private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyAgreement";
|
|
|
- private static final int VIDEO_RESOLUTION_WIDTH = 1280;
|
|
|
- private static final int VIDEO_RESOLUTION_HEIGHT = 800;
|
|
|
+ private static final int VIDEO_RESOLUTION_WIDTH = 960;
|
|
|
+ private static final int VIDEO_RESOLUTION_HEIGHT =640 ;
|
|
|
private static final int FPS = 30;
|
|
|
private String preferredVideoCodec;
|
|
|
private PeerConnectionParameters peerConnectionParameters;
|
|
@@ -344,8 +349,8 @@ public class WebRTCEngine {
|
|
|
for (String deviceName : deviceNames) {
|
|
|
Log.d(TAG, "createCameraCapture device name: " + deviceName);
|
|
|
if (enumerator.isFrontFacing(deviceName)) {
|
|
|
+ enumerator.getSupportedFormats(deviceName);
|
|
|
VideoCapturer videoCapturer = enumerator.createCapturer(deviceName, null);
|
|
|
-
|
|
|
if (videoCapturer != null) {
|
|
|
return videoCapturer;
|
|
|
}
|
|
@@ -421,9 +426,9 @@ public class WebRTCEngine {
|
|
|
surfaceTextureHelper = SurfaceTextureHelper.create("CaptureThread", mRootEglBase.getEglBaseContext());
|
|
|
videoSource = factory.createVideoSource(captureAndroid.isScreencast());
|
|
|
|
|
|
+
|
|
|
captureAndroid.initialize(surfaceTextureHelper, mContext, videoSource.getCapturerObserver());
|
|
|
captureAndroid.startCapture(VIDEO_RESOLUTION_WIDTH, VIDEO_RESOLUTION_HEIGHT, FPS);
|
|
|
-
|
|
|
VideoTrack _localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
|
|
|
_localStream.addTrack(_localVideoTrack);
|
|
|
}
|
|
@@ -443,7 +448,6 @@ public class WebRTCEngine {
|
|
|
localRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
|
|
|
localRenderer.setMirror(true);
|
|
|
localRenderer.setZOrderMediaOverlay(isOverlay);
|
|
|
-
|
|
|
localSink = new ProxyVideoSink();
|
|
|
localSink.setTarget(localRenderer);
|
|
|
if (_localStream.videoTracks.size() > 0) {
|
|
@@ -636,6 +640,7 @@ public class WebRTCEngine {
|
|
|
if (captureAndroid == null) return;
|
|
|
if (captureAndroid instanceof CameraVideoCapturer) {
|
|
|
CameraVideoCapturer cameraVideoCapturer = (CameraVideoCapturer) captureAndroid;
|
|
|
+
|
|
|
try {
|
|
|
cameraVideoCapturer.switchCamera(new CameraVideoCapturer.CameraSwitchHandler() {
|
|
|
@Override
|