From b38c2d6d89f77744bf410777ef2053bf4520cc2a Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sat, 30 Jan 2016 09:07:29 -0700 Subject: [PATCH] fix prob in last checkin with seek read limit --- cinelerra-5.0/cinelerra/ffmpeg.C | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cinelerra-5.0/cinelerra/ffmpeg.C b/cinelerra-5.0/cinelerra/ffmpeg.C index aa7a9f1f..b149a30c 100644 --- a/cinelerra-5.0/cinelerra/ffmpeg.C +++ b/cinelerra-5.0/cinelerra/ffmpeg.C @@ -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 && -- 2.26.2