mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Enable call vanity when joining a video call.
This commit is contained in:
@@ -22,6 +22,7 @@ import org.webrtc.CameraVideoCapturer;
|
||||
import org.webrtc.CapturerObserver;
|
||||
import org.webrtc.SurfaceTextureHelper;
|
||||
import org.webrtc.VideoFrame;
|
||||
import org.webrtc.VideoSink;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -47,6 +48,7 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
|
||||
private boolean enabled;
|
||||
private boolean isInitialized;
|
||||
private int orientation;
|
||||
@Nullable private volatile VideoSink vanitySink;
|
||||
|
||||
public Camera(@NonNull Context context,
|
||||
@NonNull CameraEventListener cameraEventListener,
|
||||
@@ -139,6 +141,15 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
|
||||
this.cameraEventListener = cameraEventListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a vanity sink that receives camera frames directly from the capturer,
|
||||
* bypassing the WebRTC VideoTrack pipeline. This allows local preview to work
|
||||
* even when the video track is disabled (e.g., during incoming call ringing).
|
||||
*/
|
||||
public void setVanitySink(@Nullable VideoSink vanitySink) {
|
||||
this.vanitySink = vanitySink;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
if (capturer != null) {
|
||||
capturer.dispose();
|
||||
@@ -327,6 +338,10 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
|
||||
@Override
|
||||
public void onFrameCaptured(VideoFrame videoFrame) {
|
||||
observer.onFrameCaptured(videoFrame);
|
||||
VideoSink sink = vanitySink;
|
||||
if (sink != null) {
|
||||
sink.onFrame(videoFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user