mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Introduce an appropriate period for the desired buffer
This commit is contained in:
parent
e8ec5feb22
commit
aaef07e819
1 changed files with 2 additions and 1 deletions
|
@ -41,7 +41,8 @@ fn open_device(dev_name: &str) -> Result<(PCM), Box<Error>> {
|
|||
hwp.set_format(Format::s16())?;
|
||||
hwp.set_rate(44100, ValueOr::Nearest)?;
|
||||
hwp.set_channels(2)?;
|
||||
hwp.set_buffer_size_near(22050)?; // ~ 0.5s latency
|
||||
hwp.set_period_size_near(5512, ValueOr::Nearest)?; // Period of roughly 125ms
|
||||
hwp.set_buffer_size_near(22048)?; // ~ 0.5s latency
|
||||
pcm.hw_params(&hwp)?;
|
||||
|
||||
let swp = pcm.sw_params_current()?;
|
||||
|
|
Loading…
Reference in a new issue