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
83208b0b
Commit
83208b0b
authored
Apr 01, 2021
by
ziyue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善
parent
868b379a
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
88 行增加
和
9 行删除
+88
-9
webrtc/Sdp.cpp
+36
-8
webrtc/Sdp.h
+4
-0
webrtc/WebRtcTransport.cpp
+1
-1
webrtc/answer.sdp
+47
-0
没有找到文件。
webrtc/Sdp.cpp
查看文件 @
83208b0b
...
...
@@ -468,6 +468,33 @@ string SdpAttrRtcp::toString() const {
return
SdpItem
::
toString
();
}
void
SdpAttrIceOption
::
parse
(
const
string
&
str
){
auto
vec
=
split
(
str
,
" "
);
for
(
auto
&
v
:
vec
)
{
if
(
!
strcasecmp
(
v
.
data
(),
"trickle"
))
{
trickle
=
true
;
continue
;
}
if
(
!
strcasecmp
(
v
.
data
(),
"renomination"
))
{
renomination
=
true
;
continue
;
}
}
}
string
SdpAttrIceOption
::
toString
()
const
{
if
(
value
.
empty
())
{
if
(
trickle
&&
renomination
)
{
value
=
"trickle renomination"
;
}
else
if
(
trickle
)
{
value
=
"trickle"
;
}
else
if
(
renomination
)
{
value
=
"renomination"
;
}
}
return
value
;
}
void
SdpAttrFingerprint
::
parse
(
const
string
&
str
)
{
auto
vec
=
split
(
str
,
" "
);
if
(
vec
.
size
()
!=
2
)
{
...
...
@@ -751,9 +778,10 @@ void RtcSession::loadFrom(const string &str) {
rtc_media
.
ice_pwd
=
media
.
getStringItem
(
'a'
,
"ice-pwd"
);
rtc_media
.
role
=
media
.
getItemClass
<
SdpAttrSetup
>
(
'a'
,
"setup"
).
role
;
rtc_media
.
fingerprint
=
media
.
getItemClass
<
SdpAttrFingerprint
>
(
'a'
,
"fingerprint"
);
rtc_media
.
ice_trickle
=
media
.
getItem
(
'a'
,
"ice-trickle"
).
operator
bool
();
rtc_media
.
ice_lite
=
media
.
getItem
(
'a'
,
"ice-lite"
).
operator
bool
();
rtc_media
.
ice_renomination
=
media
.
getItem
(
'a'
,
"ice-renomination"
).
operator
bool
();
auto
ice_options
=
media
.
getItemClass
<
SdpAttrIceOption
>
(
'a'
,
"ice-options"
);
rtc_media
.
ice_trickle
=
ice_options
.
trickle
;
rtc_media
.
ice_renomination
=
ice_options
.
renomination
;
rtc_media
.
candidate
=
media
.
getAllItem
<
SdpAttrCandidate
>
(
'a'
,
"candidate"
);
if
(
mline
.
type
==
TrackType
::
TrackApplication
)
{
...
...
@@ -922,15 +950,15 @@ string RtcSession::toString() const{
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
)
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpCommon
>
(
"ice-trickle"
)));
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
));
}
if
(
m
.
ice_lite
)
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpCommon
>
(
"ice-lite"
)));
}
if
(
m
.
ice_renomination
)
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpCommon
>
(
"ice-renomination"
)));
}
for
(
auto
&
ext
:
m
.
extmap
)
{
sdp_media
.
items
.
emplace_back
(
wrapSdpAttr
(
std
::
make_shared
<
SdpAttrExtmap
>
(
ext
)));
}
...
...
@@ -1215,8 +1243,8 @@ shared_ptr<RtcSession> RtcConfigure::createAnswer(const RtcSession &offer){
ret
->
session_info
=
"zlmediakit_webrtc_session"
;
ret
->
connection
.
parse
(
"IN IP4 0.0.0.0"
);
ret
->
msid_semantic
.
parse
(
"WMS *"
);
matchMedia
(
ret
,
TrackVideo
,
offer
.
media
,
video
);
matchMedia
(
ret
,
TrackAudio
,
offer
.
media
,
audio
);
matchMedia
(
ret
,
TrackVideo
,
offer
.
media
,
video
);
matchMedia
(
ret
,
TrackApplication
,
offer
.
media
,
application
);
return
ret
;
}
...
...
webrtc/Sdp.h
查看文件 @
83208b0b
...
...
@@ -282,6 +282,10 @@ public:
class
SdpAttrIceOption
:
public
SdpItem
{
public
:
//a=ice-options:trickle
bool
trickle
{
false
};
bool
renomination
{
false
};
void
parse
(
const
string
&
str
)
override
;
string
toString
()
const
override
;
const
char
*
getKey
()
const
override
{
return
"ice-options"
;}
};
...
...
webrtc/WebRtcTransport.cpp
查看文件 @
83208b0b
...
...
@@ -78,7 +78,7 @@ string getFingerprint(const string &algorithm_str, const std::shared_ptr<RTC::Dt
}
std
::
string
WebRtcTransport
::
getAnswerSdp
(
const
string
&
offer
){
InfoL
<<
offer
;
//
InfoL << offer;
_offer_sdp
=
std
::
make_shared
<
RtcSession
>
();
_offer_sdp
->
loadFrom
(
offer
);
...
...
webrtc/answer.sdp
0 → 100644
查看文件 @
83208b0b
v=0
o=- 0 0 IN IP4 0.0.0.0
s=zlmediakit_webrtc_session
i=zlmediakit_webrtc_session
t=0 0
c=IN IP4 0.0.0.0
a=msid-semantic: WMS *
a=group:BUNDLE 0 1
m=audio 0 UDP/TLS/RTP/SAVPF 111
a=mid:0
c=IN IP4 0.0.0.0
a=ice-ufrag:PdK3
a=ice-pwd:PdK31zZ1sKhPU2ACzP5av37f
a=fingerprint:sha-256 D1:4F:7B:70:86:99:BE:1E:7E:B8:C7:0F:13:BC:78:C4:6A:F9:2C:F6:F3:5E:42:11:0F:1C:74:18:F6:DD:95:75
a=setup:passive
a=ice-options:trickle
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=recvonly
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
m=video 0 UDP/TLS/RTP/SAVPF 102 121
a=mid:1
c=IN IP4 0.0.0.0
a=ice-ufrag:PdK3
a=ice-pwd:PdK31zZ1sKhPU2ACzP5av37f
a=fingerprint:sha-256 D1:4F:7B:70:86:99:BE:1E:7E:B8:C7:0F:13:BC:78:C4:6A:F9:2C:F6:F3:5E:42:11:0F:1C:74:18:F6:DD:95:75
a=setup:passive
a=ice-options:trickle
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:13 urn:3gpp:video-orientation
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=recvonly
a=rtcp-mux
a=rtpmap:102 H264/90000
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:121 rtx/90000
a=fmtp:121 apt=102
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论