mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-19 16:47:01 +03:00
1ab3f9c6db
As part of Period-flattening, I'm trying to remove our dependence on the "position" field of SegmentReference. With that eliminated, we can more easily concatenate Arrays of SegmentReferences without modifying them. - Make SegmentIndex iterable - Add specialized seek() and current() methods to SegmentIterator - Remove position from SegmentReference - Make positions in SegmentIndex API stable without field in reference - Remove brittle hard-coded positions in tests (except SegmentIndex tests, where they would be hard to avoid in testing methods separately) - Use SegmentIterator in StreamingEngine to track the next segment between switches Issue #892 (refactor StreamingEngine) Issue #1339 (period flattening) Change-Id: I666cc21249c34ee6cbc138a59109d9f1159fa127
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
/** @license
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
describe('SegmentReference', () => {
|
|
it('returns in getters values from constructor parameters', () => {
|
|
const initSegmentReference = new shaka.media.InitSegmentReference(
|
|
/* getUris= */ () => ['a', 'b'],
|
|
/* startByte= */ 0,
|
|
/* endBytes= */ null);
|
|
|
|
const reference = new shaka.media.SegmentReference(
|
|
/* startTime= */ 2,
|
|
/* endTime= */ 3,
|
|
/* getUris= */ () => ['x', 'y'],
|
|
/* startByte= */ 4,
|
|
/* endByte= */ 5,
|
|
initSegmentReference,
|
|
/* timestampOffset= */ 6,
|
|
/* appendWindowStart= */ 7,
|
|
/* appendWindowEnd= */ 8);
|
|
|
|
expect(reference.getStartTime()).toBe(2);
|
|
expect(reference.getEndTime()).toBe(3);
|
|
expect(reference.getUris()).toEqual(['x', 'y']);
|
|
expect(reference.getStartByte()).toBe(4);
|
|
expect(reference.getEndByte()).toBe(5);
|
|
expect(reference.initSegmentReference).toBe(initSegmentReference);
|
|
expect(reference.timestampOffset).toBe(6);
|
|
expect(reference.appendWindowStart).toBe(7);
|
|
expect(reference.appendWindowEnd).toBe(8);
|
|
});
|
|
});
|
|
|
|
describe('InitSegmentReference', () => {
|
|
it('returns in getters values from constructor parameters', () => {
|
|
const reference = new shaka.media.InitSegmentReference(
|
|
/* getUris= */ () => ['x', 'y'],
|
|
/* startByte= */ 4,
|
|
/* endByte= */ 5);
|
|
|
|
expect(reference.getUris()).toEqual(['x', 'y']);
|
|
expect(reference.getStartByte()).toBe(4);
|
|
expect(reference.getEndByte()).toBe(5);
|
|
});
|
|
});
|