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/strings/utf_string_conversions.h" | 6 #include "base/strings/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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 | 272 |
273 PeerConnectionTracker::~PeerConnectionTracker() { | 273 PeerConnectionTracker::~PeerConnectionTracker() { |
274 } | 274 } |
275 | 275 |
276 bool PeerConnectionTracker::OnControlMessageReceived( | 276 bool PeerConnectionTracker::OnControlMessageReceived( |
277 const IPC::Message& message) { | 277 const IPC::Message& message) { |
278 bool handled = true; | 278 bool handled = true; |
279 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTracker, message) | 279 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTracker, message) |
280 IPC_MESSAGE_HANDLER(PeerConnectionTracker_GetAllStats, OnGetAllStats) | 280 IPC_MESSAGE_HANDLER(PeerConnectionTracker_GetAllStats, OnGetAllStats) |
| 281 IPC_MESSAGE_HANDLER(PeerConnectionTracker_OnSuspend, OnSuspend) |
281 IPC_MESSAGE_UNHANDLED(handled = false) | 282 IPC_MESSAGE_UNHANDLED(handled = false) |
282 IPC_END_MESSAGE_MAP() | 283 IPC_END_MESSAGE_MAP() |
283 return handled; | 284 return handled; |
284 } | 285 } |
285 | 286 |
286 void PeerConnectionTracker::OnGetAllStats() { | 287 void PeerConnectionTracker::OnGetAllStats() { |
287 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); | 288 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); |
288 it != peer_connection_id_map_.end(); ++it) { | 289 it != peer_connection_id_map_.end(); ++it) { |
289 | 290 |
290 rtc::scoped_refptr<InternalStatsObserver> observer( | 291 rtc::scoped_refptr<InternalStatsObserver> observer( |
291 new rtc::RefCountedObject<InternalStatsObserver>(it->second)); | 292 new rtc::RefCountedObject<InternalStatsObserver>(it->second)); |
292 | 293 |
293 it->first->GetStats( | 294 it->first->GetStats( |
294 observer, | 295 observer, |
295 NULL, | 296 NULL, |
296 webrtc::PeerConnectionInterface::kStatsOutputLevelDebug); | 297 webrtc::PeerConnectionInterface::kStatsOutputLevelDebug); |
297 } | 298 } |
298 } | 299 } |
299 | 300 |
| 301 void PeerConnectionTracker::OnSuspend() { |
| 302 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); |
| 303 it != peer_connection_id_map_.end(); ++it) { |
| 304 it->first->stop(); |
| 305 } |
| 306 } |
| 307 |
300 void PeerConnectionTracker::RegisterPeerConnection( | 308 void PeerConnectionTracker::RegisterPeerConnection( |
301 RTCPeerConnectionHandler* pc_handler, | 309 RTCPeerConnectionHandler* pc_handler, |
302 const webrtc::PeerConnectionInterface::RTCConfiguration& config, | 310 const webrtc::PeerConnectionInterface::RTCConfiguration& config, |
303 const RTCMediaConstraints& constraints, | 311 const RTCMediaConstraints& constraints, |
304 const blink::WebFrame* frame) { | 312 const blink::WebFrame* frame) { |
305 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; | 313 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; |
306 PeerConnectionInfo info; | 314 PeerConnectionInfo info; |
307 | 315 |
308 info.lid = GetNextLocalID(); | 316 info.lid = GetNextLocalID(); |
309 info.rtc_configuration = | 317 info.rtc_configuration = |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 const std::string& value) { | 526 const std::string& value) { |
519 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) | 527 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) |
520 return; | 528 return; |
521 | 529 |
522 RenderThreadImpl::current()->Send( | 530 RenderThreadImpl::current()->Send( |
523 new PeerConnectionTrackerHost_UpdatePeerConnection( | 531 new PeerConnectionTrackerHost_UpdatePeerConnection( |
524 peer_connection_id_map_[pc_handler], type, value)); | 532 peer_connection_id_map_[pc_handler], type, value)); |
525 } | 533 } |
526 | 534 |
527 } // namespace content | 535 } // namespace content |
OLD | NEW |