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

Don't wait for sessions to close on DrmEngine#destroy #1168

Merged
Merged
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
9 changes: 7 additions & 2 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,21 @@ shaka.media.DrmEngine.prototype.destroy = function() {
var Functional = shaka.util.Functional;
this.destroyed_ = true;

var async = this.activeSessions_.map(function(activeSession) {
// TODO: wait for sessions to close when destroying. Due to a bug in Chrome,
// sometimes the Promise returned by MediaKeySession#close never resolves.
// See #1093 and https://crbug.com/690583
this.activeSessions_.forEach(function(activeSession) {
// Ignore any errors when closing the sessions. One such error would be
// an invalid state error triggered by closing a session which has not
// generated any key requests.
// Chrome sometimes returns |undefined|: https://crbug.com/690664
var p = activeSession.session.close() || Promise.resolve();
return p.catch(Functional.noop);
p = p.catch(Functional.noop);
});
this.allSessionsLoaded_.reject();

var async = [];

if (this.eventManager_)
async.push(this.eventManager_.destroy());

Expand Down