mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-18 10:32:43 +00:00
Set the vendor.qti-ext-dec-low-latency.enable Qualcomm vendor extension
This commit is contained in:
parent
3011a5bad7
commit
81b6a8a311
@ -319,6 +319,18 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
videoFormat.setInteger(MediaCodecHelper.KEY_LOW_LATENCY, 1);
|
videoFormat.setInteger(MediaCodecHelper.KEY_LOW_LATENCY, 1);
|
||||||
}
|
}
|
||||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
// Set the Qualcomm vendor low latency extension if the Android R option is unavailable
|
||||||
|
if (MediaCodecHelper.decoderSupportsQcomVendorLowLatency(selectedDecoderName)) {
|
||||||
|
// 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.
|
||||||
|
// https://cs.android.com/android/platform/superproject/+/master:hardware/qcom/sdm845/media/mm-video-v4l2/vidc/common/inc/vidc_vendor_extensions.h;l=67
|
||||||
|
//
|
||||||
|
// Examples of Qualcomm's vendor extensions for Snapdragon 845:
|
||||||
|
// https://cs.android.com/android/platform/superproject/+/master:hardware/qcom/sdm845/media/mm-video-v4l2/vidc/vdec/src/omx_vdec_extensions.hpp
|
||||||
|
// https://cs.android.com/android/_/android/platform/hardware/qcom/sm8150/media/+/0621ceb1c1b19564999db8293574a0e12952ff6c
|
||||||
|
videoFormat.setInteger("vendor.qti-ext-dec-low-latency.enable", 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Operate at maximum rate to lower latency as much as possible on
|
// Operate at maximum rate to lower latency as much as possible on
|
||||||
// some Qualcomm platforms. We could also set KEY_PRIORITY to 0 (realtime)
|
// some Qualcomm platforms. We could also set KEY_PRIORITY to 0 (realtime)
|
||||||
// but that will actually result in the decoder crashing if it can't satisfy
|
// but that will actually result in the decoder crashing if it can't satisfy
|
||||||
|
@ -38,6 +38,7 @@ public class MediaCodecHelper {
|
|||||||
private static final List<String> refFrameInvalidationHevcPrefixes;
|
private static final List<String> refFrameInvalidationHevcPrefixes;
|
||||||
private static final List<String> blacklisted49FpsDecoderPrefixes;
|
private static final List<String> blacklisted49FpsDecoderPrefixes;
|
||||||
private static final List<String> blacklisted59FpsDecoderPrefixes;
|
private static final List<String> blacklisted59FpsDecoderPrefixes;
|
||||||
|
private static final List<String> qualcommDecoderPrefixes;
|
||||||
|
|
||||||
// FIXME: Remove when Android R SDK is finalized
|
// FIXME: Remove when Android R SDK is finalized
|
||||||
public static final String FEATURE_LowLatency = "low-latency";
|
public static final String FEATURE_LowLatency = "low-latency";
|
||||||
@ -193,6 +194,13 @@ public class MediaCodecHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
qualcommDecoderPrefixes = new LinkedList<>();
|
||||||
|
|
||||||
|
qualcommDecoderPrefixes.add("omx.qcom");
|
||||||
|
qualcommDecoderPrefixes.add("c2.qti");
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isPowerVR(String glRenderer) {
|
private static boolean isPowerVR(String glRenderer) {
|
||||||
return glRenderer.toLowerCase().contains("powervr");
|
return glRenderer.toLowerCase().contains("powervr");
|
||||||
}
|
}
|
||||||
@ -376,6 +384,13 @@ public class MediaCodecHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean decoderSupportsQcomVendorLowLatency(String decoderName) {
|
||||||
|
// MediaCodec vendor extension support was introduced in Android 8.0:
|
||||||
|
// https://cs.android.com/android/_/android/platform/frameworks/av/+/01c10f8cdcd58d1e7025f426a72e6e75ba5d7fc2
|
||||||
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||||
|
isDecoderInList(qualcommDecoderPrefixes, decoderName);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean decoderNeedsConstrainedHighProfile(String decoderName) {
|
public static boolean decoderNeedsConstrainedHighProfile(String decoderName) {
|
||||||
return isDecoderInList(constrainedHighProfilePrefixes, decoderName);
|
return isDecoderInList(constrainedHighProfilePrefixes, decoderName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user