OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
5 #include "remoting/protocol/webrtc_transport.h" | 5 #include "remoting/protocol/webrtc_transport.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 DCHECK(pending_transport_info_message_); | 673 DCHECK(pending_transport_info_message_); |
674 | 674 |
675 send_transport_info_callback_.Run(std::move(pending_transport_info_message_)); | 675 send_transport_info_callback_.Run(std::move(pending_transport_info_message_)); |
676 } | 676 } |
677 | 677 |
678 void WebrtcTransport::AddPendingCandidatesIfPossible() { | 678 void WebrtcTransport::AddPendingCandidatesIfPossible() { |
679 DCHECK(thread_checker_.CalledOnValidThread()); | 679 DCHECK(thread_checker_.CalledOnValidThread()); |
680 | 680 |
681 if (peer_connection()->signaling_state() == | 681 if (peer_connection()->signaling_state() == |
682 webrtc::PeerConnectionInterface::kStable) { | 682 webrtc::PeerConnectionInterface::kStable) { |
683 for (auto* candidate : pending_incoming_candidates_) { | 683 for (const auto& candidate : pending_incoming_candidates_) { |
684 if (!peer_connection()->AddIceCandidate(candidate)) { | 684 if (!peer_connection()->AddIceCandidate(candidate.get())) { |
685 LOG(ERROR) << "Failed to add incoming candidate"; | 685 LOG(ERROR) << "Failed to add incoming candidate"; |
686 Close(INCOMPATIBLE_PROTOCOL); | 686 Close(INCOMPATIBLE_PROTOCOL); |
687 return; | 687 return; |
688 } | 688 } |
689 } | 689 } |
690 pending_incoming_candidates_.clear(); | 690 pending_incoming_candidates_.clear(); |
691 } | 691 } |
692 } | 692 } |
693 | 693 |
694 void WebrtcTransport::Close(ErrorCode error) { | 694 void WebrtcTransport::Close(ErrorCode error) { |
695 DCHECK(thread_checker_.CalledOnValidThread()); | 695 DCHECK(thread_checker_.CalledOnValidThread()); |
696 if (!peer_connection_wrapper_) | 696 if (!peer_connection_wrapper_) |
697 return; | 697 return; |
698 | 698 |
699 weak_factory_.InvalidateWeakPtrs(); | 699 weak_factory_.InvalidateWeakPtrs(); |
700 | 700 |
701 // Close and delete PeerConnection asynchronously. PeerConnection may be on | 701 // Close and delete PeerConnection asynchronously. PeerConnection may be on |
702 // the stack and so it must be destroyed later. | 702 // the stack and so it must be destroyed later. |
703 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( | 703 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( |
704 FROM_HERE, peer_connection_wrapper_.release()); | 704 FROM_HERE, peer_connection_wrapper_.release()); |
705 | 705 |
706 if (error != OK) | 706 if (error != OK) |
707 event_handler_->OnWebrtcTransportError(error); | 707 event_handler_->OnWebrtcTransportError(error); |
708 } | 708 } |
709 | 709 |
710 } // namespace protocol | 710 } // namespace protocol |
711 } // namespace remoting | 711 } // namespace remoting |
OLD | NEW |