1.5. RTC
Prev | Chapter 1. Introduction | Next

## 1.5. RTC

There are three timing methods in MPlayer.

- To use the old method, you don't have to do anything. It uses `usleep()` to tune A/V sync, with +/- 10ms accuracy. However sometimes the sync has to be tuned even finer.

- The new timer code uses the RTC (RealTime Clock) for this task, because it has precise 1ms timers. It is automagically enabled when available, but requires root privileges, a setuid root MPlayer binary or a properly set up kernel. If you are running kernel 2.4.19pre8 or later you can adjust the maximum RTC frequency for normal users through the `/proc` filesystem. Use this command to enable RTC for normal users:

      echo 1024 > /proc/sys/dev/rtc/max-user-freq

  If you do not have such a new kernel, you can also change one line in `drivers/char/rtc.c` and recompile your kernel. Find the section that reads

             * We don't really want Joe User enabling more
             * than 64Hz of interrupts on a multi-user machine.
             */
            if ((rtc_freq > 64) && (!capable(CAP_SYS_RESOURCE)))

  and change the 64 to 1024. You should really know what you are doing, though. You can see the new timer's efficiency in the status line. The power management functions of some notebook BIOSes with speedstep CPUs interact badly with RTC. Audio and video may get out of sync. Plugging the external power connector in before you power up your notebook seems to help. You can always turn off RTC support with the `-nortc` option. In some hardware combinations (confirmed during usage of non-DMA DVD drive on an ALi1541 board) usage of the RTC timer causes skippy playback. It's recommended to use the third method in these cases.
- The third timer code is turned on with the `-softsleep` option. It has the efficiency of the RTC, but it doesn't use RTC. On the other hand, it requires more CPU.

### Note

NEVER install a setuid root MPlayer binary on a multiuser system! It's a clear way for everyone to become root.

Prev | Up | Next
1.4. Subtitles and OSD | Home | Chapter 2. Features