Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
f1f5261a
提交
f1f5261a
authored
10月 04, 2017
作者:
Iñaki Baz Castillo
提交者:
GitHub
10月 04, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #148 from versatica/RtpStreamStats
RtpStream and TransportTuple Stats
上级
7ef805ee
6f2b8d24
显示空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
237 行增加
和
64 行删除
+237
-64
Consumer.hpp
worker/include/RTC/Consumer.hpp
+3
-2
Producer.hpp
worker/include/RTC/Producer.hpp
+3
-4
ProducerListener.hpp
worker/include/RTC/ProducerListener.hpp
+1
-1
Router.hpp
worker/include/RTC/Router.hpp
+1
-1
RtpDictionaries.hpp
worker/include/RTC/RtpDictionaries.hpp
+1
-1
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+17
-14
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+3
-0
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+3
-0
TcpConnection.hpp
worker/include/RTC/TcpConnection.hpp
+14
-0
Transport.hpp
worker/include/RTC/Transport.hpp
+1
-1
TransportTuple.hpp
worker/include/RTC/TransportTuple.hpp
+18
-0
UdpSocket.hpp
worker/include/handles/UdpSocket.hpp
+14
-0
Consumer.cpp
worker/src/RTC/Consumer.cpp
+33
-3
Producer.cpp
worker/src/RTC/Producer.cpp
+8
-2
Router.cpp
worker/src/RTC/Router.cpp
+7
-5
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+46
-17
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+19
-5
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+18
-5
TcpConnection.cpp
worker/src/RTC/TcpConnection.cpp
+7
-1
Transport.cpp
worker/src/RTC/Transport.cpp
+2
-2
TransportTuple.cpp
worker/src/RTC/TransportTuple.cpp
+4
-0
UdpSocket.cpp
worker/src/handles/UdpSocket.cpp
+14
-0
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
f1f5261a
...
@@ -43,7 +43,7 @@ namespace RTC
...
@@ -43,7 +43,7 @@ namespace RTC
void
Resume
();
void
Resume
();
void
SourcePause
();
void
SourcePause
();
void
SourceResume
();
void
SourceResume
();
void
AddProfile
(
const
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStream
Info
*
info
);
void
AddProfile
(
const
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStream
*
rtpStream
);
void
RemoveProfile
(
const
RTC
::
RtpEncodingParameters
::
Profile
profile
);
void
RemoveProfile
(
const
RTC
::
RtpEncodingParameters
::
Profile
profile
);
void
SourceRtpParametersUpdated
();
void
SourceRtpParametersUpdated
();
void
SetPreferredProfile
(
const
RTC
::
RtpEncodingParameters
::
Profile
profile
);
void
SetPreferredProfile
(
const
RTC
::
RtpEncodingParameters
::
Profile
profile
);
...
@@ -54,6 +54,7 @@ namespace RTC
...
@@ -54,6 +54,7 @@ namespace RTC
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
,
RTC
::
RtpEncodingParameters
::
Profile
profile
);
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
,
RTC
::
RtpEncodingParameters
::
Profile
profile
);
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
);
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
);
void
ReceiveNack
(
RTC
::
RTCP
::
FeedbackRtpNackPacket
*
nackPacket
);
void
ReceiveNack
(
RTC
::
RTCP
::
FeedbackRtpNackPacket
*
nackPacket
);
void
ReceiveKeyFrameRequest
(
RTCP
::
FeedbackPs
::
MessageType
messageType
);
void
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
void
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
uint32_t
GetTransmissionRate
(
uint64_t
now
);
uint32_t
GetTransmissionRate
(
uint64_t
now
);
void
RequestKeyFrame
();
void
RequestKeyFrame
();
...
@@ -104,7 +105,7 @@ namespace RTC
...
@@ -104,7 +105,7 @@ namespace RTC
// RTP profiles.
// RTP profiles.
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>
profiles
;
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>
profiles
;
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
Info
*>
mapProfileRtpStreamInfo
;
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
*>
mapProfileRtpStream
;
RTC
::
RtpEncodingParameters
::
Profile
preferredProfile
{
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
};
RTC
::
RtpEncodingParameters
::
Profile
preferredProfile
{
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
};
RTC
::
RtpEncodingParameters
::
Profile
targetProfile
{
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
};
RTC
::
RtpEncodingParameters
::
Profile
targetProfile
{
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
};
RTC
::
RtpEncodingParameters
::
Profile
effectiveProfile
{
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
};
RTC
::
RtpEncodingParameters
::
Profile
effectiveProfile
{
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
};
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
f1f5261a
...
@@ -69,8 +69,7 @@ namespace RTC
...
@@ -69,8 +69,7 @@ namespace RTC
void
ReceiveRtcpFeedback
(
RTC
::
RTCP
::
FeedbackPsPacket
*
packet
)
const
;
void
ReceiveRtcpFeedback
(
RTC
::
RTCP
::
FeedbackPsPacket
*
packet
)
const
;
void
ReceiveRtcpFeedback
(
RTC
::
RTCP
::
FeedbackRtpPacket
*
packet
)
const
;
void
ReceiveRtcpFeedback
(
RTC
::
RTCP
::
FeedbackRtpPacket
*
packet
)
const
;
void
RequestKeyFrame
(
bool
force
=
false
);
void
RequestKeyFrame
(
bool
force
=
false
);
const
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStreamInfo
*>&
GetHealthyProfiles
()
const
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
*>&
GetHealthyProfiles
()
const
;
const
;
private
:
private
:
void
FillHeaderExtensionIds
();
void
FillHeaderExtensionIds
();
...
@@ -112,7 +111,7 @@ namespace RTC
...
@@ -112,7 +111,7 @@ namespace RTC
std
::
map
<
uint32_t
,
RTC
::
RtpStreamRecv
*>
rtpStreams
;
std
::
map
<
uint32_t
,
RTC
::
RtpStreamRecv
*>
rtpStreams
;
std
::
map
<
uint32_t
,
RTC
::
RtpStreamRecv
*>
mapRtxStreams
;
std
::
map
<
uint32_t
,
RTC
::
RtpStreamRecv
*>
mapRtxStreams
;
std
::
map
<
RTC
::
RtpStreamRecv
*
,
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>>
mapRtpStreamProfiles
;
std
::
map
<
RTC
::
RtpStreamRecv
*
,
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>>
mapRtpStreamProfiles
;
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
Info
*>
healthyProfiles
;
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
*>
healthyProfiles
;
Timer
*
keyFrameRequestBlockTimer
{
nullptr
};
Timer
*
keyFrameRequestBlockTimer
{
nullptr
};
// Others.
// Others.
std
::
vector
<
RtpEncodingParameters
>
outputEncodings
;
std
::
vector
<
RtpEncodingParameters
>
outputEncodings
;
...
@@ -164,7 +163,7 @@ namespace RTC
...
@@ -164,7 +163,7 @@ namespace RTC
}
}
}
}
inline
const
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
Info
*>&
Producer
::
inline
const
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
*>&
Producer
::
GetHealthyProfiles
()
const
GetHealthyProfiles
()
const
{
{
return
this
->
healthyProfiles
;
return
this
->
healthyProfiles
;
...
...
worker/include/RTC/ProducerListener.hpp
浏览文件 @
f1f5261a
...
@@ -22,7 +22,7 @@ namespace RTC
...
@@ -22,7 +22,7 @@ namespace RTC
virtual
void
OnProducerProfileEnabled
(
virtual
void
OnProducerProfileEnabled
(
RTC
::
Producer
*
producer
,
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
,
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStream
Info
*
info
)
=
0
;
const
RTC
::
RtpStream
*
rtpStream
)
=
0
;
virtual
void
OnProducerProfileDisabled
(
virtual
void
OnProducerProfileDisabled
(
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
)
=
0
;
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
)
=
0
;
};
};
...
...
worker/include/RTC/Router.hpp
浏览文件 @
f1f5261a
...
@@ -74,7 +74,7 @@ namespace RTC
...
@@ -74,7 +74,7 @@ namespace RTC
void
OnProducerProfileEnabled
(
void
OnProducerProfileEnabled
(
RTC
::
Producer
*
producer
,
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
,
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStream
Info
*
info
)
override
;
const
RTC
::
RtpStream
*
rtpStream
)
override
;
void
OnProducerProfileDisabled
(
void
OnProducerProfileDisabled
(
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
)
override
;
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
)
override
;
...
...
worker/include/RTC/RtpDictionaries.hpp
浏览文件 @
f1f5261a
...
@@ -69,7 +69,7 @@ namespace RTC
...
@@ -69,7 +69,7 @@ namespace RTC
RED
RED
};
};
p
rivate
:
p
ublic
:
static
std
::
unordered_map
<
std
::
string
,
Type
>
string2Type
;
static
std
::
unordered_map
<
std
::
string
,
Type
>
string2Type
;
static
std
::
map
<
Type
,
std
::
string
>
type2String
;
static
std
::
map
<
Type
,
std
::
string
>
type2String
;
static
std
::
unordered_map
<
std
::
string
,
Subtype
>
string2Subtype
;
static
std
::
unordered_map
<
std
::
string
,
Subtype
>
string2Subtype
;
...
...
worker/include/RTC/RtpStream.hpp
浏览文件 @
f1f5261a
...
@@ -10,20 +10,7 @@
...
@@ -10,20 +10,7 @@
namespace
RTC
namespace
RTC
{
{
class
RtpStreamInfo
class
RtpStream
:
public
Timer
::
Listener
{
public
:
uint32_t
totalLost
{
0
};
uint8_t
fractionLost
{
0
};
uint32_t
jitter
{
0
};
uint32_t
rtt
{
0
};
size_t
numPlis
{
0
};
size_t
numNacks
{
0
};
// RTP counters.
RTC
::
RtpDataCounter
counter
;
};
class
RtpStream
:
public
Timer
::
Listener
,
public
RtpStreamInfo
{
{
public
:
public
:
class
Listener
class
Listener
...
@@ -55,6 +42,7 @@ namespace RTC
...
@@ -55,6 +42,7 @@ namespace RTC
virtual
~
RtpStream
();
virtual
~
RtpStream
();
virtual
Json
::
Value
ToJson
();
virtual
Json
::
Value
ToJson
();
virtual
Json
::
Value
GetStats
();
virtual
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
);
virtual
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
);
uint32_t
GetRate
(
uint64_t
now
);
uint32_t
GetRate
(
uint64_t
now
);
uint32_t
GetSsrc
();
uint32_t
GetSsrc
();
...
@@ -77,6 +65,18 @@ namespace RTC
...
@@ -77,6 +65,18 @@ namespace RTC
public
:
public
:
void
OnTimer
(
Timer
*
timer
)
override
;
void
OnTimer
(
Timer
*
timer
)
override
;
public
:
// Stats.
size_t
packetsDiscarded
{
0
};
size_t
packetsRepaired
{
0
};
size_t
firCount
{
0
};
size_t
pliCount
{
0
};
size_t
nackCount
{
0
};
size_t
sliCount
{
0
};
RtpDataCounter
transmissionCounter
;
RtpDataCounter
retransmissionCounter
;
protected
:
protected
:
// Given as argument.
// Given as argument.
RtpStream
::
Params
params
;
RtpStream
::
Params
params
;
...
@@ -94,6 +94,9 @@ namespace RTC
...
@@ -94,6 +94,9 @@ namespace RTC
Timer
*
healthCheckTimer
{
nullptr
};
Timer
*
healthCheckTimer
{
nullptr
};
bool
healthy
{
true
};
bool
healthy
{
true
};
bool
notifyHealth
{
true
};
bool
notifyHealth
{
true
};
// Stats.
uint32_t
packetsLost
{
0
};
uint8_t
fractionLost
{
0
};
};
};
/* Inline instance methods. */
/* Inline instance methods. */
...
...
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
f1f5261a
...
@@ -23,6 +23,7 @@ namespace RTC
...
@@ -23,6 +23,7 @@ namespace RTC
RtpStreamRecv
(
Listener
*
listener
,
RTC
::
RtpStream
::
Params
&
params
);
RtpStreamRecv
(
Listener
*
listener
,
RTC
::
RtpStream
::
Params
&
params
);
~
RtpStreamRecv
()
override
;
~
RtpStreamRecv
()
override
;
Json
::
Value
GetStats
()
override
;
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
override
;
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
override
;
bool
ReceiveRtxPacket
(
RTC
::
RtpPacket
*
packet
);
bool
ReceiveRtxPacket
(
RTC
::
RtpPacket
*
packet
);
RTC
::
RTCP
::
ReceiverReport
*
GetRtcpReceiverReport
();
RTC
::
RTCP
::
ReceiverReport
*
GetRtcpReceiverReport
();
...
@@ -58,6 +59,8 @@ namespace RTC
...
@@ -58,6 +59,8 @@ namespace RTC
bool
hasRtx
{
false
};
bool
hasRtx
{
false
};
uint8_t
rtxPayloadType
{
0
};
uint8_t
rtxPayloadType
{
0
};
uint32_t
rtxSsrc
{
0
};
uint32_t
rtxSsrc
{
0
};
// Stats.
uint32_t
jitter
{
0
};
};
};
}
// namespace RTC
}
// namespace RTC
...
...
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
f1f5261a
...
@@ -29,6 +29,7 @@ namespace RTC
...
@@ -29,6 +29,7 @@ namespace RTC
RtpStreamSend
(
RTC
::
RtpStream
::
Listener
*
listener
,
RTC
::
RtpStream
::
Params
&
params
,
size_t
bufferSize
);
RtpStreamSend
(
RTC
::
RtpStream
::
Listener
*
listener
,
RTC
::
RtpStream
::
Params
&
params
,
size_t
bufferSize
);
~
RtpStreamSend
()
override
;
~
RtpStreamSend
()
override
;
Json
::
Value
GetStats
()
override
;
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
override
;
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
override
;
void
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
void
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
void
RequestRtpRetransmission
(
void
RequestRtpRetransmission
(
...
@@ -52,6 +53,8 @@ namespace RTC
...
@@ -52,6 +53,8 @@ namespace RTC
std
::
vector
<
StorageItem
>
storage
;
std
::
vector
<
StorageItem
>
storage
;
using
Buffer
=
std
::
list
<
BufferItem
>
;
using
Buffer
=
std
::
list
<
BufferItem
>
;
Buffer
buffer
;
Buffer
buffer
;
// Stats.
uint32_t
rtt
{
0
};
private
:
private
:
// Retransmittion related.
// Retransmittion related.
...
...
worker/include/RTC/TcpConnection.hpp
浏览文件 @
f1f5261a
...
@@ -23,6 +23,8 @@ namespace RTC
...
@@ -23,6 +23,8 @@ namespace RTC
public
:
public
:
void
Send
(
const
uint8_t
*
data
,
size_t
len
);
void
Send
(
const
uint8_t
*
data
,
size_t
len
);
size_t
GetRecvBytes
()
const
;
size_t
GetSentBytes
()
const
;
/* Pure virtual methods inherited from ::TcpConnection. */
/* Pure virtual methods inherited from ::TcpConnection. */
public
:
public
:
...
@@ -33,7 +35,19 @@ namespace RTC
...
@@ -33,7 +35,19 @@ namespace RTC
Listener
*
listener
{
nullptr
};
Listener
*
listener
{
nullptr
};
// Others.
// Others.
size_t
frameStart
{
0
};
// Where the latest frame starts.
size_t
frameStart
{
0
};
// Where the latest frame starts.
size_t
recvBytes
{
0
};
size_t
sentBytes
{
0
};
};
};
inline
size_t
TcpConnection
::
GetRecvBytes
()
const
{
return
this
->
recvBytes
;
}
inline
size_t
TcpConnection
::
GetSentBytes
()
const
{
return
this
->
sentBytes
;
}
}
// namespace RTC
}
// namespace RTC
#endif
#endif
worker/include/RTC/Transport.hpp
浏览文件 @
f1f5261a
...
@@ -98,7 +98,7 @@ namespace RTC
...
@@ -98,7 +98,7 @@ namespace RTC
void
OnProducerProfileEnabled
(
void
OnProducerProfileEnabled
(
RTC
::
Producer
*
producer
,
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
,
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStream
Info
*
info
)
override
;
const
RTC
::
RtpStream
*
rtpStream
)
override
;
void
OnProducerProfileDisabled
(
void
OnProducerProfileDisabled
(
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
)
override
;
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
)
override
;
...
...
worker/include/RTC/TransportTuple.hpp
浏览文件 @
f1f5261a
...
@@ -30,6 +30,8 @@ namespace RTC
...
@@ -30,6 +30,8 @@ namespace RTC
Protocol
GetProtocol
()
const
;
Protocol
GetProtocol
()
const
;
const
struct
sockaddr
*
GetLocalAddress
()
const
;
const
struct
sockaddr
*
GetLocalAddress
()
const
;
const
struct
sockaddr
*
GetRemoteAddress
()
const
;
const
struct
sockaddr
*
GetRemoteAddress
()
const
;
size_t
GetRecvBytes
()
const
;
size_t
GetSentBytes
()
const
;
private
:
private
:
// Passed by argument.
// Passed by argument.
...
@@ -107,6 +109,22 @@ namespace RTC
...
@@ -107,6 +109,22 @@ namespace RTC
else
else
return
this
->
tcpConnection
->
GetPeerAddress
();
return
this
->
tcpConnection
->
GetPeerAddress
();
}
}
inline
size_t
TransportTuple
::
GetRecvBytes
()
const
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
return
this
->
udpSocket
->
GetRecvBytes
();
else
return
this
->
tcpConnection
->
GetRecvBytes
();
}
inline
size_t
TransportTuple
::
GetSentBytes
()
const
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
return
this
->
udpSocket
->
GetSentBytes
();
else
return
this
->
tcpConnection
->
GetSentBytes
();
}
}
// namespace RTC
}
// namespace RTC
#endif
#endif
worker/include/handles/UdpSocket.hpp
浏览文件 @
f1f5261a
...
@@ -39,6 +39,8 @@ public:
...
@@ -39,6 +39,8 @@ public:
int
GetLocalFamily
()
const
;
int
GetLocalFamily
()
const
;
const
std
::
string
&
GetLocalIP
()
const
;
const
std
::
string
&
GetLocalIP
()
const
;
uint16_t
GetLocalPort
()
const
;
uint16_t
GetLocalPort
()
const
;
size_t
GetRecvBytes
()
const
;
size_t
GetSentBytes
()
const
;
private
:
private
:
bool
SetLocalAddress
();
bool
SetLocalAddress
();
...
@@ -60,6 +62,8 @@ private:
...
@@ -60,6 +62,8 @@ private:
uv_udp_t
*
uvHandle
{
nullptr
};
uv_udp_t
*
uvHandle
{
nullptr
};
// Others.
// Others.
bool
isClosing
{
false
};
bool
isClosing
{
false
};
size_t
recvBytes
{
0
};
size_t
sentBytes
{
0
};
protected
:
protected
:
struct
sockaddr_storage
localAddr
struct
sockaddr_storage
localAddr
...
@@ -101,4 +105,14 @@ inline uint16_t UdpSocket::GetLocalPort() const
...
@@ -101,4 +105,14 @@ inline uint16_t UdpSocket::GetLocalPort() const
return
this
->
localPort
;
return
this
->
localPort
;
}
}
inline
size_t
UdpSocket
::
GetRecvBytes
()
const
{
return
this
->
recvBytes
;
}
inline
size_t
UdpSocket
::
GetSentBytes
()
const
{
return
this
->
sentBytes
;
}
#endif
#endif
worker/src/RTC/Consumer.cpp
浏览文件 @
f1f5261a
...
@@ -227,7 +227,7 @@ namespace RTC
...
@@ -227,7 +227,7 @@ namespace RTC
}
}
void
Consumer
::
AddProfile
(
void
Consumer
::
AddProfile
(
const
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStream
Info
*
info
)
const
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStream
*
rtpStream
)
{
{
MS_ASSERT
(
MS_ASSERT
(
profile
!=
RTC
::
RtpEncodingParameters
::
Profile
::
NONE
&&
profile
!=
RTC
::
RtpEncodingParameters
::
Profile
::
NONE
&&
...
@@ -237,7 +237,7 @@ namespace RTC
...
@@ -237,7 +237,7 @@ namespace RTC
MS_ASSERT
(
this
->
profiles
.
find
(
profile
)
==
this
->
profiles
.
end
(),
"profile already exists"
);
MS_ASSERT
(
this
->
profiles
.
find
(
profile
)
==
this
->
profiles
.
end
(),
"profile already exists"
);
// Insert the new profile.
// Insert the new profile.
this
->
mapProfileRtpStream
Info
[
profile
]
=
info
;
this
->
mapProfileRtpStream
[
profile
]
=
rtpStream
;
this
->
profiles
.
insert
(
profile
);
this
->
profiles
.
insert
(
profile
);
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
...
@@ -257,7 +257,7 @@ namespace RTC
...
@@ -257,7 +257,7 @@ namespace RTC
MS_ASSERT
(
this
->
profiles
.
find
(
profile
)
!=
this
->
profiles
.
end
(),
"profile not found"
);
MS_ASSERT
(
this
->
profiles
.
find
(
profile
)
!=
this
->
profiles
.
end
(),
"profile not found"
);
// Remove the profile.
// Remove the profile.
this
->
mapProfileRtpStream
Info
.
erase
(
profile
);
this
->
mapProfileRtpStream
.
erase
(
profile
);
this
->
profiles
.
erase
(
profile
);
this
->
profiles
.
erase
(
profile
);
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
...
@@ -553,6 +553,8 @@ namespace RTC
...
@@ -553,6 +553,8 @@ namespace RTC
if
(
!
IsEnabled
())
if
(
!
IsEnabled
())
return
;
return
;
this
->
rtpStream
->
nackCount
++
;
for
(
auto
it
=
nackPacket
->
Begin
();
it
!=
nackPacket
->
End
();
++
it
)
for
(
auto
it
=
nackPacket
->
Begin
();
it
!=
nackPacket
->
End
();
++
it
)
{
{
RTC
::
RTCP
::
FeedbackRtpNackItem
*
item
=
*
it
;
RTC
::
RTCP
::
FeedbackRtpNackItem
*
item
=
*
it
;
...
@@ -569,8 +571,36 @@ namespace RTC
...
@@ -569,8 +571,36 @@ namespace RTC
break
;
break
;
RetransmitRtpPacket
(
packet
);
RetransmitRtpPacket
(
packet
);
// Packet repaired after applying RTX.
this
->
rtpStream
->
packetsRepaired
++
;
}
}
}
}
}
void
Consumer
::
ReceiveKeyFrameRequest
(
RTCP
::
FeedbackPs
::
MessageType
messageType
)
{
MS_TRACE
();
if
(
!
IsEnabled
())
return
;
switch
(
messageType
)
{
case
RTCP
:
:
FeedbackPs
::
MessageType
::
PLI
:
this
->
rtpStream
->
pliCount
++
;
break
;
case
RTCP
:
:
FeedbackPs
::
MessageType
::
FIR
:
this
->
rtpStream
->
firCount
++
;
break
;
default
:
MS_ASSERT
(
false
,
"invalid messageType"
);
break
;
}
RequestKeyFrame
();
}
}
void
Consumer
::
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
)
void
Consumer
::
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
)
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
f1f5261a
...
@@ -210,6 +210,9 @@ namespace RTC
...
@@ -210,6 +210,9 @@ namespace RTC
// Process the packet.
// Process the packet.
if
(
!
rtpStream
->
ReceiveRtxPacket
(
packet
))
if
(
!
rtpStream
->
ReceiveRtxPacket
(
packet
))
return
;
return
;
// Packet repaired after applying RTX.
rtpStream
->
packetsRepaired
++
;
}
}
else
else
{
{
...
@@ -645,8 +648,7 @@ namespace RTC
...
@@ -645,8 +648,7 @@ namespace RTC
for
(
auto
&
listener
:
this
->
listeners
)
for
(
auto
&
listener
:
this
->
listeners
)
{
{
listener
->
OnProducerProfileEnabled
(
listener
->
OnProducerProfileEnabled
(
this
,
profile
,
rtpStream
);
this
,
profile
,
dynamic_cast
<
RTC
::
RtpStreamInfo
*>
(
rtpStream
));
}
}
}
}
}
}
...
@@ -723,6 +725,8 @@ namespace RTC
...
@@ -723,6 +725,8 @@ namespace RTC
packet
.
Serialize
(
RTC
::
RTCP
::
Buffer
);
packet
.
Serialize
(
RTC
::
RTCP
::
Buffer
);
this
->
transport
->
SendRtcpPacket
(
&
packet
);
this
->
transport
->
SendRtcpPacket
(
&
packet
);
rtpStream
->
nackCount
++
;
}
}
void
Producer
::
OnRtpStreamRecvPliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
void
Producer
::
OnRtpStreamRecvPliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
...
@@ -738,6 +742,8 @@ namespace RTC
...
@@ -738,6 +742,8 @@ namespace RTC
// Send two, because it's free.
// Send two, because it's free.
this
->
transport
->
SendRtcpPacket
(
&
packet
);
this
->
transport
->
SendRtcpPacket
(
&
packet
);
this
->
transport
->
SendRtcpPacket
(
&
packet
);
this
->
transport
->
SendRtcpPacket
(
&
packet
);
rtpStream
->
pliCount
++
;
}
}
void
Producer
::
OnRtpStreamDied
(
RTC
::
RtpStream
*
rtpStream
)
void
Producer
::
OnRtpStreamDied
(
RTC
::
RtpStream
*
rtpStream
)
...
...
worker/src/RTC/Router.cpp
浏览文件 @
f1f5261a
...
@@ -512,14 +512,14 @@ namespace RTC
...
@@ -512,14 +512,14 @@ namespace RTC
consumer
->
AddListener
(
this
);
consumer
->
AddListener
(
this
);
auto
healthyProfiles
=
producer
->
GetHealthyProfiles
();
auto
healthyProfiles
=
producer
->
GetHealthyProfiles
();
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
Info
*>::
reverse_iterator
it
;
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
*>::
reverse_iterator
it
;
for
(
it
=
healthyProfiles
.
rbegin
();
it
!=
healthyProfiles
.
rend
();
++
it
)
for
(
it
=
healthyProfiles
.
rbegin
();
it
!=
healthyProfiles
.
rend
();
++
it
)
{
{
auto
profile
=
it
->
first
;
auto
profile
=
it
->
first
;
auto
info
=
it
->
second
;
auto
stats
=
it
->
second
;
consumer
->
AddProfile
(
profile
,
info
);
consumer
->
AddProfile
(
profile
,
stats
);
}
}
// Insert into the maps.
// Insert into the maps.
...
@@ -1531,7 +1531,9 @@ namespace RTC
...
@@ -1531,7 +1531,9 @@ namespace RTC
}
}
void
Router
::
OnProducerProfileEnabled
(
void
Router
::
OnProducerProfileEnabled
(
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStreamInfo
*
info
)
RTC
::
Producer
*
producer
,
RTC
::
RtpEncodingParameters
::
Profile
profile
,
const
RTC
::
RtpStream
*
rtpStream
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -1543,7 +1545,7 @@ namespace RTC
...
@@ -1543,7 +1545,7 @@ namespace RTC
for
(
auto
*
consumer
:
consumers
)
for
(
auto
*
consumer
:
consumers
)
{
{
consumer
->
AddProfile
(
profile
,
info
);
consumer
->
AddProfile
(
profile
,
rtpStream
);
}
}
}
}
...
...
worker/src/RTC/RtpStream.cpp
浏览文件 @
f1f5261a
...
@@ -40,29 +40,55 @@ namespace RTC
...
@@ -40,29 +40,55 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
JsonStringBitRate
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringJitter
{
"jitter"
};
static
const
Json
::
StaticString
JsonStringParams
{
"params"
};
static
const
Json
::
StaticString
JsonStringParams
{
"params"
};
static
const
Json
::
StaticString
JsonStringStats
{
"stats"
};
Json
::
Value
json
(
Json
::
objectValue
);
json
[
JsonStringParams
]
=
this
->
params
.
ToJson
();
json
[
JsonStringStats
]
=
GetStats
();
return
json
;
}
Json
::
Value
RtpStream
::
GetStats
()
{
MS_TRACE
();
static
const
Json
::
StaticString
JsonStringTimestamp
{
"timestamp"
};
static
const
Json
::
StaticString
JsonStringSsrc
{
"ssrc"
};
static
const
Json
::
StaticString
JsonStringMediaType
{
"mediaType"
};
static
const
Json
::
StaticString
JsonStringHealthy
{
"healthy"
};
static
const
Json
::
StaticString
JsonStringPacketCount
{
"packetCount"
};
static
const
Json
::
StaticString
JsonStringPacketCount
{
"packetCount"
};
static
const
Json
::
StaticString
JsonStringOctetCount
{
"octetCount"
};
static
const
Json
::
StaticString
JsonStringByteCount
{
"byteCount"
};
static
const
Json
::
StaticString
JsonStringRtt
{
"rtt"
};
static
const
Json
::
StaticString
JsonStringBitRate
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringPacketsLost
{
"packetsLost"
};
static
const
Json
::
StaticString
JsonStringFractionLost
{
"fractionLost"
};
static
const
Json
::
StaticString
JsonStringFractionLost
{
"fractionLost"
};
static
const
Json
::
StaticString
JsonStringTotalLost
{
"totalLost"
};
static
const
Json
::
StaticString
JsonStringPacketsDiscarded
{
"packetsDiscarded"
};
static
const
Json
::
StaticString
JsonStringHealthy
{
"healthy"
};
static
const
Json
::
StaticString
JsonStringPacketsRepaired
{
"packetsRepaired"
};
static
const
Json
::
StaticString
JsonStringFirCount
{
"firCount"
};
static
const
Json
::
StaticString
JsonStringPliCount
{
"pliCount"
};
static
const
Json
::
StaticString
JsonStringNackCount
{
"nackCount"
};
static
const
Json
::
StaticString
JsonStringSliCount
{
"sliCount"
};
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
uint64_t
now
=
DepLibUV
::
GetTime
();
uint64_t
now
=
DepLibUV
::
GetTime
();
json
[
JsonStringBitRate
]
=
Json
::
UInt
{
GetRate
(
now
)
};
json
[
JsonStringTimestamp
]
=
Json
::
UInt64
{
now
};
json
[
JsonStringJitter
]
=
Json
::
UInt
{
this
->
jitter
};
json
[
JsonStringSsrc
]
=
Json
::
UInt
{
this
->
params
.
ssrc
};
json
[
JsonStringParams
]
=
this
->
params
.
ToJson
();
json
[
JsonStringMediaType
]
=
RtpCodecMimeType
::
type2String
[
this
->
params
.
mimeType
.
type
];
json
[
JsonStringPacketCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
counter
.
GetPacketCount
());
json
[
JsonStringOctetCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
counter
.
GetBytes
());
json
[
JsonStringRtt
]
=
Json
::
UInt
{
this
->
rtt
};
json
[
JsonStringFractionLost
]
=
Json
::
UInt
{
this
->
fractionLost
};
json
[
JsonStringTotalLost
]
=
Json
::
UInt
{
this
->
totalLost
};
json
[
JsonStringHealthy
]
=
this
->
healthy
?
"true"
:
"false"
;
json
[
JsonStringHealthy
]
=
this
->
healthy
?
"true"
:
"false"
;
json
[
JsonStringPacketCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
transmissionCounter
.
GetPacketCount
());
json
[
JsonStringByteCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
transmissionCounter
.
GetBytes
());
json
[
JsonStringBitRate
]
=
Json
::
UInt
{
this
->
transmissionCounter
.
GetRate
(
now
)
};
json
[
JsonStringPacketsLost
]
=
Json
::
UInt
{
this
->
packetsLost
};
json
[
JsonStringFractionLost
]
=
Json
::
UInt
{
this
->
fractionLost
};
json
[
JsonStringPacketsDiscarded
]
=
static_cast
<
Json
::
UInt
>
(
this
->
packetsDiscarded
);
json
[
JsonStringPacketsRepaired
]
=
static_cast
<
Json
::
UInt
>
(
this
->
packetsRepaired
);
json
[
JsonStringFirCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
firCount
);
json
[
JsonStringPliCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
pliCount
);
json
[
JsonStringNackCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
nackCount
);
json
[
JsonStringSliCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
sliCount
);
return
json
;
return
json
;
}
}
...
@@ -95,7 +121,7 @@ namespace RTC
...
@@ -95,7 +121,7 @@ namespace RTC
}
}
// Increase counters.
// Increase counters.
this
->
c
ounter
.
Update
(
packet
);
this
->
transmissionC
ounter
.
Update
(
packet
);
// Update highest seen RTP timestamp.
// Update highest seen RTP timestamp.
if
(
packet
->
GetTimestamp
()
>
this
->
maxPacketTs
)
if
(
packet
->
GetTimestamp
()
>
this
->
maxPacketTs
)
...
@@ -109,7 +135,7 @@ namespace RTC
...
@@ -109,7 +135,7 @@ namespace RTC
uint32_t
RtpStream
::
GetRate
(
uint64_t
now
)
uint32_t
RtpStream
::
GetRate
(
uint64_t
now
)
{
{
return
this
->
c
ounter
.
GetRate
(
now
);
return
this
->
transmissionC
ounter
.
GetRate
(
now
);
}
}
void
RtpStream
::
ResetHealthCheckTimer
(
uint16_t
timeout
)
void
RtpStream
::
ResetHealthCheckTimer
(
uint16_t
timeout
)
...
@@ -180,6 +206,9 @@ namespace RTC
...
@@ -180,6 +206,9 @@ namespace RTC
this
->
badSeq
=
(
seq
+
1
)
&
(
RtpSeqMod
-
1
);
this
->
badSeq
=
(
seq
+
1
)
&
(
RtpSeqMod
-
1
);
// Packet discarded due to late or early arriving.
this
->
packetsDiscarded
++
;
return
false
;
return
false
;
}
}
}
}
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
f1f5261a
...
@@ -24,6 +24,20 @@ namespace RTC
...
@@ -24,6 +24,20 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
}
}
Json
::
Value
RtpStreamRecv
::
GetStats
()
{
static
const
std
::
string
Type
=
"inboundrtp"
;
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
static
const
Json
::
StaticString
JsonStringJitter
{
"jitter"
};
Json
::
Value
json
=
RtpStream
::
GetStats
();
json
[
JsonStringType
]
=
Type
;
json
[
JsonStringJitter
]
=
Json
::
UInt
{
this
->
jitter
};
return
json
;
}
bool
RtpStreamRecv
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStreamRecv
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -127,18 +141,18 @@ namespace RTC
...
@@ -127,18 +141,18 @@ namespace RTC
// Calculate Packets Expected and Lost.
// Calculate Packets Expected and Lost.
uint32_t
expected
=
(
this
->
cycles
+
this
->
maxSeq
)
-
this
->
baseSeq
+
1
;
uint32_t
expected
=
(
this
->
cycles
+
this
->
maxSeq
)
-
this
->
baseSeq
+
1
;
this
->
totalLost
=
expected
-
this
->
c
ounter
.
GetPacketCount
();
this
->
packetsLost
=
expected
-
this
->
transmissionC
ounter
.
GetPacketCount
();
report
->
SetTotalLost
(
t
otal
Lost
);
report
->
SetTotalLost
(
t
his
->
packets
Lost
);
// Calculate Fraction Lost.
// Calculate Fraction Lost.
uint32_t
expectedInterval
=
expected
-
this
->
expectedPrior
;
uint32_t
expectedInterval
=
expected
-
this
->
expectedPrior
;
this
->
expectedPrior
=
expected
;
this
->
expectedPrior
=
expected
;
uint32_t
receivedInterval
=
this
->
c
ounter
.
GetPacketCount
()
-
this
->
receivedPrior
;
uint32_t
receivedInterval
=
this
->
transmissionC
ounter
.
GetPacketCount
()
-
this
->
receivedPrior
;
this
->
receivedPrior
=
c
ounter
.
GetPacketCount
();
this
->
receivedPrior
=
transmissionC
ounter
.
GetPacketCount
();
int32_t
lostInterval
=
expectedInterval
-
receivedInterval
;
int32_t
lostInterval
=
expectedInterval
-
receivedInterval
;
...
@@ -217,7 +231,7 @@ namespace RTC
...
@@ -217,7 +231,7 @@ namespace RTC
{
{
auto
now
=
DepLibUV
::
GetTime
();
auto
now
=
DepLibUV
::
GetTime
();
if
(
this
->
c
ounter
.
GetRate
(
now
)
==
0
)
if
(
this
->
transmissionC
ounter
.
GetRate
(
now
)
==
0
)
this
->
listener
->
OnRtpStreamDied
(
this
);
this
->
listener
->
OnRtpStreamDied
(
this
);
}
}
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
f1f5261a
...
@@ -34,6 +34,20 @@ namespace RTC
...
@@ -34,6 +34,20 @@ namespace RTC
ClearRetransmissionBuffer
();
ClearRetransmissionBuffer
();
}
}
Json
::
Value
RtpStreamSend
::
GetStats
()
{
static
const
std
::
string
Type
=
"outboundrtp"
;
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
static
const
Json
::
StaticString
JsonStringRtt
{
"rtt"
};
Json
::
Value
json
=
RtpStream
::
GetStats
();
json
[
JsonStringType
]
=
Type
;
json
[
JsonStringRtt
]
=
Json
::
UInt
{
this
->
rtt
};
return
json
;
}
bool
RtpStreamSend
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStreamSend
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -71,9 +85,8 @@ namespace RTC
...
@@ -71,9 +85,8 @@ namespace RTC
this
->
rtt
=
((
rtt
>>
16
)
*
1000
);
this
->
rtt
=
((
rtt
>>
16
)
*
1000
);
this
->
rtt
+=
(
static_cast
<
float
>
(
rtt
&
0x0000FFFF
)
/
65536
)
*
1000
;
this
->
rtt
+=
(
static_cast
<
float
>
(
rtt
&
0x0000FFFF
)
/
65536
)
*
1000
;
this
->
totalLost
=
report
->
GetTotalLost
();
this
->
packetsLost
=
report
->
GetTotalLost
();
this
->
fractionLost
=
report
->
GetFractionLost
();
this
->
fractionLost
=
report
->
GetFractionLost
();
this
->
jitter
=
report
->
GetJitter
();
}
}
// This method looks for the requested RTP packets and inserts them into the
// This method looks for the requested RTP packets and inserts them into the
...
@@ -261,13 +274,13 @@ namespace RTC
...
@@ -261,13 +274,13 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
if
(
this
->
c
ounter
.
GetPacketCount
()
==
0u
)
if
(
this
->
transmissionC
ounter
.
GetPacketCount
()
==
0u
)
return
nullptr
;
return
nullptr
;
auto
report
=
new
RTC
::
RTCP
::
SenderReport
();
auto
report
=
new
RTC
::
RTCP
::
SenderReport
();
report
->
SetPacketCount
(
this
->
c
ounter
.
GetPacketCount
());
report
->
SetPacketCount
(
this
->
transmissionC
ounter
.
GetPacketCount
());
report
->
SetOctetCount
(
this
->
c
ounter
.
GetBytes
());
report
->
SetOctetCount
(
this
->
transmissionC
ounter
.
GetBytes
());
Utils
::
Time
::
Ntp
ntp
{};
Utils
::
Time
::
Ntp
ntp
{};
Utils
::
Time
::
CurrentTimeNtp
(
ntp
);
Utils
::
Time
::
CurrentTimeNtp
(
ntp
);
...
...
worker/src/RTC/TcpConnection.cpp
浏览文件 @
f1f5261a
...
@@ -63,9 +63,12 @@ namespace RTC
...
@@ -63,9 +63,12 @@ namespace RTC
{
{
const
uint8_t
*
packet
=
this
->
buffer
+
this
->
frameStart
+
2
;
const
uint8_t
*
packet
=
this
->
buffer
+
this
->
frameStart
+
2
;
//
N
otify the listener.
//
Update received bytes and n
otify the listener.
if
(
packetLen
!=
0
)
if
(
packetLen
!=
0
)
{
this
->
recvBytes
+=
packetLen
;
this
->
listener
->
OnPacketRecv
(
this
,
packet
,
packetLen
);
this
->
listener
->
OnPacketRecv
(
this
,
packet
,
packetLen
);
}
// If there is no more space available in the buffer and that is because
// If there is no more space available in the buffer and that is because
// the latest parsed frame filled it, then empty the full buffer.
// the latest parsed frame filled it, then empty the full buffer.
...
@@ -140,6 +143,9 @@ namespace RTC
...
@@ -140,6 +143,9 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// Update sent bytes.
this
->
sentBytes
+=
len
;
// Write according to Framing RFC 4571.
// Write according to Framing RFC 4571.
uint8_t
frameLen
[
2
];
uint8_t
frameLen
[
2
];
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
f1f5261a
...
@@ -252,7 +252,7 @@ namespace RTC
...
@@ -252,7 +252,7 @@ namespace RTC
feedback
->
GetMediaSsrc
(),
feedback
->
GetMediaSsrc
(),
feedback
->
GetMediaSsrc
());
feedback
->
GetMediaSsrc
());
consumer
->
Re
questKeyFrame
(
);
consumer
->
Re
ceiveKeyFrameRequest
(
feedback
->
GetMessageType
()
);
break
;
break
;
}
}
...
@@ -544,7 +544,7 @@ namespace RTC
...
@@ -544,7 +544,7 @@ namespace RTC
void
Transport
::
OnProducerProfileEnabled
(
void
Transport
::
OnProducerProfileEnabled
(
RTC
::
Producer
*
/*producer*/
,
RTC
::
Producer
*
/*producer*/
,
RTC
::
RtpEncodingParameters
::
Profile
/*profile*/
,
RTC
::
RtpEncodingParameters
::
Profile
/*profile*/
,
const
RTC
::
RtpStream
Info
*
/*info
*/
)
const
RTC
::
RtpStream
*
/*rtpStream
*/
)
{
{
// Do nothing.
// Do nothing.
}
}
...
...
worker/src/RTC/TransportTuple.cpp
浏览文件 @
f1f5261a
...
@@ -21,6 +21,8 @@ namespace RTC
...
@@ -21,6 +21,8 @@ namespace RTC
static
const
Json
::
StaticString
JsonStringProtocol
{
"protocol"
};
static
const
Json
::
StaticString
JsonStringProtocol
{
"protocol"
};
static
const
Json
::
StaticString
JsonStringUdp
{
"udp"
};
static
const
Json
::
StaticString
JsonStringUdp
{
"udp"
};
static
const
Json
::
StaticString
JsonStringTcp
{
"tcp"
};
static
const
Json
::
StaticString
JsonStringTcp
{
"tcp"
};
static
const
Json
::
StaticString
JsonStringRecvBytes
{
"recvBytes"
};
static
const
Json
::
StaticString
JsonStringSentBytes
{
"sentBytes"
};
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
int
ipFamily
;
int
ipFamily
;
...
@@ -38,6 +40,8 @@ namespace RTC
...
@@ -38,6 +40,8 @@ namespace RTC
Utils
::
IP
::
GetAddressInfo
(
this
->
GetRemoteAddress
(),
&
ipFamily
,
ip
,
&
port
);
Utils
::
IP
::
GetAddressInfo
(
this
->
GetRemoteAddress
(),
&
ipFamily
,
ip
,
&
port
);
json
[
JsonStringRemoteIp
]
=
ip
;
json
[
JsonStringRemoteIp
]
=
ip
;
json
[
JsonStringRemotePort
]
=
Json
::
UInt
{
port
};
json
[
JsonStringRemotePort
]
=
Json
::
UInt
{
port
};
json
[
JsonStringRecvBytes
]
=
Json
::
UInt64
{
GetRecvBytes
()
};
json
[
JsonStringSentBytes
]
=
Json
::
UInt64
{
GetSentBytes
()
};
return
json
;
return
json
;
}
}
...
...
worker/src/handles/UdpSocket.cpp
浏览文件 @
f1f5261a
...
@@ -204,12 +204,18 @@ void UdpSocket::Send(const uint8_t* data, size_t len, const struct sockaddr* add
...
@@ -204,12 +204,18 @@ void UdpSocket::Send(const uint8_t* data, size_t len, const struct sockaddr* add
// Entire datagram was sent. Done.
// Entire datagram was sent. Done.
if
(
sent
==
static_cast
<
int
>
(
len
))
if
(
sent
==
static_cast
<
int
>
(
len
))
{
{
// Update sent bytes.
this
->
sentBytes
+=
sent
;
return
;
return
;
}
}
if
(
sent
>=
0
)
if
(
sent
>=
0
)
{
{
MS_WARN_DEV
(
"datagram truncated (just %d of %zu bytes were sent)"
,
sent
,
len
);
MS_WARN_DEV
(
"datagram truncated (just %d of %zu bytes were sent)"
,
sent
,
len
);
// Update sent bytes.
this
->
sentBytes
+=
sent
;
return
;
return
;
}
}
// Error,
// Error,
...
@@ -243,6 +249,11 @@ void UdpSocket::Send(const uint8_t* data, size_t len, const struct sockaddr* add
...
@@ -243,6 +249,11 @@ void UdpSocket::Send(const uint8_t* data, size_t len, const struct sockaddr* add
// Delete the UvSendData struct (which includes the uv_req_t and the store char[]).
// Delete the UvSendData struct (which includes the uv_req_t and the store char[]).
std
::
free
(
sendData
);
std
::
free
(
sendData
);
}
}
else
{
// Update sent bytes.
this
->
sentBytes
+=
len
;
}
}
}
void
UdpSocket
::
Send
(
const
uint8_t
*
data
,
size_t
len
,
const
std
::
string
&
ip
,
uint16_t
port
)
void
UdpSocket
::
Send
(
const
uint8_t
*
data
,
size_t
len
,
const
std
::
string
&
ip
,
uint16_t
port
)
...
@@ -346,6 +357,9 @@ inline void UdpSocket::OnUvRecv(
...
@@ -346,6 +357,9 @@ inline void UdpSocket::OnUvRecv(
// Data received.
// Data received.
if
(
nread
>
0
)
if
(
nread
>
0
)
{
{
// Update received bytes.
this
->
recvBytes
+=
nread
;
// Notify the subclass.
// Notify the subclass.
UserOnUdpDatagramRecv
(
reinterpret_cast
<
uint8_t
*>
(
buf
->
base
),
nread
,
addr
);
UserOnUdpDatagramRecv
(
reinterpret_cast
<
uint8_t
*>
(
buf
->
base
),
nread
,
addr
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论