mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 18:05:42 +01:00
axfer: handle -ETIMEDOUT before non-block I/O operation
When running for IRQ-based scheduling model, transmission backend is expected to queue PCM event in different context from the main thread. When queueing no events during time equivalent to one period of PCM buffer, the backend has problems. This commit outputs report it for non-blocking operation for IRQ-based scheduling model. The timeout is equivalent to all frames in buffer, instead of period for safe. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
498ca99461
commit
7d7c988e05
1 changed files with 10 additions and 1 deletions
|
@ -21,12 +21,21 @@ struct rw_closure {
|
|||
|
||||
static int wait_for_avail(struct libasound_state *state)
|
||||
{
|
||||
unsigned int msec_per_buffer;
|
||||
unsigned short revents;
|
||||
unsigned short event;
|
||||
int err;
|
||||
|
||||
// Wait during msec equivalent to all audio data frames in buffer
|
||||
// instead of period, for safe.
|
||||
err = snd_pcm_hw_params_get_buffer_time(state->hw_params,
|
||||
&msec_per_buffer, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
msec_per_buffer /= 1000;
|
||||
|
||||
// Wait for hardware IRQ when no available space.
|
||||
err = xfer_libasound_wait_event(state, -1, &revents);
|
||||
err = xfer_libasound_wait_event(state, msec_per_buffer, &revents);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
|
Loading…
Reference in a new issue