Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
2e75da78
提交
2e75da78
authored
10月 14, 2016
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use consistent type2String method
上级
4d1e2554
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
56 行增加
和
48 行删除
+56
-48
Packet.h
worker/include/RTC/RTCP/Packet.h
+19
-1
Sdes.h
worker/include/RTC/RTCP/Sdes.h
+6
-3
Packet.cpp
worker/src/RTC/RTCP/Packet.cpp
+12
-28
Sdes.cpp
worker/src/RTC/RTCP/Sdes.cpp
+19
-16
没有找到文件。
worker/include/RTC/RTCP/Packet.h
浏览文件 @
2e75da78
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
#include "common.h"
#include "common.h"
#include "map"
#include "string"
namespace
RTC
namespace
RTC
{
{
namespace
RTCP
namespace
RTCP
...
@@ -20,6 +23,21 @@ namespace RTCP
...
@@ -20,6 +23,21 @@ namespace RTCP
PSFB
=
206
PSFB
=
206
};
};
static
std
::
map
<
Type
,
std
::
string
>
type2String
=
{
{
Type
::
FIR
,
"FIR"
},
{
Type
::
NACK
,
"NACK"
},
{
Type
::
SR
,
"SR"
},
{
Type
::
RR
,
"RR"
},
{
Type
::
SDES
,
"SDES"
},
{
Type
::
BYE
,
"BYE"
},
{
Type
::
APP
,
"APP"
},
{
Type
::
RTPFB
,
"RTPFB"
},
{
Type
::
PSFB
,
"PSBF"
}
};
const
std
::
string
&
Type2String
(
Type
type
);
class
Packet
class
Packet
{
{
public
:
public
:
...
@@ -42,7 +60,7 @@ namespace RTCP
...
@@ -42,7 +60,7 @@ namespace RTCP
public
:
public
:
static
bool
IsRtcp
(
const
uint8_t
*
data
,
size_t
len
);
static
bool
IsRtcp
(
const
uint8_t
*
data
,
size_t
len
);
static
Packet
*
Parse
(
const
uint8_t
*
data
,
size_t
len
);
static
Packet
*
Parse
(
const
uint8_t
*
data
,
size_t
len
);
static
const
char
*
TypeString
(
Type
type
);
public
:
public
:
Packet
(
Type
type
);
Packet
(
Type
type
);
...
...
worker/include/RTC/RTCP/Sdes.h
浏览文件 @
2e75da78
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#include "RTC/RTCP/Packet.h"
#include "RTC/RTCP/Packet.h"
#include <vector>
#include <vector>
#include <map>
#include <string>
namespace
RTC
{
namespace
RTCP
namespace
RTC
{
namespace
RTCP
{
{
...
@@ -13,8 +15,6 @@ namespace RTC { namespace RTCP
...
@@ -13,8 +15,6 @@ namespace RTC { namespace RTCP
class
SdesItem
class
SdesItem
{
{
static
const
char
*
_TypeString
[];
public
:
public
:
typedef
enum
Type
:
uint8_t
typedef
enum
Type
:
uint8_t
{
{
...
@@ -39,7 +39,7 @@ namespace RTC { namespace RTCP
...
@@ -39,7 +39,7 @@ namespace RTC { namespace RTCP
public
:
public
:
static
SdesItem
*
Parse
(
const
uint8_t
*
data
,
size_t
len
);
static
SdesItem
*
Parse
(
const
uint8_t
*
data
,
size_t
len
);
static
const
char
*
TypeString
(
uint8_t
type
);
static
const
std
::
string
&
Type2String
(
Type
type
);
public
:
public
:
SdesItem
(
Header
*
header
);
SdesItem
(
Header
*
header
);
...
@@ -60,6 +60,9 @@ namespace RTC { namespace RTCP
...
@@ -60,6 +60,9 @@ namespace RTC { namespace RTCP
// Passed by argument.
// Passed by argument.
Header
*
header
=
nullptr
;
Header
*
header
=
nullptr
;
uint8_t
*
raw
=
nullptr
;
uint8_t
*
raw
=
nullptr
;
private
:
static
std
::
map
<
SdesItem
::
Type
,
std
::
string
>
type2String
;
};
};
class
SdesChunk
class
SdesChunk
...
...
worker/src/RTC/RTCP/Packet.cpp
浏览文件 @
2e75da78
...
@@ -11,6 +11,17 @@ namespace RTC
...
@@ -11,6 +11,17 @@ namespace RTC
{
{
namespace
RTCP
namespace
RTCP
{
{
/* Namespace methods */
const
std
::
string
&
Type2String
(
Type
type
)
{
static
const
std
::
string
unknown
(
"UNKNOWN"
);
if
(
type2String
.
find
(
type
)
==
type2String
.
end
())
return
unknown
;
return
type2String
[
type
];
}
/* Class methods. */
/* Class methods. */
Packet
*
Packet
::
Parse
(
const
uint8_t
*
data
,
size_t
len
)
Packet
*
Packet
::
Parse
(
const
uint8_t
*
data
,
size_t
len
)
...
@@ -91,7 +102,7 @@ namespace RTCP
...
@@ -91,7 +102,7 @@ namespace RTCP
}
}
if
(
!
current
)
{
if
(
!
current
)
{
MS_WARN
(
"error parsing %s Packet"
,
Type
String
(
RTCP
::
Type
(
header
->
packet_type
)
));
MS_WARN
(
"error parsing %s Packet"
,
Type
2String
(
Type
(
header
->
packet_type
)).
c_str
(
));
return
first
;
return
first
;
}
}
...
@@ -111,33 +122,6 @@ namespace RTCP
...
@@ -111,33 +122,6 @@ namespace RTCP
return
first
;
return
first
;
}
}
const
char
*
Packet
::
TypeString
(
Type
type
)
{
switch
(
type
)
{
case
Type
:
:
FIR
:
return
"FIR"
;
case
Type
:
:
NACK
:
return
"NACK"
;
case
Type
:
:
SR
:
return
"SR"
;
case
Type
:
:
RR
:
return
"RR"
;
case
Type
:
:
SDES
:
return
"SDES"
;
case
Type
:
:
BYE
:
return
"BYE"
;
case
Type
:
:
APP
:
return
"APP"
;
case
Type
:
:
RTPFB
:
return
"RTPFB"
;
case
Type
:
:
PSFB
:
return
"PSFB"
;
default
:
return
"UNKNOWN"
;
}
}
/* Instance methods. */
/* Instance methods. */
Packet
::
Packet
(
Type
type
)
Packet
::
Packet
(
Type
type
)
...
...
worker/src/RTC/RTCP/Sdes.cpp
浏览文件 @
2e75da78
...
@@ -10,17 +10,19 @@ namespace RTC
...
@@ -10,17 +10,19 @@ namespace RTC
namespace
RTCP
namespace
RTCP
{
{
const
char
*
SdesItem
::
_TypeString
[]
/* Sdes Item Class variables. */
std
::
map
<
SdesItem
::
Type
,
std
::
string
>
SdesItem
::
type2String
=
{
{
"END"
,
{
END
,
"END"
}
,
"CNAME"
,
{
CNAME
,
"CNAME"
}
,
"NAME"
,
{
NAME
,
"NAME"
}
,
"EMAIL"
,
{
EMAIL
,
"EMAIL"
}
,
"PHONE"
,
{
PHONE
,
"PHONE"
}
,
"LOC"
,
{
LOC
,
"LOC"
}
,
"TOOL"
,
{
TOOL
,
"TOOL"
}
,
"NOTE"
,
{
NOTE
,
"NOTE"
}
,
"PRIV"
{
PRIV
,
"PRIV"
},
};
};
/* SDES Item Class methods. */
/* SDES Item Class methods. */
...
@@ -43,13 +45,14 @@ namespace RTCP
...
@@ -43,13 +45,14 @@ namespace RTCP
return
new
SdesItem
(
header
);
return
new
SdesItem
(
header
);
}
}
const
char
*
SdesItem
::
TypeString
(
uint8_t
type
)
const
std
::
string
&
SdesItem
::
Type2String
(
Type
type
)
{
{
if
(
type
<
sizeof
(
_TypeString
))
static
const
std
::
string
unknown
(
"UNKNOWN"
);
return
_TypeString
[
type
];
if
(
type2String
.
find
(
type
)
==
type2String
.
end
())
return
unknown
;
else
return
type2String
[
type
];
return
"UNKNOWN"
;
}
}
/* SDES Item Instance methods. */
/* SDES Item Instance methods. */
...
@@ -79,7 +82,7 @@ namespace RTCP
...
@@ -79,7 +82,7 @@ namespace RTCP
return
;
return
;
MS_WARN
(
"
\t\t
<Sdes Item>"
);
MS_WARN
(
"
\t\t
<Sdes Item>"
);
MS_WARN
(
"
\t\t\t
type: %s"
,
Type
String
(
this
->
GetType
()
));
MS_WARN
(
"
\t\t\t
type: %s"
,
Type
2String
(
this
->
GetType
()).
c_str
(
));
MS_WARN
(
"
\t\t\t
length: %u"
,
this
->
header
->
length
);
MS_WARN
(
"
\t\t\t
length: %u"
,
this
->
header
->
length
);
MS_WARN
(
"
\t\t\t
value: %.*s"
,
this
->
header
->
length
,
this
->
header
->
value
);
MS_WARN
(
"
\t\t\t
value: %.*s"
,
this
->
header
->
length
,
this
->
header
->
value
);
MS_WARN
(
"
\t\t
</Sdes Item>"
);
MS_WARN
(
"
\t\t
</Sdes Item>"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论