summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-17 23:42:04 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-02-19 13:39:38 +0900
commit72ba8515d53ee681f8501e573579364781051ade (patch)
tree9346267e57747fa87a9fc1723bcd6f895567ecae
parent21f5d82dc52d4175765f1ea871dc594b215cca66 (diff)
downloadmpv-72ba8515d53ee681f8501e573579364781051ade.tar.bz2
mpv-72ba8515d53ee681f8501e573579364781051ade.tar.xz
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. (cherry picked from commit a64b1deaa613108ffa3496b0306c1aea1ba5a68f)
-rw-r--r--demux/demux_lavf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 4d84bd20d4..bc5d394eba 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -856,6 +856,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;
}