openstf / stf

Control and manage Android devices from your browser.
https://openstf.io
Other
13.38k stars 2.79k forks source link

How to reduce frame rate #997

Open KeshavP96 opened 5 years ago

KeshavP96 commented 5 years ago

Hi, I am using stf for device testing. I want to know how to reduce FPS from 60 fps to 45 fps or 30 fps. And one more thing, how will it affect the performance?

sorccu commented 5 years ago

There is no option to do that. You’d have to modify the source code. I know of some people (or companies) who have done it but they haven’t shared their changes.

thinkhy commented 5 years ago

@KeshavP96 There is an easy way that may meet your requirement.


function wsFrameNotifier(frame) {  
  if (lastsenttime == 0 || Date.now()-lastsenttime > 1000/framerate) {  
    lastsenttime = Date.now()  
    return send(frame, {  
      binary: true  
    })  
  }  
}

case 'rate':  
  var rate =  Number(match[6])  
  if (rate > 2 && rate < 100) {  
    framerate = rate  
  }  
  break
KeshavP96 commented 5 years ago

Hi @thinkhy , Thank you for the solution. I have few questions.

  1. How change in frame rate will affect the quality of screen?
  2. what will be the acceptable frame rate for game testing as our games rendered at 25 fps.
  3. can we compress the image size to improve performance without impacting quality. If yes, where can we make those modifications.
thinkhy commented 5 years ago

@KeshavP96

PS: you can refer to the test results for different combination of FPS and compression ratio. The data is extracted from the tech blog of Meituan

image

ghost commented 5 years ago

@thinkhy

Thinly just wanted to thank you for the solution. Can you point out which file that’s needs to be dropped in. I’ve looked for quite some time but must be overlooking something.

Thanks !