Random crash with repeated Record/Preview
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
Piste de recherche
Aucun fichier du dépôt ni aucun test n’est identifié. Commencez par reproduire le cycle répété de démarrage/arrêt de vidéo Camera2 et MediaRecorder décrit dans l’issue, puis examinez les chemins CreateCaptureRequest, CreateCaptureSession et OnConfigureFailed avec les erreurs de caméra signalées. Le travail est terminé lorsque le cycle répété ne provoque plus de crash et que l’application revient à un état attendu après les erreurs.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
UPDATE: This appears to be related to https://github.com/android/camera-samples/issues/109, But with Camera2 instead of CameraX.
I've built a test app using Camera2 video and MediaRecoder. This was seemingly working, but I was having random crashes when stopping record when repeatedly starting/stopping recording. The result of this record state change is that the previewBuilder gets rebuilt with previewSurface + recordSurface (record Start), or just previewSurface (record Stop).
To track it down, I made the code cycle 100 times thru a 10 second record/stop at 15 second intervals. With this approach, I can almost always see a crash, though it could be at iteration 3 or at 80, sometimes not until 300. I've done this testing on multiple Galaxy S9/10 devices as well as on a Pixel 4. All fail the same way, eventually.
The crashes appear to happen either at CreateCaptureRequest or at CreateCaptureSession. And the errors vary from crash to crash, usually being one of these:
-
[Binder] java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List android.hardware.camera2.params.OutputConfiguration.getSurfaces()' on a null object reference
-
CAMERA_ERROR (3): waitUntilIdle:1701: Camera 0: Error waiting to drain: Connection timed out (-110)
-
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
-
android.os.ServiceSpecificException: createDefaultRequest:1644: Camera 0: Error creating default request for template 3: Function not implemented (-38) (code 10)
-
CameraCaptureSession Session 4: Failed to create capture session; configuration failed
I have not figured out how to recover from the error to get the app back into an expected state consistently. try/catch isn't working, as the error seems to occur in some async camera2 functionality. I can see that OnConfigureFailed is called, but by the time that's happened, it's already at some other part of the code which will fail. I tried to separate further along steps to be triggered by OnConfgured/OnReady, to isolate where the crash is happening, but it doesn't seem to be consistent, and this didn't stop the crash from happening.
My best guess is that some background activity, outside my app, is in conflict at the random point in time when my recording is changing states. But, I can't be sure of that.
I've added a ton of tracking into my code to try and isolate this, but no matter what I do, the result is the same. I'm stumped.
I also tried to make it so that I did not rebuild the previewBuilder with every record state change. But this didn't work because of the use of MediaRecorder for which there doesn't seem to be a way to Stop/Start it without recreating it.
- Langage dominant
- Kotlin
- Étoiles
- 5.5k
- Forks
- 2.4k
- Merge moyen
- 34 min
- PR mergées (30 j)
- 1
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de android/camera-samples
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
android/camera-samples#546 ·
-
Crash on app start caused by empty resourcesPeut-être pris @bradh l’a pris il y a 26 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 15/100
android/camera-samples#645 ·
-
camerax)Ouverte
android/camera-samples#644 · 1 commentaire ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
android/camera-samples#545 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 30/100
android/camera-samples#544 ·
Toutes les issues de android/camera-samples
Issues similaires
-
Remove Collect againOuverte
Difficulté 1/5 1-3 heures Accessibilité débutants 86/100
thisisartman/Meguri#211 ·
Les mainteneurs répondent en général sous 1 jour
-
follow-up
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
area:android fleet
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
bug needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
emm3000/myGame#2175 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour