mirror of
https://github.com/mpv-player/mpv
synced 2025-02-07 07:31:48 +00:00
demux_lavf: hack against hls showing "100%" position
The HLs protocol consists of a "playlist" main file, which mpv downloads and passes to the HLS demuxer. The HLS demuxer actually requests segment files containing media data on its own. The packets read from the demuxer have a source file position set, but it's not from the main file. This leads to a strange effect: as a last fallback, the player will calculate the approximate playback position from the file position/size ratio, and since the main file is tiny, this will always show 100%. Fix this by resetting the packet file position. This doesn't affect the case when HLS actually reports a duration.
This commit is contained in:
parent
d26ba961d0
commit
a64b1deaa6
@ -858,6 +858,12 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
|
||||
priv->last_pts = dp->dts * AV_TIME_BASE;
|
||||
}
|
||||
av_free_packet(pkt);
|
||||
|
||||
// Do not confuse player's position estimation (position is into segment,
|
||||
// player knows about the playlist main file only).
|
||||
if (matches_avinputformat_name(priv, "hls"))
|
||||
dp->pos = -1;
|
||||
|
||||
demux_add_packet(stream, dp);
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user