A simple media player powered by Java Swing with the ability to sync audio and video stream
You are welcome to modify or extend it with additional features!
cd project root then run:
$ javac -cp src src/JPlayer.java
$ java -cp src JPlayer
The synchronization consists of 2 parts: calibration and compensation. Calibration is used to
measure the actual waiting time by comparing it with target frame rate. Compensation is used
to adjust the frame rate for the next frame according to the actual duration time for current
frame. If video is slower, the waiting time for the next frame will be reduced; If video is faster,
we do the opposite.
The playback thread gives up CPU and wait in the background before rendering the next frame
Normally it takes up to 80% reduced CPU resources comparing to busy-waiting solutions