From 64333899dc98682b72b696db8c062f25f220680c Mon Sep 17 00:00:00 2001 From: malc Date: Wed, 9 Jul 2008 19:25:28 +0000 Subject: Warn about rejected buffer/period size/time when it was specified by the user git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4864 c046a42c-6fe2-441c-8c8c-71466251a162 --- audio/alsaaudio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'audio/alsaaudio.c') diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 4d47aa006b..867e15b41a 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; -- cgit v1.2.1