Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: webrtc/pc/webrtcsession.cc

Issue 2748253003: Pass ownership of candidate to PeerConnection::OnIceCandidate (Closed)
Patch Set: Pass ownership through std::unique_ptr Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/pc/webrtcsession.h ('k') | webrtc/pc/webrtcsession_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 int sdp_mline_index; 1495 int sdp_mline_index;
1496 if (!GetLocalCandidateMediaIndex(transport_name, &sdp_mline_index)) { 1496 if (!GetLocalCandidateMediaIndex(transport_name, &sdp_mline_index)) {
1497 LOG(LS_ERROR) << "OnTransportControllerCandidatesGathered: content name " 1497 LOG(LS_ERROR) << "OnTransportControllerCandidatesGathered: content name "
1498 << transport_name << " not found"; 1498 << transport_name << " not found";
1499 return; 1499 return;
1500 } 1500 }
1501 1501
1502 for (cricket::Candidates::const_iterator citer = candidates.begin(); 1502 for (cricket::Candidates::const_iterator citer = candidates.begin();
1503 citer != candidates.end(); ++citer) { 1503 citer != candidates.end(); ++citer) {
1504 // Use transport_name as the candidate media id. 1504 // Use transport_name as the candidate media id.
1505 JsepIceCandidate candidate(transport_name, sdp_mline_index, *citer); 1505 std::unique_ptr<JsepIceCandidate> candidate(
1506 new JsepIceCandidate(transport_name, sdp_mline_index, *citer));
1507 if (local_description()) {
1508 mutable_local_description()->AddCandidate(candidate.get());
1509 }
1506 if (ice_observer_) { 1510 if (ice_observer_) {
1507 ice_observer_->OnIceCandidate(&candidate); 1511 ice_observer_->OnIceCandidate(std::move(candidate));
1508 }
1509 if (local_description()) {
1510 mutable_local_description()->AddCandidate(&candidate);
1511 } 1512 }
1512 } 1513 }
1513 } 1514 }
1514 1515
1515 void WebRtcSession::OnTransportControllerCandidatesRemoved( 1516 void WebRtcSession::OnTransportControllerCandidatesRemoved(
1516 const std::vector<cricket::Candidate>& candidates) { 1517 const std::vector<cricket::Candidate>& candidates) {
1517 RTC_DCHECK(signaling_thread()->IsCurrent()); 1518 RTC_DCHECK(signaling_thread()->IsCurrent());
1518 // Sanity check. 1519 // Sanity check.
1519 for (const cricket::Candidate& candidate : candidates) { 1520 for (const cricket::Candidate& candidate : candidates) {
1520 if (candidate.transport_name().empty()) { 1521 if (candidate.transport_name().empty()) {
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 (rtp_data_channel_->rtcp_dtls_transport() != nullptr); 2384 (rtp_data_channel_->rtcp_dtls_transport() != nullptr);
2384 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); 2385 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release());
2385 transport_controller_->DestroyDtlsTransport( 2386 transport_controller_->DestroyDtlsTransport(
2386 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 2387 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
2387 if (need_to_delete_rtcp) { 2388 if (need_to_delete_rtcp) {
2388 transport_controller_->DestroyDtlsTransport( 2389 transport_controller_->DestroyDtlsTransport(
2389 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); 2390 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
2390 } 2391 }
2391 } 2392 }
2392 } // namespace webrtc 2393 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/webrtcsession.h ('k') | webrtc/pc/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698