Skip to content

Commit

Permalink
comment correction
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherche committed Dec 18, 2023
1 parent 88a972b commit 17f3546
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -841,12 +841,6 @@ else if (seekFrame.samples != null && samples_frame != null && getSampleRate() >
frameGrabbed = true;

} else { //old quick seeking code used in JavaCV versions prior to 1.4.1
/* comparing to timestamp +/- 1 avoids rouding issues for framerates
which are no proper divisors of 1000000, e.g. where
av_frame_get_best_effort_timestamp in grabFrame sets this.timestamp
to ...666 and the given timestamp has been rounded to ...667
(or vice versa)
*/
/* add the stream start time */
timestamp += ts0;
if ((ret = avformat_seek_file(oc, -1, Long.MIN_VALUE, timestamp, Long.MAX_VALUE, AVSEEK_FLAG_BACKWARD)) < 0) {
Expand All @@ -862,6 +856,12 @@ else if (seekFrame.samples != null && samples_frame != null && getSampleRate() >
av_packet_unref(pkt);
pkt.stream_index(-1);
}
/* comparing to timestamp +/- 1 avoids rouding issues for framerates
which are no proper divisors of 1000000, e.g. where
av_frame_get_best_effort_timestamp in grabFrame sets this.timestamp
to ...666 and the given timestamp has been rounded to ...667
(or vice versa)
*/
int count = 0; // prevent infinite loops with corrupted files
while (this.timestamp > timestamp + 1 && grabFrame(true, true, false, false) != null && count++ < 1000) {
// flush frames if seeking backwards
Expand Down

0 comments on commit 17f3546

Please sign in to comment.