From 3f5ab8dc63e4d76b269b1e0bc86fc9de7d3fb665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=98=E7=AF=B1?= Date: Sun, 17 May 2020 00:03:14 +0800 Subject: [PATCH] RTC: Add utest for srs_rtp_seq_distance --- trunk/auto/options.sh | 3 +- trunk/configure | 2 +- trunk/src/app/srs_app_rtc_queue.cpp | 4 +- trunk/src/app/srs_app_rtc_queue.hpp | 13 +-- trunk/src/kernel/srs_kernel_rtc_rtcp.hpp | 1 - trunk/src/kernel/srs_kernel_rtc_rtp.hpp | 1 + trunk/src/service/srs_service_http_conn.cpp | 5 +- trunk/src/service/srs_service_utility.cpp | 28 +++++- trunk/src/service/srs_service_utility.hpp | 2 +- trunk/src/utest/srs_utest_protocol.cpp | 30 +++--- trunk/src/utest/srs_utest_rtc.cpp | 104 ++++++++++++++++++++ trunk/src/utest/srs_utest_rtc.hpp | 33 +++++++ trunk/src/utest/srs_utest_service.cpp | 18 ++-- 13 files changed, 206 insertions(+), 38 deletions(-) create mode 100644 trunk/src/utest/srs_utest_rtc.cpp create mode 100644 trunk/src/utest/srs_utest_rtc.hpp diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 704ec5ad7..815dda937 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -134,7 +134,7 @@ function show_help() { Presets: --x86-64, --x86-x64 [default] For x86/x64 cpu, common pc and servers. --arm Enable crossbuild for ARM, should also set bellow toolchain options. - --mips Enable crossbuild for MIPS + --osx Enable build for OSX/Darwin AppleOS. Features: -h, --help Print this message and exit 0. @@ -175,7 +175,6 @@ Performance: @see https://blog.csdn.net/win_lin/article/details/5 Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuecomment-576078411 --static Whether add '-static' to link options. --arm Enable crossbuild for ARM. - --mips Enable crossbuild for MIPS. --cc= Use c compiler CC, default is gcc. --cxx= Use c++ compiler CXX, default is g++. --ar= Use archive tool AR, default is ar. diff --git a/trunk/configure b/trunk/configure index b9918850e..f18bdb230 100755 --- a/trunk/configure +++ b/trunk/configure @@ -407,7 +407,7 @@ fi if [ $SRS_UTEST = YES ]; then MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol" "srs_utest_kernel" "srs_utest_core" "srs_utest_config" "srs_utest_rtmp" "srs_utest_http" "srs_utest_avc" "srs_utest_reload" - "srs_utest_mp4" "srs_utest_service" "srs_utest_app") + "srs_utest_mp4" "srs_utest_service" "srs_utest_app" "srs_utest_rtc") ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibSSLRoot}) if [[ $SRS_RTC == YES ]]; then ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot}) diff --git a/trunk/src/app/srs_app_rtc_queue.cpp b/trunk/src/app/srs_app_rtc_queue.cpp index 1f0e51cf4..577af40ed 100644 --- a/trunk/src/app/srs_app_rtc_queue.cpp +++ b/trunk/src/app/srs_app_rtc_queue.cpp @@ -151,8 +151,8 @@ SrsRtpNackInfo::SrsRtpNackInfo() req_nack_count_ = 0; } -bool SrsRtpNackForReceiver::SeqComp::operator()(const uint16_t& low, const uint16_t& high) const { - return srs_rtp_seq_distance(low, high) > 0; +bool SrsRtpNackForReceiver::SeqComp::operator()(const uint16_t& pre_value, const uint16_t& value) const { + return srs_rtp_seq_distance(pre_value, value) > 0; } SrsRtpNackForReceiver::SrsRtpNackForReceiver(SrsRtpRingBuffer* rtp, size_t queue_size) diff --git a/trunk/src/app/srs_app_rtc_queue.hpp b/trunk/src/app/srs_app_rtc_queue.hpp index 55cea88a6..420db6338 100644 --- a/trunk/src/app/srs_app_rtc_queue.hpp +++ b/trunk/src/app/srs_app_rtc_queue.hpp @@ -35,13 +35,14 @@ class SrsRtpQueue; class SrsRtpRingBuffer; // The "distance" between two uint16 number, for example: -// distance(low=3, high=5) === (int16_t)(uint16_t)((uint16_t)3-(uint16_t)5) === -2 -// distance(low=3, high=65534) === (int16_t)(uint16_t)((uint16_t)3-(uint16_t)65534) === 5 -// distance(low=65532, high=65534) === (int16_t)(uint16_t)((uint16_t)65532-(uint16_t)65534) === -2 +// distance(prev_value=3, value=5) === (int16_t)(uint16_t)((uint16_t)3-(uint16_t)5) === -2 +// distance(prev_value=3, value=65534) === (int16_t)(uint16_t)((uint16_t)3-(uint16_t)65534) === 5 +// distance(prev_value=65532, value=65534) === (int16_t)(uint16_t)((uint16_t)65532-(uint16_t)65534) === -2 // For RTP sequence, it's only uint16 and may flip back, so 3 maybe 3+0xffff. -inline int16_t srs_rtp_seq_distance(const uint16_t& low, const uint16_t& high) +// @see https://mp.weixin.qq.com/s/JZTInmlB9FUWXBQw_7NYqg +inline int16_t srs_rtp_seq_distance(const uint16_t& prev_value, const uint16_t& value) { - return (int16_t)(high - low); + return (int16_t)(value - prev_value); } // For UDP, the packets sequence may present as bellow: @@ -123,7 +124,7 @@ class SrsRtpNackForReceiver { private: struct SeqComp { - bool operator()(const uint16_t& low, const uint16_t& high) const; + bool operator()(const uint16_t& pre_value, const uint16_t& value) const; }; private: // Nack queue, seq order, oldest to newest. diff --git a/trunk/src/kernel/srs_kernel_rtc_rtcp.hpp b/trunk/src/kernel/srs_kernel_rtc_rtcp.hpp index 4b215aee4..4f69e23d7 100644 --- a/trunk/src/kernel/srs_kernel_rtc_rtcp.hpp +++ b/trunk/src/kernel/srs_kernel_rtc_rtcp.hpp @@ -48,7 +48,6 @@ enum SrsRtcpType { SrsRtcpType_xr = 207, }; - // RTCP Header, @see http://tools.ietf.org/html/rfc3550#section-6.1 struct SrsRtcpHeader { diff --git a/trunk/src/kernel/srs_kernel_rtc_rtp.hpp b/trunk/src/kernel/srs_kernel_rtc_rtp.hpp index b84a5531c..ec17cd6b1 100644 --- a/trunk/src/kernel/srs_kernel_rtc_rtp.hpp +++ b/trunk/src/kernel/srs_kernel_rtc_rtp.hpp @@ -59,6 +59,7 @@ class SrsRtpFUAPayload2; class SrsSharedPtrMessage; // TODO: FIXME: Merge with srs_rtp_seq_distance +// @see https://mp.weixin.qq.com/s/JZTInmlB9FUWXBQw_7NYqg bool SrsSeqIsNewer(uint16_t current_sn, uint16_t last_sn); bool SrsSeqIsRoolback(uint16_t current_sn, uint16_t last_sn); int32_t SrsSeqDistance(uint16_t current_sn, uint16_t last_sn); diff --git a/trunk/src/service/srs_service_http_conn.cpp b/trunk/src/service/srs_service_http_conn.cpp index d28e7b724..854872318 100644 --- a/trunk/src/service/srs_service_http_conn.cpp +++ b/trunk/src/service/srs_service_http_conn.cpp @@ -350,9 +350,12 @@ srs_error_t SrsHttpMessage::set_url(string url, bool allow_jsonp) // use server public ip when host not specified. // to make telnet happy. std::string host = _header.get("Host"); + + // If no host in header, we use local discovered IP, IPv4 first. if (host.empty()) { - host= srs_get_public_internet_address(); + host = srs_get_public_internet_address(true); } + if (!host.empty()) { uri = "http://" + host + _url; } diff --git a/trunk/src/service/srs_service_utility.cpp b/trunk/src/service/srs_service_utility.cpp index 25ce3b08c..51ae86ecb 100644 --- a/trunk/src/service/srs_service_utility.cpp +++ b/trunk/src/service/srs_service_utility.cpp @@ -139,6 +139,26 @@ bool srs_net_device_is_internet(const sockaddr* addr) if (IN6_IS_ADDR_SITELOCAL(&a6->sin6_addr)) { return false; } + + // Others. + if (IN6_IS_ADDR_MULTICAST(&a6->sin6_addr)) { + return false; + } + if (IN6_IS_ADDR_MC_NODELOCAL(&a6->sin6_addr)) { + return false; + } + if (IN6_IS_ADDR_MC_LINKLOCAL(&a6->sin6_addr)) { + return false; + } + if (IN6_IS_ADDR_MC_SITELOCAL(&a6->sin6_addr)) { + return false; + } + if (IN6_IS_ADDR_MC_ORGLOCAL(&a6->sin6_addr)) { + return false; + } + if (IN6_IS_ADDR_MC_GLOBAL(&a6->sin6_addr)) { + return false; + } } return true; @@ -287,7 +307,7 @@ vector& srs_get_local_ips() std::string _public_internet_address; -string srs_get_public_internet_address() +string srs_get_public_internet_address(bool ipv4_only) { if (!_public_internet_address.empty()) { return _public_internet_address; @@ -301,6 +321,9 @@ string srs_get_public_internet_address() if (!ip->is_internet) { continue; } + if (ipv4_only && !ip->is_ipv4) { + continue; + } srs_warn("use public address as ip: %s, ifname=%s", ip->ip.c_str(), ip->ifname.c_str()); _public_internet_address = ip->ip; @@ -313,6 +336,9 @@ string srs_get_public_internet_address() if (ip->is_loopback) { continue; } + if (ipv4_only && !ip->is_ipv4) { + continue; + } srs_warn("use private address as ip: %s, ifname=%s", ip->ip.c_str(), ip->ifname.c_str()); _public_internet_address = ip->ip; diff --git a/trunk/src/service/srs_service_utility.hpp b/trunk/src/service/srs_service_utility.hpp index 2a53ee5e4..f6c9ccf1b 100644 --- a/trunk/src/service/srs_service_utility.hpp +++ b/trunk/src/service/srs_service_utility.hpp @@ -67,7 +67,7 @@ struct SrsIPAddress extern std::vector& srs_get_local_ips(); // Get local public ip, empty string if no public internet address found. -extern std::string srs_get_public_internet_address(); +extern std::string srs_get_public_internet_address(bool ipv4_only = false); // Detect whether specified device is internet public address. extern bool srs_net_device_is_internet(std::string ifname); diff --git a/trunk/src/utest/srs_utest_protocol.cpp b/trunk/src/utest/srs_utest_protocol.cpp index ebd260aa1..86e901b84 100644 --- a/trunk/src/utest/srs_utest_protocol.cpp +++ b/trunk/src/utest/srs_utest_protocol.cpp @@ -5999,15 +5999,17 @@ VOID TEST(ProtocolHTTPTest, HTTPParser) VOID TEST(ProtocolHTTPTest, ParseHTTPMessage) { + srs_error_t err = srs_success; + if (true) { MockBufferIO bio; SrsHttpParser hp; bio.append("GET /gslb/v1/versions HTTP/1.1\r\nContent-Length: 5\r\n\r\nHello"); - EXPECT_TRUE(0 == hp.initialize(HTTP_REQUEST, false)); + HELPER_ASSERT_SUCCESS(hp.initialize(HTTP_REQUEST, false)); ISrsHttpMessage* req = NULL; - ASSERT_TRUE(0 == hp.parse_message(&bio, &req)); + HELPER_ASSERT_SUCCESS(hp.parse_message(&bio, &req)); // We should read body, or next parsing message will fail. // @see https://github.com/ossrs/srs/issues/1181 @@ -6019,7 +6021,7 @@ VOID TEST(ProtocolHTTPTest, ParseHTTPMessage) // Should fail because there is body which not read. // @see https://github.com/ossrs/srs/issues/1181 - ASSERT_FALSE(0 == hp.parse_message(&bio, &req)); + HELPER_ASSERT_FAILED(hp.parse_message(&bio, &req)); srs_freep(req); } @@ -6028,11 +6030,11 @@ VOID TEST(ProtocolHTTPTest, ParseHTTPMessage) SrsHttpParser hp; bio.append("GET"); - EXPECT_TRUE(0 == hp.initialize(HTTP_REQUEST, false)); + HELPER_ASSERT_SUCCESS(hp.initialize(HTTP_REQUEST, false)); // Should fail if not completed message. ISrsHttpMessage* req = NULL; - ASSERT_FALSE(0 == hp.parse_message(&bio, &req)); + HELPER_ASSERT_FAILED(hp.parse_message(&bio, &req)); srs_freep(req); } @@ -6041,14 +6043,14 @@ VOID TEST(ProtocolHTTPTest, ParseHTTPMessage) SrsHttpParser hp; bio.append("GET /gslb/v1/versions HTTP/1.1\r\nContent-Length: 5\r\n\r\nHello"); - ASSERT_TRUE(0 == hp.initialize(HTTP_REQUEST, false)); + HELPER_ASSERT_SUCCESS(hp.initialize(HTTP_REQUEST, false)); ISrsHttpMessage* req = NULL; SrsAutoFree(ISrsHttpMessage, req); - ASSERT_TRUE(0 == hp.parse_message(&bio, &req)); + HELPER_ASSERT_SUCCESS(hp.parse_message(&bio, &req)); char v[64] = {0}; - EXPECT_TRUE(0 == req->body_reader()->read(v, sizeof(v), NULL)); + HELPER_ASSERT_SUCCESS(req->body_reader()->read(v, sizeof(v), NULL)); EXPECT_TRUE(string("Hello") == string(v)); EXPECT_TRUE(req->body_reader()->eof()); @@ -6059,11 +6061,11 @@ VOID TEST(ProtocolHTTPTest, ParseHTTPMessage) SrsHttpParser hp; bio.append("GET /gslb/v1/versions HTTP/1.1\r\nContent-Length: 0\r\n\r\n"); - ASSERT_TRUE(0 == hp.initialize(HTTP_REQUEST, false)); + HELPER_ASSERT_SUCCESS(hp.initialize(HTTP_REQUEST, false)); ISrsHttpMessage* req = NULL; SrsAutoFree(ISrsHttpMessage, req); - EXPECT_TRUE(0 == hp.parse_message(&bio, &req)); + HELPER_ASSERT_SUCCESS(hp.parse_message(&bio, &req)); } if (true) { @@ -6071,11 +6073,11 @@ VOID TEST(ProtocolHTTPTest, ParseHTTPMessage) SrsHttpParser hp; bio.append("GET /gslb/v1/versions HTTP/1.1\r\n\r\n"); - ASSERT_TRUE(0 == hp.initialize(HTTP_REQUEST, false)); + HELPER_ASSERT_SUCCESS(hp.initialize(HTTP_REQUEST, false)); ISrsHttpMessage* req = NULL; SrsAutoFree(ISrsHttpMessage, req); - EXPECT_TRUE(0 == hp.parse_message(&bio, &req)); + HELPER_ASSERT_SUCCESS(hp.parse_message(&bio, &req)); } if (true) { @@ -6083,11 +6085,11 @@ VOID TEST(ProtocolHTTPTest, ParseHTTPMessage) SrsHttpParser hp; bio.append("GET /gslb/v1/versions HTTP/1.1\r\n\r\n"); - ASSERT_TRUE(0 == hp.initialize(HTTP_REQUEST, false)); + HELPER_ASSERT_SUCCESS(hp.initialize(HTTP_REQUEST, false)); ISrsHttpMessage* req = NULL; SrsAutoFree(ISrsHttpMessage, req); - EXPECT_TRUE(0 == hp.parse_message(&bio, &req)); + HELPER_ASSERT_SUCCESS(hp.parse_message(&bio, &req)); } } diff --git a/trunk/src/utest/srs_utest_rtc.cpp b/trunk/src/utest/srs_utest_rtc.cpp new file mode 100644 index 000000000..872c9ddb5 --- /dev/null +++ b/trunk/src/utest/srs_utest_rtc.cpp @@ -0,0 +1,104 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2020 Winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +#include + +#include +#include +#include +#include + +VOID TEST(KernelRTCTest, SequenceCompare) +{ + if (true) { + EXPECT_EQ(0, srs_rtp_seq_distance(0, 0)); + EXPECT_EQ(0, srs_rtp_seq_distance(1, 1)); + EXPECT_EQ(0, srs_rtp_seq_distance(3, 3)); + + EXPECT_EQ(1, srs_rtp_seq_distance(0, 1)); + EXPECT_EQ(-1, srs_rtp_seq_distance(1, 0)); + EXPECT_EQ(1, srs_rtp_seq_distance(65535, 0)); + } + + if (true) { + EXPECT_FALSE(srs_rtp_seq_distance(1, 1) > 0); + EXPECT_TRUE(srs_rtp_seq_distance(65534, 65535) > 0); + EXPECT_TRUE(srs_rtp_seq_distance(0, 1) > 0); + EXPECT_TRUE(srs_rtp_seq_distance(255, 256) > 0); + + EXPECT_TRUE(srs_rtp_seq_distance(65535, 0) > 0); + EXPECT_TRUE(srs_rtp_seq_distance(65280, 0) > 0); + EXPECT_TRUE(srs_rtp_seq_distance(65535, 255) > 0); + EXPECT_TRUE(srs_rtp_seq_distance(65280, 255) > 0); + + EXPECT_FALSE(srs_rtp_seq_distance(0, 65535) > 0); + EXPECT_FALSE(srs_rtp_seq_distance(0, 65280) > 0); + EXPECT_FALSE(srs_rtp_seq_distance(255, 65535) > 0); + EXPECT_FALSE(srs_rtp_seq_distance(255, 65280) > 0); + + // Note that it's TRUE at https://mp.weixin.qq.com/s/JZTInmlB9FUWXBQw_7NYqg + EXPECT_FALSE(srs_rtp_seq_distance(0, 32768) > 0); + // It's FALSE definitely. + EXPECT_FALSE(srs_rtp_seq_distance(32768, 0) > 0); + } + + if (true) { + EXPECT_FALSE(SrsSeqIsNewer(1, 1)); + EXPECT_TRUE(SrsSeqIsNewer(65535, 65534)); + EXPECT_TRUE(SrsSeqIsNewer(1, 0)); + EXPECT_TRUE(SrsSeqIsNewer(256, 255)); + + EXPECT_TRUE(SrsSeqIsNewer(0, 65535)); + EXPECT_TRUE(SrsSeqIsNewer(0, 65280)); + EXPECT_TRUE(SrsSeqIsNewer(255, 65535)); + EXPECT_TRUE(SrsSeqIsNewer(255, 65280)); + + EXPECT_FALSE(SrsSeqIsNewer(65535, 0)); + EXPECT_FALSE(SrsSeqIsNewer(65280, 0)); + EXPECT_FALSE(SrsSeqIsNewer(65535, 255)); + EXPECT_FALSE(SrsSeqIsNewer(65280, 255)); + + EXPECT_TRUE(SrsSeqIsNewer(32768, 0)); + EXPECT_FALSE(SrsSeqIsNewer(0, 32768)); + } + + if (true) { + EXPECT_FALSE(SrsSeqDistance(1, 1) > 0); + EXPECT_TRUE(SrsSeqDistance(65535, 65534) > 0); + EXPECT_TRUE(SrsSeqDistance(1, 0) > 0); + EXPECT_TRUE(SrsSeqDistance(256, 255) > 0); + + EXPECT_TRUE(SrsSeqDistance(0, 65535) > 0); + EXPECT_TRUE(SrsSeqDistance(0, 65280) > 0); + EXPECT_TRUE(SrsSeqDistance(255, 65535) > 0); + EXPECT_TRUE(SrsSeqDistance(255, 65280) > 0); + + EXPECT_FALSE(SrsSeqDistance(65535, 0) > 0); + EXPECT_FALSE(SrsSeqDistance(65280, 0) > 0); + EXPECT_FALSE(SrsSeqDistance(65535, 255) > 0); + EXPECT_FALSE(SrsSeqDistance(65280, 255) > 0); + + EXPECT_TRUE(SrsSeqDistance(32768, 0) > 0); + EXPECT_FALSE(SrsSeqDistance(0, 32768) > 0); + } +} + diff --git a/trunk/src/utest/srs_utest_rtc.hpp b/trunk/src/utest/srs_utest_rtc.hpp new file mode 100644 index 000000000..4fa39fbb8 --- /dev/null +++ b/trunk/src/utest/srs_utest_rtc.hpp @@ -0,0 +1,33 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2020 Winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef SRS_UTEST_RTC_HPP +#define SRS_UTEST_RTC_HPP + +/* +#include +*/ +#include + +#endif + diff --git a/trunk/src/utest/srs_utest_service.cpp b/trunk/src/utest/srs_utest_service.cpp index 9bfef5084..3e7d8b85d 100644 --- a/trunk/src/utest/srs_utest_service.cpp +++ b/trunk/src/utest/srs_utest_service.cpp @@ -110,7 +110,7 @@ VOID TEST(TCPServerTest, PingPong) SrsTcpClient c(_srs_tmp_host, _srs_tmp_port, _srs_tmp_timeout); HELPER_EXPECT_SUCCESS(c.connect()); - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); EXPECT_TRUE(h.fd != NULL); } @@ -123,7 +123,7 @@ VOID TEST(TCPServerTest, PingPong) HELPER_EXPECT_SUCCESS(c.connect()); SrsStSocket skt; - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); #ifdef SRS_OSX ASSERT_TRUE(h.fd != NULL); #endif @@ -145,7 +145,7 @@ VOID TEST(TCPServerTest, PingPong) HELPER_EXPECT_SUCCESS(c.connect()); SrsStSocket skt; - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); #ifdef SRS_OSX ASSERT_TRUE(h.fd != NULL); #endif @@ -169,7 +169,7 @@ VOID TEST(TCPServerTest, PingPong) HELPER_EXPECT_SUCCESS(c.connect()); SrsStSocket skt; - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); #ifdef SRS_OSX ASSERT_TRUE(h.fd != NULL); #endif @@ -204,7 +204,7 @@ VOID TEST(TCPServerTest, PingPongWithTimeout) HELPER_EXPECT_SUCCESS(c.connect()); SrsStSocket skt; - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); #ifdef SRS_OSX ASSERT_TRUE(h.fd != NULL); #endif @@ -226,7 +226,7 @@ VOID TEST(TCPServerTest, PingPongWithTimeout) HELPER_EXPECT_SUCCESS(c.connect()); SrsStSocket skt; - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); #ifdef SRS_OSX ASSERT_TRUE(h.fd != NULL); #endif @@ -248,7 +248,7 @@ VOID TEST(TCPServerTest, PingPongWithTimeout) HELPER_EXPECT_SUCCESS(c.connect()); SrsStSocket skt; - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); #ifdef SRS_OSX ASSERT_TRUE(h.fd != NULL); #endif @@ -428,7 +428,7 @@ VOID TEST(TCPServerTest, WritevIOVC) HELPER_EXPECT_SUCCESS(c.connect()); SrsStSocket skt; - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); #ifdef SRS_OSX ASSERT_TRUE(h.fd != NULL); #endif @@ -458,7 +458,7 @@ VOID TEST(TCPServerTest, WritevIOVC) HELPER_EXPECT_SUCCESS(c.connect()); SrsStSocket skt; - srs_usleep(100 * SRS_UTIME_MILLISECONDS); + srs_usleep(30 * SRS_UTIME_MILLISECONDS); #ifdef SRS_OSX ASSERT_TRUE(h.fd != NULL); #endif