Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
13ca7f07
提交
13ca7f07
authored
9月 13, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
smooth profile transition.
Wait upon reception of a video key frame to make the transition effective.
上级
2df20fbf
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
82 行增加
和
20 行删除
+82
-20
Consumer.hpp
worker/include/RTC/Consumer.hpp
+1
-0
Consumer.cpp
worker/src/RTC/Consumer.cpp
+81
-20
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
13ca7f07
...
...
@@ -63,6 +63,7 @@ namespace RTC
void
CreateRtpStream
(
RTC
::
RtpEncodingParameters
&
encoding
);
void
RetransmitRtpPacket
(
RTC
::
RtpPacket
*
packet
);
void
RecalculateEffectiveProfile
();
void
SetEffectiveProfile
(
RTC
::
RtpEncodingParameters
::
Profile
profile
);
/* Pure virtual methods inherited from RTC::RtpStream::Listener. */
public
:
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
13ca7f07
...
...
@@ -5,6 +5,7 @@
#include "Logger.hpp"
#include "MediaSoupError.hpp"
#include "Utils.hpp"
#include "RTC/Codecs/Codecs.hpp"
#include "RTC/RTCP/FeedbackRtpNack.hpp"
#include "RTC/RTCP/SenderReport.hpp"
#include <vector>
...
...
@@ -237,7 +238,7 @@ namespace RTC
this
->
profiles
.
insert
(
profile
);
MS_DEBUG_TAG
(
rtp
,
"profile added
: %s
"
,
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
rtp
,
"profile added
[profile:%s]
"
,
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
;
RecalculateEffectiveProfile
();
...
...
@@ -257,8 +258,8 @@ namespace RTC
MS_DEBUG_TAG
(
rtp
,
"profile removed
: %s
"
,
RTC
::
RtpEncodingParameters
::
profile2String
[
this
->
effectiveP
rofile
].
c_str
());
"profile removed
[profile:%s]
"
,
RTC
::
RtpEncodingParameters
::
profile2String
[
p
rofile
].
c_str
());
;
RecalculateEffectiveProfile
();
...
...
@@ -273,6 +274,12 @@ namespace RTC
this
->
preferredProfile
=
profile
;
MS_DEBUG_TAG
(
rtp
,
"preferred profile set [profile:%s]"
,
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
;
RecalculateEffectiveProfile
();
}
...
...
@@ -323,6 +330,26 @@ namespace RTC
return
;
}
// Whether we want to re-transmit the packet.
bool
retransmissionNeeded
=
false
;
// Check whether this is the key frame we are waiting for in order to update the effective
// profile.
if
(
this
->
effectiveProfile
!=
this
->
preferredProfile
&&
profile
==
this
->
preferredProfile
&&
Codecs
::
isKeyFrame
(
this
->
rtpStream
->
GetMymeType
(),
packet
))
{
MS_DEBUG_TAG
(
rtp
,
"changing effective profile after receiving a key frame"
);
this
->
syncRequired
=
true
;
this
->
rtpStream
->
ClearRetransmissionBuffer
();
// Send this packet twice.
retransmissionNeeded
=
true
;
SetEffectiveProfile
(
this
->
preferredProfile
);
}
// If the packet belongs to different profile than the one being sent, drop it.
// NOTE: This is specific to simulcast with no temporal layers.
if
(
profile
!=
this
->
effectiveProfile
)
...
...
@@ -391,6 +418,17 @@ namespace RTC
// Update transmitted RTP data counter.
this
->
transmittedCounter
.
Update
(
packet
);
if
(
retransmissionNeeded
)
{
MS_DEBUG_TAG
(
rtp
,
"retransmitting packet [ssrc:%"
PRIu32
", seq:%"
PRIu16
"]"
,
packet
->
GetSsrc
(),
packet
->
GetSequenceNumber
());
RetransmitRtpPacket
(
packet
);
}
}
// Restore packet SSRC.
...
...
@@ -568,8 +606,8 @@ namespace RTC
MS_DEBUG_TAG
(
rtx
,
"sending RTX packet [ssrc:
%"
PRIu32
", seq: %"
PRIu16
"
] recovering original [ssrc: %"
PRIu32
", seq:
%"
PRIu16
"]"
,
"sending RTX packet [ssrc:
%"
PRIu32
", seq:%"
PRIu16
"] recovering original [ssrc:%"
PRIu32
"
, seq:
%"
PRIu16
"]"
,
rtxPacket
->
GetSsrc
(),
rtxPacket
->
GetSequenceNumber
(),
packet
->
GetSsrc
(),
...
...
@@ -580,7 +618,7 @@ namespace RTC
rtxPacket
=
packet
;
MS_DEBUG_TAG
(
rtx
,
"retransmitting packet [ssrc:
%"
PRIu32
", seq:
%"
PRIu16
"]"
,
"retransmitting packet [ssrc:
%"
PRIu32
", seq:
%"
PRIu16
"]"
,
rtxPacket
->
GetSsrc
(),
rtxPacket
->
GetSequenceNumber
());
}
...
...
@@ -598,10 +636,6 @@ namespace RTC
void
Consumer
::
RecalculateEffectiveProfile
()
{
static
const
Json
::
StaticString
JsonStringProfile
{
"profile"
};
Json
::
Value
eventData
(
Json
::
objectValue
);
RTC
::
RtpEncodingParameters
::
Profile
newProfile
;
// If there are no profiles, select none or default, depending on whether this
...
...
@@ -641,7 +675,43 @@ namespace RTC
if
(
newProfile
==
this
->
effectiveProfile
)
return
;
this
->
effectiveProfile
=
newProfile
;
if
(
IsEnabled
()
&&
!
IsPaused
())
{
/*
* - This is the first time we are setting the effective profile.
* - The current effective profile is no longer available.
* - We don't handle the key frames for the used codec.
*/
if
(
this
->
effectiveProfile
==
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
||
this
->
profiles
.
find
(
this
->
effectiveProfile
)
==
this
->
profiles
.
end
()
||
!
RTC
::
Codecs
::
isKnown
(
this
->
rtpStream
->
GetMymeType
()))
{
this
->
syncRequired
=
true
;
this
->
rtpStream
->
ClearRetransmissionBuffer
();
SetEffectiveProfile
(
newProfile
);
}
// Otherwise set the effective profile upon reception of a key frame.
else
{
}
RequestFullFrame
();
}
else
{
SetEffectiveProfile
(
newProfile
);
}
}
void
Consumer
::
SetEffectiveProfile
(
RTC
::
RtpEncodingParameters
::
Profile
profile
)
{
static
const
Json
::
StaticString
JsonStringProfile
{
"profile"
};
Json
::
Value
eventData
(
Json
::
objectValue
);
this
->
effectiveProfile
=
profile
;
MS_DEBUG_TAG
(
rtp
,
...
...
@@ -652,14 +722,5 @@ namespace RTC
// Notify.
eventData
[
JsonStringProfile
]
=
RTC
::
RtpEncodingParameters
::
profile2String
[
this
->
effectiveProfile
];
this
->
notifier
->
Emit
(
this
->
consumerId
,
"effectiveprofilechange"
,
eventData
);
if
(
IsEnabled
()
&&
!
IsPaused
())
{
this
->
rtpStream
->
ClearRetransmissionBuffer
();
RequestFullFrame
();
}
this
->
syncRequired
=
true
;
}
}
// namespace RTC
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论