Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc

Issue 2061423003: Refactor NACK bitrate allocation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed nit Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 @@ StreamStatisticianImpl::StreamStatisticianImpl(
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 @@ void StreamStatisticianImpl::UpdateCounters(const RTPHeader& header,
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 @@ void StreamStatisticianImpl::GetReceiveStreamDataCounters(
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 @@ ReceiveStatistics* ReceiveStatistics::Create(Clock* clock) {
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::SetMaxReorderingThreshold(
}
}
-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 @@ StreamStatistician* NullReceiveStatistics::GetStatistician(
void NullReceiveStatistics::SetMaxReorderingThreshold(
int max_reordering_threshold) {}
-int64_t NullReceiveStatistics::TimeUntilNextProcess() { return 0; }
-
-void NullReceiveStatistics::Process() {}
-
void NullReceiveStatistics::RegisterRtcpStatisticsCallback(
RtcpStatisticsCallback* callback) {}
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/receive_statistics_impl.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698