summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/libjingle/source/talk/session/media/mediasession_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libjingle/source/talk/session/media/mediasession_unittest.cc')
-rw-r--r--chromium/third_party/libjingle/source/talk/session/media/mediasession_unittest.cc104
1 files changed, 97 insertions, 7 deletions
diff --git a/chromium/third_party/libjingle/source/talk/session/media/mediasession_unittest.cc b/chromium/third_party/libjingle/source/talk/session/media/mediasession_unittest.cc
index 0e645667162..cf492a65ee1 100644
--- a/chromium/third_party/libjingle/source/talk/session/media/mediasession_unittest.cc
+++ b/chromium/third_party/libjingle/source/talk/session/media/mediasession_unittest.cc
@@ -41,12 +41,12 @@
#ifdef HAVE_SRTP
#define ASSERT_CRYPTO(cd, s, cs) \
- ASSERT_FALSE(cd->crypto_required()); \
+ ASSERT_EQ(cricket::CT_NONE, cd->crypto_required()); \
ASSERT_EQ(s, cd->cryptos().size()); \
ASSERT_EQ(std::string(cs), cd->cryptos()[0].cipher_suite)
#else
#define ASSERT_CRYPTO(cd, s, cs) \
- ASSERT_FALSE(cd->crypto_required()); \
+ ASSERT_EQ(cricket::CT_NONE, cd->crypto_required()); \
ASSERT_EQ(0U, cd->cryptos().size());
#endif
@@ -143,6 +143,7 @@ static const RtpHeaderExtension kAudioRtpExtension1[] = {
static const RtpHeaderExtension kAudioRtpExtension2[] = {
RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2),
RtpHeaderExtension("http://google.com/testing/audio_something_else", 8),
+ RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7),
};
static const RtpHeaderExtension kAudioRtpExtensionAnswer[] = {
@@ -151,18 +152,21 @@ static const RtpHeaderExtension kAudioRtpExtensionAnswer[] = {
static const RtpHeaderExtension kVideoRtpExtension1[] = {
RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
- RtpHeaderExtension("http://google.com/testing/video_something", 15),
+ RtpHeaderExtension("http://google.com/testing/video_something", 13),
};
static const RtpHeaderExtension kVideoRtpExtension2[] = {
RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 2),
RtpHeaderExtension("http://google.com/testing/video_something_else", 14),
+ RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7),
};
static const RtpHeaderExtension kVideoRtpExtensionAnswer[] = {
RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
};
+static const uint32 kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31};
+static const uint32 kSimSsrc[] = {10, 20, 30};
static const uint32 kFec1Ssrc[] = {10, 11};
static const uint32 kFec2Ssrc[] = {20, 21};
static const uint32 kFec3Ssrc[] = {30, 31};
@@ -192,6 +196,32 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
tdf2_.set_identity(&id2_);
}
+ // Create a video StreamParamsVec object with:
+ // - one video stream with 3 simulcast streams and FEC,
+ StreamParamsVec CreateComplexVideoStreamParamsVec() {
+ SsrcGroup sim_group("SIM", MAKE_VECTOR(kSimSsrc));
+ SsrcGroup fec_group1("FEC", MAKE_VECTOR(kFec1Ssrc));
+ SsrcGroup fec_group2("FEC", MAKE_VECTOR(kFec2Ssrc));
+ SsrcGroup fec_group3("FEC", MAKE_VECTOR(kFec3Ssrc));
+
+ std::vector<SsrcGroup> ssrc_groups;
+ ssrc_groups.push_back(sim_group);
+ ssrc_groups.push_back(fec_group1);
+ ssrc_groups.push_back(fec_group2);
+ ssrc_groups.push_back(fec_group3);
+
+ StreamParams simulcast_params;
+ simulcast_params.id = kVideoTrack1;
+ simulcast_params.ssrcs = MAKE_VECTOR(kSimulcastParamsSsrc);
+ simulcast_params.ssrc_groups = ssrc_groups;
+ simulcast_params.cname = "Video_SIM_FEC";
+ simulcast_params.sync_label = kMediaStream1;
+
+ StreamParamsVec video_streams;
+ video_streams.push_back(simulcast_params);
+
+ return video_streams;
+ }
bool CompareCryptoParams(const CryptoParamsVec& c1,
const CryptoParamsVec& c2) {
@@ -1588,17 +1618,19 @@ TEST_F(MediaSessionDescriptionFactoryTest,
// extensions from the first offer/answer exchange plus the extensions only
// |f2_| offer.
// Since the default local extension id |f2_| uses has already been used by
- // |f1_| for another extensions, it is changed to 255.
+ // |f1_| for another extensions, it is changed to 13.
const RtpHeaderExtension kUpdatedAudioRtpExtensions[] = {
kAudioRtpExtensionAnswer[0],
- RtpHeaderExtension(kAudioRtpExtension2[1].uri, 255),
+ RtpHeaderExtension(kAudioRtpExtension2[1].uri, 13),
+ kAudioRtpExtension2[2],
};
// Since the default local extension id |f2_| uses has already been used by
- // |f1_| for another extensions, is is changed to 254.
+ // |f1_| for another extensions, is is changed to 12.
const RtpHeaderExtension kUpdatedVideoRtpExtensions[] = {
kVideoRtpExtensionAnswer[0],
- RtpHeaderExtension(kVideoRtpExtension2[1].uri, 254),
+ RtpHeaderExtension(kVideoRtpExtension2[1].uri, 12),
+ kVideoRtpExtension2[2],
};
const AudioContentDescription* updated_acd =
@@ -1756,6 +1788,64 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoWithAnswerBundle) {
TestCryptoWithBundle(false);
}
+// Verifies that creating answer fails if the offer has UDP/TLS/RTP/SAVPF but
+// DTLS is not enabled locally.
+TEST_F(MediaSessionDescriptionFactoryTest,
+ TestOfferDtlsSavpfWithoutDtlsFailed) {
+ f1_.set_secure(SEC_ENABLED);
+ f2_.set_secure(SEC_ENABLED);
+ tdf1_.set_secure(SEC_DISABLED);
+ tdf2_.set_secure(SEC_DISABLED);
+
+ talk_base::scoped_ptr<SessionDescription> offer(
+ f1_.CreateOffer(MediaSessionOptions(), NULL));
+ ASSERT_TRUE(offer.get() != NULL);
+ ContentInfo* offer_content = offer->GetContentByName("audio");
+ ASSERT_TRUE(offer_content != NULL);
+ AudioContentDescription* offer_audio_desc =
+ static_cast<AudioContentDescription*>(offer_content->description);
+ offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
+
+ talk_base::scoped_ptr<SessionDescription> answer(
+ f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
+ ASSERT_TRUE(answer != NULL);
+ ContentInfo* answer_content = answer->GetContentByName("audio");
+ ASSERT_TRUE(answer_content != NULL);
+
+ ASSERT_TRUE(answer_content->rejected);
+}
+
+// Offers UDP/TLS/RTP/SAVPF and verifies the answer can be created and contains
+// UDP/TLS/RTP/SAVPF.
+TEST_F(MediaSessionDescriptionFactoryTest, TestOfferDtlsSavpfCreateAnswer) {
+ f1_.set_secure(SEC_ENABLED);
+ f2_.set_secure(SEC_ENABLED);
+ tdf1_.set_secure(SEC_ENABLED);
+ tdf2_.set_secure(SEC_ENABLED);
+
+ talk_base::scoped_ptr<SessionDescription> offer(
+ f1_.CreateOffer(MediaSessionOptions(), NULL));
+ ASSERT_TRUE(offer.get() != NULL);
+ ContentInfo* offer_content = offer->GetContentByName("audio");
+ ASSERT_TRUE(offer_content != NULL);
+ AudioContentDescription* offer_audio_desc =
+ static_cast<AudioContentDescription*>(offer_content->description);
+ offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
+
+ talk_base::scoped_ptr<SessionDescription> answer(
+ f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
+ ASSERT_TRUE(answer != NULL);
+
+ const ContentInfo* answer_content = answer->GetContentByName("audio");
+ ASSERT_TRUE(answer_content != NULL);
+ ASSERT_FALSE(answer_content->rejected);
+
+ const AudioContentDescription* answer_audio_desc =
+ static_cast<const AudioContentDescription*>(answer_content->description);
+ EXPECT_EQ(std::string(cricket::kMediaProtocolDtlsSavpf),
+ answer_audio_desc->protocol());
+}
+
// Test that we include both SDES and DTLS in the offer, but only include SDES
// in the answer if DTLS isn't negotiated.
TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoDtls) {