diff --git a/lib/player.js b/lib/player.js index 4899b81175..8be4517d09 100644 --- a/lib/player.js +++ b/lib/player.js @@ -1440,11 +1440,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget { // "preload" here without prefetch. // That way, both a preload and normal load can follow the same code // paths. + // NOTE: await preloadInner_ can be outside the mutex because it should + // not mutate "this". preloadManager = await this.preloadInner_( assetUri, startTime, mimeType, /* standardLoad= */ true); if (preloadManager) { preloadManager.setEventHandoffTarget(this); - await preloadManager.start(); + await mutexWrapOperation(() => preloadManager.start(), 'preload'); } } else { // Hook up events, so any events emitted by the preloadManager will diff --git a/test/player_load_graph_integration.js b/test/player_load_graph_integration.js index 27be9657dc..b8c18208d4 100644 --- a/test/player_load_graph_integration.js +++ b/test/player_load_graph_integration.js @@ -756,6 +756,7 @@ describe('Player Load Graph', () => { 'manifest-parser', 'manifest', 'drm-engine', + // Excludes 'unload'. ]); /** @type {!Set.} */ @@ -774,6 +775,7 @@ describe('Player Load Graph', () => { await player.attach(video); player.load('test:sintel').catch(() => {}); } else { + goog.asserts.assert(state == 'unload', 'Unrecognized testing state!'); await player.attach(video); await player.load('test:sintel'); player.unload().catch(() => {});