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

Unified Diff: webrtc/pc/mediasession_unittest.cc

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: Created 3 years, 9 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
Index: webrtc/pc/mediasession_unittest.cc
diff --git a/webrtc/pc/mediasession_unittest.cc b/webrtc/pc/mediasession_unittest.cc
index 7fe4b51fa8b0f7775040534e973cb8e357b1fbd2..8134a64b5587b43d43937dba2836618b3848a7ea 100644
--- a/webrtc/pc/mediasession_unittest.cc
+++ b/webrtc/pc/mediasession_unittest.cc
@@ -112,6 +112,12 @@ static const RtpExtension kAudioRtpExtension1[] = {
RtpExtension("http://google.com/testing/audio_something", 10),
};
+static const RtpExtension kAudioRtpExtensionEncrypted1[] = {
+ RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
+ RtpExtension("http://google.com/testing/audio_something", 10),
+ RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 12, true),
+};
+
static const RtpExtension kAudioRtpExtension2[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2),
RtpExtension("http://google.com/testing/audio_something_else", 8),
@@ -127,11 +133,21 @@ static const RtpExtension kAudioRtpExtensionAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
};
+static const RtpExtension kAudioRtpExtensionEncryptedAnswer[] = {
+ RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 12, true),
+};
+
static const RtpExtension kVideoRtpExtension1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
RtpExtension("http://google.com/testing/video_something", 13),
};
+static const RtpExtension kVideoRtpExtensionEncrypted1[] = {
+ RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
+ RtpExtension("http://google.com/testing/video_something", 13),
+ RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 11, true),
+};
+
static const RtpExtension kVideoRtpExtension2[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 2),
RtpExtension("http://google.com/testing/video_something_else", 14),
@@ -147,6 +163,10 @@ static const RtpExtension kVideoRtpExtensionAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
};
+static const RtpExtension kVideoRtpExtensionEncryptedAnswer[] = {
+ RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 11, true),
+};
+
static const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31};
static const uint32_t kSimSsrc[] = {10, 20, 30};
static const uint32_t kFec1Ssrc[] = {10, 11};
@@ -1153,6 +1173,112 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestOfferAnswerWithRtpExtensions) {
answer.get())->rtp_header_extensions());
}
+TEST_F(MediaSessionDescriptionFactoryTest,
+ TestOfferAnswerWithEncryptedRtpExtensionsBoth) {
+ MediaSessionOptions opts;
+ opts.recv_video = true;
+
+ f1_.set_enable_rtp_header_encryption(true);
+ f2_.set_enable_rtp_header_encryption(true);
+
+ f1_.set_audio_rtp_header_extensions(
+ MAKE_VECTOR(kAudioRtpExtension1));
+ f1_.set_video_rtp_header_extensions(
+ MAKE_VECTOR(kVideoRtpExtension1));
+ f2_.set_audio_rtp_header_extensions(
+ MAKE_VECTOR(kAudioRtpExtension2));
+ f2_.set_video_rtp_header_extensions(
+ MAKE_VECTOR(kVideoRtpExtension2));
+
+ std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ ASSERT_TRUE(offer.get() != NULL);
+ std::unique_ptr<SessionDescription> answer(
+ f2_.CreateAnswer(offer.get(), opts, NULL));
+
+ EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionEncrypted1),
+ GetFirstAudioContentDescription(
+ offer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionEncrypted1),
+ GetFirstVideoContentDescription(
+ offer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionEncryptedAnswer),
+ GetFirstAudioContentDescription(
+ answer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionEncryptedAnswer),
+ GetFirstVideoContentDescription(
+ answer.get())->rtp_header_extensions());
+}
+
+TEST_F(MediaSessionDescriptionFactoryTest,
+ TestOfferAnswerWithEncryptedRtpExtensionsOffer) {
+ MediaSessionOptions opts;
+ opts.recv_video = true;
+
+ f1_.set_enable_rtp_header_encryption(true);
+
+ f1_.set_audio_rtp_header_extensions(
+ MAKE_VECTOR(kAudioRtpExtension1));
+ f1_.set_video_rtp_header_extensions(
+ MAKE_VECTOR(kVideoRtpExtension1));
+ f2_.set_audio_rtp_header_extensions(
+ MAKE_VECTOR(kAudioRtpExtension2));
+ f2_.set_video_rtp_header_extensions(
+ MAKE_VECTOR(kVideoRtpExtension2));
+
+ std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ ASSERT_TRUE(offer.get() != NULL);
+ std::unique_ptr<SessionDescription> answer(
+ f2_.CreateAnswer(offer.get(), opts, NULL));
+
+ EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionEncrypted1),
+ GetFirstAudioContentDescription(
+ offer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionEncrypted1),
+ GetFirstVideoContentDescription(
+ offer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionAnswer),
+ GetFirstAudioContentDescription(
+ answer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionAnswer),
+ GetFirstVideoContentDescription(
+ answer.get())->rtp_header_extensions());
+}
+
+TEST_F(MediaSessionDescriptionFactoryTest,
+ TestOfferAnswerWithEncryptedRtpExtensionsAnswer) {
+ MediaSessionOptions opts;
+ opts.recv_video = true;
+
+ f2_.set_enable_rtp_header_encryption(true);
+
+ f1_.set_audio_rtp_header_extensions(
+ MAKE_VECTOR(kAudioRtpExtension1));
+ f1_.set_video_rtp_header_extensions(
+ MAKE_VECTOR(kVideoRtpExtension1));
+ f2_.set_audio_rtp_header_extensions(
+ MAKE_VECTOR(kAudioRtpExtension2));
+ f2_.set_video_rtp_header_extensions(
+ MAKE_VECTOR(kVideoRtpExtension2));
+
+ std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ ASSERT_TRUE(offer.get() != NULL);
+ std::unique_ptr<SessionDescription> answer(
+ f2_.CreateAnswer(offer.get(), opts, NULL));
+
+ EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension1),
+ GetFirstAudioContentDescription(
+ offer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtension1),
+ GetFirstVideoContentDescription(
+ offer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionAnswer),
+ GetFirstAudioContentDescription(
+ answer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionAnswer),
+ GetFirstVideoContentDescription(
+ answer.get())->rtp_header_extensions());
+}
+
// Create an audio, video, data answer without legacy StreamParams.
TEST_F(MediaSessionDescriptionFactoryTest,
TestCreateAnswerWithoutLegacyStreams) {

Powered by Google App Engine
This is Rietveld 408576698