[MPlayer-dev-eng] Real Time Clock into timer-lx.c?

Sidik Isani lksi at cfht.hawaii.edu
Sun Sep 22 09:07:37 CEST 2002


Hello -

  I'm still planning to send you that timing patch this weekend!
  (The one which makes video smooth with network audio and broken
  sound drivers.)  Please tell me what you think about the following
  though, so if needed I can back out other changes that are now in
  my tree before generating this patch.  This has to do with RTC.
  I get good results with it, but only if:

  1. Some previous program happens to have left it at >= 256Hz.
  2. I'm running as root, or setuid-root

  Even if 1. is true, kernel will not allow a normal user to enable
  the interrupt until they select something <= 64Hz.  At such a low
  frequency, the results are much worse than what usleep or nanosleep
  would give.  Actually, the low frequencies would still work fairly
  well if they could be multiples of the frame rate, but I found out
  the RTC hardware only supports powers of 2.  So... the RTC is only
  a good option for root (or movies that happen to be 16 or 32 Hz?!)

  I'd like to propose three things... and the patch if you like ;-)

  1. *Set* the RTC to 256Hz rather than accepting whatever frequency
     it was left at, ... or if that somehow causes a problem, set the
     frequency to 256Hz only if the old frequency happens to be lower
     than that.  Since only one application can use the RTC at a time,
     does anyone see a problem with just putting a value in?

  2. Actually look at what the RTC returns (exact count of interrupts
     since last call) and use this to efficiently calculate
     GetRelativeTime() instead of banging on gettimeofday.

  3. At the same time, move RTC into linux/timer-lx.c (still inside
     ifdef HAVE_RTC's of course.)  Is there a better place that
     it might belong?  Is it OK/clean to add #include for ../mp_msg.h
     in timer-lx.c so that the RTC code can continue to print the
     messages it does now?

  I've verified that the above can be done in a way that leaves
  the player 100% unchanged functionally and it makes mplayer.c
  more readable:  The exact same while loop that was used for
  usleep is the only one needed again.  Please let me know what
  you think.

Thanks,

- Sidik



More information about the MPlayer-dev-eng mailing list