av-merge: End stream correctly when last segments do not overlap

In this video at 480p:
https://www.youtube.com/watch?v=6bnanI9jXps
There is an extremely tiny audio segment from
30.00018140589569 to 30.06981859410431
after the last video segment ends at 29.99998888888889. Call
end of stream when we have all segments until the end, instead
of calling it when we are playing the last segment.

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor 2021-08-28 09:23:19 -07:00 committed by Jesús
parent ef867e3759
commit 9d3ebca622
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -283,10 +283,9 @@ Stream.prototype.checkBuffer = async function() {
if (i < this.sidx.entries.length && !this.sidx.entries[i].requested) {
this.fetchSegment(i);
// We are playing the last segment and we have it.
// We have all the segments until the end
// Signal the end of stream
} else if (currentSegmentIdx == this.sidx.entries.length - 1
&& this.sidx.entries[currentSegmentIdx].have) {
} else if (i == this.sidx.entries.length) {
if (this.streamType == 'audio')
this.avMerge.audioEndOfStream();
else