mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-26 14:32:42 +00:00
Add magic performance boost for MediaTek devices
This commit is contained in:
parent
3bfeaefdbd
commit
6f9021a5e6
@ -41,6 +41,7 @@ public class MediaCodecHelper {
|
|||||||
private static final List<String> qualcommDecoderPrefixes;
|
private static final List<String> qualcommDecoderPrefixes;
|
||||||
private static final List<String> kirinDecoderPrefixes;
|
private static final List<String> kirinDecoderPrefixes;
|
||||||
private static final List<String> exynosDecoderPrefixes;
|
private static final List<String> exynosDecoderPrefixes;
|
||||||
|
private static final List<String> mediatekDecoderPrefixes;
|
||||||
|
|
||||||
public static final boolean IS_EMULATOR = Build.HARDWARE.equals("ranchu") || Build.HARDWARE.equals("cheets");
|
public static final boolean IS_EMULATOR = Build.HARDWARE.equals("ranchu") || Build.HARDWARE.equals("cheets");
|
||||||
|
|
||||||
@ -211,6 +212,12 @@ public class MediaCodecHelper {
|
|||||||
exynosDecoderPrefixes.add("omx.exynos");
|
exynosDecoderPrefixes.add("omx.exynos");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
mediatekDecoderPrefixes = new LinkedList<>();
|
||||||
|
|
||||||
|
mediatekDecoderPrefixes.add("omx.mtk");
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isPowerVR(String glRenderer) {
|
private static boolean isPowerVR(String glRenderer) {
|
||||||
return glRenderer.toLowerCase().contains("powervr");
|
return glRenderer.toLowerCase().contains("powervr");
|
||||||
}
|
}
|
||||||
@ -392,6 +399,15 @@ public class MediaCodecHelper {
|
|||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && decoderSupportsAndroidRLowLatency(decoderInfo, mimeType)) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && decoderSupportsAndroidRLowLatency(decoderInfo, mimeType)) {
|
||||||
videoFormat.setInteger(MediaFormat.KEY_LOW_LATENCY, 1);
|
videoFormat.setInteger(MediaFormat.KEY_LOW_LATENCY, 1);
|
||||||
}
|
}
|
||||||
|
else if (isDecoderInList(mediatekDecoderPrefixes, decoderInfo.getName())) {
|
||||||
|
// MediaTek decoders don't use vendor-defined keys for low latency mode. Instead, they have a modified
|
||||||
|
// version of AOSP's ACodec.cpp which supports the "vdec-lowlatency" option. This option is passed down
|
||||||
|
// to the decoder as OMX.MTK.index.param.video.LowLatencyDecode.
|
||||||
|
//
|
||||||
|
// https://github.com/yuan1617/Framwork/blob/master/frameworks/av/media/libstagefright/ACodec.cpp
|
||||||
|
// https://github.com/iykex/vendor_mediatek_proprietary_hardware/blob/master/libomx/video/MtkOmxVdecEx/MtkOmxVdecEx.h
|
||||||
|
videoFormat.setInteger("vdec-lowlatency", 1);
|
||||||
|
}
|
||||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
// MediaCodec supports vendor-defined format keys using the "vendor.<extension name>.<parameter name>" syntax.
|
// MediaCodec supports vendor-defined format keys using the "vendor.<extension name>.<parameter name>" syntax.
|
||||||
// These allow access to functionality that is not exposed through documented MediaFormat.KEY_* values.
|
// These allow access to functionality that is not exposed through documented MediaFormat.KEY_* values.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user