| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 RenderThread* PeerConnectionTracker::SendTarget() { | 370 RenderThread* PeerConnectionTracker::SendTarget() { |
| 371 if (send_target_for_test_) { | 371 if (send_target_for_test_) { |
| 372 return send_target_for_test_; | 372 return send_target_for_test_; |
| 373 } | 373 } |
| 374 return RenderThreadImpl::current(); | 374 return RenderThreadImpl::current(); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void PeerConnectionTracker::OnSuspend() { | 377 void PeerConnectionTracker::OnSuspend() { |
| 378 DCHECK(main_thread_.CalledOnValidThread()); | 378 DCHECK(main_thread_.CalledOnValidThread()); |
| 379 // On Android 'Suspend' means more of the activity state. So it's better to | |
| 380 // keep the webrtc call session when user is doing something else or screen | |
| 381 // is off. | |
| 382 #if !defined(OS_ANDROID) | |
| 383 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); | 379 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); |
| 384 it != peer_connection_id_map_.end(); ++it) { | 380 it != peer_connection_id_map_.end(); ++it) { |
| 385 it->first->CloseClientPeerConnection(); | 381 it->first->CloseClientPeerConnection(); |
| 386 } | 382 } |
| 387 #endif | |
| 388 } | 383 } |
| 389 | 384 |
| 390 void PeerConnectionTracker::OnStartEventLog(int peer_connection_id, | 385 void PeerConnectionTracker::OnStartEventLog(int peer_connection_id, |
| 391 IPC::PlatformFileForTransit file) { | 386 IPC::PlatformFileForTransit file) { |
| 392 DCHECK(main_thread_.CalledOnValidThread()); | 387 DCHECK(main_thread_.CalledOnValidThread()); |
| 393 for (auto& it : peer_connection_id_map_) { | 388 for (auto& it : peer_connection_id_map_) { |
| 394 if (it.second == peer_connection_id) { | 389 if (it.second == peer_connection_id) { |
| 395 #if defined(OS_ANDROID) | 390 #if defined(OS_ANDROID) |
| 396 // A lower maximum filesize is used on Android because storage space is | 391 // A lower maximum filesize is used on Android because storage space is |
| 397 // more scarce on mobile. This upper limit applies to each peerconnection | 392 // more scarce on mobile. This upper limit applies to each peerconnection |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 DCHECK(main_thread_.CalledOnValidThread()); | 738 DCHECK(main_thread_.CalledOnValidThread()); |
| 744 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( | 739 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( |
| 745 local_id, std::string(callback_type), value)); | 740 local_id, std::string(callback_type), value)); |
| 746 } | 741 } |
| 747 | 742 |
| 748 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { | 743 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { |
| 749 send_target_for_test_ = target; | 744 send_target_for_test_ = target; |
| 750 } | 745 } |
| 751 | 746 |
| 752 } // namespace content | 747 } // namespace content |
| OLD | NEW |