Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
1a69e855
提交
1a69e855
authored
4月 03, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix video not shown at Consumer start (fixes #288)
上级
26602ac3
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
135 行增加
和
63 行删除
+135
-63
Consumer.hpp
worker/include/RTC/Consumer.hpp
+4
-3
PipeConsumer.hpp
worker/include/RTC/PipeConsumer.hpp
+3
-3
PipeTransport.hpp
worker/include/RTC/PipeTransport.hpp
+3
-0
PlainRtpTransport.hpp
worker/include/RTC/PlainRtpTransport.hpp
+3
-0
SimpleConsumer.hpp
worker/include/RTC/SimpleConsumer.hpp
+3
-5
SimulcastConsumer.hpp
worker/include/RTC/SimulcastConsumer.hpp
+3
-3
WebRtcTransport.hpp
worker/include/RTC/WebRtcTransport.hpp
+3
-0
Consumer.cpp
worker/src/RTC/Consumer.cpp
+4
-4
PipeConsumer.cpp
worker/src/RTC/PipeConsumer.cpp
+9
-9
PipeTransport.cpp
worker/src/RTC/PipeTransport.cpp
+13
-0
PlainRtpTransport.cpp
worker/src/RTC/PlainRtpTransport.cpp
+13
-0
SimpleConsumer.cpp
worker/src/RTC/SimpleConsumer.cpp
+16
-28
SimulcastConsumer.cpp
worker/src/RTC/SimulcastConsumer.cpp
+41
-8
Transport.cpp
worker/src/RTC/Transport.cpp
+4
-0
WebRtcTransport.cpp
worker/src/RTC/WebRtcTransport.cpp
+13
-0
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
1a69e855
...
@@ -24,6 +24,7 @@ namespace RTC
...
@@ -24,6 +24,7 @@ namespace RTC
class
Listener
class
Listener
{
{
public
:
public
:
virtual
void
OnConsumerNeedBandwidth
(
RTC
::
Consumer
*
consumer
)
=
0
;
virtual
void
OnConsumerSendRtpPacket
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpPacket
*
packet
)
=
0
;
virtual
void
OnConsumerSendRtpPacket
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpPacket
*
packet
)
=
0
;
virtual
void
OnConsumerRetransmitRtpPacket
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpPacket
*
packet
)
=
0
;
virtual
void
OnConsumerRetransmitRtpPacket
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpPacket
*
packet
)
=
0
;
virtual
void
OnConsumerKeyFrameRequested
(
RTC
::
Consumer
*
consumer
,
uint32_t
mappedSsrc
)
=
0
;
virtual
void
OnConsumerKeyFrameRequested
(
RTC
::
Consumer
*
consumer
,
uint32_t
mappedSsrc
)
=
0
;
...
@@ -51,7 +52,7 @@ namespace RTC
...
@@ -51,7 +52,7 @@ namespace RTC
bool
IsActive
()
const
;
bool
IsActive
()
const
;
bool
IsPaused
()
const
;
bool
IsPaused
()
const
;
bool
IsProducerPaused
()
const
;
bool
IsProducerPaused
()
const
;
virtual
void
UseBandwidth
(
uint32_t
availableBandwidth
)
=
0
;
virtual
uint32_t
UseBandwidth
(
uint32_t
availableBandwidth
)
=
0
;
void
ProducerPaused
();
void
ProducerPaused
();
void
ProducerResumed
();
void
ProducerResumed
();
virtual
void
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
=
0
;
virtual
void
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
=
0
;
...
@@ -68,8 +69,8 @@ namespace RTC
...
@@ -68,8 +69,8 @@ namespace RTC
virtual
float
GetLossPercentage
()
const
=
0
;
virtual
float
GetLossPercentage
()
const
=
0
;
protected
:
protected
:
virtual
void
Paused
(
bool
wasProducer
)
=
0
;
virtual
void
Paused
()
=
0
;
virtual
void
Resumed
(
bool
wasProducer
)
=
0
;
virtual
void
Resumed
()
=
0
;
public
:
public
:
// Passed by argument.
// Passed by argument.
...
...
worker/include/RTC/PipeConsumer.hpp
浏览文件 @
1a69e855
...
@@ -17,7 +17,7 @@ namespace RTC
...
@@ -17,7 +17,7 @@ namespace RTC
void
FillJsonStats
(
json
&
jsonArray
)
const
override
;
void
FillJsonStats
(
json
&
jsonArray
)
const
override
;
void
FillJsonScore
(
json
&
jsonObject
)
const
override
;
void
FillJsonScore
(
json
&
jsonObject
)
const
override
;
void
HandleRequest
(
Channel
::
Request
*
request
)
override
;
void
HandleRequest
(
Channel
::
Request
*
request
)
override
;
void
UseBandwidth
(
uint32_t
availableBandwidth
)
override
;
uint32_t
UseBandwidth
(
uint32_t
availableBandwidth
)
override
;
void
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerNewRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerNewRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerRtpStreamScore
(
RTC
::
RtpStream
*
rtpStream
,
uint8_t
score
)
override
;
void
ProducerRtpStreamScore
(
RTC
::
RtpStream
*
rtpStream
,
uint8_t
score
)
override
;
...
@@ -31,8 +31,8 @@ namespace RTC
...
@@ -31,8 +31,8 @@ namespace RTC
float
GetLossPercentage
()
const
override
;
float
GetLossPercentage
()
const
override
;
private
:
private
:
void
Paused
(
bool
wasProducer
)
override
;
void
Paused
()
override
;
void
Resumed
(
bool
wasProducer
)
override
;
void
Resumed
()
override
;
void
CreateRtpStreams
();
void
CreateRtpStreams
();
void
RequestKeyFrame
();
void
RequestKeyFrame
();
...
...
worker/include/RTC/PipeTransport.hpp
浏览文件 @
1a69e855
...
@@ -40,6 +40,9 @@ namespace RTC
...
@@ -40,6 +40,9 @@ namespace RTC
void
UserOnNewConsumer
(
RTC
::
Consumer
*
consumer
)
override
;
void
UserOnNewConsumer
(
RTC
::
Consumer
*
consumer
)
override
;
void
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
)
override
;
void
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
)
override
;
public
:
void
OnConsumerNeedBandwidth
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
public
:
public
:
void
OnPacketRecv
(
void
OnPacketRecv
(
...
...
worker/include/RTC/PlainRtpTransport.hpp
浏览文件 @
1a69e855
...
@@ -40,6 +40,9 @@ namespace RTC
...
@@ -40,6 +40,9 @@ namespace RTC
void
UserOnNewConsumer
(
RTC
::
Consumer
*
consumer
)
override
;
void
UserOnNewConsumer
(
RTC
::
Consumer
*
consumer
)
override
;
void
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
)
override
;
void
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
)
override
;
public
:
void
OnConsumerNeedBandwidth
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
public
:
public
:
void
OnPacketRecv
(
void
OnPacketRecv
(
...
...
worker/include/RTC/SimpleConsumer.hpp
浏览文件 @
1a69e855
#ifndef MS_RTC_SIMPLE_CONSUMER_HPP
#ifndef MS_RTC_SIMPLE_CONSUMER_HPP
#define MS_RTC_SIMPLE_CONSUMER_HPP
#define MS_RTC_SIMPLE_CONSUMER_HPP
#include "RTC/Codecs/PayloadDescriptorHandler.hpp"
#include "RTC/Consumer.hpp"
#include "RTC/Consumer.hpp"
#include "RTC/RtpStreamSend.hpp"
#include "RTC/RtpStreamSend.hpp"
#include "RTC/SeqManager.hpp"
#include "RTC/SeqManager.hpp"
...
@@ -19,7 +18,7 @@ namespace RTC
...
@@ -19,7 +18,7 @@ namespace RTC
void
FillJsonStats
(
json
&
jsonArray
)
const
override
;
void
FillJsonStats
(
json
&
jsonArray
)
const
override
;
void
FillJsonScore
(
json
&
jsonObject
)
const
override
;
void
FillJsonScore
(
json
&
jsonObject
)
const
override
;
void
HandleRequest
(
Channel
::
Request
*
request
)
override
;
void
HandleRequest
(
Channel
::
Request
*
request
)
override
;
void
UseBandwidth
(
uint32_t
availableBandwidth
)
override
;
uint32_t
UseBandwidth
(
uint32_t
availableBandwidth
)
override
;
void
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerNewRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerNewRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerRtpStreamScore
(
RTC
::
RtpStream
*
rtpStream
,
uint8_t
score
)
override
;
void
ProducerRtpStreamScore
(
RTC
::
RtpStream
*
rtpStream
,
uint8_t
score
)
override
;
...
@@ -33,8 +32,8 @@ namespace RTC
...
@@ -33,8 +32,8 @@ namespace RTC
float
GetLossPercentage
()
const
override
;
float
GetLossPercentage
()
const
override
;
private
:
private
:
void
Paused
(
bool
wasProducer
)
override
;
void
Paused
()
override
;
void
Resumed
(
bool
wasProducer
)
override
;
void
Resumed
()
override
;
void
CreateRtpStream
();
void
CreateRtpStream
();
void
RequestKeyFrame
();
void
RequestKeyFrame
();
void
EmitScore
()
const
;
void
EmitScore
()
const
;
...
@@ -52,7 +51,6 @@ namespace RTC
...
@@ -52,7 +51,6 @@ namespace RTC
bool
syncRequired
{
true
};
bool
syncRequired
{
true
};
RTC
::
SeqManager
<
uint16_t
>
rtpSeqManager
;
RTC
::
SeqManager
<
uint16_t
>
rtpSeqManager
;
RTC
::
SeqManager
<
uint32_t
>
rtpTimestampManager
;
RTC
::
SeqManager
<
uint32_t
>
rtpTimestampManager
;
std
::
unique_ptr
<
RTC
::
Codecs
::
EncodingContext
>
encodingContext
;
RTC
::
RtpStream
*
producerRtpStream
{
nullptr
};
RTC
::
RtpStream
*
producerRtpStream
{
nullptr
};
};
};
}
// namespace RTC
}
// namespace RTC
...
...
worker/include/RTC/SimulcastConsumer.hpp
浏览文件 @
1a69e855
...
@@ -19,7 +19,7 @@ namespace RTC
...
@@ -19,7 +19,7 @@ namespace RTC
void
FillJsonStats
(
json
&
jsonArray
)
const
override
;
void
FillJsonStats
(
json
&
jsonArray
)
const
override
;
void
FillJsonScore
(
json
&
jsonObject
)
const
override
;
void
FillJsonScore
(
json
&
jsonObject
)
const
override
;
void
HandleRequest
(
Channel
::
Request
*
request
)
override
;
void
HandleRequest
(
Channel
::
Request
*
request
)
override
;
void
UseBandwidth
(
uint32_t
availableBandwidth
)
override
;
uint32_t
UseBandwidth
(
uint32_t
availableBandwidth
)
override
;
void
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerNewRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerNewRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerRtpStreamScore
(
RTC
::
RtpStream
*
rtpStream
,
uint8_t
score
)
override
;
void
ProducerRtpStreamScore
(
RTC
::
RtpStream
*
rtpStream
,
uint8_t
score
)
override
;
...
@@ -33,8 +33,8 @@ namespace RTC
...
@@ -33,8 +33,8 @@ namespace RTC
float
GetLossPercentage
()
const
override
;
float
GetLossPercentage
()
const
override
;
private
:
private
:
void
Paused
(
bool
wasProducer
)
override
;
void
Paused
()
override
;
void
Resumed
(
bool
wasProducer
)
override
;
void
Resumed
()
override
;
void
CreateRtpStream
();
void
CreateRtpStream
();
void
RequestKeyFrame
();
void
RequestKeyFrame
();
void
RetransmitRtpPacket
(
RTC
::
RtpPacket
*
packet
);
void
RetransmitRtpPacket
(
RTC
::
RtpPacket
*
packet
);
...
...
worker/include/RTC/WebRtcTransport.hpp
浏览文件 @
1a69e855
...
@@ -60,6 +60,9 @@ namespace RTC
...
@@ -60,6 +60,9 @@ namespace RTC
void
UserOnNewConsumer
(
RTC
::
Consumer
*
consumer
)
override
;
void
UserOnNewConsumer
(
RTC
::
Consumer
*
consumer
)
override
;
void
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
)
override
;
void
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
)
override
;
public
:
void
OnConsumerNeedBandwidth
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
public
:
public
:
void
OnPacketRecv
(
void
OnPacketRecv
(
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
1a69e855
...
@@ -219,7 +219,7 @@ namespace RTC
...
@@ -219,7 +219,7 @@ namespace RTC
MS_DEBUG_DEV
(
"Consumer paused [consumerId:%s]"
,
this
->
id
.
c_str
());
MS_DEBUG_DEV
(
"Consumer paused [consumerId:%s]"
,
this
->
id
.
c_str
());
if
(
wasActive
)
if
(
wasActive
)
Paused
(
false
);
Paused
();
request
->
Accept
();
request
->
Accept
();
...
@@ -240,7 +240,7 @@ namespace RTC
...
@@ -240,7 +240,7 @@ namespace RTC
MS_DEBUG_DEV
(
"Consumer resumed [consumerId:%s]"
,
this
->
id
.
c_str
());
MS_DEBUG_DEV
(
"Consumer resumed [consumerId:%s]"
,
this
->
id
.
c_str
());
if
(
IsActive
())
if
(
IsActive
())
Resumed
(
false
);
Resumed
();
request
->
Accept
();
request
->
Accept
();
...
@@ -268,7 +268,7 @@ namespace RTC
...
@@ -268,7 +268,7 @@ namespace RTC
MS_DEBUG_DEV
(
"Producer paused [consumerId:%s]"
,
this
->
id
.
c_str
());
MS_DEBUG_DEV
(
"Producer paused [consumerId:%s]"
,
this
->
id
.
c_str
());
if
(
wasActive
)
if
(
wasActive
)
Paused
(
true
);
Paused
();
Channel
::
Notifier
::
Emit
(
this
->
id
,
"producerpause"
);
Channel
::
Notifier
::
Emit
(
this
->
id
,
"producerpause"
);
}
}
...
@@ -285,7 +285,7 @@ namespace RTC
...
@@ -285,7 +285,7 @@ namespace RTC
MS_DEBUG_DEV
(
"Producer resumed [consumerId:%s]"
,
this
->
id
.
c_str
());
MS_DEBUG_DEV
(
"Producer resumed [consumerId:%s]"
,
this
->
id
.
c_str
());
if
(
IsActive
())
if
(
IsActive
())
Resumed
(
true
);
Resumed
();
Channel
::
Notifier
::
Emit
(
this
->
id
,
"producerresume"
);
Channel
::
Notifier
::
Emit
(
this
->
id
,
"producerresume"
);
}
}
...
...
worker/src/RTC/PipeConsumer.cpp
浏览文件 @
1a69e855
...
@@ -80,11 +80,14 @@ namespace RTC
...
@@ -80,11 +80,14 @@ namespace RTC
}
}
}
}
void
PipeConsumer
::
UseBandwidth
(
uint32_t
availableBandwidth
)
uint32_t
PipeConsumer
::
UseBandwidth
(
uint32_t
availableBandwidth
)
{
{
MS_TRACE
();
MS_TRACE
();
RequestKeyFrame
();
RequestKeyFrame
();
// TODO.
return
0
;
}
}
void
PipeConsumer
::
ProducerRtpStream
(
RTC
::
RtpStream
*
/*rtpStream*/
,
uint32_t
/*mappedSsrc*/
)
void
PipeConsumer
::
ProducerRtpStream
(
RTC
::
RtpStream
*
/*rtpStream*/
,
uint32_t
/*mappedSsrc*/
)
...
@@ -188,8 +191,6 @@ namespace RTC
...
@@ -188,8 +191,6 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// TODO: Must call the corresponding rtpStream->ReceiveKeyFrameRequest(messageType);
RequestKeyFrame
();
RequestKeyFrame
();
}
}
...
@@ -235,7 +236,7 @@ namespace RTC
...
@@ -235,7 +236,7 @@ namespace RTC
return
0u
;
return
0u
;
}
}
void
PipeConsumer
::
Paused
(
bool
/*wasProducer*/
)
void
PipeConsumer
::
Paused
()
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -247,7 +248,7 @@ namespace RTC
...
@@ -247,7 +248,7 @@ namespace RTC
}
}
}
}
void
PipeConsumer
::
Resumed
(
bool
wasProducer
)
void
PipeConsumer
::
Resumed
()
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -258,10 +259,9 @@ namespace RTC
...
@@ -258,10 +259,9 @@ namespace RTC
rtpStream
->
Resume
();
rtpStream
->
Resume
();
}
}
// If we have been resumed due to the Producer becoming resumed, we don't
// We need to ask the Transport for bandwidth.
// need to request a key frame since the Producer already requested it.
if
(
IsActive
())
if
(
!
wasProducer
)
this
->
listener
->
OnConsumerNeedBandwidth
(
this
);
RequestKeyFrame
();
}
}
void
PipeConsumer
::
CreateRtpStreams
()
void
PipeConsumer
::
CreateRtpStreams
()
...
...
worker/src/RTC/PipeTransport.cpp
浏览文件 @
1a69e855
...
@@ -420,6 +420,19 @@ namespace RTC
...
@@ -420,6 +420,19 @@ namespace RTC
// TODO
// TODO
}
}
inline
void
PipeTransport
::
OnConsumerNeedBandwidth
(
RTC
::
Consumer
*
consumer
)
{
MS_TRACE
();
// Ignore if not connected.
if
(
!
IsConnected
())
return
;
// TODO: Here we must check the available sending BWE and so on.
consumer
->
UseBandwidth
(
0
);
}
inline
void
PipeTransport
::
OnPacketRecv
(
inline
void
PipeTransport
::
OnPacketRecv
(
RTC
::
UdpSocket
*
socket
,
const
uint8_t
*
data
,
size_t
len
,
const
struct
sockaddr
*
remoteAddr
)
RTC
::
UdpSocket
*
socket
,
const
uint8_t
*
data
,
size_t
len
,
const
struct
sockaddr
*
remoteAddr
)
{
{
...
...
worker/src/RTC/PlainRtpTransport.cpp
浏览文件 @
1a69e855
...
@@ -692,6 +692,19 @@ namespace RTC
...
@@ -692,6 +692,19 @@ namespace RTC
// TODO
// TODO
}
}
inline
void
PlainRtpTransport
::
OnConsumerNeedBandwidth
(
RTC
::
Consumer
*
consumer
)
{
MS_TRACE
();
// Ignore if not connected.
if
(
!
IsConnected
())
return
;
// TODO: Here we must check the available sending BWE and so on.
consumer
->
UseBandwidth
(
0
);
}
inline
void
PlainRtpTransport
::
OnPacketRecv
(
inline
void
PlainRtpTransport
::
OnPacketRecv
(
RTC
::
UdpSocket
*
socket
,
const
uint8_t
*
data
,
size_t
len
,
const
struct
sockaddr
*
remoteAddr
)
RTC
::
UdpSocket
*
socket
,
const
uint8_t
*
data
,
size_t
len
,
const
struct
sockaddr
*
remoteAddr
)
{
{
...
...
worker/src/RTC/SimpleConsumer.cpp
浏览文件 @
1a69e855
...
@@ -99,11 +99,14 @@ namespace RTC
...
@@ -99,11 +99,14 @@ namespace RTC
}
}
}
}
void
SimpleConsumer
::
UseBandwidth
(
uint32_t
availableBandwidth
)
uint32_t
SimpleConsumer
::
UseBandwidth
(
uint32_t
availableBandwidth
)
{
{
MS_TRACE
();
MS_TRACE
();
RequestKeyFrame
();
RequestKeyFrame
();
// TODO.
return
0
;
}
}
void
SimpleConsumer
::
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
/*mappedSsrc*/
)
void
SimpleConsumer
::
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
/*mappedSsrc*/
)
...
@@ -122,6 +125,13 @@ namespace RTC
...
@@ -122,6 +125,13 @@ namespace RTC
this
->
producerRtpStream
=
rtpStream
;
this
->
producerRtpStream
=
rtpStream
;
if
(
IsActive
())
{
// Since the Producer RtpStream has been created right now, we need to ask
// the Transport for bandwidth.
this
->
listener
->
OnConsumerNeedBandwidth
(
this
);
}
// Emit the score event.
// Emit the score event.
EmitScore
();
EmitScore
();
}
}
...
@@ -180,24 +190,9 @@ namespace RTC
...
@@ -180,24 +190,9 @@ namespace RTC
this
->
rtpTimestampManager
.
Offset
(
diffTs
);
this
->
rtpTimestampManager
.
Offset
(
diffTs
);
}
}
if
(
this
->
encodingContext
)
this
->
encodingContext
->
SyncRequired
();
this
->
syncRequired
=
false
;
this
->
syncRequired
=
false
;
}
}
// TODO: Not sure how to deal with it, but if this happens (and we drop the packet)
// we shouldn't have unset the syncRequired flag, etc.
//
// Rewrite payload if needed. Drop packet if necessary.
if
(
this
->
encodingContext
&&
!
packet
->
EncodePayload
(
this
->
encodingContext
.
get
()))
{
this
->
rtpSeqManager
.
Drop
(
packet
->
GetSequenceNumber
());
this
->
rtpTimestampManager
.
Drop
(
packet
->
GetTimestamp
());
return
;
}
// Update RTP seq number and timestamp.
// Update RTP seq number and timestamp.
uint16_t
seq
;
uint16_t
seq
;
uint32_t
timestamp
;
uint32_t
timestamp
;
...
@@ -251,10 +246,6 @@ namespace RTC
...
@@ -251,10 +246,6 @@ namespace RTC
packet
->
SetSsrc
(
origSsrc
);
packet
->
SetSsrc
(
origSsrc
);
packet
->
SetSequenceNumber
(
origSeq
);
packet
->
SetSequenceNumber
(
origSeq
);
packet
->
SetTimestamp
(
origTimestamp
);
packet
->
SetTimestamp
(
origTimestamp
);
// Restore the original payload if needed.
if
(
this
->
encodingContext
)
packet
->
RestorePayload
();
}
}
void
SimpleConsumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
void
SimpleConsumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
...
@@ -347,14 +338,14 @@ namespace RTC
...
@@ -347,14 +338,14 @@ namespace RTC
}
}
}
}
void
SimpleConsumer
::
Paused
(
bool
/*wasProducer*/
)
void
SimpleConsumer
::
Paused
()
{
{
MS_TRACE
();
MS_TRACE
();
this
->
rtpStream
->
Pause
();
this
->
rtpStream
->
Pause
();
}
}
void
SimpleConsumer
::
Resumed
(
bool
wasProducer
)
void
SimpleConsumer
::
Resumed
()
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -364,10 +355,9 @@ namespace RTC
...
@@ -364,10 +355,9 @@ namespace RTC
// receiver will request lot of NACKs due to unknown RTP packets.
// receiver will request lot of NACKs due to unknown RTP packets.
this
->
syncRequired
=
true
;
this
->
syncRequired
=
true
;
// If we have been resumed due to the Producer becoming resumed, we don't
// We need to ask the Transport for bandwidth.
// need to request a key frame since the Producer already requested it.
if
(
IsActive
()
&&
this
->
producerRtpStream
)
if
(
!
wasProducer
)
this
->
listener
->
OnConsumerNeedBandwidth
(
this
);
RequestKeyFrame
();
}
}
void
SimpleConsumer
::
CreateRtpStream
()
void
SimpleConsumer
::
CreateRtpStream
()
...
@@ -447,8 +437,6 @@ namespace RTC
...
@@ -447,8 +437,6 @@ namespace RTC
this
->
rtpStream
->
SetRtx
(
rtxCodec
->
payloadType
,
encoding
.
rtx
.
ssrc
);
this
->
rtpStream
->
SetRtx
(
rtxCodec
->
payloadType
,
encoding
.
rtx
.
ssrc
);
this
->
keyFrameSupported
=
Codecs
::
CanBeKeyFrame
(
mediaCodec
->
mimeType
);
this
->
keyFrameSupported
=
Codecs
::
CanBeKeyFrame
(
mediaCodec
->
mimeType
);
this
->
encodingContext
.
reset
(
RTC
::
Codecs
::
GetEncodingContext
(
mediaCodec
->
mimeType
));
}
}
void
SimpleConsumer
::
RequestKeyFrame
()
void
SimpleConsumer
::
RequestKeyFrame
()
...
...
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
1a69e855
...
@@ -179,7 +179,7 @@ namespace RTC
...
@@ -179,7 +179,7 @@ namespace RTC
this
->
id
.
c_str
());
this
->
id
.
c_str
());
if
(
IsActive
())
if
(
IsActive
())
RecalculateTargetSpatialLayer
(
);
this
->
listener
->
OnConsumerNeedBandwidth
(
this
);
request
->
Accept
();
request
->
Accept
();
...
@@ -194,14 +194,21 @@ namespace RTC
...
@@ -194,14 +194,21 @@ namespace RTC
}
}
}
}
void
SimulcastConsumer
::
UseBandwidth
(
uint32_t
availableBandwidth
)
uint32_t
SimulcastConsumer
::
UseBandwidth
(
uint32_t
availableBandwidth
)
{
{
MS_TRACE
();
MS_TRACE
();
if
(
IsActive
())
if
(
IsActive
())
{
// TODO: Here we should be able to use the best layer we can.
RecalculateTargetSpatialLayer
();
RecalculateTargetSpatialLayer
();
}
}
// TODO.
return
0
;
}
void
SimulcastConsumer
::
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
void
SimulcastConsumer
::
ProducerRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -230,9 +237,27 @@ namespace RTC
...
@@ -230,9 +237,27 @@ namespace RTC
this
->
producerRtpStreams
[
spatialLayer
]
=
rtpStream
;
this
->
producerRtpStreams
[
spatialLayer
]
=
rtpStream
;
// Recalculate layers.
// If the Consumer is active and this is the first Producer RtpStream, we
if
(
IsActive
())
// need to ask for bandwidth.
//
// clang-format off
if
(
IsActive
()
&&
std
::
none_of
(
this
->
producerRtpStreams
.
begin
(),
this
->
producerRtpStreams
.
end
(),
[](
const
RTC
::
RtpStream
*
rtpStream
)
{
return
rtpStream
!=
nullptr
;
})
)
// clang-format on
{
this
->
listener
->
OnConsumerNeedBandwidth
(
this
);
}
// TODO: We should never upgrade layers by ourselves.
else
if
(
IsActive
())
{
RecalculateTargetSpatialLayer
();
RecalculateTargetSpatialLayer
();
}
// Emit the score event.
// Emit the score event.
EmitScore
();
EmitScore
();
...
@@ -242,7 +267,7 @@ namespace RTC
...
@@ -242,7 +267,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
//
Recalculat
e layers.
//
TODO: NO, we just can downgrad
e layers.
if
(
IsActive
())
if
(
IsActive
())
RecalculateTargetSpatialLayer
();
RecalculateTargetSpatialLayer
();
...
@@ -487,7 +512,7 @@ namespace RTC
...
@@ -487,7 +512,7 @@ namespace RTC
}
}
}
}
void
SimulcastConsumer
::
Paused
(
bool
/*wasProducer*/
)
void
SimulcastConsumer
::
Paused
()
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -498,7 +523,7 @@ namespace RTC
...
@@ -498,7 +523,7 @@ namespace RTC
this
->
currentSpatialLayer
=
-
1
;
this
->
currentSpatialLayer
=
-
1
;
}
}
void
SimulcastConsumer
::
Resumed
(
bool
wasProducer
)
void
SimulcastConsumer
::
Resumed
()
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -508,8 +533,9 @@ namespace RTC
...
@@ -508,8 +533,9 @@ namespace RTC
// receiver will request lot of NACKs due to unknown RTP packets.
// receiver will request lot of NACKs due to unknown RTP packets.
this
->
syncRequired
=
true
;
this
->
syncRequired
=
true
;
// We need to ask the Transport for bandwidth.
if
(
IsActive
())
if
(
IsActive
())
RecalculateTargetSpatialLayer
(
);
this
->
listener
->
OnConsumerNeedBandwidth
(
this
);
}
}
void
SimulcastConsumer
::
CreateRtpStream
()
void
SimulcastConsumer
::
CreateRtpStream
()
...
@@ -786,6 +812,12 @@ namespace RTC
...
@@ -786,6 +812,12 @@ namespace RTC
}
}
}
}
MS_DEBUG_TAG
(
simulcast
,
"newTargetSpatialLayer is %"
PRIi16
" [consumerId:%s]"
,
newTargetSpatialLayer
,
this
->
id
.
c_str
());
if
(
newTargetSpatialLayer
==
-
1
)
if
(
newTargetSpatialLayer
==
-
1
)
{
{
MS_DEBUG_TAG
(
simulcast
,
"newTargetSpatialLayer remains unset"
);
MS_DEBUG_TAG
(
simulcast
,
"newTargetSpatialLayer remains unset"
);
...
@@ -838,6 +870,7 @@ namespace RTC
...
@@ -838,6 +870,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// TODO: NO, we just can downgrade layers.
if
(
IsActive
())
if
(
IsActive
())
RecalculateTargetSpatialLayer
();
RecalculateTargetSpatialLayer
();
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
1a69e855
...
@@ -901,7 +901,11 @@ namespace RTC
...
@@ -901,7 +901,11 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
if
(
!
IsConnected
())
if
(
!
IsConnected
())
{
MS_WARN_TAG
(
rtcp
,
"ignoring key rame request (transport not connected)"
);
return
;
return
;
}
this
->
listener
->
OnTransportConsumerKeyFrameRequested
(
this
,
consumer
,
mappedSsrc
);
this
->
listener
->
OnTransportConsumerKeyFrameRequested
(
this
,
consumer
,
mappedSsrc
);
}
}
...
...
worker/src/RTC/WebRtcTransport.cpp
浏览文件 @
1a69e855
...
@@ -1151,6 +1151,19 @@ namespace RTC
...
@@ -1151,6 +1151,19 @@ namespace RTC
this
->
rembClient
->
ReceiveRembFeedback
(
remb
);
this
->
rembClient
->
ReceiveRembFeedback
(
remb
);
}
}
inline
void
WebRtcTransport
::
OnConsumerNeedBandwidth
(
RTC
::
Consumer
*
consumer
)
{
MS_TRACE
();
// Ignore if not connected.
if
(
!
IsConnected
())
return
;
// TODO: Here we must check the available sending BWE and so on.
consumer
->
UseBandwidth
(
0
);
}
inline
void
WebRtcTransport
::
OnPacketRecv
(
inline
void
WebRtcTransport
::
OnPacketRecv
(
RTC
::
UdpSocket
*
socket
,
const
uint8_t
*
data
,
size_t
len
,
const
struct
sockaddr
*
remoteAddr
)
RTC
::
UdpSocket
*
socket
,
const
uint8_t
*
data
,
size_t
len
,
const
struct
sockaddr
*
remoteAddr
)
{
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论