mirror of https://github.com/jetkvm/kvm.git
Fixes / Updates: Update outside mutex comment, move outputSource, outputRelay assignments
This commit is contained in:
parent
fcf072d9db
commit
3121747712
15
audio.go
15
audio.go
|
|
@ -47,17 +47,14 @@ func startAudio() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start output audio if not running and enabled
|
// Start output audio if not running, enabled, and we have a track
|
||||||
if outputSource == nil && audioOutputEnabled.Load() {
|
if outputSource == nil && audioOutputEnabled.Load() && currentAudioTrack != nil {
|
||||||
alsaDevice := "hw:1,0" // USB audio
|
alsaDevice := "hw:1,0" // USB audio
|
||||||
|
|
||||||
outputSource = audio.NewCgoOutputSource(alsaDevice)
|
outputSource = audio.NewCgoOutputSource(alsaDevice)
|
||||||
|
outputRelay = audio.NewOutputRelay(outputSource, currentAudioTrack)
|
||||||
if currentAudioTrack != nil {
|
if err := outputRelay.Start(); err != nil {
|
||||||
outputRelay = audio.NewOutputRelay(outputSource, currentAudioTrack)
|
audioLogger.Error().Err(err).Msg("Failed to start audio output relay")
|
||||||
if err := outputRelay.Start(); err != nil {
|
|
||||||
audioLogger.Error().Err(err).Msg("Failed to start audio output relay")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,7 +157,7 @@ func setAudioTrack(audioTrack *webrtc.TrackLocalStaticSample) {
|
||||||
}
|
}
|
||||||
audioMutex.Unlock()
|
audioMutex.Unlock()
|
||||||
|
|
||||||
// Start new relay outside mutex
|
// Capture relay reference and start it outside mutex
|
||||||
audioMutex.Lock()
|
audioMutex.Lock()
|
||||||
relayToStart := outputRelay
|
relayToStart := outputRelay
|
||||||
audioMutex.Unlock()
|
audioMutex.Unlock()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue