正在显示
6 个修改的文件
包含
45 行增加
和
40 行删除
| @@ -67,7 +67,7 @@ cd simple-rtmp-server/trunk | @@ -67,7 +67,7 @@ cd simple-rtmp-server/trunk | ||
| 67 | [Usage: How to deploy low lantency application?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleRealtime)<br/> | 67 | [Usage: How to deploy low lantency application?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleRealtime)<br/> |
| 68 | [Usage: How to deploy srs on ARM?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleARM)<br/> | 68 | [Usage: How to deploy srs on ARM?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleARM)<br/> |
| 69 | [Usage: How to show the demo of SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo)<br/> | 69 | [Usage: How to show the demo of SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo)<br/> |
| 70 | -[Usage: Who is using SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/Sample)<br/> | 70 | +[Usage: Solution using SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/Sample)<br/> |
| 71 | 71 | ||
| 72 | ### System Requirements | 72 | ### System Requirements |
| 73 | Supported operating systems and hardware: | 73 | Supported operating systems and hardware: |
| @@ -45,7 +45,8 @@ int main(int argc, char** argv) | @@ -45,7 +45,8 @@ int main(int argc, char** argv) | ||
| 45 | 45 | ||
| 46 | rtmp = srs_rtmp_create("rtmp://127.0.0.1:1935/live/livestream"); | 46 | rtmp = srs_rtmp_create("rtmp://127.0.0.1:1935/live/livestream"); |
| 47 | 47 | ||
| 48 | - if (srs_simple_handshake(rtmp) != 0) { | 48 | + //if (srs_simple_handshake(rtmp) != 0) { |
| 49 | + if (srs_complex_handshake(rtmp) != 0) { | ||
| 49 | printf("simple handshake failed.\n"); | 50 | printf("simple handshake failed.\n"); |
| 50 | goto rtmp_destroy; | 51 | goto rtmp_destroy; |
| 51 | } | 52 | } |
| @@ -34,43 +34,7 @@ class ISrsProtocolReaderWriter; | @@ -34,43 +34,7 @@ class ISrsProtocolReaderWriter; | ||
| 34 | class SrsComplexHandshake; | 34 | class SrsComplexHandshake; |
| 35 | class SrsHandshakeBytes; | 35 | class SrsHandshakeBytes; |
| 36 | 36 | ||
| 37 | -/** | ||
| 38 | -* try complex handshake, if failed, fallback to simple handshake. | ||
| 39 | -*/ | ||
| 40 | -class SrsSimpleHandshake | ||
| 41 | -{ | ||
| 42 | -public: | ||
| 43 | - SrsSimpleHandshake(); | ||
| 44 | - virtual ~SrsSimpleHandshake(); | ||
| 45 | -public: | ||
| 46 | - /** | ||
| 47 | - * simple handshake. | ||
| 48 | - */ | ||
| 49 | - virtual int handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io); | ||
| 50 | - virtual int handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io); | ||
| 51 | -}; | ||
| 52 | - | ||
| 53 | -/** | ||
| 54 | -* rtmp complex handshake, | ||
| 55 | -* @see also crtmp(crtmpserver) or librtmp, | ||
| 56 | -* @see also: http://blog.csdn.net/win_lin/article/details/13006803 | ||
| 57 | -*/ | ||
| 58 | -class SrsComplexHandshake | ||
| 59 | -{ | ||
| 60 | -public: | ||
| 61 | - SrsComplexHandshake(); | ||
| 62 | - virtual ~SrsComplexHandshake(); | ||
| 63 | -public: | ||
| 64 | - /** | ||
| 65 | - * complex hanshake. | ||
| 66 | - * @return user must: | ||
| 67 | - * continue connect app if success, | ||
| 68 | - * try simple handshake if error is ERROR_RTMP_TRY_SIMPLE_HS, | ||
| 69 | - * otherwise, disconnect | ||
| 70 | - */ | ||
| 71 | - virtual int handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io); | ||
| 72 | - virtual int handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io); | ||
| 73 | -}; | 37 | +#ifdef SRS_SSL |
| 74 | 38 | ||
| 75 | namespace srs | 39 | namespace srs |
| 76 | { | 40 | { |
| @@ -304,3 +268,43 @@ namespace srs | @@ -304,3 +268,43 @@ namespace srs | ||
| 304 | } | 268 | } |
| 305 | 269 | ||
| 306 | #endif | 270 | #endif |
| 271 | + | ||
| 272 | +/** | ||
| 273 | +* try complex handshake, if failed, fallback to simple handshake. | ||
| 274 | +*/ | ||
| 275 | +class SrsSimpleHandshake | ||
| 276 | +{ | ||
| 277 | +public: | ||
| 278 | + SrsSimpleHandshake(); | ||
| 279 | + virtual ~SrsSimpleHandshake(); | ||
| 280 | +public: | ||
| 281 | + /** | ||
| 282 | + * simple handshake. | ||
| 283 | + */ | ||
| 284 | + virtual int handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io); | ||
| 285 | + virtual int handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io); | ||
| 286 | +}; | ||
| 287 | + | ||
| 288 | +/** | ||
| 289 | +* rtmp complex handshake, | ||
| 290 | +* @see also crtmp(crtmpserver) or librtmp, | ||
| 291 | +* @see also: http://blog.csdn.net/win_lin/article/details/13006803 | ||
| 292 | +*/ | ||
| 293 | +class SrsComplexHandshake | ||
| 294 | +{ | ||
| 295 | +public: | ||
| 296 | + SrsComplexHandshake(); | ||
| 297 | + virtual ~SrsComplexHandshake(); | ||
| 298 | +public: | ||
| 299 | + /** | ||
| 300 | + * complex hanshake. | ||
| 301 | + * @return user must: | ||
| 302 | + * continue connect app if success, | ||
| 303 | + * try simple handshake if error is ERROR_RTMP_TRY_SIMPLE_HS, | ||
| 304 | + * otherwise, disconnect | ||
| 305 | + */ | ||
| 306 | + virtual int handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io); | ||
| 307 | + virtual int handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io); | ||
| 308 | +}; | ||
| 309 | + | ||
| 310 | +#endif |
| @@ -229,7 +229,7 @@ int SrsHandshakeBytes::read_s0s1s2(ISrsProtocolReaderWriter* io) | @@ -229,7 +229,7 @@ int SrsHandshakeBytes::read_s0s1s2(ISrsProtocolReaderWriter* io) | ||
| 229 | 229 | ||
| 230 | ssize_t nsize; | 230 | ssize_t nsize; |
| 231 | 231 | ||
| 232 | - c0c1 = new char[3073]; | 232 | + s0s1s2 = new char[3073]; |
| 233 | if ((ret = io->read_fully(s0s1s2, 3073, &nsize)) != ERROR_SUCCESS) { | 233 | if ((ret = io->read_fully(s0s1s2, 3073, &nsize)) != ERROR_SUCCESS) { |
| 234 | srs_warn("read s0s1s2 failed. ret=%d", ret); | 234 | srs_warn("read s0s1s2 failed. ret=%d", ret); |
| 235 | return ret; | 235 | return ret; |
-
请 注册 或 登录 后发表评论