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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/peerconnection.cc
diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc
index 0d519b280b9f77485e4e648cf1697274bbd448fa..192e09d9ed7793be9269602930ba02e761488ebe 100644
--- a/talk/app/webrtc/peerconnection.cc
+++ b/talk/app/webrtc/peerconnection.cc
@@ -949,19 +949,27 @@ void PeerConnection::SetLocalDescription(
const cricket::ContentInfo* audio_content =
GetFirstAudioContent(desc->description());
if (audio_content) {
- const cricket::AudioContentDescription* audio_desc =
- static_cast<const cricket::AudioContentDescription*>(
- audio_content->description);
- UpdateLocalTracks(audio_desc->streams(), audio_desc->type());
+ if (audio_content->rejected) {
+ RemoveTracks(cricket::MEDIA_TYPE_AUDIO);
+ } else {
+ const cricket::AudioContentDescription* audio_desc =
+ static_cast<const cricket::AudioContentDescription*>(
+ audio_content->description);
+ UpdateLocalTracks(audio_desc->streams(), audio_desc->type());
+ }
}
const cricket::ContentInfo* video_content =
GetFirstVideoContent(desc->description());
if (video_content) {
- const cricket::VideoContentDescription* video_desc =
- static_cast<const cricket::VideoContentDescription*>(
- video_content->description);
- UpdateLocalTracks(video_desc->streams(), video_desc->type());
+ if (video_content->rejected) {
+ RemoveTracks(cricket::MEDIA_TYPE_VIDEO);
+ } else {
+ const cricket::VideoContentDescription* video_desc =
+ static_cast<const cricket::VideoContentDescription*>(
+ video_content->description);
+ UpdateLocalTracks(video_desc->streams(), video_desc->type());
+ }
}
const cricket::ContentInfo* data_content =
@@ -1023,26 +1031,36 @@ void PeerConnection::SetRemoteDescription(
// and MediaStreams.
const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc);
if (audio_content) {
- const cricket::AudioContentDescription* desc =
- static_cast<const cricket::AudioContentDescription*>(
- audio_content->description);
- UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(), new_streams);
- remote_info_.default_audio_track_needed =
- !remote_desc->msid_supported() && desc->streams().empty() &&
- MediaContentDirectionHasSend(desc->direction());
+ if (audio_content->rejected) {
+ RemoveTracks(cricket::MEDIA_TYPE_AUDIO);
+ } else {
+ const cricket::AudioContentDescription* desc =
+ static_cast<const cricket::AudioContentDescription*>(
+ audio_content->description);
+ UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(),
+ new_streams);
+ remote_info_.default_audio_track_needed =
+ !remote_desc->msid_supported() && desc->streams().empty() &&
+ MediaContentDirectionHasSend(desc->direction());
+ }
}
// Find all video rtp streams and create corresponding remote VideoTracks
// and MediaStreams.
const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc);
if (video_content) {
- const cricket::VideoContentDescription* desc =
- static_cast<const cricket::VideoContentDescription*>(
- video_content->description);
- UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(), new_streams);
- remote_info_.default_video_track_needed =
- !remote_desc->msid_supported() && desc->streams().empty() &&
- MediaContentDirectionHasSend(desc->direction());
+ if (video_content->rejected) {
+ RemoveTracks(cricket::MEDIA_TYPE_VIDEO);
+ } else {
+ const cricket::VideoContentDescription* desc =
+ static_cast<const cricket::VideoContentDescription*>(
+ video_content->description);
+ UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(),
+ new_streams);
+ remote_info_.default_video_track_needed =
+ !remote_desc->msid_supported() && desc->streams().empty() &&
+ MediaContentDirectionHasSend(desc->direction());
+ }
}
// Update the DataChannels with the information from the remote peer.
@@ -1433,6 +1451,12 @@ bool PeerConnection::GetOptionsForAnswer(
return true;
}
+void PeerConnection::RemoveTracks(cricket::MediaType media_type) {
+ UpdateLocalTracks(std::vector<cricket::StreamParams>(), media_type);
+ UpdateRemoteStreamsList(std::vector<cricket::StreamParams>(), media_type,
+ nullptr);
+}
+
void PeerConnection::UpdateRemoteStreamsList(
const cricket::StreamParamsVec& streams,
cricket::MediaType media_type,
« 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