Describe the bug
On some devices, stopping an active stream can block long enough to freeze the UI and trigger ANR.
This does not appear to be related to stream connection or encoder selection. The issue seems to happen during the stop/release path, when the library is tearing down codec, camera, and GL resources.
In practice:
- stream starts and runs normally
- user presses Stop
- UI may freeze for several seconds
- in some cases this results in ANR
This looks like a lifecycle / teardown problem rather than a connection problem.
To Reproduce
- Start an RTMP stream on the affected device (Tecno spark 30c - HiOS v14.5.0)
- Wait until the stream is running normally
- Stop the stream
- Observe that the app may freeze during stop
- In some cases Android reports ANR
Expected behavior
Stopping a stream should return control to the UI quickly and should not block long enough to trigger ANR.
Screenshots
N/A
Smartphone (please complete the following information):
- Library version: 2.7.1
- Device: [your device model here]
- OS: [your Android version here]
- Media server: [your RTMP server here]
- Class used: GenericStream
Additional context
From local investigation, the freeze seems to be caused by blocking operations during teardown, including one or more of:
MediaCodec.start()/flush()/stop()/release()
- camera open/close callbacks
- encoder EGL surface add/remove
- stream stop being executed from the UI path
What helped locally:
- moving stream operations off the main thread
- adding timeout protection around blocking
MediaCodec operations
- running encoder EGL surface add/remove on the GL executor thread
- guarding Camera2 open/close flow against stale or delayed callbacks
So far I am reporting this separately from the secure AVC encoder issue, because this seems to be a broader stop/lifecycle robustness problem.
Describe the bug
On some devices, stopping an active stream can block long enough to freeze the UI and trigger ANR.
This does not appear to be related to stream connection or encoder selection. The issue seems to happen during the stop/release path, when the library is tearing down codec, camera, and GL resources.
In practice:
This looks like a lifecycle / teardown problem rather than a connection problem.
To Reproduce
Expected behavior
Stopping a stream should return control to the UI quickly and should not block long enough to trigger ANR.
Screenshots
N/A
Smartphone (please complete the following information):
Additional context
From local investigation, the freeze seems to be caused by blocking operations during teardown, including one or more of:
MediaCodec.start()/flush()/stop()/release()What helped locally:
MediaCodecoperationsSo far I am reporting this separately from the secure AVC encoder issue, because this seems to be a broader stop/lifecycle robustness problem.