From 8623a5d0304dd3e65c613b176b4afa38a6dc96b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Sat, 29 Oct 2022 00:43:02 +0200 Subject: [PATCH] feat: Add AAC transmuxer (#4632) --- demo/common/assets.js | 4 +- demo/common/message_ids.js | 2 +- demo/config.js | 4 +- demo/locales/en.json | 2 +- demo/locales/source.json | 4 +- docs/tutorials/faq.md | 2 +- docs/tutorials/upgrade.md | 6 ++ externs/shaka/player.js | 14 ++--- lib/media/drm_engine.js | 2 +- lib/media/media_source_engine.js | 11 ++-- lib/media/streaming_engine.js | 4 +- lib/media/transmuxer.js | 60 ++++++++++++++++--- lib/player.js | 12 +++- lib/util/mime_utils.js | 6 +- lib/util/player_configuration.js | 2 +- test/media/media_source_engine_integration.js | 12 ++-- test/media/media_source_engine_unit.js | 8 ++- test/media/streaming_engine_unit.js | 2 +- test/media/transmuxer_integration.js | 23 ++++--- test/player_unit.js | 4 +- 20 files changed, 128 insertions(+), 56 deletions(-) diff --git a/demo/common/assets.js b/demo/common/assets.js index cb091266c6..861cd2e4fc 100644 --- a/demo/common/assets.js +++ b/demo/common/assets.js @@ -1306,7 +1306,7 @@ shakaAssets.testAssets = [ .setExtraConfig({ streaming: { useNativeHlsOnSafari: false, - forceTransmuxTS: true, + forceTransmux: true, }, lcevc: { enabled: true, @@ -1331,7 +1331,7 @@ shakaAssets.testAssets = [ .setExtraConfig({ streaming: { useNativeHlsOnSafari: false, - forceTransmuxTS: true, + forceTransmux: true, }, lcevc: { enabled: true, diff --git a/demo/common/message_ids.js b/demo/common/message_ids.js index 19097f6b75..2052e4216a 100644 --- a/demo/common/message_ids.js +++ b/demo/common/message_ids.js @@ -191,7 +191,7 @@ shakaDemo.MessageIds = { ENABLED: 'DEMO_ENABLED', FAST_HALF_LIFE: 'DEMO_FAST_HALF_LIFE', FORCE_HTTPS: 'DEMO_FORCE_HTTPS', - FORCE_TRANSMUX_TS: 'DEMO_FORCE_TRANSMUX_TS', + FORCE_TRANSMUX: 'DEMO_FORCE_TRANSMUX', FUZZ_FACTOR: 'DEMO_FUZZ_FACTOR', GAP_DETECTION_THRESHOLD: 'DEMO_GAP_DETECTION_THRESHOLD', IGNORE_DASH_EMPTY_ADAPTATION_SET: 'DEMO_IGNORE_DASH_EMPTY_ADAPTATION_SET', diff --git a/demo/config.js b/demo/config.js index ad4bb54c27..8db3062a49 100644 --- a/demo/config.js +++ b/demo/config.js @@ -436,8 +436,8 @@ shakaDemo.Config = class { this.latestInput_.input().checked = true; } - this.addBoolInput_(MessageIds.FORCE_TRANSMUX_TS, - 'streaming.forceTransmuxTS') + this.addBoolInput_(MessageIds.FORCE_TRANSMUX, + 'streaming.forceTransmux') .addBoolInput_(MessageIds.START_AT_SEGMENT_BOUNDARY, 'streaming.startAtSegmentBoundary') .addBoolInput_(MessageIds.IGNORE_TEXT_FAILURES, diff --git a/demo/locales/en.json b/demo/locales/en.json index 436f53ea60..a861a17cf0 100644 --- a/demo/locales/en.json +++ b/demo/locales/en.json @@ -82,7 +82,7 @@ "DEMO_FAIRPLAY": "Fairplay DRM", "DEMO_FAST_HALF_LIFE": "Fast half life", "DEMO_FORCE_HTTPS": "Force HTTPS", - "DEMO_FORCE_TRANSMUX_TS": "Force Transmux TS", + "DEMO_FORCE_TRANSMUX": "Force Transmux", "DEMO_FRONT_INTRO_DISMISS": "Dismiss", "DEMO_FRONT_INTRO_ONE": "This is a demo of Google's Shaka Player, a JavaScript library for adaptive video streaming.", "DEMO_FRONT_INTRO_TWO": "Choose a video to playback; more assets are available via the \"all content\" tab.", diff --git a/demo/locales/source.json b/demo/locales/source.json index f2bdd3a3ed..5d3b425f02 100644 --- a/demo/locales/source.json +++ b/demo/locales/source.json @@ -331,9 +331,9 @@ "description": "The name of a configuration value.", "message": "Force [JARGON:HTTPS]" }, - "DEMO_FORCE_TRANSMUX_TS": { + "DEMO_FORCE_TRANSMUX": { "description": "The name of a configuration value.", - "message": "Force Transmux [JARGON:MPEG-2 TS]" + "message": "Force Transmux" }, "DEMO_FRONT_INTRO_DISMISS": { "description": "A button allowing users to dismiss the intro message.", diff --git a/docs/tutorials/faq.md b/docs/tutorials/faq.md index 84f9777cac..433122cfb7 100644 --- a/docs/tutorials/faq.md +++ b/docs/tutorials/faq.md @@ -164,7 +164,7 @@ shaka.net.NetworkingEngine.registerScheme('file', shaka.net.HttpXHRPlugin); contain said captions. Edge and Chromecast, however, have native TS support and thus are not required to transmux. In order to force those platforms to transmux, set the -{@link shaka.extern.StreamingConfiguration|`.streaming.forceTransmuxTS`} +{@link shaka.extern.StreamingConfiguration|`.streaming.forceTransmux`} configuration to true.
diff --git a/docs/tutorials/upgrade.md b/docs/tutorials/upgrade.md index 3aefa2bd9d..1fb4a74199 100644 --- a/docs/tutorials/upgrade.md +++ b/docs/tutorials/upgrade.md @@ -90,3 +90,9 @@ application: clearly-named `lineBreak` (deprecated in v3.1.0) - `IUIElement` plugins must have a `release()` method (not `destroy()`) (deprecated in v3.0.0) + +## v4.3 + + - Configuration changes: + - `streaming.forceTransmuxTS` has been deprecated and replaced by + `streaming.forceTransmux` diff --git a/externs/shaka/player.js b/externs/shaka/player.js index fc8fed1941..a640a965d7 100644 --- a/externs/shaka/player.js +++ b/externs/shaka/player.js @@ -947,7 +947,7 @@ shaka.extern.ManifestConfiguration; * startAtSegmentBoundary: boolean, * gapDetectionThreshold: number, * durationBackoff: number, - * forceTransmuxTS: boolean, + * forceTransmux: boolean, * safeSeekOffset: number, * stallEnabled: boolean, * stallThreshold: number, @@ -1010,12 +1010,12 @@ shaka.extern.ManifestConfiguration; * seek to when the user tries to seek to or start playback at the duration. * To disable this behavior, the config can be set to 0. We recommend using * the default value unless you have a good reason not to. - * @property {boolean} forceTransmuxTS - * If this is true, we will transmux TS content even if not - * strictly necessary for the assets to be played. Shaka Player currently - * only supports CEA 708 captions by transmuxing, so this value is necessary - * for enabling them on platforms with native TS support like Edge or - * Chromecast. This value defaults to false. + * @property {boolean} forceTransmux + * If this is true, we will transmux AAC and TS content even if + * not strictly necessary for the assets to be played. Shaka Player + * currently only supports CEA 708 captions by transmuxing, so this value is + * necessary for enabling them on platforms with native TS support like Edge + * or Chromecast. This value defaults to false. * @property {number} safeSeekOffset * The amount of seconds that should be added when repositioning the playhead * after falling out of the availability window or seek. This gives the player diff --git a/lib/media/drm_engine.js b/lib/media/drm_engine.js index d4d96a8590..52aa5ea581 100644 --- a/lib/media/drm_engine.js +++ b/lib/media/drm_engine.js @@ -845,7 +845,7 @@ shaka.media.DrmEngine = class { if (shaka.media.Transmuxer.isSupported(realMimeType)) { // This will be handled by the Transmuxer, so use the MIME type that the // Transmuxer will produce. - return shaka.media.Transmuxer.convertTsCodecs(stream.type, realMimeType); + return shaka.media.Transmuxer.convertCodecs(stream.type, realMimeType); } return realMimeType; } diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js index cfa427d8c7..6c8b28d088 100644 --- a/lib/media/media_source_engine.js +++ b/lib/media/media_source_engine.js @@ -342,15 +342,16 @@ shaka.media.MediaSourceEngine = class { * shaka.extern.Stream>} streamsByType * A map of content types to streams. All streams must be supported * according to MediaSourceEngine.isStreamSupported. - * @param {boolean} forceTransmuxTS - * If true, this will transmux TS content even if it is natively supported. + * @param {boolean} forceTransmux + * If true, this will transmux AAC and TS content even if it is natively + * supported. * @param {boolean=} sequenceMode * If true, the media segments are appended to the SourceBuffer in strict * sequence. * * @return {!Promise} */ - async init(streamsByType, forceTransmuxTS, sequenceMode=false) { + async init(streamsByType, forceTransmux, sequenceMode=false) { const ContentType = shaka.util.ManifestParserUtils.ContentType; await this.mediaSourceOpen_; @@ -368,11 +369,11 @@ shaka.media.MediaSourceEngine = class { if (contentType == ContentType.TEXT) { this.reinitText(mimeType, sequenceMode); } else { - if ((forceTransmuxTS || !MediaSource.isTypeSupported(mimeType)) && + if ((forceTransmux || !MediaSource.isTypeSupported(mimeType)) && shaka.media.Transmuxer.isSupported(mimeType, contentType)) { this.transmuxers_[contentType] = new shaka.media.Transmuxer(); mimeType = - shaka.media.Transmuxer.convertTsCodecs(contentType, mimeType); + shaka.media.Transmuxer.convertCodecs(contentType, mimeType); } const type = mimeType + this.config_.sourceBufferExtraFeatures; const sourceBuffer = this.mediaSource_.addSourceBuffer(type); diff --git a/lib/media/streaming_engine.js b/lib/media/streaming_engine.js index c74e2920c3..7aa07806a3 100644 --- a/lib/media/streaming_engine.js +++ b/lib/media/streaming_engine.js @@ -784,9 +784,9 @@ shaka.media.StreamingEngine = class { // Init MediaSourceEngine. const mediaSourceEngine = this.playerInterface_.mediaSourceEngine; - const forceTransmuxTS = this.config_.forceTransmuxTS; + const forceTransmux = this.config_.forceTransmux; - await mediaSourceEngine.init(streamsByType, forceTransmuxTS, + await mediaSourceEngine.init(streamsByType, forceTransmux, this.manifest_.sequenceMode); this.destroyer_.ensureNotDestroyed(); diff --git a/lib/media/transmuxer.js b/lib/media/transmuxer.js index b1f144112c..c2575106a4 100644 --- a/lib/media/transmuxer.js +++ b/lib/media/transmuxer.js @@ -18,7 +18,7 @@ goog.require('shaka.dependencies'); /** * Transmuxer provides all operations for transmuxing from Transport - * Stream to MP4. + * Stream or AAC to MP4. * * @implements {shaka.util.IDestroyable} */ @@ -61,7 +61,8 @@ shaka.media.Transmuxer = class { /** - * Check if the content type is Transport Stream, and if muxjs is loaded. + * Check if the content type is Transport Stream or AAC, and if muxjs is + * loaded. * @param {string} mimeType * @param {string=} contentType * @return {boolean} @@ -69,24 +70,41 @@ shaka.media.Transmuxer = class { static isSupported(mimeType, contentType) { const Transmuxer = shaka.media.Transmuxer; - if (!shaka.dependencies.muxjs() || !Transmuxer.isTsContainer(mimeType)) { + const isTs = Transmuxer.isTsContainer(mimeType); + const isAac = Transmuxer.isAacContainer(mimeType); + + if (!shaka.dependencies.muxjs() || (!isTs && !isAac)) { return false; } + if (isAac) { + return MediaSource.isTypeSupported(Transmuxer.convertAacCodecs_()); + } + if (contentType) { return MediaSource.isTypeSupported( - Transmuxer.convertTsCodecs(contentType, mimeType)); + Transmuxer.convertTsCodecs_(contentType, mimeType)); } const ContentType = shaka.util.ManifestParserUtils.ContentType; - const audioMime = Transmuxer.convertTsCodecs(ContentType.AUDIO, mimeType); - const videoMime = Transmuxer.convertTsCodecs(ContentType.VIDEO, mimeType); + const audioMime = Transmuxer.convertTsCodecs_(ContentType.AUDIO, mimeType); + const videoMime = Transmuxer.convertTsCodecs_(ContentType.VIDEO, mimeType); return MediaSource.isTypeSupported(audioMime) || MediaSource.isTypeSupported(videoMime); } + /** + * Check if the mimetype is 'audio/aac'. + * @param {string} mimeType + * @return {boolean} + */ + static isAacContainer(mimeType) { + return mimeType.toLowerCase().split(';')[0] == 'audio/aac'; + } + + /** * Check if the mimetype contains 'mp2t'. * @param {string} mimeType @@ -97,13 +115,41 @@ shaka.media.Transmuxer = class { } + /** + * For any stream, convert its codecs to MP4 codecs. + * @param {string} contentType + * @param {string} mimeType + * @return {string} + */ + static convertCodecs(contentType, mimeType) { + const Transmuxer = shaka.media.Transmuxer; + if (Transmuxer.isAacContainer(mimeType)) { + return Transmuxer.convertAacCodecs_(); + } else if (Transmuxer.isTsContainer(mimeType)) { + return Transmuxer.convertTsCodecs_(contentType, mimeType); + } + return mimeType; + } + + + /** + * For aac stream, convert its codecs to MP4 codecs. + * @return {string} + * @private + */ + static convertAacCodecs_() { + return 'audio/mp4; codecs="mp4a.40.2"'; + } + + /** * For transport stream, convert its codecs to MP4 codecs. * @param {string} contentType * @param {string} tsMimeType * @return {string} + * @private */ - static convertTsCodecs(contentType, tsMimeType) { + static convertTsCodecs_(contentType, tsMimeType) { const ContentType = shaka.util.ManifestParserUtils.ContentType; let mp4MimeType = tsMimeType.replace(/mp2t/i, 'mp4'); if (contentType == ContentType.AUDIO) { diff --git a/lib/player.js b/lib/player.js index 4200881dd8..bd816f22ae 100644 --- a/lib/player.js +++ b/lib/player.js @@ -799,7 +799,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget { const edge = shaka.util.Platform.isEdge() || shaka.util.Platform.isLegacyEdge(); if (edge) { - if (!config.streaming.forceTransmuxTS) { + if (!config.streaming.forceTransmux) { // If forceTransmux is disabled for Microsoft Edge, LCEVC data // is stripped out in case of a MPEG-2 TS container. // Hence the warning for Microsoft Edge when playing content with @@ -3162,6 +3162,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget { goog.asserts.assert(typeof(config) == 'object', 'Should be an object!'); + // Deprecate 'streaming.forceTransmuxTS' configuration. + if (config['streaming'] && 'forceTransmuxTS' in config['streaming']) { + shaka.Deprecate.deprecateFeature(5, + 'streaming.forceTransmuxTS configuration', + 'Please Use streaming.forceTransmux instead.'); + config['streaming']['forceTransmux'] = + config['streaming']['forceTransmuxTS']; + delete config['streaming']['forceTransmuxTS']; + } + // If lowLatencyMode is enabled, and inaccurateManifestTolerance and // rebufferingGoal are not specified, set inaccurateManifestTolerance to 0 // and rebufferingGoal to 0.01 by default for low latency streaming. diff --git a/lib/util/mime_utils.js b/lib/util/mime_utils.js index ae802ba1b7..e5e2a93bd9 100644 --- a/lib/util/mime_utils.js +++ b/lib/util/mime_utils.js @@ -46,10 +46,12 @@ shaka.util.MimeUtils = class { static getFullOrConvertedType(mimeType, codecs, contentType) { const fullMimeType = shaka.util.MimeUtils.getFullType(mimeType, codecs); const ContentType = shaka.util.ManifestParserUtils.ContentType; + const Transmuxer = shaka.media.Transmuxer; - if (shaka.media.Transmuxer.isTsContainer(fullMimeType)) { + if (Transmuxer.isTsContainer(fullMimeType) || + Transmuxer.isAacContainer(fullMimeType)) { if (shaka.dependencies.muxjs()) { - return shaka.media.Transmuxer.convertTsCodecs( + return shaka.media.Transmuxer.convertCodecs( contentType, fullMimeType); } } else if (contentType == ContentType.AUDIO) { diff --git a/lib/util/player_configuration.js b/lib/util/player_configuration.js index a78fa5b135..2cfc433b17 100644 --- a/lib/util/player_configuration.js +++ b/lib/util/player_configuration.js @@ -157,7 +157,7 @@ shaka.util.PlayerConfiguration = class { startAtSegmentBoundary: false, gapDetectionThreshold: 0.5, durationBackoff: 1, - forceTransmuxTS: false, + forceTransmux: false, // Offset by 5 seconds since Chromecast takes a few seconds to start // playing after a seek, even when buffered. safeSeekOffset: 5, diff --git a/test/media/media_source_engine_integration.js b/test/media/media_source_engine_integration.js index fa893c38e0..ce1fa8128e 100644 --- a/test/media/media_source_engine_integration.js +++ b/test/media/media_source_engine_integration.js @@ -379,9 +379,9 @@ describe('MediaSourceEngine', () => { const initObject = new Map(); initObject.set(ContentType.VIDEO, getFakeStream(metadata.video)); initObject.set(ContentType.TEXT, getFakeStream(metadata.text)); - // Call with forceTransmuxTS = true, so that it will transmux even on + // Call with forceTransmux = true, so that it will transmux even on // platforms with native TS support. - await mediaSourceEngine.init(initObject, /* forceTransmuxTS= */ true); + await mediaSourceEngine.init(initObject, /* forceTransmux= */ true); mediaSourceEngine.setSelectedClosedCaptionId('CC1'); await append(ContentType.VIDEO, 0); @@ -397,7 +397,7 @@ describe('MediaSourceEngine', () => { initObject.set(videoType, getFakeStream(metadata.video)); await mediaSourceEngine.init( - initObject, /* forceTransmuxTS= */ false, /* sequenceMode= */ true); + initObject, /* forceTransmux= */ false, /* sequenceMode= */ true); await mediaSourceEngine.setDuration(presentationDuration); await mediaSourceEngine.setStreamProperties( videoType, @@ -432,7 +432,7 @@ describe('MediaSourceEngine', () => { const initObject = new Map(); initObject.set(ContentType.VIDEO, getFakeStream(metadata.video)); - await mediaSourceEngine.init(initObject, /* forceTransmuxTS= */ false); + await mediaSourceEngine.init(initObject, /* forceTransmux= */ false); await mediaSourceEngine.setDuration(presentationDuration); await appendInitWithClosedCaptions(ContentType.VIDEO); mediaSourceEngine.setSelectedClosedCaptionId('CC1'); @@ -448,7 +448,7 @@ describe('MediaSourceEngine', () => { const audioType = ContentType.AUDIO; const initObject = new Map(); initObject.set(audioType, getFakeStream(metadata.audio)); - await mediaSourceEngine.init(initObject, /* forceTransmuxTS= */ false); + await mediaSourceEngine.init(initObject, /* forceTransmux= */ false); await append(ContentType.AUDIO, 0); expect(onMetadata).toHaveBeenCalled(); @@ -464,7 +464,7 @@ describe('MediaSourceEngine', () => { const audioType = ContentType.AUDIO; const initObject = new Map(); initObject.set(audioType, getFakeStream(metadata.audio)); - await mediaSourceEngine.init(initObject, /* forceTransmuxTS= */ false); + await mediaSourceEngine.init(initObject, /* forceTransmux= */ false); await append(ContentType.AUDIO, 0); expect(onMetadata).toHaveBeenCalled(); diff --git a/test/media/media_source_engine_unit.js b/test/media/media_source_engine_unit.js index 485016fda6..75cf20790d 100644 --- a/test/media/media_source_engine_unit.js +++ b/test/media/media_source_engine_unit.js @@ -106,10 +106,12 @@ describe('MediaSourceEngine', () => { shaka.media.Transmuxer = /** @type {?} */ (function() { return /** @type {?} */ (mockTransmuxer); }); - shaka.media.Transmuxer.convertTsCodecs = originalTransmuxer.convertTsCodecs; + shaka.media.Transmuxer.convertCodecs = originalTransmuxer.convertCodecs; shaka.media.Transmuxer.isSupported = (mimeType, contentType) => { return mimeType == 'tsMimetype'; }; + shaka.media.Transmuxer.isAacContainer = originalTransmuxer.isAacContainer; + shaka.media.Transmuxer.isTsContainer = originalTransmuxer.isTsContainer; shaka.text.TextEngine = createMockTextEngineCtor(); @@ -633,7 +635,7 @@ describe('MediaSourceEngine', () => { videoSourceBuffer.mode = 'sequence'; await mediaSourceEngine.init( - initObject, /* forceTransmuxTS= */ false, /* sequenceMode= */ true); + initObject, /* forceTransmux= */ false, /* sequenceMode= */ true); expect(videoSourceBuffer.timestampOffset).toBe(0); @@ -659,7 +661,7 @@ describe('MediaSourceEngine', () => { initObject.set(ContentType.VIDEO, fakeVideoStream); await mediaSourceEngine.init( - initObject, /* forceTransmuxTS= */ false, /* sequenceMode= */ true); + initObject, /* forceTransmux= */ false, /* sequenceMode= */ true); // First, mock the scenario where timestampOffset is set to help align // text segments. In this case, SourceBuffer mode is still 'segments'. diff --git a/test/media/streaming_engine_unit.js b/test/media/streaming_engine_unit.js index 83d0456495..49c22746a7 100644 --- a/test/media/streaming_engine_unit.js +++ b/test/media/streaming_engine_unit.js @@ -521,7 +521,7 @@ describe('StreamingEngine', () => { expectedMseInit.set(ContentType.TEXT, textStream); expect(mediaSourceEngine.init).toHaveBeenCalledWith(expectedMseInit, - /** forceTransmuxTS= */ false, /** sequenceMode= */ false); + /** forceTransmux= */ false, /** sequenceMode= */ false); expect(mediaSourceEngine.init).toHaveBeenCalledTimes(1); expect(mediaSourceEngine.setDuration).toHaveBeenCalledTimes(1); diff --git a/test/media/transmuxer_integration.js b/test/media/transmuxer_integration.js index d229ec83c5..843e58bbbc 100644 --- a/test/media/transmuxer_integration.js +++ b/test/media/transmuxer_integration.js @@ -12,6 +12,7 @@ describe('Transmuxer', () => { const mp4MimeType = 'video/mp4; codecs="avc1.42E01E"'; const transportStreamVideoMimeType = 'video/mp2t; codecs="avc1.42E01E"'; const transportStreamAudioMimeType = 'video/mp2t; codecs="mp4a.40.2"'; + const aacAudioMimeType = 'audio/aac'; /** @type {!ArrayBuffer} */ let videoSegment; @@ -59,37 +60,41 @@ describe('Transmuxer', () => { }); }); - describe('convertTsCodecs', () => { - const convertTsCodecs = - (type, codecs) => shaka.media.Transmuxer.convertTsCodecs(type, codecs); + describe('convertCodecs', () => { + const convertCodecs = + (type, codecs) => shaka.media.Transmuxer.convertCodecs(type, codecs); it('returns converted codecs', () => { const convertedVideoCodecs = - convertTsCodecs(ContentType.VIDEO, transportStreamVideoMimeType); + convertCodecs(ContentType.VIDEO, transportStreamVideoMimeType); const convertedAudioCodecs = - convertTsCodecs(ContentType.AUDIO, transportStreamAudioMimeType); + convertCodecs(ContentType.AUDIO, transportStreamAudioMimeType); + const convertedAacCodecs = + convertCodecs(ContentType.AUDIO, aacAudioMimeType); const expectedVideoCodecs = 'video/mp4; codecs="avc1.42E01E"'; const expectedAudioCodecs = 'audio/mp4; codecs="mp4a.40.2"'; + const expectedAacCodecs = 'audio/mp4; codecs="mp4a.40.2"'; expect(convertedVideoCodecs).toBe(expectedVideoCodecs); expect(convertedAudioCodecs).toBe(expectedAudioCodecs); + expect(convertedAacCodecs).toBe(expectedAacCodecs); }); it('converts legacy avc1 codec strings', () => { expect( - convertTsCodecs( + convertCodecs( ContentType.VIDEO, 'video/mp2t; codecs="avc1.100.42"')) .toBe('video/mp4; codecs="avc1.64002a"'); expect( - convertTsCodecs(ContentType.VIDEO, 'video/mp2t; codecs="avc1.77.80"')) + convertCodecs(ContentType.VIDEO, 'video/mp2t; codecs="avc1.77.80"')) .toBe('video/mp4; codecs="avc1.4d0050"'); expect( - convertTsCodecs(ContentType.VIDEO, 'video/mp2t; codecs="avc1.66.1"')) + convertCodecs(ContentType.VIDEO, 'video/mp2t; codecs="avc1.66.1"')) .toBe('video/mp4; codecs="avc1.420001"'); }); // Issue #1991 it('handles upper-case MIME types', () => { - expect(convertTsCodecs( + expect(convertCodecs( ContentType.VIDEO, 'video/MP2T; codecs="avc1.420001"')) .toBe('video/mp4; codecs="avc1.420001"'); }); diff --git a/test/player_unit.js b/test/player_unit.js index ba48ff5f5a..8a56b21ec3 100644 --- a/test/player_unit.js +++ b/test/player_unit.js @@ -629,13 +629,13 @@ describe('Player', () => { // Try a bogus streaming config (number instead of Object) logErrorSpy.calls.reset(); player.configure({ - streaming: 5, + drm: 5, }); newConfig = player.getConfiguration(); expect(newConfig).toEqual(defaultConfig); expect(logErrorSpy).toHaveBeenCalledWith( - stringContaining('.streaming')); + stringContaining('.drm')); }); it('accepts synchronous function values for async function fields', () => {