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.
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 = 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. Are those csid values always the same? I mean, low level command messages will always use csid 2, 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. Cheers, Andre 1. C->S: csid = 3, sid = 0, connect 2. S->C: csid = 2, sid = 0, serverBW csid = 2, sid = 0, clientBW csid = 2, sid = 0, ping (stream begin, stream ID = 0) csid = 2, sid = 0, chunkSize csid = 3, sid = 0, _result 3. C->S: csid = 2, sid = 0, serverBW 4. C->S: csid = 3, sid = 0, createStream (client stream ID = 2) 5. S->C: csid = 3, sid = 0, _result (client stream ID = 2, server stream ID = 1) 6. C->S: csid = 2, sid = 0, ping (set buffer size, stream ID = 1, size = 0) csid = 8, sid = 1, publish csid = 8, sid = 1, notify 7. S->C: csid = 2, sid = 0, ping (stream begin, stream ID = 1) 8. C->S: csid = 4, sid = 1, audio data 9. S->C: csid = 3, sid = 1, onStatus 10. C->S: csid = 6, sid = 1, video data ----- Original Message ---- From: Max <[email protected]> To: Open Source Flash Mailing List <[email protected]> Sent: Saturday, August 8, 2009 1:26:52 PM Subject: Re: [osflash] RTMP: How to associate responses and requests? Hello Andre Andre Kirchner a écrit : > Thanks for the information. It was very helpful. > > If the streamID is used to associate a response with a a request, what's the > use of csid? As you know, RTMP stands for Real Time Media Protocol which means you may use this protocol to exchange several streams at the time between a client and a server. To do so you need to multiplexe your streams (ex : one first stream for audio, a second one for video and so on). This is achived transmiting data into small pieces so you could toggle sending thses streams simultaneously. For example you may want to send a 64KB data block to the server. This data block is splitted into small pieces (chunks), sent to the server and reassembled once received in order to recompose the original data block. The default size of a chunk is 128 bits (it can be modified sending a special low level protocol chunk, reserved csid 2, type 1). As you can send several streams at the same time, client and server have to identify each chunk stream exchanged. The use of csid aims to solve a performance issue. As I wrote in my last post, csid may be stored in only one byte where sid is always stored in 3 bytes. Multiplied by the number of chunks used to send a stream, it would represent useless extra bytes consumption (in my example 64KB data exchange may use an extra 1KB load if you consider sid would have to be sent instead of using a csid between 3 and 63. Saved 1.5% of trafic). I also guess this protocol was implemented in order to make difficult to understand mecanisms behind Flash stream transmissions. After all, RTMP specification where made public only a few weeks ago. ;) ;) Cheers. -- Max. _______________________________________________ osflash mailing list [email protected] http://osflash.org/mailman/listinfo/osflash_osflash.org _______________________________________________ osflash mailing list [email protected] http://osflash.org/mailman/listinfo/osflash_osflash.org
