summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-07-28 20:09:31 +0300
committerMartin Storsjö <martin@martin.st>2013-07-29 09:50:02 +0300
commiteb33ba04e03d9f36e23fffd442510c824be709c3 (patch)
tree84ea8f24bc6f7c993a7f2656cb28343afbd5838d
parentc5b46a064d9991f2cd045c90179fccf35ecffc34 (diff)
hls: Return all packets from a previous variant before moving on to the next one
This serves as a safeguard; normally we want to use the dts comparison to interleave packets from all active variants. If that dts comparison for some reason doesn't work as intended, make sure that all packets in all variants for a certain sequence number have been returned before moving on to the next one. Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/hls.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 0d691ec47e..464faee793 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -638,10 +638,13 @@ start:
}
}
}
- /* Check if this stream has the packet with the lowest dts */
+ /* Check if this stream still is on an earlier segment number, or
+ * has the packet with the lowest dts */
if (var->pkt.data) {
if (minvariant < 0 ||
- var->pkt.dts < c->variants[minvariant]->pkt.dts)
+ var->cur_seq_no < c->variants[minvariant]->cur_seq_no ||
+ (var->cur_seq_no == c->variants[minvariant]->cur_seq_no &&
+ var->pkt.dts < c->variants[minvariant]->pkt.dts))
minvariant = i;
}
}