Commit f3b5298316aa7885b83d49b6499388189b3e08f7
1 parent
ece43b8d
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
Showing
1 changed file
with
16 additions
and
0 deletions
audio/alsaaudio.c
... | ... | @@ -334,6 +334,8 @@ static int alsa_open (int in, struct alsa_params_req *req, |
334 | 334 | } |
335 | 335 | |
336 | 336 | if (req->buffer_size) { |
337 | + unsigned long obt; | |
338 | + | |
337 | 339 | if (size_in_usec) { |
338 | 340 | int dir = 0; |
339 | 341 | unsigned int btime = req->buffer_size; |
... | ... | @@ -344,6 +346,7 @@ static int alsa_open (int in, struct alsa_params_req *req, |
344 | 346 | &btime, |
345 | 347 | &dir |
346 | 348 | ); |
349 | + obt = btime; | |
347 | 350 | } |
348 | 351 | else { |
349 | 352 | snd_pcm_uframes_t bsize = req->buffer_size; |
... | ... | @@ -353,15 +356,22 @@ static int alsa_open (int in, struct alsa_params_req *req, |
353 | 356 | hw_params, |
354 | 357 | &bsize |
355 | 358 | ); |
359 | + obt = bsize; | |
356 | 360 | } |
357 | 361 | if (err < 0) { |
358 | 362 | alsa_logerr2 (err, typ, "Failed to set buffer %s to %d\n", |
359 | 363 | size_in_usec ? "time" : "size", req->buffer_size); |
360 | 364 | goto err; |
361 | 365 | } |
366 | + | |
367 | + if (obt - req->buffer_size) | |
368 | + dolog ("Requested buffer %s %u was rejected, using %lu\n", | |
369 | + size_in_usec ? "time" : "size", req->buffer_size, obt); | |
362 | 370 | } |
363 | 371 | |
364 | 372 | if (req->period_size) { |
373 | + unsigned long obt; | |
374 | + | |
365 | 375 | if (size_in_usec) { |
366 | 376 | int dir = 0; |
367 | 377 | unsigned int ptime = req->period_size; |
... | ... | @@ -372,6 +382,7 @@ static int alsa_open (int in, struct alsa_params_req *req, |
372 | 382 | &ptime, |
373 | 383 | &dir |
374 | 384 | ); |
385 | + obt = ptime; | |
375 | 386 | } |
376 | 387 | else { |
377 | 388 | snd_pcm_uframes_t psize = req->period_size; |
... | ... | @@ -381,6 +392,7 @@ static int alsa_open (int in, struct alsa_params_req *req, |
381 | 392 | hw_params, |
382 | 393 | &psize |
383 | 394 | ); |
395 | + obt = psize; | |
384 | 396 | } |
385 | 397 | |
386 | 398 | if (err < 0) { |
... | ... | @@ -388,6 +400,10 @@ static int alsa_open (int in, struct alsa_params_req *req, |
388 | 400 | size_in_usec ? "time" : "size", req->period_size); |
389 | 401 | goto err; |
390 | 402 | } |
403 | + | |
404 | + if (obt - req->period_size) | |
405 | + dolog ("Requested period %s %u was rejected, using %lu\n", | |
406 | + size_in_usec ? "time" : "size", req->period_size, obt); | |
391 | 407 | } |
392 | 408 | |
393 | 409 | err = snd_pcm_hw_params (handle, hw_params); | ... | ... |