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

feat: Add config to ignore duplicate init data #5853

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ shakaDemo.Config = class {
/* canBeUnset= */ true)
.addBoolInput_('Parse inband "pssh" from media segments',
'drm.parseInbandPsshEnabled')
.addTextInput_('Min HDCP version', 'drm.minHdcpVersion');
.addTextInput_('Min HDCP version', 'drm.minHdcpVersion')
.addBoolInput_('Ignore duplicate init data',
'drm.ignoreDuplicateInitData');
const advanced = shakaDemoMain.getConfiguration().drm.advanced || {};
const addDRMAdvancedField = (name, valueName, suggestions) => {
// All advanced fields of a given type are set at once.
Expand Down
10 changes: 8 additions & 2 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,8 @@ shaka.extern.PersistentSessionMetadata;
* preferredKeySystems: !Array.<string>,
* keySystemsMapping: !Object.<string, string>,
* parseInbandPsshEnabled: boolean,
* minHdcpVersion: string
* minHdcpVersion: string,
* ignoreDuplicateInitData: boolean
* }}
*
* @property {shaka.extern.RetryParameters} retryParameters
Expand Down Expand Up @@ -813,7 +814,12 @@ shaka.extern.PersistentSessionMetadata;
* <i>By default (''), do not check the HDCP version.</i><br>
* Indicates the minimum version of HDCP to start the playback of encrypted
* streams. <b>May be ignored if not supported by the device.</b>
*
* @property {boolean} ignoreDuplicateInitData
* <i>Defaults to false on Tizen 2, and true for all other browsers.</i><br>
* When true indicate that the player doesn't ignore duplicate init data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be "When true indicates that the player does ignore duplicate init data". (Without negation)

* Note: Tizen 2015 and 2016 models will send multiple webkitneedkey events
* with the same init data. If the duplicates are supressed, playback
* will stall without errors.
* @exportDoc
*/
shaka.extern.DrmConfiguration;
Expand Down
5 changes: 1 addition & 4 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,8 @@ shaka.media.DrmEngine = class {

const metadatas = this.activeSessions_.values();
for (const metadata of metadatas) {
// Tizen 2015 and 2016 models will send multiple webkitneedkey events
// with the same init data. If the duplicates are supressed, playback
// will stall without errors.
if (shaka.util.BufferUtils.equal(initData, metadata.initData) &&
!shaka.util.Platform.isTizen2()) {
this.config_.ignoreDuplicateInitData) {
shaka.log.debug('Ignoring duplicate init data.');
return;
}
Expand Down
1 change: 1 addition & 0 deletions lib/util/player_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ shaka.util.PlayerConfiguration = class {
// segments to detect key changes.
parseInbandPsshEnabled: shaka.util.Platform.isXboxOne(),
minHdcpVersion: '',
ignoreDuplicateInitData: !shaka.util.Platform.isTizen2(),
};

const manifest = {
Expand Down
Loading