mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
Clean up using gettimestamp()
Introduce a new local function gettimestamp() to get the current timestamp.
This commit is contained in:
parent
7379b061eb
commit
683c8bc4a2
8 changed files with 28 additions and 66 deletions
|
|
@ -438,7 +438,6 @@ static int snd_pcm_ioplug_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
|||
static int snd_pcm_ioplug_start(snd_pcm_t *pcm)
|
||||
{
|
||||
ioplug_priv_t *io = pcm->private_data;
|
||||
struct timeval tv;
|
||||
int err;
|
||||
|
||||
if (io->data->state != SND_PCM_STATE_PREPARED)
|
||||
|
|
@ -448,9 +447,7 @@ static int snd_pcm_ioplug_start(snd_pcm_t *pcm)
|
|||
if (err < 0)
|
||||
return err;
|
||||
|
||||
gettimeofday(&tv, 0);
|
||||
io->trigger_tstamp.tv_sec = tv.tv_sec;
|
||||
io->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
||||
gettimestamp(&io->trigger_tstamp);
|
||||
io->data->state = SND_PCM_STATE_RUNNING;
|
||||
|
||||
return 0;
|
||||
|
|
@ -459,16 +456,13 @@ static int snd_pcm_ioplug_start(snd_pcm_t *pcm)
|
|||
static int snd_pcm_ioplug_drop(snd_pcm_t *pcm)
|
||||
{
|
||||
ioplug_priv_t *io = pcm->private_data;
|
||||
struct timeval tv;
|
||||
|
||||
if (io->data->state == SND_PCM_STATE_OPEN)
|
||||
return -EBADFD;
|
||||
|
||||
io->data->callback->stop(io->data);
|
||||
|
||||
gettimeofday(&tv, 0);
|
||||
io->trigger_tstamp.tv_sec = tv.tv_sec;
|
||||
io->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
||||
gettimestamp(&io->trigger_tstamp);
|
||||
io->data->state = SND_PCM_STATE_SETUP;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue