Revert "Add a default RTT to CallStats and use different values for buffered/real-time mode."

This reverts commit aae26db1da5803482b094357c546b8454ab1c26d.

BUG=1613
TBR=mflodman@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3890 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2013-04-23 16:48:32 +00:00
parent a942692725
commit 8ca8a71de2
11 changed files with 43 additions and 60 deletions

View File

@ -54,7 +54,8 @@ RTCPReceiver::RTCPReceiver(const int32_t id, Clock* clock,
_receivedInfoMap(), _receivedInfoMap(),
_packetTimeOutMS(0), _packetTimeOutMS(0),
_lastReceivedRrMs(0), _lastReceivedRrMs(0),
_lastIncreasedSequenceNumberMs(0) { _lastIncreasedSequenceNumberMs(0),
_rtt(0) {
memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo)); memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo));
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__); WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
} }
@ -210,6 +211,23 @@ int32_t RTCPReceiver::RTT(const uint32_t remoteSSRC,
return 0; return 0;
} }
uint16_t RTCPReceiver::RTT() const {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
if (!_receivedReportBlockMap.empty()) {
return 0;
}
return _rtt;
}
int RTCPReceiver::SetRTT(uint16_t rtt) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
if (!_receivedReportBlockMap.empty()) {
return -1;
}
_rtt = rtt;
return 0;
}
int32_t int32_t
RTCPReceiver::NTP(uint32_t *ReceivedNTPsecs, RTCPReceiver::NTP(uint32_t *ReceivedNTPsecs,
uint32_t *ReceivedNTPfrac, uint32_t *ReceivedNTPfrac,

View File

@ -237,6 +237,11 @@ protected:
// The time we last received an RTCP RR telling we have ssuccessfully // The time we last received an RTCP RR telling we have ssuccessfully
// delivered RTP packet to the remote side. // delivered RTP packet to the remote side.
int64_t _lastIncreasedSequenceNumberMs; int64_t _lastIncreasedSequenceNumberMs;
// Externally set RTT. This value can only be used if there are no valid
// RTT estimates.
uint16_t _rtt;
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_

View File

@ -95,8 +95,7 @@ RTPReceiver::RTPReceiver(const int32_t id,
max_reordering_threshold_(kDefaultMaxReorderingThreshold), max_reordering_threshold_(kDefaultMaxReorderingThreshold),
rtx_(false), rtx_(false),
ssrc_rtx_(0), ssrc_rtx_(0),
payload_type_rtx_(-1), payload_type_rtx_(-1) {
rtt_ms_(kInitialReceiveSideRtt) {
assert(incoming_audio_messages_callback && assert(incoming_audio_messages_callback &&
incoming_messages_callback && incoming_messages_callback &&
incoming_payload_callback); incoming_payload_callback);

View File

@ -158,10 +158,6 @@ class RTPReceiver : public Bitrate {
const uint16_t bytes, const uint16_t bytes,
const bool old_packet); const bool old_packet);
void set_rtt_ms(uint32_t rtt_ms) { rtt_ms_ = rtt_ms; }
uint32_t rtt_ms() const { return rtt_ms_; }
private: private:
// Returns whether RED is configured with payload_type. // Returns whether RED is configured with payload_type.
bool REDPayloadType(const int8_t payload_type) const; bool REDPayloadType(const int8_t payload_type) const;
@ -241,7 +237,6 @@ class RTPReceiver : public Bitrate {
bool rtx_; bool rtx_;
uint32_t ssrc_rtx_; uint32_t ssrc_rtx_;
int payload_type_rtx_; int payload_type_rtx_;
uint32_t rtt_ms_;
}; };
} // namespace webrtc } // namespace webrtc

View File

@ -23,7 +23,6 @@ enum { NACK_BYTECOUNT_SIZE = 60}; // size of our NACK history
enum { kSendSideNackListSizeSanity = 20000 }; enum { kSendSideNackListSizeSanity = 20000 };
enum { kDefaultMaxReorderingThreshold = 50 }; // In sequence numbers. enum { kDefaultMaxReorderingThreshold = 50 }; // In sequence numbers.
enum { kRtcpMaxNackFields = 253 }; enum { kRtcpMaxNackFields = 253 };
enum { kInitialReceiveSideRtt = 100 };
enum { RTCP_INTERVAL_VIDEO_MS = 1000 }; enum { RTCP_INTERVAL_VIDEO_MS = 1000 };
enum { RTCP_INTERVAL_AUDIO_MS = 5000 }; enum { RTCP_INTERVAL_AUDIO_MS = 5000 };

View File

@ -1224,9 +1224,9 @@ int32_t ModuleRtpRtcpImpl::ResetRTT(const uint32_t remote_ssrc) {
return rtcp_receiver_.ResetRTT(remote_ssrc); return rtcp_receiver_.ResetRTT(remote_ssrc);
} }
void ModuleRtpRtcpImpl::SetRtt(uint32_t rtt) { void ModuleRtpRtcpImpl:: SetRtt(uint32_t rtt) {
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetRtt(rtt: %u)", rtt); WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetRtt(rtt: %u)", rtt);
rtp_receiver_->set_rtt_ms(rtt); rtcp_receiver_.SetRTT(static_cast<uint16_t>(rtt));
} }
// Reset RTP statistics. // Reset RTP statistics.
@ -1545,8 +1545,13 @@ int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
id_, id_,
"SendNACK(size:%u)", size); "SendNACK(size:%u)", size);
// 5 + RTT * 1.5. uint16_t avg_rtt = 0;
int64_t wait_time = 5 + ((rtp_receiver_->rtt_ms() * 3) / 2); rtcp_receiver_.RTT(rtp_receiver_->SSRC(), NULL, &avg_rtt, NULL, NULL);
int64_t wait_time = 5 + ((avg_rtt * 3) >> 1); // 5 + RTT * 1.5.
if (wait_time == 5) {
wait_time = 100; // During startup we don't have an RTT.
}
const int64_t now = clock_->TimeInMilliseconds(); const int64_t now = clock_->TimeInMilliseconds();
const int64_t time_limit = now - wait_time; const int64_t time_limit = now - wait_time;
uint16_t nackLength = size; uint16_t nackLength = size;

