Skip to content

Commit d45fc47

Browse files
committed
Test clearing per-room limits and resetting bandwidth.
1 parent 1ea60b1 commit d45fc47

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

room_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,24 @@ func TestRoom_Bandwidth(t *testing.T) {
621621
assert.EqualValues(500000, pub.GetBandwidth())
622622
assert.EqualValues(1234567, room.GetNextPublisherBandwidth(StreamTypeScreen))
623623
assert.EqualValues(500000, room.GetNextPublisherBandwidth(StreamTypeVideo))
624+
625+
// Clearing the per-room limit will reset the bandwidth of publishers.
626+
room.Backend().bandwidthPerRoom.Store(0)
627+
room.Backend().minPublisherBandwidth.Store(0)
628+
room.Backend().maxPublisherBandwidth.Store(0)
629+
room.updateBandwidth().Wait()
630+
631+
pubs, subs, bw = room.Bandwidth()
632+
assert.EqualValues(1, pubs)
633+
assert.EqualValues(0, subs)
634+
assert.Equal(&McuClientBandwidthInfo{
635+
Sent: api.BandwidthFromBits(2000),
636+
Received: api.BandwidthFromBits(100000),
637+
}, bw)
638+
639+
assert.EqualValues(700000, pub.GetBandwidth())
640+
assert.EqualValues(1234567, room.GetNextPublisherBandwidth(StreamTypeScreen))
641+
assert.EqualValues(700000, room.GetNextPublisherBandwidth(StreamTypeVideo))
624642
}
625643

626644
func TestRoom_BandwidthClustered(t *testing.T) {

0 commit comments

Comments
 (0)