if (matroska->skip_to_keyframe &&
track->type != MATROSKA_TRACK_TYPE_SUBTITLE) {
- if (timecode < matroska->skip_to_timecode)
+ // Compare signed timecodes. Timecode may be negative due to codec delay
+ // offset. We don't support timestamps greater than int64_t anyway - see
+ // AVPacket's pts.
+ if ((int64_t)timecode < (int64_t)(matroska->skip_to_timecode))
return res;
if (is_keyframe)
matroska->skip_to_keyframe = 0;