diff mbox series

[2/3] ALSA: compress: document the compress gapless audio state machine

Message ID 20200619045449.3966868-3-vkoul@kernel.org (mailing list archive)
State New, archived
Headers show
Series ALSA: compress: Document stream states and fix gaplless SM | expand

Commit Message

Vinod Koul June 19, 2020, 4:54 a.m. UTC
Also documented the galpess transitions. Please note that these are not
really stream states, but show how the stream steps in gapless mode

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 .../sound/designs/compress-offload.rst        | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Pierre-Louis Bossart June 19, 2020, 2:27 p.m. UTC | #1
> +For Gapless, we move from running state to partial drain and back, along
> +with setting of meta_data and signalling for next track ::
> +
> +
> +                                        +----------+
> +                compr_drain_notify()    |          |
> +              +------------------------>|  RUNNING |
> +              |                         |          |
> +              |                         +----------+
> +              |                              |
> +              |                              |
> +              |                              | compr_next_track()
> +              |                              |
> +              |                              V
> +              |                         +----------+
> +              |                         |          |
> +              |                         |NEXT_TRACK|
> +              |                         |          |
> +              |                         +----------+
> +              |                              |
> +              |                              |
> +              |                              | compr_partial_drain()
> +              |                              |
> +              |                              V
> +              |                         +----------+
> +              |                         |          |
> +              +------------------------ | PARTIAL_ |
> +                                        |  DRAIN   |
> +                                        +----------+

May I suggest having a single state machine, not a big one and an 
additional partial one. It would help explain why in one case 
compr_drain_notify() triggers a transition to RUNNING while in the other 
one it goes to SETUP.

I realize it's more complicated to edit but it'd be easier on 
reviewers/users.
Vinod Koul June 22, 2020, 5:34 a.m. UTC | #2
On 19-06-20, 09:27, Pierre-Louis Bossart wrote:
> 
> > +For Gapless, we move from running state to partial drain and back, along
> > +with setting of meta_data and signalling for next track ::
> > +
> > +
> > +                                        +----------+
> > +                compr_drain_notify()    |          |
> > +              +------------------------>|  RUNNING |
> > +              |                         |          |
> > +              |                         +----------+
> > +              |                              |
> > +              |                              |
> > +              |                              | compr_next_track()
> > +              |                              |
> > +              |                              V
> > +              |                         +----------+
> > +              |                         |          |
> > +              |                         |NEXT_TRACK|
> > +              |                         |          |
> > +              |                         +----------+
> > +              |                              |
> > +              |                              |
> > +              |                              | compr_partial_drain()
> > +              |                              |
> > +              |                              V
> > +              |                         +----------+
> > +              |                         |          |
> > +              +------------------------ | PARTIAL_ |
> > +                                        |  DRAIN   |
> > +                                        +----------+
> 
> May I suggest having a single state machine, not a big one and an additional
> partial one. It would help explain why in one case compr_drain_notify()
> triggers a transition to RUNNING while in the other one it goes to SETUP.
> 
> I realize it's more complicated to edit but it'd be easier on
> reviewers/users.

Ell adding stop and transitions would really make it complicated and
gapless is a bit different handling and it looks cleaner this way IMO,
so lets stick to this. Feel free to create one if you are up for it.
Pierre-Louis Bossart June 22, 2020, 1:22 p.m. UTC | #3
On 6/22/20 12:34 AM, Vinod Koul wrote:
> On 19-06-20, 09:27, Pierre-Louis Bossart wrote:
>>
>>> +For Gapless, we move from running state to partial drain and back, along
>>> +with setting of meta_data and signalling for next track ::
>>> +
>>> +
>>> +                                        +----------+
>>> +                compr_drain_notify()    |          |
>>> +              +------------------------>|  RUNNING |
>>> +              |                         |          |
>>> +              |                         +----------+
>>> +              |                              |
>>> +              |                              |
>>> +              |                              | compr_next_track()
>>> +              |                              |
>>> +              |                              V
>>> +              |                         +----------+
>>> +              |                         |          |
>>> +              |                         |NEXT_TRACK|
>>> +              |                         |          |
>>> +              |                         +----------+
>>> +              |                              |
>>> +              |                              |
>>> +              |                              | compr_partial_drain()
>>> +              |                              |
>>> +              |                              V
>>> +              |                         +----------+
>>> +              |                         |          |
>>> +              +------------------------ | PARTIAL_ |
>>> +                                        |  DRAIN   |
>>> +                                        +----------+
>>
>> May I suggest having a single state machine, not a big one and an additional
>> partial one. It would help explain why in one case compr_drain_notify()
>> triggers a transition to RUNNING while in the other one it goes to SETUP.
>>
>> I realize it's more complicated to edit but it'd be easier on
>> reviewers/users.
> 
> Ell adding stop and transitions would really make it complicated and
> gapless is a bit different handling and it looks cleaner this way IMO,
> so lets stick to this. Feel free to create one if you are up for it.

if you don't want to change the visuals then please add a paragraph 
explaining the different uses of compr_drain_notify().
diff mbox series

Patch

diff --git a/Documentation/sound/designs/compress-offload.rst b/Documentation/sound/designs/compress-offload.rst
index 7292717c43bf..3e241530e173 100644
--- a/Documentation/sound/designs/compress-offload.rst
+++ b/Documentation/sound/designs/compress-offload.rst
@@ -251,6 +251,38 @@  Sequence flow for gapless would be:
 
 (note: order for partial_drain and write for next track can be reversed as well)
 
+Gapless Playback SM
+===================
+
+For Gapless, we move from running state to partial drain and back, along
+with setting of meta_data and signalling for next track ::
+
+
+                                        +----------+
+                compr_drain_notify()    |          |
+              +------------------------>|  RUNNING |
+              |                         |          |
+              |                         +----------+
+              |                              |
+              |                              |
+              |                              | compr_next_track()
+              |                              |
+              |                              V
+              |                         +----------+
+              |                         |          |
+              |                         |NEXT_TRACK|
+              |                         |          |
+              |                         +----------+
+              |                              |
+              |                              |
+              |                              | compr_partial_drain()
+              |                              |
+              |                              V
+              |                         +----------+
+              |                         |          |
+              +------------------------ | PARTIAL_ |
+                                        |  DRAIN   |
+                                        +----------+
 
 Not supported
 =============