提交 64333899 编写于 作者: M malc

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
上级 a7bb29ba
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册