player: don't use stream position as fallback for percent-pos

This should be unneeded, and the packet position is already sufficient
for this case.

Accessing the stream position directly is going to be a problem when the
stream is accessed from another thread later.
This commit is contained in:
wm4 2014-07-05 17:00:48 +02:00
parent 54a4a25fe9
commit 4f00c74491
1 changed files with 2 additions and 3 deletions

View File

@ -461,9 +461,8 @@ double get_current_pos_ratio(struct MPContext *mpctx, bool use_range)
struct stream *s = demuxer->stream;
int64_t size;
if (stream_control(s, STREAM_CTRL_GET_SIZE, &size) > 0 && size > 0) {
int64_t fpos =
demuxer->filepos >= 0 ? demuxer->filepos : stream_tell(s);
ans = MPCLAMP(fpos / (double)size, 0, 1);
if (demuxer->filepos >= 0)
ans = MPCLAMP(demuxer->filepos / (double)size, 0, 1);
}
}
if (use_range) {