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

Side by Side Diff: talk/app/webrtc/jsepsessiondescription.cc

Issue 1241973002: Use std::string references instead of copying contents. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix use-after-free Created 5 years, 5 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 | « no previous file | talk/app/webrtc/webrtcsdp.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 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 bool JsepSessionDescription::AddCandidate( 123 bool JsepSessionDescription::AddCandidate(
124 const IceCandidateInterface* candidate) { 124 const IceCandidateInterface* candidate) {
125 if (!candidate || candidate->sdp_mline_index() < 0) 125 if (!candidate || candidate->sdp_mline_index() < 0)
126 return false; 126 return false;
127 size_t mediasection_index = 0; 127 size_t mediasection_index = 0;
128 if (!GetMediasectionIndex(candidate, &mediasection_index)) { 128 if (!GetMediasectionIndex(candidate, &mediasection_index)) {
129 return false; 129 return false;
130 } 130 }
131 if (mediasection_index >= number_of_mediasections()) 131 if (mediasection_index >= number_of_mediasections())
132 return false; 132 return false;
133 const std::string content_name = 133 const std::string& content_name =
134 description_->contents()[mediasection_index].name; 134 description_->contents()[mediasection_index].name;
135 const cricket::TransportInfo* transport_info = 135 const cricket::TransportInfo* transport_info =
136 description_->GetTransportInfoByName(content_name); 136 description_->GetTransportInfoByName(content_name);
137 if (!transport_info) { 137 if (!transport_info) {
138 return false; 138 return false;
139 } 139 }
140 140
141 cricket::Candidate updated_candidate = candidate->candidate(); 141 cricket::Candidate updated_candidate = candidate->candidate();
142 if (updated_candidate.username().empty()) { 142 if (updated_candidate.username().empty()) {
143 updated_candidate.set_username(transport_info->description.ice_ufrag); 143 updated_candidate.set_username(transport_info->description.ice_ufrag);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (!found) { 198 if (!found) {
199 // If the sdp_mid is presented but we can't find a match, we consider 199 // If the sdp_mid is presented but we can't find a match, we consider
200 // this as an error. 200 // this as an error.
201 return false; 201 return false;
202 } 202 }
203 } 203 }
204 return true; 204 return true;
205 } 205 }
206 206
207 } // namespace webrtc 207 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/webrtcsdp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698