Index: talk/session/media/mediasession.cc |
diff --git a/talk/session/media/mediasession.cc b/talk/session/media/mediasession.cc |
index ed626e2f3478b99d432e8a4a9ddcfdcc61d01162..0e9730ce2babb4bf11145aa093b225f65cb57650 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."); |