Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
c6538783
提交
c6538783
authored
10月 11, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Producer: enhance mothod naming
上级
2f0935ba
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
27 行增加
和
38 行删除
+27
-38
Producer.hpp
worker/include/RTC/Producer.hpp
+3
-2
Producer.cpp
worker/src/RTC/Producer.cpp
+24
-36
没有找到文件。
worker/include/RTC/Producer.hpp
浏览文件 @
c6538783
...
...
@@ -82,8 +82,9 @@ namespace RTC
void
ClearRtpStreams
();
void
ApplyRtpMapping
(
RTC
::
RtpPacket
*
packet
)
const
;
RTC
::
RtpEncodingParameters
::
Profile
GetProfile
(
RTC
::
RtpStreamRecv
*
rtpStream
,
RTC
::
RtpPacket
*
packet
);
void
AddActiveProfiles
(
RTC
::
RtpStreamRecv
*
rtpStream
);
void
RemoveActiveProfiles
(
RTC
::
RtpStreamRecv
*
rtpStream
);
void
ActivateStreamProfiles
(
RTC
::
RtpStreamRecv
*
rtpStream
);
void
DeactivateStreamProfiles
(
RTC
::
RtpStreamRecv
*
rtpStream
);
bool
IsStreamActive
(
const
RTC
::
RtpStream
*
rtpStream
)
const
;
/* Pure virtual methods inherited from RTC::RtpStreamRecv::Listener. */
public
:
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
c6538783
...
...
@@ -544,7 +544,7 @@ namespace RTC
this
->
mapRtpStreamProfiles
[
rtpStream
].
insert
(
profile
);
// Add new profile/s into active profiles map and notify the listener.
A
ddActive
Profiles
(
rtpStream
);
A
ctivateStream
Profiles
(
rtpStream
);
// Request a key frame since we may have lost the first packets of this stream.
RequestKeyFrame
(
true
);
...
...
@@ -555,7 +555,7 @@ namespace RTC
MS_TRACE
();
// Remove the profiles related to this stream from active profiles map and notify the listener.
RemoveActive
Profiles
(
rtpStream
);
DeactivateStream
Profiles
(
rtpStream
);
this
->
rtpStreams
.
erase
(
rtpStream
->
GetSsrc
());
...
...
@@ -662,7 +662,7 @@ namespace RTC
MS_THROW_ERROR
(
"unknown RTP packet received [ssrc:%"
PRIu32
"]"
,
packet
->
GetSsrc
());
}
void
Producer
::
A
ddActive
Profiles
(
RTC
::
RtpStreamRecv
*
rtpStream
)
void
Producer
::
A
ctivateStream
Profiles
(
RTC
::
RtpStreamRecv
*
rtpStream
)
{
auto
&
profiles
=
this
->
mapRtpStreamProfiles
[
rtpStream
];
...
...
@@ -683,7 +683,7 @@ namespace RTC
}
}
void
Producer
::
RemoveActive
Profiles
(
RTC
::
RtpStreamRecv
*
rtpStream
)
void
Producer
::
DeactivateStream
Profiles
(
RTC
::
RtpStreamRecv
*
rtpStream
)
{
auto
&
profiles
=
this
->
mapRtpStreamProfiles
[
rtpStream
];
...
...
@@ -704,6 +704,19 @@ namespace RTC
}
}
bool
Producer
::
IsStreamActive
(
const
RTC
::
RtpStream
*
rtpStream
)
const
{
for
(
auto
it
:
this
->
mapActiveProfiles
)
{
auto
activeRtpStream
=
it
.
second
;
if
(
activeRtpStream
==
rtpStream
)
return
true
;
}
return
false
;
}
void
Producer
::
OnRtpStreamRecvNackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
{
...
...
@@ -802,27 +815,14 @@ namespace RTC
if
(
totalBitrate
==
0
)
return
;
// Check whether the stream is already active.
const
RtpStream
*
activeRtpStream
=
nullptr
;
for
(
auto
it
:
this
->
mapActiveProfiles
)
{
activeRtpStream
=
it
.
second
;
// Remove stream from the active profiles map.
if
(
activeRtpStream
==
rtpStream
)
{
MS_DEBUG_TAG
(
rtp
,
"rtp inactivity detected [ssrc:%"
PRIu32
"]"
,
rtpStream
->
GetSsrc
());
// Deactivate stream profiles if active.
if
(
IsStreamActive
(
rtpStream
))
DeactivateStreamProfiles
(
rtpStreamRecv
);
RemoveActiveProfiles
(
rtpStreamRecv
);
break
;
}
}
// Reset stream check timer on every active stream.
// Reset stream check timer on every stream whose profiles are active.
for
(
auto
it
:
this
->
mapActiveProfiles
)
{
activeRtpStream
=
it
.
second
;
a
uto
a
ctiveRtpStream
=
it
.
second
;
auto
ssrc
=
activeRtpStream
->
GetSsrc
();
this
->
rtpStreams
[
ssrc
]
->
ResetStatusCheckTimer
(
RTC
::
RtpStream
::
StatusCheckPeriod
*
2
);
...
...
@@ -839,21 +839,9 @@ namespace RTC
this
->
mapRtpStreamProfiles
.
find
(
rtpStreamRecv
)
!=
this
->
mapRtpStreamProfiles
.
end
(),
"stream not present in mapRtpStreamProfiles"
);
// Check whether the stream is already active.
const
RtpStream
*
activeRtpStream
=
nullptr
;
for
(
auto
it
:
this
->
mapActiveProfiles
)
{
activeRtpStream
=
it
.
second
;
if
(
activeRtpStream
!=
nullptr
)
break
;
}
// Add the profiles related to this stream into active profiles map and notify the listener.
if
(
!
activeRtpStream
)
if
(
!
IsStreamActive
(
rtpStream
))
{
A
ddActive
Profiles
(
rtpStreamRecv
);
A
ctivateStream
Profiles
(
rtpStreamRecv
);
MS_DEBUG_TAG
(
rtp
,
"stream is now active [ssrc:%"
PRIu32
"]"
,
rtpStream
->
GetSsrc
());
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论