avformat/subtitles: check lower bound for duration overlap seeking.

pull/35/head
Clément Bœsch 11 years ago
parent f8678dcef3
commit 1ca4bf930b
  1. 3
      libavformat/subtitles.c

@ -122,10 +122,11 @@ int ff_subtitles_queue_seek(FFDemuxSubtitlesQueue *q, AVFormatContext *s, int st
/* look back in the latest subtitles for overlapping subtitles */ /* look back in the latest subtitles for overlapping subtitles */
ts_selected = q->subs[idx].pts; ts_selected = q->subs[idx].pts;
for (i = idx - 1; i >= 0; i--) { for (i = idx - 1; i >= 0; i--) {
int64_t pts = q->subs[i].pts;
if (q->subs[i].duration <= 0 || if (q->subs[i].duration <= 0 ||
(stream_index != -1 && q->subs[i].stream_index != stream_index)) (stream_index != -1 && q->subs[i].stream_index != stream_index))
continue; continue;
if (q->subs[i].pts > ts_selected - q->subs[i].duration) if (pts >= min_ts && pts > ts_selected - q->subs[i].duration)
idx = i; idx = i;
else else
break; break;

Loading…
Cancel
Save