Avoid underflow/wrap around

This commit is contained in:
Moritz Bunkus 2011-08-25 15:54:16 +02:00
parent 787339f03a
commit d439f5894c

View File

@ -1036,7 +1036,7 @@ mpeg_ts_reader_c::send_to_packetizer(int tid) {
//if (tid == 0)
// m_file->write(tracks[tid]->payload->get_buffer(), tracks[tid]->payload_size);
if (tracks[tid]->timecode - m_global_timecode_offset < 0)
if (tracks[tid]->timecode < m_global_timecode_offset)
tracks[tid]->timecode = 0;
else
tracks[tid]->timecode = (uint64_t)(tracks[tid]->timecode - m_global_timecode_offset) * 100000ll / 9;