diff options
Diffstat (limited to 'meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/periodfix.patch')
| -rw-r--r-- | meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/periodfix.patch | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/periodfix.patch b/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/periodfix.patch new file mode 100644 index 0000000000..3a1c605009 --- /dev/null +++ b/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/periodfix.patch | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | X-Git-Url: http://git.0pointer.de/?p=pulseaudio.git;a=blobdiff_plain;f=src%2Fmodules%2Falsa%2Falsa-util.c;h=107bec357c7889f0197853f5e5f1951a5a2f5be0;hp=a3a045080dac0e1b30e8671443ce73a03337cf14;hb=4bffc7849f7898fa85dd6ac8e735db86b57814b3;hpb=d2b5ae5525e9036c4f91b1615879a5a07aac5bf2 | ||
| 2 | |||
| 3 | diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c | ||
| 4 | index a3a0450..107bec3 100644 | ||
| 5 | --- a/src/modules/alsa/alsa-util.c | ||
| 6 | +++ b/src/modules/alsa/alsa-util.c | ||
| 7 | @@ -334,7 +334,6 @@ int pa_alsa_set_hw_params( | ||
| 8 | int ret = -1; | ||
| 9 | snd_pcm_uframes_t _period_size = period_size ? *period_size : 0; | ||
| 10 | unsigned int _periods = periods ? *periods : 0; | ||
| 11 | - snd_pcm_uframes_t buffer_size; | ||
| 12 | unsigned int r = ss->rate; | ||
| 13 | unsigned int c = ss->channels; | ||
| 14 | pa_sample_format_t f = ss->format; | ||
| 15 | @@ -390,39 +389,47 @@ int pa_alsa_set_hw_params( | ||
| 16 | goto finish; | ||
| 17 | |||
| 18 | if (_period_size && tsched_size && _periods) { | ||
| 19 | + | ||
| 20 | /* Adjust the buffer sizes, if we didn't get the rate we were asking for */ | ||
| 21 | _period_size = (snd_pcm_uframes_t) (((uint64_t) _period_size * r) / ss->rate); | ||
| 22 | tsched_size = (snd_pcm_uframes_t) (((uint64_t) tsched_size * r) / ss->rate); | ||
| 23 | |||
| 24 | if (_use_tsched) { | ||
| 25 | - _period_size = tsched_size; | ||
| 26 | - _periods = 1; | ||
| 27 | + snd_pcm_uframes_t buffer_size; | ||
| 28 | |||
| 29 | pa_assert_se(snd_pcm_hw_params_get_buffer_size_max(hwparams, &buffer_size) == 0); | ||
| 30 | pa_log_debug("Maximum hw buffer size is %u ms", (unsigned) buffer_size * 1000 / r); | ||
| 31 | + | ||
| 32 | + _period_size = tsched_size; | ||
| 33 | + _periods = 1; | ||
| 34 | } | ||
| 35 | |||
| 36 | + if (_period_size > 0 && _periods > 0) { | ||
| 37 | + snd_pcm_uframes_t buffer_size; | ||
| 38 | + | ||
| 39 | buffer_size = _periods * _period_size; | ||
| 40 | |||
| 41 | + if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0) | ||
| 42 | + pa_log_info("snd_pcm_hw_params_set_buffer_size_near() failed: %s", pa_alsa_strerror(ret)); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | if (_periods > 0) { | ||
| 46 | |||
| 47 | - /* First we pass 0 as direction to get exactly what we asked | ||
| 48 | - * for. That this is necessary is presumably a bug in ALSA */ | ||
| 49 | + /* First we pass 0 as direction to get exactly what we | ||
| 50 | + * asked for. That this is necessary is presumably a bug | ||
| 51 | + * in ALSA. All in all this is mostly a hint to ALSA, so | ||
| 52 | + * we don't care if this fails. */ | ||
| 53 | |||
| 54 | dir = 0; | ||
| 55 | - if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) { | ||
| 56 | + if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir) < 0) { | ||
| 57 | dir = 1; | ||
| 58 | - if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) { | ||
| 59 | + if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir) < 0) { | ||
| 60 | dir = -1; | ||
| 61 | if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) | ||
| 62 | - goto finish; | ||
| 63 | + pa_log_info("snd_pcm_hw_params_set_periods_near() failed: %s", pa_alsa_strerror(ret)); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | } | ||
| 67 | - | ||
| 68 | - if (_period_size > 0) | ||
| 69 | - if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0) | ||
| 70 | - goto finish; | ||
| 71 | } | ||
| 72 | |||
| 73 | if ((ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0) | ||
