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

Unified 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: Formatting. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | talk/app/webrtc/peerconnectioninterface_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 e7b33c43acdbd917ad549aac93df2611fd818475..b3c8b8769752700defbf66a802f422becbe207d6 100644
--- a/talk/app/webrtc/peerconnection.cc
+++ b/talk/app/webrtc/peerconnection.cc
@@ -348,6 +348,16 @@ bool MediaContentDirectionHasSend(cricket::MediaContentDirection dir) {
return dir == cricket::MD_SENDONLY || dir == cricket::MD_SENDRECV;
}
+// If the direction is "recvonly" or "inactive", treat the description
+// as containing no streams.
+// See: https://code.google.com/p/webrtc/issues/detail?id=5054
+std::vector<cricket::StreamParams> GetActiveStreams(
+ const cricket::MediaContentDescription* desc) {
+ return MediaContentDirectionHasSend(desc->direction())
+ ? desc->streams()
+ : std::vector<cricket::StreamParams>();
+}
+
bool IsValidOfferToReceiveMedia(int value) {
typedef PeerConnectionInterface::RTCOfferAnswerOptions Options;
return (value >= Options::kUndefined) &&
@@ -1029,7 +1039,7 @@ void PeerConnection::SetRemoteDescription(
const cricket::AudioContentDescription* desc =
static_cast<const cricket::AudioContentDescription*>(
audio_content->description);
- UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams);
+ UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(), new_streams);
remote_info_.default_audio_track_needed =
MediaContentDirectionHasSend(desc->direction()) &&
desc->streams().empty();
@@ -1042,7 +1052,7 @@ void PeerConnection::SetRemoteDescription(
const cricket::VideoContentDescription* desc =
static_cast<const cricket::VideoContentDescription*>(
video_content->description);
- UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams);
+ UpdateRemoteStreamsList(GetActiveStreams(desc), desc->type(), new_streams);
remote_info_.default_video_track_needed =
MediaContentDirectionHasSend(desc->direction()) &&
desc->streams().empty();
@@ -1051,12 +1061,12 @@ void PeerConnection::SetRemoteDescription(
// Update the DataChannels with the information from the remote peer.
const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc);
if (data_content) {
- const cricket::DataContentDescription* data_desc =
+ const cricket::DataContentDescription* desc =
static_cast<const cricket::DataContentDescription*>(
data_content->description);
- if (rtc::starts_with(data_desc->protocol().data(),
+ if (rtc::starts_with(desc->protocol().data(),
cricket::kMediaProtocolRtpPrefix)) {
- UpdateRemoteRtpDataChannels(data_desc->streams());
+ UpdateRemoteRtpDataChannels(GetActiveStreams(desc));
}
}
« 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