Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3384 Multiple Seek Backwards (e.g. Drag) #3479

Merged
merged 1 commit into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Toshihiro Suzuki <[email protected]>
uStudio Inc. <*@ustudio.com>
Verizon Digital Media Services <*@verizondigitalmedia.com>
Vincent Valot <[email protected]>
Wayne Morgan <[email protected]>
Prakash <[email protected]>


1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Toshihiro Suzuki <[email protected]>
Vasanth Polipelli <[email protected]>
Vignesh Venkatasubramanian <[email protected]>
Vincent Valot <[email protected]>
Wayne Morgan <[email protected]>
Yohann Connell <[email protected]>
Adrián Gómez Llorente <[email protected]>
Prakash Duggaraju <[email protected]>
15 changes: 9 additions & 6 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1188,18 +1188,21 @@ shaka.media.StreamingEngine = class {

mediaState.performingUpdate = true;

const initSourceBuffer = this.initSourceBuffer_(mediaState, reference);

shaka.log.v2(logPrefix, 'fetching segment');
try {
await this.initSourceBuffer_(mediaState, reference);
this.destroyer_.ensureNotDestroyed();
if (this.fatalError_) {
return;
}

shaka.log.v2(logPrefix, 'fetching segment');
const isMP4 = stream.mimeType == 'video/mp4' ||
stream.mimeType == 'audio/mp4';
const isReadableStreamSupported = window.ReadableStream;
// Enable MP4 low latency streaming with ReadableStream chunked data.
if (this.config_.lowLatencyMode && isReadableStreamSupported && isMP4) {
let remaining = new Uint8Array(0);
const streamDataCallback = async (data) => {
await initSourceBuffer;
this.destroyer_.ensureNotDestroyed();
if (this.fatalError_) {
return;
Expand Down Expand Up @@ -1237,7 +1240,7 @@ shaka.media.StreamingEngine = class {
'ReadableStream is not supported by the browser.');
}
const fetchSegment = this.fetch_(mediaState, reference);
const results = await Promise.all([initSourceBuffer, fetchSegment]);
const result = await fetchSegment;
this.destroyer_.ensureNotDestroyed();
if (this.fatalError_) {
return;
Expand All @@ -1254,7 +1257,7 @@ shaka.media.StreamingEngine = class {
return;
}
await this.append_(
mediaState, presentationTime, stream, reference, results[1]);
mediaState, presentationTime, stream, reference, result);
}

this.destroyer_.ensureNotDestroyed();
Expand Down
6 changes: 3 additions & 3 deletions test/media/streaming_engine_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ describe('StreamingEngine', () => {
// This would let some media types buffer faster than others if unchecked.
netEngineDelays.text = 0.1;
netEngineDelays.audio = 1.0;
netEngineDelays.video = 10.0;
netEngineDelays.video = 5.0; // Need init segment and media segment

mediaSourceEngine.appendBuffer.and.callFake((type, data, start, end) => {
// Call to the underlying implementation.
Expand Down Expand Up @@ -2170,13 +2170,13 @@ describe('StreamingEngine', () => {
.bind(mediaSourceEngine);

mediaSourceEngine.remove.and.callFake((type, start, end) => {
expect(presentationTimeInSeconds).toBe(20);
expect(presentationTimeInSeconds).toBeGreaterThanOrEqual(20);
expect(start).toBe(0);
expect(end).toBe(10);

if (mediaSourceEngine.remove.calls.count() == 3) {
mediaSourceEngine.remove.and.callFake((type, start, end) => {
expect(presentationTimeInSeconds).toBe(30);
expect(presentationTimeInSeconds).toBeGreaterThanOrEqual(30);
expect(start).toBe(10);
expect(end).toBe(20);
return originalRemove(type, start, end);
Expand Down