diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js index a131015a61..24dfadfda1 100644 --- a/lib/media/media_source_engine.js +++ b/lib/media/media_source_engine.js @@ -1052,7 +1052,7 @@ shaka.media.MediaSourceEngine = class { return; } const hasChangedCodecs = - await this.determineCodecSwitch_(contentType, stream, streamsByType); + await this.codecSwitchIfNecessary_(contentType, stream, streamsByType); await Promise.all([ // Queue an abort() to help MSE splice together overlapping segments. @@ -1360,7 +1360,7 @@ shaka.media.MediaSourceEngine = class { * Enqueue an operation which must block all other operations on all * SourceBuffers. * - * @param {function()} run + * @param {function():(Promise|undefined)} run * @return {!Promise} * @private */ @@ -1669,15 +1669,17 @@ shaka.media.MediaSourceEngine = class { } /** - * Codec switch if necessary + * Codec switch if necessary, this will not resolve until the codec + * switch is over. * @param {shaka.util.ManifestParserUtils.ContentType} contentType * @param {shaka.extern.Stream} stream * @param {!Map.} streamsByType - * @return {!Promise.} + * @return {!Promise.} true if there was a codec switch, + * false otherwise. * @private */ - async determineCodecSwitch_(contentType, stream, streamsByType) { + async codecSwitchIfNecessary_(contentType, stream, streamsByType) { const MimeUtils = shaka.util.MimeUtils; const currentCodec = MimeUtils.getCodecBase( MimeUtils.getCodecs(this.sourceBufferTypes_[contentType])); diff --git a/lib/media/streaming_engine.js b/lib/media/streaming_engine.js index f06cafa578..822481a704 100644 --- a/lib/media/streaming_engine.js +++ b/lib/media/streaming_engine.js @@ -2501,9 +2501,9 @@ shaka.media.StreamingEngine.PlayerInterface; * The last append window start given to MediaSourceEngine for this type. * @property {?number} lastAppendWindowEnd * The last append window end given to MediaSourceEngine for this type. - * @property {?number} lastCodecs + * @property {?string} lastCodecs * The last append codecs given to MediaSourceEngine for this type. - * @property {?number} lastMimeType + * @property {?string} lastMimeType * The last append mime type given to MediaSourceEngine for this type. * @property {?shaka.extern.Stream} restoreStreamAfterTrickPlay * The Stream to restore after trick play mode is turned off.