mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 18:25:35 +00:00
PulseAudio: fix incorrect outstream software_latency
Previously, when using PulseAudio, unintended integer division caused SoundIoOutStream::software_latency to be incorrect.
This commit is contained in:
parent
180ed94e2f
commit
72fde44073
|
@ -200,12 +200,6 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
fprintf(stderr, "Output device: %s\n", device->name);
|
||||
fprintf(stderr,
|
||||
"'p\\n' - pause\n"
|
||||
"'u\\n' - unpause\n"
|
||||
"'P\\n' - pause from within callback\n"
|
||||
"'c\\n' - clear buffer\n"
|
||||
"'q\\n' - quit\n");
|
||||
|
||||
if (device->probe_error) {
|
||||
fprintf(stderr, "Cannot probe device: %s\n", soundio_strerror(device->probe_error));
|
||||
|
@ -241,6 +235,13 @@ int main(int argc, char **argv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Software latency: %f\n", outstream->software_latency);
|
||||
fprintf(stderr,
|
||||
"'p\\n' - pause\n"
|
||||
"'u\\n' - unpause\n"
|
||||
"'P\\n' - pause from within callback\n"
|
||||
"'c\\n' - clear buffer\n"
|
||||
"'q\\n' - quit\n");
|
||||
|
||||
if (outstream->layout_error)
|
||||
fprintf(stderr, "unable to set channel layout: %s\n", soundio_strerror(outstream->layout_error));
|
||||
|
|
|
@ -724,7 +724,7 @@ static int outstream_open_pa(struct SoundIoPrivate *si, struct SoundIoOutStreamP
|
|||
}
|
||||
|
||||
size_t writable_size = pa_stream_writable_size(ospa->stream);
|
||||
outstream->software_latency = writable_size / bytes_per_second;
|
||||
outstream->software_latency = ((double)writable_size) / (double)bytes_per_second;
|
||||
|
||||
pa_threaded_mainloop_unlock(sipa->main_loop);
|
||||
|
||||
|
|
Loading…
Reference in a new issue