Skip to content

Commit

Permalink
feat: Use local assets for transmuxer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Aug 29, 2023
1 parent 8f867cd commit 983f36f
Show file tree
Hide file tree
Showing 56 changed files with 183 additions and 46 deletions.
7 changes: 7 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ module.exports = (config) => {
{pattern: 'test/**/*.js', included: false},
{pattern: 'test/test/assets/*', included: false},
{pattern: 'test/test/assets/3675/*', included: false},
{pattern: 'test/test/assets/hls-raw-aac/*', included: false},
{pattern: 'test/test/assets/hls-raw-ac3/*', included: false},
{pattern: 'test/test/assets/hls-raw-ec3/*', included: false},
{pattern: 'test/test/assets/hls-raw-mp3/*', included: false},
{pattern: 'test/test/assets/hls-ts-aac/*', included: false},
{pattern: 'test/test/assets/hls-ts-h264/*', included: false},
{pattern: 'test/test/assets/hls-ts-muxed-aac-h264/*', included: false},
{pattern: 'dist/shaka-player.ui.js', included: false},
{pattern: 'dist/locales.js', included: false},
{pattern: 'demo/**/*.js', included: false},
Expand Down
Binary file added test/test/assets/hls-raw-aac/fileSequence0.aac
Binary file not shown.
Binary file added test/test/assets/hls-raw-aac/fileSequence1.aac
Binary file not shown.
Binary file added test/test/assets/hls-raw-aac/fileSequence2.aac
Binary file not shown.
Binary file added test/test/assets/hls-raw-aac/fileSequence3.aac
Binary file not shown.
4 changes: 4 additions & 0 deletions test/test/assets/hls-raw-aac/manifest.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#EXTM3U

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=41457,CODECS="mp4a.40.2"
stream.m4a.m3u8
14 changes: 14 additions & 0 deletions test/test/assets/hls-raw-aac/stream.m4a.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#EXTM3U
#EXT-X-TARGETDURATION:11
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:9.98458,
fileSequence0.aac
#EXTINF:9.98458,
fileSequence1.aac
#EXTINF:9.98459,
fileSequence2.aac
#EXTINF:10.03102,
fileSequence3.aac
#EXT-X-ENDLIST
Binary file added test/test/assets/hls-raw-ac3/fileSequence0.ac3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ac3/fileSequence1.ac3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ac3/fileSequence2.ac3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ac3/fileSequence3.ac3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ac3/fileSequence4.ac3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ac3/fileSequence5.ac3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ac3/fileSequence6.ac3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ac3/fileSequence7.ac3
Binary file not shown.
31 changes: 31 additions & 0 deletions test/test/assets/hls-raw-ac3/prog_index.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.98400,
#EXT-X-BITRATE:384
fileSequence0.ac3
#EXTINF:5.98400,
#EXT-X-BITRATE:384
fileSequence1.ac3
#EXTINF:5.98400,
#EXT-X-BITRATE:384
fileSequence2.ac3
#EXTINF:5.98400,
#EXT-X-BITRATE:384
fileSequence3.ac3
#EXTINF:5.98400,
#EXT-X-BITRATE:384
fileSequence4.ac3
#EXTINF:5.98400,
#EXT-X-BITRATE:384
fileSequence5.ac3
#EXTINF:5.98400,
#EXT-X-BITRATE:384
fileSequence6.ac3
#EXTINF:5.98400,
#EXT-X-BITRATE:384
fileSequence7.ac3
#EXT-X-ENDLIST
Binary file added test/test/assets/hls-raw-ec3/fileSequence0.ec3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ec3/fileSequence1.ec3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ec3/fileSequence2.ec3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ec3/fileSequence3.ec3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ec3/fileSequence4.ec3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ec3/fileSequence5.ec3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ec3/fileSequence6.ec3
Binary file not shown.
Binary file added test/test/assets/hls-raw-ec3/fileSequence7.ec3
Binary file not shown.
31 changes: 31 additions & 0 deletions test/test/assets/hls-raw-ec3/prog_index.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.98400,
#EXT-X-BITRATE:192
fileSequence0.ec3
#EXTINF:5.98400,
#EXT-X-BITRATE:192
fileSequence1.ec3
#EXTINF:5.98400,
#EXT-X-BITRATE:192
fileSequence2.ec3
#EXTINF:5.98400,
#EXT-X-BITRATE:192
fileSequence3.ec3
#EXTINF:5.98400,
#EXT-X-BITRATE:192
fileSequence4.ec3
#EXTINF:5.98400,
#EXT-X-BITRATE:192
fileSequence5.ec3
#EXTINF:5.98400,
#EXT-X-BITRATE:192
fileSequence6.ec3
#EXTINF:5.98400,
#EXT-X-BITRATE:192
fileSequence7.ec3
#EXT-X-ENDLIST
13 changes: 13 additions & 0 deletions test/test/assets/hls-raw-mp3/chunklist_w905519204.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10.0,
media_w905519204_0.mp3
#EXTINF:10.0,
media_w905519204_1.mp3
#EXTINF:10.0,
media_w905519204_2.mp3
#EXTINF:10.0,
media_w905519204_3.mp3
#EXT-X-ENDLIST
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions test/test/assets/hls-raw-mp3/playlist.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=63701,CODECS="mp4a.40.34"
chunklist_w905519204.m3u8
23 changes: 23 additions & 0 deletions test/test/assets/hls-ts-aac/playlist.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#EXTM3U

#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:4

#EXTINF:3.989
segment_0.ts
#EXTINF:3.989
segment_1.ts
#EXTINF:3.989
segment_2.ts
#EXTINF:3.989
segment_3.ts
#EXTINF:3.989
segment_4.ts
#EXTINF:3.989
segment_5.ts
#EXTINF:3.989
segment_6.ts
#EXTINF:3.989
segment_7.ts
#EXT-X-ENDLIST
Binary file added test/test/assets/hls-ts-aac/segment_0.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-aac/segment_1.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-aac/segment_2.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-aac/segment_3.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-aac/segment_4.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-aac/segment_5.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-aac/segment_6.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-aac/segment_7.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-h264/fileSequence0.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-h264/fileSequence1.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-h264/fileSequence2.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-h264/fileSequence3.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-h264/fileSequence4.ts
Binary file not shown.
Binary file added test/test/assets/hls-ts-h264/fileSequence5.ts
Binary file not shown.
25 changes: 25 additions & 0 deletions test/test/assets/hls-ts-h264/prog_index.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:6.00000,
#EXT-X-BITRATE:377
fileSequence0.ts
#EXTINF:6.00000,
#EXT-X-BITRATE:385
fileSequence1.ts
#EXTINF:6.00000,
#EXT-X-BITRATE:388
fileSequence2.ts
#EXTINF:6.00000,
#EXT-X-BITRATE:378
fileSequence3.ts
#EXTINF:6.00000,
#EXT-X-BITRATE:378
fileSequence4.ts
#EXTINF:6.00000,
#EXT-X-BITRATE:372
fileSequence5.ts
#EXT-X-ENDLIST
17 changes: 17 additions & 0 deletions test/test/assets/hls-ts-muxed-aac-h264/chunk.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:6,
n_0_0_0.ts
#EXTINF:6,
n_1_0_0.ts
#EXTINF:6,
n_2_0_0.ts
#EXTINF:6,
n_3_0_0.ts
#EXTINF:6,
n_4_0_0.ts
#EXTINF:6,
n_5_0_0.ts
#EXT-X-ENDLIST
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions test/test/assets/hls-ts-muxed-aac-h264/playlist.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=1225016,CODECS="avc1.42c00d,mp4a.40.2",RESOLUTION=320x180
chunk.m3u8
56 changes: 10 additions & 46 deletions test/transmuxer/transmuxer_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,10 @@ describe('Transmuxer Player', () => {
await shaka.test.Loader.loadShaka(getClientArg('uncompiled'));
});

beforeEach(() => {
beforeEach(async () => {
await shaka.test.TestScheme.createManifests(compiledShaka, '_compiled');
player = new compiledShaka.Player(video);

// Make sure we are playing the lowest res available to avoid test flake
// based on network issues. Note that disabling ABR and setting a low
// abr.defaultBandwidthEstimate would not be sufficient, because it
// would only affect the choice of track on the first period. When we
// cross a period boundary, the default bandwidth estimate will no
// longer be in effect, and AbrManager may choose higher res tracks for
// the new period. Using abr.restrictions.maxHeight will let us force
// AbrManager to the lowest resolution, which is its fallback when these
// soft restrictions cannot be met.
player.configure('abr.restrictions.maxHeight', 1);
player.configure('mediaSource.forceTransmux', true);
player.configure('streaming.useNativeHlsOnSafari', false);

Expand All @@ -71,11 +62,7 @@ describe('Transmuxer Player', () => {
});

it('raw AAC', async () => {
// eslint-disable-next-line max-len
const url = 'https://storage.googleapis.com/shaka-demo-assets/raw-hls-audio-only/manifest.m3u8';

await player.load(url, /* startTime= */ null,
/* mimeType= */ undefined);
await player.load('/base/test/test/assets/hls-raw-aac/manifest.m3u8');
await video.play();
expect(player.isLive()).toBe(false);

Expand All @@ -85,7 +72,7 @@ describe('Transmuxer Player', () => {

// Play for 15 seconds, but stop early if the video ends. If it takes
// longer than 90 seconds, fail the test.
await waiter.waitUntilPlayheadReachesOrFailOnTimeout(video, 15, 90);
await waiter.waitUntilPlayheadReachesOrFailOnTimeout(video, 15, 15);

await player.unload();
});
Expand All @@ -94,11 +81,7 @@ describe('Transmuxer Player', () => {
if (!MediaSource.isTypeSupported('audio/mp4; codecs="mp3"')) {
return;
}
// eslint-disable-next-line max-len
const url = 'https://pl.streamingvideoprovider.com/mp3-playlist/playlist.m3u8';

await player.load(url, /* startTime= */ null,
/* mimeType= */ undefined);
await player.load('/base/test/test/assets/hls-raw-mp3/playlist.m3u8');
await video.play();
expect(player.isLive()).toBe(false);

Expand Down Expand Up @@ -132,11 +115,7 @@ describe('Transmuxer Player', () => {
return;
}

// eslint-disable-next-line max-len
const url = 'https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/a2/prog_index.m3u8';

await player.load(url, /* startTime= */ null,
/* mimeType= */ undefined);
await player.load('/base/test/test/assets/hls-raw-ac3/prog_index.m3u8');
await video.play();
expect(player.isLive()).toBe(false);

Expand Down Expand Up @@ -166,11 +145,7 @@ describe('Transmuxer Player', () => {
return;
}

// eslint-disable-next-line max-len
const url = 'https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/a3/prog_index.m3u8';

await player.load(url, /* startTime= */ null,
/* mimeType= */ undefined);
await player.load('/base/test/test/assets/hls-raw-ac3/prog_index.m3u8');
await video.play();
expect(player.isLive()).toBe(false);

Expand All @@ -187,10 +162,7 @@ describe('Transmuxer Player', () => {

it('muxed H.264+AAC in TS', async () => {
// eslint-disable-next-line max-len
const url = 'https://cf-sf-video.wmspanel.com/local/raw/BigBuckBunny_320x180.mp4/playlist.m3u8';

await player.load(url, /* startTime= */ null,
/* mimeType= */ undefined);
await player.load('/base/test/test/assets/hls-ts-muxed-aac-h264/playlist.m3u8');
await video.play();
expect(player.isLive()).toBe(false);

Expand All @@ -206,11 +178,7 @@ describe('Transmuxer Player', () => {
});

it('AAC in TS', async () => {
// eslint-disable-next-line max-len
const url = 'https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa_audio_1_stereo_128000.m3u8';

await player.load(url, /* startTime= */ null,
/* mimeType= */ undefined);
await player.load('/base/test/test/assets/hls-ts-aac/playlist.m3u8');
await video.play();
expect(player.isLive()).toBe(false);

Expand All @@ -226,11 +194,7 @@ describe('Transmuxer Player', () => {
});

it('H.264 in TS', async () => {
// eslint-disable-next-line max-len
const url = 'https://storage.googleapis.com/shaka-demo-assets/apple-advanced-stream-ts/v2/prog_index.m3u8';

await player.load(url, /* startTime= */ null,
/* mimeType= */ undefined);
await player.load('/base/test/test/assets/hls-ts-h264/prog_index.m3u8');
await video.play();
expect(player.isLive()).toBe(false);

Expand Down

0 comments on commit 983f36f

Please sign in to comment.