Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
d5facb5b
Unverified
提交
d5facb5b
authored
8月 09, 2024
作者:
Iñaki Baz Castillo
提交者:
GitHub
8月 09, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DepLibUring improvements (#1440)
上级
28a1483b
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
133 行增加
和
67 行删除
+133
-67
mediasoup-rust.yaml
.github/workflows/mediasoup-rust.yaml
+1
-0
mediasoup-worker-fuzzer.yaml
.github/workflows/mediasoup-worker-fuzzer.yaml
+5
-4
mediasoup-worker-prebuild.yaml
.github/workflows/mediasoup-worker-prebuild.yaml
+2
-0
mediasoup-worker.yaml
.github/workflows/mediasoup-worker.yaml
+13
-3
DepLibUring.hpp
worker/include/DepLibUring.hpp
+9
-1
DepLibUring.cpp
worker/src/DepLibUring.cpp
+44
-54
DepUsrSCTP.cpp
worker/src/DepUsrSCTP.cpp
+6
-0
Router.cpp
worker/src/RTC/Router.cpp
+12
-0
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+6
-0
SrtpSession.cpp
worker/src/RTC/SrtpSession.cpp
+1
-0
Transport.cpp
worker/src/RTC/Transport.cpp
+6
-0
Worker.cpp
worker/src/Worker.cpp
+20
-5
TcpConnectionHandle.cpp
worker/src/handles/TcpConnectionHandle.cpp
+4
-0
UdpSocketHandle.cpp
worker/src/handles/UdpSocketHandle.cpp
+4
-0
没有找到文件。
.github/workflows/mediasoup-rust.yaml
浏览文件 @
d5facb5b
...
@@ -18,6 +18,7 @@ jobs:
...
@@ -18,6 +18,7 @@ jobs:
ci
:
ci
:
-
os
:
ubuntu-20.04
-
os
:
ubuntu-20.04
-
os
:
ubuntu-22.04
-
os
:
ubuntu-22.04
-
os
:
ubuntu-24.04
-
os
:
macos-12
-
os
:
macos-12
-
os
:
macos-14
-
os
:
macos-14
-
os
:
windows-2022
-
os
:
windows-2022
...
...
.github/workflows/mediasoup-worker-fuzzer.yaml
浏览文件 @
d5facb5b
...
@@ -13,9 +13,10 @@ jobs:
...
@@ -13,9 +13,10 @@ jobs:
strategy
:
strategy
:
matrix
:
matrix
:
build
:
build
:
-
os
:
ubuntu-2
2
.04
-
os
:
ubuntu-2
4
.04
cc
:
clang
cc
:
clang
cxx
:
clang++
cxx
:
clang++
pip-break-system-packages
:
true
build-type
:
build-type
:
-
Release
-
Release
-
Debug
-
Debug
...
@@ -34,12 +35,12 @@ jobs:
...
@@ -34,12 +35,12 @@ jobs:
uses
:
actions/checkout@v4
uses
:
actions/checkout@v4
# We need to install pip invoke manually.
# We need to install pip invoke manually.
-
if
:
runner.os != 'macOS'
-
if
:
${{ !matrix.build.pip-break-system-packages }}
name
:
pip3 install invoke
name
:
pip3 install invoke
run
:
pip3 install invoke
run
:
pip3 install invoke
# In m
acOS we need to specify
this option.
# In m
odern OSs we need to run pip with
this option.
-
if
:
runner.os == 'macOS'
-
if
:
${{ matrix.build.pip-break-system-packages }}
name
:
pip3 install --break-system-packages invoke
name
:
pip3 install --break-system-packages invoke
run
:
pip3 install --break-system-packages invoke
run
:
pip3 install --break-system-packages invoke
...
...
.github/workflows/mediasoup-worker-prebuild.yaml
浏览文件 @
d5facb5b
...
@@ -19,6 +19,8 @@ jobs:
...
@@ -19,6 +19,8 @@ jobs:
cc
:
gcc
cc
:
gcc
cxx
:
g++
cxx
:
g++
# Worker prebuild for Linux with kernel version 6 Ubuntu (22.04).
# Worker prebuild for Linux with kernel version 6 Ubuntu (22.04).
# Let's not use Ubutu 24.04 to avoid same potential problem as described
# above.
-
os
:
ubuntu-22.04
-
os
:
ubuntu-22.04
cc
:
gcc
cc
:
gcc
cxx
:
g++
cxx
:
g++
...
...
.github/workflows/mediasoup-worker.yaml
浏览文件 @
d5facb5b
...
@@ -31,12 +31,22 @@ jobs:
...
@@ -31,12 +31,22 @@ jobs:
-
os
:
ubuntu-22.04
-
os
:
ubuntu-22.04
cc
:
clang
cc
:
clang
cxx
:
clang++
cxx
:
clang++
-
os
:
ubuntu-24.04
cc
:
gcc
cxx
:
g++
pip-break-system-packages
:
true
-
os
:
ubuntu-24.04
cc
:
clang
cxx
:
clang++
pip-break-system-packages
:
true
-
os
:
macos-12
-
os
:
macos-12
cc
:
gcc
cc
:
gcc
cxx
:
g++
cxx
:
g++
pip-break-system-packages
:
true
-
os
:
macos-14
-
os
:
macos-14
cc
:
clang
cc
:
clang
cxx
:
clang++
cxx
:
clang++
pip-break-system-packages
:
true
-
os
:
windows-2022
-
os
:
windows-2022
cc
:
cl
cc
:
cl
cxx
:
cl
cxx
:
cl
...
@@ -75,12 +85,12 @@ jobs:
...
@@ -75,12 +85,12 @@ jobs:
${{ matrix.build.os }}-node-${{matrix.build.cc}}-
${{ matrix.build.os }}-node-${{matrix.build.cc}}-
# We need to install pip invoke manually.
# We need to install pip invoke manually.
-
if
:
runner.os != 'macOS'
-
if
:
${{ !matrix.build.pip-break-system-packages }}
name
:
pip3 install invoke
name
:
pip3 install invoke
run
:
pip3 install invoke
run
:
pip3 install invoke
# In m
acOS we need to specify
this option.
# In m
odern OSs we need to run pip with
this option.
-
if
:
runner.os == 'macOS'
-
if
:
${{ matrix.build.pip-break-system-packages }}
name
:
pip3 install --break-system-packages invoke
name
:
pip3 install --break-system-packages invoke
run
:
pip3 install --break-system-packages invoke
run
:
pip3 install --break-system-packages invoke
...
...
worker/include/DepLibUring.hpp
浏览文件 @
d5facb5b
...
@@ -33,9 +33,10 @@ public:
...
@@ -33,9 +33,10 @@ public:
using
SendBuffer
=
uint8_t
[
SendBufferSize
];
using
SendBuffer
=
uint8_t
[
SendBufferSize
];
static
bool
IsRuntimeSupported
();
static
void
ClassInit
();
static
void
ClassInit
();
static
void
ClassDestroy
();
static
void
ClassDestroy
();
static
void
CheckRuntimeSupport
();
static
bool
IsEnabled
();
static
flatbuffers
::
Offset
<
FBS
::
LibUring
::
Dump
>
FillBuffer
(
flatbuffers
::
FlatBufferBuilder
&
builder
);
static
flatbuffers
::
Offset
<
FBS
::
LibUring
::
Dump
>
FillBuffer
(
flatbuffers
::
FlatBufferBuilder
&
builder
);
static
void
StartPollingCQEs
();
static
void
StartPollingCQEs
();
static
void
StopPollingCQEs
();
static
void
StopPollingCQEs
();
...
@@ -50,9 +51,12 @@ public:
...
@@ -50,9 +51,12 @@ public:
class
LibUring
;
class
LibUring
;
// Whether liburing is enabled or not after runtime checks.
static
bool
enabled
;
thread_local
static
LibUring
*
liburing
;
thread_local
static
LibUring
*
liburing
;
public
:
public
:
// Singleton.
class
LibUring
class
LibUring
{
{
public
:
public
:
...
@@ -98,6 +102,10 @@ public:
...
@@ -98,6 +102,10 @@ public:
}
}
private
:
private
:
void
SetInactive
()
{
this
->
active
=
false
;
}
UserData
*
GetUserData
();
UserData
*
GetUserData
();
bool
IsDataInSendBuffers
(
const
uint8_t
*
data
)
const
bool
IsDataInSendBuffers
(
const
uint8_t
*
data
)
const
{
{
...
...
worker/src/DepLibUring.cpp
浏览文件 @
d5facb5b
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include <sys/utsname.h>
#include <sys/utsname.h>
/* Static variables. */
/* Static variables. */
bool
DepLibUring
::
enabled
{
false
};
/* liburing instance per thread. */
/* liburing instance per thread. */
thread_local
DepLibUring
::
LibUring
*
DepLibUring
::
liburing
{
nullptr
};
thread_local
DepLibUring
::
LibUring
*
DepLibUring
::
liburing
{
nullptr
};
/* Completion queue entry array used to retrieve processes tasks. */
/* Completion queue entry array used to retrieve processes tasks. */
...
@@ -114,7 +114,36 @@ inline static void onFdEvent(uv_poll_t* handle, int status, int events)
...
@@ -114,7 +114,36 @@ inline static void onFdEvent(uv_poll_t* handle, int status, int events)
/* Static class methods */
/* Static class methods */
bool
DepLibUring
::
IsRuntimeSupported
()
void
DepLibUring
::
ClassInit
()
{
const
auto
mayor
=
io_uring_major_version
();
const
auto
minor
=
io_uring_minor_version
();
MS_DEBUG_TAG
(
info
,
"liburing version:
\"
%i.%i
\"
"
,
mayor
,
minor
);
// This must be called first.
DepLibUring
::
CheckRuntimeSupport
();
if
(
DepLibUring
::
IsEnabled
())
{
DepLibUring
::
liburing
=
new
LibUring
();
MS_DEBUG_TAG
(
info
,
"liburing enabled"
);
}
else
{
MS_DEBUG_TAG
(
info
,
"liburing not enabled"
);
}
}
void
DepLibUring
::
ClassDestroy
()
{
MS_TRACE
();
delete
DepLibUring
::
liburing
;
}
void
DepLibUring
::
CheckRuntimeSupport
()
{
{
// clang-format off
// clang-format off
struct
utsname
buffer
{};
struct
utsname
buffer
{};
...
@@ -134,43 +163,19 @@ bool DepLibUring::IsRuntimeSupported()
...
@@ -134,43 +163,19 @@ bool DepLibUring::IsRuntimeSupported()
// liburing `sento` capabilities are supported for kernel versions greather
// liburing `sento` capabilities are supported for kernel versions greather
// than or equal to 6.
// than or equal to 6.
return
kernelMayorLong
>=
6
;
DepLibUring
::
enabled
=
kernelMayorLong
>=
6
;
}
void
DepLibUring
::
ClassInit
()
{
const
auto
mayor
=
io_uring_major_version
();
const
auto
minor
=
io_uring_minor_version
();
MS_DEBUG_TAG
(
info
,
"liburing version:
\"
%i.%i
\"
"
,
mayor
,
minor
);
if
(
DepLibUring
::
IsRuntimeSupported
())
{
DepLibUring
::
liburing
=
new
LibUring
();
MS_DEBUG_TAG
(
info
,
"liburing supported, enabled"
);
}
else
{
MS_DEBUG_TAG
(
info
,
"liburing not supported, not enabled"
);
}
}
}
void
DepLibUring
::
ClassDestroy
()
bool
DepLibUring
::
IsEnabled
()
{
{
MS_TRACE
();
return
DepLibUring
::
enabled
;
delete
DepLibUring
::
liburing
;
}
}
flatbuffers
::
Offset
<
FBS
::
LibUring
::
Dump
>
DepLibUring
::
FillBuffer
(
flatbuffers
::
FlatBufferBuilder
&
builder
)
flatbuffers
::
Offset
<
FBS
::
LibUring
::
Dump
>
DepLibUring
::
FillBuffer
(
flatbuffers
::
FlatBufferBuilder
&
builder
)
{
{
MS_TRACE
();
MS_TRACE
();
if
(
!
DepLibUring
::
liburing
)
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled"
);
{
return
0
;
}
return
DepLibUring
::
liburing
->
FillBuffer
(
builder
);
return
DepLibUring
::
liburing
->
FillBuffer
(
builder
);
}
}
...
@@ -179,10 +184,7 @@ void DepLibUring::StartPollingCQEs()
...
@@ -179,10 +184,7 @@ void DepLibUring::StartPollingCQEs()
{
{
MS_TRACE
();
MS_TRACE
();
if
(
!
DepLibUring
::
liburing
)
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled"
);
{
return
;
}
DepLibUring
::
liburing
->
StartPollingCQEs
();
DepLibUring
::
liburing
->
StartPollingCQEs
();
}
}
...
@@ -191,10 +193,7 @@ void DepLibUring::StopPollingCQEs()
...
@@ -191,10 +193,7 @@ void DepLibUring::StopPollingCQEs()
{
{
MS_TRACE
();
MS_TRACE
();
if
(
!
DepLibUring
::
liburing
)
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled"
);
{
return
;
}
DepLibUring
::
liburing
->
StopPollingCQEs
();
DepLibUring
::
liburing
->
StopPollingCQEs
();
}
}
...
@@ -203,7 +202,7 @@ uint8_t* DepLibUring::GetSendBuffer()
...
@@ -203,7 +202,7 @@ uint8_t* DepLibUring::GetSendBuffer()
{
{
MS_TRACE
();
MS_TRACE
();
MS_ASSERT
(
DepLibUring
::
liburing
,
"DepLibUring::liburing is not set
"
);
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled
"
);
return
DepLibUring
::
liburing
->
GetSendBuffer
();
return
DepLibUring
::
liburing
->
GetSendBuffer
();
}
}
...
@@ -213,7 +212,7 @@ bool DepLibUring::PrepareSend(
...
@@ -213,7 +212,7 @@ bool DepLibUring::PrepareSend(
{
{
MS_TRACE
();
MS_TRACE
();
MS_ASSERT
(
DepLibUring
::
liburing
,
"DepLibUring::liburing is not set
"
);
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled
"
);
return
DepLibUring
::
liburing
->
PrepareSend
(
sockfd
,
data
,
len
,
addr
,
cb
);
return
DepLibUring
::
liburing
->
PrepareSend
(
sockfd
,
data
,
len
,
addr
,
cb
);
}
}
...
@@ -223,7 +222,7 @@ bool DepLibUring::PrepareWrite(
...
@@ -223,7 +222,7 @@ bool DepLibUring::PrepareWrite(
{
{
MS_TRACE
();
MS_TRACE
();
MS_ASSERT
(
DepLibUring
::
liburing
,
"DepLibUring::liburing is not set
"
);
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled
"
);
return
DepLibUring
::
liburing
->
PrepareWrite
(
sockfd
,
data1
,
len1
,
data2
,
len2
,
cb
);
return
DepLibUring
::
liburing
->
PrepareWrite
(
sockfd
,
data1
,
len1
,
data2
,
len2
,
cb
);
}
}
...
@@ -232,10 +231,7 @@ void DepLibUring::Submit()
...
@@ -232,10 +231,7 @@ void DepLibUring::Submit()
{
{
MS_TRACE
();
MS_TRACE
();
if
(
!
DepLibUring
::
liburing
)
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled"
);
{
return
;
}
DepLibUring
::
liburing
->
Submit
();
DepLibUring
::
liburing
->
Submit
();
}
}
...
@@ -244,10 +240,7 @@ void DepLibUring::SetActive()
...
@@ -244,10 +240,7 @@ void DepLibUring::SetActive()
{
{
MS_TRACE
();
MS_TRACE
();
if
(
!
DepLibUring
::
liburing
)
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled"
);
{
return
;
}
DepLibUring
::
liburing
->
SetActive
();
DepLibUring
::
liburing
->
SetActive
();
}
}
...
@@ -256,10 +249,7 @@ bool DepLibUring::IsActive()
...
@@ -256,10 +249,7 @@ bool DepLibUring::IsActive()
{
{
MS_TRACE
();
MS_TRACE
();
if
(
!
DepLibUring
::
liburing
)
MS_ASSERT
(
DepLibUring
::
enabled
,
"DepLibUring::liburing not enabled"
);
{
return
false
;
}
return
DepLibUring
::
liburing
->
IsActive
();
return
DepLibUring
::
liburing
->
IsActive
();
}
}
...
@@ -580,7 +570,7 @@ void DepLibUring::LibUring::Submit()
...
@@ -580,7 +570,7 @@ void DepLibUring::LibUring::Submit()
MS_TRACE
();
MS_TRACE
();
// Unset active flag.
// Unset active flag.
this
->
active
=
false
;
SetInactive
()
;
auto
err
=
io_uring_submit
(
std
::
addressof
(
this
->
ring
));
auto
err
=
io_uring_submit
(
std
::
addressof
(
this
->
ring
));
...
...
worker/src/DepUsrSCTP.cpp
浏览文件 @
d5facb5b
...
@@ -251,19 +251,25 @@ void DepUsrSCTP::Checker::OnTimer(TimerHandle* /*timer*/)
...
@@ -251,19 +251,25 @@ void DepUsrSCTP::Checker::OnTimer(TimerHandle* /*timer*/)
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
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Activate liburing usage.
// Activate liburing usage.
// 'usrsctp_handle_timers()' will synchronously call the send/recv
// 'usrsctp_handle_timers()' will synchronously call the send/recv
// callbacks for the pending data. If there are multiple messages to be
// 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
// sent over the network then we will send those messages within a single
// system call.
// system call.
DepLibUring
::
SetActive
();
DepLibUring
::
SetActive
();
}
#endif
#endif
usrsctp_handle_timers
(
elapsedMs
);
usrsctp_handle_timers
(
elapsedMs
);
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Submit all prepared submission entries.
// Submit all prepared submission entries.
DepLibUring
::
Submit
();
DepLibUring
::
Submit
();
}
#endif
#endif
this
->
lastCalledAtMs
=
nowMs
;
this
->
lastCalledAtMs
=
nowMs
;
...
...
worker/src/RTC/Router.cpp
浏览文件 @
d5facb5b
...
@@ -665,8 +665,11 @@ namespace RTC
...
@@ -665,8 +665,11 @@ namespace RTC
std
::
shared_ptr
<
RTC
::
RtpPacket
>
sharedPacket
;
std
::
shared_ptr
<
RTC
::
RtpPacket
>
sharedPacket
;
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Activate liburing usage.
// Activate liburing usage.
DepLibUring
::
SetActive
();
DepLibUring
::
SetActive
();
}
#endif
#endif
for
(
auto
*
consumer
:
consumers
)
for
(
auto
*
consumer
:
consumers
)
...
@@ -683,8 +686,11 @@ namespace RTC
...
@@ -683,8 +686,11 @@ namespace RTC
}
}
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Submit all prepared submission entries.
// Submit all prepared submission entries.
DepLibUring
::
Submit
();
DepLibUring
::
Submit
();
}
#endif
#endif
}
}
...
@@ -925,10 +931,13 @@ namespace RTC
...
@@ -925,10 +931,13 @@ namespace RTC
if
(
!
dataConsumers
.
empty
())
if
(
!
dataConsumers
.
empty
())
{
{
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Activate liburing usage.
// Activate liburing usage.
// The effective sending could be synchronous, thus we would send those
// The effective sending could be synchronous, thus we would send those
// messages within a single system call.
// messages within a single system call.
DepLibUring
::
SetActive
();
DepLibUring
::
SetActive
();
}
#endif
#endif
for
(
auto
*
dataConsumer
:
dataConsumers
)
for
(
auto
*
dataConsumer
:
dataConsumers
)
...
@@ -937,8 +946,11 @@ namespace RTC
...
@@ -937,8 +946,11 @@ namespace RTC
}
}
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Submit all prepared submission entries.
// Submit all prepared submission entries.
DepLibUring
::
Submit
();
DepLibUring
::
Submit
();
}
#endif
#endif
}
}
}
}
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
d5facb5b
...
@@ -128,8 +128,11 @@ namespace RTC
...
@@ -128,8 +128,11 @@ namespace RTC
this
->
nackCount
++
;
this
->
nackCount
++
;
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Activate liburing usage.
// Activate liburing usage.
DepLibUring
::
SetActive
();
DepLibUring
::
SetActive
();
}
#endif
#endif
for
(
auto
it
=
nackPacket
->
Begin
();
it
!=
nackPacket
->
End
();
++
it
)
for
(
auto
it
=
nackPacket
->
Begin
();
it
!=
nackPacket
->
End
();
++
it
)
...
@@ -173,8 +176,11 @@ namespace RTC
...
@@ -173,8 +176,11 @@ namespace RTC
}
}
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Submit all prepared submission entries.
// Submit all prepared submission entries.
DepLibUring
::
Submit
();
DepLibUring
::
Submit
();
}
#endif
#endif
}
}
...
...
worker/src/RTC/SrtpSession.cpp
浏览文件 @
d5facb5b
...
@@ -204,6 +204,7 @@ namespace RTC
...
@@ -204,6 +204,7 @@ namespace RTC
uint8_t
*
encryptBuffer
=
EncryptBuffer
;
uint8_t
*
encryptBuffer
=
EncryptBuffer
;
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
{
if
(
!
DepLibUring
::
IsActive
())
if
(
!
DepLibUring
::
IsActive
())
{
{
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
d5facb5b
...
@@ -2158,8 +2158,11 @@ namespace RTC
...
@@ -2158,8 +2158,11 @@ namespace RTC
std
::
unique_ptr
<
RTC
::
RTCP
::
CompoundPacket
>
packet
{
new
RTC
::
RTCP
::
CompoundPacket
()
};
std
::
unique_ptr
<
RTC
::
RTCP
::
CompoundPacket
>
packet
{
new
RTC
::
RTCP
::
CompoundPacket
()
};
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Activate liburing usage.
// Activate liburing usage.
DepLibUring
::
SetActive
();
DepLibUring
::
SetActive
();
}
#endif
#endif
for
(
auto
&
kv
:
this
->
mapConsumers
)
for
(
auto
&
kv
:
this
->
mapConsumers
)
...
@@ -2207,8 +2210,11 @@ namespace RTC
...
@@ -2207,8 +2210,11 @@ namespace RTC
}
}
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Submit all prepared submission entries.
// Submit all prepared submission entries.
DepLibUring
::
Submit
();
DepLibUring
::
Submit
();
}
#endif
#endif
}
}
...
...
worker/src/Worker.cpp
浏览文件 @
d5facb5b
...
@@ -44,8 +44,11 @@ Worker::Worker(::Channel::ChannelSocket* channel) : channel(channel)
...
@@ -44,8 +44,11 @@ Worker::Worker(::Channel::ChannelSocket* channel) : channel(channel)
DepUsrSCTP
::
CreateChecker
();
DepUsrSCTP
::
CreateChecker
();
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Start polling CQEs, which will create a uv_pool_t handle.
// Start polling CQEs, which will create a uv_pool_t handle.
DepLibUring
::
StartPollingCQEs
();
DepLibUring
::
StartPollingCQEs
();
}
#endif
#endif
// Tell the Node process that we are running.
// Tell the Node process that we are running.
...
@@ -106,8 +109,11 @@ void Worker::Close()
...
@@ -106,8 +109,11 @@ void Worker::Close()
DepUsrSCTP
::
CloseChecker
();
DepUsrSCTP
::
CloseChecker
();
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
// Stop polling CQEs, which will close the uv_pool_t handle.
// Stop polling CQEs, which will close the uv_pool_t handle.
DepLibUring
::
StopPollingCQEs
();
DepLibUring
::
StopPollingCQEs
();
}
#endif
#endif
// Close the Channel.
// Close the Channel.
...
@@ -142,17 +148,26 @@ flatbuffers::Offset<FBS::Worker::DumpResponse> Worker::FillBuffer(
...
@@ -142,17 +148,26 @@ flatbuffers::Offset<FBS::Worker::DumpResponse> Worker::FillBuffer(
// Add channelMessageHandlers.
// Add channelMessageHandlers.
auto
channelMessageHandlers
=
this
->
shared
->
channelMessageRegistrator
->
FillBuffer
(
builder
);
auto
channelMessageHandlers
=
this
->
shared
->
channelMessageRegistrator
->
FillBuffer
(
builder
);
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
return
FBS
::
Worker
::
CreateDumpResponseDirect
(
return
FBS
::
Worker
::
CreateDumpResponseDirect
(
builder
,
builder
,
Logger
::
Pid
,
Logger
::
Pid
,
&
webRtcServerIds
,
&
webRtcServerIds
,
&
routerIds
,
&
routerIds
,
channelMessageHandlers
channelMessageHandlers
,
#ifdef MS_LIBURING_SUPPORTED
DepLibUring
::
FillBuffer
(
builder
));
,
}
DepLibUring
::
FillBuffer
(
builder
)
else
{
return
FBS
::
Worker
::
CreateDumpResponseDirect
(
builder
,
Logger
::
Pid
,
&
webRtcServerIds
,
&
routerIds
,
channelMessageHandlers
);
}
#else
return
FBS
::
Worker
::
CreateDumpResponseDirect
(
builder
,
Logger
::
Pid
,
&
webRtcServerIds
,
&
routerIds
,
channelMessageHandlers
);
#endif
#endif
);
}
}
flatbuffers
::
Offset
<
FBS
::
Worker
::
ResourceUsageResponse
>
Worker
::
FillBufferResourceUsage
(
flatbuffers
::
Offset
<
FBS
::
Worker
::
ResourceUsageResponse
>
Worker
::
FillBufferResourceUsage
(
...
...
worker/src/handles/TcpConnectionHandle.cpp
浏览文件 @
d5facb5b
...
@@ -168,12 +168,15 @@ void TcpConnectionHandle::Start()
...
@@ -168,12 +168,15 @@ void TcpConnectionHandle::Start()
}
}
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
err
=
uv_fileno
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
std
::
addressof
(
this
->
fd
));
err
=
uv_fileno
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
std
::
addressof
(
this
->
fd
));
if
(
err
!=
0
)
if
(
err
!=
0
)
{
{
MS_THROW_ERROR
(
"uv_fileno() failed: %s"
,
uv_strerror
(
err
));
MS_THROW_ERROR
(
"uv_fileno() failed: %s"
,
uv_strerror
(
err
));
}
}
}
#endif
#endif
}
}
...
@@ -209,6 +212,7 @@ void TcpConnectionHandle::Write(
...
@@ -209,6 +212,7 @@ void TcpConnectionHandle::Write(
}
}
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
{
if
(
!
DepLibUring
::
IsActive
())
if
(
!
DepLibUring
::
IsActive
())
{
{
...
...
worker/src/handles/UdpSocketHandle.cpp
浏览文件 @
d5facb5b
...
@@ -88,12 +88,15 @@ UdpSocketHandle::UdpSocketHandle(uv_udp_t* uvHandle) : uvHandle(uvHandle)
...
@@ -88,12 +88,15 @@ UdpSocketHandle::UdpSocketHandle(uv_udp_t* uvHandle) : uvHandle(uvHandle)
}
}
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
err
=
uv_fileno
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
std
::
addressof
(
this
->
fd
));
err
=
uv_fileno
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
std
::
addressof
(
this
->
fd
));
if
(
err
!=
0
)
if
(
err
!=
0
)
{
{
MS_THROW_ERROR
(
"uv_fileno() failed: %s"
,
uv_strerror
(
err
));
MS_THROW_ERROR
(
"uv_fileno() failed: %s"
,
uv_strerror
(
err
));
}
}
}
#endif
#endif
}
}
...
@@ -144,6 +147,7 @@ void UdpSocketHandle::Send(
...
@@ -144,6 +147,7 @@ void UdpSocketHandle::Send(
}
}
#ifdef MS_LIBURING_SUPPORTED
#ifdef MS_LIBURING_SUPPORTED
if
(
DepLibUring
::
IsEnabled
())
{
{
if
(
!
DepLibUring
::
IsActive
())
if
(
!
DepLibUring
::
IsActive
())
{
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论