Skip to content

Commit d1612a5

Browse files
committed
remove secure codecs and use only regular codecs
1 parent 56581b7 commit d1612a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

encoder/src/main/java/com/pedro/encoder/utils/CodecUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static List<String> showAllCodecsInfo() {
189189
public static List<MediaCodecInfo> getAllCodecs(boolean filterBroken) {
190190
List<MediaCodecInfo> mediaCodecInfoList = new ArrayList<>();
191191
if (Build.VERSION.SDK_INT >= 21) {
192-
MediaCodecList mediaCodecList = new MediaCodecList(MediaCodecList.ALL_CODECS);
192+
MediaCodecList mediaCodecList = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
193193
MediaCodecInfo[] mediaCodecInfos = mediaCodecList.getCodecInfos();
194194
mediaCodecInfoList.addAll(Arrays.asList(mediaCodecInfos));
195195
} else {
@@ -459,6 +459,8 @@ private static List<MediaCodecInfo> filterBrokenCodecs(List<MediaCodecInfo> code
459459
private static boolean isValid(String name) {
460460
//This encoder is invalid and produce errors (Only found in AVD API 16)
461461
if (name.equalsIgnoreCase("aacencoder")) return false;
462+
//Discard secure encoders. It is only used for DRM
463+
else if (name.toLowerCase().contains(".secure")) return false;
462464
return true;
463465
}
464466

@@ -475,8 +477,6 @@ private static CodecPriority checkCodecPriority(String name) {
475477
//maybe only broke on samsung with Android 12+ using YouTube and AWS MediaLive
476478
// but set as ultra low priority in all cases.
477479
if (name.equalsIgnoreCase("c2.sec.aac.encoder")) return CodecPriority.ULTRA_LOW;
478-
//not working in few devices but maybe usable in others.
479-
else if (name.toLowerCase().contains(".secure")) return CodecPriority.ULTRA_LOW;
480480
//broke on few devices using YouTube and AWS MediaLive
481481
else if (name.equalsIgnoreCase("omx.google.aac.encoder")) return CodecPriority.LOW;
482482
else return CodecPriority.NORMAL;

0 commit comments

Comments
 (0)