Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
064a883c
提交
064a883c
authored
4月 10, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rewording: available bandwidth => available bitrate
上级
529538ae
显示空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
118 行增加
和
79 行删除
+118
-79
Consumer.hpp
worker/include/RTC/Consumer.hpp
+3
-2
PipeConsumer.hpp
worker/include/RTC/PipeConsumer.hpp
+1
-1
PipeTransport.hpp
worker/include/RTC/PipeTransport.hpp
+2
-1
PlainRtpTransport.hpp
worker/include/RTC/PlainRtpTransport.hpp
+2
-1
RembClient.hpp
worker/include/RTC/RembClient.hpp
+24
-4
RemoteBitrateEstimator.hpp
worker/include/RTC/RembServer/RemoteBitrateEstimator.hpp
+2
-2
SimpleConsumer.hpp
worker/include/RTC/SimpleConsumer.hpp
+1
-1
SimulcastConsumer.hpp
worker/include/RTC/SimulcastConsumer.hpp
+1
-1
Transport.hpp
worker/include/RTC/Transport.hpp
+1
-0
WebRtcTransport.hpp
worker/include/RTC/WebRtcTransport.hpp
+5
-4
PipeConsumer.cpp
worker/src/RTC/PipeConsumer.cpp
+3
-3
PipeTransport.cpp
worker/src/RTC/PipeTransport.cpp
+15
-6
PlainRtpTransport.cpp
worker/src/RTC/PlainRtpTransport.cpp
+15
-6
RemoteBitrateEstimatorAbsSendTime.cpp
.../src/RTC/RembServer/RemoteBitrateEstimatorAbsSendTime.cpp
+2
-2
RemoteBitrateEstimatorSingleStream.cpp
...src/RTC/RembServer/RemoteBitrateEstimatorSingleStream.cpp
+1
-1
SimpleConsumer.cpp
worker/src/RTC/SimpleConsumer.cpp
+5
-5
SimulcastConsumer.cpp
worker/src/RTC/SimulcastConsumer.cpp
+6
-6
Transport.cpp
worker/src/RTC/Transport.cpp
+0
-15
WebRtcTransport.cpp
worker/src/RTC/WebRtcTransport.cpp
+29
-18
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
064a883c
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include "RTC/RtpHeaderExtensionIds.hpp"
#include "RTC/RtpHeaderExtensionIds.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpStream.hpp"
#include "RTC/RtpStream.hpp"
#include <limits>
#include <string>
#include <string>
#include <unordered_set>
#include <unordered_set>
#include <vector>
#include <vector>
...
@@ -24,10 +25,10 @@ namespace RTC
...
@@ -24,10 +25,10 @@ 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
;
virtual
void
OnConsumerNeedBitrate
(
RTC
::
Consumer
*
consumer
)
=
0
;
virtual
void
onConsumerProducerClosed
(
RTC
::
Consumer
*
consumer
)
=
0
;
virtual
void
onConsumerProducerClosed
(
RTC
::
Consumer
*
consumer
)
=
0
;
};
};
...
@@ -52,7 +53,7 @@ namespace RTC
...
@@ -52,7 +53,7 @@ namespace RTC
bool
IsActive
()
const
;
bool
IsActive
()
const
;
bool
IsPaused
()
const
;
bool
IsPaused
()
const
;
bool
IsProducerPaused
()
const
;
bool
IsProducerPaused
()
const
;
virtual
uint32_t
UseB
andwidth
(
uint32_t
availableBandwidth
)
=
0
;
virtual
uint32_t
UseB
itrate
(
uint32_t
availableBitrate
=
std
::
numeric_limits
<
uint32_t
>::
max
()
)
=
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
;
...
...
worker/include/RTC/PipeConsumer.hpp
浏览文件 @
064a883c
...
@@ -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
;
uint32_t
UseB
andwidth
(
uint32_t
availableBandwidth
)
override
;
uint32_t
UseB
itrate
(
uint32_t
availableBitrate
)
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
;
...
...
worker/include/RTC/PipeTransport.hpp
浏览文件 @
064a883c
...
@@ -40,8 +40,9 @@ namespace RTC
...
@@ -40,8 +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
;
/* Pure virtual methods inherited from RTC::Consumer::Listener. */
public
:
public
:
void
OnConsumerNeedB
andwidth
(
RTC
::
Consumer
*
consumer
)
override
;
void
OnConsumerNeedB
itrate
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
public
:
public
:
...
...
worker/include/RTC/PlainRtpTransport.hpp
浏览文件 @
064a883c
...
@@ -40,8 +40,9 @@ namespace RTC
...
@@ -40,8 +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
;
/* Pure virtual methods inherited from RTC::Consumer::Listener. */
public
:
public
:
void
OnConsumerNeedB
andwidth
(
RTC
::
Consumer
*
consumer
)
override
;
void
OnConsumerNeedB
itrate
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
public
:
public
:
...
...
worker/include/RTC/RembClient.hpp
浏览文件 @
064a883c
...
@@ -14,8 +14,8 @@ namespace RTC
...
@@ -14,8 +14,8 @@ namespace RTC
class
Listener
class
Listener
{
{
public
:
public
:
virtual
void
OnRembClientAvailableB
andwidth
(
virtual
void
OnRembClientAvailableB
itrate
(
RTC
::
RembClient
*
rembClient
,
int32_t
availableB
andwidth
)
=
0
;
RTC
::
RembClient
*
rembClient
,
int32_t
availableB
itrate
)
=
0
;
};
};
public
:
public
:
...
@@ -23,13 +23,17 @@ namespace RTC
...
@@ -23,13 +23,17 @@ namespace RTC
virtual
~
RembClient
();
virtual
~
RembClient
();
public
:
public
:
uint32_t
GetAvailableBitrate
()
const
;
void
ReceiveRtpPacket
(
RTC
::
RtpPacket
*
packet
);
void
ReceiveRtpPacket
(
RTC
::
RtpPacket
*
packet
);
void
ReceiveRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
);
void
ReceiveRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
);
uint32_t
GetAvailableBitrate
()
const
;
void
AddExtraBitrate
(
uint32_t
extraBitrate
);
void
RemoveExtraBitrate
(
uint32_t
extraBitrate
);
private
:
private
:
Listener
*
listener
;
Listener
*
listener
;
RTC
::
RtpDataCounter
transmissionCounter
;
RTC
::
RtpDataCounter
transmissionCounter
;
uint32_t
averageBitrate
{
0
};
uint32_t
extraBitrate
{
0
};
uint32_t
availableBitrate
{
0
};
uint32_t
availableBitrate
{
0
};
};
};
...
@@ -37,7 +41,23 @@ namespace RTC
...
@@ -37,7 +41,23 @@ namespace RTC
inline
uint32_t
RembClient
::
GetAvailableBitrate
()
const
inline
uint32_t
RembClient
::
GetAvailableBitrate
()
const
{
{
return
this
->
availableBitrate
;
if
(
this
->
availableBitrate
>=
this
->
extraBitrate
)
return
this
->
availableBitrate
-
this
->
extraBitrate
;
else
return
0
;
}
inline
void
RembClient
::
AddExtraBitrate
(
uint32_t
extraBitrate
)
{
this
->
extraBitrate
+=
extraBitrate
;
}
inline
void
RembClient
::
RemoveExtraBitrate
(
uint32_t
extraBitrate
)
{
if
(
this
->
extraBitrate
>=
extraBitrate
)
this
->
extraBitrate
-=
extraBitrate
;
else
this
->
extraBitrate
=
0
;
}
}
}
// namespace RTC
}
// namespace RTC
...
...
worker/include/RTC/RembServer/RemoteBitrateEstimator.hpp
浏览文件 @
064a883c
...
@@ -43,10 +43,10 @@ namespace RTC
...
@@ -43,10 +43,10 @@ namespace RTC
{
{
public
:
public
:
// Called when a receive channel group has a new bandwidth estimate for the incoming streams.
// Called when a receive channel group has a new bandwidth estimate for the incoming streams.
virtual
void
OnRembServer
Bandwidth
(
virtual
void
OnRembServer
AvailableBitrate
(
const
RemoteBitrateEstimator
*
remoteBitrateEstimator
,
const
RemoteBitrateEstimator
*
remoteBitrateEstimator
,
const
std
::
vector
<
uint32_t
>&
ssrcs
,
const
std
::
vector
<
uint32_t
>&
ssrcs
,
uint32_t
bandwidth
)
=
0
;
uint32_t
availableBitrate
)
=
0
;
};
};
protected
:
protected
:
...
...
worker/include/RTC/SimpleConsumer.hpp
浏览文件 @
064a883c
...
@@ -18,7 +18,7 @@ namespace RTC
...
@@ -18,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
;
uint32_t
UseB
andwidth
(
uint32_t
availableBandwidth
)
override
;
uint32_t
UseB
itrate
(
uint32_t
availableBitrate
)
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
;
...
...
worker/include/RTC/SimulcastConsumer.hpp
浏览文件 @
064a883c
...
@@ -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
;
uint32_t
UseB
andwidth
(
uint32_t
availableBandwidth
)
override
;
uint32_t
UseB
itrate
(
uint32_t
availableBitrate
)
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
;
...
...
worker/include/RTC/Transport.hpp
浏览文件 @
064a883c
...
@@ -114,6 +114,7 @@ namespace RTC
...
@@ -114,6 +114,7 @@ namespace RTC
void
OnConsumerSendRtpPacket
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpPacket
*
packet
)
override
;
void
OnConsumerSendRtpPacket
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpPacket
*
packet
)
override
;
void
OnConsumerRetransmitRtpPacket
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpPacket
*
packet
)
override
;
void
OnConsumerRetransmitRtpPacket
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpPacket
*
packet
)
override
;
void
OnConsumerKeyFrameRequested
(
RTC
::
Consumer
*
consumer
,
uint32_t
mappedSsrc
)
override
;
void
OnConsumerKeyFrameRequested
(
RTC
::
Consumer
*
consumer
,
uint32_t
mappedSsrc
)
override
;
virtual
void
OnConsumerNeedBitrate
(
RTC
::
Consumer
*
consumer
)
override
=
0
;
void
onConsumerProducerClosed
(
RTC
::
Consumer
*
consumer
)
override
;
void
onConsumerProducerClosed
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from Timer::Listener. */
/* Pure virtual methods inherited from Timer::Listener. */
...
...
worker/include/RTC/WebRtcTransport.hpp
浏览文件 @
064a883c
...
@@ -60,8 +60,9 @@ namespace RTC
...
@@ -60,8 +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
;
/* Pure virtual methods inherited from RTC::Consumer::Listener. */
public
:
public
:
void
OnConsumerNeedB
andwidth
(
RTC
::
Consumer
*
consumer
)
override
;
void
OnConsumerNeedB
itrate
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
public
:
public
:
...
@@ -106,14 +107,14 @@ namespace RTC
...
@@ -106,14 +107,14 @@ namespace RTC
/* Pure virtual methods inherited from RTC::RembClient::Listener. */
/* Pure virtual methods inherited from RTC::RembClient::Listener. */
public
:
public
:
void
OnRembClientAvailableB
andwidth
(
RTC
::
RembClient
*
rembClient
,
int32_t
availableBandwidth
)
override
;
void
OnRembClientAvailableB
itrate
(
RTC
::
RembClient
*
rembClient
,
int32_t
availableBitrate
)
override
;
/* Pure virtual methods inherited from RTC::RembServer::RemoteBitrateEstimator::Listener. */
/* Pure virtual methods inherited from RTC::RembServer::RemoteBitrateEstimator::Listener. */
public
:
public
:
void
OnRembServer
Bandwidth
(
void
OnRembServer
AvailableBitrate
(
const
RTC
::
RembServer
::
RemoteBitrateEstimator
*
remoteBitrateEstimator
,
const
RTC
::
RembServer
::
RemoteBitrateEstimator
*
remoteBitrateEstimator
,
const
std
::
vector
<
uint32_t
>&
ssrcs
,
const
std
::
vector
<
uint32_t
>&
ssrcs
,
uint32_t
bandwidth
)
override
;
uint32_t
availableBitrate
)
override
;
private
:
private
:
// Allocated by this.
// Allocated by this.
...
...
worker/src/RTC/PipeConsumer.cpp
浏览文件 @
064a883c
...
@@ -80,7 +80,7 @@ namespace RTC
...
@@ -80,7 +80,7 @@ namespace RTC
}
}
}
}
uint32_t
PipeConsumer
::
UseB
andwidth
(
uint32_t
availableBandwidth
)
uint32_t
PipeConsumer
::
UseB
itrate
(
uint32_t
availableBitrate
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -259,9 +259,9 @@ namespace RTC
...
@@ -259,9 +259,9 @@ namespace RTC
rtpStream
->
Resume
();
rtpStream
->
Resume
();
}
}
// We need to ask the Transport for b
andwidth
.
// We need to ask the Transport for b
itrate
.
if
(
IsActive
())
if
(
IsActive
())
this
->
listener
->
OnConsumerNeedB
andwidth
(
this
);
this
->
listener
->
OnConsumerNeedB
itrate
(
this
);
}
}
void
PipeConsumer
::
CreateRtpStreams
()
void
PipeConsumer
::
CreateRtpStreams
()
...
...
worker/src/RTC/PipeTransport.cpp
浏览文件 @
064a883c
...
@@ -236,6 +236,14 @@ namespace RTC
...
@@ -236,6 +236,14 @@ namespace RTC
// and tell the parent class.
// and tell the parent class.
RTC
::
Transport
::
Connected
();
RTC
::
Transport
::
Connected
();
// Tell all Consumers.
for
(
auto
&
kv
:
this
->
mapConsumers
)
{
auto
*
consumer
=
kv
.
second
;
consumer
->
UseBitrate
();
}
break
;
break
;
}
}
...
@@ -406,11 +414,14 @@ namespace RTC
...
@@ -406,11 +414,14 @@ namespace RTC
// Do nothing.
// Do nothing.
}
}
void
PipeTransport
::
UserOnNewConsumer
(
RTC
::
Consumer
*
/*consumer*/
)
void
PipeTransport
::
UserOnNewConsumer
(
RTC
::
Consumer
*
consumer
)
{
{
MS_TRACE
();
MS_TRACE
();
// Do nothing.
// If the Transport is already connected tell the new Consumer to use
// available bitrate.
if
(
IsConnected
())
consumer
->
UseBitrate
();
}
}
void
PipeTransport
::
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
/*remb*/
)
void
PipeTransport
::
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
/*remb*/
)
...
@@ -420,7 +431,7 @@ namespace RTC
...
@@ -420,7 +431,7 @@ namespace RTC
// TODO
// TODO
}
}
inline
void
PipeTransport
::
OnConsumerNeedB
andwidth
(
RTC
::
Consumer
*
consumer
)
inline
void
PipeTransport
::
OnConsumerNeedB
itrate
(
RTC
::
Consumer
*
consumer
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -428,9 +439,7 @@ namespace RTC
...
@@ -428,9 +439,7 @@ namespace RTC
if
(
!
IsConnected
())
if
(
!
IsConnected
())
return
;
return
;
// TODO: Here we must check the available sending BWE and so on.
consumer
->
UseBitrate
();
consumer
->
UseBandwidth
(
0
);
}
}
inline
void
PipeTransport
::
OnPacketRecv
(
inline
void
PipeTransport
::
OnPacketRecv
(
...
...
worker/src/RTC/PlainRtpTransport.cpp
浏览文件 @
064a883c
...
@@ -413,6 +413,14 @@ namespace RTC
...
@@ -413,6 +413,14 @@ namespace RTC
// and tell the parent class.
// and tell the parent class.
RTC
::
Transport
::
Connected
();
RTC
::
Transport
::
Connected
();
// Tell all Consumers.
for
(
auto
&
kv
:
this
->
mapConsumers
)
{
auto
*
consumer
=
kv
.
second
;
consumer
->
UseBitrate
();
}
break
;
break
;
}
}
...
@@ -678,11 +686,14 @@ namespace RTC
...
@@ -678,11 +686,14 @@ namespace RTC
// Do nothing.
// Do nothing.
}
}
void
PlainRtpTransport
::
UserOnNewConsumer
(
RTC
::
Consumer
*
/*consumer*/
)
void
PlainRtpTransport
::
UserOnNewConsumer
(
RTC
::
Consumer
*
consumer
)
{
{
MS_TRACE
();
MS_TRACE
();
// Do nothing.
// If the Transport is already connected tell the new Consumer to use
// available bitrate.
if
(
IsConnected
())
consumer
->
UseBitrate
();
}
}
void
PlainRtpTransport
::
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
/*remb*/
)
void
PlainRtpTransport
::
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
/*remb*/
)
...
@@ -692,7 +703,7 @@ namespace RTC
...
@@ -692,7 +703,7 @@ namespace RTC
// TODO
// TODO
}
}
inline
void
PlainRtpTransport
::
OnConsumerNeedB
andwidth
(
RTC
::
Consumer
*
consumer
)
inline
void
PlainRtpTransport
::
OnConsumerNeedB
itrate
(
RTC
::
Consumer
*
consumer
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -700,9 +711,7 @@ namespace RTC
...
@@ -700,9 +711,7 @@ namespace RTC
if
(
!
IsConnected
())
if
(
!
IsConnected
())
return
;
return
;
// TODO: Here we must check the available sending BWE and so on.
consumer
->
UseBitrate
();
consumer
->
UseBandwidth
(
0
);
}
}
inline
void
PlainRtpTransport
::
OnPacketRecv
(
inline
void
PlainRtpTransport
::
OnPacketRecv
(
...
...
worker/src/RTC/RembServer/RemoteBitrateEstimatorAbsSendTime.cpp
浏览文件 @
064a883c
...
@@ -323,7 +323,7 @@ namespace RTC
...
@@ -323,7 +323,7 @@ namespace RTC
++
this
->
totalProbesReceived
;
++
this
->
totalProbesReceived
;
// Make sure that a probe which updated the bitrate immediately has an
// Make sure that a probe which updated the bitrate immediately has an
// effect by calling the OnRembServer
Bandwidth
callback.
// effect by calling the OnRembServer
AvailableBitrate
callback.
if
(
ProcessClusters
(
nowMs
)
==
ProbeResult
::
BITRATE_UPDATED
)
if
(
ProcessClusters
(
nowMs
)
==
ProbeResult
::
BITRATE_UPDATED
)
updateEstimate
=
true
;
updateEstimate
=
true
;
}
}
...
@@ -377,7 +377,7 @@ namespace RTC
...
@@ -377,7 +377,7 @@ namespace RTC
this
->
lastUpdateMs
=
nowMs
;
this
->
lastUpdateMs
=
nowMs
;
this
->
availableBitrate
=
targetBitrateBps
;
this
->
availableBitrate
=
targetBitrateBps
;
this
->
observer
->
OnRembServer
Bandwidth
(
this
,
ssrcs
,
targetBitrateBps
);
this
->
observer
->
OnRembServer
AvailableBitrate
(
this
,
ssrcs
,
targetBitrateBps
);
}
}
}
}
...
...
worker/src/RTC/RembServer/RemoteBitrateEstimatorSingleStream.cpp
浏览文件 @
064a883c
...
@@ -165,7 +165,7 @@ namespace RTC
...
@@ -165,7 +165,7 @@ namespace RTC
std
::
vector
<
uint32_t
>
ssrcs
;
std
::
vector
<
uint32_t
>
ssrcs
;
GetSsrcs
(
&
ssrcs
);
GetSsrcs
(
&
ssrcs
);
this
->
observer
->
OnRembServer
Bandwidth
(
this
,
ssrcs
,
targetBitrate
);
this
->
observer
->
OnRembServer
AvailableBitrate
(
this
,
ssrcs
,
targetBitrate
);
}
}
}
}
...
...
worker/src/RTC/SimpleConsumer.cpp
浏览文件 @
064a883c
...
@@ -99,7 +99,7 @@ namespace RTC
...
@@ -99,7 +99,7 @@ namespace RTC
}
}
}
}
uint32_t
SimpleConsumer
::
UseB
andwidth
(
uint32_t
availableBandwidth
)
uint32_t
SimpleConsumer
::
UseB
itrate
(
uint32_t
availableBitrate
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -128,8 +128,8 @@ namespace RTC
...
@@ -128,8 +128,8 @@ namespace RTC
if
(
IsActive
())
if
(
IsActive
())
{
{
// Since the Producer RtpStream has been created right now, we need to ask
// Since the Producer RtpStream has been created right now, we need to ask
// the Transport for b
andwidth
.
// the Transport for b
itrate
.
this
->
listener
->
OnConsumerNeedB
andwidth
(
this
);
this
->
listener
->
OnConsumerNeedB
itrate
(
this
);
}
}
// Emit the score event.
// Emit the score event.
...
@@ -355,9 +355,9 @@ namespace RTC
...
@@ -355,9 +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
;
// We need to ask the Transport for b
andwidth
.
// We need to ask the Transport for b
itrate
.
if
(
IsActive
()
&&
this
->
producerRtpStream
)
if
(
IsActive
()
&&
this
->
producerRtpStream
)
this
->
listener
->
OnConsumerNeedB
andwidth
(
this
);
this
->
listener
->
OnConsumerNeedB
itrate
(
this
);
}
}
void
SimpleConsumer
::
CreateRtpStream
()
void
SimpleConsumer
::
CreateRtpStream
()
...
...
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
064a883c
...
@@ -216,7 +216,7 @@ namespace RTC
...
@@ -216,7 +216,7 @@ namespace RTC
this
->
id
.
c_str
());
this
->
id
.
c_str
());
if
(
IsActive
())
if
(
IsActive
())
this
->
listener
->
OnConsumerNeedB
andwidth
(
this
);
this
->
listener
->
OnConsumerNeedB
itrate
(
this
);
request
->
Accept
();
request
->
Accept
();
...
@@ -231,7 +231,7 @@ namespace RTC
...
@@ -231,7 +231,7 @@ namespace RTC
}
}
}
}
uint32_t
SimulcastConsumer
::
UseB
andwidth
(
uint32_t
availableBandwidth
)
uint32_t
SimulcastConsumer
::
UseB
itrate
(
uint32_t
availableBitrate
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -275,7 +275,7 @@ namespace RTC
...
@@ -275,7 +275,7 @@ namespace RTC
this
->
producerRtpStreams
[
spatialLayer
]
=
rtpStream
;
this
->
producerRtpStreams
[
spatialLayer
]
=
rtpStream
;
// If the Consumer is active and this is the first Producer RtpStream, we
// If the Consumer is active and this is the first Producer RtpStream, we
// need to ask for b
andwidth
.
// need to ask for b
itrate
.
//
//
// clang-format off
// clang-format off
if
(
if
(
...
@@ -288,7 +288,7 @@ namespace RTC
...
@@ -288,7 +288,7 @@ namespace RTC
)
)
// clang-format on
// clang-format on
{
{
this
->
listener
->
OnConsumerNeedB
andwidth
(
this
);
this
->
listener
->
OnConsumerNeedB
itrate
(
this
);
}
}
// TODO: We should never upgrade layers by ourselves.
// TODO: We should never upgrade layers by ourselves.
else
if
(
IsActive
())
else
if
(
IsActive
())
...
@@ -584,9 +584,9 @@ namespace RTC
...
@@ -584,9 +584,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 b
andwidth
.
// We need to ask the Transport for b
itrate
.
if
(
IsActive
())
if
(
IsActive
())
this
->
listener
->
OnConsumerNeedB
andwidth
(
this
);
this
->
listener
->
OnConsumerNeedB
itrate
(
this
);
}
}
void
SimulcastConsumer
::
CreateRtpStream
()
void
SimulcastConsumer
::
CreateRtpStream
()
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
064a883c
...
@@ -338,12 +338,6 @@ namespace RTC
...
@@ -338,12 +338,6 @@ namespace RTC
// Tell the subclass.
// Tell the subclass.
UserOnNewConsumer
(
consumer
);
UserOnNewConsumer
(
consumer
);
// TODO: Update with new BWE API.
//
// If the Transport is already connected tell the new Consumer to ask for bandwidth.
if
(
IsConnected
())
consumer
->
UseBandwidth
(
0
);
break
;
break
;
}
}
...
@@ -438,15 +432,6 @@ namespace RTC
...
@@ -438,15 +432,6 @@ namespace RTC
// Start the RTCP timer.
// Start the RTCP timer.
this
->
rtcpTimer
->
Start
(
static_cast
<
uint64_t
>
(
RTC
::
RTCP
::
MaxVideoIntervalMs
/
2
));
this
->
rtcpTimer
->
Start
(
static_cast
<
uint64_t
>
(
RTC
::
RTCP
::
MaxVideoIntervalMs
/
2
));
// Iterate all Consumers and tell them to use bandwidth.
for
(
auto
&
kv
:
this
->
mapConsumers
)
{
auto
*
consumer
=
kv
.
second
;
// TODO: Update with new BWE API.
consumer
->
UseBandwidth
(
0
);
}
}
}
void
Transport
::
Disconnected
()
void
Transport
::
Disconnected
()
...
...
worker/src/RTC/WebRtcTransport.cpp
浏览文件 @
064a883c
...
@@ -1139,6 +1139,14 @@ namespace RTC
...
@@ -1139,6 +1139,14 @@ namespace RTC
this
->
rembClient
=
new
RTC
::
RembClient
(
this
);
this
->
rembClient
=
new
RTC
::
RembClient
(
this
);
}
}
// If the Transport is already connected tell the new Consumer to use
// available bitrate.
if
(
IsConnected
())
{
// TODO
consumer
->
UseBitrate
();
}
}
}
void
WebRtcTransport
::
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
)
void
WebRtcTransport
::
UserOnRembFeedback
(
RTC
::
RTCP
::
FeedbackPsRembPacket
*
remb
)
...
@@ -1151,7 +1159,7 @@ namespace RTC
...
@@ -1151,7 +1159,7 @@ namespace RTC
this
->
rembClient
->
ReceiveRembFeedback
(
remb
);
this
->
rembClient
->
ReceiveRembFeedback
(
remb
);
}
}
inline
void
WebRtcTransport
::
OnConsumerNeedB
andwidth
(
RTC
::
Consumer
*
consumer
)
inline
void
WebRtcTransport
::
OnConsumerNeedB
itrate
(
RTC
::
Consumer
*
consumer
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -1159,9 +1167,8 @@ namespace RTC
...
@@ -1159,9 +1167,8 @@ namespace RTC
if
(
!
IsConnected
())
if
(
!
IsConnected
())
return
;
return
;
// TODO: Here we must check the available sending BWE and so on.
// TODO
consumer
->
UseBitrate
();
consumer
->
UseBandwidth
(
0
);
}
}
inline
void
WebRtcTransport
::
OnPacketRecv
(
inline
void
WebRtcTransport
::
OnPacketRecv
(
...
@@ -1355,6 +1362,15 @@ namespace RTC
...
@@ -1355,6 +1362,15 @@ namespace RTC
// Tell the parent class.
// Tell the parent class.
RTC
::
Transport
::
Connected
();
RTC
::
Transport
::
Connected
();
// Tell all Consumers.
for
(
auto
&
kv
:
this
->
mapConsumers
)
{
auto
*
consumer
=
kv
.
second
;
// TODO
consumer
->
UseBitrate
();
}
}
}
inline
void
WebRtcTransport
::
OnDtlsFailed
(
const
RTC
::
DtlsTransport
*
/*dtlsTransport*/
)
inline
void
WebRtcTransport
::
OnDtlsFailed
(
const
RTC
::
DtlsTransport
*
/*dtlsTransport*/
)
...
@@ -1413,28 +1429,24 @@ namespace RTC
...
@@ -1413,28 +1429,24 @@ namespace RTC
// NOTE: No DataChannel support, si just ignore it.
// NOTE: No DataChannel support, si just ignore it.
}
}
inline
void
WebRtcTransport
::
OnRembClientAvailableB
andwidth
(
inline
void
WebRtcTransport
::
OnRembClientAvailableB
itrate
(
RTC
::
RembClient
*
rembClient
,
int32_t
availableB
andwidth
)
RTC
::
RembClient
*
rembClient
,
int32_t
availableB
itrate
)
{
{
MS_TRACE
();
MS_TRACE
();
// TODO
// TODO
}
}
inline
void
WebRtcTransport
::
OnRembServer
Bandwidth
(
inline
void
WebRtcTransport
::
OnRembServer
AvailableBitrate
(
const
RTC
::
RembServer
::
RemoteBitrateEstimator
*
/*rembServer*/
,
const
RTC
::
RembServer
::
RemoteBitrateEstimator
*
/*rembServer*/
,
const
std
::
vector
<
uint32_t
>&
ssrcs
,
const
std
::
vector
<
uint32_t
>&
ssrcs
,
uint32_t
bandwidth
)
uint32_t
availableBitrate
)
{
{
MS_TRACE
();
MS_TRACE
();
uint32_t
effectiveBandwidth
{
0u
};
// Limit announced bitrate if requested via API.
// Limit announced bandwidth if requested via API.
if
(
this
->
maxIncomingBitrate
!=
0u
)
if
(
this
->
maxIncomingBitrate
!=
0u
)
effectiveBandwidth
=
std
::
min
(
bandwidth
,
this
->
maxIncomingBitrate
);
availableBitrate
=
std
::
min
(
availableBitrate
,
this
->
maxIncomingBitrate
);
else
effectiveBandwidth
=
bandwidth
;
if
(
MS_HAS_DEBUG_TAG
(
rbe
))
if
(
MS_HAS_DEBUG_TAG
(
rbe
))
{
{
...
@@ -1448,15 +1460,14 @@ namespace RTC
...
@@ -1448,15 +1460,14 @@ namespace RTC
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
rbe
,
rbe
,
"sending RTCP REMB packet [bandwidth:%"
PRIu32
"bps, effective:%"
PRIu32
"bps, ssrcs:%s]"
,
"sending RTCP REMB packet [bitrate:%"
PRIu32
"bps, ssrcs:%s]"
,
bandwidth
,
availableBitrate
,
effectiveBandwidth
,
ssrcsStream
.
str
().
c_str
());
ssrcsStream
.
str
().
c_str
());
}
}
RTC
::
RTCP
::
FeedbackPsRembPacket
packet
(
0
,
0
);
RTC
::
RTCP
::
FeedbackPsRembPacket
packet
(
0
,
0
);
packet
.
SetBitrate
(
effectiveBandwidth
);
packet
.
SetBitrate
(
availableBitrate
);
packet
.
SetSsrcs
(
ssrcs
);
packet
.
SetSsrcs
(
ssrcs
);
packet
.
Serialize
(
RTC
::
RTCP
::
Buffer
);
packet
.
Serialize
(
RTC
::
RTCP
::
Buffer
);
SendRtcpPacket
(
&
packet
);
SendRtcpPacket
(
&
packet
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论