mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Actually store the period_size
This commit is contained in:
parent
82e54dfaba
commit
1e5d98b8fd
1 changed files with 2 additions and 2 deletions
|
@ -35,7 +35,7 @@ fn list_outputs() {
|
|||
|
||||
fn open_device(dev_name: &str) -> Result<(PCM, Frames), Box<Error>> {
|
||||
let pcm = PCM::new(dev_name, Direction::Playback, false)?;
|
||||
let period_size = PREFERED_PERIOD_SIZE;
|
||||
let mut period_size = PREFERED_PERIOD_SIZE;
|
||||
// http://www.linuxjournal.com/article/6735?page=0,1#N0x19ab2890.0x19ba78d8
|
||||
// latency = period_size * periods / (rate * bytes_per_frame)
|
||||
// For 16 Bit stereo data, one frame has a length of four bytes.
|
||||
|
@ -50,7 +50,7 @@ fn open_device(dev_name: &str) -> Result<(PCM, Frames), Box<Error>> {
|
|||
hwp.set_format(Format::s16())?;
|
||||
hwp.set_rate(44100, ValueOr::Nearest)?;
|
||||
hwp.set_channels(2)?;
|
||||
let period_size = hwp.set_period_size_near(period_size, ValueOr::Greater)?;
|
||||
period_size = hwp.set_period_size_near(period_size, ValueOr::Greater)?;
|
||||
hwp.set_buffer_size_near(period_size * BUFFERED_PERIODS)?;
|
||||
pcm.hw_params(&hwp)?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue