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

Unified Diff: content/renderer/media/webrtc/rtc_stats.h

Issue 2319543002: WebRTCStats added for surfacing RTCStats from WebRTC to Blink. (Closed)
Patch Set: Addressed comments, added WebRTCStatsReport Created 4 years, 3 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
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/media/webrtc/rtc_stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc/rtc_stats.h
diff --git a/content/renderer/media/webrtc/rtc_stats.h b/content/renderer/media/webrtc/rtc_stats.h
new file mode 100644
index 0000000000000000000000000000000000000000..3c2a4b21b080ef3ccffd235e29ea359f64c3bf5a
--- /dev/null
+++ b/content/renderer/media/webrtc/rtc_stats.h
@@ -0,0 +1,81 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
+#define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
+
+#include "base/memory/ref_counted.h"
+#include "third_party/WebKit/public/platform/WebRTCStats.h"
+#include "third_party/webrtc/api/rtcstats.h"
+#include "third_party/webrtc/api/rtcstatsreport.h"
+
+namespace content {
+
+class RTCStatsReport : public blink::WebRTCStatsReport {
+ public:
+ RTCStatsReport(
+ const scoped_refptr<const webrtc::RTCStatsReport>& stats_report);
+ ~RTCStatsReport() override;
+
+ std::unique_ptr<blink::WebRTCStats> next() override;
+
+ private:
+ const scoped_refptr<const webrtc::RTCStatsReport> stats_report_;
+ webrtc::RTCStatsReport::ConstIterator it_;
+ const webrtc::RTCStatsReport::ConstIterator end_;
+};
+
+class RTCStats : public blink::WebRTCStats {
+ public:
+ RTCStats(const scoped_refptr<const webrtc::RTCStatsReport>& stats_owner,
+ const webrtc::RTCStats* stats);
+ ~RTCStats() override;
+
+ blink::WebString id() const override;
+ blink::WebString type() const override;
+ double timestamp() const override;
+
+ size_t membersCount() const override;
+ std::unique_ptr<blink::WebRTCStatsMember> getMember(size_t i) const override;
+
+ private:
+ // Referencing the owning report protects |stats_| from destruction.
perkj_chrome 2016/09/09 07:10:40 owning report protects ?
hbos_chromium 2016/09/09 08:47:33 Done.
+ const scoped_refptr<const webrtc::RTCStatsReport> stats_owner_;
+ // Pointer to a stats object that is owned by |stats_owner_|.
+ const webrtc::RTCStats* const stats_;
+ const std::vector<const webrtc::RTCStatsMemberInterface*> stats_members_;
perkj_chrome 2016/09/09 07:10:40 and a comment about stats_members_?
hbos_chromium 2016/09/09 08:47:33 Done.
+};
+
+class RTCStatsMember : public blink::WebRTCStatsMember {
+ public:
+ RTCStatsMember(const scoped_refptr<const webrtc::RTCStatsReport>& stats_owner,
+ const webrtc::RTCStatsMemberInterface* member);
+ ~RTCStatsMember() override;
+
+ blink::WebString name() const override;
+ blink::WebRTCStatsMemberType type() const override;
+
+ int32_t valueInt32() const override;
+ uint32_t valueUint32() const override;
+ int64_t valueInt64() const override;
+ uint64_t valueUint64() const override;
+ double valueDouble() const override;
+ blink::WebString valueString() const override;
+ blink::WebVector<int32_t> valueSequenceInt32() const override;
+ blink::WebVector<uint32_t> valueSequenceUint32() const override;
+ blink::WebVector<int64_t> valueSequenceInt64() const override;
+ blink::WebVector<uint64_t> valueSequenceUint64() const override;
+ blink::WebVector<double> valueSequenceDouble() const override;
+ blink::WebVector<blink::WebString> valueSequenceString() const override;
+
+ private:
+ // Referencing the owning report protects |member_| from destruction.
perkj_chrome 2016/09/09 07:10:40 dito
hbos_chromium 2016/09/09 08:47:33 Done.
+ const scoped_refptr<const webrtc::RTCStatsReport> stats_owner_;
+ // Pointer to member of a stats object that is owned by |stats_owner_|.
+ const webrtc::RTCStatsMemberInterface* const member_;
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/media/webrtc/rtc_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698