正在显示
4 个修改的文件
包含
24 行增加
和
0 行删除
@@ -36,7 +36,16 @@ class SrsStream; | @@ -36,7 +36,16 @@ class SrsStream; | ||
36 | 36 | ||
37 | /** | 37 | /** |
38 | * read amf0 string from stream. | 38 | * read amf0 string from stream. |
39 | +* 2.4 String Type | ||
40 | +* string-type = string-marker UTF-8 | ||
39 | */ | 41 | */ |
40 | extern std::string srs_amf0_read_string(SrsStream* stream); | 42 | extern std::string srs_amf0_read_string(SrsStream* stream); |
41 | 43 | ||
44 | +/** | ||
45 | +* read amf0 number from stream. | ||
46 | +* 2.2 Number Type | ||
47 | +* number-type = number-marker DOUBLE | ||
48 | +*/ | ||
49 | +extern double srs_amf0_read_number(SrsStream* stream); | ||
50 | + | ||
42 | #endif | 51 | #endif |
@@ -341,6 +341,14 @@ int SrsConnectAppPacket::decode(SrsStream* stream) | @@ -341,6 +341,14 @@ int SrsConnectAppPacket::decode(SrsStream* stream) | ||
341 | return ret; | 341 | return ret; |
342 | } | 342 | } |
343 | 343 | ||
344 | + transaction_id = srs_amf0_read_number(stream); | ||
345 | + if (transaction_id != 1.0) { | ||
346 | + ret = ERROR_RTMP_AMF0_DECODE; | ||
347 | + srs_error("amf0 decode connect transaction_id failed. " | ||
348 | + "required=%.1f, actual=%.1f, ret=%d", 1.0, transaction_id, ret); | ||
349 | + return ret; | ||
350 | + } | ||
351 | + | ||
344 | return ret; | 352 | return ret; |
345 | } | 353 | } |
346 | 354 |
@@ -163,6 +163,7 @@ private: | @@ -163,6 +163,7 @@ private: | ||
163 | typedef SrsPacket super; | 163 | typedef SrsPacket super; |
164 | private: | 164 | private: |
165 | std::string command_name; | 165 | std::string command_name; |
166 | + double transaction_id; | ||
166 | public: | 167 | public: |
167 | SrsConnectAppPacket(); | 168 | SrsConnectAppPacket(); |
168 | virtual ~SrsConnectAppPacket(); | 169 | virtual ~SrsConnectAppPacket(); |
-
请 注册 或 登录 后发表评论