mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-05-30 00:49:44 +00:00
fix: throughput bug where maxWireFPS=120 capped send rate 32x too low
This commit is contained in:
@@ -52,7 +52,6 @@ const (
|
||||
outboundQueueSize = 1024
|
||||
inboundQueueSize = 1024
|
||||
canSendHighWatermark = 90 // percent
|
||||
maxWireFPS = 120
|
||||
keepaliveIdlePeriod = 100 * time.Millisecond
|
||||
)
|
||||
|
||||
@@ -357,15 +356,10 @@ func (p *streamTransport) writerLoop() {
|
||||
}
|
||||
|
||||
func (p *streamTransport) sampleInterval() time.Duration {
|
||||
sampleInterval := p.frameInterval
|
||||
if p.batchSize > 1 {
|
||||
sampleInterval = p.frameInterval / time.Duration(p.batchSize)
|
||||
return p.frameInterval / time.Duration(p.batchSize)
|
||||
}
|
||||
minInterval := time.Second / maxWireFPS
|
||||
if sampleInterval < minInterval {
|
||||
return minInterval
|
||||
}
|
||||
return sampleInterval
|
||||
return p.frameInterval
|
||||
}
|
||||
|
||||
func (p *streamTransport) resetKCP() {
|
||||
|
||||
@@ -20,13 +20,14 @@ type fakeVideoSession struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func TestSampleIntervalIsCappedForLargeBatch(t *testing.T) {
|
||||
func TestSampleIntervalWithBatch(t *testing.T) {
|
||||
tr := &streamTransport{
|
||||
frameInterval: time.Second / 60,
|
||||
batchSize: 64,
|
||||
}
|
||||
if got := tr.sampleInterval(); got != time.Second/maxWireFPS {
|
||||
t.Fatalf("sampleInterval() = %v, want %v", got, time.Second/maxWireFPS)
|
||||
want := time.Second / 60 / 64
|
||||
if got := tr.sampleInterval(); got != want {
|
||||
t.Fatalf("sampleInterval() = %v, want %v", got, want)
|
||||
}
|
||||
|
||||
tr.batchSize = 1
|
||||
|
||||
Reference in New Issue
Block a user