mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Cover protocol stack RTMP. 3.0.63
This commit is contained in:
parent
c8bb7e71c9
commit
6eab86644e
1 changed files with 68 additions and 3 deletions
|
@ -445,7 +445,7 @@ VOID TEST(ProtoStackTest, OnDecodeMessages)
|
|||
}
|
||||
}
|
||||
|
||||
SrsCommonMessage* _mock_create_message(char* bytes, int size, int stream_id)
|
||||
SrsCommonMessage* _create_amf0(char* bytes, int size, int stream_id)
|
||||
{
|
||||
SrsCommonMessage* msg = new SrsCommonMessage();
|
||||
msg->header.initialize_amf0_script(size, stream_id);
|
||||
|
@ -464,7 +464,7 @@ VOID TEST(ProtoStackTest, OnDecodeMessages2)
|
|||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x01, 's', 0x00, 0,0,0,0,0,0,0,0, 0x03,0,0,9};
|
||||
SrsCommonMessage* msg = _mock_create_message((char*)bytes, sizeof(bytes), 1);
|
||||
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
|
||||
SrsAutoFree(SrsCommonMessage, msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
|
||||
|
||||
|
@ -481,7 +481,7 @@ VOID TEST(ProtoStackTest, OnDecodeMessages2)
|
|||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x01, 's'};
|
||||
SrsCommonMessage* msg = _mock_create_message((char*)bytes, sizeof(bytes), 1);
|
||||
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
|
||||
SrsAutoFree(SrsCommonMessage, msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
|
||||
|
||||
|
@ -490,5 +490,70 @@ VOID TEST(ProtoStackTest, OnDecodeMessages2)
|
|||
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x00};
|
||||
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
|
||||
SrsAutoFree(SrsCommonMessage, msg);
|
||||
msg->header.message_type = 0xff;
|
||||
|
||||
SrsPacket* pkt;
|
||||
SrsAutoFree(SrsPacket, pkt);
|
||||
|
||||
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 0x01, 's'};
|
||||
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
|
||||
SrsAutoFree(SrsCommonMessage, msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF0DataMessage;
|
||||
|
||||
SrsPacket* pkt;
|
||||
SrsAutoFree(SrsPacket, pkt);
|
||||
|
||||
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ProtoStackTest, OnDecodeMessages3)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't'};
|
||||
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
|
||||
SrsAutoFree(SrsCommonMessage, msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF0DataMessage;
|
||||
|
||||
SrsPacket* pkt;
|
||||
SrsAutoFree(SrsPacket, pkt);
|
||||
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't'};
|
||||
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
|
||||
SrsAutoFree(SrsCommonMessage, msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF0DataMessage;
|
||||
|
||||
SrsPacket* pkt;
|
||||
SrsAutoFree(SrsPacket, pkt);
|
||||
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue