mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Remove bandwidth check because falsh is disabled. v5.0.52
This commit is contained in:
parent
1630918b0f
commit
937605b18c
16 changed files with 5 additions and 1490 deletions
|
|
@ -1843,61 +1843,6 @@ VOID TEST(ConfigMainTest, CheckConf_transcode)
|
|||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, CheckConf_bandcheck)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_FAILED(conf.parse(_MIN_OK_CONF "vhost v{bandchecks{}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{enabled on;}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_FAILED(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{enableds on;}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{key \"35c9b402c12a7246868752e2878f7e0e\";}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_FAILED(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{keys \"35c9b402c12a7246868752e2878f7e0e\";}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{interval 30;}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_FAILED(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{intervals 30;}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{limit_kbps 4000;}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_FAILED(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{limit_kbpss 4000;}}"));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, CheckConf_chunk_size2)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
|
@ -2019,14 +1964,6 @@ VOID TEST(ConfigUnitTest, CheckDefaultValuesVhost)
|
|||
|
||||
MockSrsConfig conf;
|
||||
|
||||
if (true) {
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF));
|
||||
EXPECT_EQ(30 * SRS_UTIME_SECONDS, conf.get_bw_check_interval(""));
|
||||
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost v{bandcheck{interval 4;}}"));
|
||||
EXPECT_EQ(4 * SRS_UTIME_SECONDS, conf.get_bw_check_interval("v"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF));
|
||||
EXPECT_EQ(30 * SRS_UTIME_SECONDS, conf.get_dash_fragment(""));
|
||||
|
|
@ -3198,10 +3135,6 @@ VOID TEST(ConfigMainTest, CheckVhostConfig3)
|
|||
EXPECT_TRUE(conf.get_vhost_on_dvr("ossrs.net") == NULL);
|
||||
EXPECT_TRUE(conf.get_vhost_on_hls("ossrs.net") == NULL);
|
||||
EXPECT_TRUE(conf.get_vhost_on_hls_notify("ossrs.net") == NULL);
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled("ossrs.net"));
|
||||
EXPECT_TRUE(conf.get_bw_check_key("ossrs.net").empty());
|
||||
EXPECT_EQ(30000000, conf.get_bw_check_interval("ossrs.net"));
|
||||
EXPECT_EQ(1000, conf.get_bw_check_limit_kbps("ossrs.net"));
|
||||
EXPECT_FALSE(conf.get_vhost_is_edge("ossrs.net"));
|
||||
EXPECT_TRUE(conf.get_vhost_edge_origin("ossrs.net") == NULL);
|
||||
EXPECT_FALSE(conf.get_vhost_edge_token_traverse("ossrs.net"));
|
||||
|
|
@ -3260,30 +3193,6 @@ VOID TEST(ConfigMainTest, CheckVhostConfig3)
|
|||
EXPECT_TRUE(conf.get_vhost_is_edge("ossrs.net"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost ossrs.net{bandcheck{limit_kbps 10;}}"));
|
||||
EXPECT_EQ(10, conf.get_bw_check_limit_kbps("ossrs.net"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost ossrs.net{bandcheck{interval 10;}}"));
|
||||
EXPECT_EQ(10000000, conf.get_bw_check_interval("ossrs.net"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost ossrs.net{bandcheck{key xxx;}}"));
|
||||
EXPECT_FALSE(conf.get_bw_check_key("ossrs.net").empty());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost ossrs.net{bandcheck{enabled on;}}"));
|
||||
EXPECT_TRUE(conf.get_bw_check_enabled("ossrs.net"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "vhost ossrs.net{http_hooks{on_hls_notify xxx;}}"));
|
||||
|
|
|
|||
|
|
@ -4993,40 +4993,6 @@ VOID TEST(ProtocolStackTest, ProtocolSendSrsOnStatusCallPacket)
|
|||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
/**
|
||||
* send a SrsBandwidthPacket packet
|
||||
*/
|
||||
VOID TEST(ProtocolStackTest, ProtocolSendSrsBandwidthPacket)
|
||||
{
|
||||
MockBufferIO bio;
|
||||
SrsProtocol proto(&bio);
|
||||
|
||||
SrsAmf0Object* args = SrsAmf0Any::object();
|
||||
|
||||
args->set("stream" , SrsAmf0Any::str("livestream"));
|
||||
args->set("start" , SrsAmf0Any::number(0));
|
||||
|
||||
SrsBandwidthPacket* pkt = new SrsBandwidthPacket();
|
||||
pkt->command_name = "startPublish";
|
||||
pkt->args = SrsAmf0Any::null();
|
||||
pkt->data = args;
|
||||
|
||||
EXPECT_TRUE(ERROR_SUCCESS == proto.send_and_free_packet(pkt, 0));
|
||||
char buf[] = {
|
||||
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x73,
|
||||
0x74, 0x61, 0x72, 0x74, 0x50, 0x75, 0x62, 0x6c,
|
||||
0x69, 0x73, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x06,
|
||||
0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x02, 0x00,
|
||||
0x0a, 0x6c, 0x69, 0x76, 0x65, 0x73, 0x74, 0x72,
|
||||
0x65, 0x61, 0x6d, 0x00, 0x05, 0x73, 0x74, 0x61,
|
||||
0x72, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x09
|
||||
};
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
/**
|
||||
* send a SrsOnStatusDataPacket packet
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -841,186 +841,6 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
|
|||
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 22, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','F','i','n','i','s','h','e','d', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 21, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','P','l','a','y','i','n','g', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 24, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','P','u','b','l','i','s','h','i','n','g', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 31, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','S','t','a','r','t','i','n','g','P','l','a','y','B','y','t','e','s', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 34, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','S','t','a','r','t','i','n','g','P','u','b','l','i','s','h','B','y','t','e','s', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 28, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','S','t','a','r','t','P','l','a','y','B','y','t','e','s', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 31, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','S','t','a','r','t','P','u','b','l','i','s','h','B','y','t','e','s', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 30, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','S','t','o','p','p','e','d','P','l','a','y','B','y','t','e','s', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 27, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','S','t','o','p','P','l','a','y','B','y','t','e','s', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 30, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','S','t','o','p','P','u','b','l','i','s','h','B','y','t','e','s', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 33, 'o','n','S','r','s','B','a','n','d','C','h','e','c','k','S','t','o','p','p','e','d','P','u','b','l','i','s','h','B','y','t','e','s', 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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
||||
uint8_t bytes[] = {0x02, 0x00, 17, 'f','i','n','a','l','C','l','i','e','n','t','P','a','c','k','e','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 request packet.
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsProtocol p(&io);
|
||||
|
|
@ -2488,78 +2308,6 @@ VOID TEST(ProtocolRTMPTest, CoverAll)
|
|||
}
|
||||
}
|
||||
|
||||
VOID TEST(ProtocolRTMPTest, CoverBandwidth)
|
||||
{
|
||||
if (true) {
|
||||
SrsBandwidthPacket p;
|
||||
|
||||
p.set_command("onSrsBandCheckStartPlayBytes");
|
||||
EXPECT_TRUE(p.is_start_play());
|
||||
|
||||
p.command_name = "onSrsBandCheckStartPlayBytes";
|
||||
EXPECT_TRUE(p.is_start_play());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_start_play();
|
||||
EXPECT_TRUE(p->is_start_play());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_starting_play();
|
||||
EXPECT_TRUE(p->is_starting_play());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_playing();
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_stop_play();
|
||||
EXPECT_TRUE(p->is_stop_play());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_stopped_play();
|
||||
EXPECT_TRUE(p->is_stopped_play());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_start_publish();
|
||||
EXPECT_TRUE(p->is_start_publish());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_starting_publish();
|
||||
EXPECT_TRUE(p->is_starting_publish());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_publishing();
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_stop_publish();
|
||||
EXPECT_TRUE(p->is_stop_publish());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_stopped_publish();
|
||||
EXPECT_TRUE(p->is_stopped_publish());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_finish();
|
||||
EXPECT_TRUE(p->is_finish());
|
||||
srs_freep(p);
|
||||
}
|
||||
if (true) {
|
||||
SrsBandwidthPacket* p = SrsBandwidthPacket::create_final();
|
||||
EXPECT_TRUE(p->is_final());
|
||||
srs_freep(p);
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ProtocolRTMPTest, CoverAllUnmarshal)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue