Re: reset of kernel input buffer for /dev/dsp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Tue, 30 Nov 2010 11:51:33 +0900,
Amit Nagal wrote:
> 
> Hi ,
> 
> Thanx for the patch . Application of this patch resolves kernel pcm
> ring buffer flush problem .
> Now SNDCTL_DSP_RESET works properly .
> 
> 
> On a suggestive note  ,  as this bug is present in main stream kernel also ,
> this patch should also be applied as well .

Thanks for testing.  Yes, I applied the patch now, and it'll be included
in the stable kernel as well.


Takashi

> 
> Thanx & Regards
> Amit Nagal
> 
> 
> 
> 
> On Mon, Nov 29, 2010 at 5:58 PM, Takashi Iwai <tiwai@xxxxxxx> wrote:
> > At Mon, 29 Nov 2010 17:40:03 +0900,
> > Amit Nagal wrote:
> >>
> >> Hi ,
> >>
> >> Thanx for the reply .
> >>
> >> we tried SNDCTL_DSP_RESET , but it is not flushing Âthe kernel pcm
> >> buffer for us Â.
> >
> > It should. ÂIt abandons the pending data and resets to the initial
> > state before starting the stream.
> >
> > But, it might be a bug in OSS emulation later. ÂIt doesn't seem to
> > reset the internal buffer. ÂTry the patch below.
> >
> >> any other method which we can use ?
> >
> >> also please lets us the function available with alsa - lib which
> >> serves the purpose of flushing
> >> the kernel pcm buffer .
> >
> > snd_pcm_drop() corresponds to it.
> >
> >
> > Takashi
> >
> > ---
> > diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
> > index 5c8c7df..a4411a3 100644
> > --- a/sound/core/oss/pcm_oss.c
> > +++ b/sound/core/oss/pcm_oss.c
> > @@ -1510,16 +1510,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
> > Âstatic int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
> > Â{
> > Â Â Â Âstruct snd_pcm_substream *substream;
> > + Â Â Â struct snd_pcm_runtime *runtime;
> > + Â Â Â int i;
> >
> > - Â Â Â substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
> > - Â Â Â if (substream != NULL) {
> > - Â Â Â Â Â Â Â snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
> > - Â Â Â Â Â Â Â substream->runtime->oss.prepare = 1;
> > - Â Â Â }
> > - Â Â Â substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
> > - Â Â Â if (substream != NULL) {
> > + Â Â Â for (i = 0; i < 2; i++) {
> > + Â Â Â Â Â Â Â substream = pcm_oss_file->streams[i];
> > + Â Â Â Â Â Â Â if (!substream)
> > + Â Â Â Â Â Â Â Â Â Â Â continue;
> > + Â Â Â Â Â Â Â runtime = substream->runtine;
> > Â Â Â Â Â Â Â Âsnd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
> > - Â Â Â Â Â Â Â substream->runtime->oss.prepare = 1;
> > + Â Â Â Â Â Â Â runtime->oss.prepare = 1;
> > + Â Â Â Â Â Â Â runtime->oss.buffer_used = 0;
> > + Â Â Â Â Â Â Â runtime->oss.prev_hw_ptr_period = 0;
> > + Â Â Â Â Â Â Â runtime->oss.period_ptr = 0;
> > Â Â Â Â}
> > Â Â Â Âreturn 0;
> > Â}
> >
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux