ability to disable auto subscribe per participant

This commit is contained in:
David Zhao
2021-05-22 22:54:47 -07:00
parent 55d801d30b
commit 0900054c24
29 changed files with 236 additions and 7683 deletions
+8 -9
View File
@@ -3,9 +3,8 @@ package rtc_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/livekit/livekit-server/pkg/rtc"
"github.com/stretchr/testify/require"
)
const (
@@ -19,11 +18,11 @@ func TestAudioLevel(t *testing.T) {
t.Run("initially to return not noisy, within a few samples", func(t *testing.T) {
a := rtc.NewAudioLevel(defaultActiveLevel, defaultPercentile)
_, noisy := a.GetLevel()
assert.False(t, noisy)
require.False(t, noisy)
observeSamples(a, 28, 5)
_, noisy = a.GetLevel()
assert.False(t, noisy)
require.False(t, noisy)
})
t.Run("not noisy when all samples are below threshold", func(t *testing.T) {
@@ -31,7 +30,7 @@ func TestAudioLevel(t *testing.T) {
observeSamples(a, 35, 100)
_, noisy := a.GetLevel()
assert.False(t, noisy)
require.False(t, noisy)
})
t.Run("not noisy when less than percentile samples are above threshold", func(t *testing.T) {
@@ -42,7 +41,7 @@ func TestAudioLevel(t *testing.T) {
observeSamples(a, 35, 1)
_, noisy := a.GetLevel()
assert.False(t, noisy)
require.False(t, noisy)
})
t.Run("noisy when higher than percentile samples are above threshold", func(t *testing.T) {
@@ -53,9 +52,9 @@ func TestAudioLevel(t *testing.T) {
observeSamples(a, 29, 2)
level, noisy := a.GetLevel()
assert.True(t, noisy)
assert.Less(t, level, uint8(defaultActiveLevel))
assert.Greater(t, level, uint8(25))
require.True(t, noisy)
require.Less(t, level, uint8(defaultActiveLevel))
require.Greater(t, level, uint8(25))
})
}