Only report fraction of lost packets if report_block_stats has been updated.
R=holmer@google.com, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/33939004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@8108 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
9ffd8fe96b
commit
e7358eabbc
@ -100,6 +100,9 @@ void ReportBlockStats::StoreAndAddPacketIncrement(
|
||||
}
|
||||
|
||||
int ReportBlockStats::FractionLostInPercent() const {
|
||||
if (num_sequence_numbers_ == 0) {
|
||||
return -1;
|
||||
}
|
||||
return FractionLost(
|
||||
num_lost_sequence_numbers_, num_sequence_numbers_) * 100 / 255;
|
||||
}
|
||||
|
||||
@ -36,7 +36,8 @@ class ReportBlockStats {
|
||||
uint32_t remote_ssrc,
|
||||
uint32_t source_ssrc);
|
||||
|
||||
// Returns the total fraction of lost packets.
|
||||
// Returns the total fraction of lost packets (or -1 if less than two report
|
||||
// blocks have been stored).
|
||||
int FractionLostInPercent() const;
|
||||
|
||||
private:
|
||||
|
||||
@ -129,11 +129,11 @@ TEST_F(ReportBlockStatsTest, AggregateAndStore_TwoSsrcs) {
|
||||
TEST_F(ReportBlockStatsTest, StoreAndGetFractionLost) {
|
||||
const uint32_t kRemoteSsrc = 1;
|
||||
ReportBlockStats stats;
|
||||
EXPECT_EQ(0, stats.FractionLostInPercent());
|
||||
EXPECT_EQ(-1, stats.FractionLostInPercent());
|
||||
|
||||
// First block => 0%
|
||||
// First block.
|
||||
stats.Store(RtcpReportBlockToRtcpStatistics(block1_1_), kRemoteSsrc, kSsrc1);
|
||||
EXPECT_EQ(0, stats.FractionLostInPercent());
|
||||
EXPECT_EQ(-1, stats.FractionLostInPercent());
|
||||
// fl: 100 * (15-10) / (24100-24000) = 5%
|
||||
stats.Store(RtcpReportBlockToRtcpStatistics(block1_2_), kRemoteSsrc, kSsrc1);
|
||||
EXPECT_EQ(5, stats.FractionLostInPercent());
|
||||
|
||||
@ -212,8 +212,11 @@ void ViEChannel::UpdateHistograms() {
|
||||
"WebRTC.Video.UniqueNackRequestsReceivedInPercent",
|
||||
rtcp_received.UniqueNackRequestsInPercent());
|
||||
}
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent",
|
||||
report_block_stats_sender_->FractionLostInPercent());
|
||||
int fraction_lost = report_block_stats_sender_->FractionLostInPercent();
|
||||
if (fraction_lost != -1) {
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent",
|
||||
fraction_lost);
|
||||
}
|
||||
}
|
||||
} else if (vie_receiver_.GetRemoteSsrc() > 0) {
|
||||
// Get receive stats if we are receiving packets, i.e. there is a remote
|
||||
@ -230,8 +233,11 @@ void ViEChannel::UpdateHistograms() {
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent",
|
||||
rtcp_sent.UniqueNackRequestsInPercent());
|
||||
}
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent",
|
||||
report_block_stats_receiver_->FractionLostInPercent());
|
||||
int fraction_lost = report_block_stats_receiver_->FractionLostInPercent();
|
||||
if (fraction_lost != -1) {
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent",
|
||||
fraction_lost);
|
||||
}
|
||||
}
|
||||
|
||||
StreamDataCounters rtp;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user