ALSA: explicitly list millisecond buffer-sizes

This commit is contained in:
Robin Gareus 2021-01-22 16:06:18 +01:00
parent 0b97175d49
commit 8426bb3aaf
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 15 additions and 0 deletions

View File

@ -236,6 +236,21 @@ AlsaAudioBackend::available_buffer_sizes (const std::string& device) const
bs.push_back (avail_sizes[i]);
}
}
if (!nfo) {
return bs;
}
static const unsigned long try_msec [] = { 2, 4, 5, 6, 8, 10, 15, 20, 25, 40};
for (size_t i = 0 ; i < sizeof(try_msec) / sizeof(unsigned long); ++i) {
unsigned int msbs = _samplerate * try_msec[i] / 1000;
if (msbs >= nfo->min_size && msbs <= nfo->max_size) {
bs.push_back (msbs);
}
}
std::sort (bs.begin (), bs.end ());
return bs;
}