Skip to content

Commit

Permalink
tsdemuxer: mark fragment as contiguous if on same level, next SN but …
Browse files Browse the repository at this point in the history
…with discontinuity

fix buffer hole after discontinuity

related to https://github.com/dailymotion/hls.js/issues/443
  • Loading branch information
mangui committed Jun 9, 2016
1 parent 42552bf commit fe0e38a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/demux/tsdemuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
this._aacTrack = {container : 'video/mp2t', type: 'audio', id :-1, sequenceNumber: 0, samples : [], len : 0};
this._id3Track = {type: 'id3', id :-1, sequenceNumber: 0, samples : [], len : 0};
this._txtTrack = {type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0};
// flush any partial content
this.aacOverFlow = null;
this.remuxer.switchLevel();
}

Expand All @@ -68,7 +70,8 @@
logger.log('discontinuity detected');
this.insertDiscontinuity();
this.lastCC = cc;
} else if (level !== this.lastLevel) {
}
if (level !== this.lastLevel) {
logger.log('level switch detected');
this.switchLevel();
this.lastLevel = level;
Expand All @@ -77,11 +80,6 @@
}
this.lastSN = sn;

if(!this.contiguous) {
// flush any partial content
this.aacOverFlow = null;
}

var pmtParsed = this.pmtParsed,
avcId = this._avcTrack.id,
aacId = this._aacTrack.id,
Expand Down
2 changes: 1 addition & 1 deletion src/remux/mp4-remuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MP4Remuxer {
}

insertDiscontinuity() {
this._initPTS = this._initDTS = this.nextAacPts = this.nextAvcDts = undefined;
this._initPTS = this._initDTS = undefined;
}

switchLevel() {
Expand Down

0 comments on commit fe0e38a

Please sign in to comment.