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
6220db77
Commit
6220db77
authored
Jul 07, 2021
by
ziyue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复webrtc纯音频推流时不能注册流的bug:#963
parent
039be544
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
44 行增加
和
23 行删除
+44
-23
webrtc/Sdp.cpp
+18
-4
webrtc/Sdp.h
+1
-0
webrtc/WebRtcTransport.cpp
+24
-19
webrtc/WebRtcTransport.h
+1
-0
没有找到文件。
webrtc/Sdp.cpp
查看文件 @
6220db77
...
...
@@ -1034,15 +1034,17 @@ string RtcSession::toRtspSdp() const{
switch
(
m
.
type
)
{
case
TrackAudio
:
case
TrackVideo
:
{
copy
.
media
.
emplace_back
(
m
);
copy
.
media
.
back
().
plan
.
resize
(
1
);
if
(
m
.
direction
!=
RtpDirection
::
inactive
)
{
copy
.
media
.
emplace_back
(
m
);
copy
.
media
.
back
().
plan
.
resize
(
1
);
}
break
;
}
default
:
continue
;
default
:
continue
;
}
}
CHECK
(
!
copy
.
media
.
empty
());
auto
sdp
=
copy
.
toRtcSessionSdp
();
toRtsp
(
sdp
->
items
);
int
i
=
0
;
...
...
@@ -1368,6 +1370,18 @@ bool RtcSession::supportRtcpFb(const string &name, TrackType type) const {
return
ref
.
find
(
name
)
!=
ref
.
end
();
}
bool
RtcSession
::
supportSimulcast
()
const
{
for
(
auto
&
m
:
media
)
{
if
(
!
m
.
rtp_rids
.
empty
())
{
return
true
;
}
if
(
!
m
.
rtp_ssrc_sim
.
empty
())
{
return
true
;
}
}
return
false
;
}
string
const
SdpConst
::
kTWCCRtcpFb
=
"transport-cc"
;
string
const
SdpConst
::
kRembRtcpFb
=
"goog-remb"
;
...
...
webrtc/Sdp.h
查看文件 @
6220db77
...
...
@@ -673,6 +673,7 @@ public:
const
RtcMedia
*
getMedia
(
TrackType
type
)
const
;
bool
haveSSRC
()
const
;
bool
supportRtcpFb
(
const
string
&
name
,
TrackType
type
=
TrackType
::
TrackVideo
)
const
;
bool
supportSimulcast
()
const
;
private
:
RtcSessionSdp
::
Ptr
toRtcSessionSdp
()
const
;
...
...
webrtc/WebRtcTransport.cpp
查看文件 @
6220db77
...
...
@@ -448,6 +448,7 @@ void WebRtcTransportImp::onStartWebRTC() {
if
(
canRecvRtp
())
{
_push_src
->
setSdp
(
getSdp
(
SdpType
::
answer
).
toRtspSdp
());
_simulcast
=
getSdp
(
SdpType
::
answer
).
supportSimulcast
();
}
if
(
canSendRtp
())
{
_reader
=
_play_src
->
getRing
()
->
attach
(
getPoller
(),
true
);
...
...
@@ -794,25 +795,29 @@ void WebRtcTransportImp::onSortedRtp(MediaTrack &track, const string &rid, RtpPa
}
}
if
(
_push_src
)
{
if
(
rtp
->
type
==
TrackAudio
)
{
//音频
for
(
auto
&
pr
:
_push_src_simulcast
)
{
pr
.
second
->
onWrite
(
rtp
,
false
);
}
}
else
{
//视频
auto
&
src
=
_push_src_simulcast
[
rid
];
if
(
!
src
)
{
auto
stream_id
=
rid
.
empty
()
?
_push_src
->
getId
()
:
_push_src
->
getId
()
+
"_"
+
rid
;
auto
src_imp
=
std
::
make_shared
<
RtspMediaSourceImp
>
(
_push_src
->
getVhost
(),
_push_src
->
getApp
(),
stream_id
);
src_imp
->
setSdp
(
_push_src
->
getSdp
());
src_imp
->
setProtocolTranslation
(
_push_src
->
isRecording
(
Recorder
::
type_hls
),
_push_src
->
isRecording
(
Recorder
::
type_mp4
));
src_imp
->
setListener
(
shared_from_this
());
src
=
src_imp
;
}
src
->
onWrite
(
std
::
move
(
rtp
),
false
);
if
(
!
_simulcast
)
{
assert
(
_push_src
);
_push_src
->
onWrite
(
rtp
,
false
);
return
;
}
if
(
rtp
->
type
==
TrackAudio
)
{
//音频
for
(
auto
&
pr
:
_push_src_simulcast
)
{
pr
.
second
->
onWrite
(
rtp
,
false
);
}
}
else
{
//视频
auto
&
src
=
_push_src_simulcast
[
rid
];
if
(
!
src
)
{
auto
stream_id
=
rid
.
empty
()
?
_push_src
->
getId
()
:
_push_src
->
getId
()
+
"_"
+
rid
;
auto
src_imp
=
std
::
make_shared
<
RtspMediaSourceImp
>
(
_push_src
->
getVhost
(),
_push_src
->
getApp
(),
stream_id
);
src_imp
->
setSdp
(
_push_src
->
getSdp
());
src_imp
->
setProtocolTranslation
(
_push_src
->
isRecording
(
Recorder
::
type_hls
),
_push_src
->
isRecording
(
Recorder
::
type_mp4
));
src_imp
->
setListener
(
shared_from_this
());
src
=
src_imp
;
}
src
->
onWrite
(
std
::
move
(
rtp
),
false
);
}
}
...
...
@@ -901,7 +906,7 @@ int WebRtcTransportImp::totalReaderCount(MediaSource &sender) {
for
(
auto
&
src
:
_push_src_simulcast
)
{
total_count
+=
src
.
second
->
totalReaderCount
();
}
return
total_count
;
return
total_count
+
_push_src
->
totalReaderCount
()
;
}
MediaOriginType
WebRtcTransportImp
::
getOriginType
(
MediaSource
&
sender
)
const
{
...
...
webrtc/WebRtcTransport.h
查看文件 @
6220db77
...
...
@@ -219,6 +219,7 @@ private:
void
createRtpChannel
(
const
string
&
rid
,
uint32_t
ssrc
,
const
MediaTrack
::
Ptr
&
track
);
private
:
bool
_simulcast
=
false
;
uint16_t
_rtx_seq
[
2
]
=
{
0
,
0
};
//用掉的总流量
uint64_t
_bytes_usage
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论