Closed wmailn closed 1 year ago
I have both nativeWindow and captureWindow Windows in the android-camera2-capture.cpp file, Does this mean that separate capture and preview Windows are considered and supported?
Hi,
I didn't took a look at your logs because they are pasted as plain text and it's impossible to read them like that, but to answer your question:
I have both nativeWindow and captureWindow Windows in the android-camera2-capture.cpp file, Does this mean that separate capture and preview Windows are considered and supported?
Yes, there is already a separation between the local preview and the remote video display, see our tutorial for exemple: https://gitlab.linphone.org/BC/public/tutorials/-/blob/master/android/kotlin/4-OutgoingCall/app/src/main/java/org/linphone/outgoingcall/OutgoingCallActivity.kt#L127
Thank you very much for your reply.
I carefully read what you said about OutgoingCallActivity.kt file and its implementation, I guess I didn't make myself clear.
What I want to say is whether the local capture video to the camera window and the window used to display the local video can be divided into two Windows. Instead of displaying the local video and displaying the remote video two Windows.
For example, code like the following
int oesTextureId = GlUtil.generateTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES); SurfaceTexture surfaceTexture = new SurfaceTexture(oesTextureId); camera.startCamera(surfaceTexture ,cameraId);
When the camera started, it was a TEXTURE created internally instead of the actual preview window, and then passed the camera data to the actual preview window to avoid the camera opening and closing as the preview window was repeatedly created.
Is there any way to support this approach that I have described?
No, I don't think so. On Android you have to use and display the preview texture created by the Android API, it's a security created to prevent a malicious app from capturing the video without the user knowing he is being filmed.
No, I don't think so. On Android you have to use and display the preview texture created by the Android API, it's a security created to prevent a malicious app from capturing the video without the user knowing he is being filmed.
I found that camera1 had this limitation, but camera2 doesn't have this limitation anymore, can use ImageReader to get the raw video data.
Alternatively, use code like the following so that you can separate the actual preview window from the one you need to capture the camera, so that you don't have to open or close the camera repeatedly while creating the preview window.
int[] textureIds = new int[1];
GLES20.glGenTextures(1, textureIds, 0); cameraRenderTextureId = textureIds[0]; GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, cameraRenderTextureId); GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT); GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT); GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
surfaceTexture = new SurfaceTexture(cameraRenderTextureId);
surfaceTexture.setOnFrameAvailableListener(this);
if (onSurfaceListener != null) {
onSurfaceListener.onSurfaceCreate(surfaceTexture);
}
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);
camera.setPreviewTexture(surfaceTexture);
The code comes from: https://github.com/ChinaZeng/OpenGLESCameraDemo
Sorry but we won't do that.
Sorry but we won't do that.
I understand. Thank you very much.
Hi,
Describe the bug (mandatory) The camera is turned on and off repeatedly.
To Reproduce (mandatory) Repeatedly destroy and reconfigure the preview window to appear.
Expected behavior (mandatory) I hope the camera doesn't have to start working again when I switch the preview window.
Please complete the following information (mandatory)
SDK logs (mandatory) HIDE
Adb logcat logs (mandatory if native crash) The APP runs normally and does not crash.