lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 11 Jun 2020 11:09:47 +0200 From: Jaroslav Kysela <perex@...ex.cz> To: Charles Keepax <ckeepax@...nsource.cirrus.com>, Vinod Koul <vkoul@...nel.org> Cc: alsa-devel@...a-project.org, broonie@...nel.org, Srinivas Kandagatla <srinivas.kandagatla@...aro.org>, tiwai@...e.com, linux-kernel@...r.kernel.org Subject: Re: [RFC PATCH] ALSA: compress: Fix gapless playback state machine Dne 11. 06. 20 v 10:46 Charles Keepax napsal(a): > On Wed, Jun 10, 2020 at 04:28:20PM +0530, Vinod Koul wrote: >> On 10-06-20, 12:40, Jaroslav Kysela wrote: >>> Dne 10. 06. 20 v 12:07 Srinivas Kandagatla napsal(a): >>>> For gapless playback call to snd_compr_drain_notify() after >>>> partial drain should put the state to SNDRV_PCM_STATE_RUNNING >>>> rather than SNDRV_PCM_STATE_SETUP as the driver is ready to >>>> process the buffers for new track. >>>> >>>> With existing code, if we are playing 3 tracks in gapless, after >>>> partial drain finished on previous track 1 the state is set to >>>> SNDRV_PCM_STATE_SETUP which is then moved to SNDRV_PCM_STATE_PREPARED >>>> after data write. With this state calls to snd_compr_next_track() and >>>> few other calls will fail as they expect the state to be in >>>> SNDRV_PCM_STATE_RUNNING. >>>> >>>> Here is the sequence of events and state transitions: >>>> >>>> 1. set_params (Track 1), state = SNDRV_PCM_STATE_SETUP >>>> 2. set_metadata (Track 1), no state change, state = SNDRV_PCM_STATE_SETUP >>>> 3. fill and trigger start (Track 1), state = SNDRV_PCM_STATE_RUNNING >>>> 4. set_next_track (Track 2), state = SNDRV_PCM_STATE_RUNNING >>>> 5. partial_drain (Track 1), state = SNDRV_PCM_STATE_SETUP >>>> 6 snd_compr_drain_notify (Track 1), state = SNDRV_PCM_STATE_SETUP >>>> 7. fill data (Track 2), state = SNDRV_PCM_STATE_PREPARED >>>> 8. set_metadata (Track 3), no state change, state = SNDRV_PCM_STATE_PREPARED >>>> 9. set_next_track (Track 3), !! FAILURE as state != SNDRV_PCM_STATE_RUNNING >>> >>> >>> The snd_compr_drain_notify() is called only from snd_compr_stop(). Something >>> is missing in this sequence? >> >> It is supposed to be invoked by driver when partial drain is complete.. >> both intel and sprd driver are calling this. snd_compr_stop is stop >> while draining case so legit >> > > Not sure I follow this statement, could you elaborate a bit? > snd_compr_stop putting the state to RUNNING seems fundamentally > broken to me, the whole point of snd_compr_stop is to take the > state out of RUNNING. Yes. I agree. It seems that the acknowledge for the partial drain should be handled differently. Jaroslav > > Thanks, > Charles > -- Jaroslav Kysela <perex@...ex.cz> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Powered by blists - more mailing lists