Browse Source

alsa: Simplify get state on linux

shave off a few usec from processing time

Change-Id: I052d168b11caa54d881d651c32822d6db33383b8
Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
(cherry picked from commit 138925dfd5)
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
pull/463/head
Adam Miartus Timo Wischer 6 years ago
parent
commit
8e8ae8eefa
1 changed files with 4 additions and 9 deletions
  1. +4
    -9
      linux/alsa/alsa_driver.c

+ 4
- 9
linux/alsa/alsa_driver.c View File

@@ -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
}



Loading…
Cancel
Save