aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-06-16 23:02:59 -0700
committerChris Robinson <[email protected]>2012-06-16 23:02:59 -0700
commit051195a99152e35e089a2477b4a7f66a1aadf6da (patch)
tree2f1e8d5c3a645098e4e0299aad020bfcb9d71e98 /Alc
parent90ca6675c2a433a99d3cc3086cc18428b1088b10 (diff)
Avoid failing if ALSA can't set a buffer or period time near to our request
These functions should not fail, but there seem to be bugs that cause them to sometimes. We're flexible enough to handle almost anything it throws back at us though, so anything is better than nothing here.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/backends/alsa.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index 3cb96327..49fec523 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -763,29 +763,10 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
CHECK(snd_pcm_hw_params_set_rate_near(data->pcmHandle, hp, &rate, NULL));
/* set buffer time (implicitly constrains period/buffer parameters) */
if(snd_pcm_hw_params_set_buffer_time_near(data->pcmHandle, hp, &bufferLen, NULL) < 0)
- {
- unsigned int mintime, maxtime;
- CHECK(snd_pcm_hw_params_get_buffer_time_min(hp, &mintime, NULL));
- CHECK(snd_pcm_hw_params_get_buffer_time_max(hp, &maxtime, NULL));
-
- TRACE("Failed to set %uus buffer time, detected range: %u -> %u\n", bufferLen, mintime, maxtime);
- bufferLen = clampu(bufferLen, mintime, maxtime);
- periodLen = minu(periodLen, bufferLen/2);
-
- CHECK(snd_pcm_hw_params_set_buffer_time_near(data->pcmHandle, hp, &bufferLen, NULL));
- }
+ ERR("snd_pcm_hw_params_set_buffer_time_near failed: %s\n", snd_strerror(err));
/* set period time (implicitly sets buffer size/bytes/time and period size/bytes) */
if(snd_pcm_hw_params_set_period_time_near(data->pcmHandle, hp, &periodLen, NULL) < 0)
- {
- unsigned int mintime, maxtime;
- CHECK(snd_pcm_hw_params_get_period_time_min(hp, &mintime, NULL));
- CHECK(snd_pcm_hw_params_get_period_time_max(hp, &maxtime, NULL));
-
- TRACE("Failed to set %uus period time, detected range: %u -> %u\n", periodLen, mintime, maxtime);
- periodLen = clampu(periodLen, mintime, maxtime);
-
- CHECK(snd_pcm_hw_params_set_period_time_near(data->pcmHandle, hp, &periodLen, NULL));
- }
+ ERR("snd_pcm_hw_params_set_period_time_near failed: %s\n", snd_strerror(err));
/* install and prepare hardware configuration */
CHECK(snd_pcm_hw_params(data->pcmHandle, hp));
/* retrieve configuration info */