Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] [camera] #3

Open
anisghaoui opened this issue Jan 22, 2022 · 8 comments
Open

[Question] [camera] #3

anisghaoui opened this issue Jan 22, 2022 · 8 comments

Comments

@anisghaoui
Copy link

HI @ThibaudM
I was toying around with the app and I noticed that on many phone there is only mention of one "Camera". It is never the frontal nor the wide angle ones. Is there anyway to obtain these or to make it so the app can see all camera sensors anyway? is it even feasible?

thank you a lot for sharing your app!

ThibaudM added a commit that referenced this issue Jan 31, 2022
@ThibaudM ThibaudM mentioned this issue Jan 31, 2022
Merged
@ThibaudM
Copy link
Member

ThibaudM commented Jan 31, 2022

Could you try the PR #4?
I have implemented the camera lens choice in the settings.

@anisghaoui
Copy link
Author

Hi!
I just tried RP #4 and It worked for both FRONT and BACK.

External gives me an exception as it calls a non-existing camera. Here is the console after "Davey!" from OpenGL

I/OpenGLRenderer: Davey! duration=1909ms; Flags=0, IntendedVsync=3648033399922, Vsync=3649900066626, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=3649901947668, AnimationStart=3649902051418, PerformTraversalsStart=3649902732720, DrawStart=3649918977304, SyncQueued=3649940390429, SyncStart=3649940831991, IssueDrawCommandsStart=3649940981210, SwapBuffers=3649942748345, FrameCompleted=3649943366939, DequeueBufferDuration=94322, QueueBufferDuration=162136, GpuCompleted=1897245480, 
I/.tyrex.senslog: WaitForGcToComplete blocked RunEmptyCheckpoint on ProfileSaver for 20.046ms
I/CameraManagerGlobal: Connecting to camera service
W/CameraManagerGlobal: [soar.cts] ignore the status update of camera: 2
W/CameraManagerGlobal: [soar.cts] ignore the status update of camera: 3
E/CameraManagerGlobal: cameraIdHasConcurrentStreamsLocked called on non existing camera id
E/SensorManager: registerListenerImpl sensorName:lsm6ds3c Accelerometer Non-wakeup,isWakeUpSensor:false,callingApp: fr.inria.tyrex.senslogs,callingPid:2411,callingUid:10049
E/AndroidRuntime: FATAL EXCEPTION: Thread-3
    Process: fr.inria.tyrex.senslogs, PID: 2411
    java.lang.IllegalArgumentException: Not allowed to open CameraID 2
        at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:809)
        at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:744)
        at fr.inria.tyrex.senslogs.model.sensors.CameraRecorder.startInternal(CameraRecorder.java:178)
        at fr.inria.tyrex.senslogs.model.sensors.CameraRecorder.start(CameraRecorder.java:145)
        at fr.inria.tyrex.senslogs.control.Recorder.lambda$play$0$fr-inria-tyrex-senslogs-control-Recorder(Recorder.java:133)
        at fr.inria.tyrex.senslogs.control.Recorder$$ExternalSyntheticLambda1.run(Unknown Source:6)
        at java.lang.Thread.run(Thread.java:923)
I/Process: Sending signal. PID: 2411 SIG: 9
Disconnected from the target VM, address: 'localhost:63205', transport: 'socket'

@anisghaoui
Copy link
Author

I didn't test it on my wide-angle phone (I can only do that tomorrow)
This isn't the exact thought I had in mind. I had imagined that it could be possible to have all cameras available on the device to record at the same: each on its own thread? too heavy performance? memory-bound? This was the easiest way to implement?

Ty already for making it possible to have a setting to choose camera.

@anisghaoui
Copy link
Author

Update: I tried it on my wide angle. it isn't even listed. Looking at your changes, it is predictable as you list only 3 types of LENS. a+

@ThibaudM
Copy link
Member

You are right, I have used predefined cameras (FRONT, BACK, EXTERNAL).

I have just tested a code snippet on my Pixel 5 to list all available cameras via CameraManager#getCameraIdList(), but it only lists one FRONT camera (instead of two).
We should use multi camera API for both: using wide-angle cameras and multiple cameras at the same time.

Unfortunately, I do not have the time to do this kind of change at this time :/

@anisghaoui
Copy link
Author

anisghaoui commented Feb 1, 2022

Well, I completely understand. I will try my luck at it. Your work solved a huge problem in my first experiment and might do the same for the second. Thanks a lot for your time!

@anisghaoui
Copy link
Author

anisghaoui commented Feb 1, 2022

I noticed that you forked camera-samples from Android.
what about this repo, particularly this part. Though it is 3 years old and in Kotlin, do you think it offers any insight about the task I am planning?

@ThibaudM
Copy link
Member

ThibaudM commented Feb 8, 2022

Sorry for the late answer,
It seems multiple camera API is the way to do what you are looking for. But I never gave it a try ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants