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
This commit is contained in:
malc 2008-07-09 19:25:28 +00:00
parent a7bb29ba87
commit 64333899dc

View File

@ -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;