All of lore.kernel.org
 help / color / mirror / Atom feed
* ALSA throwing buffers away?
@ 2010-11-23 16:36 Radivoje Jovanovic
  2010-11-23 17:03 ` Clemens Ladisch
  0 siblings, 1 reply; 5+ messages in thread
From: Radivoje Jovanovic @ 2010-11-23 16:36 UTC (permalink / raw)
  To: alsa-devel

Hello,
I am developing driver for a really simple hardware. Hardware has codec that
supports mono/stereo and the amplifier that supports only one speaker so the
driver has to be mono driver and the codec is setup to manage mono data. I
have setup ALSA with following parameters:

.info =            (SNDRV_PCM_INFO_NONINTERLEAVED |
                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
                 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),

    .formats = SNDRV_PCM_FMTBIT_U16_LE |
           SNDRV_PCM_FMTBIT_U16_BE |
           SNDRV_PCM_FMTBIT_S16_LE |
           SNDRV_PCM_FMTBIT_S16_BE |
           SNDRV_PCM_FMTBIT_U8,
.channels_min = 1,
 .channels_max = 1,

Initially I was happy since sound started playing right away, but I noticed
that songs are skipping. I created buffers that collect statistics about
playback which is printed at the STOP trigger. The hardware is going through
ALSA circular buffer correctly, and ALSA is filling the buffer as the
hardware progresses, but after each buffer iteration ALSA skips the buffer
length of the data?! For example:
If buffer is .5 Mb ALSA will fill first .5Mb from the file into the buffer.
As the hardware is playing the sound ALSA fills the buffer starting 1.0 Mb
away from the begining of the file (the data from .5-1.0 Mb never makes it
to the buffer). This pattern repeats constantly to the end of the song. I
have tried SNDRV_PCM_INFO_INTERLEAVED with the same results (in this case
ALSA will not even try to play stereo files using my mono driver). The files
I tested are stereo and mono and they all behave the same. I am collecting
ALSA info in the snd_pcm_lib_write1 method in the pcm_lib.c file. I was
wondering if ALSA maybe deals with two circular buffers in the same time, or
if anybody has an idea what is going on here?

~cheers,
Ogi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-23 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-23 16:36 ALSA throwing buffers away? Radivoje Jovanovic
2010-11-23 17:03 ` Clemens Ladisch
2010-11-23 17:25   ` Radivoje Jovanovic
2010-11-23 17:40     ` Clemens Ladisch
2010-11-23 17:51       ` Radivoje Jovanovic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.