mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Fix timer read in non-TREAD mode
Fix timer read in non-TREAD mode. (the struct is different.)
This commit is contained in:
parent
c5fc9e7cf7
commit
9a0f2817bb
2 changed files with 15 additions and 8 deletions
|
|
@ -420,9 +420,15 @@ void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix)
|
|||
{
|
||||
/* rbuf might be overwriten by multiple plugins */
|
||||
/* we don't need the value */
|
||||
snd_timer_tread_t rbuf;
|
||||
while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf))
|
||||
;
|
||||
if (dmix->tread) {
|
||||
snd_timer_tread_t rbuf;
|
||||
while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf))
|
||||
;
|
||||
} else {
|
||||
snd_timer_read_t rbuf;
|
||||
while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
int snd_pcm_direct_timer_stop(snd_pcm_direct_t *dmix)
|
||||
|
|
@ -849,10 +855,10 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
|
|||
snd_pcm_info_t *info;
|
||||
snd_timer_params_t *params;
|
||||
char name[128];
|
||||
int tread = 0;
|
||||
struct pollfd fd;
|
||||
int capture = dmix->type == SND_PCM_TYPE_DSNOOP ? 1 : 0;
|
||||
|
||||
dmix->tread = 0;
|
||||
snd_pcm_info_alloca(&info);
|
||||
snd_timer_params_alloca(¶ms);
|
||||
ret = snd_pcm_info(dmix->spcm, info);
|
||||
|
|
@ -888,16 +894,16 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
|
|||
int ver = 0;
|
||||
ioctl(dmix->poll_fd, SNDRV_TIMER_IOCTL_PVERSION, &ver);
|
||||
if (ver >= SNDRV_PROTOCOL_VERSION(2, 0, 3)) {
|
||||
tread = 1;
|
||||
if (ioctl(dmix->poll_fd, SNDRV_TIMER_IOCTL_TREAD, &tread) < 0)
|
||||
tread = 0;
|
||||
dmix->tread = 1;
|
||||
if (ioctl(dmix->poll_fd, SNDRV_TIMER_IOCTL_TREAD, &dmix->tread) < 0)
|
||||
dmix->tread = 0;
|
||||
}
|
||||
}
|
||||
|
||||
snd_timer_params_set_auto_start(params, 1);
|
||||
snd_timer_params_set_early_event(params, 1);
|
||||
snd_timer_params_set_ticks(params, 1);
|
||||
if (tread)
|
||||
if (dmix->tread)
|
||||
snd_timer_params_set_filter(params, (1<<SND_TIMER_EVENT_TICK)|(1<<SND_TIMER_EVENT_MPAUSE));
|
||||
ret = snd_timer_params(dmix->timer, params);
|
||||
if (ret < 0) {
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ struct snd_pcm_direct {
|
|||
int comm_fd; /* communication file descriptor (socket) */
|
||||
int hw_fd; /* hardware file descriptor */
|
||||
int poll_fd;
|
||||
int tread;
|
||||
int server_fd;
|
||||
pid_t server_pid;
|
||||
snd_timer_t *timer; /* timer used as poll_fd */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue