aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authormalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>2008-06-21 20:09:32 +0000
committermalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>2008-06-21 20:09:32 +0000
commitf3b5298316aa7885b83d49b6499388189b3e08f7 (patch)
tree4b54ced1bdc54b0ae3649df2659f3252e893c45a /audio
parentece43b8d06f26c670b06c30c6bd1021580a005aa (diff)
Emit warning message if user supplied buffer/period size/time was rejected
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4773 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'audio')
-rw-r--r--audio/alsaaudio.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 7d488859d1..c926cae381 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -334,6 +334,8 @@ static int alsa_open (int in, struct alsa_params_req *req,
}
if (req->buffer_size) {
+ unsigned long obt;
+
if (size_in_usec) {
int dir = 0;
unsigned int btime = req->buffer_size;
@@ -344,6 +346,7 @@ static int alsa_open (int in, struct alsa_params_req *req,
&btime,
&dir
);
+ obt = btime;
}
else {
snd_pcm_uframes_t bsize = req->buffer_size;
@@ -353,15 +356,22 @@ static int alsa_open (int in, struct alsa_params_req *req,
hw_params,
&bsize
);
+ obt = bsize;
}
if (err < 0) {
alsa_logerr2 (err, typ, "Failed to set buffer %s to %d\n",
size_in_usec ? "time" : "size", req->buffer_size);
goto err;
}
+
+ if (obt - req->buffer_size)
+ dolog ("Requested buffer %s %u was rejected, using %lu\n",
+ size_in_usec ? "time" : "size", req->buffer_size, obt);
}
if (req->period_size) {
+ unsigned long obt;
+
if (size_in_usec) {
int dir = 0;
unsigned int ptime = req->period_size;
@@ -372,6 +382,7 @@ static int alsa_open (int in, struct alsa_params_req *req,
&ptime,
&dir
);
+ obt = ptime;
}
else {
snd_pcm_uframes_t psize = req->period_size;
@@ -381,6 +392,7 @@ static int alsa_open (int in, struct alsa_params_req *req,
hw_params,
&psize
);
+ obt = psize;
}
if (err < 0) {
@@ -388,6 +400,10 @@ static int alsa_open (int in, struct alsa_params_req *req,
size_in_usec ? "time" : "size", req->period_size);
goto err;
}
+
+ if (obt - req->period_size)
+ dolog ("Requested period %s %u was rejected, using %lu\n",
+ size_in_usec ? "time" : "size", req->period_size, obt);
}
err = snd_pcm_hw_params (handle, hw_params);