Fraction lost statistics not being reported

A bug is causing fraction lost to always be set to zero when calling
ViERTP_RTCP::Get(Send|Receive)ChannelRtcpStatistics. Fix this and update
tests to catch it.

BUG=
R=holmer@google.com, stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/5219004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5235 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sprang@webrtc.org 2013-12-06 11:56:55 +00:00
parent 32f485b16a
commit 7f73280ded
2 changed files with 41 additions and 17 deletions

View File

@ -286,11 +286,30 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel));
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
AutoTestSleep(kAutoTestSleepTimeMs);
webrtc::RtcpStatistics sent;
int sentRttMs = 0;
// Fraction lost is a transient value that can get reset after a new rtcp
// report block. Make regular polls to make sure it is propagated.
// TODO(sprang): Replace with callbacks, when those are fully implemented.
int time_to_sleep = kAutoTestSleepTimeMs;
bool got_send_channel_frac_lost = false;
bool got_receive_channel_frac_lost = false;
while (time_to_sleep > 0) {
AutoTestSleep(500);
time_to_sleep -= 500;
EXPECT_EQ(0,
ViE.rtp_rtcp->GetSendChannelRtcpStatistics(
tbChannel.videoChannel, sent, sentRttMs));
got_send_channel_frac_lost |= sent.fraction_lost > 0;
EXPECT_EQ(0,
ViE.rtp_rtcp->GetReceiveChannelRtcpStatistics(
tbChannel.videoChannel, received, recRttMs));
got_receive_channel_frac_lost |= received.fraction_lost > 0;
}
EXPECT_TRUE(got_send_channel_frac_lost);
EXPECT_TRUE(got_receive_channel_frac_lost);
EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage(
tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate,
sentFecBitrate, sentNackBitrate));

View File

@ -842,9 +842,10 @@ int ViERTP_RTCPImpl::SetTransmissionSmoothingStatus(int video_channel,
return 0;
}
int ViERTP_RTCPImpl::GetReceiveChannelRtcpStatistics(const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const {
int ViERTP_RTCPImpl::GetReceiveChannelRtcpStatistics(
const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
@ -859,21 +860,23 @@ int ViERTP_RTCPImpl::GetReceiveChannelRtcpStatistics(const int video_channel,
}
// TODO(sprang): Clean this up when stats struct is propagated all the way.
uint16_t frac_loss;
uint16_t frac_lost;
if (vie_channel->GetReceivedRtcpStatistics(
&frac_loss, &basic_stats.cumulative_lost,
&basic_stats.extended_max_sequence_number, &basic_stats.jitter,
&rtt_ms) != 0) {
basic_stats.fraction_lost = frac_loss;
&frac_lost,
&basic_stats.cumulative_lost,
&basic_stats.extended_max_sequence_number,
&basic_stats.jitter,
&rtt_ms) != 0) {
shared_data_->SetLastError(kViERtpRtcpUnknownError);
return -1;
}
basic_stats.fraction_lost = frac_lost;
return 0;
}
int ViERTP_RTCPImpl::GetSendChannelRtcpStatistics(const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const {
RtcpStatistics& basic_stats,
int& rtt_ms) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
@ -888,15 +891,17 @@ int ViERTP_RTCPImpl::GetSendChannelRtcpStatistics(const int video_channel,
}
// TODO(sprang): Clean this up when stats struct is propagated all the way.
uint16_t frac_loss;
uint16_t frac_lost;
if (vie_channel->GetSendRtcpStatistics(
&frac_loss, &basic_stats.cumulative_lost,
&basic_stats.extended_max_sequence_number, &basic_stats.jitter,
&rtt_ms) != 0) {
basic_stats.fraction_lost = frac_loss;
&frac_lost,
&basic_stats.cumulative_lost,
&basic_stats.extended_max_sequence_number,
&basic_stats.jitter,
&rtt_ms) != 0) {
shared_data_->SetLastError(kViERtpRtcpUnknownError);
return -1;
}
basic_stats.fraction_lost = frac_lost;
return 0;
}