Remove ResetStatistics from RTP feedback.

BUG=
R=asapersson@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1213603002

Cr-Commit-Position: refs/heads/master@{#9548}
This commit is contained in:
pbos 2015-07-07 08:32:48 -07:00 committed by Commit bot
parent 19492f1c4c
commit d436298332
22 changed files with 56 additions and 186 deletions

View File

@ -35,9 +35,6 @@ class StreamStatistician {
virtual uint32_t BitrateReceived() const = 0;
// Resets all statistics.
virtual void ResetStatistics() = 0;
// Returns true if the packet with RTP header |header| is likely to be a
// retransmitted packet, false otherwise.
virtual bool IsRetransmitOfOldPacket(const RTPHeader& header,

View File

@ -414,13 +414,6 @@ class RtpRtcp : public Module {
*/
virtual int32_t SendRTCPSliceLossIndication(uint8_t pictureID) = 0;
/*
* Reset RTP data counters for the sending side
*
* return -1 on failure else 0
*/
virtual int32_t ResetSendDataCountersRTP() = 0;
/*
* Statistics of the amount of data sent
*

View File

@ -252,8 +252,6 @@ public:
virtual void OnIncomingCSRCChanged( const int32_t id,
const uint32_t CSRC,
const bool added) = 0;
virtual void ResetStatistics(uint32_t ssrc) = 0;
};
class RtpAudioFeedback {
@ -323,8 +321,6 @@ class NullRtpFeedback : public RtpFeedback {
void OnIncomingCSRCChanged(const int32_t id,
const uint32_t CSRC,
const bool added) override {}
void ResetStatistics(uint32_t ssrc) override {}
};
// Null object version of RtpData.

View File

@ -161,8 +161,6 @@ class MockRtpRtcp : public RtpRtcp {
int32_t(const uint64_t pictureID));
MOCK_METHOD1(SendRTCPSliceLossIndication,
int32_t(const uint8_t pictureID));
MOCK_METHOD0(ResetSendDataCountersRTP,
int32_t());
MOCK_CONST_METHOD2(DataCountersRTP,
int32_t(size_t *bytesSent, uint32_t *packetsSent));
MOCK_CONST_METHOD2(GetSendStreamDataCounters,

View File

@ -51,22 +51,6 @@ StreamStatisticianImpl::StreamStatisticianImpl(
rtcp_callback_(rtcp_callback),
rtp_callback_(rtp_callback) {}
void StreamStatisticianImpl::ResetStatistics() {
CriticalSectionScoped cs(stream_lock_.get());
last_report_inorder_packets_ = 0;
last_report_old_packets_ = 0;
last_report_seq_max_ = 0;
last_reported_statistics_ = RtcpStatistics();
jitter_q4_ = 0;
cumulative_loss_ = 0;
jitter_q4_transmission_time_offset_ = 0;
received_seq_wraps_ = 0;
received_seq_max_ = 0;
received_seq_first_ = 0;
stored_sum_receive_counters_.Add(receive_counters_);
receive_counters_ = StreamDataCounters();
}
void StreamStatisticianImpl::IncomingPacket(const RTPHeader& header,
size_t packet_length,
bool retransmitted) {
@ -320,7 +304,6 @@ void StreamStatisticianImpl::GetReceiveStreamDataCounters(
StreamDataCounters* data_counters) const {
CriticalSectionScoped cs(stream_lock_.get());
*data_counters = receive_counters_;
data_counters->Add(stored_sum_receive_counters_);
}
uint32_t StreamStatisticianImpl::BitrateReceived() const {

View File

@ -36,7 +36,6 @@ class StreamStatisticianImpl : public StreamStatistician {
void GetReceiveStreamDataCounters(
StreamDataCounters* data_counters) const override;
uint32_t BitrateReceived() const override;
void ResetStatistics() override;
bool IsRetransmitOfOldPacket(const RTPHeader& header,
int64_t min_rtt) const override;
bool IsPacketInOrder(uint16_t sequence_number) const override;
@ -85,9 +84,6 @@ class StreamStatisticianImpl : public StreamStatistician {
size_t received_packet_overhead_;
StreamDataCounters receive_counters_;
// Stored counter values. Includes sum of reset counter values for the stream.
StreamDataCounters stored_sum_receive_counters_;
// Counter values when we sent the last report.
uint32_t last_report_inorder_packets_;
uint32_t last_report_old_packets_;

View File

@ -143,12 +143,6 @@ TEST_F(ReceiveStatisticsTest, GetReceiveStreamDataCounters) {
EXPECT_GT(counters.first_packet_time_ms, -1);
EXPECT_EQ(1u, counters.transmitted.packets);
statistician->ResetStatistics();
// GetReceiveStreamDataCounters includes reset counter values.
statistician->GetReceiveStreamDataCounters(&counters);
EXPECT_GT(counters.first_packet_time_ms, -1);
EXPECT_EQ(1u, counters.transmitted.packets);
receive_statistics_->IncomingPacket(header1_, kPacketSize1, false);
statistician->GetReceiveStreamDataCounters(&counters);
EXPECT_GT(counters.first_packet_time_ms, -1);

View File

@ -228,10 +228,8 @@ RTPAliveType RTPReceiverAudio::ProcessDeadOrAlive(
void RTPReceiverAudio::CheckPayloadChanged(int8_t payload_type,
PayloadUnion* specific_payload,
bool* should_reset_statistics,
bool* should_discard_changes) {
*should_discard_changes = false;
*should_reset_statistics = false;
if (TelephoneEventPayloadType(payload_type)) {
// Don't do callbacks for DTMF packets.
@ -244,8 +242,6 @@ void RTPReceiverAudio::CheckPayloadChanged(int8_t payload_type,
&specific_payload->Audio.frequency,
&cng_payload_type_has_changed);
*should_reset_statistics = cng_payload_type_has_changed;
if (is_cng_payload_type) {
// Don't do callbacks for DTMF packets.
*should_discard_changes = true;

View File

@ -93,7 +93,6 @@ class RTPReceiverAudio : public RTPReceiverStrategy,
// statistics. In addition we sometimes need to tweak the frequency.
void CheckPayloadChanged(int8_t payload_type,
PayloadUnion* specific_payload,
bool* should_reset_statistics,
bool* should_discard_changes) override;
int Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override;

View File

@ -171,13 +171,9 @@ bool RtpReceiverImpl::IncomingRtpPacket(
int8_t first_payload_byte = payload_length > 0 ? payload[0] : 0;
bool is_red = false;
bool should_reset_statistics = false;
if (CheckPayloadChanged(rtp_header,
first_payload_byte,
is_red,
&payload_specific,
&should_reset_statistics) == -1) {
if (CheckPayloadChanged(rtp_header, first_payload_byte, is_red,
&payload_specific) == -1) {
if (payload_length == 0) {
// OK, keep-alive packet.
return true;
@ -186,10 +182,6 @@ bool RtpReceiverImpl::IncomingRtpPacket(
return false;
}
if (should_reset_statistics) {
cb_rtp_feedback_->ResetStatistics(ssrc_);
}
WebRtcRTPHeader webrtc_rtp_header;
memset(&webrtc_rtp_header, 0, sizeof(webrtc_rtp_header));
webrtc_rtp_header.header = rtp_header;
@ -276,8 +268,6 @@ void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
// We need the payload_type_ to make the call if the remote SSRC is 0.
new_ssrc = true;
cb_rtp_feedback_->ResetStatistics(ssrc_);
last_received_timestamp_ = 0;
last_received_sequence_number_ = 0;
last_received_frame_time_ms_ = -1;
@ -330,12 +320,10 @@ void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
// this code path moves we can get rid of some of the rtp_receiver ->
// media_specific interface (such as CheckPayloadChange, possibly get/set
// last known payload).
int32_t RtpReceiverImpl::CheckPayloadChanged(
const RTPHeader& rtp_header,
const int8_t first_payload_byte,
bool& is_red,
PayloadUnion* specific_payload,
bool* should_reset_statistics) {
int32_t RtpReceiverImpl::CheckPayloadChanged(const RTPHeader& rtp_header,
const int8_t first_payload_byte,
bool& is_red,
PayloadUnion* specific_payload) {
bool re_initialize_decoder = false;
char payload_name[RTP_PAYLOAD_NAME_SIZE];
@ -367,11 +355,10 @@ int32_t RtpReceiverImpl::CheckPayloadChanged(
return 0;
}
}
*should_reset_statistics = false;
bool should_discard_changes = false;
rtp_media_receiver_->CheckPayloadChanged(
payload_type, specific_payload, should_reset_statistics,
payload_type, specific_payload,
&should_discard_changes);
if (should_discard_changes) {
@ -403,9 +390,6 @@ int32_t RtpReceiverImpl::CheckPayloadChanged(
re_initialize_decoder = false;
}
}
if (re_initialize_decoder) {
*should_reset_statistics = true;
}
} else {
rtp_media_receiver_->GetLastMediaSpecificPayload(specific_payload);
is_red = false;

View File

@ -73,8 +73,7 @@ class RtpReceiverImpl : public RtpReceiver {
int32_t CheckPayloadChanged(const RTPHeader& rtp_header,
const int8_t first_payload_byte,
bool& is_red,
PayloadUnion* payload,
bool* should_reset_statistics);
PayloadUnion* payload);
Clock* clock_;
RTPPayloadRegistry* rtp_payload_registry_;

View File

@ -36,11 +36,9 @@ void RTPReceiverStrategy::SetLastMediaSpecificPayload(
void RTPReceiverStrategy::CheckPayloadChanged(int8_t payload_type,
PayloadUnion* specific_payload,
bool* should_reset_statistics,
bool* should_discard_changes) {
// Default: Keep changes and don't reset statistics.
// Default: Keep changes.
*should_discard_changes = false;
*should_reset_statistics = false;
}
int RTPReceiverStrategy::Energy(uint8_t array_of_energy[kRtpCsrcSize]) const {

View File

@ -79,7 +79,6 @@ class RTPReceiverStrategy {
// reset statistics and/or discard this packet.
virtual void CheckPayloadChanged(int8_t payload_type,
PayloadUnion* specific_payload,
bool* should_reset_statistics,
bool* should_discard_changes);
virtual int Energy(uint8_t array_of_energy[kRtpCsrcSize]) const;

View File

@ -540,12 +540,6 @@ int32_t ModuleRtpRtcpImpl::RTT(const uint32_t remote_ssrc,
return ret;
}
// Reset RTP data counters for the sending side.
int32_t ModuleRtpRtcpImpl::ResetSendDataCountersRTP() {
rtp_sender_.ResetDataCounters();
return 0; // TODO(pwestin): change to void.
}
// Force a send of an RTCP packet.
// Normal SR and RR are triggered via the process function.
int32_t ModuleRtpRtcpImpl::SendRTCP(RTCPPacketType packet_type) {

View File

@ -162,8 +162,6 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
int32_t SendCompoundRTCP(
const std::set<RTCPPacketType>& rtcpPacketTypes) override;
int32_t ResetSendDataCountersRTP() override;
// Statistics of the amount of data sent and received.
int32_t DataCountersRTP(size_t* bytes_sent,
uint32_t* packets_sent) const override;

View File

@ -1101,26 +1101,6 @@ uint16_t RTPSender::AllocateSequenceNumber(uint16_t packets_to_send) {
return first_allocated_sequence_number;
}
void RTPSender::ResetDataCounters() {
uint32_t ssrc;
uint32_t ssrc_rtx;
bool report_rtx;
{
CriticalSectionScoped ssrc_lock(send_critsect_.get());
ssrc = ssrc_;
ssrc_rtx = ssrc_rtx_;
report_rtx = rtx_ != kRtxOff;
}
CriticalSectionScoped lock(statistics_crit_.get());
rtp_stats_ = StreamDataCounters();
rtx_rtp_stats_ = StreamDataCounters();
if (rtp_stats_callback_) {
rtp_stats_callback_->DataCountersUpdated(rtp_stats_, ssrc);
if (report_rtx)
rtp_stats_callback_->DataCountersUpdated(rtx_rtp_stats_, ssrc_rtx);
}
}
void RTPSender::GetDataCounters(StreamDataCounters* rtp_stats,
StreamDataCounters* rtx_stats) const {
CriticalSectionScoped lock(statistics_crit_.get());

View File

@ -131,8 +131,6 @@ class RTPSender : public RTPSenderInterface {
void GetDataCounters(StreamDataCounters* rtp_stats,
StreamDataCounters* rtx_stats) const;
void ResetDataCounters();
uint32_t StartTimestamp() const;
void SetStartTimestamp(uint32_t timestamp, bool force);

View File

@ -245,7 +245,6 @@ class FakeReceiveStatistics : public NullReceiveStatistics {
void GetReceiveStreamDataCounters(
StreamDataCounters* data_counters) const override {}
uint32_t BitrateReceived() const override { return 0; }
void ResetStatistics() override {}
bool IsRetransmitOfOldPacket(const RTPHeader& header,
int64_t min_rtt) const override {
return false;

View File

@ -229,20 +229,61 @@ void ViEChannel::UpdateHistograms() {
int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsReceivedPerMinute",
rtcp_counter.nack_packets * 60 / elapsed_sec);
rtcp_counter.nack_packets * 60 / elapsed_sec);
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute",
rtcp_counter.fir_packets * 60 / elapsed_sec);
rtcp_counter.fir_packets * 60 / elapsed_sec);
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute",
rtcp_counter.pli_packets * 60 / elapsed_sec);
rtcp_counter.pli_packets * 60 / elapsed_sec);
if (rtcp_counter.nack_requests > 0) {
RTC_HISTOGRAM_PERCENTAGE(
"WebRTC.Video.UniqueNackRequestsReceivedInPercent",
rtcp_counter.UniqueNackRequestsInPercent());
rtcp_counter.UniqueNackRequestsInPercent());
}
int fraction_lost = report_block_stats_sender_->FractionLostInPercent();
if (fraction_lost != -1) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent",
fraction_lost);
fraction_lost);
}
}
StreamDataCounters rtp;
StreamDataCounters rtx;
GetSendStreamDataCounters(&rtp, &rtx);
StreamDataCounters rtp_rtx = rtp;
rtp_rtx.Add(rtx);
elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(
Clock::GetRealTimeClock()->TimeInMilliseconds()) /
1000;
if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
RTC_HISTOGRAM_COUNTS_100000(
"WebRTC.Video.BitrateSentInKbps",
static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
1000));
RTC_HISTOGRAM_COUNTS_10000(
"WebRTC.Video.MediaBitrateSentInKbps",
static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
RTC_HISTOGRAM_COUNTS_10000(
"WebRTC.Video.PaddingBitrateSentInKbps",
static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
1000));
RTC_HISTOGRAM_COUNTS_10000(
"WebRTC.Video.RetransmittedBitrateSentInKbps",
static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
elapsed_sec / 1000));
if (rtp_rtcp_->RtxSendStatus() != kRtxOff) {
RTC_HISTOGRAM_COUNTS_10000(
"WebRTC.Video.RtxBitrateSentInKbps",
static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
1000));
}
bool fec_enabled = false;
uint8_t pltype_red;
uint8_t pltype_fec;
rtp_rtcp_->GenericFECStatus(fec_enabled, pltype_red, pltype_fec);
if (fec_enabled) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps",
static_cast<int>(rtp_rtx.fec.TotalBytes() *
8 / elapsed_sec / 1000));
}
}
} else if (vie_receiver_.GetRemoteSsrc() > 0) {
@ -302,49 +343,6 @@ void ViEChannel::UpdateHistograms() {
}
}
void ViEChannel::UpdateHistogramsAtStopSend() {
StreamDataCounters rtp;
StreamDataCounters rtx;
GetSendStreamDataCounters(&rtp, &rtx);
StreamDataCounters rtp_rtx = rtp;
rtp_rtx.Add(rtx);
int64_t elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(
Clock::GetRealTimeClock()->TimeInMilliseconds()) / 1000;
if (elapsed_sec < metrics::kMinRunTimeInSeconds) {
return;
}
RTC_HISTOGRAM_COUNTS_100000(
"WebRTC.Video.BitrateSentInKbps",
static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
1000));
RTC_HISTOGRAM_COUNTS_10000(
"WebRTC.Video.MediaBitrateSentInKbps",
static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
RTC_HISTOGRAM_COUNTS_10000(
"WebRTC.Video.PaddingBitrateSentInKbps",
static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
1000));
RTC_HISTOGRAM_COUNTS_10000(
"WebRTC.Video.RetransmittedBitrateSentInKbps",
static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec /
1000));
if (rtp_rtcp_->RtxSendStatus() != kRtxOff) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtxBitrateSentInKbps",
static_cast<int>(rtx.transmitted.TotalBytes() *
8 / elapsed_sec / 1000));
}
bool fec_enabled = false;
uint8_t pltype_red;
uint8_t pltype_fec;
rtp_rtcp_->GenericFECStatus(fec_enabled, pltype_red, pltype_fec);
if (fec_enabled) {
RTC_HISTOGRAM_COUNTS_10000(
"WebRTC.Video.FecBitrateSentInKbps",
static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000));
}
}
int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec,
bool new_stream) {
DCHECK(sender_);
@ -1336,7 +1334,6 @@ int32_t ViEChannel::StartSend() {
}
int32_t ViEChannel::StopSend() {
UpdateHistogramsAtStopSend();
send_payload_router_->set_active(false);
CriticalSectionScoped cs(rtp_rtcp_cs_.get());
rtp_rtcp_->SetSendingMediaStatus(false);
@ -1350,8 +1347,6 @@ int32_t ViEChannel::StopSend() {
return -1;
}
// Reset.
rtp_rtcp_->ResetSendDataCountersRTP();
if (rtp_rtcp_->SetSendingStatus(false) != 0) {
return -1;
}
@ -1359,7 +1354,6 @@ int32_t ViEChannel::StopSend() {
it != simulcast_rtp_rtcp_.end();
it++) {
RtpRtcp* rtp_rtcp = *it;
rtp_rtcp->ResetSendDataCountersRTP();
rtp_rtcp->SetSendingStatus(false);
}
return 0;
@ -1698,13 +1692,6 @@ void ViEChannel::OnIncomingCSRCChanged(const int32_t id,
CriticalSectionScoped cs(callback_cs_.get());
}
void ViEChannel::ResetStatistics(uint32_t ssrc) {
StreamStatistician* statistician =
vie_receiver_.GetReceiveStatistics()->GetStatistician(ssrc);
if (statistician)
statistician->ResetStatistics();
}
void ViEChannel::RegisterSendFrameCountObserver(
FrameCountObserver* observer) {
send_frame_count_observer_.Set(observer);

View File

@ -258,7 +258,6 @@ class ViEChannel : public VCMFrameTypeCallback,
virtual void OnIncomingCSRCChanged(const int32_t id,
const uint32_t CSRC,
const bool added);
virtual void ResetStatistics(uint32_t);
int32_t SetRemoteSSRCType(const StreamType usage, const uint32_t SSRC);
@ -375,7 +374,6 @@ class ViEChannel : public VCMFrameTypeCallback,
void SetRtxSendStatus(bool enable);
void UpdateHistograms();
void UpdateHistogramsAtStopSend();
// ViEChannel exposes methods that allow to modify observers and callbacks
// to be modified. Such an API-style is cumbersome to implement and maintain

View File

@ -74,11 +74,6 @@ class StatisticsProxy : public RtcpStatisticsCallback {
void CNameChanged(const char* cname, uint32_t ssrc) override {}
void ResetStatistics() {
CriticalSectionScoped cs(stats_lock_.get());
stats_ = ChannelStatistics();
}
ChannelStatistics GetStats() {
CriticalSectionScoped cs(stats_lock_.get());
return stats_;
@ -340,15 +335,6 @@ void Channel::OnIncomingCSRCChanged(int32_t id,
id, CSRC, added);
}
void Channel::ResetStatistics(uint32_t ssrc) {
StreamStatistician* statistician =
rtp_receive_statistics_->GetStatistician(ssrc);
if (statistician) {
statistician->ResetStatistics();
}
statistics_proxy_->ResetStatistics();
}
int32_t
Channel::OnInitializeDecoder(
int32_t id,
@ -1206,8 +1192,7 @@ Channel::StopSend()
// Reset sending SSRC and sequence number and triggers direct transmission
// of RTCP BYE
if (_rtpRtcpModule->SetSendingStatus(false) == -1 ||
_rtpRtcpModule->ResetSendDataCountersRTP() == -1)
if (_rtpRtcpModule->SetSendingStatus(false) == -1)
{
_engineStatisticsPtr->SetLastError(
VE_RTP_RTCP_MODULE_ERROR, kTraceWarning,

View File

@ -368,7 +368,6 @@ public:
uint32_t rate) override;
void OnIncomingSSRCChanged(int32_t id, uint32_t ssrc) override;
void OnIncomingCSRCChanged(int32_t id, uint32_t CSRC, bool added) override;
void ResetStatistics(uint32_t ssrc) override;
// From RtpAudioFeedback in the RTP/RTCP module
void OnPlayTelephoneEvent(int32_t id,