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

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

Issue 1403173002: Don't create remote streams if m-line direction doesn't include "send". (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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/peerconnectioninterface_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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 // since only at that point will new streams have all their tracks. 1022 // since only at that point will new streams have all their tracks.
1023 rtc::scoped_refptr<StreamCollection> new_streams(StreamCollection::Create()); 1023 rtc::scoped_refptr<StreamCollection> new_streams(StreamCollection::Create());
1024 1024
1025 // Find all audio rtp streams and create corresponding remote AudioTracks 1025 // Find all audio rtp streams and create corresponding remote AudioTracks
1026 // and MediaStreams. 1026 // and MediaStreams.
1027 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc); 1027 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc);
1028 if (audio_content) { 1028 if (audio_content) {
1029 const cricket::AudioContentDescription* desc = 1029 const cricket::AudioContentDescription* desc =
1030 static_cast<const cricket::AudioContentDescription*>( 1030 static_cast<const cricket::AudioContentDescription*>(
1031 audio_content->description); 1031 audio_content->description);
1032 UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams); 1032 // If the direction is "recvonly" or "inactive", treat the description
1033 // as containing no streams.
1034 // See: https://code.google.com/p/webrtc/issues/detail?id=5054
1035 UpdateRemoteStreamsList(MediaContentDirectionHasSend(desc->direction())
1036 ? desc->streams()
1037 : std::vector<cricket::StreamParams>(),
pthatcher1 2015/10/15 05:46:49 Can you put this logic in a method called "GetActi
Taylor Brandstetter 2015/10/15 17:32:24 Done.
1038 desc->type(), new_streams);
1033 remote_info_.default_audio_track_needed = 1039 remote_info_.default_audio_track_needed =
1034 MediaContentDirectionHasSend(desc->direction()) && 1040 MediaContentDirectionHasSend(desc->direction()) &&
1035 desc->streams().empty(); 1041 desc->streams().empty();
1036 } 1042 }
1037 1043
1038 // Find all video rtp streams and create corresponding remote VideoTracks 1044 // Find all video rtp streams and create corresponding remote VideoTracks
1039 // and MediaStreams. 1045 // and MediaStreams.
1040 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc); 1046 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc);
1041 if (video_content) { 1047 if (video_content) {
1042 const cricket::VideoContentDescription* desc = 1048 const cricket::VideoContentDescription* desc =
1043 static_cast<const cricket::VideoContentDescription*>( 1049 static_cast<const cricket::VideoContentDescription*>(
1044 video_content->description); 1050 video_content->description);
1045 UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams); 1051 UpdateRemoteStreamsList(MediaContentDirectionHasSend(desc->direction())
1052 ? desc->streams()
1053 : std::vector<cricket::StreamParams>(),
1054 desc->type(), new_streams);
1046 remote_info_.default_video_track_needed = 1055 remote_info_.default_video_track_needed =
1047 MediaContentDirectionHasSend(desc->direction()) && 1056 MediaContentDirectionHasSend(desc->direction()) &&
1048 desc->streams().empty(); 1057 desc->streams().empty();
1049 } 1058 }
1050 1059
1051 // Update the DataChannels with the information from the remote peer. 1060 // Update the DataChannels with the information from the remote peer.
1052 const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc); 1061 const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc);
1053 if (data_content) { 1062 if (data_content) {
1054 const cricket::DataContentDescription* data_desc = 1063 const cricket::DataContentDescription* desc =
1055 static_cast<const cricket::DataContentDescription*>( 1064 static_cast<const cricket::DataContentDescription*>(
1056 data_content->description); 1065 data_content->description);
1057 if (rtc::starts_with(data_desc->protocol().data(), 1066 if (rtc::starts_with(desc->protocol().data(),
1058 cricket::kMediaProtocolRtpPrefix)) { 1067 cricket::kMediaProtocolRtpPrefix)) {
1059 UpdateRemoteRtpDataChannels(data_desc->streams()); 1068 UpdateRemoteRtpDataChannels(
1069 MediaContentDirectionHasSend(desc->direction())
1070 ? desc->streams()
1071 : std::vector<cricket::StreamParams>());
1060 } 1072 }
1061 } 1073 }
1062 1074
1063 // Iterate new_streams and notify the observer about new MediaStreams. 1075 // Iterate new_streams and notify the observer about new MediaStreams.
1064 for (size_t i = 0; i < new_streams->count(); ++i) { 1076 for (size_t i = 0; i < new_streams->count(); ++i) {
1065 MediaStreamInterface* new_stream = new_streams->at(i); 1077 MediaStreamInterface* new_stream = new_streams->at(i);
1066 stats_->AddStream(new_stream); 1078 stats_->AddStream(new_stream);
1067 observer_->OnAddStream(new_stream); 1079 observer_->OnAddStream(new_stream);
1068 } 1080 }
1069 1081
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { 1961 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const {
1950 for (const auto& channel : sctp_data_channels_) { 1962 for (const auto& channel : sctp_data_channels_) {
1951 if (channel->id() == sid) { 1963 if (channel->id() == sid) {
1952 return channel; 1964 return channel;
1953 } 1965 }
1954 } 1966 }
1955 return nullptr; 1967 return nullptr;
1956 } 1968 }
1957 1969
1958 } // namespace webrtc 1970 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698