diff options
author | jiayl@webrtc.org <jiayl@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-05-29 22:07:59 +0000 |
---|---|---|
committer | jiayl@webrtc.org <jiayl@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-05-29 22:07:59 +0000 |
commit | 8dcd43c4f71da88f75ca46ed5868eb8812e1d6f7 (patch) | |
tree | 10353a2eeac4887c0c72852502a001a35b35dfdd /talk/session/media/mediasession.cc | |
parent | abe01dd634cd92245b7836e687de0f6e7c0723b9 (diff) | |
download | webrtc-8dcd43c4f71da88f75ca46ed5868eb8812e1d6f7.tar.gz |
Make MediaSessionDescriptionFactory accept offers with UDP/TLS/RTP/SAVPF.
This is the first step toward switching completely to UDP/TLS/RTP/SAVPF.
BUG=2796
R=juberti@webrtc.org, pthatcher@google.com
Review URL: https://webrtc-codereview.appspot.com/13439004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6276 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'talk/session/media/mediasession.cc')
-rw-r--r-- | talk/session/media/mediasession.cc | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/talk/session/media/mediasession.cc b/talk/session/media/mediasession.cc index 8219ec8844..006975f931 100644 --- a/talk/session/media/mediasession.cc +++ b/talk/session/media/mediasession.cc @@ -62,6 +62,10 @@ using talk_base::scoped_ptr; // RFC4585 const char kMediaProtocolAvpf[] = "RTP/AVPF"; // RFC5124 +const char kMediaProtocolDtlsSavpf[] = "UDP/TLS/RTP/SAVPF"; + +// This should be replaced by "UDP/TLS/RTP/SAVPF", but we need to support it for +// now to be compatible with previous Chrome versions. const char kMediaProtocolSavpf[] = "RTP/SAVPF"; const char kMediaProtocolRtpPrefix[] = "RTP/"; @@ -987,17 +991,20 @@ static bool CreateMediaContentAnswer( } static bool IsMediaProtocolSupported(MediaType type, - const std::string& protocol) { + const std::string& protocol, + bool secure_transport) { // Data channels can have a protocol of SCTP or SCTP/DTLS. if (type == MEDIA_TYPE_DATA && - (protocol == kMediaProtocolSctp || - protocol == kMediaProtocolDtlsSctp)) { + ((protocol == kMediaProtocolSctp && !secure_transport)|| + (protocol == kMediaProtocolDtlsSctp && secure_transport))) { return true; } + // Since not all applications serialize and deserialize the media protocol, // we will have to accept |protocol| to be empty. - return protocol == kMediaProtocolAvpf || protocol == kMediaProtocolSavpf || - protocol.empty(); + return protocol == kMediaProtocolAvpf || protocol.empty() || + protocol == kMediaProtocolSavpf || + (protocol == kMediaProtocolDtlsSavpf && secure_transport); } static void SetMediaProtocol(bool secure_transport, @@ -1337,8 +1344,9 @@ SessionDescription* MediaSessionDescriptionFactory::CreateAnswer( } bool rejected = !options.has_audio || audio_content->rejected || - !IsMediaProtocolSupported(MEDIA_TYPE_AUDIO, - audio_answer->protocol()); + !IsMediaProtocolSupported(MEDIA_TYPE_AUDIO, + audio_answer->protocol(), + audio_transport->secure()); if (!rejected) { AddTransportAnswer(audio_content->name, *(audio_transport.get()), answer.get()); @@ -1385,7 +1393,9 @@ SessionDescription* MediaSessionDescriptionFactory::CreateAnswer( return NULL; } bool rejected = !options.has_video || video_content->rejected || - !IsMediaProtocolSupported(MEDIA_TYPE_VIDEO, video_answer->protocol()); + !IsMediaProtocolSupported(MEDIA_TYPE_VIDEO, + video_answer->protocol(), + video_transport->secure()); if (!rejected) { if (!AddTransportAnswer(video_content->name, *(video_transport.get()), answer.get())) { @@ -1438,7 +1448,9 @@ SessionDescription* MediaSessionDescriptionFactory::CreateAnswer( } bool rejected = !options.has_data() || data_content->rejected || - !IsMediaProtocolSupported(MEDIA_TYPE_DATA, data_answer->protocol()); + !IsMediaProtocolSupported(MEDIA_TYPE_DATA, + data_answer->protocol(), + data_transport->secure()); if (!rejected) { data_answer->set_bandwidth(options.data_bandwidth); if (!AddTransportAnswer(data_content->name, *(data_transport.get()), |