avformat/subtitles: check lower bound for duration overlap seeking.
authorClément Bœsch <u@pkh.me>
Sun, 8 Sep 2013 07:55:02 +0000 (09:55 +0200)
committerClément Bœsch <u@pkh.me>
Tue, 10 Sep 2013 19:32:56 +0000 (21:32 +0200)
(cherry picked from commit 1ca4bf930bab681a79fb591330043675c7cfd798)

libavformat/subtitles.c

index 11cf1a1..d2eb53c 100644 (file)
@@ -120,10 +120,11 @@ int ff_subtitles_queue_seek(FFDemuxSubtitlesQueue *q, AVFormatContext *s, int st
         /* look back in the latest subtitles for overlapping subtitles */
         ts_selected = q->subs[idx].pts;
         for (i = idx - 1; i >= 0; i--) {
+            int64_t pts = q->subs[i].pts;
             if (q->subs[i].duration <= 0 ||
                 (stream_index != -1 && q->subs[i].stream_index != stream_index))
                 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;
             else
                 break;