Unverified 提交 b986e21e authored 作者: José Luis Millán's avatar José Luis Millán 提交者: GitHub

LibUring: Enable liburing usage for SCTP data delivery (#1249)

liburing: Enable liburing usage for SCTP data delivery
上级 bf57b8a4
# Changelog # Changelog
### Next
* LibUring: Enable liburing usage for SCTP data delivery ([PR 1249](https://github.com/versatica/mediasoup/pull/1249)).
### 3.13.7 ### 3.13.7
* Update worker dependencies ([PR #1201](https://github.com/versatica/mediasoup/pull/1201)): * Update worker dependencies ([PR #1201](https://github.com/versatica/mediasoup/pull/1201)):
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
// #define MS_LOG_DEV_LEVEL 3 // #define MS_LOG_DEV_LEVEL 3
#include "DepUsrSCTP.hpp" #include "DepUsrSCTP.hpp"
#ifdef MS_LIBURING_SUPPORTED
#include "DepLibUring.hpp"
#endif
#include "DepLibUV.hpp" #include "DepLibUV.hpp"
#include "Logger.hpp" #include "Logger.hpp"
#include <usrsctp.h> #include <usrsctp.h>
...@@ -249,7 +252,21 @@ void DepUsrSCTP::Checker::OnTimer(TimerHandle* /*timer*/) ...@@ -249,7 +252,21 @@ void DepUsrSCTP::Checker::OnTimer(TimerHandle* /*timer*/)
auto nowMs = DepLibUV::GetTimeMs(); auto nowMs = DepLibUV::GetTimeMs();
const int elapsedMs = this->lastCalledAtMs ? static_cast<int>(nowMs - this->lastCalledAtMs) : 0; const int elapsedMs = this->lastCalledAtMs ? static_cast<int>(nowMs - this->lastCalledAtMs) : 0;
#ifdef MS_LIBURING_SUPPORTED
// Activate liburing usage.
// 'usrsctp_handle_timers()' will synchronously call the send/recv
// callbacks for the pending data. If there are multiple messages to be
// sent over the network then we will send those messages within a single
// system call.
DepLibUring::SetActive();
#endif
usrsctp_handle_timers(elapsedMs); usrsctp_handle_timers(elapsedMs);
#ifdef MS_LIBURING_SUPPORTED
// Submit all prepared submission entries.
DepLibUring::Submit();
#endif
this->lastCalledAtMs = nowMs; this->lastCalledAtMs = nowMs;
} }
...@@ -921,10 +921,25 @@ namespace RTC ...@@ -921,10 +921,25 @@ namespace RTC
auto& dataConsumers = this->mapDataProducerDataConsumers.at(dataProducer); auto& dataConsumers = this->mapDataProducerDataConsumers.at(dataProducer);
if (!dataConsumers.empty())
{
#ifdef MS_LIBURING_SUPPORTED
// Activate liburing usage.
// The effective sending could be synchronous, thus we would send those
// messages within a single system call.
DepLibUring::SetActive();
#endif
for (auto* dataConsumer : dataConsumers) for (auto* dataConsumer : dataConsumers)
{ {
dataConsumer->SendMessage(msg, len, ppid, subchannels, requiredSubchannel); dataConsumer->SendMessage(msg, len, ppid, subchannels, requiredSubchannel);
} }
#ifdef MS_LIBURING_SUPPORTED
// Submit all prepared submission entries.
DepLibUring::Submit();
#endif
}
} }
inline void Router::OnTransportNewDataConsumer( inline void Router::OnTransportNewDataConsumer(
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论