Unverified 提交 c0e3a623 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

Avoid abseil containers with SeqManager compare functions (#1369)

上级 1a507ecc
...@@ -42,6 +42,7 @@ jobs: ...@@ -42,6 +42,7 @@ jobs:
env: env:
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true' MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true' MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: 'Release'
steps: steps:
- name: Checkout repository - name: Checkout repository
......
...@@ -29,12 +29,16 @@ jobs: ...@@ -29,12 +29,16 @@ jobs:
node: 20 node: 20
- os: windows-2022 - os: windows-2022
node: 20 node: 20
build-type:
- Release
- Debug
runs-on: ${{ matrix.ci.os }} runs-on: ${{ matrix.ci.os }}
env: env:
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true' MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true' MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: ${{ matrix.build-type }}
steps: steps:
- name: Checkout - name: Checkout
......
...@@ -49,8 +49,12 @@ jobs: ...@@ -49,8 +49,12 @@ jobs:
- name: cargo clippy - name: cargo clippy
run: cargo clippy --all-targets -- -D warnings run: cargo clippy --all-targets -- -D warnings
# NOTE: In Windows this will build and test libmediasoupworker in release
# mode twice since build.rs doesn't allow debug mode for Windows.
- name: cargo test - name: cargo test
run: cargo test --verbose run: |
cargo test --verbose
cargo test --release --verbose
- name: cargo doc - name: cargo doc
run: cargo doc --locked --all --no-deps --lib run: cargo doc --locked --all --no-deps --lib
......
...@@ -20,6 +20,9 @@ jobs: ...@@ -20,6 +20,9 @@ jobs:
cc: clang cc: clang
cxx: clang++ cxx: clang++
arch: arm64 arch: arm64
build-type:
- Release
- Debug
runs-on: ${{ matrix.build.os }} runs-on: ${{ matrix.build.os }}
...@@ -28,6 +31,7 @@ jobs: ...@@ -28,6 +31,7 @@ jobs:
CXX: ${{ matrix.build.cxx }} CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true' MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true' MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: ${{ matrix.build-type }}
steps: steps:
- name: Checkout - name: Checkout
......
...@@ -51,6 +51,7 @@ jobs: ...@@ -51,6 +51,7 @@ jobs:
CXX: ${{ matrix.build.cxx }} CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true' MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true' MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: 'Release'
steps: steps:
- name: Checkout - name: Checkout
......
...@@ -53,6 +53,9 @@ jobs: ...@@ -53,6 +53,9 @@ jobs:
# A single Node.js version should be fine for C++. # A single Node.js version should be fine for C++.
node: node:
- 20 - 20
build-type:
- Release
- Debug
runs-on: ${{ matrix.build.os }} runs-on: ${{ matrix.build.os }}
...@@ -61,6 +64,7 @@ jobs: ...@@ -61,6 +64,7 @@ jobs:
CXX: ${{ matrix.build.cxx }} CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true' MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true' MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: ${{ matrix.build-type }}
steps: steps:
- name: Checkout - name: Checkout
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#include "RTC/RtpPacket.hpp" #include "RTC/RtpPacket.hpp"
#include "RTC/SeqManager.hpp" #include "RTC/SeqManager.hpp"
#include "handles/TimerHandle.hpp" #include "handles/TimerHandle.hpp"
#include <absl/container/btree_map.h>
#include <absl/container/btree_set.h>
#include <map> #include <map>
#include <set> #include <set>
#include <vector> #include <vector>
...@@ -80,9 +78,9 @@ namespace RTC ...@@ -80,9 +78,9 @@ namespace RTC
// Allocated by this. // Allocated by this.
TimerHandle* timer{ nullptr }; TimerHandle* timer{ nullptr };
// Others. // Others.
absl::btree_map<uint16_t, NackInfo, RTC::SeqManager<uint16_t>::SeqLowerThan> nackList; std::map<uint16_t, NackInfo, RTC::SeqManager<uint16_t>::SeqLowerThan> nackList;
absl::btree_set<uint16_t, RTC::SeqManager<uint16_t>::SeqLowerThan> keyFrameList; std::set<uint16_t, RTC::SeqManager<uint16_t>::SeqLowerThan> keyFrameList;
absl::btree_set<uint16_t, RTC::SeqManager<uint16_t>::SeqLowerThan> recoveredList; std::set<uint16_t, RTC::SeqManager<uint16_t>::SeqLowerThan> recoveredList;
bool started{ false }; bool started{ false };
uint16_t lastSeq{ 0u }; // Seq number of last valid packet. uint16_t lastSeq{ 0u }; // Seq number of last valid packet.
uint32_t rtt{ 0u }; // Round trip time (ms). uint32_t rtt{ 0u }; // Round trip time (ms).
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "RTC/RateCalculator.hpp" #include "RTC/RateCalculator.hpp"
#include "RTC/SeqManager.hpp" #include "RTC/SeqManager.hpp"
#include "RTC/TrendCalculator.hpp" #include "RTC/TrendCalculator.hpp"
#include <absl/container/btree_map.h>
#include <map> #include <map>
namespace RTC namespace RTC
...@@ -103,7 +102,7 @@ namespace RTC ...@@ -103,7 +102,7 @@ namespace RTC
uint32_t initialAvailableBitrate{ 0u }; uint32_t initialAvailableBitrate{ 0u };
uint32_t availableBitrate{ 0u }; uint32_t availableBitrate{ 0u };
uint64_t lastAvailableBitrateEventAtMs{ 0u }; uint64_t lastAvailableBitrateEventAtMs{ 0u };
absl::btree_map<uint16_t, SentInfo, RTC::SeqManager<uint16_t>::SeqLowerThan> sentInfos; std::map<uint16_t, SentInfo, RTC::SeqManager<uint16_t>::SeqLowerThan> sentInfos;
float rtt{ 0 }; // Round trip time in ms. float rtt{ 0 }; // Round trip time in ms.
CummulativeResult cummulativeResult; CummulativeResult cummulativeResult;
CummulativeResult probationCummulativeResult; CummulativeResult probationCummulativeResult;
......
...@@ -106,6 +106,8 @@ namespace RTC ...@@ -106,6 +106,8 @@ namespace RTC
absl::flat_hash_map<std::string, RTC::WebRtcTransport*> mapLocalIceUsernameFragmentWebRtcTransport; absl::flat_hash_map<std::string, RTC::WebRtcTransport*> mapLocalIceUsernameFragmentWebRtcTransport;
// Map of WebRtcTransports indexed by TransportTuple.hash. // Map of WebRtcTransports indexed by TransportTuple.hash.
absl::flat_hash_map<uint64_t, RTC::WebRtcTransport*> mapTupleWebRtcTransport; absl::flat_hash_map<uint64_t, RTC::WebRtcTransport*> mapTupleWebRtcTransport;
// Whether the destructor has been called.
bool closing{ false };
}; };
} // namespace RTC } // namespace RTC
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "Logger.hpp" #include "Logger.hpp"
#include "MediaSoupErrors.hpp" #include "MediaSoupErrors.hpp"
#include "RTC/RtpDictionaries.hpp" #include "RTC/RtpDictionaries.hpp"
#include <absl/container/btree_map.h>
#include <cmath> // std::lround() #include <cmath> // std::lround()
namespace RTC namespace RTC
......
...@@ -232,6 +232,8 @@ namespace RTC ...@@ -232,6 +232,8 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
this->closing = true;
this->shared->channelMessageRegistrator->UnregisterHandler(this->id); this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
for (auto& item : this->udpSocketOrTcpServers) for (auto& item : this->udpSocketOrTcpServers)
...@@ -497,8 +499,15 @@ namespace RTC ...@@ -497,8 +499,15 @@ namespace RTC
this->webRtcTransports.find(webRtcTransport) != this->webRtcTransports.end(), this->webRtcTransports.find(webRtcTransport) != this->webRtcTransports.end(),
"WebRtcTransport not handled"); "WebRtcTransport not handled");
// NOTE: If WebRtcServer is closing then do not remove the transport from
// the set since it would modify the set while the WebRtcServer destructor
// is iterating it.
// See: https://github.com/versatica/mediasoup/pull/1369#issuecomment-2044672247
if (!this->closing)
{
this->webRtcTransports.erase(webRtcTransport); this->webRtcTransports.erase(webRtcTransport);
} }
}
inline void WebRtcServer::OnWebRtcTransportLocalIceUsernameFragmentAdded( inline void WebRtcServer::OnWebRtcTransportLocalIceUsernameFragmentAdded(
RTC::WebRtcTransport* webRtcTransport, const std::string& usernameFragment) RTC::WebRtcTransport* webRtcTransport, const std::string& usernameFragment)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论