mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 03:23:07 +00:00
Blacklist the whole device from HEVC decoding if Qualcomm's HEVC hybrid decoder is found
This commit is contained in:
parent
0e21d5e166
commit
3c2dd88fd3
@ -29,6 +29,7 @@ public class MediaCodecHelper {
|
|||||||
private static final List<String> directSubmitPrefixes;
|
private static final List<String> directSubmitPrefixes;
|
||||||
private static final List<String> constrainedHighProfilePrefixes;
|
private static final List<String> constrainedHighProfilePrefixes;
|
||||||
private static final List<String> whitelistedHevcDecoders;
|
private static final List<String> whitelistedHevcDecoders;
|
||||||
|
private static final List<String> hevcDeviceBlacklistingDecoderPrefixes;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
directSubmitPrefixes = new LinkedList<String>();
|
directSubmitPrefixes = new LinkedList<String>();
|
||||||
@ -44,6 +45,18 @@ public class MediaCodecHelper {
|
|||||||
directSubmitPrefixes.add("omx.arc");
|
directSubmitPrefixes.add("omx.arc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
// If we find these decoders present at all, we don't enable HEVC
|
||||||
|
hevcDeviceBlacklistingDecoderPrefixes = new LinkedList<>();
|
||||||
|
|
||||||
|
// This decoder appears on some Qualcomm devices prior to Snapdragon 805. It appears
|
||||||
|
// to be so broken that it crashes some devices or at best shows no video. On these devices
|
||||||
|
// Qualcomm thought they'd be clever and also expose omx.qcom.video.decoder.hevc (same as
|
||||||
|
// real hw acceleration SoCs like 805). As a result, we need to blacklist HEVC for ALL codecs
|
||||||
|
// if we see this codec in the list.
|
||||||
|
hevcDeviceBlacklistingDecoderPrefixes.add("omx.qcom.video.decoder.hevchybrid");
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
preferredDecoders = new LinkedList<String>();
|
preferredDecoders = new LinkedList<String>();
|
||||||
}
|
}
|
||||||
@ -163,6 +176,11 @@ public class MediaCodecHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for indications that this device has a broken HEVC codec
|
||||||
|
if (deviceIsHevcBlacklisted()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return isDecoderInList(whitelistedHevcDecoders, decoderName);
|
return isDecoderInList(whitelistedHevcDecoders, decoderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +247,18 @@ public class MediaCodecHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean deviceIsHevcBlacklisted() {
|
||||||
|
for (MediaCodecInfo codecInfo : getMediaCodecList()) {
|
||||||
|
// Check for device-blacklisting codecs
|
||||||
|
if (isDecoderInList(hevcDeviceBlacklistingDecoderPrefixes, codecInfo.getName())) {
|
||||||
|
LimeLog.info("Decoder blacklists HEVC on entire device! "+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()) {
|
||||||
// Skip encoders
|
// Skip encoders
|
||||||
|
Loading…
x
Reference in New Issue
Block a user