Merged in 441-fix-check-samplerate (pull request #532)

audio-netsender: Fix sample rate validation

* audio-netsender: Fix sample rate validation

This change makes a simple change that makes the function compare the requested sample rate against the valid rates instead of the indices of the valid rates.


Approved-by: Alan Noble
This commit is contained in:
David Sutton 2024-02-09 06:28:45 +00:00
parent 60e208fdab
commit 262e5fb5b4
1 changed files with 1 additions and 1 deletions

View File

@ -282,7 +282,7 @@ func (ac *audioClient) open() error {
// to fix this 8000 and 16000 must be removed from this slice. // to fix this 8000 and 16000 must be removed from this slice.
rates := [8]int{8000, 16000, 32000, 44100, 48000, 88200, 96000, 192000} rates := [8]int{8000, 16000, 32000, 44100, 48000, 88200, 96000, 192000}
foundRate := false foundRate := false
for r := range rates { for _, r := range rates {
if r < ac.rate { if r < ac.rate {
continue continue
} }