Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
0fdd6356
提交
0fdd6356
authored
9月 14, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- Refactor RTC/Codecs so we have RtpPacket::IsKeyFrame().
- s/fullframe/keyframe/g
上级
3df732bb
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
130 行增加
和
118 行删除
+130
-118
Codecs.hpp
worker/include/RTC/Codecs/Codecs.hpp
+19
-3
VP8.hpp
worker/include/RTC/Codecs/VP8.hpp
+3
-1
Consumer.hpp
worker/include/RTC/Consumer.hpp
+1
-1
ConsumerListener.hpp
worker/include/RTC/ConsumerListener.hpp
+1
-1
NackGenerator.hpp
worker/include/RTC/NackGenerator.hpp
+1
-1
Producer.hpp
worker/include/RTC/Producer.hpp
+3
-3
Router.hpp
worker/include/RTC/Router.hpp
+1
-1
RtpPacket.hpp
worker/include/RTC/RtpPacket.hpp
+13
-0
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+2
-2
Transport.hpp
worker/include/RTC/Transport.hpp
+1
-1
Codecs.cpp
worker/src/RTC/Codecs/Codecs.cpp
+7
-27
VP8.cpp
worker/src/RTC/Codecs/VP8.cpp
+16
-18
Consumer.cpp
worker/src/RTC/Consumer.cpp
+8
-7
NackGenerator.cpp
worker/src/RTC/NackGenerator.cpp
+3
-3
Producer.cpp
worker/src/RTC/Producer.cpp
+29
-27
Router.cpp
worker/src/RTC/Router.cpp
+2
-2
RtpPacket.cpp
worker/src/RTC/RtpPacket.cpp
+3
-3
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+3
-3
Transport.cpp
worker/src/RTC/Transport.cpp
+14
-14
没有找到文件。
worker/include/RTC/Codecs/Codecs.hpp
浏览文件 @
0fdd6356
...
...
@@ -3,15 +3,31 @@
#include "common.hpp"
#include "RTC/Codecs/VP8.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpDictionaries.hpp"
namespace
RTC
{
namespace
Codecs
{
bool
IsKnown
(
const
RTC
::
RtpCodecMimeType
&
mimeType
);
bool
IsKeyFrame
(
const
RTC
::
RtpCodecMimeType
&
mimeType
,
const
RTC
::
RtpPacket
*
packet
);
bool
CanBeKeyFrame
(
const
RTC
::
RtpCodecMimeType
&
mimeType
);
void
ProcessRtpPacket
(
RTC
::
RtpPacket
*
packet
,
const
RTC
::
RtpCodecMimeType
&
mimeType
);
// Inline namespace methods.
inline
bool
CanBeKeyFrame
(
const
RTC
::
RtpCodecMimeType
&
mimeType
)
{
if
(
mimeType
.
type
!=
RTC
::
RtpCodecMimeType
::
Type
::
VIDEO
)
return
false
;
switch
(
mimeType
.
subtype
)
{
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP8
:
return
true
;
default:
return
false
;
}
}
}
// namespace Codecs
}
// namespace RTC
...
...
worker/include/RTC/Codecs/VP8.hpp
浏览文件 @
0fdd6356
...
...
@@ -2,6 +2,8 @@
#define MS_RTC_CODECS_VP8_HPP
#include "common.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpDictionaries.hpp"
namespace
RTC
{
...
...
@@ -10,7 +12,7 @@ namespace RTC
class
VP8
{
public
:
static
bool
IsKeyFrame
(
const
uint8_t
*
data
,
size_t
len
);
static
void
ProcessRtpPacket
(
RTC
::
RtpPacket
*
packet
);
};
}
// namespace Codecs
}
// namespace RTC
...
...
worker/include/RTC/Consumer.hpp
浏览文件 @
0fdd6356
...
...
@@ -56,7 +56,7 @@ namespace RTC
void
ReceiveNack
(
RTC
::
RTCP
::
FeedbackRtpNackPacket
*
nackPacket
);
void
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
uint32_t
GetTransmissionRate
(
uint64_t
now
);
void
Request
Full
Frame
();
void
Request
Key
Frame
();
private
:
void
FillSupportedCodecPayloadTypes
();
...
...
worker/include/RTC/ConsumerListener.hpp
浏览文件 @
0fdd6356
...
...
@@ -13,7 +13,7 @@ namespace RTC
{
public
:
virtual
void
OnConsumerClosed
(
RTC
::
Consumer
*
consumer
)
=
0
;
virtual
void
OnConsumer
Full
FrameRequired
(
RTC
::
Consumer
*
consumer
)
=
0
;
virtual
void
OnConsumer
Key
FrameRequired
(
RTC
::
Consumer
*
consumer
)
=
0
;
};
}
// namespace RTC
...
...
worker/include/RTC/NackGenerator.hpp
浏览文件 @
0fdd6356
...
...
@@ -16,7 +16,7 @@ namespace RTC
{
public
:
virtual
void
OnNackGeneratorNackRequired
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
=
0
;
virtual
void
OnNackGenerator
Full
FrameRequired
()
=
0
;
virtual
void
OnNackGenerator
Key
FrameRequired
()
=
0
;
};
private
:
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
0fdd6356
...
...
@@ -72,7 +72,7 @@ namespace RTC
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
);
void
ReceiveRtcpFeedback
(
RTC
::
RTCP
::
FeedbackPsPacket
*
packet
)
const
;
void
ReceiveRtcpFeedback
(
RTC
::
RTCP
::
FeedbackRtpPacket
*
packet
)
const
;
void
Request
Full
Frame
(
bool
force
=
false
);
void
Request
Key
Frame
(
bool
force
=
false
);
const
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>
GetProfiles
()
const
;
private
:
...
...
@@ -111,7 +111,7 @@ namespace RTC
std
::
map
<
uint32_t
,
RTC
::
RtpStreamRecv
*>
rtpStreams
;
std
::
map
<
uint32_t
,
RTC
::
RtpStreamRecv
*>
mapRtxStreams
;
std
::
map
<
RTC
::
RtpStreamRecv
*
,
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>>
profiles
;
Timer
*
full
FrameRequestBlockTimer
{
nullptr
};
Timer
*
key
FrameRequestBlockTimer
{
nullptr
};
// Others.
std
::
vector
<
RtpEncodingParameters
>
outputEncodings
;
struct
RTC
::
Transport
::
HeaderExtensionIds
transportHeaderExtensionIds
;
...
...
@@ -119,7 +119,7 @@ namespace RTC
bool
paused
{
false
};
bool
rtpRawEventEnabled
{
false
};
bool
rtpObjectEventEnabled
{
false
};
bool
is
Full
FrameRequested
{
false
};
bool
is
Key
FrameRequested
{
false
};
// Timestamp when last RTCP was sent.
uint64_t
lastRtcpSentTime
{
0
};
uint16_t
maxRtcpInterval
{
0
};
...
...
worker/include/RTC/Router.hpp
浏览文件 @
0fdd6356
...
...
@@ -79,7 +79,7 @@ namespace RTC
/* Pure virtual methods inherited from RTC::ConsumerListener. */
public
:
void
OnConsumerClosed
(
RTC
::
Consumer
*
consumer
)
override
;
void
OnConsumer
Full
FrameRequired
(
RTC
::
Consumer
*
consumer
)
override
;
void
OnConsumer
Key
FrameRequired
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from Timer::Listener. */
public
:
...
...
worker/include/RTC/RtpPacket.hpp
浏览文件 @
0fdd6356
...
...
@@ -117,6 +117,8 @@ namespace RTC
bool
ReadRid
(
const
uint8_t
**
data
,
size_t
*
len
)
const
;
uint8_t
*
GetPayload
()
const
;
size_t
GetPayloadLength
()
const
;
void
SetKeyFrame
(
bool
flag
);
bool
IsKeyFrame
()
const
;
void
Serialize
(
uint8_t
*
buffer
);
RtpPacket
*
Clone
(
uint8_t
*
buffer
)
const
;
void
RtxEncode
(
uint8_t
payloadType
,
uint32_t
ssrc
,
uint16_t
seq
);
...
...
@@ -138,6 +140,7 @@ namespace RTC
uint8_t
payloadPadding
{
0
};
size_t
size
{
0
};
// Full size of the packet in bytes.
uint32_t
seq32
{
0
};
// Extended seq number.
bool
isKeyFrame
{
false
};
// Whether this packet contains a key frame.
};
/* Inline static methods. */
...
...
@@ -362,6 +365,16 @@ namespace RTC
{
return
this
->
payloadLength
;
}
inline
void
RtpPacket
::
SetKeyFrame
(
bool
flag
)
{
this
->
isKeyFrame
=
flag
;
}
inline
bool
RtpPacket
::
IsKeyFrame
()
const
{
return
this
->
isKeyFrame
;
}
}
// namespace RTC
#endif
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
0fdd6356
...
...
@@ -30,7 +30,7 @@ namespace RTC
RTC
::
RTCP
::
ReceiverReport
*
GetRtcpReceiverReport
();
void
ReceiveRtcpSenderReport
(
RTC
::
RTCP
::
SenderReport
*
report
);
void
SetRtx
(
uint8_t
payloadType
,
uint32_t
ssrc
);
void
Request
Full
Frame
();
void
Request
Key
Frame
();
uint32_t
GetBitRate
();
private
:
...
...
@@ -44,7 +44,7 @@ namespace RTC
/* Pure virtual methods inherited from RTC::NackGenerator. */
protected
:
void
OnNackGeneratorNackRequired
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
;
void
OnNackGenerator
Full
FrameRequired
()
override
;
void
OnNackGenerator
Key
FrameRequired
()
override
;
private
:
// Passed by argument.
...
...
worker/include/RTC/Transport.hpp
浏览文件 @
0fdd6356
...
...
@@ -176,7 +176,7 @@ namespace RTC
/* Pure virtual methods inherited from RTC::ConsumerListener. */
public
:
void
OnConsumerClosed
(
RTC
::
Consumer
*
consumer
)
override
;
void
OnConsumer
Full
FrameRequired
(
RTC
::
Consumer
*
consumer
)
override
;
void
OnConsumer
Key
FrameRequired
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from Timer::Listener. */
public
:
...
...
worker/src/RTC/Codecs/Codecs.cpp
浏览文件 @
0fdd6356
#define MS_CLASS "RTC::Codecs"
#define MS_LOG_DEV
//
#define MS_LOG_DEV
#include "RTC/Codecs/Codecs.hpp"
#include "Logger.hpp"
...
...
@@ -9,41 +9,21 @@ namespace RTC
{
namespace
Codecs
{
bool
IsKnown
(
const
RTC
::
RtpCodecMimeType
&
mimeType
)
void
ProcessRtpPacket
(
RTC
::
RtpPacket
*
packet
,
const
RTC
::
RtpCodecMimeType
&
mimeType
)
{
MS_TRACE
();
if
(
mimeType
.
type
!=
RTC
::
RtpCodecMimeType
::
Type
::
VIDEO
)
return
false
;
switch
(
mimeType
.
subtype
)
{
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP8
:
return
true
;
default
:
return
false
;
}
}
bool
IsKeyFrame
(
const
RTC
::
RtpCodecMimeType
&
mimeType
,
const
RTC
::
RtpPacket
*
packet
)
{
MS_TRACE
();
if
(
!
IsKnown
(
mimeType
))
return
false
;
auto
data
=
packet
->
GetPayload
();
auto
len
=
packet
->
GetPayloadLength
();
{
VP8
::
ProcessRtpPacket
(
packet
);
switch
(
mimeType
.
subtype
)
{
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP8
:
return
VP8
::
IsKeyFrame
(
data
,
len
);
break
;
}
default
:
MS_DEBUG_TAG
(
rtp
,
"requested key frame for an unsupported codec: %s"
,
mimeType
.
GetName
().
c_str
());
return
false
;
;
}
}
}
// namespace Codecs
...
...
worker/src/RTC/Codecs/VP8.cpp
浏览文件 @
0fdd6356
#define MS_CLASS "RTC::Codecs::VP8"
#define MS_LOG_DEV
//
#define MS_LOG_DEV
#include "RTC/Codecs/VP8.hpp"
#include "Logger.hpp"
...
...
@@ -9,10 +9,15 @@ namespace RTC
{
namespace
Codecs
{
bool
VP8
::
IsKeyFrame
(
const
uint8_t
*
data
,
size_t
len
)
void
VP8
::
ProcessRtpPacket
(
RTC
::
RtpPacket
*
packet
)
{
MS_TRACE
();
auto
data
=
packet
->
GetPayload
();
auto
len
=
packet
->
GetPayloadLength
();
if
(
len
<
1
)
return
false
;
return
;
size_t
offset
=
0
;
uint8_t
byte
=
data
[
offset
++
];
...
...
@@ -28,10 +33,8 @@ namespace RTC
if
(
x
)
{
{
if
(
len
<
offset
+
1
)
return
false
;
}
if
(
len
<
offset
+
1
)
return
;
byte
=
data
[
offset
++
];
...
...
@@ -44,34 +47,29 @@ namespace RTC
if
(
i
)
{
if
(
len
<
offset
++
)
{
return
false
;
}
return
;
if
((
byte
>>
7
)
&
0x1
)
{
if
(
len
<
offset
++
)
return
false
;
return
;
}
}
if
(
l
)
{
if
(
len
<
offset
++
)
{
return
false
;
}
return
;
}
if
(
t
||
k
)
{
if
(
len
<
offset
++
)
{
return
false
;
}
return
;
}
return
start
&&
pid
==
0
&&
(
!
(
data
[
offset
]
&
0x1
));
if
(
start
&&
pid
==
0
&&
(
!
(
data
[
offset
]
&
0x1
)))
packet
->
SetKeyFrame
(
true
);
}
}
// namespace Codecs
}
// namespace RTC
worker/src/RTC/Consumer.cpp
浏览文件 @
0fdd6356
...
...
@@ -175,7 +175,7 @@ namespace RTC
MS_DEBUG_DEV
(
"Consumer resumed [consumerId:%"
PRIu32
"]"
,
this
->
consumerId
);
if
(
IsEnabled
()
&&
!
this
->
sourcePaused
)
Request
Full
Frame
();
Request
Key
Frame
();
}
void
Consumer
::
SourcePause
()
...
...
@@ -209,7 +209,7 @@ namespace RTC
this
->
notifier
->
Emit
(
this
->
consumerId
,
"sourceresumed"
);
if
(
IsEnabled
()
&&
!
this
->
paused
)
Request
Full
Frame
();
Request
Key
Frame
();
}
void
Consumer
::
SourceRtpParametersUpdated
()
...
...
@@ -337,8 +337,9 @@ namespace RTC
if
(
this
->
effectiveProfile
!=
this
->
targetProfile
&&
profile
==
this
->
targetProfile
)
{
bool
isKeyFrame
=
false
;
bool
canBeKeyFrame
=
Codecs
::
CanBeKeyFrame
(
this
->
rtpStream
->
GetMimeType
());
if
(
Codecs
::
IsKnown
(
this
->
rtpStream
->
GetMimeType
())
&&
Codecs
::
IsKeyFrame
(
this
->
rtpStream
->
GetMimeType
(),
packet
))
if
(
canBeKeyFrame
&&
packet
->
IsKeyFrame
(
))
{
isKeyFrame
=
true
;
...
...
@@ -348,7 +349,7 @@ namespace RTC
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
}
if
(
!
Codecs
::
IsKnown
(
this
->
rtpStream
->
GetMimeType
())
||
is
KeyFrame
)
if
(
isKeyFrame
||
!
canBe
KeyFrame
)
{
SetEffectiveProfile
(
this
->
targetProfile
);
...
...
@@ -549,7 +550,7 @@ namespace RTC
this
->
rtpStream
->
ReceiveRtcpReceiverReport
(
report
);
}
void
Consumer
::
Request
Full
Frame
()
void
Consumer
::
Request
Key
Frame
()
{
MS_TRACE
();
...
...
@@ -561,7 +562,7 @@ namespace RTC
for
(
auto
&
listener
:
this
->
listeners
)
{
listener
->
OnConsumer
Full
FrameRequired
(
this
);
listener
->
OnConsumer
Key
FrameRequired
(
this
);
}
}
...
...
@@ -727,7 +728,7 @@ namespace RTC
return
;
if
(
IsEnabled
()
&&
!
IsPaused
())
Request
Full
Frame
();
Request
Key
Frame
();
MS_DEBUG_TAG
(
rtp
,
...
...
worker/src/RTC/NackGenerator.cpp
浏览文件 @
0fdd6356
...
...
@@ -112,15 +112,15 @@ namespace RTC
this
->
nackList
.
erase
(
this
->
nackList
.
begin
(),
it
);
// If the nack list is too large, clear it and request a
full
frame.
// If the nack list is too large, clear it and request a
key
frame.
uint32_t
numNewNacks
=
seq32End
-
seq32Start
;
if
(
this
->
nackList
.
size
()
+
numNewNacks
>
MaxNackPackets
)
{
MS_DEBUG_TAG
(
rtx
,
"NACK list too large, clearing it and requesting a
full
frame"
);
MS_DEBUG_TAG
(
rtx
,
"NACK list too large, clearing it and requesting a
key
frame"
);
this
->
nackList
.
clear
();
this
->
listener
->
OnNackGenerator
Full
FrameRequired
();
this
->
listener
->
OnNackGenerator
Key
FrameRequired
();
return
;
}
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
0fdd6356
...
...
@@ -13,8 +13,7 @@ namespace RTC
{
/* Static. */
// TODO: Set a proper value.
static
constexpr
uint64_t
FullFrameRequestBlockTimeout
{
1000
};
// In ms.
static
constexpr
uint64_t
KeyFrameRequestBlockTimeout
{
1000
};
// In ms.
/* Instance methods. */
...
...
@@ -43,8 +42,8 @@ namespace RTC
else
this
->
maxRtcpInterval
=
RTC
::
RTCP
::
MaxAudioIntervalMs
;
// Set the RTP
full
frame request block timer.
this
->
full
FrameRequestBlockTimer
=
new
Timer
(
this
);
// Set the RTP
key
frame request block timer.
this
->
key
FrameRequestBlockTimer
=
new
Timer
(
this
);
}
Producer
::~
Producer
()
...
...
@@ -65,8 +64,8 @@ namespace RTC
listener
->
OnProducerClosed
(
this
);
}
// Close the RTP
full
frame request block timer.
this
->
full
FrameRequestBlockTimer
->
Destroy
();
// Close the RTP
key
frame request block timer.
this
->
key
FrameRequestBlockTimer
->
Destroy
();
delete
this
;
}
...
...
@@ -200,7 +199,7 @@ namespace RTC
listener
->
OnProducerResumed
(
this
);
}
Request
Full
Frame
(
true
);
Request
Key
Frame
(
true
);
}
void
Producer
::
SetRtpRawEvent
(
bool
enabled
)
...
...
@@ -221,9 +220,9 @@ namespace RTC
MS_DEBUG_DEV
(
"Producer rtpraw event disabled [producerId:%"
PRIu32
"]"
,
this
->
producerId
);
}
// If set (and not paused), require a
full
frame.
// If set (and not paused), require a
key
frame.
if
(
this
->
rtpRawEventEnabled
&&
!
this
->
paused
)
Request
Full
Frame
(
true
);
Request
Key
Frame
(
true
);
}
void
Producer
::
SetRtpObjectEvent
(
bool
enabled
)
...
...
@@ -244,9 +243,9 @@ namespace RTC
MS_DEBUG_DEV
(
"Producer rtpobject event disabled [producerId:%"
PRIu32
"]"
,
this
->
producerId
);
}
// If set (and not paused), require a
full
frame.
// If set (and not paused), require a
key
frame.
if
(
this
->
rtpObjectEventEnabled
&&
!
this
->
paused
)
Request
Full
Frame
(
true
);
Request
Key
Frame
(
true
);
}
void
Producer
::
ReceiveRtpPacket
(
RTC
::
RtpPacket
*
packet
)
...
...
@@ -301,7 +300,10 @@ namespace RTC
return
;
}
if
(
Codecs
::
IsKeyFrame
(
rtpStream
->
GetMimeType
(),
packet
))
// Process the packet at codec level.
Codecs
::
ProcessRtpPacket
(
packet
,
rtpStream
->
GetMimeType
());
if
(
packet
->
IsKeyFrame
())
{
MS_DEBUG_TAG
(
rtp
,
...
...
@@ -398,7 +400,7 @@ namespace RTC
this
->
transport
->
SendRtcpPacket
(
packet
);
}
void
Producer
::
Request
Full
Frame
(
bool
force
)
void
Producer
::
Request
Key
Frame
(
bool
force
)
{
MS_TRACE
();
...
...
@@ -408,30 +410,30 @@ namespace RTC
if
(
force
)
{
// Stop the timer.
this
->
full
FrameRequestBlockTimer
->
Stop
();
this
->
key
FrameRequestBlockTimer
->
Stop
();
}
else
if
(
this
->
full
FrameRequestBlockTimer
->
IsActive
())
else
if
(
this
->
key
FrameRequestBlockTimer
->
IsActive
())
{
MS_DEBUG_TAG
(
rtcp
,
"blocking
full
frame request until timer expires"
);
MS_DEBUG_TAG
(
rtcp
,
"blocking
key
frame request until timer expires"
);
// Set flag.
this
->
is
Full
FrameRequested
=
true
;
this
->
is
Key
FrameRequested
=
true
;
return
;
}
// Run the timer.
this
->
fullFrameRequestBlockTimer
->
Start
(
Full
FrameRequestBlockTimeout
);
this
->
keyFrameRequestBlockTimer
->
Start
(
Key
FrameRequestBlockTimeout
);
for
(
auto
&
kv
:
this
->
rtpStreams
)
{
auto
rtpStream
=
kv
.
second
;
rtpStream
->
Request
Full
Frame
();
rtpStream
->
Request
Key
Frame
();
}
// Reset flag.
this
->
is
Full
FrameRequested
=
false
;
this
->
is
Key
FrameRequested
=
false
;
}
void
Producer
::
FillHeaderExtensionIds
()
...
...
@@ -614,8 +616,8 @@ namespace RTC
}
}
// Request a
full
frame since we may have lost the first packets of this stream.
Request
Full
Frame
(
true
);
// Request a
key
frame since we may have lost the first packets of this stream.
Request
Key
Frame
(
true
);
}
void
Producer
::
ClearRtpStream
(
RTC
::
RtpStreamRecv
*
rtpStream
)
...
...
@@ -850,15 +852,15 @@ namespace RTC
{
MS_TRACE
();
if
(
timer
==
this
->
full
FrameRequestBlockTimer
)
if
(
timer
==
this
->
key
FrameRequestBlockTimer
)
{
// Nobody asked for a
full
frame since the timer was started.
if
(
!
this
->
is
Full
FrameRequested
)
// Nobody asked for a
key
frame since the timer was started.
if
(
!
this
->
is
Key
FrameRequested
)
return
;
MS_DEBUG_TAG
(
rtcp
,
"requesting
full
frame after timer expires"
);
MS_DEBUG_TAG
(
rtcp
,
"requesting
key
frame after timer expires"
);
Request
Full
Frame
();
Request
Key
Frame
();
}
}
}
// namespace RTC
worker/src/RTC/Router.cpp
浏览文件 @
0fdd6356
...
...
@@ -1476,7 +1476,7 @@ namespace RTC
this
->
mapConsumerProducer
.
erase
(
consumer
);
}
void
Router
::
OnConsumer
Full
FrameRequired
(
RTC
::
Consumer
*
consumer
)
void
Router
::
OnConsumer
Key
FrameRequired
(
RTC
::
Consumer
*
consumer
)
{
MS_TRACE
();
...
...
@@ -1486,7 +1486,7 @@ namespace RTC
auto
*
producer
=
this
->
mapConsumerProducer
[
consumer
];
producer
->
Request
Full
Frame
();
producer
->
Request
Key
Frame
();
}
inline
void
Router
::
OnTimer
(
Timer
*
timer
)
...
...
worker/src/RTC/RtpPacket.cpp
浏览文件 @
0fdd6356
...
...
@@ -291,9 +291,6 @@ namespace RTC
ptr
+=
4
+
extensionValueSize
;
}
// Parse and regenerate RFC 5285 extension header.
ParseExtensions
();
// Add payload.
if
(
this
->
payload
!=
nullptr
)
{
...
...
@@ -367,6 +364,9 @@ namespace RTC
// Clone seq32.
packet
->
seq32
=
this
->
seq32
;
// Copy isKeyFrame.
packet
->
isKeyFrame
=
this
->
isKeyFrame
;
// Parse RFC 5285 extension header.
packet
->
ParseExtensions
();
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
0fdd6356
...
...
@@ -213,7 +213,7 @@ namespace RTC
this
->
lastSrTimestamp
+=
report
->
GetNtpFrac
()
>>
16
;
}
void
RtpStreamRecv
::
Request
Full
Frame
()
void
RtpStreamRecv
::
Request
Key
Frame
()
{
MS_TRACE
();
...
...
@@ -285,11 +285,11 @@ namespace RTC
this
->
listener
->
OnRtpStreamRecvNackRequired
(
this
,
seqNumbers
);
}
void
RtpStreamRecv
::
OnNackGenerator
Full
FrameRequired
()
void
RtpStreamRecv
::
OnNackGenerator
Key
FrameRequired
()
{
MS_TRACE
();
Request
Full
Frame
();
Request
Key
Frame
();
}
void
RtpStreamRecv
::
SetRtx
(
uint8_t
payloadType
,
uint32_t
ssrc
)
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
0fdd6356
...
...
@@ -40,7 +40,7 @@ namespace RTC
/* Static. */
static
constexpr
uint64_t
EffectiveMaxBitrateCheckInterval
{
2000
};
// In ms.
static
constexpr
double
EffectiveMaxBitrateThresholdBefore
Full
Frame
{
0.6
};
// 0.0 - 1.0.
static
constexpr
double
EffectiveMaxBitrateThresholdBefore
Key
Frame
{
0.6
};
// 0.0 - 1.0.
/* Instance methods. */
...
...
@@ -461,16 +461,16 @@ namespace RTC
// Add us as listener.
consumer
->
AddListener
(
this
);
// If we are connected, ask a
full
request for this enabled Consumer.
// If we are connected, ask a
key
request for this enabled Consumer.
if
(
IsConnected
())
{
if
(
consumer
->
kind
==
RTC
::
Media
::
Kind
::
VIDEO
)
{
MS_DEBUG_TAG
(
rtcp
,
"requesting
full
frame for new Consumer since Transport already connected"
);
rtcp
,
"requesting
key
frame for new Consumer since Transport already connected"
);
}
consumer
->
Request
Full
Frame
();
consumer
->
Request
Key
Frame
();
}
}
...
...
@@ -736,7 +736,7 @@ namespace RTC
break
;
}
consumer
->
Request
Full
Frame
();
consumer
->
Request
Key
Frame
();
break
;
}
...
...
@@ -1439,13 +1439,13 @@ namespace RTC
eventData
[
JsonStringDtlsRemoteCert
]
=
remoteCert
;
this
->
notifier
->
Emit
(
this
->
transportId
,
"dtlsstatechange"
,
eventData
);
// Iterate all the Consumers and request
full
frame.
// Iterate all the Consumers and request
key
frame.
for
(
auto
*
consumer
:
this
->
consumers
)
{
if
(
consumer
->
kind
==
RTC
::
Media
::
Kind
::
VIDEO
)
MS_DEBUG_TAG
(
rtcp
,
"Transport connected, requesting
full
frame for Consumers"
);
MS_DEBUG_TAG
(
rtcp
,
"Transport connected, requesting
key
frame for Consumers"
);
consumer
->
Request
Full
Frame
();
consumer
->
Request
Key
Frame
();
}
}
...
...
@@ -1550,21 +1550,21 @@ namespace RTC
packet
.
Serialize
(
RTC
::
RTCP
::
Buffer
);
this
->
SendRtcpPacket
(
&
packet
);
// Trigger a
full frame for all the suitable str
ams if the effective max bitrate
// Trigger a
key frame for all the suitable stre
ams if the effective max bitrate
// has decreased abruptly.
if
(
now
-
this
->
lastEffectiveMaxBitrateAt
>
EffectiveMaxBitrateCheckInterval
)
{
if
(
(
bitrate
!=
0u
)
&&
(
this
->
effectiveMaxBitrate
!=
0u
)
&&
static_cast
<
double
>
(
effectiveBitrate
)
/
static_cast
<
double
>
(
this
->
effectiveMaxBitrate
)
<
EffectiveMaxBitrateThresholdBefore
Full
Frame
)
EffectiveMaxBitrateThresholdBefore
Key
Frame
)
{
MS_WARN_TAG
(
rbe
,
"uplink effective max bitrate abruptly decrease, requesting
full
frames"
);
MS_WARN_TAG
(
rbe
,
"uplink effective max bitrate abruptly decrease, requesting
key
frames"
);
// Request
full
frame for all the Producers.
// Request
key
frame for all the Producers.
for
(
auto
*
producer
:
this
->
producers
)
{
producer
->
Request
Full
Frame
();
producer
->
Request
Key
Frame
();
}
}
...
...
@@ -1631,7 +1631,7 @@ namespace RTC
this
->
consumers
.
erase
(
consumer
);
}
void
Transport
::
OnConsumer
Full
FrameRequired
(
RTC
::
Consumer
*
/*consumer*/
)
void
Transport
::
OnConsumer
Key
FrameRequired
(
RTC
::
Consumer
*
/*consumer*/
)
{
// Do nothing.
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论