winlin

for #730, refine code to decode the acknowledge message

... ... @@ -5017,6 +5017,22 @@ SrsAcknowledgementPacket::~SrsAcknowledgementPacket()
{
}
int SrsAcknowledgementPacket::decode(SrsBuffer* stream)
{
int ret = ERROR_SUCCESS;
if (!stream->require(4)) {
ret = ERROR_RTMP_MESSAGE_DECODE;
srs_error("decode acknowledgement failed. ret=%d", ret);
return ret;
}
sequence_number = stream->read_4bytes();
srs_info("decode acknowledgement success");
return ret;
}
int SrsAcknowledgementPacket::get_prefer_cid()
{
return RTMP_CID_ProtocolControl;
... ...
... ... @@ -1847,6 +1847,9 @@ public:
public:
SrsAcknowledgementPacket();
virtual ~SrsAcknowledgementPacket();
// decode functions for concrete packet to override.
public:
virtual int decode(SrsBuffer* stream);
// encode functions for concrete packet to override.
public:
virtual int get_prefer_cid();
... ...
... ... @@ -31,12 +31,12 @@ using namespace std;
VOID TEST(CoreAutoFreeTest, Free)
{
char* data = new char[32];
srs_freep(data);
srs_freepa(data);
EXPECT_TRUE(data == NULL);
if (true) {
data = new char[32];
SrsAutoFree(char, data);
SrsAutoFreeA(char, data);
}
EXPECT_TRUE(data == NULL);
}
... ...