From: Takashi Iwai Subject: Re: [BUG] snd_pcm_drop() does not stop the PCM immediately Date: Wed, 14 Mar 2018 17:49:21 +0100 Message-ID: References: <32cead2b-d2fc-485f-70e9-e528bc2fe63e@gmail.com> <332672f7-eabb-73a2-9f76-d03e8c9c253c@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 5301B26708E for ; Wed, 14 Mar 2018 17:49:21 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Martin Schreiber Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Wed, 14 Mar 2018 17:39:46 +0100, Martin Schreiber wrote: > > On 03/14/2018 05:16 PM, Takashi Iwai wrote: > >> Does snd_pcm_close() "scratching off the existing data from the mixed > >> buffer"? > > > > It shouldn't. There is no corresponding code in the dmix close path > > as far as I read again. So, if it really does anything better, it's > > somewhere rather in the ALSA timer handling, I suppose. > > > It does better, see attached alsadrop2.c. Hm, interesting. Could you track down why it makes difference? For example, put a sleep(10) in snd_pcm_dmix_close() at the beginning, so that it stops processing at the entrance of the close callback. If the sample discard still occurs, something else before that point. Similarly, move sleep(10) call in each step of snd_pcm_dmix_close() and see what really matters. > Now the question is why? And could it be implemented in snd_pcm_drop() too? Yes, but only if you understand why it differs :) Takashi