1
0
Fork 0
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:
winlin 2019-11-20 11:14:02 +08:00
parent 3365bc6b02
commit 40e60aff4d

View file

@ -549,7 +549,7 @@ VOID TEST(ProtoStackTest, OnDecodeMessages3)
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x07, '_','r','e','s','u','l','t'}; uint8_t bytes[] = {0x17, 0x02, 0x00, 0x07, '_','r','e','s','u','l','t'};
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1); SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
SrsAutoFree(SrsCommonMessage, msg); SrsAutoFree(SrsCommonMessage, msg);
msg->header.message_type = RTMP_MSG_AMF0DataMessage; msg->header.message_type = RTMP_MSG_AMF3DataMessage;
SrsPacket* pkt; SrsPacket* pkt;
SrsAutoFree(SrsPacket, pkt); SrsAutoFree(SrsPacket, pkt);
@ -562,10 +562,10 @@ VOID TEST(ProtoStackTest, OnDecodeMessages3)
MockBufferIO io; MockBufferIO io;
SrsProtocol p(&io); SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 0x07, '_','r','e','s','u','l','t', 0x00,0,0,0,0,0,0,0,0}; uint8_t bytes[] = {0x17, 0x02, 0x00, 0x07, '_','r','e','s','u','l','t', 0x00,0,0,0,0,0,0,0,0};
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1); SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
SrsAutoFree(SrsCommonMessage, msg); SrsAutoFree(SrsCommonMessage, msg);
msg->header.message_type = RTMP_MSG_AMF0DataMessage; msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
SrsPacket* pkt; SrsPacket* pkt;
SrsAutoFree(SrsPacket, pkt); SrsAutoFree(SrsPacket, pkt);
@ -669,6 +669,26 @@ VOID TEST(ProtoStackTest, OnDecodeMessages3)
// Without enough data, it fail when decoding the response packet. // Without enough data, it fail when decoding the response packet.
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt)); HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
} }
if (true) {
MockBufferIO io;
SrsProtocol p(&io);
SrsFMLEStartPacket* request = new SrsFMLEStartPacket();
request->command_name = "srs";
request->transaction_id = 0.0;
HELPER_EXPECT_SUCCESS(p.send_and_free_packet(request, 1));
uint8_t bytes[] = {0x02, 0x00, 0x07, '_','r','e','s','u','l','t', 0x00,0,0,0,0,0,0,0,0};
SrsCommonMessage* msg = _create_amf0((char*)bytes, sizeof(bytes), 1);
SrsAutoFree(SrsCommonMessage, msg);
SrsPacket* pkt;
SrsAutoFree(SrsPacket, pkt);
// Without enough data, it fail when decoding the response packet.
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
}
} }
VOID TEST(ProtoStackTest, OnDecodeMessages4) VOID TEST(ProtoStackTest, OnDecodeMessages4)