moonlight-android icon indicating copy to clipboard operation
moonlight-android copied to clipboard

[Issue]: 30 ms decoding latency on Mediatek Dimensity 9000

Open ktm-91 opened this issue 1 year ago • 53 comments

Describe the bug

On my OnePlus Nord 3 5G (Mediatek Dimensity 9000 high-end SoC) I get around 30 ms of decoding latency with both H.264 and H.265. It's a lot, considering that on my Sony Android TV (also with a Mediatek SoC) I get around 3 ms. I already tried changing resolution, FPS and bitrate but it won't get better latencies.

Steps to reproduce

none

Affected games

any

Other Moonlight clients

PC

Moonlight adjusted settings

Yes

Moonlight adjusted settings (please complete the following information)

tried many combinations of resolution, FPS and bitrate

Moonlight default settings

Yes

Gamepad-related connection issue

Yes

Gamepad-related input issue

Yes

Gamepad-related streaming issue

Yes

Android version

13

Device model

OnePlus Nord 3 5G

Server PC OS version

Windows 10 22H2

Server PC GeForce Experience version

3.27.0.112

Server PC Nvidia GPU driver version

537.13

Server PC antivirus and firewall software

Windows Defender

Screenshots

Screenshot_2023-08-24-11-57-49-31_0ff5f4589442642967c97622a25eb61e

Relevant log output

No response

Additional context

No response

ktm-91 avatar Aug 24 '23 10:08 ktm-91

I'd like to get some codec information to see if there's a way to reduce the latency.

  1. Please install https://play.google.com/store/apps/details?id=com.parseus.codecinfo
  2. Open Codec Info app and navigate to the Video tab
  3. Find "c2.mtk.hevc.decoder" in the list and take screenshots of the properties page for that codec
  4. Find "c2.mtk.avc.decoder" in the list and take screenshots of the properties page for that codec
  5. Attach the screenshots here.

cgutman avatar Aug 24 '23 23:08 cgutman

Sure, here they are:

AVC HEVC

ktm-91 avatar Aug 25 '23 17:08 ktm-91

hey, i have same issue with my oneplus pad, when i use wifi im between 25-35ms but when i plug rj45 im between 13-20ms Screenshot_2023-08-25-23-32-33-82_0ff5f4589442642967c97622a25eb61e Screenshot_2023-08-25-23-31-25-14_0ff5f4589442642967c97622a25eb61e

dels95 avatar Aug 25 '23 21:08 dels95

The only MediaFormat option I see that Steam Link sets and we don't is KEY_PRIORITY. I never saw any advantage for setting it on any of my non-MediaTek devices, but maybe it helps for your MediaTek devices.

Here is a test build you can try: https://drive.google.com/file/d/1BjsjTvQ-UZEznufincc2FTfph7FUQIQx/view?usp=sharing

cgutman avatar Aug 27 '23 20:08 cgutman

Unfortunately it doesn't get better. FYI I also tried Steam Link and I get the same 30 ms decoding delay. I can't believe that such a high end SoC can't do better than this :(

ktm-91 avatar Aug 28 '23 07:08 ktm-91

Noob question: would it be possible to use the OMX.MTK.VIDEO.DECODER.HEVC decoder instead, as my TV does? Apparently it has way better latency performance

ktm-91 avatar Aug 30 '23 18:08 ktm-91

Here is a test build you can try: https://drive.google.com/file/d/1BjsjTvQ-UZEznufincc2FTfph7FUQIQx/view?usp=sharing

Didn't work on my Infinix Note 12 2023 with Mediatek G99. Is it possible to see how this is implemented in Parces? There's a decoding delay of about 6-8ms on my device.

svishchev avatar Sep 03 '23 07:09 svishchev

@svishchev if you can collect adb logcat logs of Parsec and Moonlight streaming on your device, I could take a look at them and see if anything looks different between the two logs.

cgutman avatar Sep 03 '23 18:09 cgutman

I have the same issue as well with my phone xiaomi 11T non pro version using Dimensity 1200. Getting the same decoding latency of 15-20ms as well on Moonlight. If i use Parsec the decoding latency is much faster at around 5ms.

AceZero925 avatar Oct 05 '23 11:10 AceZero925

@cgutman

This is my logcat file by using Parsec v3.150.085.00 and Moonlight v11.0 on Android 13 with my Xiaomi 11T running mediatek dimensity 1200 Hope it helps.

Logcat.zip

AceZero925 avatar Oct 05 '23 17:10 AceZero925

Thanks, here's another build to try: https://drive.google.com/file/d/1f7YJpgtchqRuYwdhN2fFkwPeUiZaQlGM/view?usp=sharing

I tweaked a few things to be closer to what Parsec does.

Since Sunshine is variable frame rate, please also try moving the mouse around to get 60 FPS from the host and see if latency goes down.

cgutman avatar Oct 06 '23 02:10 cgutman

@cgutman Just tried with no luck at all, the result are still the same with both H.254 and HEVC. one more things i notice is that i can't choose AV1 as decoder it says AV1 decoder not found but my soc supports it. HVEC H 264

AceZero925 avatar Oct 06 '23 11:10 AceZero925

I am inface having the same issue with my oneplus pad. around 30ms decode time no matter what option i choose.

joemossjr16 avatar Oct 23 '23 15:10 joemossjr16

Same with my Firestick 4K Max, anything between 20-30ms decoding latency regardless of bitrate, resolution, fps etc.

Getting 0-1ms on my Rog Ally so I know it's not anything Sunshine related.

ZachShaw avatar Oct 24 '23 19:10 ZachShaw

