This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
ALL-3936/Intel hack #52
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
065377b
Use custom codec selector in ExoPlayerCreator.
6a8d668
Use correct secure decoder value.
4748c1d
Extract static class in order to test codec selector logic.
65008cf
Invert logic for readbility in the code selector.
9604237
Rename constant for downgrading in PlayerFactory.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
core/src/main/java/com/novoda/noplayer/exoplayer/CodecSelector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.novoda.noplayer.exoplayer; | ||
|
||
import com.google.android.exoplayer2.mediacodec.MediaCodecInfo; | ||
import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; | ||
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil; | ||
|
||
/** | ||
* CodecSelector that allows overriding of the requiresSecureDecoder to allow | ||
* downgrading of security but not upgrading. | ||
*/ | ||
class CodecSelector implements MediaCodecSelector { | ||
|
||
private final InternalMediaCodecUtil internalMediaCodecUtil; | ||
private final boolean overrideSecureDecoder; | ||
|
||
public static CodecSelector newInstance(boolean useSecureCodec) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So... which one is it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We got confused with this |
||
InternalMediaCodecUtil internalMediaCodecUtil = new InternalMediaCodecUtil(); | ||
return new CodecSelector(internalMediaCodecUtil, useSecureCodec); | ||
} | ||
|
||
CodecSelector(InternalMediaCodecUtil internalMediaCodecUtil, boolean overrideSecureDecoder) { | ||
this.internalMediaCodecUtil = internalMediaCodecUtil; | ||
this.overrideSecureDecoder = overrideSecureDecoder; | ||
} | ||
|
||
@Override | ||
public MediaCodecInfo getDecoderInfo(String mimeType, boolean contentRequiresSecureDecoder) | ||
throws MediaCodecUtil.DecoderQueryException { | ||
return internalMediaCodecUtil.getDecoderInfo(mimeType, contentRequiresSecureDecoder && overrideSecureDecoder); | ||
} | ||
|
||
@Override | ||
public MediaCodecInfo getPassthroughDecoderInfo() throws MediaCodecUtil.DecoderQueryException { | ||
return internalMediaCodecUtil.getPassthroughDecoderInfo(); | ||
} | ||
|
||
static class InternalMediaCodecUtil { | ||
|
||
MediaCodecInfo getDecoderInfo(String mimeType, boolean requiresSecureDecoder) throws MediaCodecUtil.DecoderQueryException { | ||
return MediaCodecUtil.getDecoderInfo(mimeType, requiresSecureDecoder); | ||
} | ||
|
||
MediaCodecInfo getPassthroughDecoderInfo() throws MediaCodecUtil.DecoderQueryException { | ||
return MediaCodecUtil.getPassthroughDecoderInfo(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create two factories instead ;)