Skip to content

[Issue]: 300ms audio latency on Fire Cube 3rd gen that disappears with Google OBOE implementation #1238

@WTassoux

Description

@WTassoux

Describe the bug

Hello,

I have tried to run Moonlight on a Fire Cube 3rd generation but noticed that no matter the settings used, I have a latency of around 300ms between the video and the audio (the audio being later than the video, which has no visible latency).

Looking at the statistics, the average decoding time is 12-13ms in HEVC which is consistent with the fact that the video itself has no issue. The Fire Cube is connected through Ethernet so my network latency stays at 1ms (but I have tried Wifi as well). Also, the same stream works perfectly fine on my phone, implying that the issue comes from the Fire Cube.

Checking the logcat, I have found the following lines when Moonlight creates the track in AndroidAudioRenderer::setup:

createTrack_l(): mismatch between requested flags (00000004) and output flags (00000002)
AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 480 -> 6152

After meddling with the AudioTrack options (attempting to change the Mode, increasing the buffer size or reducing it, etc ...), I decided to write a simple Audio Renderer using Google OBOE, as it seems the de-facto standard to play low-latency audio on Android devices.

Using this implementation, the audio latency completely disappears ! (or at least, is not noticeable anymore, I'll have to measure it properly). Which is a good news to me because it means the Fire Cube 3rd gen is capable of playing low-latency audio.

So now I am wondering whether it is possible to reproduce those results without Google OBOE, but my knowledge about Android development (or audio) is quite limited.

Is there something I missed that could allow low latency audio to play on the Fire Cube 3rd ? Should I continue with the OBOE implementation and make a pull-request ?

Thanks & regards

Steps to reproduce

Run Moonlight on a Fire Cube 3rd generation. The settings don't seem to matter, as I've tried every option possible on both Moonlight and the Fire Cube itself.

Affected games

All.

Other Moonlight clients

PC

Moonlight adjusted settings

No

Moonlight adjusted settings (please complete the following information)

N/A (doesn't matter)

Moonlight default settings

Yes

Gamepad-related connection issue

No

Gamepad-related input issue

No

Gamepad-related streaming issue

No

Android version

Android 9.x (FireOS 7.x)

Device model

Fire Cube 3rd gen

Server PC OS version

Windows 11 22H2

Server PC GeForce Experience version

Sunshine 0.20

Server PC Nvidia GPU driver version

535.98

Server PC antivirus and firewall software

Windows default AV/firewall

Screenshots

No response

Relevant log output

createTrack_l(): mismatch between requested flags (00000004) and output flags (00000002)
AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 480 -> 6152

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions