[osflash] RTMP: How to associate responses and requests?

Max maxlemans at free.fr
Sun Aug 9 09:56:59 PDT 2009


Hi Andre,

Andre Kirchner a écrit :
> Hi Max,
> 
> I understood what you meant that a single stream can carry audio,
> video, ... , and csid is used to differentiate between them. In the
> sampled traffic bellow, csid =4 is used for audio and 6 for video.

That's it.

> Furthermore, csid = 2 seems to be used in messages to set values that
> are valid for all streams like serverBW, clientBW, chunkSize. Except
> for low level command messages (ping in 2, 6 and 7) where it was only
> applied in the stream specified by the stream id in the command body
> (and not the stream id in the header, which was always 0).

csid = 2 is always reserved for low-level RTMP command like "set chunk 
size", "set bandwith" or "abort stream" for example. Note you will 
always have a stream id (sid always 0x000000) for these chunks.

> csid = 3 was used in high level command messages to connect to the
> server and create streams, and csid = 8 in command messages to
> control streams. And in this case, the sid used was the server stream
> id returned by _result in 5, and not the client stream id requested
> be the createStream command in 4.

That's normal: the stream from the client to the server is not the same 
as the stream from the server to the client. Nevertheless, csid makes 
possible to understand what each chunk correspond to. That's what I noticed.

> Are those csid values always the same? I mean, low level command
> messages will always use csid 2, 

Yes, it's a special case as well as csid 0 and 1 do not exist. (csid can 
be stored on 1, 2 or 3 bytes. If the first byte is set to 0 (wich may be 
erroneously understood as being csid 0), then csid is stored on 2 bytes. 
If the first byte is set to 1 ((wich may also be erroneously understood 
as being csid 1), then csid is stored on 3 bytes.

> high level command messages to
> connect to the media server and create stream will use csid 3,
> messages to control stream will use csid = 8, audio messages csid = 4
> and video messages csid = 6.

Not always. Imagine your Flash application creates two or more netStream 
objects using only one netConnection object (exemple : you publish your 
audio & video to rtmp server while receiving audio and video from 
someone else, a common case for video conferencing). You will have one 
csid and another csid for incoming audio & video, one more csid and 
another more csid for outgoing audio & video.

Hope this helps. ;)

-- 
Max.



More information about the osflash mailing list