[alsa-devel] my driver can't reproduce continuously
Takashi Iwai
tiwai at suse.de
Mon Jul 27 11:34:41 CEST 2009
At Mon, 27 Jul 2009 16:43:05 +0900,
Kuninori Morimoto wrote:
>
>
> Dear Takashi
>
> Thank you for your comment
>
> > > when 1st buffer was send,
> > > driver stop.
> > > 2nd trigger function isn't called.
> >
> > Check the raw value returned from the pointer callback, too.
> > This can be the real cause.
>
> I might have been doing a very big misunderstanding.
>
> > The pointer callback is supposed to give the currently played position
> > offset in a ring buffer, and ranged from 0 to buffer_size-1.
>
> Does this "ring buffer" mean
> I should transmit runtime->dma_area many times
> from offset 0x0 ??
Yes and no. A ring buffer may contain multiple "periods" (or
"fragments") in it. In your case, a ring buffer has 4 periods.
Until these 4 periods are sent out, the offset goes incrementally.
Once it reaches to buffer_size, it returns to zero again.
> => when I call 4th elapsed,
> should I send runtime->dma_area + 0x0 again ?
Yes.
> If so,
> my driver get STOP on trigger funtion many times
> even if I didn't stop it.
>
> START
> STOP
> underrun!!!
> START
> STOP
> underrun!!!
> ...
>
> Does this correct operation ?
Yes, because the PCM core thinks a buffer underrun happens,
judging from the pointer callback value your driver returned.
That's why I asked many times to check the values returned from the
pointer callback. This value and the timing of
snd_pcm_period_elapsed() is the only information the PCM core checks.
Takashi
More information about the Alsa-devel
mailing list