When resuming an OSS device ask for the very same fragment settings as we did the first time

In OSS it is only possible to request fragment sizes that are powers of
2. However actually selected fragment sizes may be arbitrary values.
This means that it is not always possible to request the same fragment
size after a suspend that was used before the suspend because we simply
cannot express it in the request. To work around that we should issue
the same request as we did the first time.
This commit is contained in:
Lennart Poettering 2009-01-22 01:15:49 +01:00
parent 3be4c31ee0
commit bb23932e9a
2 changed files with 7 additions and 3 deletions

View file

@ -250,6 +250,8 @@ int pa_oss_set_fragments(int fd, int nfrags, int frag_size) {
int arg;
arg = ((int) nfrags << 16) | simple_log2(frag_size);
pa_log_debug("Asking for %i fragments of size %i (requested %i)", nfrags, 1 << simple_log2(frag_size), frag_size);
if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &arg) < 0) {
pa_log("SNDCTL_DSP_SETFRAGMENT: %s", pa_cstrerror(errno));
return -1;