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

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

Issue 2131913003: Revert of Refactor NACK bitrate allocation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 4ec11b63452745cf1f8d772b0971575dc97e767b..932be1bb9e1c19490a397146ba96c941884ac0fd 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/rtp_rtcp_config.h"
+#include "webrtc/modules/rtp_rtcp/source/bitrate.h"
#include "webrtc/modules/rtp_rtcp/source/time_util.h"
namespace webrtc {
@@ -29,8 +29,7 @@
RtcpStatisticsCallback* rtcp_callback,
StreamDataCountersCallback* rtp_callback)
: clock_(clock),
- incoming_bitrate_(kStatisticsProcessIntervalMs,
- RateStatistics::kBpsScale),
+ incoming_bitrate_(clock, NULL),
ssrc_(0),
max_reordering_threshold_(kDefaultMaxReorderingThreshold),
jitter_q4_(0),
@@ -62,7 +61,7 @@
rtc::CritScope cs(&stream_lock_);
bool in_order = InOrderPacketInternal(header.sequenceNumber);
ssrc_ = header.ssrc;
- incoming_bitrate_.Update(packet_length, clock_->TimeInMilliseconds());
+ incoming_bitrate_.Update(packet_length);
receive_counters_.transmitted.AddPacket(packet_length, header);
if (!in_order && retransmitted) {
receive_counters_.retransmitted.AddPacket(packet_length, header);
@@ -301,7 +300,12 @@
uint32_t StreamStatisticianImpl::BitrateReceived() const {
rtc::CritScope cs(&stream_lock_);
- return incoming_bitrate_.Rate(clock_->TimeInMilliseconds()).value_or(0);
+ return incoming_bitrate_.BitrateNow();
+}
+
+void StreamStatisticianImpl::ProcessBitrate() {
+ rtc::CritScope cs(&stream_lock_);
+ incoming_bitrate_.Process();
}
void StreamStatisticianImpl::LastReceiveTimeNtp(uint32_t* secs,
@@ -372,6 +376,7 @@
ReceiveStatisticsImpl::ReceiveStatisticsImpl(Clock* clock)
: clock_(clock),
+ last_rate_update_ms_(0),
rtcp_stats_callback_(NULL),
rtp_stats_callback_(NULL) {}
@@ -447,6 +452,23 @@
}
}
+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_);
@@ -503,6 +525,10 @@
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