-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] latency is greater than, 2000ms at times #57
Comments
I find two different things on the code:
For the first, there is a existed feature request #33. I'm not sure whether the network delay is the main reason. You can connect your phone to PC via USB tethering to test it. For the second, I'll open a new feature request #60. |
USB tethering didn't work, but I connected my phone using Ethernet and there is still a noticeable delay |
You can try to set the process priority to test it. |
I remove the all zero check of blank PCM data, which may affect the performance. audio-share/server-core/src/linux/audio_manager_impl.cpp Lines 193 to 196 in b63b07b
You can download the new as-cmd to test it. |
Thanks for building that for me. Unfortunately, I do not notice any difference using renice or the new binary (with renice). |
I read the code of Sunshine again and find it use pulse-audio instead of pipewire. I find a doc which may point out the problem. You can start playing first video. If there has been some sound, then start playing the second video and close first one. If second video has no delay, then the problem is clear. So you can try to use a virtual device https://github.com/mkckr0/audio-share#for-linux or follow the instruction of ArchLinux https://wiki.archlinux.org/title/PipeWire#Noticeable_audio_delay_or_audible_pop/crack_when_starting_playback. |
I'm aware of this issue, this is for a delay when starting playback. The delay I'm experiencing is a synchronicity issue. If the video shows a hammer hitting an anvil, then the strike isn't heard for 1–3 seconds. Maybe high latency is a better way to describe it? The ping time on Wi-Fi is only 14ms I tried the virtual device and playing 2 overlapping videos just for curiosity and there is no noticeable change. |
I compiled a new as-cmd, which can show the stream time info.
Output:
The |
this is no good because as-cmd has 5 proccesses with the same name Also using bluetooth on your android device introduces latency no matter what |
I reniced them all by hand and still no difference. The delay from network, bluetooth, CPU priority is not much of an issue when using sunshine and moonlight (maybe 150-500ms) |
I'm using arch just like you so this doesn't make any sense |
I've tried a different phone and steam deck. I don't know either it may be network but the delay with steam link and sunshine is negligible even with a video stream. |
I've tested both audio-share and sunshine, and the latency of audio-share is at least 500ms higher when compared to Sunshine, no matter which tricks or means of transport are used. All that while Sunshine is also streaming video... |
I've also discovered this https://docs.pipewire.org/page_module_roc_sink.html And guides [quite simple] : https://gavv.net/articles/roc-tutorial-0.2/: |
awesome!!! |
I don't get it but it looks like this roc thing is missing on fedora 40 and 41. we have to compile it from source |
I'm on Gentoo, so I just had to enable it and reinstall. With Pipewire-ROC I like that it's pretty much always passively ready to stream and it's just a one button away to receive. |
I was on gentoo too a while a ago before debian |
Arch seems to have issues too, with packaging. Config for it looks like this:
and the app https://github.com/kaytat/SimpleProtocolPlayer |
I just installed arch linux and got roc running by installing this "pipewire-roc" package. It's on the official repo. |
Uhh I tested it with the youtube test in github link and it always beeps on the first black bar after the white one. |
That's quite weird, because Simple sounds much better for me, absolutely no issues, with defaults, where ROC sorta breaks/glitches when sound is paused/unpaused like it has to catch up. Iy seems that You have almost no latency though, I get the beep at the first black bar on the magenta stripe, which is more than fine for me. |
@airisama019 Changing anything made both sound and latency much worse for me, so try with defaults [and stereo] perhaps? |
Idk dude I just use default ISP router with wifi 5ghz and this moto g5s phone that has headphone jack and lineageos. |
I tried default settings and it was the same result |
Yeah I tried it on Android TV running on Ethernet and It beeps on magenta bar just like yours. |
@airisama019 also, I've just tried Simple while tethered, only with performance mode checked in the app, 48khz/stereo [that's what my system outputs so no conversion], and the beep comes from my phone at the same time as from the speakers. |
nice, that's closer to a solution then. So, for wifi minimal latency, Basically you a android device launched with android 8 or less as per a certain magisk module description. |
I'm using stock, unrooted A13 that came with zenfone 8 though. |
my Android TV comes with A11 so that's no good either |
teach me how to use tethering I haven't tried it yet. |
When you connect your phone via usb , there will be a popup where you can switch it to tethering, your other device, TV or whatever will get a new IP from it which you'll use to connect directly to the phone. I'm not sure where you can check the IP on TV, usually I do it via termux app, |
yeah I got one here 192.168.88.61 |
ok so roc app does know that ip |
yeah it's beeping right on the white bar now |
but tethering kinda beats the point of this I think |
and it's faster than bluetooth |
It all depends on your intended use. I get ya |
@barolo hey if I get an IP then why can't I use the PC's internet on the phone. |
I'm a bit confused by your setup right now, so it's hard for me to say. |
I had to turn wifi off in order for roc app to change the IP so this is kinda of a bummer |
I'm doing tethering on the phone not android tv |
@barolo you're right about simple protocol not crackling on pause video |
lol simple protocol with tethering beeps on the first black bar in the green stripe |
yeah, simple protocol has lower latency on android TV wifi as well. Instead of magenta stripe, it beeps right on the white bar |
|
As evident, there are inbuilt protocols in pipewire [they all come from pulseaudio apparently] which all result in much lower latency. So it might be useful to @mkckr0 |
what I'm trying to say is that what started this issue is different android devices having more latency than others and that is due to hardware differences and there's nothing you can do about that. Whether audio-share can be further improved or not has nothing to do with this. |
@JamesOsborn-SE your problem may be caused by the capture format. Sunshine use |
@JamesOsborn-SE Audio Share can specify the audio format since v0.2.0. You can test it. |
I don't hear/see a difference between |
This may be still a performance problem. But I can do nothing until I find some clues. |
The latency seems to go down with encoding (lower bit lower latency), also the higher the buffer scale, the higher the latency, i was able to match your 2000ms latency with 10x buffer scale and 24bit int |
roc-droid requires a specific pipewire setup and a separate package called pipewire-roc |
Describe the bug
delay is greater than 2000ms at times making it unfit for watching a video or zoom meeting
To Reproduce
Steps to reproduce the behavior:
start server
start client
watch a video on the server
Expected behavior
I expect there to be a delay of 200ms or less
Screenshots
not applicable
Server (please complete the following information):
Android (please complete the following information):
Additional information
you might want to see how it's done in this project since it's multi-platform and has little latency
https://github.com/LizardByte/Sunshine/blob/nightly/src/audio.cpp
The text was updated successfully, but these errors were encountered: