Skip to content

Commit

Permalink
First review
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed May 10, 2023
1 parent 4d8b9bd commit b4f1ee2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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.<shaka.util.ManifestParserUtils.ContentType,
* shaka.extern.Stream>} streamsByType
* @return {!Promise.<boolean>}
* @return {!Promise.<boolean>} 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]));
Expand Down
4 changes: 2 additions & 2 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b4f1ee2

Please sign in to comment.