Make RestartAudioOutput async to prevent RPC hanging

Consistent with other audio toggle functions, restart now happens
asynchronously to avoid blocking the RPC caller.
This commit is contained in:
Alex P 2025-11-21 00:15:38 +02:00
parent edd06e2346
commit 3cd5bdd16c
1 changed files with 6 additions and 1 deletions

View File

@ -339,7 +339,12 @@ func RestartAudioOutput() error {
audioLogger.Info().Msg("Restarting audio output") audioLogger.Info().Msg("Restarting audio output")
stopOutputAudio() stopOutputAudio()
return startAudio() go func() {
if err := startAudio(); err != nil {
audioLogger.Error().Err(err).Msg("Failed to restart audio output")
}
}()
return nil
} }
func handleInputTrackForSession(track *webrtc.TrackRemote) { func handleInputTrackForSession(track *webrtc.TrackRemote) {