Skip to content

Commit

Permalink
try to stick to the same scaling value longer
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jul 18, 2024
1 parent 4533efa commit aaf22af
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions xpra/server/window/window_video_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -1633,11 +1633,13 @@ def mrs(v=(1, 1), info="using minimum required scaling"):
ratio = target/spps
#ideal ratio is 1, measure distance from 1:
score = int(abs(1-ratio)*100)
if self.actual_scaling and self.actual_scaling==(num, denom) and (num!=1 or denom!=1):
#if we are already downscaling,
#try to stick to the same value longer:
#give it a score boost (lowest score wins):
score = int(score/1.5)
if self.actual_scaling == (num, denom):
# try to stick to the same settings longer:
# give it a score boost (lowest score wins):
elapsed = min(16, max(0, now - self.last_pipeline_time))
# gain will range from 4 (after 0 seconds) to 1 (after 9 seconds)
gain = sqrt(17 - elapsed)
score = round(score / gain)
if num/denom>min_ratio:
#higher than minimum, should not be used unless we have no choice:
score = int(score*100)
Expand Down

0 comments on commit aaf22af

Please sign in to comment.