Index: webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc |
index 932be1bb9e1c19490a397146ba96c941884ac0fd..4ec11b63452745cf1f8d772b0971575dc97e767b 100644 |
--- a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc |
+++ b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc |
@@ -14,7 +14,7 @@ |
#include <cstdlib> |
-#include "webrtc/modules/rtp_rtcp/source/bitrate.h" |
+#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
#include "webrtc/modules/rtp_rtcp/source/time_util.h" |
namespace webrtc { |
@@ -29,7 +29,8 @@ |
RtcpStatisticsCallback* rtcp_callback, |
StreamDataCountersCallback* rtp_callback) |
: clock_(clock), |
- incoming_bitrate_(clock, NULL), |
+ incoming_bitrate_(kStatisticsProcessIntervalMs, |
+ RateStatistics::kBpsScale), |
ssrc_(0), |
max_reordering_threshold_(kDefaultMaxReorderingThreshold), |
jitter_q4_(0), |
@@ -61,7 +62,7 @@ |
rtc::CritScope cs(&stream_lock_); |
bool in_order = InOrderPacketInternal(header.sequenceNumber); |
ssrc_ = header.ssrc; |
- incoming_bitrate_.Update(packet_length); |
+ incoming_bitrate_.Update(packet_length, clock_->TimeInMilliseconds()); |
receive_counters_.transmitted.AddPacket(packet_length, header); |
if (!in_order && retransmitted) { |
receive_counters_.retransmitted.AddPacket(packet_length, header); |
@@ -300,12 +301,7 @@ |
uint32_t StreamStatisticianImpl::BitrateReceived() const { |
rtc::CritScope cs(&stream_lock_); |
- return incoming_bitrate_.BitrateNow(); |
-} |
- |
-void StreamStatisticianImpl::ProcessBitrate() { |
- rtc::CritScope cs(&stream_lock_); |
- incoming_bitrate_.Process(); |
+ return incoming_bitrate_.Rate(clock_->TimeInMilliseconds()).value_or(0); |
} |
void StreamStatisticianImpl::LastReceiveTimeNtp(uint32_t* secs, |
@@ -376,7 +372,6 @@ |
ReceiveStatisticsImpl::ReceiveStatisticsImpl(Clock* clock) |
: clock_(clock), |
- last_rate_update_ms_(0), |
rtcp_stats_callback_(NULL), |
rtp_stats_callback_(NULL) {} |
@@ -452,23 +447,6 @@ |
} |
} |
-void ReceiveStatisticsImpl::Process() { |
- rtc::CritScope cs(&receive_statistics_lock_); |
- for (StatisticianImplMap::iterator it = statisticians_.begin(); |
- it != statisticians_.end(); ++it) { |
- it->second->ProcessBitrate(); |
- } |
- last_rate_update_ms_ = clock_->TimeInMilliseconds(); |
-} |
- |
-int64_t ReceiveStatisticsImpl::TimeUntilNextProcess() { |
- rtc::CritScope cs(&receive_statistics_lock_); |
- int64_t time_since_last_update = clock_->TimeInMilliseconds() - |
- last_rate_update_ms_; |
- return std::max<int64_t>( |
- kStatisticsProcessIntervalMs - time_since_last_update, 0); |
-} |
- |
void ReceiveStatisticsImpl::RegisterRtcpStatisticsCallback( |
RtcpStatisticsCallback* callback) { |
rtc::CritScope cs(&receive_statistics_lock_); |
@@ -525,10 +503,6 @@ |
void NullReceiveStatistics::SetMaxReorderingThreshold( |
int max_reordering_threshold) {} |
-int64_t NullReceiveStatistics::TimeUntilNextProcess() { return 0; } |
- |
-void NullReceiveStatistics::Process() {} |
- |
void NullReceiveStatistics::RegisterRtcpStatisticsCallback( |
RtcpStatisticsCallback* callback) {} |