Index: webrtc/pc/webrtcsession.cc |
diff --git a/webrtc/pc/webrtcsession.cc b/webrtc/pc/webrtcsession.cc |
index 78078e169c115101fb9c25aa541f84457c37c81e..c6046e905fd48e3a57b98315d49bebe091b56dfd 100644 |
--- a/webrtc/pc/webrtcsession.cc |
+++ b/webrtc/pc/webrtcsession.cc |
@@ -1502,12 +1502,13 @@ void WebRtcSession::OnTransportControllerCandidatesGathered( |
for (cricket::Candidates::const_iterator citer = candidates.begin(); |
citer != candidates.end(); ++citer) { |
// Use transport_name as the candidate media id. |
- JsepIceCandidate candidate(transport_name, sdp_mline_index, *citer); |
- if (ice_observer_) { |
- ice_observer_->OnIceCandidate(&candidate); |
- } |
+ std::unique_ptr<JsepIceCandidate> candidate( |
+ new JsepIceCandidate(transport_name, sdp_mline_index, *citer)); |
if (local_description()) { |
- mutable_local_description()->AddCandidate(&candidate); |
+ mutable_local_description()->AddCandidate(candidate.get()); |
+ } |
+ if (ice_observer_) { |
+ ice_observer_->OnIceCandidate(std::move(candidate)); |
} |
} |
} |