fix prob in last checkin with seek read limit
authorGood Guy <[email protected]>
Sat, 30 Jan 2016 16:07:29 +0000 (09:07 -0700)
committerGood Guy <[email protected]>
Sat, 30 Jan 2016 16:07:29 +0000 (09:07 -0700)
cinelerra-5.0/cinelerra/ffmpeg.C

index aa7a9f1f396827759404a688d94bf815c1e23d7d..b149a30cd183c262558c6604f2316b4f21113476 100644 (file)
@@ -460,7 +460,7 @@ int FFStream::seek(int64_t no, double rate)
                if( no-n < 30*rate ) {
                        if( n < 0 ) n = 0;
                        pos = n;
-                       plmt = marks[i].pos;
+                       if( ++i < marks.size() ) plmt = marks[i].pos;
                        npkts = MAX_RETRY;
                }
        }
@@ -475,9 +475,8 @@ int FFStream::seek(int64_t no, double rate)
                seeked = 1;  st_eof(0);
 // read up to retry packets, limited to npkts in stream, and not past pkt.pos plmt
                for( int retry=MAX_RETRY; ret>=0 && --retry>=0; ) {
-                       if( read_packet() <= 0 || ( plmt >= 0 && ipkt->pos > plmt ) ) {
-                               ret = -1;  break;
-                       }
+                       if( read_packet() <= 0 ) { ret = -1;  break; }
+                       if( plmt >= 0 && ipkt->pos >= plmt ) break;
                        if( ipkt->stream_index != st->index ) continue;
                        if( --npkts <= 0 ) break;
                        if( (pkt_ts=ipkt->dts) == AV_NOPTS_VALUE &&