aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
Diffstat (limited to 'youtube')
-rw-r--r--youtube/static/js/av-merge.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/youtube/static/js/av-merge.js b/youtube/static/js/av-merge.js
index 84e121c..93664b9 100644
--- a/youtube/static/js/av-merge.js
+++ b/youtube/static/js/av-merge.js
@@ -225,7 +225,7 @@ Stream.prototype.appendSegment = function(segmentIdx, chunk) {
while (numDeleted < 3 && i < currentSegment) {
let entry = this.sidx.entries[i];
let start = entry.tickStart/this.sidx.timeScale;
- let end = entry.tickEnd/this.sidx.timeScale;
+ let end = (entry.tickEnd+1)/this.sidx.timeScale;
if (entry.have) {
this.reportWarning('Deleting segment', i);
this.sourceBuffer.remove(start, end);
@@ -248,7 +248,7 @@ Stream.prototype.getSegmentIdx = function(videoTime) {
// go up or down to find correct index
while (index >= 0 && index < this.sidx.entries.length) {
var entry = this.sidx.entries[index];
- if (entry.tickStart <= currentTick && entry.tickEnd >= currentTick){
+ if (entry.tickStart <= currentTick && (entry.tickEnd+1) > currentTick){
return index;
}
index = index + increment;
@@ -296,7 +296,7 @@ Stream.prototype.segmentInBuffer = function(segmentIdx) {
var entry = this.sidx.entries[segmentIdx];
// allow for 0.01 second error
var timeStart = entry.tickStart/this.sidx.timeScale + 0.01;
- var timeEnd = entry.tickEnd/this.sidx.timeScale - 0.01;
+ var timeEnd = (entry.tickEnd+1)/this.sidx.timeScale - 0.01;
var timeRanges = this.sourceBuffer.buffered;
for (var i=0; i < timeRanges.length; i++) {
if (timeRanges.start(i) <= timeStart && timeEnd <= timeRanges.end(i)) {
@@ -311,7 +311,8 @@ Stream.prototype.fetchSegment = function(segmentIdx) {
this.reportDebug(
'Fetching segment', segmentIdx, ', bytes',
entry.start, entry.end, ', seconds',
- entry.tickStart/this.sidx.timeScale, entry.tickEnd/this.sidx.timeScale
+ entry.tickStart/this.sidx.timeScale,
+ (entry.tickEnd+1)/this.sidx.timeScale
)
fetchRange(
this.url,