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
4853a5af
Commit
4853a5af
authored
Apr 01, 2021
by
ziyue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善answer代码
parent
83208b0b
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
23 行增加
和
15 行删除
+23
-15
webrtc/Sdp.cpp
+19
-15
webrtc/Sdp.h
+4
-0
没有找到文件。
webrtc/Sdp.cpp
查看文件 @
4853a5af
...
...
@@ -924,12 +924,14 @@ string RtcSession::toString() const{
sdp
.
items
.
emplace_back
(
std
::
make_shared
<
SdpString
<
'i'
>
>
(
session_info
));
}
sdp
.
items
.
emplace_back
(
std
::
make_shared
<
SdpTime
>
(
time
));
sdp
.
items
.
emplace_back
(
std
::
make_shared
<
SdpConnection
>
(
connection
));
if
(
connection
.
empty
()){
sdp
.
items
.
emplace_back
(
std
::
make_shared
<
SdpConnection
>
(
connection
));
}
if
(
!
bandwidth
.
empty
())
{
sdp
.
items
.
emplace_back
(
std
::
make_shared
<
SdpBandwidth
>
(
bandwidth
));
}
sdp
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrMsidSemantic
>
(
msid_semantic
)));
sdp
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrGroup
>
(
group
)));
sdp
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrMsidSemantic
>
(
msid_semantic
)));
for
(
auto
&
m
:
media
)
{
sdp
.
medias
.
emplace_back
();
auto
&
sdp_media
=
sdp
.
medias
.
back
();
...
...
@@ -944,18 +946,22 @@ string RtcSession::toString() const{
mline
->
fmts
.
emplace_back
(
m
.
sctp_port
);
}
sdp_media
.
items
.
emplace_back
(
std
::
move
(
mline
));
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrMid
>
(
m
.
mid
)));
sdp_media
.
items
.
emplace_back
(
std
::
make_shared
<
SdpConnection
>
(
m
.
addr
));
if
(
!
m
.
rtcp_addr
.
empty
())
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrRtcp
>
(
m
.
rtcp_addr
)));
}
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrIceUfrag
>
(
m
.
ice_ufrag
)));
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrIcePwd
>
(
m
.
ice_pwd
)));
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrFingerprint
>
(
m
.
fingerprint
)));
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrSetup
>
(
m
.
role
)));
if
(
m
.
ice_trickle
||
m
.
ice_renomination
)
{
auto
attr
=
std
::
make_shared
<
SdpAttrIceOption
>
();
attr
->
trickle
=
m
.
ice_trickle
;
attr
->
renomination
=
m
.
ice_renomination
;
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
attr
));
}
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrFingerprint
>
(
m
.
fingerprint
)));
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrSetup
>
(
m
.
role
)));
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrMid
>
(
m
.
mid
)));
if
(
m
.
ice_lite
)
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpCommon
>
(
"ice-lite"
)));
}
...
...
@@ -965,9 +971,6 @@ string RtcSession::toString() const{
if
(
m
.
direction
!=
RtpDirection
::
invalid
)
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
DirectionInterfaceImp
>
(
m
.
direction
)));
}
if
(
m
.
rtcp_addr
.
port
)
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrRtcp
>
(
m
.
rtcp_addr
)));
}
if
(
m
.
rtcp_mux
)
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpCommon
>
(
"rtcp-mux"
)));
}
...
...
@@ -1145,7 +1148,7 @@ RtcMedia *RtcSession::getMedia(TrackType type){
void
RtcConfigure
::
RtcTrackConfigure
::
setDefaultSetting
(
TrackType
type
){
enable
=
true
;
rtcp_mux
=
true
;
rtcp_rsize
=
fals
e
;
rtcp_rsize
=
tru
e
;
group_bundle
=
true
;
unified_plan
=
false
;
support_rtx
=
true
;
...
...
@@ -1238,11 +1241,9 @@ shared_ptr<RtcSession> RtcConfigure::createOffer(){
shared_ptr
<
RtcSession
>
RtcConfigure
::
createAnswer
(
const
RtcSession
&
offer
){
shared_ptr
<
RtcSession
>
ret
=
std
::
make_shared
<
RtcSession
>
();
ret
->
version
=
offer
.
version
;
ret
->
origin
.
parse
(
"- 0 0 IN IP4 0.0.0.0"
);
ret
->
session_name
=
"zlmediakit_webrtc_session"
;
ret
->
session_info
=
"zlmediakit_webrtc_session"
;
ret
->
connection
.
parse
(
"IN IP4 0.0.0.0"
);
ret
->
msid_semantic
.
parse
(
"WMS *"
);
ret
->
origin
=
offer
.
origin
;
ret
->
session_name
=
offer
.
session_name
;
ret
->
msid_semantic
=
offer
.
msid_semantic
;
matchMedia
(
ret
,
TrackAudio
,
offer
.
media
,
audio
);
matchMedia
(
ret
,
TrackVideo
,
offer
.
media
,
video
);
matchMedia
(
ret
,
TrackApplication
,
offer
.
media
,
application
);
...
...
@@ -1283,19 +1284,22 @@ void RtcConfigure::matchMedia(shared_ptr<RtcSession> &ret, TrackType type, const
answer_media
.
type
=
offer_media
.
type
;
answer_media
.
mid
=
offer_media
.
mid
;
answer_media
.
proto
=
offer_media
.
proto
;
answer_media
.
port
=
offer_media
.
port
;
answer_media
.
rtcp_mux
=
offer_media
.
rtcp_mux
&&
configure
.
rtcp_mux
;
answer_media
.
rtcp_rsize
=
offer_media
.
rtcp_rsize
&&
configure
.
rtcp_rsize
;
answer_media
.
rtcp_addr
=
offer_media
.
rtcp_addr
;
answer_media
.
ice_trickle
=
offer_media
.
ice_trickle
&&
configure
.
ice_trickle
;
answer_media
.
ice_renomination
=
offer_media
.
ice_renomination
&&
configure
.
ice_renomination
;
answer_media
.
ice_ufrag
=
configure
.
ice_ufrag
;
answer_media
.
ice_pwd
=
configure
.
ice_pwd
;
answer_media
.
fingerprint
=
configure
.
fingerprint
;
answer_media
.
ice_lite
=
configure
.
ice_lite
;
switch
(
offer_media
.
role
)
{
case
DtlsRole
:
:
actpass
:
case
DtlsRole
:
:
active
:
{
answer_media
.
role
=
DtlsRole
::
passive
;
break
;
}
case
DtlsRole
:
:
actpass
:
case
DtlsRole
:
:
passive
:
{
answer_media
.
role
=
DtlsRole
::
active
;
break
;
...
...
webrtc/Sdp.h
查看文件 @
4853a5af
...
...
@@ -159,6 +159,7 @@ public:
void
parse
(
const
string
&
str
)
override
;
string
toString
()
const
override
;
const
char
*
getKey
()
const
override
{
return
"c"
;}
bool
empty
()
const
{
return
address
.
empty
();}
};
class
SdpBandwidth
:
public
SdpItem
{
...
...
@@ -261,6 +262,9 @@ public:
void
parse
(
const
string
&
str
)
override
;;
string
toString
()
const
override
;
const
char
*
getKey
()
const
override
{
return
"rtcp"
;}
bool
empty
()
const
{
return
address
.
empty
()
||
!
port
;
}
};
class
SdpAttrIceUfrag
:
public
SdpItem
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论