Index: webrtc/stats/rtcstatsreport.cc |
diff --git a/webrtc/stats/rtcstatsreport.cc b/webrtc/stats/rtcstatsreport.cc |
index 4be554daaec9e5d11c6fedc4d2d3e4da817a2b5b..9e2244cecf848b888416b4dbb5af9c4a8101dca1 100644 |
--- a/webrtc/stats/rtcstatsreport.cc |
+++ b/webrtc/stats/rtcstatsreport.cc |
@@ -10,6 +10,8 @@ |
#include "webrtc/api/stats/rtcstatsreport.h" |
+#include <sstream> |
+ |
namespace webrtc { |
RTCStatsReport::ConstIterator::ConstIterator( |
@@ -40,6 +42,10 @@ const RTCStats& RTCStatsReport::ConstIterator::operator*() const { |
return *it_->second.get(); |
} |
+const RTCStats* RTCStatsReport::ConstIterator::operator->() const { |
+ return it_->second.get(); |
+} |
+ |
bool RTCStatsReport::ConstIterator::operator==( |
const RTCStatsReport::ConstIterator& other) const { |
return it_ == other.it_; |
@@ -50,12 +56,14 @@ bool RTCStatsReport::ConstIterator::operator!=( |
return !(*this == other); |
} |
-rtc::scoped_refptr<RTCStatsReport> RTCStatsReport::Create() { |
+rtc::scoped_refptr<RTCStatsReport> RTCStatsReport::Create( |
+ uint64_t timestamp_us) { |
return rtc::scoped_refptr<RTCStatsReport>( |
- new rtc::RefCountedObject<RTCStatsReport>()); |
+ new rtc::RefCountedObject<RTCStatsReport>(timestamp_us)); |
} |
-RTCStatsReport::RTCStatsReport() { |
+RTCStatsReport::RTCStatsReport(uint64_t timestamp_us) |
+ : timestamp_us_(timestamp_us) { |
} |
RTCStatsReport::~RTCStatsReport() { |
@@ -92,4 +100,16 @@ RTCStatsReport::ConstIterator RTCStatsReport::end() const { |
stats_.cend()); |
} |
+std::string RTCStatsReport::ToString() const { |
+ std::ostringstream oss; |
+ ConstIterator it = begin(); |
+ if (it != end()) { |
+ oss << it->ToString(); |
+ for (++it; it != end(); ++it) { |
+ oss << '\n' << it->ToString(); |
+ } |
+ } |
+ return oss.str(); |
+} |
+ |
} // namespace webrtc |