Rabbit-R1/android (non root)/java/sources/org/webrtc/NativeCapturerObserver.java
2024-05-21 17:08:36 -04:00

34 lines
1.3 KiB
Java

package org.webrtc;
import org.webrtc.VideoFrame;
import org.webrtc.VideoProcessor;
/* loaded from: classes3.dex */
class NativeCapturerObserver implements CapturerObserver {
private final NativeAndroidVideoTrackSource nativeAndroidVideoTrackSource;
public NativeCapturerObserver(long j) {
this.nativeAndroidVideoTrackSource = new NativeAndroidVideoTrackSource(j);
}
@Override // org.webrtc.CapturerObserver
public void onCapturerStarted(boolean z) {
this.nativeAndroidVideoTrackSource.setState(z);
}
@Override // org.webrtc.CapturerObserver
public void onCapturerStopped() {
this.nativeAndroidVideoTrackSource.setState(false);
}
@Override // org.webrtc.CapturerObserver
public void onFrameCaptured(VideoFrame videoFrame) {
VideoProcessor.FrameAdaptationParameters adaptFrame = this.nativeAndroidVideoTrackSource.adaptFrame(videoFrame);
if (adaptFrame == null) {
return;
}
VideoFrame.Buffer cropAndScale = videoFrame.getBuffer().cropAndScale(adaptFrame.cropX, adaptFrame.cropY, adaptFrame.cropWidth, adaptFrame.cropHeight, adaptFrame.scaleWidth, adaptFrame.scaleHeight);
this.nativeAndroidVideoTrackSource.onFrameCaptured(new VideoFrame(cropAndScale, videoFrame.getRotation(), adaptFrame.timestampNs));
cropAndScale.release();
}
}