14 Examples (Esempi)
14 Examples (Esempi)
I seguenti esempi si riferiscono a formati di descrizione di flusso che non sono standard, come RTSL. Non devono essere usati come riferimento per tali formati.
14.1 Media on Demand (Unicast)
Il client C richiede un film ai server multimediali A (audio.example.com) e V (video.example.com). La descrizione è sul server web W e include presentazione, tutti i flussi, codec, tipi di payload RTP dinamici, stack di protocollo e informazioni come lingua o copyright. Può anche indicare la linea temporale del film.
Qui il client è interessato solo alla parte finale.
C->W: GET /twister.sdp HTTP/1.1 Host: www.example.com Accept: application/sdp
W->C: HTTP/1.0 200 OK Content-Type: application/sdp
v=0 o=- 2890844526 2890842807 IN IP4 192.16.24.202 s=RTSP Session m=audio 0 RTP/AVP 0 a=control:rtsp://audio.example.com/twister/audio.en m=video 0 RTP/AVP 31 a=control:rtsp://video.example.com/twister/video
C->A: SETUP rtsp://audio.example.com/twister/audio.en RTSP/1.0 CSeq: 1 Transport: RTP/AVP/UDP;unicast;client_port=3056-3057
A->C: RTSP/1.0 200 OK CSeq: 1 Session: 12345678 Transport: RTP/AVP/UDP;unicast;client_port=3056-3057; server_port=5000-5001
C->V: SETUP rtsp://video.example.com/twister/video RTSP/1.0 CSeq: 1 Transport: RTP/AVP/UDP;unicast;client_port=3058-3059
V->C: RTSP/1.0 200 OK CSeq: 1 Session: 23456789 Transport: RTP/AVP/UDP;unicast;client_port=3058-3059; server_port=5002-5003
C->V: PLAY rtsp://video.example.com/twister/video RTSP/1.0 CSeq: 2 Session: 23456789 Range: smpte=0:10:00-
V->C: RTSP/1.0 200 OK CSeq: 2 Session: 23456789 Range: smpte=0:10:00-0:20:00 RTP-Info: url=rtsp://video.example.com/twister/video; seq=12312232;rtptime=78712811
C->A: PLAY rtsp://audio.example.com/twister/audio.en RTSP/1.0 CSeq: 2 Session: 12345678 Range: smpte=0:10:00-
A->C: RTSP/1.0 200 OK CSeq: 2 Session: 12345678
Range: smpte=0:10:00-0:20:00 RTP-Info: url=rtsp://audio.example.com/twister/audio.en; seq=876655;rtptime=1032181
C->A: TEARDOWN rtsp://audio.example.com/twister/audio.en RTSP/1.0 CSeq: 3 Session: 12345678
A->C: RTSP/1.0 200 OK CSeq: 3
C->V: TEARDOWN rtsp://video.example.com/twister/video RTSP/1.0 CSeq: 3 Session: 23456789
V->C: RTSP/1.0 200 OK CSeq: 3
Pur essendo su server diversi e potendo iniziare con leggeri sfasamenti o deriva, audio e video possono essere sincronizzati con RTP standard, in particolare la scala temporale nei sender report RTCP.
14.2 Streaming of a Container file
Un file contenitore memorizza più tipi di media continui per la stessa presentazione utente finale ; rappresenta una presentazione RTSP i cui componenti sono flussi RTSP. È utile un contesto comune lato server.
C richiede a M una presentazione ; il film è in un file contenitore.
C->M: DESCRIBE rtsp://foo/twister RTSP/1.0 CSeq: 1
M->C: RTSP/1.0 200 OK CSeq: 1 Content-Type: application/sdp Content-Length: 164
v=0 o=- 2890844256 2890842807 IN IP4 172.16.2.93 s=RTSP Session i=An Example of RTSP Session Usage a=control:rtsp://foo/twister t=0 0 m=audio 0 RTP/AVP 0 a=control:rtsp://foo/twister/audio m=video 0 RTP/AVP 26 a=control:rtsp://foo/twister/video
C->M: SETUP rtsp://foo/twister/audio RTSP/1.0 CSeq: 2 Transport: RTP/AVP;unicast;client_port=8000-8001
M->C: RTSP/1.0 200 OK CSeq: 2 Transport: RTP/AVP;unicast;client_port=8000-8001; server_port=9000-9001 Session: 12345678
C->M: SETUP rtsp://foo/twister/video RTSP/1.0 CSeq: 3 Transport: RTP/AVP;unicast;client_port=8002-8003 Session: 12345678
M->C: RTSP/1.0 200 OK CSeq: 3 Transport: RTP/AVP;unicast;client_port=8002-8003; server_port=9004-9005 Session: 12345678
C->M: PLAY rtsp://foo/twister RTSP/1.0 CSeq: 4 Range: npt=0- Session: 12345678
M->C: RTSP/1.0 200 OK CSeq: 4 Session: 12345678 RTP-Info: url=rtsp://foo/twister/video; seq=9810092;rtptime=3450012
C->M: PAUSE rtsp://foo/twister/video RTSP/1.0 CSeq: 5 Session: 12345678
M->C: RTSP/1.0 460 Only aggregate operation allowed CSeq: 5
C->M: PAUSE rtsp://foo/twister RTSP/1.0 CSeq: 6 Session: 12345678
M->C: RTSP/1.0 200 OK CSeq: 6 Session: 12345678
C->M: SETUP rtsp://foo/twister RTSP/1.0 CSeq: 7 Transport: RTP/AVP;unicast;client_port=10000
M->C: RTSP/1.0 459 Aggregate operation not allowed CSeq: 7
Primo fallimento: pausa di un solo flusso non consentita. Secondo: URL aggregato non ammesso per SETUP ; un messaggio di controllo per flusso. Sintassi Transport semplice per i firewall.
14.3 Single Stream Container Files
I client DOVREBBERO seguire le regole della descrizione di sessione per gli URL di richiesta, non assumere un URL uniforme.
Accept: application/x-rtsp-mh, application/sdp
CSeq: 1
S->C RTSP/1.0 200 OK CSeq: 1 Content-base: rtsp://foo.com/test.wav/ Content-type: application/sdp Content-length: 48
v=0 o=- 872653257 872653257 IN IP4 172.16.2.187 s=mu-law wave file i=audio test t=0 0 m=audio 0 RTP/AVP 0 a=control:streamid=0
C->S SETUP rtsp://foo.com/test.wav/streamid=0 RTSP/1.0 Transport: RTP/AVP/UDP;unicast; client_port=6970-6971;mode=play CSeq: 2
S->C RTSP/1.0 200 OK Transport: RTP/AVP/UDP;unicast;client_port=6970-6971; server_port=6970-6971;mode=play CSeq: 2 Session: 2034820394
C->S PLAY rtsp://foo.com/test.wav RTSP/1.0 CSeq: 3 Session: 2034820394
S->C RTSP/1.0 200 OK CSeq: 3 Session: 2034820394 RTP-Info: url=rtsp://foo.com/test.wav/streamid=0; seq=981888;rtptime=3781123
URL diversa in SETUP e URL aggregato in PLAY ; con un solo flusso è poco intuitivo. Si raccomanda tolleranza per PLAY con streamid=0 (peggio 460) e per SETUP su test.wav senza streamid.
14.4 Live Media Presentation Using Multicast
M sceglie indirizzo e porta multicast ; il web ha solo un puntatore, M la descrizione completa.
C->W: GET /concert.sdp HTTP/1.1 Host: www.example.com
W->C: HTTP/1.1 200 OK Content-Type: application/x-rtsl
C->M: DESCRIBE rtsp://live.example.com/concert/audio RTSP/1.0 CSeq: 1
M->C: RTSP/1.0 200 OK CSeq: 1 Content-Type: application/sdp Content-Length: 44
v=0 o=- 2890844526 2890842807 IN IP4 192.16.24.202 s=RTSP Session m=audio 3456 RTP/AVP 0 a=control:rtsp://live.example.com/concert/audio c=IN IP4 224.2.0.1/16
C->M: SETUP rtsp://live.example.com/concert/audio RTSP/1.0 CSeq: 2
Transport: RTP/AVP;multicast
M->C: RTSP/1.0 200 OK CSeq: 2 Transport: RTP/AVP;multicast;destination=224.2.0.1; port=3456-3457;ttl=16 Session: 0456804596
C->M: PLAY rtsp://live.example.com/concert/audio RTSP/1.0 CSeq: 3 Session: 0456804596
M->C: RTSP/1.0 200 OK CSeq: 3 Session: 0456804596
14.5 Playing media into an existing session
Il partecipante C vuole che M riproduca una demo in una conferenza esistente ; indirizzi e chiavi sono già forniti dalla conferenza. ACK semplici omessi.
C->M: DESCRIBE rtsp://server.example.com/demo/548/sound RTSP/1.0 CSeq: 1 Accept: application/sdp
M->C: RTSP/1.0 200 1 OK Content-type: application/sdp Content-Length: 44
v=0 o=- 2890844526 2890842807 IN IP4 192.16.24.202 s=RTSP Session i=See above t=0 0 m=audio 0 RTP/AVP 0
C->M: SETUP rtsp://server.example.com/demo/548/sound RTSP/1.0 CSeq: 2 Transport: RTP/AVP;multicast;destination=225.219.201.15; port=7000-7001;ttl=127 Conference: [email protected]%20Starr
M->C: RTSP/1.0 200 OK CSeq: 2 Transport: RTP/AVP;multicast;destination=225.219.201.15;
port=7000-7001;ttl=127 Session: 91389234234 Conference: [email protected]%20Starr
C->M: PLAY rtsp://server.example.com/demo/548/sound RTSP/1.0 CSeq: 3 Session: 91389234234
M->C: RTSP/1.0 200 OK CSeq: 3
14.6 Recording
C chiede a M di registrare audio e video della riunione ; ANNOUNCE fornisce metadati.
C->M: ANNOUNCE rtsp://server.example.com/meeting RTSP/1.0 CSeq: 90 Content-Type: application/sdp Content-Length: 121
v=0 o=camera1 3080117314 3080118787 IN IP4 195.27.192.36 s=IETF Meeting, Munich - 1 i=The thirty-ninth IETF meeting will be held in Munich, Germany u=http://www.ietf.org/meetings/Munich.html e=IETF Channel 1 [email protected] p=IETF Channel 1 +49-172-2312 451 c=IN IP4 224.0.1.11/127 t=3080271600 3080703600 a=tool:sdr v2.4a6 a=type:test m=audio 21010 RTP/AVP 5 c=IN IP4 224.0.1.11/127 a=ptime:40 m=video 61010 RTP/AVP 31 c=IN IP4 224.0.1.12/127
M->C: RTSP/1.0 200 OK CSeq: 90
C->M: SETUP rtsp://server.example.com/meeting/audiotrack RTSP/1.0 CSeq: 91 Transport: RTP/AVP;multicast;destination=224.0.1.11; port=21010-21011;mode=record;ttl=127
M->C: RTSP/1.0 200 OK CSeq: 91 Session: 50887676 Transport: RTP/AVP;multicast;destination=224.0.1.11; port=21010-21011;mode=record;ttl=127
C->M: SETUP rtsp://server.example.com/meeting/videotrack RTSP/1.0 CSeq: 92 Session: 50887676 Transport: RTP/AVP;multicast;destination=224.0.1.12; port=61010-61011;mode=record;ttl=127
M->C: RTSP/1.0 200 OK CSeq: 92 Transport: RTP/AVP;multicast;destination=224.0.1.12; port=61010-61011;mode=record;ttl=127
C->M: RECORD rtsp://server.example.com/meeting RTSP/1.0 CSeq: 93 Session: 50887676 Range: clock=19961110T1925-19961110T2015
M->C: RTSP/1.0 200 OK CSeq: 93