Add screen share receive support and improve video calling rotation.

This commit is contained in:
Cody Henthorne
2021-05-25 12:15:07 -04:00
committed by Greyson Parrelli
parent 513e5b45c5
commit b9b2924939
41 changed files with 665 additions and 397 deletions

View File

@@ -22,6 +22,7 @@ import org.webrtc.CameraVideoCapturer;
import org.webrtc.CapturerObserver;
import org.webrtc.EglBase;
import org.webrtc.SurfaceTextureHelper;
import org.webrtc.VideoFrame;
import java.util.LinkedList;
import java.util.List;
@@ -81,7 +82,7 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
if (capturer != null) {
capturer.initialize(SurfaceTextureHelper.create("WebRTC-SurfaceTextureHelper", eglBase.getEglBaseContext()),
context,
observer);
new CameraCapturerWrapper(observer));
capturer.setOrientation(orientation);
isInitialized = true;
}
@@ -297,4 +298,30 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
return new Camera2Capturer(context, deviceName, eventsHandler, new FilteredCamera2Enumerator(context));
}
}
private class CameraCapturerWrapper implements CapturerObserver {
private final CapturerObserver observer;
public CameraCapturerWrapper(@NonNull CapturerObserver observer) {
this.observer = observer;
}
@Override
public void onCapturerStarted(boolean success) {
observer.onCapturerStarted(success);
if (success) {
cameraEventListener.onFullyInitialized();
}
}
@Override
public void onCapturerStopped() {
observer.onCapturerStopped();
}
@Override
public void onFrameCaptured(VideoFrame videoFrame) {
observer.onFrameCaptured(videoFrame);
}
}
}

View File

@@ -3,5 +3,6 @@ package org.thoughtcrime.securesms.ringrtc;
import androidx.annotation.NonNull;
public interface CameraEventListener {
void onFullyInitialized();
void onCameraSwitchCompleted(@NonNull CameraState newCameraState);
}