From 5b6ff0af2749e1af548cf8ae87799caab46fcb6f Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Tue, 11 Jan 2022 14:09:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84mingw=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E7=9A=84=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- src/Common/MediaSource.cpp | 8 -------- src/Common/MediaSource.h | 8 ++++++-- src/Rtp/GB28181Process.cpp | 6 +++--- src/Rtp/GB28181Process.h | 2 +- tests/CMakeLists.txt | 5 +++-- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 86407d4c..dd101bcc 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 86407d4cea8a344cf737082215fe7ffcabaa33b3 +Subproject commit dd101bcc31290e3d1ec1ae939d937f2712719a0d diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index 9de0db48..2e95a324 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -747,14 +747,6 @@ std::shared_ptr MediaSourceEventInterceptor::getDelegate() con /////////////////////////////////////FlushPolicy////////////////////////////////////// -template<> -bool PacketCache::flushImmediatelyWhenCloseMerge() { - //因为rtp的包很小,一个RtpPacket包中也不是完整的一帧图像,所以在关闭合并写时, - //还是有必要缓冲一帧的rtp(也就是时间戳相同的rtp)再输出,这样虽然会增加一帧的延时 - //但是却对性能提升很大,这样做还是比较划算的 - return false; -} - static bool isFlushAble_default(bool is_video, uint64_t last_stamp, uint64_t new_stamp, size_t cache_size) { if (new_stamp + 500 < last_stamp) { //时间戳回退比较大(可能seek中),由于rtp中时间戳是pts,是可能存在一定程度的回退的 diff --git a/src/Common/MediaSource.h b/src/Common/MediaSource.h index 14f0fc64..fe28f232 100644 --- a/src/Common/MediaSource.h +++ b/src/Common/MediaSource.h @@ -376,9 +376,13 @@ private: } bool flushImmediatelyWhenCloseMerge() { - //一般的协议关闭合并写时,立即刷新缓存,这样可以减少一帧的延时,但是rtp例外,请看相应的模板特例化函数 + //一般的协议关闭合并写时,立即刷新缓存,这样可以减少一帧的延时,但是rtp例外 + //因为rtp的包很小,一个RtpPacket包中也不是完整的一帧图像,所以在关闭合并写时, + //还是有必要缓冲一帧的rtp(也就是时间戳相同的rtp)再输出,这样虽然会增加一帧的延时 + //但是却对性能提升很大,这样做还是比较划算的 + GET_CONFIG(int, mergeWriteMS, General::kMergeWriteMS); - return mergeWriteMS <= 0; + return std::is_same::value ? false : (mergeWriteMS <= 0); } private: diff --git a/src/Rtp/GB28181Process.cpp b/src/Rtp/GB28181Process.cpp index 42c955c8..b85f0abc 100644 --- a/src/Rtp/GB28181Process.cpp +++ b/src/Rtp/GB28181Process.cpp @@ -50,10 +50,10 @@ private: /////////////////////////////////////////////////////////////////////////////////////////// -GB28181Process::GB28181Process(const MediaInfo &media_info, MediaSinkInterface *interface) { - assert(interface); +GB28181Process::GB28181Process(const MediaInfo &media_info, MediaSinkInterface *sink) { + assert(sink); _media_info = media_info; - _interface = interface; + _interface = sink; } GB28181Process::~GB28181Process() {} diff --git a/src/Rtp/GB28181Process.h b/src/Rtp/GB28181Process.h index e1a60d5c..01ffea94 100644 --- a/src/Rtp/GB28181Process.h +++ b/src/Rtp/GB28181Process.h @@ -25,7 +25,7 @@ class RtpReceiverImp; class GB28181Process : public ProcessInterface { public: typedef std::shared_ptr Ptr; - GB28181Process(const MediaInfo &media_info, MediaSinkInterface *interface); + GB28181Process(const MediaInfo &media_info, MediaSinkInterface *sink); ~GB28181Process() override; /** diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 01ba99ba..c8cd3bfb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,14 +2,15 @@ aux_source_directory(. TEST_SRC_LIST) foreach (TEST_SRC ${TEST_SRC_LIST}) + get_filename_component(TEST_EXE_NAME ${TEST_SRC} NAME_WE) + if (NOT ENABLE_WEBRTC) # 暂时过滤掉依赖 WebRTC 的测试模块 - if ("${TEST_SRC}" MATCHES "test_rtcp_nack\.cpp") + if ("${TEST_EXE_NAME}" MATCHES "test_rtcp_nack") continue() endif () endif () - get_filename_component(TEST_EXE_NAME ${TEST_SRC} NAME_WE) message(STATUS "add test:${TEST_EXE_NAME}") add_executable(${TEST_EXE_NAME} ${TEST_SRC})