snd_pcm_writei() takes to much time to write data

Abierto
#428 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
15/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
c, linux

Línea de trabajo

The report concerns snd_pcm_writei() in the PCM layer, with a route plugin and a soft-volume plugin in the chain, ending at an es8389 hardware device; the pasted setup dump and kernel log are mixed together and may be unreliable. Start by reproducing with a minimal writer that logs the time per call and the appl_ptr/hw_ptr values, then check whether the stall comes from the plugin chain or the driver. Done means identifying the layer responsible for the roughly one-second blocking, which the maintainers have not yet done.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I am using the ALSA open-source library to read and write audio data for my project. To write audio data, I am calling the snd_pcm_writei function. Initially, it works as expected, but after writing 2-3 frames, the function starts taking significantly more time (around 1 second) to complete.

Normally, snd_pcm_writei should execute within 1-3 ms, but this delay is affecting my application's overall performance, causing audio chopping issues.

Here are the details of my setup:

Frame size: ~8000 bytes (writing 8000 bytes per call)

Plug PCM: Route conversion PCM (sformat=S16_LE)
Transformation table:
0 <- 0
1 <- 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 1
rate : 8000
exact rate : 8000 (8000/1)
msbits : 16
buffer_size : 4000
period_size : 1000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 1000
period_event : 0
start_threshold : 4000
stop_threshold : 4000
silence_threshold: 0
silence_size : 0
boundary : 9007199254740992000
Slave: Soft volume PCM
Control: amba-playback
min_dB: -20
max_dB: 20
resolution: 256
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 8000
exact rate : 8000 (8000/1)
msbits : 16
buffer_size : 4000
period_size : 1000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 1000
period_event : 0
start_threshold : 4000
stop_threshold : 4000
silence_threshold: 0
silence_size : 0
boundary : 9007199254740992000
Slave: Hardware PCM card 0 'es8389' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAV[ 22.206911] ambarella-i2c e400a000.i2c: No ACK from address 0x6c, 0:0!
ED
format [ 22.214533] os04c10: probe of 2-0001 failed with error -5
: S16_LE
subformat : STD
channels : 2
rate : 8000
exact rate : 8000 (8000/1)
msbits : 16
buffer_size : 4000
period_size : 1000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 1000
period_event : 0
start_threshold : 4000
stop_threshold : 4000
silence_threshold: 0
silence_size : 0
boundary : 9007199254740992000
appl_ptr : 0
hw_ptr : 0

I would appreciate any guidance or suggestions on why this delay is happening and how I can resolve it. Let me know if you need any additional details or logs.

Lenguaje dominante
C
Estrellas
501
Forks
227
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de alsa-project/alsa-lib

Todos los issues de alsa-project/alsa-lib

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.