From 4a11c28237c4f362d9b54f47076bfa56f21119d8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 9 Jan 2018 21:37:14 +0100 Subject: 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. --- demux/demux.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- cgit v1.2.3