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

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

Issue 1428243005: Fix for scenario where m-line is revived after being set to port 0. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing typo. Created 5 years, 1 month 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/app/webrtc/peerconnection.h ('k') | talk/app/webrtc/peerconnection_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 * 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 if (session_->data_channel_type() == cricket::DCT_SCTP && 942 if (session_->data_channel_type() == cricket::DCT_SCTP &&
943 session_->GetSslRole(&role)) { 943 session_->GetSslRole(&role)) {
944 AllocateSctpSids(role); 944 AllocateSctpSids(role);
945 } 945 }
946 946
947 // Update state and SSRC of local MediaStreams and DataChannels based on the 947 // Update state and SSRC of local MediaStreams and DataChannels based on the
948 // local session description. 948 // local session description.
949 const cricket::ContentInfo* audio_content = 949 const cricket::ContentInfo* audio_content =
950 GetFirstAudioContent(desc->description()); 950 GetFirstAudioContent(desc->description());
951 if (audio_content) { 951 if (audio_content) {
952 const cricket::AudioContentDescription* audio_desc = 952 if (audio_content->rejected) {
953 static_cast<const cricket::AudioContentDescription*>( 953 RemoveTracks(cricket::MEDIA_TYPE_AUDIO);
954 audio_content->description); 954 } else {
955 UpdateLocalTracks(audio_desc->streams(), audio_desc->type()); 955 const cricket::AudioContentDescription* audio_desc =
956 static_cast<const cricket::AudioContentDescription*>(
957 audio_content->description);
958 UpdateLocalTracks(audio_desc->streams(), audio_desc->type());
959 }
956 } 960 }
957 961
958 const cricket::ContentInfo* video_content = 962 const cricket::ContentInfo* video_content =
959 GetFirstVideoContent(desc->description()); 963 GetFirstVideoContent(desc->description());
960 if (video_content) { 964 if (video_content) {
961 const cricket::VideoContentDescription* video_desc = 965 if (video_content->rejected) {
962 static_cast<const cricket::VideoContentDescription*>( 966 RemoveTracks(cricket::MEDIA_TYPE_VIDEO);
963 video_content->description); 967 } else {
964 UpdateLocalTracks(video_desc->streams(), video_desc->type()); 968 const cricket::VideoContentDescription* video_desc =
969 static_cast<const cricket::VideoContentDescription*>(
970 video_content->description);
971 UpdateLocalTracks(video_desc->streams(), video_desc->type());
972 }
965 } 973 }
966 974
967 const cricket::ContentInfo* data_content = 975 const cricket::ContentInfo* data_content =
968 GetFirstDataContent(desc->description()); 976 GetFirstDataContent(desc->description());
969 if (data_content) { 977 if (data_content) {
970 const cricket::DataContentDescription* data_desc = 978 const cricket::DataContentDescription* data_desc =
971 static_cast<const cricket::DataContentDescription*>( 979 static_cast<const cricket::DataContentDescription*>(
972 data_content->description); 980 data_content->description);
973 if (rtc::starts_with(data_desc->protocol().data(), 981 if (rtc::starts_with(data_desc->protocol().data(),
974 cricket::kMediaProtocolRtpPrefix)) { 982 cricket::kMediaProtocolRtpPrefix)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 const cricket::SessionDescription* remote_desc = desc->description(); 1024 const cricket::SessionDescription* remote_desc = desc->description();
1017 1025
1018 // We wait to signal new streams until we finish processing the description, 1026 // We wait to signal new streams until we finish processing the description,
1019 // since only at that point will new streams have all their tracks. 1027 // since only at that point will new streams have all their tracks.
1020 rtc::scoped_refptr<StreamCollection> new_streams(StreamCollection::Create()); 1028 rtc::scoped_refptr<StreamCollection> new_streams(StreamCollection::Create());
1021 1029
1022 // Find all audio rtp streams and create corresponding remote AudioTracks 1030 // Find all audio rtp streams and create corresponding remote AudioTracks
1023 // and MediaStreams. 1031 // and MediaStreams.
1024 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc); 1032 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc);
1025 if (audio_content) { 1033 if (audio_content) {
1026 const cricket::AudioContentDescription* desc = 1034 if (audio_content->rejected) {
1027 static_cast<const cricket::AudioContentDescription*>( 1035 RemoveTracks(cricket::MEDIA_TYPE_AUDIO);
1028 audio_content->description); 1036 } else {
1029 UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(), new_streams); 1037 const cricket::AudioContentDescription* desc =
1030 remote_info_.default_audio_track_needed = 1038 static_cast<const cricket::AudioContentDescription*>(
1031 !remote_desc->msid_supported() && desc->streams().empty() && 1039 audio_content->description);
1032 MediaContentDirectionHasSend(desc->direction()); 1040 UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(),
1041 new_streams);
1042 remote_info_.default_audio_track_needed =
1043 !remote_desc->msid_supported() && desc->streams().empty() &&
1044 MediaContentDirectionHasSend(desc->direction());
1045 }
1033 } 1046 }
1034 1047
1035 // Find all video rtp streams and create corresponding remote VideoTracks 1048 // Find all video rtp streams and create corresponding remote VideoTracks
1036 // and MediaStreams. 1049 // and MediaStreams.
1037 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc); 1050 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc);
1038 if (video_content) { 1051 if (video_content) {
1039 const cricket::VideoContentDescription* desc = 1052 if (video_content->rejected) {
1040 static_cast<const cricket::VideoContentDescription*>( 1053 RemoveTracks(cricket::MEDIA_TYPE_VIDEO);
1041 video_content->description); 1054 } else {
1042 UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(), new_streams); 1055 const cricket::VideoContentDescription* desc =
1043 remote_info_.default_video_track_needed = 1056 static_cast<const cricket::VideoContentDescription*>(
1044 !remote_desc->msid_supported() && desc->streams().empty() && 1057 video_content->description);
1045 MediaContentDirectionHasSend(desc->direction()); 1058 UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(),
1059 new_streams);
1060 remote_info_.default_video_track_needed =
1061 !remote_desc->msid_supported() && desc->streams().empty() &&
1062 MediaContentDirectionHasSend(desc->direction());
1063 }
1046 } 1064 }
1047 1065
1048 // Update the DataChannels with the information from the remote peer. 1066 // Update the DataChannels with the information from the remote peer.
1049 const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc); 1067 const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc);
1050 if (data_content) { 1068 if (data_content) {
1051 const cricket::DataContentDescription* desc = 1069 const cricket::DataContentDescription* desc =
1052 static_cast<const cricket::DataContentDescription*>( 1070 static_cast<const cricket::DataContentDescription*>(
1053 data_content->description); 1071 data_content->description);
1054 if (rtc::starts_with(desc->protocol().data(), 1072 if (rtc::starts_with(desc->protocol().data(),
1055 cricket::kMediaProtocolRtpPrefix)) { 1073 cricket::kMediaProtocolRtpPrefix)) {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 1444
1427 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams 1445 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams
1428 // are not signaled in the SDP so does not go through that path and must be 1446 // are not signaled in the SDP so does not go through that path and must be
1429 // handled here. 1447 // handled here.
1430 if (session_->data_channel_type() == cricket::DCT_SCTP) { 1448 if (session_->data_channel_type() == cricket::DCT_SCTP) {
1431 session_options->data_channel_type = cricket::DCT_SCTP; 1449 session_options->data_channel_type = cricket::DCT_SCTP;
1432 } 1450 }
1433 return true; 1451 return true;
1434 } 1452 }
1435 1453
1454 void PeerConnection::RemoveTracks(cricket::MediaType media_type) {
1455 UpdateLocalTracks(std::vector<cricket::StreamParams>(), media_type);
1456 UpdateRemoteStreamsList(std::vector<cricket::StreamParams>(), media_type,
1457 nullptr);
1458 }
1459
1436 void PeerConnection::UpdateRemoteStreamsList( 1460 void PeerConnection::UpdateRemoteStreamsList(
1437 const cricket::StreamParamsVec& streams, 1461 const cricket::StreamParamsVec& streams,
1438 cricket::MediaType media_type, 1462 cricket::MediaType media_type,
1439 StreamCollection* new_streams) { 1463 StreamCollection* new_streams) {
1440 TrackInfos* current_tracks = GetRemoteTracks(media_type); 1464 TrackInfos* current_tracks = GetRemoteTracks(media_type);
1441 1465
1442 // Find removed tracks. I.e., tracks where the track id or ssrc don't match 1466 // Find removed tracks. I.e., tracks where the track id or ssrc don't match
1443 // the 1467 // the
1444 // new StreamParam. 1468 // new StreamParam.
1445 auto track_it = current_tracks->begin(); 1469 auto track_it = current_tracks->begin();
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { 1990 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const {
1967 for (const auto& channel : sctp_data_channels_) { 1991 for (const auto& channel : sctp_data_channels_) {
1968 if (channel->id() == sid) { 1992 if (channel->id() == sid) {
1969 return channel; 1993 return channel;
1970 } 1994 }
1971 } 1995 }
1972 return nullptr; 1996 return nullptr;
1973 } 1997 }
1974 1998
1975 } // namespace webrtc 1999 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/peerconnection.h ('k') | talk/app/webrtc/peerconnection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698