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

Side by Side Diff: talk/session/media/mediasession.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 | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | no next file » | 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 2004 Google Inc. 3 * Copyright 2004 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // |bundle_group| should be updated to use the ufrag and pwd of the first 522 // |bundle_group| should be updated to use the ufrag and pwd of the first
523 // content within the |bundle_group|. 523 // content within the |bundle_group|.
524 static bool UpdateTransportInfoForBundle(const ContentGroup& bundle_group, 524 static bool UpdateTransportInfoForBundle(const ContentGroup& bundle_group,
525 SessionDescription* sdesc) { 525 SessionDescription* sdesc) {
526 // The bundle should not be empty. 526 // The bundle should not be empty.
527 if (!sdesc || !bundle_group.FirstContentName()) { 527 if (!sdesc || !bundle_group.FirstContentName()) {
528 return false; 528 return false;
529 } 529 }
530 530
531 // We should definitely have a transport for the first content. 531 // We should definitely have a transport for the first content.
532 std::string selected_content_name = *bundle_group.FirstContentName(); 532 const std::string& selected_content_name = *bundle_group.FirstContentName();
533 const TransportInfo* selected_transport_info = 533 const TransportInfo* selected_transport_info =
534 sdesc->GetTransportInfoByName(selected_content_name); 534 sdesc->GetTransportInfoByName(selected_content_name);
535 if (!selected_transport_info) { 535 if (!selected_transport_info) {
536 return false; 536 return false;
537 } 537 }
538 538
539 // Set the other contents to use the same ICE credentials. 539 // Set the other contents to use the same ICE credentials.
540 const std::string selected_ufrag = 540 const std::string& selected_ufrag =
541 selected_transport_info->description.ice_ufrag; 541 selected_transport_info->description.ice_ufrag;
542 const std::string selected_pwd = 542 const std::string& selected_pwd =
543 selected_transport_info->description.ice_pwd; 543 selected_transport_info->description.ice_pwd;
544 for (TransportInfos::iterator it = 544 for (TransportInfos::iterator it =
545 sdesc->transport_infos().begin(); 545 sdesc->transport_infos().begin();
546 it != sdesc->transport_infos().end(); ++it) { 546 it != sdesc->transport_infos().end(); ++it) {
547 if (bundle_group.HasContentName(it->content_name) && 547 if (bundle_group.HasContentName(it->content_name) &&
548 it->content_name != selected_content_name) { 548 it->content_name != selected_content_name) {
549 it->description.ice_ufrag = selected_ufrag; 549 it->description.ice_ufrag = selected_ufrag;
550 it->description.ice_pwd = selected_pwd; 550 it->description.ice_pwd = selected_pwd;
551 } 551 }
552 } 552 }
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 } else if (channel_name == GICE_CHANNEL_NAME_DATA_RTP || 1947 } else if (channel_name == GICE_CHANNEL_NAME_DATA_RTP ||
1948 channel_name == GICE_CHANNEL_NAME_DATA_RTCP) { 1948 channel_name == GICE_CHANNEL_NAME_DATA_RTCP) {
1949 *media_type = MEDIA_TYPE_DATA; 1949 *media_type = MEDIA_TYPE_DATA;
1950 return true; 1950 return true;
1951 } 1951 }
1952 1952
1953 return false; 1953 return false;
1954 } 1954 }
1955 1955
1956 } // namespace cricket 1956 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698