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 . 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; > } > ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Alsa-user mailing list Alsa-user@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-user