Subject: [MMUSIC] RTSP state machine version 0.4

From: Magnus Westerlund <[email-masked]>
Date: Fri, 08 Mar 2002 11:16:26 +0100

Hi,

Here is a new version that I guess will restart the RTSP state machine 
discussion.

Changes compared to the previous version:

- Added the Ready-No Media state to try it out.
- added REDIRECT
- Also first shot on RECORD and its states
- Removed automatic state transitions related to play and pause.
- Created an issue list.

So please review the state machine and its issue.

Regards

Magnus Westerlund 

Multimedia Technologies, Ericsson Research ERA/T/VA
----------------------------------------------------------------------
Ericsson Radio Systems AB  | Phone +46 8 4048287
Torshamsgatan 23           | Fax   +46 8 7575550
S-164 80 Stockholm, Sweden | mailto: [email-masked]

RTSP state machine ver. 0.4

It is based on the proposal that in aggregated control, PAUSE and PLAY
can't be used on individual medias. If that is allowed there will be
a number of extra transitions with requirements on the 
different medias state. It also using the assumption that queued play
is removed. 

There is discussion if teardown on media URL should end up in a middle
state between Init and Ready-na. This state would contain no media but
keep all session related state and keep its ID. The only way to remove 
such a state will be the teardown with * or a session timeout. It has
been added in this version with the state name "Ready-nm".

This state machine has removed the automatic state transtitions relative to
end of media or range. The automatic state transition that remain is 
session tiemout and when reaching a specifed pause point. 

Missing in state table
----------------------

Of course it is missing things but please help me find what!

Issues
------

1. In the both playing states, is SETUP and TEARDOWN allowed?

2. When a media reaches the end of a media should the resume point be
   set to begining of clip, although it will remain in playing state?

3. When a media reaches the end of the specified range(s) should the 
   resume point be set to 0.0 or the end of the range?

4. Should we have the READY-nm state that this version shows?

5. When doing setup for recording is there a requirement to have done 
   announce before?

6. Should REDIRECT without range or reaching the readirect point result
   in imediatly closeing of the session? This is suggested by the old 
   client state machine that send the client to Init on redirect. The
   text in chapter 10.10 says that the client should issue a teardown
   of previous session. 

States          Explanation
-----------------------------------------------------------------------
Init            Initial state no session exist
Ready-nm        Ready state without any medias 
Ready-na        Non aggregated session in Ready state
Playing-na      Non aggregated session in Playing state
Recording-na    Non aggregated session in Recording state
Ready-a         Aggregated session in Ready state
Playing-a       Aggregated session in Playing
Recording-a     Aggregated session in Recording

The reason for separating aggregated and non aggregated states are the 
following:
- Play and Pause may only be done on aggregate URL and not media URLs 
  in aggregated control. In non-aggregated the two are the same.

State variables
---------------
Nr-media         The number of medias currently setuped in this session
RP = Resume point  The point that a play request without range resumes.

Abrivations
-----------

PP      Pause Point
RP      Resume point
Prs     Presentation

None state machine changeing events
Action          Prerequisite            Response
-----------------------------------------------------------------------
DESCRIBE        Needs REDIRECT          3xx Redirect
DESCRIBE                                200, Session description
OPTIONS         Session ID              200, Reset sess timeout timer
OPTIONS                                 200, Allow hdr
SET_PARAMETER   Valid parameter         200, change value of parameter
GET_PARAMETER   Valid parameter         200, return value of parameter  
ANNOUNCE        C->S, support rec.      
ANNOUNCE        S->C, update session    

State: Init
Action          Prerequisite    New State       Response
-----------------------------------------------------------------------
SETUP                           Ready-na        Nr-media = 1, RP=0.0
SETUP           URL->Redirect   Init            3xx Redirect 

State: Ready-nm
Action          Prerequisite    New State       Response
-----------------------------------------------------------------------
SETUP                           Ready-na        Nr-media = 1, RP=0.0
TEARDOWN        * URL           Init            No session hdr.
Timeout                         Init

