RTMP handshake compliance for clients
authorKevin DuBois <kdub432@gmail.com>
Wed, 8 Jul 2009 07:19:38 +0000 (09:19 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 8 Jul 2009 07:19:38 +0000 (09:19 +0200)
The spec says that the 2nd round of packets need to have the 1st 4 bytes be the
timestamp (potentially zero) and the next 4 bytes be zero. The bytes after that
should be random. (not necessarily cryptographically secure, just for
establishing a unique echo response in the 3rd round of packets).

Signed-off-by: Rémi Duraffort <ivoire@videolan.org>
modules/access/rtmp/rtmp_amf_flv.c

index 4added1..ed3bd56 100644 (file)
@@ -339,7 +339,14 @@ rtmp_handshake_active( vlc_object_t *p_this, int fd )
 
     p_write[0] = RTMP_HANDSHAKE;
     for( i = 0; i < RTMP_HANDSHAKE_BODY_SIZE; i++ )
-        p_write[i + 1] = i & 0xFF;
+    {
+        if (i < 8)
+        {
+            p_write[i + 1] = 0x00;
+        } else {
+            p_write[i + 1] = rand() & 0xFF;
+        }
+    }
 
     /* Send handshake*/
     i_ret = net_Write( p_this, fd, NULL, p_write, RTMP_HANDSHAKE_BODY_SIZE + 1 );