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) |
379 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); | 383 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); |
380 it != peer_connection_id_map_.end(); ++it) { | 384 it != peer_connection_id_map_.end(); ++it) { |
381 it->first->CloseClientPeerConnection(); | 385 it->first->CloseClientPeerConnection(); |
382 } | 386 } |
| 387 #endif |
383 } | 388 } |
384 | 389 |
385 void PeerConnectionTracker::OnStartEventLog(int peer_connection_id, | 390 void PeerConnectionTracker::OnStartEventLog(int peer_connection_id, |
386 IPC::PlatformFileForTransit file) { | 391 IPC::PlatformFileForTransit file) { |
387 DCHECK(main_thread_.CalledOnValidThread()); | 392 DCHECK(main_thread_.CalledOnValidThread()); |
388 for (auto& it : peer_connection_id_map_) { | 393 for (auto& it : peer_connection_id_map_) { |
389 if (it.second == peer_connection_id) { | 394 if (it.second == peer_connection_id) { |
390 #if defined(OS_ANDROID) | 395 #if defined(OS_ANDROID) |
391 // A lower maximum filesize is used on Android because storage space is | 396 // A lower maximum filesize is used on Android because storage space is |
392 // more scarce on mobile. This upper limit applies to each peerconnection | 397 // more scarce on mobile. This upper limit applies to each peerconnection |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 DCHECK(main_thread_.CalledOnValidThread()); | 743 DCHECK(main_thread_.CalledOnValidThread()); |
739 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( | 744 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( |
740 local_id, std::string(callback_type), value)); | 745 local_id, std::string(callback_type), value)); |
741 } | 746 } |
742 | 747 |
743 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { | 748 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { |
744 send_target_for_test_ = target; | 749 send_target_for_test_ = target; |
745 } | 750 } |
746 | 751 |
747 } // namespace content | 752 } // namespace content |
OLD | NEW |