agent-adapter: restart audio thread on mic/speaker enable changes - #1524
Open
WLTB-Gino wants to merge 1 commit into
Open
agent-adapter: restart audio thread on mic/speaker enable changes#1524WLTB-Gino wants to merge 1 commit into
WLTB-Gino wants to merge 1 commit into
Conversation
Prudynt applies mic_enabled and spk_enabled only after an audio subsystem restart. The agent persisted the new value but sent no restart action, so the running streamer kept the old state and the preview-page speaker and mic toggles flipped back to their previous color on the next heartbeat poll. Include the same restart_thread action already used by the speaker CLI tool and the audio settings page so toggles take effect immediately. Verified on wyze_cam3_t31x_gc2053_rtl8189ftv, ciao 3a6c603.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Toggling the speaker (or mic) button on the preview page turns the button off (gray) for a moment, then it flips back to on (orange).
The preview page sends
PATCH /api/v1/settings/audio/spk-enabled. The agent-adapter applies the payload{"audio":{"spk_enabled":false}}to prudynt but does not request a restart. Prudynt treatsmic_enabledandspk_enabledas restart-required parameters (audio + RTSP threads), so the running streamer keeps the old state and the new value only takes effect after a prudynt restart. MeanwhileS99heartbeatpolls the live state every second, sees the speaker still enabled, and the UI flips back.The setting is persisted to
/etc/prudynt.json(viaagent_persist_value), so it applies on the next restart — which is why the flip-back looks like a "stuck" toggle rather than a failed save.Fix
Include the audio-thread restart action in the payloads for
audio/mic-enabledandaudio/spk-enabled:This matches the two existing paths that work correctly:
speakerCLI tool (ships with prudynt-t): sendsaction.restart_thread: 4config-audio+audio.js): sendsaction.restart_thread: ThreadAudio(4)Testing
shfmt -i 0 -ciandshellcheckclean; repo pre-commit gates pass.