fix fps toggle
This commit is contained in:
@@ -33,6 +33,7 @@ func DesktopStart(ctx context.Context, env *rt.Env) error {
|
||||
fps := activeDesktopTargetFPS()
|
||||
interval := time.Second / time.Duration(fps)
|
||||
capture.SetH264TargetFPS(fps)
|
||||
capture.SetFrameFlowTargetFPS(fps)
|
||||
log.Printf("desktop: starting stream (target fps %d)", fps)
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
@@ -47,6 +48,7 @@ func DesktopStart(ctx context.Context, env *rt.Env) error {
|
||||
if fps != currentFPS {
|
||||
currentFPS = fps
|
||||
capture.SetH264TargetFPS(fps)
|
||||
capture.SetFrameFlowTargetFPS(fps)
|
||||
ticker.Reset(time.Second / time.Duration(fps))
|
||||
log.Printf("desktop: target fps changed to %d", fps)
|
||||
}
|
||||
@@ -73,6 +75,7 @@ func SetDesktopTargetFPS(fps int) int {
|
||||
fps = clampDesktopTargetFPS(fps)
|
||||
desktopTargetFPS.Store(int64(fps))
|
||||
capture.SetH264TargetFPS(fps)
|
||||
capture.SetFrameFlowTargetFPS(fps)
|
||||
return fps
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user