Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
a1b2aa9a
Commit
a1b2aa9a
authored
4 years ago
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理与校验
parent
87c53dab
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
77 行增加
和
20 行删除
+77
-20
webrtc/Sdp.cpp
+52
-2
webrtc/Sdp.h
+25
-18
没有找到文件。
webrtc/Sdp.cpp
查看文件 @
a1b2aa9a
...
@@ -949,9 +949,7 @@ void RtcSession::loadFrom(const string &str) {
...
@@ -949,9 +949,7 @@ void RtcSession::loadFrom(const string &str) {
if
(
group
.
isFID
())
{
if
(
group
.
isFID
())
{
ssrc_rtp
=
group
.
u
.
fid
.
rtp_ssrc
;
ssrc_rtp
=
group
.
u
.
fid
.
rtp_ssrc
;
ssrc_rtx
=
group
.
u
.
fid
.
rtx_ssrc
;
ssrc_rtx
=
group
.
u
.
fid
.
rtx_ssrc
;
rtc_media
.
rtx
=
true
;
}
else
if
(
group
.
isSIM
())
{
}
else
if
(
group
.
isSIM
())
{
rtc_media
.
simulcast
=
true
;
ssrc_rtp_low
=
group
.
u
.
sim
.
rtp_ssrc_low
;
ssrc_rtp_low
=
group
.
u
.
sim
.
rtp_ssrc_low
;
ssrc_rtp_mid
=
group
.
u
.
sim
.
rtp_ssrc_mid
;
ssrc_rtp_mid
=
group
.
u
.
sim
.
rtp_ssrc_mid
;
ssrc_rtp_high
=
group
.
u
.
sim
.
rtp_ssrc_high
;
ssrc_rtp_high
=
group
.
u
.
sim
.
rtp_ssrc_high
;
...
@@ -1033,4 +1031,55 @@ void RtcSession::loadFrom(const string &str) {
...
@@ -1033,4 +1031,55 @@ void RtcSession::loadFrom(const string &str) {
}
}
group
=
sdp
.
getItemClass
<
SdpAttrGroup
>
(
'a'
,
"group"
);
group
=
sdp
.
getItemClass
<
SdpAttrGroup
>
(
'a'
,
"group"
);
checkValid
();
}
string
RtcCodecPlan
::
getFmtp
(
const
char
*
key
)
const
{
for
(
auto
&
item
:
fmtp
)
{
if
(
item
.
first
==
key
)
{
return
item
.
second
;
}
}
return
""
;
}
const
RtcCodecPlan
*
RtcMedia
::
getPlan
(
uint8_t
pt
)
const
{
for
(
auto
&
item
:
plan
)
{
if
(
item
.
pt
==
pt
)
{
return
&
item
;
}
}
return
nullptr
;
}
void
RtcMedia
::
checkValid
()
const
{
switch
(
direction
)
{
case
RtpDirection
:
:
sendonly
:
case
RtpDirection
:
:
sendrecv
:
{
if
(
rtp_ssrc
.
empty
())
{
throw
std
::
invalid_argument
(
"发送rtp但是未指定rtp ssrc"
);
}
break
;
}
default
:
break
;
}
for
(
auto
&
item
:
plan
)
{
if
(
item
.
codec
==
"rtx"
)
{
if
(
rtx_ssrc
.
empty
())
{
throw
std
::
invalid_argument
(
"指定开启rtx但是未指定rtx ssrc"
);
}
auto
apt
=
atoi
(
item
.
getFmtp
(
"apt"
).
data
());
if
(
!
getPlan
(
apt
))
{
throw
std
::
invalid_argument
(
"找不到rtx关联的plan信息"
);
}
}
}
//todo 校验更多信息
}
void
RtcSession
::
checkValid
()
const
{
for
(
auto
&
item
:
media
)
{
item
.
checkValid
();
}
//todo 校验更多信息
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
webrtc/Sdp.h
查看文件 @
a1b2aa9a
...
@@ -517,6 +517,8 @@ public:
...
@@ -517,6 +517,8 @@ public:
string
msid
;
string
msid
;
string
mslabel
;
string
mslabel
;
string
label
;
string
label
;
bool
empty
()
const
{
return
ssrc
==
0
;}
};
};
//rtc传输编码方案
//rtc传输编码方案
...
@@ -527,47 +529,48 @@ public:
...
@@ -527,47 +529,48 @@ public:
uint32_t
sample_rate
;
uint32_t
sample_rate
;
//音频时有效
//音频时有效
uint32_t
channel
=
0
;
uint32_t
channel
=
0
;
//rtcp反馈
vector
<
string
>
rtcp_fb
;
vector
<
string
>
rtcp_fb
;
vector
<
std
::
pair
<
string
/*key*/
,
string
/*value*/
>
>
fmtp
;
vector
<
std
::
pair
<
string
/*key*/
,
string
/*value*/
>
>
fmtp
;
string
getFmtp
(
const
char
*
key
)
const
;
};
};
//rtc 媒体描述
//rtc 媒体描述
class
RtcMedia
{
class
RtcMedia
{
public
:
public
:
TrackType
type
;
TrackType
type
{
TrackType
::
TrackInvalid
}
;
string
mid
;
string
mid
;
uint16_t
port
;
uint16_t
port
{
0
};
SdpConnection
addr
;
string
proto
;
string
proto
;
RtpDirection
direction
{
RtpDirection
::
invalid
};
vector
<
RtcCodecPlan
>
plan
;
//////// rtp ////////
//////// rtp ////////
RtcSSRC
rtp_ssrc
;
RtcSSRC
rtp_ssrc
;
// for simulcast
RtcSSRC
rtx_ssrc
;
bool
simulcast
{
false
};
//////// simulcast ////////
RtcSSRC
rtp_ssrc_low
;
RtcSSRC
rtp_ssrc_low
;
RtcSSRC
rtp_ssrc_mid
;
RtcSSRC
rtp_ssrc_mid
;
RtcSSRC
rtp_ssrc_high
;
RtcSSRC
rtp_ssrc_high
;
SdpConnection
addr
;
//////// rtcp ////////
RtpDirection
direction
;
bool
rtcp_mux
{
false
};
vector
<
RtcCodecPlan
>
plan
;
bool
rtcp_rsize
{
false
};
//////// rtx - rtcp ////////
bool
rtx
{
false
};
bool
rtcp_mux
;
bool
rtcp_rsize
;
RtcSSRC
rtx_ssrc
;
SdpAttrRtcp
rtcp_addr
;
SdpAttrRtcp
rtcp_addr
;
//////// ice ////////
//////// ice ////////
bool
ice_trickle
;
bool
ice_trickle
{
false
}
;
bool
ice_lite
;
bool
ice_lite
{
false
}
;
bool
ice_renomination
;
bool
ice_renomination
{
false
}
;
string
ice_ufrag
;
string
ice_ufrag
;
string
ice_pwd
;
string
ice_pwd
;
std
::
vector
<
SdpAttrCandidate
>
candidate
;
std
::
vector
<
SdpAttrCandidate
>
candidate
;
//////// dtls ////////
//////// dtls ////////
DtlsRole
role
;
DtlsRole
role
{
DtlsRole
::
invalid
}
;
SdpAttrFingerprint
fingerprint
;
SdpAttrFingerprint
fingerprint
;
//////// extmap ////////
//////// extmap ////////
...
@@ -575,7 +578,10 @@ public:
...
@@ -575,7 +578,10 @@ public:
//////// sctp ////////////
//////// sctp ////////////
SdpAttrSctpMap
sctpmap
;
SdpAttrSctpMap
sctpmap
;
uint32_t
sctp_port
{
0
};
uint32_t
sctp_port
{
0
};
void
checkValid
()
const
;
const
RtcCodecPlan
*
getPlan
(
uint8_t
pt
)
const
;
};
};
class
RtcSession
{
class
RtcSession
{
...
@@ -591,6 +597,7 @@ public:
...
@@ -591,6 +597,7 @@ public:
SdpAttrGroup
group
;
SdpAttrGroup
group
;
void
loadFrom
(
const
string
&
sdp
);
void
loadFrom
(
const
string
&
sdp
);
void
checkValid
()
const
;
};
};
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论