perf(videochannel): reduce ack timeout and multiplier

This commit is contained in:
zarazaex69
2026-05-28 02:42:50 +03:00
parent cfa1bd6083
commit 9f25ac59fc
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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)
}