History

avformat/seek: Remove always true condition

Zhao Zhili committed 1 year ago

Commit 1c5961e1 parent ef3ffd81 file · +10 −12Browse files

Showing the changes to libavformat (1 of 1 file). Show all

Unified · Split

libavformat/seek.c+10−12
@@ -664,6 +664,9 @@ int av_seek_frame(AVFormatContext *s, int stream_index, · 663 unmodified lines
664int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,664int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
665 int64_t ts, int64_t max_ts, int flags)665 int64_t ts, int64_t max_ts, int flags)
666{666{
667 int dir;
668 int ret;
669
667 if (min_ts > ts || max_ts < ts)670 if (min_ts > ts || max_ts < ts)
668 return -1;671 return -1;
669 if (stream_index < -1 || stream_index >= (int)s->nb_streams)672 if (stream_index < -1 || stream_index >= (int)s->nb_streams)
@@ -699,19 +702,14 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, · 29 unmodified lines
699 702
700 // Fall back on old API if new is not implemented but old is.703 // Fall back on old API if new is not implemented but old is.
701 // Note the old API has somewhat different semantics.704 // Note the old API has somewhat different semantics.
702 if (ffifmt(s->iformat)->read_seek || 1) {705 dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0);
703 int dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0);706 ret = av_seek_frame(s, stream_index, ts, flags | dir);
704 int ret = av_seek_frame(s, stream_index, ts, flags | dir);707 if (ret < 0 && ts != min_ts && max_ts != ts) {
705 if (ret < 0 && ts != min_ts && max_ts != ts) {708 ret = av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir);
706 ret = av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir);709 if (ret >= 0)
707 if (ret >= 0)710 ret = av_seek_frame(s, stream_index, ts, flags | (dir^AVSEEK_FLAG_BACKWARD));
708 ret = av_seek_frame(s, stream_index, ts, flags | (dir^AVSEEK_FLAG_BACKWARD));
709 }
710 return ret;
711 }711 }
712 712 return ret;
713 // try some generic seek like seek_frame_generic() but with new ts semantics
714 return -1; //unreachable
715}713}
716 714
717/** Flush the frame reader. */715/** Flush the frame reader. */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t