Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
e56b4947
提交
e56b4947
authored
3月 27, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize RtpPacket::SetExtensions() tby filling the RTP extension maps in place
上级
685ef99e
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
26 行增加
和
19 行删除
+26
-19
RtpPacket.hpp
worker/include/RTC/RtpPacket.hpp
+6
-6
RtpPacket.cpp
worker/src/RTC/RtpPacket.cpp
+20
-13
没有找到文件。
worker/include/RTC/RtpPacket.hpp
浏览文件 @
e56b4947
...
@@ -154,8 +154,8 @@ namespace RTC
...
@@ -154,8 +154,8 @@ namespace RTC
Header
*
header
{
nullptr
};
Header
*
header
{
nullptr
};
uint8_t
*
csrcList
{
nullptr
};
uint8_t
*
csrcList
{
nullptr
};
HeaderExtension
*
headerExtension
{
nullptr
};
HeaderExtension
*
headerExtension
{
nullptr
};
std
::
map
<
uint8_t
,
OneByteExtension
*>
o
neByteExtensions
;
std
::
map
<
uint8_t
,
OneByteExtension
*>
mapO
neByteExtensions
;
std
::
map
<
uint8_t
,
TwoBytesExtension
*>
t
woBytesExtensions
;
std
::
map
<
uint8_t
,
TwoBytesExtension
*>
mapT
woBytesExtensions
;
uint8_t
audioLevelExtensionId
{
0
};
uint8_t
audioLevelExtensionId
{
0
};
uint8_t
videoOrientationExtensionId
{
0
};
uint8_t
videoOrientationExtensionId
{
0
};
uint8_t
absSendTimeExtensionId
{
0
};
uint8_t
absSendTimeExtensionId
{
0
};
...
@@ -451,9 +451,9 @@ namespace RTC
...
@@ -451,9 +451,9 @@ namespace RTC
}
}
else
if
(
HasOneByteExtensions
())
else
if
(
HasOneByteExtensions
())
{
{
auto
it
=
this
->
o
neByteExtensions
.
find
(
id
);
auto
it
=
this
->
mapO
neByteExtensions
.
find
(
id
);
if
(
it
==
this
->
o
neByteExtensions
.
end
())
if
(
it
==
this
->
mapO
neByteExtensions
.
end
())
return
nullptr
;
return
nullptr
;
auto
*
extension
=
it
->
second
;
auto
*
extension
=
it
->
second
;
...
@@ -464,9 +464,9 @@ namespace RTC
...
@@ -464,9 +464,9 @@ namespace RTC
}
}
else
if
(
HasTwoBytesExtensions
())
else
if
(
HasTwoBytesExtensions
())
{
{
auto
it
=
this
->
t
woBytesExtensions
.
find
(
id
);
auto
it
=
this
->
mapT
woBytesExtensions
.
find
(
id
);
if
(
it
==
this
->
t
woBytesExtensions
.
end
())
if
(
it
==
this
->
mapT
woBytesExtensions
.
end
())
return
nullptr
;
return
nullptr
;
auto
*
extension
=
it
->
second
;
auto
*
extension
=
it
->
second
;
...
...
worker/src/RTC/RtpPacket.cpp
浏览文件 @
e56b4947
...
@@ -177,18 +177,18 @@ namespace RTC
...
@@ -177,18 +177,18 @@ namespace RTC
if
(
HasOneByteExtensions
())
if
(
HasOneByteExtensions
())
{
{
extIds
.
reserve
(
this
->
o
neByteExtensions
.
size
());
extIds
.
reserve
(
this
->
mapO
neByteExtensions
.
size
());
for
(
auto
&
kv
:
this
->
o
neByteExtensions
)
for
(
auto
&
kv
:
this
->
mapO
neByteExtensions
)
{
{
extIds
.
push_back
(
std
::
to_string
(
kv
.
first
));
extIds
.
push_back
(
std
::
to_string
(
kv
.
first
));
}
}
}
}
else
else
{
{
extIds
.
reserve
(
this
->
t
woBytesExtensions
.
size
());
extIds
.
reserve
(
this
->
mapT
woBytesExtensions
.
size
());
for
(
auto
&
kv
:
this
->
t
woBytesExtensions
)
for
(
auto
&
kv
:
this
->
mapT
woBytesExtensions
)
{
{
extIds
.
push_back
(
std
::
to_string
(
kv
.
first
));
extIds
.
push_back
(
std
::
to_string
(
kv
.
first
));
}
}
...
@@ -284,6 +284,10 @@ namespace RTC
...
@@ -284,6 +284,10 @@ namespace RTC
this
->
ridExtensionId
=
0
;
this
->
ridExtensionId
=
0
;
this
->
rridExtensionId
=
0
;
this
->
rridExtensionId
=
0
;
// Clear the One-Byte and Two-Bytes extension elements maps.
this
->
mapOneByteExtensions
.
clear
();
this
->
mapTwoBytesExtensions
.
clear
();
// If One-Byte is requested and the packet already has One-Byte extensions,
// If One-Byte is requested and the packet already has One-Byte extensions,
// keep the header extension id.
// keep the header extension id.
if
(
type
==
1u
&&
HasOneByteExtensions
())
if
(
type
==
1u
&&
HasOneByteExtensions
())
...
@@ -392,6 +396,9 @@ namespace RTC
...
@@ -392,6 +396,9 @@ namespace RTC
if
(
extension
.
id
==
0
||
extension
.
id
>
14
||
extension
.
len
==
0
||
extension
.
len
>
16
)
if
(
extension
.
id
==
0
||
extension
.
id
>
14
||
extension
.
len
==
0
||
extension
.
len
>
16
)
continue
;
continue
;
// Store the One-Byte extension element in the map.
this
->
mapOneByteExtensions
[
extension
.
id
]
=
reinterpret_cast
<
OneByteExtension
*>
(
ptr
);
*
ptr
=
(
extension
.
id
<<
4
)
|
((
extension
.
len
-
1
)
&
0x0F
);
*
ptr
=
(
extension
.
id
<<
4
)
|
((
extension
.
len
-
1
)
&
0x0F
);
++
ptr
;
++
ptr
;
std
::
memmove
(
ptr
,
extension
.
value
,
extension
.
len
);
std
::
memmove
(
ptr
,
extension
.
value
,
extension
.
len
);
...
@@ -402,6 +409,9 @@ namespace RTC
...
@@ -402,6 +409,9 @@ namespace RTC
if
(
extension
.
id
==
0
)
if
(
extension
.
id
==
0
)
continue
;
continue
;
// Store the Two-Bytes extension element in the map.
this
->
mapTwoBytesExtensions
[
extension
.
id
]
=
reinterpret_cast
<
TwoBytesExtension
*>
(
ptr
);
*
ptr
=
extension
.
id
;
*
ptr
=
extension
.
id
;
++
ptr
;
++
ptr
;
*
ptr
=
extension
.
len
;
*
ptr
=
extension
.
len
;
...
@@ -418,9 +428,6 @@ namespace RTC
...
@@ -418,9 +428,6 @@ namespace RTC
}
}
MS_ASSERT
(
ptr
==
this
->
payload
,
"wrong ptr calculation"
);
MS_ASSERT
(
ptr
==
this
->
payload
,
"wrong ptr calculation"
);
// Parse extensions again.
ParseExtensions
();
}
}
RtpPacket
*
RtpPacket
::
Clone
(
const
uint8_t
*
buffer
)
const
RtpPacket
*
RtpPacket
::
Clone
(
const
uint8_t
*
buffer
)
const
...
@@ -647,7 +654,7 @@ namespace RTC
...
@@ -647,7 +654,7 @@ namespace RTC
if
(
HasOneByteExtensions
())
if
(
HasOneByteExtensions
())
{
{
// Clear the One-Byte extension elements map.
// Clear the One-Byte extension elements map.
this
->
o
neByteExtensions
.
clear
();
this
->
mapO
neByteExtensions
.
clear
();
uint8_t
*
extensionStart
=
reinterpret_cast
<
uint8_t
*>
(
this
->
headerExtension
)
+
4
;
uint8_t
*
extensionStart
=
reinterpret_cast
<
uint8_t
*>
(
this
->
headerExtension
)
+
4
;
uint8_t
*
extensionEnd
=
extensionStart
+
GetHeaderExtensionLength
();
uint8_t
*
extensionEnd
=
extensionStart
+
GetHeaderExtensionLength
();
...
@@ -674,8 +681,8 @@ namespace RTC
...
@@ -674,8 +681,8 @@ namespace RTC
break
;
break
;
}
}
// Store the One-Byte extension element in
a
map.
// Store the One-Byte extension element in
the
map.
this
->
o
neByteExtensions
[
id
]
=
reinterpret_cast
<
OneByteExtension
*>
(
ptr
);
this
->
mapO
neByteExtensions
[
id
]
=
reinterpret_cast
<
OneByteExtension
*>
(
ptr
);
ptr
+=
(
1
+
len
);
ptr
+=
(
1
+
len
);
}
}
...
@@ -696,7 +703,7 @@ namespace RTC
...
@@ -696,7 +703,7 @@ namespace RTC
else
if
(
HasTwoBytesExtensions
())
else
if
(
HasTwoBytesExtensions
())
{
{
// Clear the Two-Bytes extension elements map.
// Clear the Two-Bytes extension elements map.
this
->
t
woBytesExtensions
.
clear
();
this
->
mapT
woBytesExtensions
.
clear
();
uint8_t
*
extensionStart
=
reinterpret_cast
<
uint8_t
*>
(
this
->
headerExtension
)
+
4
;
uint8_t
*
extensionStart
=
reinterpret_cast
<
uint8_t
*>
(
this
->
headerExtension
)
+
4
;
uint8_t
*
extensionEnd
=
extensionStart
+
GetHeaderExtensionLength
();
uint8_t
*
extensionEnd
=
extensionStart
+
GetHeaderExtensionLength
();
...
@@ -722,8 +729,8 @@ namespace RTC
...
@@ -722,8 +729,8 @@ namespace RTC
break
;
break
;
}
}
// Store the Two-Bytes extension element in
a
map.
// Store the Two-Bytes extension element in
the
map.
this
->
t
woBytesExtensions
[
id
]
=
reinterpret_cast
<
TwoBytesExtension
*>
(
ptr
);
this
->
mapT
woBytesExtensions
[
id
]
=
reinterpret_cast
<
TwoBytesExtension
*>
(
ptr
);
ptr
+=
(
2
+
len
);
ptr
+=
(
2
+
len
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论