My Redmi Pad (MediaTek G99) also encountered the same problem, the decoding latency fluctuated between 20ms-40ms, regardless of using HEVC or H.264.

bsdayo avatar Nov 05 '23 15:11 bsdayo

@ZachShaw Are you using the new 2023 Firestick 4K max? or the older one from 2021?

On my older 2021 Firestick 4k max, things work perfectly, 4-5ms decode time for HEVC.

Also for reference, the older stick is running fire os 7 (android 9), the newer one is fire os 8 (android 11).

The older one uses: OMX.MTK.VIDEO.DECODER.HEVC

It appears the new one uses: C2.MTK.HEVC.DECODER

I see in the logcat of the dimensity: "no c2 equivalents for vdec-lowlatency"

So might be that the 'magic' mediatek specific 'vdec-lowlatency' flag can no longer be used with the C2 decoder.

Android 11 introduced a 'standard' approach to signaling low latency video: MediaCodecInfo.CodecCapabilities.FEATURE_LowLatency

Perhaps mediatek or amazon in the case of the fire stick 4k max 2023, didn't implement the new feature, so now were stuck on these newer android versions until they fix the driver? Or maybe we can find another way to use the older OMX.MTK decoder on the newer android OS so we can continue to pass the old magic flag: vdec-lowlatency.

https://source.android.com/docs/core/media/low-latency-media

peacepenguin avatar Nov 15 '23 21:11 peacepenguin

This shouldn't be happening, but I found out that wifi 6 goes around the issue, in my case at least.

With my wifi 5 router and 360mbps ftth, my Mi Mix 2 from 2017 with Snapdragon 835 was smooth sailing, while my current Xiaomi 13T with Dimensity 8200 Ultra was having connection issues.

I went to my gf's house with a 50mbps vdsl connection and lo and behold, no issues. The difference? Her router is wifi 6.

After that I bought a wifi 6 mesh system and even though the decoding latency is higher than the Snapdragon, I get no connection issues and it's super smooth.

NoiSy-MaN avatar Nov 20 '23 00:11 NoiSy-MaN

FYI, My Xiao Mi 11T non pro has AV1 decoder functions but on the newest version of moonlight 12.0.2 it shows that there are no AV1 decoder.

AceZero925 avatar Nov 22 '23 07:11 AceZero925

So there is no solution yet? Just bought a cheap tablet that use Mediatek chip and want to use it strictly for streaming. And now I am doubting my life choice lul.

donlonW avatar Nov 28 '23 00:11 donlonW

My Redmi Pad (MediaTek G99) also encountered the same problem, the decoding latency fluctuated between 20ms-40ms, regardless of using HEVC or H.264.

I'm considering buying a newly released Samsung Tab A9 (G99) for Moonlight but @bsdayo comments makes me hesitate.

tristan-k avatar Dec 11 '23 12:12 tristan-k

@tristan-k For 8inch-ish tablet, just go for a Lenvo Y700 (S870/ 8+1) instead ig. And here is an unlucky Galaxy Tab A9 user lul. I should do more research before pulling the trigger.

donlonW avatar Dec 11 '23 13:12 donlonW

@donlonW For some reason the Lenvo Y700 isn't available in Germany and it's much more expensive. So my everlasting quest for a 8-9 Inch Tablet for moonlight streaming continues :(

tristan-k avatar Dec 11 '23 20:12 tristan-k

@tristan-k It still work OK in third-person game with the 20-30ms decoding latency if you have low internet latency(stably under 10ms). But can't really play any serious 2D platformer until this issue is solved.

The folks on Github are discussing and trying to solve the issue. https://github.com/moonlight-stream/moonlight-android/issues/1276

donlonW avatar Dec 11 '23 20:12 donlonW

Also experiencing high decode latency on mediatek D1200 (AYANEO Pocket Air/Android 12), around 20ms (h264, h265, and AV1 are all similar results). Happy to help test or provide any data related.

bassderek avatar Dec 13 '23 16:12 bassderek

@bassderek can you run parsec from and to the same devices and see what parsec reports for decode latency? with HEVC particularly?

peacepenguin avatar Dec 17 '23 18:12 peacepenguin

@peacepenguin I unfortunately don’t have access to the device anymore, but when I tested with parsec it was about 5ms. Overall worse stream quality than moonlight though other than latency being better.

bassderek avatar Dec 17 '23 23:12 bassderek

Just got a Helio G99 Android 13 tablet - I believe as per previous posters have also reported, I get approx 25ms decoding time shown in Moonlight for both H265 and H264. Parsec reports between 2 and 3ms. It's the C2.MTK.HEVC.DECODER (or C2.MTK.AVC.DECODER) in use on Moonlight.

Happy to try and help with any further information where I can.

auron2k avatar Jan 19 '24 20:01 auron2k

I have the same issue on my Iplay 50 mini pro, running the mediatek helios G99 cpu - around 35ms average decoding time, with much much less when using Parsec. Can also provide information or tests if you want.

Chrysostom83 avatar Feb 07 '24 13:02 Chrysostom83

Same problem with mtk d1100. Hoping it will be fixed soon.

ffffyyc avatar Feb 20 '24 14:02 ffffyyc

I have the same problem with MediaTek Kampanio 1300T in my Lenovo Tab P11 pro gen 2. Looks like it is also using the c2.mtk.hevc.decoder.

These are the latency times I tend to get:

1080p60fps - 16-20ms average decode time 1440p60fps - 30-32ms average decode time

I tested out 1080p60fps on Parsec on this device, and I was seeing around ~5ms on both AVC and HEVC decoders.

timharry avatar Mar 16 '24 13:03 timharry