major remote desktop upgrades + do opus. Hopefully all the tests pass 😭

This commit is contained in:
KingKDot
2026-07-17 04:28:23 -05:00
parent 779f86b259
commit 0219081682
35 changed files with 1304 additions and 91 deletions
@@ -0,0 +1,38 @@
package capture
import "testing"
func TestH264TargetBitrateAutoAndManual(t *testing.T) {
original := configuredH264Bitrate()
defer SetH264TargetBitrate(original)
SetH264TargetBitrate(0)
if got := targetH264Bitrate(1920, 1080, 60); got != 9_953_280 {
t.Fatalf("automatic 1080p60 bitrate = %d, want 9953280", got)
}
if got := targetH264Bitrate(3840, 2160, 240); got != 18_000_000 {
t.Fatalf("automatic bitrate cap = %d, want 18000000", got)
}
if got := SetH264TargetBitrate(30_000_000); got != 30_000_000 {
t.Fatalf("manual bitrate = %d, want 30000000", got)
}
if got := targetH264Bitrate(1280, 720, 30); got != 30_000_000 {
t.Fatalf("manual target = %d, want 30000000", got)
}
if got := SetH264TargetBitrate(60_000_000); got != maxH264Bitrate {
t.Fatalf("manual cap = %d, want %d", got, maxH264Bitrate)
}
}
func TestH264TargetCRFTracksManualRate(t *testing.T) {
original := configuredH264Bitrate()
defer SetH264TargetBitrate(original)
SetH264TargetBitrate(0)
auto := targetH264CRF(1920, 1080, 60)
SetH264TargetBitrate(20_000_000)
higherRate := targetH264CRF(1920, 1080, 60)
if higherRate >= auto {
t.Fatalf("higher bitrate CRF = %.2f, want below automatic %.2f", higherRate, auto)
}
}