mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-14 05:25:43 +01:00
axfer: handle -ETIMEDOUT before handle mmap 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 mmap 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
e5e6a7838b
commit
a07eb8e235
1 changed files with 19 additions and 1 deletions
|
@ -82,10 +82,28 @@ static int irq_mmap_process_frames(struct libasound_state *state,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (state->use_waiter) {
|
if (state->use_waiter) {
|
||||||
|
unsigned int msec_per_buffer;
|
||||||
unsigned short revents;
|
unsigned short revents;
|
||||||
|
|
||||||
|
// 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 avail space in buffer.
|
// Wait for hardware IRQ when no avail space in buffer.
|
||||||
err = xfer_libasound_wait_event(state, -1, &revents);
|
err = xfer_libasound_wait_event(state, msec_per_buffer,
|
||||||
|
&revents);
|
||||||
|
if (err == -ETIMEDOUT) {
|
||||||
|
logging(state,
|
||||||
|
"No event occurs for PCM substream during %u "
|
||||||
|
"msec. The implementaion of kernel driver or "
|
||||||
|
"userland backend causes this issue.\n",
|
||||||
|
msec_per_buffer);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
if (revents & POLLERR) {
|
if (revents & POLLERR) {
|
||||||
|
|
Loading…
Reference in a new issue