* @param oPacket the packet about to be written.
*/
private void delayForRealTime(IPacket oPacket)
{
// convert packet timestamp to microseconds
final IRational timeBase = oPacket.getTimeBase();
if (timeBase == null || timeBase.getNumerator() == 0 ||
timeBase.getDenominator() == 0)
return;
long dts = oPacket.getDts();
if (dts == Global.NO_PTS)
return;
final long currStreamTime = IRational.rescale(dts,
1,
1000000,
timeBase.getNumerator(),
timeBase.getDenominator(),
IRational.Rounding.ROUND_NEAR_INF);
if (mStartStreamTime == null)
mStartStreamTime = currStreamTime;
// convert now to microseconds