Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
a82c0506
提交
a82c0506
authored
3月 25, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Better RTP extension handling
上级
b3106e02
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
29 行增加
和
29 行删除
+29
-29
RtpPacket.hpp
worker/include/RTC/RtpPacket.hpp
+19
-19
RtpPacket.cpp
worker/src/RTC/RtpPacket.cpp
+10
-10
没有找到文件。
worker/include/RTC/RtpPacket.hpp
浏览文件 @
a82c0506
...
...
@@ -44,8 +44,8 @@ namespace RTC
};
private
:
/* Struct for One-Byte extension
element
. */
struct
OneByteExtension
Element
/* Struct for One-Byte extension. */
struct
OneByteExtension
{
#if defined(MS_LITTLE_ENDIAN)
uint8_t
len
:
4
;
...
...
@@ -58,8 +58,8 @@ namespace RTC
};
private
:
/* Struct for Two-Bytes extension
element
. */
struct
TwoBytesExtension
Element
/* Struct for Two-Bytes extension. */
struct
TwoBytesExtension
{
#if defined(MS_LITTLE_ENDIAN)
uint8_t
len
:
8
;
...
...
@@ -96,8 +96,8 @@ namespace RTC
uint16_t
GetExtensionHeaderId
()
const
;
size_t
GetExtensionHeaderLength
()
const
;
uint8_t
*
GetExtensionHeaderValue
()
const
;
bool
HasOneByteExtension
Element
s
()
const
;
bool
HasTwoBytesExtension
Element
s
()
const
;
bool
HasOneByteExtensions
()
const
;
bool
HasTwoBytesExtensions
()
const
;
void
AddExtensionMapping
(
RtpHeaderExtensionUri
::
Type
uri
,
uint8_t
id
);
uint8_t
*
GetExtension
(
RtpHeaderExtensionUri
::
Type
uri
,
uint8_t
*
len
)
const
;
uint32_t
GetAbsSendTime
()
const
;
...
...
@@ -107,15 +107,15 @@ namespace RTC
RtpPacket
*
Clone
(
uint8_t
*
buffer
)
const
;
private
:
void
ParseExtension
Element
s
();
void
ParseExtensions
();
private
:
// Passed by argument.
Header
*
header
=
nullptr
;
uint8_t
*
csrcList
=
nullptr
;
ExtensionHeader
*
extensionHeader
=
nullptr
;
std
::
map
<
uint8_t
,
OneByteExtension
Element
*>
oneByteExtensionElement
s
;
std
::
map
<
uint8_t
,
TwoBytesExtension
Element
*>
twoBytesExtensionElement
s
;
std
::
map
<
uint8_t
,
OneByteExtension
*>
oneByteExtension
s
;
std
::
map
<
uint8_t
,
TwoBytesExtension
*>
twoBytesExtension
s
;
std
::
map
<
RtpHeaderExtensionUri
::
Type
,
uint8_t
>
extensionMap
;
uint8_t
*
payload
=
nullptr
;
size_t
payloadLength
=
0
;
...
...
@@ -249,13 +249,13 @@ namespace RTC
}
inline
bool
RtpPacket
::
HasOneByteExtension
Element
s
()
const
bool
RtpPacket
::
HasOneByteExtensions
()
const
{
return
GetExtensionHeaderId
()
==
0xBEDE
;
}
inline
bool
RtpPacket
::
HasTwoBytesExtension
Element
s
()
const
bool
RtpPacket
::
HasTwoBytesExtensions
()
const
{
return
(
GetExtensionHeaderId
()
&
0
b1111111111110000
)
==
0
b0001000000000000
;
}
...
...
@@ -276,21 +276,21 @@ namespace RTC
uint8_t
id
=
this
->
extensionMap
.
at
(
uri
);
if
(
HasOneByteExtension
Element
s
())
if
(
HasOneByteExtensions
())
{
if
(
this
->
oneByteExtension
Elements
.
find
(
id
)
==
this
->
oneByteExtensionElement
s
.
end
())
if
(
this
->
oneByteExtension
s
.
find
(
id
)
==
this
->
oneByteExtension
s
.
end
())
return
nullptr
;
*
len
=
this
->
oneByteExtension
Element
s
.
at
(
id
)
->
len
+
1
;
return
this
->
oneByteExtension
Element
s
.
at
(
id
)
->
value
;
*
len
=
this
->
oneByteExtensions
.
at
(
id
)
->
len
+
1
;
return
this
->
oneByteExtensions
.
at
(
id
)
->
value
;
}
else
if
(
HasTwoBytesExtension
Element
s
())
else
if
(
HasTwoBytesExtensions
())
{
if
(
this
->
twoBytesExtension
Elements
.
find
(
id
)
==
this
->
twoBytesExtensionElement
s
.
end
())
if
(
this
->
twoBytesExtension
s
.
find
(
id
)
==
this
->
twoBytesExtension
s
.
end
())
return
nullptr
;
*
len
=
this
->
oneByteExtension
Element
s
.
at
(
id
)
->
len
;
return
this
->
twoBytesExtension
Element
s
.
at
(
id
)
->
value
;
*
len
=
this
->
oneByteExtensions
.
at
(
id
)
->
len
;
return
this
->
twoBytesExtensions
.
at
(
id
)
->
value
;
}
else
{
...
...
worker/src/RTC/RtpPacket.cpp
浏览文件 @
a82c0506
...
...
@@ -115,7 +115,7 @@ namespace RTC
RtpPacket
*
packet
=
new
RtpPacket
(
header
,
extensionHeader
,
payload
,
payloadLength
,
payloadPadding
,
len
);
// Parse RFC 5285 extension header.
packet
->
ParseExtension
Element
s
();
packet
->
ParseExtensions
();
return
packet
;
}
...
...
@@ -211,7 +211,7 @@ namespace RTC
}
// Parse and regenerate RFC 5285 extension header.
ParseExtension
Element
s
();
ParseExtensions
();
// Add payload.
if
(
this
->
payload
)
...
...
@@ -283,20 +283,20 @@ namespace RTC
RtpPacket
*
packet
=
new
RtpPacket
(
header
,
extensionHeader
,
payload
,
this
->
payloadLength
,
this
->
payloadPadding
,
this
->
size
);
// Parse RFC 5285 extension header.
packet
->
ParseExtension
Element
s
();
packet
->
ParseExtensions
();
return
packet
;
}
void
RtpPacket
::
ParseExtension
Element
s
()
void
RtpPacket
::
ParseExtensions
()
{
MS_TRACE
();
// Parse One-Byte extension header.
if
(
HasOneByteExtension
Element
s
())
if
(
HasOneByteExtensions
())
{
// Clear the One-Byte extension elements map.
this
->
oneByteExtension
Element
s
.
clear
();
this
->
oneByteExtensions
.
clear
();
uint8_t
*
extension_start
=
(
uint8_t
*
)
this
->
extensionHeader
+
4
;
uint8_t
*
extension_end
=
extension_start
+
GetExtensionHeaderLength
();
...
...
@@ -315,7 +315,7 @@ namespace RTC
}
// Store the One-Byte extension element in a map.
this
->
oneByteExtension
Elements
[
id
]
=
reinterpret_cast
<
OneByteExtensionElement
*>
(
ptr
);
this
->
oneByteExtension
s
[
id
]
=
reinterpret_cast
<
OneByteExtension
*>
(
ptr
);
ptr
+=
1
+
len
;
...
...
@@ -325,10 +325,10 @@ namespace RTC
}
}
// Parse Two-Bytes extension header.
else
if
(
HasTwoBytesExtension
Element
s
())
else
if
(
HasTwoBytesExtensions
())
{
// Clear the Two-Bytes extension elements map.
this
->
twoBytesExtension
Element
s
.
clear
();
this
->
twoBytesExtensions
.
clear
();
uint8_t
*
extension_start
=
(
uint8_t
*
)
this
->
extensionHeader
+
4
;
uint8_t
*
extension_end
=
extension_start
+
GetExtensionHeaderLength
();
...
...
@@ -347,7 +347,7 @@ namespace RTC
}
// Store the Two-Bytes extension element in a map.
this
->
twoBytesExtension
Elements
[
id
]
=
reinterpret_cast
<
TwoBytesExtensionElement
*>
(
ptr
);
this
->
twoBytesExtension
s
[
id
]
=
reinterpret_cast
<
TwoBytesExtension
*>
(
ptr
);
ptr
+=
len
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论