1. SrsRtmpServer::handshake 位于 srs_rtmp_stack.cpp. int SrsRtmpServer::handshake() { int ret = ERROR_SUCCESS; srs_assert(hs_bytes); /* 先尝试进行 complex handshake,若失败则再次尝试 simple handshake */ SrsComplexHandshake complex_hs; if ((ret = complex_hs.handshake_with_client(hs_bytes, io)) != ERROR_SUCCESS) { if (ret == ERROR_RTMP_TRY_SIMPLE_HS) { SrsSimpleHandshake simple_hs; if ((ret = simple_hs.handshake_with_client(hs_bytes, io)) != ERROR_SUCCESS) { return ret; } } return ret; } srs_freep(hs_bytes); return ret; } recv: c0c1 send: s0s1s2 recv: c2 2. complex handshake 2.1 相关类定义 2.1.1 SrsComplexHandshake