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

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

Issue 2988763002: Take smaller interface for RtpRtcp::Configuration::receive_statistics (Closed)
Patch Set: rerenaming Created 3 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 fe5f02b45b71237e720b1325fc0cfc16f920a1fd..21f5b37c2f5cf26dd8011a2c4b5ec0b0ef350711 100644
--- a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc
@@ -13,10 +13,12 @@
#include <math.h>
#include <cstdlib>
+#include <vector>
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
#include "webrtc/modules/rtp_rtcp/source/time_util.h"
+#include "webrtc/rtc_base/logging.h"
#include "webrtc/system_wrappers/include/clock.h"
namespace webrtc {
@@ -492,6 +494,37 @@ void ReceiveStatisticsImpl::DataCountersUpdated(const StreamDataCounters& stats,
}
}
+std::vector<rtcp::ReportBlock> ReceiveStatistics::RtcpReportBlocks(
+ size_t max_blocks) {
+ StatisticianMap statisticians = GetActiveStatisticians();
+ std::vector<rtcp::ReportBlock> result;
+ result.reserve(std::min(max_blocks, statisticians.size()));
+ for (auto& statistician : statisticians) {
+ // TODO(danilchap): Select statistician subset across multiple calls using
+ // round-robin, as described in rfc3550 section 6.4 when single
+ // rtcp_module/receive_statistics will be used for more rtp streams.
+ if (result.size() == max_blocks)
+ break;
+
+ // Do we have receive statistics to send?
+ RtcpStatistics stats;
+ if (!statistician.second->GetStatistics(&stats, true))
+ continue;
+ result.emplace_back();
+ rtcp::ReportBlock& block = result.back();
+ block.SetMediaSsrc(statistician.first);
+ block.SetFractionLost(stats.fraction_lost);
+ if (!block.SetCumulativeLost(stats.cumulative_lost)) {
+ LOG(LS_WARNING) << "Cumulative lost is oversized.";
eladalon 2017/07/27 09:07:31 Would logging the value be useful?
danilchap 2017/07/27 10:04:32 may be. I have a TODO in ReceiveStatistics to hand
+ result.pop_back();
+ continue;
+ }
+ block.SetExtHighestSeqNum(stats.extended_max_sequence_number);
+ block.SetJitter(stats.jitter);
+ }
+ return result;
+}
+
void NullReceiveStatistics::IncomingPacket(const RTPHeader& rtp_header,
size_t packet_length,
bool retransmitted) {}

Powered by Google App Engine
This is Rietveld 408576698