| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/cast_extension_session.h" | 5 #include "remoting/host/cast_extension_session.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 // A webrtc::StatsObserver implementation used to receive statistics about the | 129 // A webrtc::StatsObserver implementation used to receive statistics about the |
| 130 // current PeerConnection. | 130 // current PeerConnection. |
| 131 class CastStatsObserver : public webrtc::StatsObserver { | 131 class CastStatsObserver : public webrtc::StatsObserver { |
| 132 public: | 132 public: |
| 133 static CastStatsObserver* Create() { | 133 static CastStatsObserver* Create() { |
| 134 return new rtc::RefCountedObject<CastStatsObserver>(); | 134 return new rtc::RefCountedObject<CastStatsObserver>(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void OnComplete(const std::vector<webrtc::StatsReport>& reports) override { | 137 void OnComplete(const webrtc::StatsReports& reports) override { |
| 138 typedef webrtc::StatsReport::Values::iterator ValuesIterator; | |
| 139 | |
| 140 VLOG(1) << "Received " << reports.size() << " new StatsReports."; | 138 VLOG(1) << "Received " << reports.size() << " new StatsReports."; |
| 141 | 139 |
| 142 int index; | 140 int index = 0; |
| 143 std::vector<webrtc::StatsReport>::const_iterator it; | 141 for (const auto* report : reports) { |
| 144 for (it = reports.begin(), index = 0; it != reports.end(); ++it, ++index) { | 142 VLOG(1) << "Report " << index++ << ":"; |
| 145 webrtc::StatsReport::Values v = it->values; | 143 for (const auto& v : report->values) { |
| 146 VLOG(1) << "Report " << index << ":"; | 144 VLOG(1) << "Stat: " << v.display_name() << "=" << v.value << "."; |
| 147 for (ValuesIterator vIt = v.begin(); vIt != v.end(); ++vIt) { | |
| 148 VLOG(1) << "Stat: " << vIt->name << "=" << vIt->value << "."; | |
| 149 } | 145 } |
| 150 } | 146 } |
| 151 } | 147 } |
| 152 | 148 |
| 153 protected: | 149 protected: |
| 154 CastStatsObserver() {} | 150 CastStatsObserver() {} |
| 155 ~CastStatsObserver() override {} | 151 ~CastStatsObserver() override {} |
| 156 | 152 |
| 157 DISALLOW_COPY_AND_ASSIGN(CastStatsObserver); | 153 DISALLOW_COPY_AND_ASSIGN(CastStatsObserver); |
| 158 }; | 154 }; |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 json->SetString(kWebRtcCandidate, candidate_str); | 651 json->SetString(kWebRtcCandidate, candidate_str); |
| 656 std::string json_str; | 652 std::string json_str; |
| 657 if (!base::JSONWriter::Write(json.get(), &json_str)) { | 653 if (!base::JSONWriter::Write(json.get(), &json_str)) { |
| 658 LOG(ERROR) << "Failed to serialize candidate message."; | 654 LOG(ERROR) << "Failed to serialize candidate message."; |
| 659 return; | 655 return; |
| 660 } | 656 } |
| 661 SendMessageToClient(kSubjectNewCandidate, json_str); | 657 SendMessageToClient(kSubjectNewCandidate, json_str); |
| 662 } | 658 } |
| 663 | 659 |
| 664 } // namespace remoting | 660 } // namespace remoting |
| OLD | NEW |