View File

@ -23,7 +23,6 @@ namespace webrtc {
const int kRttTimeoutMs = 1500; const int kRttTimeoutMs = 1500;
// Time interval for updating the observers. // Time interval for updating the observers.
const int kUpdateIntervalMs = 1000; const int kUpdateIntervalMs = 1000;
const uint32_t kInitialRttMs = 200;
class RtcpObserver : public RtcpRttObserver { class RtcpObserver : public RtcpRttObserver {
public: public:
@ -43,9 +42,7 @@ class RtcpObserver : public RtcpRttObserver {
CallStats::CallStats() CallStats::CallStats()
: crit_(CriticalSectionWrapper::CreateCriticalSection()), : crit_(CriticalSectionWrapper::CreateCriticalSection()),
rtcp_rtt_observer_(new RtcpObserver(this)), rtcp_rtt_observer_(new RtcpObserver(this)),
last_process_time_(TickTime::MillisecondTimestamp()), last_process_time_(TickTime::MillisecondTimestamp()) {
last_reported_rtt_(kInitialRttMs),
rtt_report_received_(false) {
} }
CallStats::~CallStats() { CallStats::~CallStats() {
@ -76,13 +73,13 @@ int32_t CallStats::Process() {
if (it->rtt > max_rtt) if (it->rtt > max_rtt)
max_rtt = it->rtt; max_rtt = it->rtt;
} }
if (max_rtt > 0) {
last_reported_rtt_ = max_rtt;
}
// If there is a valid rtt, update all observers. // If there is a valid rtt, update all observers.
for (std::list<CallStatsObserver*>::iterator it = observers_.begin(); if (max_rtt > 0) {
it != observers_.end(); ++it) { for (std::list<CallStatsObserver*>::iterator it = observers_.begin();
(*it)->OnRttUpdate(last_reported_rtt_); it != observers_.end(); ++it) {
(*it)->OnRttUpdate(max_rtt);
}
} }
last_process_time_ = time_now; last_process_time_ = time_now;
return 0; return 0;
@ -117,7 +114,6 @@ void CallStats::OnRttUpdate(uint32_t rtt) {
CriticalSectionScoped cs(crit_.get()); CriticalSectionScoped cs(crit_.get());
int64_t time_now = TickTime::MillisecondTimestamp(); int64_t time_now = TickTime::MillisecondTimestamp();
reports_.push_back(RttTime(rtt, time_now)); reports_.push_back(RttTime(rtt, time_now));
rtt_report_received_ = true;
} }
} // namespace webrtc } // namespace webrtc

View File

@ -68,9 +68,6 @@ class CallStats : public Module {
// Observers getting stats reports. // Observers getting stats reports.
std::list<CallStatsObserver*> observers_; std::list<CallStatsObserver*> observers_;
uint32_t last_reported_rtt_;
bool rtt_report_received_;
DISALLOW_COPY_AND_ASSIGN(CallStats); DISALLOW_COPY_AND_ASSIGN(CallStats);
}; };

View File

@ -22,8 +22,6 @@ using ::testing::Return;
namespace webrtc { namespace webrtc {
enum { kDefaultRttMs = 200 };
class MockStatsObserver : public CallStatsObserver { class MockStatsObserver : public CallStatsObserver {
public: public:
MockStatsObserver() {} MockStatsObserver() {}
@ -178,32 +176,4 @@ TEST_F(CallStatsTest, ChangeRtt) {
call_stats_->DeregisterStatsObserver(&stats_observer); call_stats_->DeregisterStatsObserver(&stats_observer);
} }
TEST_F(CallStatsTest, NoRttUpdates) {
MockStatsObserver stats_observer;
call_stats_->RegisterStatsObserver(&stats_observer);
// Advance clock to be ready for an update.
TickTime::AdvanceFakeClock(1000);
EXPECT_CALL(stats_observer, OnRttUpdate(kDefaultRttMs))
.Times(1);
call_stats_->Process();
RtcpRttObserver* rtcp_observer = call_stats_->rtcp_rtt_observer();
const int kNewRtt = 50;
// Report an RTT and verify that it replaces the default.
rtcp_observer->OnRttUpdate(kNewRtt);
TickTime::AdvanceFakeClock(1000);
EXPECT_CALL(stats_observer, OnRttUpdate(kNewRtt))
.Times(1);
call_stats_->Process();
TickTime::AdvanceFakeClock(1500);
// The last reported RTT should still be reported when all reports have
// timed out.
EXPECT_CALL(stats_observer, OnRttUpdate(kNewRtt))
.Times(1);
call_stats_->Process();
call_stats_->DeregisterStatsObserver(&stats_observer);
}
} // namespace webrtc } // namespace webrtc

View File

@ -76,8 +76,6 @@ enum { kViEDefaultRenderDelayMs = 10 };
// ViERTP_RTCP // ViERTP_RTCP
enum { kSendSidePacketHistorySize = 600 }; enum { kSendSidePacketHistorySize = 600 };
enum { kDefaultBufferingRtt = 20 };
enum { kDefaultRealtimeRtt = 200 };
// NACK // NACK
enum { kMaxPacketAgeToNack = 450 }; // In sequence numbers. enum { kMaxPacketAgeToNack = 450 }; // In sequence numbers.

View File

@ -631,7 +631,7 @@ int ViERTP_RTCPImpl::SetSenderBufferingMode(int video_channel,
} }
int ViERTP_RTCPImpl::SetReceiverBufferingMode(int video_channel, int ViERTP_RTCPImpl::SetReceiverBufferingMode(int video_channel,
int target_delay_ms) { int target_delay_ms) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel), ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d, receiver target_delay: %d)", "%s(channel: %d, receiver target_delay: %d)",
@ -645,6 +645,7 @@ int ViERTP_RTCPImpl::SetReceiverBufferingMode(int video_channel,
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1; return -1;
} }
// Update the channel with buffering mode settings. // Update the channel with buffering mode settings.
if (vie_channel->SetReceiverBufferingMode(target_delay_ms) != 0) { if (vie_channel->SetReceiverBufferingMode(target_delay_ms) != 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, WEBRTC_TRACE(kTraceError, kTraceVideo,