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: Fix waiting for empty init datas #6292

Merged
merged 6 commits into from Feb 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/media/drm_engine.js
Expand Up @@ -695,14 +695,18 @@ shaka.media.DrmEngine = class {
// Create sessions.
const initDatas =
(this.currentDrmInfo_ ? this.currentDrmInfo_.initData : []) || [];
for (const initDataOverride of initDatas) {
// All initDatas with initData with a size of 0 will get ignored by the
theodab marked this conversation as resolved.
Show resolved Hide resolved
// newInitData method. Filter them out now, so that we don't hang forever
// waiting for them to finish.
const validInitDatas = initDatas.filter((id) => id.initData.length > 0);
for (const initDataOverride of validInitDatas) {
this.newInitData(
initDataOverride.initDataType, initDataOverride.initData);
}

// If we have no sessions, we need to resolve the promise right now or else
// it will never get resolved.
if (!initDatas.length) {
if (!validInitDatas.length) {
this.allSessionsLoaded_.resolve();
}

Expand Down