From 8e8ae8eefa892f98ef50bf8b860e403f3fde53fd Mon Sep 17 00:00:00 2001 From: Adam Miartus Date: Tue, 15 Oct 2019 14:18:37 +0200 Subject: [PATCH] alsa: Simplify get state on linux shave off a few usec from processing time Change-Id: I052d168b11caa54d881d651c32822d6db33383b8 Signed-off-by: Adam Miartus (cherry picked from commit 138925dfd5c45c99d7978ba39f99d9d0fc349727) Signed-off-by: Timo Wischer --- linux/alsa/alsa_driver.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/linux/alsa/alsa_driver.c b/linux/alsa/alsa_driver.c index 5f4f9d9e..a8f5916d 100644 --- a/linux/alsa/alsa_driver.c +++ b/linux/alsa/alsa_driver.c @@ -1544,36 +1544,31 @@ alsa_driver_restart (alsa_driver_t *driver) static int alsa_driver_get_status (alsa_driver_t *driver) { - int res; snd_pcm_t *pcm_handle; #ifdef __QNXNTO__ + int res; snd_pcm_channel_status_t status; -#else - snd_pcm_status_t *status; - snd_pcm_status_alloca(&status); #endif + if (driver->capture_handle) { pcm_handle = driver->capture_handle; } else { pcm_handle = driver->playback_handle; } + #ifdef __QNXNTO__ memset (&status, 0, sizeof (status)); status.channel = driver->capture_handle ? SND_PCM_CHANNEL_CAPTURE : SND_PCM_CHANNEL_PLAYBACK; res = snd_pcm_plugin_status(pcm_handle, &status); -#else - res = snd_pcm_status(pcm_handle, status); -#endif if (res < 0) { jack_error("status error: %s", snd_strerror(res)); return -1; } -#ifdef __QNXNTO__ return status.status; #else - return snd_pcm_status_get_state(status); + return snd_pcm_state(pcm_handle); #endif }