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

Pssh boxes #24

Merged
merged 6 commits into from
Mar 3, 2016
Merged

Pssh boxes #24

merged 6 commits into from
Mar 3, 2016

Conversation

juliancooper
Copy link
Contributor

  • Added support for including <cenc:pssh> elements within Playready and Widevine ContentProtection schemes

// !!! Note: this function will accept any wvHeader value !!!
func (as *AdaptationSet) AddNewContentProtectionSchemeWidevine(wvHeaders ...[]byte) (*WidevineContentProtection, error) {
if len(wvHeaders) > 1 {
panic("AddNewContentProtectionSchemeWidevine accepts at most 1 wvHeader slice")
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, panic? Why not just return this as error?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, why call the variable wvHeaders if it can only hold 1 byte slice? The comment above even calls it wvHeader. Let's consider using that name or changing the function signature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For backwards compatibility. It makes wvHeaders optional, if more than 1 argument is passed to the function it's more of a syntax error, rather than something that can/should be handled by the applicaiton.

cp.XMLNS = Strptr(CENC_XMLNS)
prSystemID, err := hex.DecodeString(CONTENT_PROTECTION_PLAYREADY_SCHEME_HEX)
if err != nil {
panic(err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

So, I'm okay with this in this situation due to the author's vehement defense of this panic and the peculiarity of this code path.

However, as a general rule of thumb, avoid panics. I probably would not accept this code as is in a future PR without a more compelling special case explanation of why a consumer of this library would want a panic in the critical path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Objection noted.

@brycefisher
Copy link
Contributor

LGTM

juliancooper added a commit that referenced this pull request Mar 3, 2016
@juliancooper juliancooper merged commit d12b37d into master Mar 3, 2016
@brycefisher brycefisher deleted the pssh-boxes branch March 3, 2016 22:49
@juliancooper juliancooper restored the pssh-boxes branch March 3, 2016 23:44
@coveralls
Copy link

Coverage Status

Coverage decreased (-9.6%) to 73.563% when pulling 4bbd135 on pssh-boxes into 2fe5395 on master.

@brycefisher brycefisher deleted the pssh-boxes branch March 4, 2016 23:20
@coveralls
Copy link

Coverage Status

Coverage decreased (-9.6%) to 73.563% when pulling 4bbd135 on pssh-boxes into 2fe5395 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants