| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 DCHECK(pending_transport_info_message_); | 549 DCHECK(pending_transport_info_message_); |
| 550 | 550 |
| 551 send_transport_info_callback_.Run(std::move(pending_transport_info_message_)); | 551 send_transport_info_callback_.Run(std::move(pending_transport_info_message_)); |
| 552 } | 552 } |
| 553 | 553 |
| 554 void WebrtcTransport::AddPendingCandidatesIfPossible() { | 554 void WebrtcTransport::AddPendingCandidatesIfPossible() { |
| 555 DCHECK(thread_checker_.CalledOnValidThread()); | 555 DCHECK(thread_checker_.CalledOnValidThread()); |
| 556 | 556 |
| 557 if (peer_connection_->signaling_state() == | 557 if (peer_connection_->signaling_state() == |
| 558 webrtc::PeerConnectionInterface::kStable) { | 558 webrtc::PeerConnectionInterface::kStable) { |
| 559 for (auto candidate : pending_incoming_candidates_) { | 559 for (auto* candidate : pending_incoming_candidates_) { |
| 560 if (!peer_connection_->AddIceCandidate(candidate)) { | 560 if (!peer_connection_->AddIceCandidate(candidate)) { |
| 561 LOG(ERROR) << "Failed to add incoming candidate"; | 561 LOG(ERROR) << "Failed to add incoming candidate"; |
| 562 Close(INCOMPATIBLE_PROTOCOL); | 562 Close(INCOMPATIBLE_PROTOCOL); |
| 563 return; | 563 return; |
| 564 } | 564 } |
| 565 } | 565 } |
| 566 pending_incoming_candidates_.clear(); | 566 pending_incoming_candidates_.clear(); |
| 567 } | 567 } |
| 568 } | 568 } |
| 569 | 569 |
| 570 void WebrtcTransport::Close(ErrorCode error) { | 570 void WebrtcTransport::Close(ErrorCode error) { |
| 571 DCHECK(thread_checker_.CalledOnValidThread()); | 571 DCHECK(thread_checker_.CalledOnValidThread()); |
| 572 if (!peer_connection_) | 572 if (!peer_connection_) |
| 573 return; | 573 return; |
| 574 | 574 |
| 575 weak_factory_.InvalidateWeakPtrs(); | 575 weak_factory_.InvalidateWeakPtrs(); |
| 576 peer_connection_->Close(); | 576 peer_connection_->Close(); |
| 577 peer_connection_ = nullptr; | 577 peer_connection_ = nullptr; |
| 578 peer_connection_factory_ = nullptr; | 578 peer_connection_factory_ = nullptr; |
| 579 | 579 |
| 580 if (error != OK) | 580 if (error != OK) |
| 581 event_handler_->OnWebrtcTransportError(error); | 581 event_handler_->OnWebrtcTransportError(error); |
| 582 } | 582 } |
| 583 | 583 |
| 584 } // namespace protocol | 584 } // namespace protocol |
| 585 } // namespace remoting | 585 } // namespace remoting |
| OLD | NEW |