Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
3142d063
提交
3142d063
authored
9月 03, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
foo
上级
3e8194f3
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
34 行增加
和
196 行删除
+34
-196
NackGenerator.hpp
worker/include/RTC/NackGenerator.hpp
+2
-2
Peer.hpp
worker/include/RTC/Peer.hpp
+0
-152
Producer.hpp
worker/include/RTC/Producer.hpp
+2
-2
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+4
-4
NackGenerator.cpp
worker/src/RTC/NackGenerator.cpp
+3
-3
Peer.cpp
worker/src/RTC/Peer.cpp
+0
-0
Producer.cpp
worker/src/RTC/Producer.cpp
+7
-7
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+10
-24
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+4
-0
Transport.cpp
worker/src/RTC/Transport.cpp
+2
-2
没有找到文件。
worker/include/RTC/NackGenerator.hpp
浏览文件 @
3142d063
...
...
@@ -15,8 +15,8 @@ namespace RTC
class
Listener
{
public
:
virtual
void
OnNackRequired
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
=
0
;
virtual
void
OnFullFrameRequired
()
=
0
;
virtual
void
OnNack
GeneratorNack
Required
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
=
0
;
virtual
void
On
NackGenerator
FullFrameRequired
()
=
0
;
};
private
:
...
...
worker/include/RTC/Peer.hpp
deleted
100644 → 0
浏览文件 @
3e8194f3
#ifndef MS_RTC_PEER_HPP
#define MS_RTC_PEER_HPP
#include "common.hpp"
#include "Channel/Notifier.hpp"
#include "Channel/Request.hpp"
#include "RTC/Consumer.hpp"
#include "RTC/Producer.hpp"
#include "RTC/RTCP/Feedback.hpp"
#include "RTC/RTCP/ReceiverReport.hpp"
#include "RTC/RTCP/SenderReport.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/Transport.hpp"
#include "handles/Timer.hpp"
#include <json/json.h>
#include <string>
#include <unordered_map>
#include <vector>
namespace
RTC
{
class
Peer
:
public
RTC
::
Transport
::
Listener
,
public
RTC
::
Producer
::
Listener
,
public
RTC
::
Consumer
::
Listener
,
public
Timer
::
Listener
{
public
:
class
Listener
{
public
:
virtual
void
OnPeerClosed
(
const
RTC
::
Peer
*
peer
)
=
0
;
virtual
void
OnPeerProducerClosed
(
const
RTC
::
Peer
*
peer
,
const
RTC
::
Producer
*
producer
)
=
0
;
virtual
void
OnPeerProducerRtpParameters
(
const
RTC
::
Peer
*
peer
,
RTC
::
Producer
*
producer
)
=
0
;
virtual
void
OnPeerProducerPaused
(
const
RTC
::
Peer
*
peer
,
const
RTC
::
Producer
*
producer
)
=
0
;
virtual
void
OnPeerProducerResumed
(
const
RTC
::
Peer
*
peer
,
const
RTC
::
Producer
*
producer
)
=
0
;
virtual
void
OnPeerProducerRtpPacket
(
const
RTC
::
Peer
*
peer
,
RTC
::
Producer
*
producer
,
RTC
::
RtpPacket
*
packet
)
=
0
;
virtual
void
OnPeerProducerRtcpSenderReport
(
const
RTC
::
Peer
*
peer
,
RTC
::
Producer
*
producer
,
RTC
::
RTCP
::
SenderReport
*
report
)
=
0
;
virtual
void
OnPeerConsumerClosed
(
const
RTC
::
Peer
*
peer
,
RTC
::
Consumer
*
consumer
)
=
0
;
virtual
void
OnPeerConsumerRtcpReceiverReport
(
const
RTC
::
Peer
*
peer
,
RTC
::
Consumer
*
consumer
,
RTC
::
RTCP
::
ReceiverReport
*
report
)
=
0
;
virtual
void
OnPeerConsumerRtcpFeedback
(
const
RTC
::
Peer
*
peer
,
RTC
::
Consumer
*
consumer
,
RTC
::
RTCP
::
FeedbackPsPacket
*
packet
)
=
0
;
virtual
void
OnPeerConsumerRtcpFeedback
(
const
RTC
::
Peer
*
peer
,
RTC
::
Consumer
*
consumer
,
RTC
::
RTCP
::
FeedbackRtpPacket
*
packet
)
=
0
;
virtual
void
OnPeerConsumerFullFrameRequired
(
RTC
::
Peer
*
peer
,
RTC
::
Consumer
*
consumer
)
=
0
;
};
public
:
Peer
(
Listener
*
listener
,
Channel
::
Notifier
*
notifier
,
uint32_t
peerId
,
std
::
string
&
peerName
);
private
:
~
Peer
()
override
;
public
:
void
Destroy
();
Json
::
Value
ToJson
()
const
;
void
HandleRequest
(
Channel
::
Request
*
request
);
std
::
vector
<
RTC
::
Producer
*>
GetProducers
()
const
;
std
::
vector
<
RTC
::
Consumer
*>
GetConsumers
()
const
;
const
std
::
unordered_map
<
uint32_t
,
RTC
::
Transport
*>&
GetTransports
()
const
;
/**
* Add a new Consumer to the Peer.
* @param consumer - Instance of Consumer.
* @param peerName - Name of the receiver Peer.
*/
void
AddConsumer
(
RTC
::
Consumer
*
consumer
,
RTC
::
RtpParameters
*
rtpParameters
,
uint32_t
associatedProducerId
);
RTC
::
Consumer
*
GetConsumer
(
uint32_t
ssrc
)
const
;
void
SendRtcp
(
uint64_t
now
);
private
:
RTC
::
Transport
*
GetTransportFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
transportId
=
nullptr
)
const
;
RTC
::
Producer
*
GetProducerFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
producerId
=
nullptr
)
const
;
RTC
::
Consumer
*
GetConsumerFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
consumerId
=
nullptr
)
const
;
/* Pure virtual methods inherited from RTC::Transport::Listener. */
public
:
void
OnTransportClosed
(
RTC
::
Transport
*
transport
)
override
;
void
OnTransportConnected
(
RTC
::
Transport
*
transport
)
override
;
void
OnTransportRtcpPacket
(
RTC
::
Transport
*
transport
,
RTC
::
RTCP
::
Packet
*
packet
)
override
;
void
OnTransportFullFrameRequired
(
RTC
::
Transport
*
transport
)
override
;
/* Pure virtual methods inherited from RTC::Producer::Listener. */
public
:
void
OnProducerClosed
(
RTC
::
Producer
*
producer
)
override
;
void
OnProducerRtpParameters
(
RTC
::
Producer
*
producer
)
override
;
void
OnProducerPaused
(
RTC
::
Producer
*
producer
)
override
;
void
OnProducerResumed
(
RTC
::
Producer
*
producer
)
override
;
void
OnProducerRtpPacket
(
RTC
::
Producer
*
producer
,
RTC
::
RtpPacket
*
packet
)
override
;
/* Pure virtual methods inherited from RTC::Consumer::Listener. */
public
:
void
OnConsumerClosed
(
RTC
::
Consumer
*
consumer
)
override
;
void
OnConsumerFullFrameRequired
(
RTC
::
Consumer
*
consumer
)
override
;
/* Pure virtual methods inherited from Timer::Listener. */
public
:
void
OnTimer
(
Timer
*
timer
)
override
;
public
:
// Passed by argument.
uint32_t
peerId
{
0
};
std
::
string
peerName
;
private
:
// Passed by argument.
Listener
*
listener
{
nullptr
};
Channel
::
Notifier
*
notifier
{
nullptr
};
// Others.
Timer
*
timer
{
nullptr
};
std
::
unordered_map
<
uint32_t
,
RTC
::
Transport
*>
transports
;
std
::
unordered_map
<
uint32_t
,
RTC
::
Producer
*>
producers
;
std
::
unordered_map
<
uint32_t
,
RTC
::
Consumer
*>
consumers
;
};
/* Inline methods. */
inline
std
::
vector
<
RTC
::
Producer
*>
Peer
::
GetProducers
()
const
{
std
::
vector
<
RTC
::
Producer
*>
producers
;
for
(
const
auto
&
producer
:
this
->
producers
)
{
producers
.
push_back
(
producer
.
second
);
}
return
producers
;
}
inline
std
::
vector
<
RTC
::
Consumer
*>
Peer
::
GetConsumers
()
const
{
std
::
vector
<
RTC
::
Consumer
*>
consumers
;
for
(
const
auto
&
consumer
:
this
->
consumers
)
{
consumers
.
push_back
(
consumer
.
second
);
}
return
consumers
;
}
inline
const
std
::
unordered_map
<
uint32_t
,
RTC
::
Transport
*>&
Peer
::
GetTransports
()
const
{
return
this
->
transports
;
}
}
// namespace RTC
#endif
worker/include/RTC/Producer.hpp
浏览文件 @
3142d063
...
...
@@ -72,8 +72,8 @@ namespace RTC
/* Pure virtual methods inherited from RTC::RtpStreamRecv::Listener. */
public
:
void
OnNackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
;
void
OnPliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
override
;
void
On
RtpStreamRecv
NackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
;
void
On
RtpStreamRecv
PliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
override
;
/* Pure virtual methods inherited from Timer::Listener. */
public
:
...
...
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
3142d063
...
...
@@ -14,9 +14,9 @@ namespace RTC
class
Listener
{
public
:
virtual
void
OnNackRequired
(
virtual
void
On
RtpStreamRecv
NackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
=
0
;
virtual
void
OnPliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
=
0
;
virtual
void
On
RtpStreamRecv
PliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
=
0
;
};
public
:
...
...
@@ -40,8 +40,8 @@ namespace RTC
/* Pure virtual methods inherited from RTC::NackGenerator. */
protected
:
void
OnNackRequired
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
;
void
OnFullFrameRequired
()
override
;
void
OnNack
GeneratorNack
Required
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
;
void
On
NackGenerator
FullFrameRequired
()
override
;
private
:
// Passed by argument.
...
...
worker/src/RTC/NackGenerator.cpp
浏览文件 @
3142d063
...
...
@@ -96,7 +96,7 @@ namespace RTC
std
::
vector
<
uint16_t
>
nackBatch
=
GetNackBatch
(
NackFilter
::
SEQ
);
if
(
!
nackBatch
.
empty
())
this
->
listener
->
OnNackRequired
(
nackBatch
);
this
->
listener
->
OnNack
GeneratorNack
Required
(
nackBatch
);
MayRunTimer
();
}
...
...
@@ -118,7 +118,7 @@ namespace RTC
MS_DEBUG_TAG
(
rtx
,
"nack list too large, clearing it and requesting a full frame"
);
this
->
nackList
.
clear
();
this
->
listener
->
OnFullFrameRequired
();
this
->
listener
->
On
NackGenerator
FullFrameRequired
();
return
;
}
...
...
@@ -215,7 +215,7 @@ namespace RTC
std
::
vector
<
uint16_t
>
nackBatch
=
GetNackBatch
(
NackFilter
::
TIME
);
if
(
!
nackBatch
.
empty
())
this
->
listener
->
OnNackRequired
(
nackBatch
);
this
->
listener
->
OnNack
GeneratorNack
Required
(
nackBatch
);
MayRunTimer
();
}
...
...
worker/src/RTC/Peer.cpp
deleted
100644 → 0
浏览文件 @
3e8194f3
差异被折叠。
点击展开。
worker/src/RTC/Producer.cpp
浏览文件 @
3142d063
...
...
@@ -47,7 +47,7 @@ namespace RTC
else
this
->
maxRtcpInterval
=
RTC
::
RTCP
::
MaxAudioIntervalMs
;
// Set the RTP fullframe request block timer.
// Set the RTP full
frame request block timer.
this
->
fullFrameRequestBlockTimer
=
new
Timer
(
this
);
}
...
...
@@ -74,7 +74,7 @@ namespace RTC
listener
->
OnProducerClosed
(
this
);
}
// Close the RTP fullframe request block timer.
// Close the RTP full
frame request block timer.
this
->
fullFrameRequestBlockTimer
->
Destroy
();
delete
this
;
...
...
@@ -373,7 +373,7 @@ namespace RTC
}
else
if
(
this
->
fullFrameRequestBlockTimer
->
IsActive
())
{
MS_DEBUG_TAG
(
rtx
,
"blocking fullframe request until timer expires"
);
MS_DEBUG_TAG
(
rtx
,
"blocking full
frame request until timer expires"
);
// Set flag.
this
->
isFullFrameRequested
=
true
;
...
...
@@ -539,7 +539,7 @@ namespace RTC
}
}
void
Producer
::
OnNackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
void
Producer
::
On
RtpStreamRecv
NackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
{
MS_TRACE
();
...
...
@@ -587,7 +587,7 @@ namespace RTC
this
->
transport
->
SendRtcpPacket
(
&
packet
);
}
void
Producer
::
OnPliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
void
Producer
::
On
RtpStreamRecv
PliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
{
MS_TRACE
();
...
...
@@ -606,11 +606,11 @@ namespace RTC
if
(
timer
==
this
->
fullFrameRequestBlockTimer
)
{
// Nobody asked for a fullframe since the timer was started.
// Nobody asked for a full
frame since the timer was started.
if
(
!
this
->
isFullFrameRequested
)
return
;
MS_DEBUG_TAG
(
rtx
,
"requesting fullframe after timer expires"
);
MS_DEBUG_TAG
(
rtx
,
"requesting full
frame after timer expires"
);
RequestFullFrame
();
}
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
3142d063
...
...
@@ -47,7 +47,11 @@ namespace RTC
// Call the parent method.
if
(
!
RtpStream
::
ReceivePacket
(
packet
))
{
MS_DEBUG_TAG
(
rtp
,
"packet discarded"
);
return
false
;
}
// Calculate Jitter.
CalculateJitter
(
packet
->
GetTimestamp
());
...
...
@@ -203,7 +207,7 @@ namespace RTC
if
(
this
->
params
.
useNack
)
this
->
nackGenerator
.
reset
(
new
RTC
::
NackGenerator
(
this
));
this
->
listener
->
OnPliRequired
(
this
);
this
->
listener
->
On
RtpStreamRecv
PliRequired
(
this
);
}
}
...
...
@@ -228,20 +232,11 @@ namespace RTC
{
MS_TRACE
();
// Reset NackGenerator.
if
(
this
->
params
.
useNack
)
this
->
nackGenerator
.
reset
(
new
RTC
::
NackGenerator
(
this
));
// Request a full frame so dropped video packets don't cause lag.
if
(
this
->
params
.
mime
.
type
==
RTC
::
RtpCodecMimeType
::
Type
::
VIDEO
)
{
MS_DEBUG_TAG
(
rtx
,
"stream initialized, triggering PLI [ssrc:%"
PRIu32
"]"
,
this
->
params
.
ssrc
);
this
->
listener
->
OnPliRequired
(
this
);
}
RequestFullFrame
();
}
void
RtpStreamRecv
::
OnNackRequired
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
void
RtpStreamRecv
::
OnNack
GeneratorNack
Required
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
{
MS_TRACE
();
...
...
@@ -254,23 +249,14 @@ namespace RTC
seqNumbers
[
0
],
seqNumbers
.
size
());
this
->
listener
->
OnNackRequired
(
this
,
seqNumbers
);
this
->
listener
->
On
RtpStreamRecv
NackRequired
(
this
,
seqNumbers
);
}
void
RtpStreamRecv
::
OnFullFrameRequired
()
void
RtpStreamRecv
::
On
NackGenerator
FullFrameRequired
()
{
MS_TRACE
();
if
(
!
this
->
params
.
usePli
)
{
MS_WARN_TAG
(
rtx
,
"PLI required but not supported by the endpoint"
);
return
;
}
MS_DEBUG_TAG
(
rtx
,
"triggering PLI [ssrc:%"
PRIu32
"]"
,
this
->
params
.
ssrc
);
this
->
listener
->
OnPliRequired
(
this
);
RequestFullFrame
();
}
void
RtpStreamRecv
::
SetRtx
(
uint8_t
payloadType
,
uint32_t
ssrc
)
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
3142d063
...
...
@@ -58,7 +58,11 @@ namespace RTC
// Call the parent method.
if
(
!
RtpStream
::
ReceivePacket
(
packet
))
{
MS_DEBUG_TAG
(
rtp
,
"packet discarded"
);
return
false
;
}
// If bufferSize was given, store the packet into the buffer.
if
(
!
this
->
storage
.
empty
())
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
3142d063
...
...
@@ -623,7 +623,7 @@ namespace RTC
{
if
(
consumer
->
kind
==
RTC
::
Media
::
Kind
::
VIDEO
)
{
MS_DEBUG_TAG
(
rtx
,
"requesting fullframe for new Consumer since Transport already connected"
);
MS_DEBUG_TAG
(
rtx
,
"requesting full
frame for new Consumer since Transport already connected"
);
}
consumer
->
RequestFullFrame
();
...
...
@@ -1268,7 +1268,7 @@ namespace RTC
for
(
auto
*
consumer
:
this
->
consumers
)
{
if
(
consumer
->
kind
==
RTC
::
Media
::
Kind
::
VIDEO
)
MS_DEBUG_TAG
(
rtx
,
"Transport connected, requesting fullframe for Consumers"
);
MS_DEBUG_TAG
(
rtx
,
"Transport connected, requesting full
frame for Consumers"
);
consumer
->
RequestFullFrame
();
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论