mirror of
https://github.com/mpv-player/mpv
synced 2025-03-21 02:41:13 +00:00
demux: adjust reader_head on range joining
I'm not sure about this, but it looks like a bug. If a stream didn't have packets, but the joined range does, the stream should obviously read the packets added by the joined range. Until now, due to reader_head being NULL, reading was only resumed if a _new_ packet was added by actual demuxing (in add_packet_locked()), which means the stream would suddenly skip ahead, past the original end of the joined range. Change it so that it will pick up the new range. Also, clear the skip_to_keyframe flag. Nothing useful can come from this flag being set; in the first place, the first packet of a range (that isn't the current range) should start with a keyframe. Some code probably enforced it (although it's fuzzy). Completely untested.
This commit is contained in:
parent
2d2d96f00b
commit
53cf4e27d4
@ -1297,6 +1297,10 @@ static void attempt_range_joining(struct demux_internal *in)
|
||||
struct demux_queue *q2 = next->streams[n];
|
||||
|
||||
struct demux_stream *ds = in->streams[n]->ds;
|
||||
assert(ds->queue == q1);
|
||||
|
||||
// First new packet that is appended to the current range.
|
||||
struct demux_packet *join_point = q2->head;
|
||||
|
||||
if (q2->head) {
|
||||
if (q1->head) {
|
||||
@ -1326,6 +1330,10 @@ static void attempt_range_joining(struct demux_internal *in)
|
||||
add_index_entry(q1, q2->index[i]);
|
||||
q2->num_index = 0;
|
||||
|
||||
if (ds->selected && !ds->reader_head)
|
||||
ds->reader_head = join_point;
|
||||
ds->skip_to_keyframe = false;
|
||||
|
||||
recompute_buffers(ds);
|
||||
in->fw_bytes += ds->fw_bytes;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user