kvm/internal/audio
Alex P dc0ccf9af5 Fix HIGH priority issues in audio system
Addressed 5 HIGH priority issues identified in code review:

HIGH #12: safe_alsa_open validation (audio.c:314-327)
- Added validation for snd_pcm_nonblock() return value
- Properly close handle and return error if blocking mode fails
- Prevents silent failures when switching to blocking mode

HIGH #13: WebRTC write failure handling (relay.go:74-147)
- Track consecutive WebRTC write failures in OutputRelay
- Reconnect source after 50 consecutive failures
- Throttle warning logs (first failure + every 10th)
- Prevents silent audio degradation from persistent write errors

HIGH #14: Opus packet size validation (audio.c:1024-1027)
- Moved validation before mutex acquisition
- Reduces unnecessary lock contention for invalid packets
- Validates opus_buf, opus_size bounds before hot path

HIGH #15: FEC recovery validation (audio.c:1050-1071)
- Added detailed logging for FEC usage
- Log warnings when decode fails and FEC is attempted
- Log info/error messages for FEC success/failure
- Log warning when FEC returns 0 frames (silence)
- Improves debuggability of packet loss scenarios

Comment accuracy fixes (audio.c:63-67, 149-150, 164-165)
- Clarified RFC 7587 comment: RTP clock rate vs codec sample rate
- Explained why sr/fs parameters are ignored
- Added context about SpeexDSP resampling

Channel map validation (audio.c:572-579)
- Added validation for unexpected channel counts
- Check for SND_CHMAP_UNKNOWN positions
- Prevents crashes from malformed channel map data
2025-11-24 20:30:57 +02:00
..
c Fix HIGH priority issues in audio system 2025-11-24 20:30:57 +02:00
cgo_source.go Fix critical error handling and race conditions in audio system 2025-11-24 20:23:14 +02:00
cgo_source_stub.go Simplify audio management 2025-11-17 22:21:47 -06:00
relay.go Fix HIGH priority issues in audio system 2025-11-24 20:30:57 +02:00
source.go Integrate libspeexdsp for high-quality audio resampling 2025-11-21 16:29:02 +02:00