   queueAudio: (pesInfo, doNotReadNext=false) ->
     pendingAudioPesPackets.push pesInfo
     if pendingAudioPesPackets.length is 1
-      timeDiff = @getTimeUntilDTS(pesInfo.pes.DTS) - SETTIMEOUT_ADVANCE_TIME
+      timeDiff = Math.round @getTimeUntilDTS(pesInfo.pes.DTS) - SETTIMEOUT_ADVANCE_TIME
       if timeDiff <= 0
         @consumeAudio doNotReadNext
       else

        if (not doNotReadNext) and (not @checkEnd())
          @readNext()
      else
        timeDiff = @getTimeUntilDTS(pendingAudioPesPackets[0].pes.DTS) - SETTIMEOUT_ADVANCE_TIME
        if timeDiff <= 0
          @consumeAudio doNotReadNext
        else

  queueVideo: (pesInfo, doNotReadNext=false) ->
    pendingVideoPesPackets.push pesInfo
    if pendingVideoPesPackets.length is 1
      timeDiff = Math.round @getTimeUntilDTS(pesInfo.pes.DTS) - SETTIMEOUT_ADVANCE_TIME
      if timeDiff <= 0
        @consumeVideo doNotReadNext
      else
