mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-06-02 06:23:37 +02:00
perf(videochannel): reduce ack timeout and multiplier
This commit is contained in:
@@ -23,7 +23,7 @@ import (
|
||||
const (
|
||||
defaultMaxPayloadSize = 16 * 1024
|
||||
defaultFragmentSize = 256
|
||||
defaultAckTimeout = 1 * time.Second
|
||||
defaultAckTimeout = 300 * time.Millisecond
|
||||
defaultFrameInterval = 40 * time.Millisecond
|
||||
defaultConnectTimeout = 30 * time.Second
|
||||
maxSendAttempts = 20
|
||||
@@ -301,7 +301,7 @@ func perAttemptAckTimeout(fragments, fps int) time.Duration {
|
||||
fps = 25
|
||||
}
|
||||
frameInterval := time.Second / time.Duration(fps)
|
||||
estimated := time.Duration(fragments) * frameInterval * 3
|
||||
estimated := time.Duration(fragments) * frameInterval * 2
|
||||
if estimated < defaultAckTimeout {
|
||||
return defaultAckTimeout
|
||||
}
|
||||
|
||||
@@ -262,8 +262,8 @@ func TestPerAttemptAckTimeoutScalesWithFragments(t *testing.T) {
|
||||
t.Fatalf("perAttemptAckTimeout(2,25) = %v, want %v", got, defaultAckTimeout)
|
||||
}
|
||||
|
||||
// 16 fragments @ 25 FPS: 16 * 40ms * 3 = 1920ms.
|
||||
if got, want := perAttemptAckTimeout(16, 25), 1920*time.Millisecond; got != want {
|
||||
// 16 fragments @ 25 FPS: 16 * 40ms * 2 = 1280ms.
|
||||
if got, want := perAttemptAckTimeout(16, 25), 1280*time.Millisecond; got != want {
|
||||
t.Fatalf("perAttemptAckTimeout(16,25) = %v, want %v", got, want)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user