[alsa-devel] ALSA queries

Chakravarthi Pradeep doubleq7 at gmail.com
Sun Aug 5 20:07:06 CEST 2018


On Sun 5 Aug, 2018, 14:19 Chakravarthi Pradeep, <doubleq7 at gmail.com> wrote:

> Hello Takashi,
>
> Thanks for your reply.
>
>  periods_min = the minimal number of periods
>  period_bytes_min = the minimal size of bytes for one period
>  period_bytes_max = the maximal size of bytes for one period
>
>
> periods_min = the minimal number of periods :  what is meaning of
> periods , is it minimal number of interrupts ?
> period_bytes_min = the minimal size of bytes for one period : it
> means, minimal size of bytes per interrupt in case of device, Is it
> correct ?
> what about period_max ?
>
> It's most likely the ALSA PCM core's safety stop; your driver seem to
> have missed snd_pcm_period_elapsed() calls, so the hwptr isn't
> updated, resulting in XRUN.  ALSA PCM core checks such XRUN condition
> with the own timer.
>
> I'm attaching my driver thread along with this mail. Can you please
> let me know if I have missed something in audio thread. ?. How to make
> sure in driver that, trigger stop should be called only when stop
> command is sent from application.
>
> I'm getting cut cut cut ... noise along with audio in VLC application.
> Initially for 2 or 4 seconds, cut cut cut noise is not heard in VLC
> application, However after almost after 5 sec ,I can hear cut cut cut
> noise in VLC application. With my analysis, hwptr is getting updated
> properly however I have doubt in app_ptr. I'm attaching the excl sheet
> with hw_ptr,app_ptr and buf_pos values.
>
> How to remove the cut cut cut ... noise in audio ?
>
> Regards,
> Chakravarthi
>
> On Fri, Aug 3, 2018 at 1:05 PM Takashi Iwai <tiwai at suse.de> wrote:
> >
> > On Thu, 02 Aug 2018 16:31:13 +0200,
> > Chakravarthi Pradeep wrote:
> > >
> > > I'm working on ALSA driver for PCIe card. My ALSA driver and it's
> > > initializing struct snd_pcm_hardware with below parameter.
> > >
> > > /************************ code  start
> > > ************************************************/
> > > static struct snd_pcm_hardware audio_pcm_hardware = {
> > > .info = (SNDRV_PCM_INFO_INTERLEAVED  | SNDRV_PCM_INFO_MMAP |
> > > SNDRV_PCM_INFO_MMAP_VALID |
> > > SNDRV_PCM_INFO_BLOCK_TRANSFER |
> > > SNDRV_PCM_INFO_RESUME ),
> > > .formats  =       (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S24_LE),
> > > .rates  = (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
> > > SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000),
> > > .rate_min  = 44100,
> > > .rate_max  = 192000,
> > > .channels_min  = 2,
> > > .channels_max  = 8,
> > > .buffer_bytes_max  = 76800, /*75 kbytes */
> > > .period_bytes_min  = 512,//4410, /* (channel (2) * sample_rate (44100)
> > > * bit width (24)) / (60 * 8)  */
> > > .period_bytes_max  = 16*1024,
> > > .periods_min  = 10,
> > > .periods_max  = 255,
> > >
> > > };
> > > /************************ code  end
> > > ************************************************/
> > >
> > > 1) I did not understand what is significance of periods_min ,
> > > period_bytes_min ,  period_bytes_max and periods_max. Can you please
> > > tell me what is importance of these parameter and what value should be
> > > mentioned according into ALSA.
> >
> > These three defines the values your hardware may accept:
> >  periods_min = the minimal number of periods
> >  period_bytes_min = the minimal size of bytes for one period
> >  period_bytes_max = the maximal size of bytes for one period
> >
> > > 2) snd_pcm_ops trigger callback is getting called in the driver when
> > > application sends "start" command. But ALSA driver is stopping by
> > > itself after one frame is copied to ALSA framework, without waiting
> > > for "stop" command.
> > >
> > > For instance:
> > > In trigger callback , I'm getting these logs after one frame is copied.
> > > Trigger:Start (When Play button is selected/clicked in application,
> > > Start command is sent to ALSA driver)
> > > Dma transfer is completed.
> > > Trigger:Stop. (When Stop button is selected/clicked in application,
> > > Stop command is sent to ALSA driver. But stop button is not clicked in
> > > this case)
> >
> > It's most likely the ALSA PCM core's safety stop; your driver seem to
> > have missed snd_pcm_period_elapsed() calls, so the hwptr isn't
> > updated, resulting in XRUN.  ALSA PCM core checks such XRUN condition
> > with the own timer.
> >
> >
> > Takashi
>
>
>
> --
> Thanks and Regards
> Chakravarthi Pradeep.K
> Ph: 91 9980434900
>


More information about the Alsa-devel mailing list