diff options
Diffstat (limited to 'audio')
-rw-r--r-- | audio/alsaaudio.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 4d47aa0..867e15b 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -67,6 +67,7 @@ struct alsa_params_req { snd_pcm_format_t fmt; int nchannels; int size_in_usec; + int override_mask; unsigned int buffer_size; unsigned int period_size; }; @@ -364,7 +365,7 @@ static int alsa_open (int in, struct alsa_params_req *req, goto err; } - if (obt - req->buffer_size) + if ((req->override_mask & 2) && (obt - req->buffer_size)) dolog ("Requested buffer %s %u was rejected, using %lu\n", size_in_usec ? "time" : "size", req->buffer_size, obt); } @@ -403,7 +404,7 @@ static int alsa_open (int in, struct alsa_params_req *req, goto err; } - if (obt - req->period_size) + if ((req->override_mask & 1) && (obt - req->period_size)) dolog ("Requested period %s %u was rejected, using %lu\n", size_in_usec ? "time" : "size", req->period_size, obt); } @@ -624,6 +625,8 @@ static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as) req.period_size = conf.period_size_out; req.buffer_size = conf.buffer_size_out; req.size_in_usec = conf.size_in_usec_out; + req.override_mask = !!conf.period_size_out_overridden + | (!!conf.buffer_size_out_overridden << 1); if (alsa_open (0, &req, &obt, &handle)) { return -1; @@ -702,6 +705,8 @@ static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as) req.period_size = conf.period_size_in; req.buffer_size = conf.buffer_size_in; req.size_in_usec = conf.size_in_usec_in; + req.override_mask = !!conf.period_size_in_overridden + | (!!conf.buffer_size_in_overridden << 1); if (alsa_open (1, &req, &obt, &handle)) { return -1; |