summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-09 21:37:14 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-10 22:32:37 -0800
commit4a11c28237c4f362d9b54f47076bfa56f21119d8 (patch)
treeae6bba3b2d29173c9a69de956c86157f9a3dd5f6 /demux
parent2d345c59d637ec12fbc39d97e1999c335dffcdd2 (diff)
downloadmpv-4a11c28237c4f362d9b54f47076bfa56f21119d8.tar.bz2
mpv-4a11c28237c4f362d9b54f47076bfa56f21119d8.tar.xz
demux: add missing seekpoint when cached ranges are joined
The impact was that you couldn't exactly seek to the join point with a keyframe seek, even though there was a keyframe. This commit fixes it by preserving the necessary metadata that got lost on cached range joining. This is so absurdly obscure that it gets a longer code comment.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c
index b903100b96..d904d03fbf 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -999,6 +999,14 @@ static void attempt_range_joining(struct demux_internal *in)
goto failed;
}
+ // q1 usually meets q2 at a keyframe. q1 will end on a key-
+ // frame (because it tries joining when reading a keyframe).
+ // Obviously, q1 can not know the kf_seek_pts yet; it would
+ // have to read packets after it to compute it. Ideally,
+ // we'd remove it and use q2's packet, but the linked list
+ // makes this hard, so copy this missing metadata instead.
+ end->kf_seek_pts = dp->kf_seek_pts;
+
remove_head_packet(q2);
join_point_found = true;
break;