Cole Nielsen wrote:
Hey all!!I know you guys are hard at work on the 0.6 release but I have a quick RTMP question. After the handshake, Flash sends some mixed Binary and ASCII data, could someone shed some light on what Red5 does with this data, or better provide a breakdown of the pieces of the packet with explanations? Not so much the RTMP Header stuff but the actual body.
I've implemented this in C++ the following way, guided by the Red5 devs' chat that's posted on the website and using Ethereal to trace what Flash player was doing:
- FMS_HANDSHAKE_SIZE = 1536- send FMS_HANDSHAKE_SIZE+1 bytes as handshake, I know it's pretty lame but I have these saved in a file and don't bother with it
- read reply into a buffer, which is 1 + FMS_HANDSHAKE_SIZE*2 bytes- create a RTMP packet with an AMF call to the "connect" function, and append it to the buffer just received from FMS (previous step) ----> details on the AMF packet; note that this contains some values for the parameters to the function that are lifted straight off the TCP packets traced, and I have no idea what the values mean, but they don't seem to matter either; below is how the AMF packet is built:
amf_packet pkt;
string fn_name("connect");
pkt.write(fn_name);
pkt.write(0x3FF0000000000000LL);
pkt.start_map();
pkt.write_map_name("app"); pkt.write(app_name); // this is the FMS app name
//pkt.write_map_name("flashVer"); pkt.write(string("penultima")); // irrelevant
//pkt.write_map_name("swfUrl"); pkt.write(string("Westbahnhof")); // irrelevant
pkt.write_map_name("tcUrl"); pkt.write(string("rtmp://")+url_); // FMS url
//pkt.write_map_name("fpad"); pkt.write(false); // no idea what this is
//pkt.write_map_name("audioCodecs"); pkt.write(0x4083380000000000LL); // no
idea...
//pkt.write_map_name("videoCodecs"); pkt.write(0x4053000000000000LL); // no
idea...
//pkt.write_map_name("pageUrl"); pkt.write_undef(); // no idea what this is
pkt.end_map();
Testing shows that "app" and "tcUrl" are the only parameters actually required for
"connect" to work, and the values for these params are self-evident, so I guess that
answers your question leaving you with well-understood values. The other params in the
code above are commented out and left there for reference, like I said, that's what Flash
player sends.
This AMF packet is then placed into a RTMP envelope that handles chunking and such, and sent to FMS. Next up are calls to "create_stream" and "publish", followed by audio/video data, and in the end, "delete_stream".
Let me know if this helps!
Also I short time ago I requested something of a UML diagram for Red5 if it exists but I never received a response. I assume it doesn't exist and that leaves me wondering, how are you guys handling the obvious complexities with abstraction in Red5 without this? Thanks in advance for the quick response!! Cole _______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
-- Radu-Adrian Popescu CSA, DBA, Developer Aldrapay MD Aldratech Ltd. +40213212372
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
