diff options
author | deadbeef <deadbeef@webrtc.org> | 2015-11-23 16:39:12 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-24 00:39:18 +0000 |
commit | b5cb19b37c361a263a9cec2e2fb356d16520afd1 (patch) | |
tree | 1610f4e117281d1b7c9b9ca33b3f8a14501b709c /talk/session/media/mediasession.cc | |
parent | 05816eb8d7ec4fe6877339ba5b9fc6412364e436 (diff) | |
download | webrtc-b5cb19b37c361a263a9cec2e2fb356d16520afd1.tar.gz |
Fixing direction attribute in answer for non-RTP protocols.
"non-RTP protocols" refers to SCTP data channels. Because
there are no streams for SCTP data channels, the answer was being
set to RECVONLY.
BUG=webrtc:5228
Review URL: https://codereview.webrtc.org/1473013002
Cr-Commit-Position: refs/heads/master@{#10762}
Diffstat (limited to 'talk/session/media/mediasession.cc')
-rw-r--r-- | talk/session/media/mediasession.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/talk/session/media/mediasession.cc b/talk/session/media/mediasession.cc index ed626e2f34..0e9730ce2b 100644 --- a/talk/session/media/mediasession.cc +++ b/talk/session/media/mediasession.cc @@ -633,6 +633,11 @@ static void PruneCryptos(const CryptoParamsVec& filter, target_cryptos->end()); } +static bool IsRtpProtocol(const std::string& protocol) { + return protocol.empty() || + (protocol.find(cricket::kMediaProtocolRtpPrefix) != std::string::npos); +} + static bool IsRtpContent(SessionDescription* sdesc, const std::string& content_name) { bool is_rtp = false; @@ -643,9 +648,7 @@ static bool IsRtpContent(SessionDescription* sdesc, if (!media_desc) { return false; } - is_rtp = media_desc->protocol().empty() || - (media_desc->protocol().find(cricket::kMediaProtocolRtpPrefix) != - std::string::npos); + is_rtp = IsRtpProtocol(media_desc->protocol()); } return is_rtp; } @@ -1067,12 +1070,16 @@ static bool CreateMediaContentAnswer( answer->set_direction(MD_RECVONLY); break; case MD_RECVONLY: - answer->set_direction(answer->streams().empty() ? MD_INACTIVE - : MD_SENDONLY); + answer->set_direction(IsRtpProtocol(answer->protocol()) && + answer->streams().empty() + ? MD_INACTIVE + : MD_SENDONLY); break; case MD_SENDRECV: - answer->set_direction(answer->streams().empty() ? MD_RECVONLY - : MD_SENDRECV); + answer->set_direction(IsRtpProtocol(answer->protocol()) && + answer->streams().empty() + ? MD_RECVONLY + : MD_SENDRECV); break; default: RTC_DCHECK(false && "MediaContentDescription has unexpected direction."); |