-
-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathcodec_test.go
More file actions
28 lines (25 loc) · 936 Bytes
/
Copy pathcodec_test.go
File metadata and controls
28 lines (25 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package meowcaller
import (
"testing"
"github.com/purpshell/meowcaller/signaling"
)
// TestSelectAudioCodec pins the codec selection: only an explicit, present
// use_mlow_codec_v1=false picks Opus; everything else (nil, absent, true) stays
// on MLow. Skipped until selectAudioCodec lands.
func TestSelectAudioCodec(t *testing.T) {
cases := []struct {
name string
vs *signaling.VoipSettings
want AudioCodec
}{
{"nil keeps mlow", nil, AudioCodecMlow},
{"absent keeps mlow", &signaling.VoipSettings{Present: false, UseMlowCodecV1: false}, AudioCodecMlow},
{"mlow true", &signaling.VoipSettings{Present: true, UseMlowCodecV1: true}, AudioCodecMlow},
{"mlow false -> opus", &signaling.VoipSettings{Present: true, UseMlowCodecV1: false}, AudioCodecOpus},
}
for _, c := range cases {
if got := selectAudioCodec(c.vs); got != c.want {
t.Errorf("%s: selectAudioCodec = %v, want %v", c.name, got, c.want)
}
}
}