winlin

decode amf0 string

... ... @@ -95,3 +95,9 @@ std::string srs_amf0_read_string(SrsStream* stream)
return str;
}
double srs_amf0_read_number(SrsStream* stream)
{
return 0;
}
... ...
... ... @@ -36,7 +36,16 @@ class SrsStream;
/**
* read amf0 string from stream.
* 2.4 String Type
* string-type = string-marker UTF-8
*/
extern std::string srs_amf0_read_string(SrsStream* stream);
/**
* read amf0 number from stream.
* 2.2 Number Type
* number-type = number-marker DOUBLE
*/
extern double srs_amf0_read_number(SrsStream* stream);
#endif
\ No newline at end of file
... ...
... ... @@ -341,6 +341,14 @@ int SrsConnectAppPacket::decode(SrsStream* stream)
return ret;
}
transaction_id = srs_amf0_read_number(stream);
if (transaction_id != 1.0) {
ret = ERROR_RTMP_AMF0_DECODE;
srs_error("amf0 decode connect transaction_id failed. "
"required=%.1f, actual=%.1f, ret=%d", 1.0, transaction_id, ret);
return ret;
}
return ret;
}
... ...
... ... @@ -163,6 +163,7 @@ private:
typedef SrsPacket super;
private:
std::string command_name;
double transaction_id;
public:
SrsConnectAppPacket();
virtual ~SrsConnectAppPacket();
... ...