-
Notifications
You must be signed in to change notification settings - Fork 446
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
Stutter with multiple snapclient instances and pulse-remap/alsa #722
Comments
Can you test with another player, e.g. aplay -D pulse-kueche? |
Sorry, should have mentioned it in the first post: mpg123 plays fine to pulse-kueche. aplay -D pulse-kueche test.wav I also used tried: |
Looks like this virtual pulse sink device is not able to reliably report the available (to-be-filled-)buffer size and delay (when will the to-be-filled-buffer be audible). This low level information is necessary for sync playback. It would work to just "write" into the buffer in a loop, this is what actually happens with the static void stream_request_cb(pa_stream *s, size_t length, void *userdata) {
pa_usec_t usec;
int neg;
pa_stream_get_latency(s,&usec,&neg);
printf(" latency %8d us\n",(int)usec);
if (sampleoffs*2 + length > sizeof(sampledata)) {
sampleoffs = 0;
}
if (length > sizeof(sampledata)) {
length = sizeof(sampledata);
}
pa_stream_write(s, &sampledata[sampleoffs], length, NULL, 0LL, PA_SEEK_RELATIVE);
sampleoffs += length/2;
} |
I didn't manage to get the example to compile on my ubuntu box. But I did manage to switch to alsa and get rid of the abomination that is pulseaudio. |
Maybe I will add a pulse player backend as a prototype tonight or tomorrow, now I'm curious if and how good it would work. |
If I can aid in testing let me know. As for me the bug can be closed or changed to enhancement "add native pulse backend" |
As i also have stutter from time to time and i use pulse also, i would like to test a pulseaudio backend also :) |
I've added an initial support for PulseAudio in develop branch: d9e0b77 |
@NDahlem @rcmcronny have you already had the chance to test the |
@badaix ahh sorry, missed you former post about it, will try it the next days. Installed the dev server version, lets see , if i can tune it :) Thanks ! |
The fixes are related to the clients, server doesn't need to be updated |
@badaix yeahh sorry, missunderstood it, testing it now with 1 snapclient device. When i start it with "--player pulse" i can not terminate the process with a STRG+C or SIGTERM, I have to use a SIGKILL. With the "--player alsa" i can use STRG+C / SIGTERM to stop the client. I will do the audible audio test, at home in the evening then ;) |
can you also provide a debug log for the STRG+C issue? |
IN the debug log is not really much to see. After the last line i press STRG+C (also tried SIGTERM [kill -TERM PID]) No output. This is the last Actions version from today.
|
Good news: I can reproduce it on my RPi with HiFiBerry DAC (actually I've never tested this outside my X64 dev box). |
Ahh, that makes sense, i have only installed the dependencies (libpulse0 and 3-4 others). |
I've added some more checks. The SIGTERM was necessary because snapclient was waiting in a busy loop for PulseAudio to be connected and initialized (which will never happen without a running PulseAudio server). The current dev version will exit with
|
The develop branch should now work in such error case (see also #727):
@NDahlem Can you please check if the develop branch fixes your original issue? |
Sorry, for the late reaction. Using the latest dev build with --player=pulse works fine. I did't manage to specify a sink with -s, seems to always use the default sink. Setting the default sink to a remap-sink works fine without stutter. |
Can you please retry with |
I have two 5.1 soundcards in my server, those are remapped using pulse audio:
load-module module-remap-sink sink_name=kueche remix=no master=alsa_output.pci-0000_00_07.0.analog-surround-51 channels=2 master_channel_map=front-right,front-right channel_map=front-left,front-right
The pulse-sinks are exposed to alsa:
pcm.pulse-kueche {
type pulse
device "kueche"
}
ctl.pulse-kueche {
type pulse
device "kueche"
}
The server runs snapserver and multiple snapclient instances (both v0.22.0 on ubuntu):
...
snapclient -h 127.0.0.1 -i 4 -s pulse-kueche
...
Streaming to snapclients over the network (raspi and android) works perfekt. But the local snapclients stutter, even if all clients except one are idle.
I tried changing the samplerate of MPD and snapserver from 48 to 44.1
Running one one snapclient works most of the time.
Running several idle in daemin mode and one with logfilter debug also seems to work most of the time
If the stream plays and I stop/pause and then resume it, it always stutters (see attached log)
My prime suspects would be, the somewhat strange snapclient -> alsa -> pulse-remap sink pipeline
Maybe it is some kind of timing issue, because logfilter debug seems to get one instance to play, if multiple instances are running.
Is there a way to use a pulse-sink from snapclient directly without going through alsa?
The text was updated successfully, but these errors were encountered: