Does VIM4 Support Low Latency Audio Mode?

Hi Team,

I want to understand is low latency mode supported in VIM4? If yes how we can we enable it??

Ref: - 音频延迟  |  Android NDK  |  Android Developers

These two feature flags
android.hardware.audio.low_latency and android.hardware.audio.pro

@rohan_nathi

android Low-latency

android P & Q

  1. use configure interface in the MediaCodec.java
    MediaCodec codec = MediaCodec.createByCodecName(name);
    MediaFormat format = new MediaFormat;

    format.setFeatureEnabled(“vendor.low-latency.enable”, 1);

    codec.configure(format, …);

  2. use setParameters interface in the MediaCodec.java
    Bundle bundle = new Bundle();

    bundle.putInt(“vendor.low-latency.enable”, 1);

    MediaCodec codec = MediaCodec.createByCodecName(name);
    setParameters(bundle);

Android R


MediaFormat format = null;

format.setFeatureEnabled(MediaCodecInfo.CodecCapabilities.FEATURE_LowLatency, true /* enable */);

MediaCodecList mcl = new MediaCodecList(MediaCodecList.ALL_CODECS);
String decoderName = mcl.findDecoderForFormat(format);

MediaCodecWrapper decoder = null;
if (useNdk) {
decoder = new NdkMediaCodec(decoderName);
} else {
decoder = new SdkMediaCodec(MediaCodec.createByCodecName(decoderName));
}

format.removeFeature(MediaCodecInfo.CodecCapabilities.FEATURE_LowLatency);

format.setInteger(MediaFormat.KEY_LOW_LATENCY, 1);

decoder.configure(format, 0 /* flags */, surface);