State: Ready-na
Action          Prerequisite    New State       Response
-----------------------------------------------------------------------
SETUP           New URL         Ready-a         Nr-media = 2
SETUP           Present URL     Ready-na        Change transport param.
TEARDOWN        *               Init            No session hdr
TEARDOWN        media URL       Ready-nm        Session hdr
PLAY            No range        Playing-na      Play from RP
PLAY            Range           Playing-na      according to range
Timeout                         Init            
RECORD                          Recording-na

State: Playing-na
Action          Prerequisite    New State       Response
-----------------------------------------------------------------------
PAUSE           No range        Ready-na        Set RP to present point
PAUSE           Range > now     Playing-na      Set RP & PP to given point 
PAUSE           Range <= now    Ready-na        Set RP to present pos.
Pause-point reached             Ready-na        
End of media                    Playing-na      Set RP = 0.0
End of range                    Playing-na      Set RP = 0.0|End of range?
Timeout                         Init
SETUP          New URL,Allowed? Playing-a       Nr-media = 2
SETUP  used media URL, Allowed? Playing-na      Change transport param.
TEARDOWN     Allowed?,URL=*|Prs Init            No session hdr
TEARDOWN        media URL       Ready-nm        Session hdr
S->C:REDIRECT   Range hdr       Playing-na
S->C:REDIRECT   no range hdr    Init?
Redirect point reached          Init?

State: Recording-na
Action          Prerequisite    New State       Response
-----------------------------------------------------------------------
PAUSE                           Ready-a         
Out-of-disk                     Ready-a
Timeout                         Init
TEARDOWN     Allowed?,URL=*|Prs Init            No session hdr
TEARDOWN     Allowed? media URL Ready-nm        Session hdr
S->C:REDIRECT   Range hdr       Recording-na    Set Redirect Point
S->C:REDIRECT   w/o range hdr   Init?
Redirect point reached          Init?

State: Ready-a  
Action          Prerequisite    New State       Response
-----------------------------------------------------------------------
SETUP           New URL         Ready-a         Nr-media +=1
SETUP           used mediaURL   Ready-a         Change transport param.
TEARDOWN        * | Pres URL    Init            No session hdr.
TEARDOWN        Nr-media >2     Ready-a         Nr-media -=1, sess hdr
TEARDOWN        Nr-media == 2   Ready-na        Nr-media = 1, sess hdr
Timeout                         Init
PLAY            No range,AggURL Playing-a       From RP
PLAY            Range, Agg URL  Playing-a       according to range
RECORD                          Recording-na

State: Playing-a
Action          Prerequisite    New State       Response
-----------------------------------------------------------------------
PAUSE           No range        Ready-a         Set RP to present pos.
PAUSE           Range > now     Playing-a       Set RP & PP to given point 
PAUSE           RANGE <= now    Ready-a         Set RP to present pos.
Pause-point reached             Ready-a        
End of range                    Ready-a         Set RP = 0.0|range end?
End of media    >=1 Media plays Playing-a       
End of media    All media ended Playing-a       Set RP to 0.0
Timeout                         Init
SETUP          New URL,Allowed? Playing-a       Nr-media +=1
SETUP      Present URL,Allowed? Playing-a       Change transport param
TEARDOWN        *|pres URL      Init            No session hdr allowed?
TEARDOWN        Allowed? Nr-m>2 Playing-a       Nr-media -=1, sess hdr
TEARDOWN        Allowed? Nr-m=2 Playing-na      Nr-media = 1, sess hdr
S->C:REDIRECT   Range hdr       Playing-a       Set Redirect Point
S->C:REDIRECT   w/o range hdr   Init?
Redirect point reached          Init?

State: Recording-a
Action          Prerequisite    New State       Response
-----------------------------------------------------------------------
PAUSE                           Ready-a         
Out-of-disk                     Ready-a
Timeout                         Init
TEARDOWN     Allowed?*|pres URL Init            No session hdr allowed?
TEARDOWN        Allowed? Nr-m>2 Playing-a       Nr-media -=1, sess hdr
TEARDOWN        Allowed? Nr-m=2 Playing-na      Nr-media = 1, sess hdr
S->C:REDIRECT   Range hdr       Recording-a     Set Redirect Point
S->C:REDIRECT   w/o range hdr   Init?
Redirect point reached          Init?