major remote desktop improvements

This commit is contained in:
KingKDot
2026-07-30 00:22:08 -05:00
parent a68172538d
commit 095a119bf4
35 changed files with 984 additions and 120 deletions
@@ -9,6 +9,9 @@ import (
"strings"
"sync"
"testing"
"time"
"overlord-client/cmd/agent/webrtcpub"
)
func resetCodecSelectionForTest() {
@@ -18,6 +21,8 @@ func resetCodecSelectionForTest() {
backstageOverrideCodec.Store("")
desktopOverrideQuality.Store(0)
backstageOverrideQuality.Store(0)
_ = webrtcpub.ConsumeKeyframeRequest(webrtcpub.KindDesktop)
_ = webrtcpub.ConsumeKeyframeRequest(webrtcpub.Kindbackstage)
}
func TestSetQualityAndCodec_H264FallbackDependsOnAvailability(t *testing.T) {
@@ -72,6 +77,27 @@ func TestDesktopAndBackstageCodecSelectionsAreIndependent(t *testing.T) {
}
}
func TestSwitchingToH264RequestsRecoveryPoint(t *testing.T) {
if !h264Available() {
t.Skip("h264 is unavailable in this build")
}
t.Cleanup(resetCodecSelectionForTest)
resetCodecSelectionForTest()
SetDesktopQualityAndCodec(80, "jpeg")
_ = webrtcpub.ConsumeKeyframeRequest(webrtcpub.KindDesktop)
lastKeyframe.Store(time.Now().UnixNano())
SetDesktopQualityAndCodec(80, "h264")
if lastKeyframe.Load() != 0 {
t.Fatal("codec transition did not invalidate the previous keyframe timestamp")
}
if !webrtcpub.ConsumeKeyframeRequest(webrtcpub.KindDesktop) {
t.Fatal("codec transition did not request an H.264 recovery point")
}
}
func TestDesktopHardwareFailureDoesNotChangeBackstageCodec(t *testing.T) {
t.Cleanup(func() {
desktopHardwareFallbackUntil.Store(0)