Commit 64333899dc98682b72b696db8c062f25f220680c
1 parent
a7bb29ba
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
Showing
1 changed file
with
7 additions
and
2 deletions
audio/alsaaudio.c
@@ -67,6 +67,7 @@ struct alsa_params_req { | @@ -67,6 +67,7 @@ struct alsa_params_req { | ||
67 | snd_pcm_format_t fmt; | 67 | snd_pcm_format_t fmt; |
68 | int nchannels; | 68 | int nchannels; |
69 | int size_in_usec; | 69 | int size_in_usec; |
70 | + int override_mask; | ||
70 | unsigned int buffer_size; | 71 | unsigned int buffer_size; |
71 | unsigned int period_size; | 72 | unsigned int period_size; |
72 | }; | 73 | }; |
@@ -364,7 +365,7 @@ static int alsa_open (int in, struct alsa_params_req *req, | @@ -364,7 +365,7 @@ static int alsa_open (int in, struct alsa_params_req *req, | ||
364 | goto err; | 365 | goto err; |
365 | } | 366 | } |
366 | 367 | ||
367 | - if (obt - req->buffer_size) | 368 | + if ((req->override_mask & 2) && (obt - req->buffer_size)) |
368 | dolog ("Requested buffer %s %u was rejected, using %lu\n", | 369 | dolog ("Requested buffer %s %u was rejected, using %lu\n", |
369 | size_in_usec ? "time" : "size", req->buffer_size, obt); | 370 | size_in_usec ? "time" : "size", req->buffer_size, obt); |
370 | } | 371 | } |
@@ -403,7 +404,7 @@ static int alsa_open (int in, struct alsa_params_req *req, | @@ -403,7 +404,7 @@ static int alsa_open (int in, struct alsa_params_req *req, | ||
403 | goto err; | 404 | goto err; |
404 | } | 405 | } |
405 | 406 | ||
406 | - if (obt - req->period_size) | 407 | + if ((req->override_mask & 1) && (obt - req->period_size)) |
407 | dolog ("Requested period %s %u was rejected, using %lu\n", | 408 | dolog ("Requested period %s %u was rejected, using %lu\n", |
408 | size_in_usec ? "time" : "size", req->period_size, obt); | 409 | size_in_usec ? "time" : "size", req->period_size, obt); |
409 | } | 410 | } |
@@ -624,6 +625,8 @@ static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as) | @@ -624,6 +625,8 @@ static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as) | ||
624 | req.period_size = conf.period_size_out; | 625 | req.period_size = conf.period_size_out; |
625 | req.buffer_size = conf.buffer_size_out; | 626 | req.buffer_size = conf.buffer_size_out; |
626 | req.size_in_usec = conf.size_in_usec_out; | 627 | req.size_in_usec = conf.size_in_usec_out; |
628 | + req.override_mask = !!conf.period_size_out_overridden | ||
629 | + | (!!conf.buffer_size_out_overridden << 1); | ||
627 | 630 | ||
628 | if (alsa_open (0, &req, &obt, &handle)) { | 631 | if (alsa_open (0, &req, &obt, &handle)) { |
629 | return -1; | 632 | return -1; |
@@ -702,6 +705,8 @@ static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as) | @@ -702,6 +705,8 @@ static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as) | ||
702 | req.period_size = conf.period_size_in; | 705 | req.period_size = conf.period_size_in; |
703 | req.buffer_size = conf.buffer_size_in; | 706 | req.buffer_size = conf.buffer_size_in; |
704 | req.size_in_usec = conf.size_in_usec_in; | 707 | req.size_in_usec = conf.size_in_usec_in; |
708 | + req.override_mask = !!conf.period_size_in_overridden | ||
709 | + | (!!conf.buffer_size_in_overridden << 1); | ||
705 | 710 | ||
706 | if (alsa_open (1, &req, &obt, &handle)) { | 711 | if (alsa_open (1, &req, &obt, &handle)) { |
707 | return -1; | 712 | return -1; |