net.sf.fmj.media
Class SleepHelper

java.lang.Object
  extended by net.sf.fmj.media.SleepHelper

public class SleepHelper
extends java.lang.Object

Helps calculate and sleep based on buffer timestamps; useful for rendering media at the correct rate. TODO: it is strange that we use this in the RendererNode (which calls the Renderer), and in the RTPSyncBufferMux (but not in the MuxNode). This implies that Multiplexers are responsible for timing but not Renderers. This is perhaps a reasonable assumption, but needs to be checked against JMF.

Author:
Ken Larson

Field Summary
static long MILLI_TO_NANO
          The number of nanoseconds in a millisecond.
 
Constructor Summary
SleepHelper()
           
 
Method Summary
 long calculateSleep(long currentTimestamp)
           
 void reset()
           
 void sleep(long currentTimestamp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MILLI_TO_NANO

public static long MILLI_TO_NANO
The number of nanoseconds in a millisecond.

Constructor Detail

SleepHelper

public SleepHelper()
Method Detail

reset

public void reset()

sleep

public void sleep(long currentTimestamp)
           throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

calculateSleep

public long calculateSleep(long currentTimestamp)