Android: keep the stream alive under dialogs, fix hang on leaving #825
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
stale
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-streetpea/chiaki-ng!825
Loading…
Reference in a new issue
No description provided.
Delete branch "aoleg94/android-fix-pause"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
onPauseand restarted inonResume, so anything that pauses without hiding the activity (e.g. the Bluetooth enablepopup) dropped the stream. The session now runs from
onStarttoonStop(
StreamVisibilityObserver).android_chiaki_video_decoder_set_surface(NULL)lockedcodec_mutexand then calledkill_decoder(), which locks it again, and returned with it held.That path never ran before because the session was always gone by the time the surface was
destroyed; with the session living until
onStop, going home hung the main thread.kill_decoder()also deleted the codec outside the lock and skipped joining the output threadwhen no input buffer was free for the EOS; both fixed.
still report Remote Play as in use for a few seconds, or until its timeout when Battery Saver
cut the network before the disconnect got out (it blocks background apps immediately, before
onStop). Within 20 s of the app stopping its own session, that error now retries every 1.5 swhile showing "connecting". A first connect still reports it right away.
Testing
StreamVisibilityObserverTest(fails with the oldonPause/onResumemapping) andRemoteInUseRetryTest../gradlew testDebugUnitTestpasses.it running; home and back (fast swipe and via recents) reconnects within seconds without an
error; no hang. The decoder change has no unit test (it drives the hardware decoder).
Notes
I tried
onUserLeaveHintto stop before the network is cut, but Samsung's Bluetooth popuptriggers it too, so it can't tell leaving from a dialog; hence the retry.
Developed with the assistance of Claude Code, and tested on real hardware as described above.
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.