forked from jiyeyuran/mediasoup-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scalability_modes_test.go
60 lines (56 loc) · 1.58 KB
/
scalability_modes_test.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package mediasoup
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseScalabilityMode(t *testing.T) {
testCases := []struct {
scalabilityMode string
want ScalabilityMode
}{
{
scalabilityMode: "L1T3",
want: ScalabilityMode{SpatialLayers: 1, TemporalLayers: 3, Ksvc: false},
},
{
scalabilityMode: "L3T2_KEY",
want: ScalabilityMode{SpatialLayers: 3, TemporalLayers: 2, Ksvc: true},
},
{
scalabilityMode: "S2T3",
want: ScalabilityMode{SpatialLayers: 2, TemporalLayers: 3, Ksvc: false},
},
{
scalabilityMode: "foo",
want: ScalabilityMode{SpatialLayers: 1, TemporalLayers: 1, Ksvc: false},
},
{
scalabilityMode: "",
want: ScalabilityMode{SpatialLayers: 1, TemporalLayers: 1, Ksvc: false},
},
{
scalabilityMode: "S0T3",
want: ScalabilityMode{SpatialLayers: 1, TemporalLayers: 1, Ksvc: false},
},
{
scalabilityMode: "S1T0",
want: ScalabilityMode{SpatialLayers: 1, TemporalLayers: 1, Ksvc: false},
},
{
scalabilityMode: "L20T3",
want: ScalabilityMode{SpatialLayers: 20, TemporalLayers: 3, Ksvc: false},
},
{
scalabilityMode: "S200T3",
want: ScalabilityMode{SpatialLayers: 1, TemporalLayers: 1, Ksvc: false},
},
{
scalabilityMode: "L4T7_KEY_SHIFT",
want: ScalabilityMode{SpatialLayers: 4, TemporalLayers: 7, Ksvc: true},
},
}
for _, testCase := range testCases {
mode := ParseScalabilityMode(testCase.scalabilityMode)
assert.EqualValues(t, testCase.want, mode)
}
}