[PATCH 1/3] ALSA: compress: document the compress audio state machine

Vinod Koul vkoul at kernel.org
Mon Jun 22 07:33:04 CEST 2020


HI Pierre,

On 19-06-20, 09:22, Pierre-Louis Bossart wrote:
> 
> > +
> > +                                        +----------+
> > +                                        |          |
> > +                                        |   OPEN   |
> > +                                        |          |
> > +                                        +----------+
> > +                                             |
> > +                                             |
> > +                                             | compr_set_params()
> > +                                             |
> > +                                             V
> > +                                        +----------+
> > +                compr_drain_notify()    |          |
> > +              +------------------------>|   SETUP  |
> > +              |                         |          |
> > +              |                         +----------+
> > +              |                              |
> > +              |                              |
> > +              |                              | compr_write()
> > +              |                              |
> > +              |                              V
> > +              |                         +----------+
> > +              |                         |          |
> > +              |                         |  PREPARE |
> > +              |                         |          |
> > +              |                         +----------+
> > +              |                              |
> > +              |                              |
> > +              |                              | compr_start()
> > +              |                              |
> > +              |                              V
> > +        +----------+                    +----------+     compr_pause()      +----------+
> > +        |          |                    |          |----------------------->|          |
> > +        |  DRAIN   |<-------------------|  RUNNING |                        |  PAUSE   |
> > +        |          |                    |          |<-----------------------|          |
> > +        +----------+                    +----------+     compr_resume()     +----------+
> > +              |                              |
> > +              |                              |
> > +              |                              | compr_free()
> > +              |                              |
> > +              |                              V
> > +              |                         +----------+
> > +              |     compr_free()        |          |
> > +              +------------------------>|          |
> > +                                        |   STOP   |
> > +                                        |          |
> > +                                        +----------+
> 
> 
> The STOP state doesn't seem quite right to me, sorry.

We should call it free, Will update

> the direction of the DRAIN-STOP comp_free() arrow seems wrong? Of if it is
> correct, then something's missing to exit the STOP state so that the stream
> can be opened again.

Once stream is freed, it can't be opened again.

But we have trigger stop which is not comprehended here, I will add
compr_stop() above which would transition to SETUP state. And a stopped
stream can be freed up as well, so one more transition from SETUP to
FREE.

Thanks for reviewing
-- 
~Vinod


More information about the Alsa-devel mailing list