mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-18 23:04:25 +00:00
[ALSA] Try to fallback on get_buffer_size.
Apparently some driver returns error here.
This commit is contained in:
parent
c429a9e424
commit
190db263b0
@ -87,9 +87,12 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency)
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params));
|
||||
|
||||
snd_pcm_hw_params_get_period_size(params, &buffer_size, NULL);
|
||||
// Shouldn't have to bother with this, but some drivers are apparently broken.
|
||||
if (snd_pcm_hw_params_get_period_size(params, &buffer_size, NULL))
|
||||
snd_pcm_hw_params_get_period_size_min(params, &buffer_size, NULL);
|
||||
RARCH_LOG("ALSA: Period size: %d frames\n", (int)buffer_size);
|
||||
snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
|
||||
if (snd_pcm_hw_params_get_buffer_size(params, &buffer_size))
|
||||
snd_pcm_hw_params_get_buffer_size_max(params, &buffer_size);
|
||||
RARCH_LOG("ALSA: Buffer size: %d frames\n", (int)buffer_size);
|
||||
alsa->buffer_size = snd_pcm_frames_to_bytes(alsa->pcm, buffer_size);
|
||||
alsa->can_pause = snd_pcm_hw_params_can_pause(params);
|
||||
|
@ -177,10 +177,14 @@ static void *alsa_thread_init(const char *device, unsigned rate, unsigned latenc
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params));
|
||||
|
||||
snd_pcm_hw_params_get_period_size(params, &alsa->period_frames, NULL);
|
||||
// Shouldn't have to bother with this, but some drivers are apparently broken.
|
||||
if (snd_pcm_hw_params_get_period_size(params, &alsa->period_frames, NULL))
|
||||
snd_pcm_hw_params_get_period_size_min(params, &alsa->period_frames, NULL);
|
||||
RARCH_LOG("ALSA: Period size: %d frames\n", (int)alsa->period_frames);
|
||||
snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
|
||||
if (snd_pcm_hw_params_get_buffer_size(params, &buffer_size))
|
||||
snd_pcm_hw_params_get_buffer_size_max(params, &buffer_size);
|
||||
RARCH_LOG("ALSA: Buffer size: %d frames\n", (int)buffer_size);
|
||||
|
||||
alsa->buffer_size = snd_pcm_frames_to_bytes(alsa->pcm, buffer_size);
|
||||
alsa->period_size = snd_pcm_frames_to_bytes(alsa->pcm, alsa->period_frames);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user