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 <stddef.h> | 6 #include <stddef.h> |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 | 336 |
337 PeerConnectionTracker::~PeerConnectionTracker() { | 337 PeerConnectionTracker::~PeerConnectionTracker() { |
338 } | 338 } |
339 | 339 |
340 bool PeerConnectionTracker::OnControlMessageReceived( | 340 bool PeerConnectionTracker::OnControlMessageReceived( |
341 const IPC::Message& message) { | 341 const IPC::Message& message) { |
342 bool handled = true; | 342 bool handled = true; |
343 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTracker, message) | 343 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTracker, message) |
344 IPC_MESSAGE_HANDLER(PeerConnectionTracker_GetAllStats, OnGetAllStats) | 344 IPC_MESSAGE_HANDLER(PeerConnectionTracker_GetAllStats, OnGetAllStats) |
345 IPC_MESSAGE_HANDLER(PeerConnectionTracker_OnSuspend, OnSuspend) | 345 IPC_MESSAGE_HANDLER(PeerConnectionTracker_OnSuspend, OnSuspend) |
346 IPC_MESSAGE_HANDLER(PeerConnectionTracker_StartEventLog, OnStartEventLog) | |
347 IPC_MESSAGE_HANDLER(PeerConnectionTracker_StopEventLog, OnStopEventLog) | |
346 IPC_MESSAGE_UNHANDLED(handled = false) | 348 IPC_MESSAGE_UNHANDLED(handled = false) |
347 IPC_END_MESSAGE_MAP() | 349 IPC_END_MESSAGE_MAP() |
348 return handled; | 350 return handled; |
349 } | 351 } |
350 | 352 |
351 void PeerConnectionTracker::OnGetAllStats() { | 353 void PeerConnectionTracker::OnGetAllStats() { |
352 DCHECK(main_thread_.CalledOnValidThread()); | 354 DCHECK(main_thread_.CalledOnValidThread()); |
353 | 355 |
354 const std::string empty_track_id; | 356 const std::string empty_track_id; |
355 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); | 357 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); |
(...skipping 17 matching lines...) Expand all Loading... | |
373 } | 375 } |
374 | 376 |
375 void PeerConnectionTracker::OnSuspend() { | 377 void PeerConnectionTracker::OnSuspend() { |
376 DCHECK(main_thread_.CalledOnValidThread()); | 378 DCHECK(main_thread_.CalledOnValidThread()); |
377 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); | 379 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); |
378 it != peer_connection_id_map_.end(); ++it) { | 380 it != peer_connection_id_map_.end(); ++it) { |
379 it->first->CloseClientPeerConnection(); | 381 it->first->CloseClientPeerConnection(); |
380 } | 382 } |
381 } | 383 } |
382 | 384 |
385 void PeerConnectionTracker::OnStartEventLog(int peer_connection_id, | |
386 IPC::PlatformFileForTransit file) { | |
387 DCHECK(main_thread_.CalledOnValidThread()); | |
388 for (auto& it : peer_connection_id_map_) { | |
389 if (it.second == peer_connection_id) { | |
390 #if defined(OS_ANDROID) | |
tommi (sloooow) - chröme
2016/05/25 15:16:21
add a comment for why we use different values
Ivo-OOO until feb 6
2016/05/30 15:04:15
Done.
| |
391 const int64_t max_filesize_bytes = 10000000; | |
dcheng
2016/05/26 22:05:15
Nit: kMaxFilesizeBytes
Ivo-OOO until feb 6
2016/05/30 15:04:15
Done.
| |
392 #else | |
393 const int64_t max_filesize_bytes = 30000000; | |
394 #endif | |
395 it.first->StartEventLog(file, max_filesize_bytes); | |
396 return; | |
397 } | |
398 } | |
399 } | |
400 | |
401 void PeerConnectionTracker::OnStopEventLog(int peer_connection_id) { | |
402 DCHECK(main_thread_.CalledOnValidThread()); | |
403 for (auto& it : peer_connection_id_map_) { | |
404 if (it.second == peer_connection_id) { | |
405 it.first->StopEventLog(); | |
406 return; | |
407 } | |
408 } | |
409 } | |
410 | |
383 void PeerConnectionTracker::RegisterPeerConnection( | 411 void PeerConnectionTracker::RegisterPeerConnection( |
384 RTCPeerConnectionHandler* pc_handler, | 412 RTCPeerConnectionHandler* pc_handler, |
385 const webrtc::PeerConnectionInterface::RTCConfiguration& config, | 413 const webrtc::PeerConnectionInterface::RTCConfiguration& config, |
386 const blink::WebMediaConstraints& constraints, | 414 const blink::WebMediaConstraints& constraints, |
387 const blink::WebFrame* frame) { | 415 const blink::WebFrame* frame) { |
388 DCHECK(main_thread_.CalledOnValidThread()); | 416 DCHECK(main_thread_.CalledOnValidThread()); |
389 DCHECK_EQ(GetLocalIDForHandler(pc_handler), -1); | 417 DCHECK_EQ(GetLocalIDForHandler(pc_handler), -1); |
390 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; | 418 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; |
391 PeerConnectionInfo info; | 419 PeerConnectionInfo info; |
392 | 420 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
706 DCHECK(main_thread_.CalledOnValidThread()); | 734 DCHECK(main_thread_.CalledOnValidThread()); |
707 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( | 735 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( |
708 local_id, std::string(callback_type), value)); | 736 local_id, std::string(callback_type), value)); |
709 } | 737 } |
710 | 738 |
711 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { | 739 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { |
712 send_target_for_test_ = target; | 740 send_target_for_test_ = target; |
713 } | 741 } |
714 | 742 |
715 } // namespace content | 743 } // namespace content |
OLD | NEW |