"main" tid=1 Waiting ```Input dispatching timed out (No focused window)```
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 18/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- audio-video-rtc, mobile-dev
Research direction
Start with Camera2ApiManager.kt around openCameraId, where the semaphore acquireUninterruptibly call blocks, then trace openCameraFacing and Camera2Source.start up to StreamBase.startPreview in StreamBase.kt. Check every path that acquires the camera semaphore for a missing release, especially failure and close paths. Done means the camera opens without the main thread parking, verified on a device or emulator where the open callback fires.
Written by the indexing model from the issue text.
Description
Describe the bug
The app freezes when attempting to start the camera preview using the startPreview method from StreamBase. The main thread gets stuck in a waiting state at Unsafe.park, causing a deadlock. This issue seems related to the Camera2ApiManager class, particularly around semaphore handling.
To Reproduce
Steps to reproduce the behavior:
- Go to the camera preview feature in the app.
- Click on 'Start Preview'.
- Observe the app freezing without starting the preview.
- Check the logcat to see the waiting state error in the stack trace.
Expected behavior
The camera preview should start smoothly without causing the app to hang or enter a waiting state.
Screenshots
No available
Smartphone (please complete the following information):
- RAM (total memory): 2,048 MB (1,960 MB)
- System on Chip (SOC): Spreadtrum T603
- CPU: 4x ARM Cortex-A55 (1800 MHz), 4x ARM Cortex-A55 (1200 MHz)
- ABI: armeabi-v7a, armeabi
- Form factor: Phone
- Screen size: 720x1612
- Screen density (DPI): 320 (xhdpi)
- Android version: Android 14 (SDK 34)
- OpenGL ES version: 3.2
- GPU: Imagination Tech PowerVR GE8322 (600 MHz)
- Device: itel-A667L
- Media server: [e.g. srs, version 5.0]
- Class used: [e.g. RtmpCamera1]
Additional context
Stack trace highlights:
"main" tid=1 Waiting
at jdk.internal.misc.Unsafe.park (Native method)
at java.util.concurrent.locks.LockSupport.park (LockSupport.java:211)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire (AbstractQueuedSynchronizer.java:715)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared (AbstractQueuedSynchronizer.java:1027)
at java.util.concurrent.Semaphore.acquireUninterruptibly (Semaphore.java:341)
at com.pedro.encoder.input.video.Camera2ApiManager.openCameraId (Camera2ApiManager.kt:616)
at com.pedro.encoder.input.video.Camera2ApiManager.openCameraFacing (Camera2ApiManager.kt:431)
at com.pedro.encoder.input.sources.video.Camera2Source.start (Camera2Source.kt:55)
at com.pedro.library.base.StreamBase.startPreview (StreamBase.kt:366)
at com.pedro.library.base.StreamBase.startPreview (StreamBase.kt:344)
at com.pedro.library.base.StreamBase.startPreview$default (StreamBase.kt:326)
Possible causes:
- Semaphore not being released properly.
- Deadlock due to improper synchronization.
- Resource conflict with other threads accessing the camera.
using com.github.pedroSG94.RootEncoder:library:2.5.5
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 946
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 9
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pedroSG94/RootEncoder
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
pedroSG94/RootEncoder#2213 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
pedroSG94/RootEncoder#2207 · 1 reaction ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pedroSG94/RootEncoder#2203 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
pedroSG94/RootEncoder#2192 · 2 comments ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pedroSG94/RootEncoder#2177 · 44 comments ·
Maintainers usually reply within 2 days
All issues in pedroSG94/RootEncoder
Similar issues
-
enhancement help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
kabirvashisht4-glitch/Vet#22 ·
-
documentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
djazairdev/wilayas#23 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
lysine-dev/okhttp#9788 ·
Maintainers usually reply within 1 day
-
[BUG] Navigation drawer drops library-name suffixes without ellipsis (1.0.8, NVIDIA Shield)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
damontecres/Wholphin#2069 ·
Maintainers usually reply within 1 day
-
Android (vision-camera-location): HybridLocationManager never quits its HandlerThread on disposeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
margelo/react-native-vision-camera#4217 ·
Maintainers usually reply within 4 days