forked from video-dev/hls.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
5 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const assert = require('assert'); | ||
const bufferIsEqual = require('arraybuffer-equal'); | ||
|
||
import TSDemuxer from '../../../src/demux/tsdemuxer'; | ||
import Hls from '../../../src/hls'; | ||
|
||
|
||
class FakeRemuxer { | ||
constructor() { | ||
this.switchLevel__count = 0; | ||
this.insertDiscontinuity__count = 0; | ||
} | ||
switchLevel() { this.switchLevel__count++; } | ||
insertDiscontinuity() { this.insertDiscontinuity__count++; } | ||
remux() {} | ||
} | ||
|
||
|
||
describe('TS Demuxer', () => { | ||
|
||
var demuxer = new TSDemuxer(new Hls(), FakeRemuxer); | ||
|
||
it('can probe for valid and invalid TS fragments', () => { | ||
assert.equal(TSDemuxer.probe(validTSFragment), true); | ||
assert.equal(TSDemuxer.probe(new Uint8Array([])), false); | ||
}); | ||
// demuxer.push(data,audioCodec,videoCodec,timeOffset,cc,level,sn,duration); | ||
|
||
it('detects a discontinuity', () => { | ||
var cc; | ||
|
||
// Initial feeds of data should not attempt to insert a discontinuity | ||
cc = 0; | ||
demuxer.push([], 'a', 'v', 0, cc, 0, 0, 0) | ||
assert.equal(demuxer.remuxer.insertDiscontinuity__count, 0); | ||
demuxer.push([], 'a', 'v', 0, cc, 0, 0, 0) | ||
assert.equal(demuxer.remuxer.insertDiscontinuity__count, 0); | ||
|
||
// Noticing a change to the continuity counter should trigger a remuxer discontinuity insertion | ||
cc = 1; | ||
demuxer.push([], 'a', 'v', 0, cc, 0, 0, 0) | ||
assert.equal(demuxer.remuxer.insertDiscontinuity__count, 1); | ||
}); | ||
|
||
}); | ||
|
||
|
||
|
||
// Grabbed the first 3*188 bytes from the sample at | ||
// http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8 | ||
const validTSFragment = new Uint8Array([71,64,17,16,0,66,240,42,0,1,193,0,0,0,1,255,0,1,252,128,25,72,23,1,10,108,117,109,98,101,114,106,97,99,107,10,108,117,109,98,101,114,106,97,99,107,181,55,220,162,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,71,64,0,16,0,0,176,13,0,1,193,0,0,0,1,225,0,232,249,94,125,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,71,65,0,16,0,2,176,23,0,1,193,0,0,225,2,240,0,15,225,1,240,0,27,225,2,240,0,36,225,253,208,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters