mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-18 10:32:43 +00:00
Use new MediaCodecInfo helper to blacklist software codecs
This commit is contained in:
parent
b7810d6eb6
commit
b461d546d6
@ -474,6 +474,24 @@ public class MediaCodecHelper {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isCodecBlacklisted(MediaCodecInfo codecInfo) {
|
||||||
|
// Use the new isSoftwareOnly() function on Android Q
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
if (codecInfo.isSoftwareOnly()) {
|
||||||
|
LimeLog.info("Skipping software-only decoder: "+codecInfo.getName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for explicitly blacklisted decoders
|
||||||
|
if (isDecoderInList(blacklistedDecoderPrefixes, codecInfo.getName())) {
|
||||||
|
LimeLog.info("Skipping blacklisted decoder: "+codecInfo.getName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static MediaCodecInfo findFirstDecoder(String mimeType) {
|
public static MediaCodecInfo findFirstDecoder(String mimeType) {
|
||||||
for (MediaCodecInfo codecInfo : getMediaCodecList()) {
|
for (MediaCodecInfo codecInfo : getMediaCodecList()) {
|
||||||
@ -482,15 +500,14 @@ public class MediaCodecHelper {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for explicitly blacklisted decoders
|
|
||||||
if (isDecoderInList(blacklistedDecoderPrefixes, codecInfo.getName())) {
|
|
||||||
LimeLog.info("Skipping blacklisted decoder: "+codecInfo.getName());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find a decoder that supports the specified video format
|
// Find a decoder that supports the specified video format
|
||||||
for (String mime : codecInfo.getSupportedTypes()) {
|
for (String mime : codecInfo.getSupportedTypes()) {
|
||||||
if (mime.equalsIgnoreCase(mimeType)) {
|
if (mime.equalsIgnoreCase(mimeType)) {
|
||||||
|
// Skip blacklisted codecs
|
||||||
|
if (isCodecBlacklisted(codecInfo)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
LimeLog.info("First decoder choice is "+codecInfo.getName());
|
LimeLog.info("First decoder choice is "+codecInfo.getName());
|
||||||
return codecInfo;
|
return codecInfo;
|
||||||
}
|
}
|
||||||
@ -530,17 +547,16 @@ public class MediaCodecHelper {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for explicitly blacklisted decoders
|
|
||||||
if (isDecoderInList(blacklistedDecoderPrefixes, codecInfo.getName())) {
|
|
||||||
LimeLog.info("Skipping blacklisted decoder: "+codecInfo.getName());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find a decoder that supports the requested video format
|
// Find a decoder that supports the requested video format
|
||||||
for (String mime : codecInfo.getSupportedTypes()) {
|
for (String mime : codecInfo.getSupportedTypes()) {
|
||||||
if (mime.equalsIgnoreCase(mimeType)) {
|
if (mime.equalsIgnoreCase(mimeType)) {
|
||||||
LimeLog.info("Examining decoder capabilities of "+codecInfo.getName());
|
LimeLog.info("Examining decoder capabilities of "+codecInfo.getName());
|
||||||
|
|
||||||
|
// Skip blacklisted codecs
|
||||||
|
if (isCodecBlacklisted(codecInfo)) {
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
CodecCapabilities caps = codecInfo.getCapabilitiesForType(mime);
|
CodecCapabilities caps = codecInfo.getCapabilitiesForType(mime);
|
||||||
|
|
||||||
if (requiredProfile != -1) {
|
if (requiredProfile != -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user