Andre,

Andre Kirchner a écrit :
Hi all,

Regarding the RTMP protocol, how is a response associated with a request?

I understood, for example, that when a createStream command with chunkID 5 (I'm 
referring By ChunkID to bits 0-5 of the first byte of the header) is send to 
the flash media server, it will respond with a _result message with chunkID 5. 
But at least when wowza is the flash media server used, all _result messages 
have chunkID 3.


I believe you are doing the same confusion I made when I first start to try to understand how RTMP messages are implemented. :) I made a confusion between Chunk Stream ID (csid) and Stream ID (sid). They are two different things.

You will get the csid for each chunk from chunk basic headers stored in 1, 2 or 3 bytes : 1 byte if chunk stream id is between 2 and 63 (remember csid #2 is reserved for low level rtmp messages), 2 bytes if csid is between 64 and 319 (first byte is like ??000000, the csid is computed as follow: second byte + 64), 3 bytes if csid is between 64 and 65599 (first byte is like ??000001, the csid is computed as follow: third byte * 256 + second byte + 64). Note: csid between 64 and 319 may be also stored on 3 bytes (third byte set to 0), but this may be one extra byte used for nothing. Next to the chunk basic header is the chunk message header 11, 7, 3 or 0 bytes long depending of chunk type.

The chunk type if stored in the first two bits of the first byte. The two first bits (??xxxxxx) of the first byte will inform you if chunk is type 0 (00xxxxxx), 1 (01xxxxxx), 2 (10xxxxxx) or 3 (11xxxxxx). If type is 0, chunk message is 11 bytes long and you will get the sid (not csid) from bytes 8 to 11 after you removed If type is 1, 2 or 3, then chunk message header will be 7, 3 or zero bytes long respectivly. In type 1, 2 or 3 the sid is not mentionned. You must refer to the previous chunks (based on csid) as the stream ID remains the same. This also means you must send or receive a 0-typed chunk before sending or receiving 1, 2 or 3-typed chunks.

With this stream ID you can determine what is the _result message targeted to.

Hope this helps ! :)

Cheers.

--
Max.



_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to