OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/renderer/media/peer_connection_tracker.h" | 4 #include "content/renderer/media/peer_connection_tracker.h" |
5 | 5 |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "content/common/media/peer_connection_tracker_messages.h" | 7 #include "content/common/media/peer_connection_tracker_messages.h" |
8 #include "content/renderer/media/rtc_media_constraints.h" | 8 #include "content/renderer/media/rtc_media_constraints.h" |
9 #include "content/renderer/media/rtc_peer_connection_handler.h" | 9 #include "content/renderer/media/rtc_peer_connection_handler.h" |
10 #include "content/renderer/render_thread_impl.h" | 10 #include "content/renderer/render_thread_impl.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 return dict; | 175 return dict; |
176 } | 176 } |
177 | 177 |
178 // Builds a DictionaryValue from the StatsReport. | 178 // Builds a DictionaryValue from the StatsReport. |
179 // The caller takes the ownership of the returned value. | 179 // The caller takes the ownership of the returned value. |
180 static DictionaryValue* GetDictValue(const webrtc::StatsReport& report) { | 180 static DictionaryValue* GetDictValue(const webrtc::StatsReport& report) { |
181 scoped_ptr<DictionaryValue> stats, result; | 181 scoped_ptr<DictionaryValue> stats, result; |
182 | 182 |
183 stats.reset(GetDictValueStats(report)); | 183 stats.reset(GetDictValueStats(report)); |
184 if (!stats.get()) | 184 if (!stats) |
185 return NULL; | 185 return NULL; |
186 | 186 |
187 result.reset(new DictionaryValue()); | 187 result.reset(new DictionaryValue()); |
188 if (!result.get()) | 188 if (!result) |
189 return NULL; | 189 return NULL; |
190 | 190 |
191 if (stats.get()) | 191 if (stats) |
192 result->Set("stats", stats.release()); | 192 result->Set("stats", stats.release()); |
193 result->SetString("id", report.id); | 193 result->SetString("id", report.id); |
194 result->SetString("type", report.type); | 194 result->SetString("type", report.type); |
195 | 195 |
196 return result.release(); | 196 return result.release(); |
197 } | 197 } |
198 | 198 |
199 class InternalStatsObserver : public webrtc::StatsObserver { | 199 class InternalStatsObserver : public webrtc::StatsObserver { |
200 public: | 200 public: |
201 InternalStatsObserver(int lid) | 201 InternalStatsObserver(int lid) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 const std::string& value) { | 447 const std::string& value) { |
448 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) | 448 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) |
449 return; | 449 return; |
450 | 450 |
451 RenderThreadImpl::current()->Send( | 451 RenderThreadImpl::current()->Send( |
452 new PeerConnectionTrackerHost_UpdatePeerConnection( | 452 new PeerConnectionTrackerHost_UpdatePeerConnection( |
453 peer_connection_id_map_[pc_handler], type, value)); | 453 peer_connection_id_map_[pc_handler], type, value)); |
454 } | 454 } |
455 | 455 |
456 } // namespace content | 456 } // namespace content |
OLD | NEW |