mozilla / cubeb-pulse-rs

ISC License
15 stars 17 forks source link

Set buffer attributes to control latency #58

Closed Koalab99 closed 4 years ago

Koalab99 commented 4 years ago

Changed the buffer attribute to get stream latency closer to the frame_latency, explained at [1], Also changed the way the buffer size is calculated, it now calls pulseaudio pa_usec_to_byte defined in [2]

[1] https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/Clients/LatencyControl/ [2] https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/pulse/sample.c#L86

padenot commented 4 years ago

Reported latency is expected to vary with PulseAudio, this is also the case today for output latency.

achronop commented 4 years ago

Yeah, it does vary but I worry mostly for the fact that it is way smaller than the one we used to have. If I run the same example without this patch I get:


press `q` to abort or `h` for help
f
stream position 72409. (output latency 1704)
press `q` to abort or `h` for help
f
stream position 126343. (output latency 1616)
press `q` to abort or `h` for help
f
stream position 168787. (output latency 1552)
press `q` to abort or `h` for help
f
stream position 220001. (output latency 1760)
press `q` to abort or `h` for help
q
state is CUBEB_STATE_STOPPED
``