diff --git a/trunk/configure b/trunk/configure index b1313d8c0..ec7220d6b 100755 --- a/trunk/configure +++ b/trunk/configure @@ -200,7 +200,7 @@ MODULE_ID="CORE" MODULE_DEPENDS=() ModuleLibIncs=(${SRS_OBJS_DIR}) MODULE_FILES=("srs_core" "srs_core_version5" "srs_core_autofree" "srs_core_performance" - "srs_core_time") + "srs_core_time" "srs_core_platform") CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . auto/modules.sh CORE_OBJS="${MODULE_OBJS[@]}" # diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index c2e1cce25..675ca7433 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -1626,7 +1626,7 @@ srs_error_t SrsServerAdapter::initialize() return err; } -srs_error_t SrsServerAdapter::run() +srs_error_t SrsServerAdapter::run(SrsWaitGroup* wg) { srs_error_t err = srs_success; @@ -1663,7 +1663,7 @@ srs_error_t SrsServerAdapter::run() return srs_error_wrap(err, "ingest"); } - if ((err = srs->start()) != srs_success) { + if ((err = srs->start(wg)) != srs_success) { return srs_error_wrap(err, "start"); } diff --git a/trunk/src/app/srs_app_server.hpp b/trunk/src/app/srs_app_server.hpp index 44aa62ac2..8e15ab6b0 100644 --- a/trunk/src/app/srs_app_server.hpp +++ b/trunk/src/app/srs_app_server.hpp @@ -343,7 +343,7 @@ public: virtual ~SrsServerAdapter(); public: virtual srs_error_t initialize(); - virtual srs_error_t run(); + virtual srs_error_t run(SrsWaitGroup* wg); virtual void stop(); public: virtual SrsServer* instance(); diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index e40b9c098..d8c1aeeb1 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -32,34 +32,8 @@ #define VERSION_STABLE 4 #define VERSION_STABLE_BRANCH SRS_XSTR(VERSION_STABLE) ".0release" -// For 32bit os, 2G big file limit for unistd io, -// ie. read/write/lseek to use 64bits size for huge file. -#ifndef _FILE_OFFSET_BITS - #define _FILE_OFFSET_BITS 64 -#endif - -// For int64_t print using PRId64 format. -#ifndef __STDC_FORMAT_MACROS - #define __STDC_FORMAT_MACROS -#endif - -// For RTC/FFMPEG build. -#if defined(SRS_RTC) && !defined(__STDC_CONSTANT_MACROS) - #define __STDC_CONSTANT_MACROS -#endif - -// For srs-librtmp, @see https://github.com/ossrs/srs/issues/213 -#ifndef _WIN32 -#include -#endif - -#include -#ifndef srs_assert -#define srs_assert(expression) assert(expression) -#endif - -#include -#include +// For platform specified headers and defines. +#include // The time unit for timeout, interval or duration. #include diff --git a/trunk/src/core/srs_core_platform.cpp b/trunk/src/core/srs_core_platform.cpp new file mode 100644 index 000000000..1da0af075 --- /dev/null +++ b/trunk/src/core/srs_core_platform.cpp @@ -0,0 +1,8 @@ +// +// Copyright (c) 2013-2021 The SRS Authors +// +// SPDX-License-Identifier: MIT +// + +#include + diff --git a/trunk/src/core/srs_core_platform.hpp b/trunk/src/core/srs_core_platform.hpp new file mode 100644 index 000000000..c55f8e452 --- /dev/null +++ b/trunk/src/core/srs_core_platform.hpp @@ -0,0 +1,45 @@ +// +// Copyright (c) 2013-2021 The SRS Authors +// +// SPDX-License-Identifier: MIT +// + +#ifndef SRS_CORE_PLATFORM_HPP +#define SRS_CORE_PLATFORM_HPP + +// For 32bit os, 2G big file limit for unistd io, +// ie. read/write/lseek to use 64bits size for huge file. +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif + +// For int64_t print using PRId64 format. +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif + +// For RTC/FFMPEG build. +#if defined(SRS_RTC) && !defined(__STDC_CONSTANT_MACROS) +#define __STDC_CONSTANT_MACROS +#endif + +// For srs-librtmp, @see https://github.com/ossrs/srs/issues/213 +#ifndef _WIN32 +#include +#endif + +#include +#ifndef srs_assert +#define srs_assert(expression) assert(expression) +#endif + +#include +#include + +// For CentOS 6 or C++98, @see https://github.com/ossrs/srs/issues/2815 +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif + diff --git a/trunk/src/kernel/srs_kernel_rtc_rtcp.cpp b/trunk/src/kernel/srs_kernel_rtc_rtcp.cpp index dd4fdcfaf..647f5dd19 100644 --- a/trunk/src/kernel/srs_kernel_rtc_rtcp.cpp +++ b/trunk/src/kernel/srs_kernel_rtc_rtcp.cpp @@ -1010,7 +1010,7 @@ srs_error_t SrsRtcpTWCC::process_pkt_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk& chunk, size_t needed_chunk_size = chunk.size == 0 ? kTwccFbChunkBytes : 0; size_t might_occupied = pkt_len + needed_chunk_size + delta_size; - if (might_occupied > kRtcpPacketSize) { + if (might_occupied > (size_t)kRtcpPacketSize) { return srs_error_new(ERROR_RTC_RTCP, "might_occupied %zu", might_occupied); }