Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
775a5e1e
提交
775a5e1e
authored
10月 02, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpStream: GetStats()
上级
e9382bf9
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
159 行增加
和
61 行删除
+159
-61
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
+20
-14
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+1
-0
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+1
-0
Transport.hpp
worker/include/RTC/Transport.hpp
+1
-1
Consumer.cpp
worker/src/RTC/Consumer.cpp
+31
-3
Producer.cpp
worker/src/RTC/Producer.cpp
+7
-2
Router.cpp
worker/src/RTC/Router.cpp
+7
-5
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+47
-16
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+17
-5
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+16
-4
Transport.cpp
worker/src/RTC/Transport.cpp
+2
-2
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
775a5e1e
...
@@ -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
浏览文件 @
775a5e1e
...
@@ -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
浏览文件 @
775a5e1e
...
@@ -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
浏览文件 @
775a5e1e
...
@@ -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
浏览文件 @
775a5e1e
...
@@ -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
浏览文件 @
775a5e1e
...
@@ -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,24 @@ namespace RTC
...
@@ -77,6 +65,24 @@ namespace RTC
public
:
public
:
void
OnTimer
(
Timer
*
timer
)
override
;
void
OnTimer
(
Timer
*
timer
)
override
;
public
:
// Stats.
size_t
packetCount
{
0
};
size_t
byteCount
{
0
};
uint32_t
packetsLost
{
0
};
uint8_t
fractionLost
{
0
};
size_t
packetsDiscarded
{
0
};
size_t
packetsRepaired
{
0
};
uint32_t
jitter
{
0
};
uint32_t
rtt
{
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
;
...
...
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
775a5e1e
...
@@ -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
();
...
...
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
775a5e1e
...
@@ -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
(
...
...
worker/include/RTC/Transport.hpp
浏览文件 @
775a5e1e
...
@@ -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/src/RTC/Consumer.cpp
浏览文件 @
775a5e1e
...
@@ -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,34 @@ namespace RTC
...
@@ -569,8 +571,34 @@ namespace RTC
break
;
break
;
RetransmitRtpPacket
(
packet
);
RetransmitRtpPacket
(
packet
);
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
浏览文件 @
775a5e1e
...
@@ -210,6 +210,8 @@ namespace RTC
...
@@ -210,6 +210,8 @@ namespace RTC
// Process the packet.
// Process the packet.
if
(
!
rtpStream
->
ReceiveRtxPacket
(
packet
))
if
(
!
rtpStream
->
ReceiveRtxPacket
(
packet
))
return
;
return
;
rtpStream
->
packetsRepaired
++
;
}
}
else
else
{
{
...
@@ -645,8 +647,7 @@ namespace RTC
...
@@ -645,8 +647,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 +724,8 @@ namespace RTC
...
@@ -723,6 +724,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 +741,8 @@ namespace RTC
...
@@ -738,6 +741,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
浏览文件 @
775a5e1e
...
@@ -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
浏览文件 @
775a5e1e
...
@@ -40,29 +40,59 @@ namespace RTC
...
@@ -40,29 +40,59 @@ 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
JsonStringJitter
{
"jitter"
};
static
const
Json
::
StaticString
JsonStringHealthy
{
"healthy"
};
static
const
Json
::
StaticString
JsonStringRtt
{
"rtt"
};
static
const
Json
::
StaticString
JsonStringPacketsDiscarded
{
"packetsDiscarded"
};
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
[
JsonStringSsrc
]
=
Json
::
UInt
{
this
->
params
.
ssrc
};
json
[
JsonStringMediaType
]
=
RtpCodecMimeType
::
type2String
[
this
->
params
.
mimeType
.
type
];
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
[
JsonStringJitter
]
=
Json
::
UInt
{
this
->
jitter
};
json
[
JsonStringJitter
]
=
Json
::
UInt
{
this
->
jitter
};
json
[
JsonStringParams
]
=
this
->
params
.
ToJson
();
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
[
JsonStringRtt
]
=
Json
::
UInt
{
this
->
rtt
};
json
[
JsonStringFractionLost
]
=
Json
::
UInt
{
this
->
fractionLost
};
json
[
JsonStringPacketsDiscarded
]
=
static_cast
<
Json
::
UInt
>
(
this
->
packetsDiscarded
);
json
[
JsonStringTotalLost
]
=
Json
::
UInt
{
this
->
totalLost
};
json
[
JsonStringPacketsRepaired
]
=
static_cast
<
Json
::
UInt
>
(
this
->
packetsRepaired
);
json
[
JsonStringHealthy
]
=
this
->
healthy
?
"true"
:
"false"
;
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 +125,7 @@ namespace RTC
...
@@ -95,7 +125,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 +139,7 @@ namespace RTC
...
@@ -109,7 +139,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
)
...
@@ -179,6 +209,7 @@ namespace RTC
...
@@ -179,6 +209,7 @@ namespace RTC
packet
->
GetSequenceNumber
());
packet
->
GetSequenceNumber
());
this
->
badSeq
=
(
seq
+
1
)
&
(
RtpSeqMod
-
1
);
this
->
badSeq
=
(
seq
+
1
)
&
(
RtpSeqMod
-
1
);
this
->
packetsDiscarded
++
;
return
false
;
return
false
;
}
}
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
775a5e1e
...
@@ -24,6 +24,18 @@ namespace RTC
...
@@ -24,6 +24,18 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
}
}
Json
::
Value
RtpStreamRecv
::
GetStats
()
{
static
const
std
::
string
Type
=
"inboundrtp"
;
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
Json
::
Value
json
=
RtpStream
::
GetStats
();
json
[
JsonStringType
]
=
Type
;
return
json
;
}
bool
RtpStreamRecv
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStreamRecv
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -127,18 +139,18 @@ namespace RTC
...
@@ -127,18 +139,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 +229,7 @@ namespace RTC
...
@@ -217,7 +229,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
浏览文件 @
775a5e1e
...
@@ -34,6 +34,18 @@ namespace RTC
...
@@ -34,6 +34,18 @@ namespace RTC
ClearRetransmissionBuffer
();
ClearRetransmissionBuffer
();
}
}
Json
::
Value
RtpStreamSend
::
GetStats
()
{
static
const
std
::
string
Type
=
"outboundrtp"
;
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
Json
::
Value
json
=
RtpStream
::
GetStats
();
json
[
JsonStringType
]
=
Type
;
return
json
;
}
bool
RtpStreamSend
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStreamSend
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -71,7 +83,7 @@ namespace RTC
...
@@ -71,7 +83,7 @@ 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
->
jitter
=
report
->
GetJitter
();
}
}
...
@@ -261,13 +273,13 @@ namespace RTC
...
@@ -261,13 +273,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/Transport.cpp
浏览文件 @
775a5e1e
...
@@ -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.
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论