[MPlayer-dev-eng] Better double frame rate output and framedrop

Vicente Sendra visenri at yahoo.es
Mon Nov 5 01:35:38 CET 2012


> I think video output buffering may be hard to get (or
> incorrect) depending on video cards/video drivers/OS used.
> 
> Maybe the safest solution is to add a command line option to
> adjust new frame drop behavior, i think good options could
> be:
> 
> Max frame rate output:
> 
> -Set to value > 0
> Drop frames when frame rate is higher than this frame rate
> (use this to calculate minimum period and use this to
> calculate frame delay relative to actual frame rate, and
> when delay > 1/2 minimum period drop a frame).
> 
> -Set to value < 0
> Disable frame rate drop by vout.
> 
> -Set to value = 0
> Enable frame rate drop by vout with max frame rate
> autodetection (actual code)
> 
> 
> In some cases setting it to disabled or value = vrefresh may
> result almost the same behavior, as your case, because if
> you disable new frame drop system, when A-V delay reaches
> 0.1sec, it will start dropping frames as needed, but cpu use
> can change a lot, because many drivers just loop in the
> blocking call to flip waiting for vsync.
> 
> Avoid burned cpu time was the main goal of this patch.
> 
> Any more ideas or suggestions are welcome. 

I've completely rewritten the code for framedrop with this idea.

For now these are the options:

syntax :  -fpslimit <option1:option2..>

 -options:
  mode=<0..2>
    working mode, 
    0(default) disables frame limit
    1 fixed frame limit
    2 automatic frame limit detection
  fastdrop
    makes some extra drops.
  min=<value>
    lower limit for fps (set to max in mode 1)
  max=<value>
    upper limit for fps
  start=<value>
    starting limit for fps (set to max in mode 1)

In mode 1 the system simply drops frames trying to limit output frame rate to specified value ("max").

In mode 2 the system calculates a max frame rate based on vflip time.
Roughly speaking, it lowers max frame rate if vflip time gets big, and raises frame rate if if vflip time is low and video frame rate is higher than max frame rate.
("min" and "max" options limit the calculated value, and "start" sets the initial value, if not specified or 0, no limits are applied. If "start" is not set a value is calculated from video frame rate and average frame rate output).

Fastdrop reacts in a fast way to vflip time, triggering extra frame drops, it makes the system react faster, highly recommended for either mode 1 or 2, makes fps limit precision (specified or calculated) less important.

Mode 1 can be used in all vo drivers, but must be used for vo drivers where vflip generates a wait in almost all frames (vsync enabled, but no buffering), mode 2 would drop lots of frames. Also, for these drivers, fastdrop option must not be used.

Example (no buffering) : -fpslimit mode=1:max=60
Example (with buffering):-fpslimit mode=1:fastdrop:max=60 (fastdrop is optional, but recommended)

Mode 2 should be used for vo drivers that do not delay vflip to next vertical refresh (vsync enabled, but buffering allows to return immediately).

Example (no buffering) : do not use
Example (with buffering):-fpslimit mode=2:fastdrop:max=60 (fastdrop is optional, but recommended)


I think results are very good, this new system makes frame dropping very regular, as soon as i finish all my test cases i'll put it here.





More information about the MPlayer-dev-eng mailing list