[vlc-devel] commit: RTMP handshake compliance for clients (Kevin DuBois )

git version control git at videolan.org
Wed Jul 8 09:26:28 CEST 2009


vlc | branch: master | Kevin DuBois <kdub432 at gmail.com> | Wed Jul  8 09:19:38 2009 +0200| [af0ba1445194d0251a6e8a0811cb15e83e6ef99e] | committer: Rémi Duraffort 

RTMP handshake compliance for clients

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 at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af0ba1445194d0251a6e8a0811cb15e83e6ef99e
---

 modules/access/rtmp/rtmp_amf_flv.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/modules/access/rtmp/rtmp_amf_flv.c b/modules/access/rtmp/rtmp_amf_flv.c
index 4added1..ed3bd56 100644
--- a/modules/access/rtmp/rtmp_amf_flv.c
+++ b/modules/access/rtmp/rtmp_amf_flv.c
@@ -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 );




More information about the vlc-devel mailing list