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

Unified Diff: talk/session/media/mediasession_unittest.cc

Issue 1286273003: Fixing problems with RTP extension ID conflict resolution (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding unit test Created 5 years, 4 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
« talk/session/media/mediasession.cc ('K') | « talk/session/media/mediasession.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/session/media/mediasession_unittest.cc
diff --git a/talk/session/media/mediasession_unittest.cc b/talk/session/media/mediasession_unittest.cc
index 7fd1d638239b0c07d75af73d227c709adde4ace3..f8b4798f3a42c23eceb9623277cec726ca546591 100644
--- a/talk/session/media/mediasession_unittest.cc
+++ b/talk/session/media/mediasession_unittest.cc
@@ -147,6 +147,11 @@ static const RtpHeaderExtension kAudioRtpExtension2[] = {
RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7),
};
+static const RtpHeaderExtension kAudioRtpExtension3[] = {
+ RtpHeaderExtension("http://google.com/testing/audio_something", 2),
+ RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 3),
+};
+
static const RtpHeaderExtension kAudioRtpExtensionAnswer[] = {
RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
};
@@ -162,6 +167,11 @@ static const RtpHeaderExtension kVideoRtpExtension2[] = {
RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7),
};
+static const RtpHeaderExtension kVideoRtpExtension3[] = {
+ RtpHeaderExtension("http://google.com/testing/video_something", 4),
+ RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 5),
+};
+
static const RtpHeaderExtension kVideoRtpExtensionAnswer[] = {
RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
};
@@ -1866,6 +1876,46 @@ TEST_F(MediaSessionDescriptionFactoryTest,
updated_vcd->rtp_header_extensions());
}
+// Verify that if the same RTP extension URI is used for audio and video, the
+// same ID is used. Also verify that the ID isn't changed when creating an
+// updated offer (this was previously a bug).
+TEST_F(MediaSessionDescriptionFactoryTest,
+ RtpHeaderExtensionIdReused) {
+ MediaSessionOptions opts;
+ opts.recv_audio = true;
+ opts.recv_video = true;
+
+ f1_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension3));
+ f1_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension3));
+
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+
+ // Since the audio extensions used ID 3 for "both_audio_and_video", so should
+ // the video extensions.
+ const RtpHeaderExtension kExpectedVideoRtpExtension[] = {
+ kVideoRtpExtension3[0],
+ kAudioRtpExtension3[1],
+ };
+
+ EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension3),
+ GetFirstAudioContentDescription(
+ offer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kExpectedVideoRtpExtension),
+ GetFirstVideoContentDescription(
+ offer.get())->rtp_header_extensions());
+
+ // Nothing should change when creating a new offer
+ rtc::scoped_ptr<SessionDescription> updated_offer(
+ f1_.CreateOffer(opts, offer.get()));
+
+ EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension3),
+ GetFirstAudioContentDescription(
+ updated_offer.get())->rtp_header_extensions());
+ EXPECT_EQ(MAKE_VECTOR(kExpectedVideoRtpExtension),
+ GetFirstVideoContentDescription(
+ updated_offer.get())->rtp_header_extensions());
+}
+
TEST(MediaSessionDescription, CopySessionDescription) {
SessionDescription source;
cricket::ContentGroup group(cricket::CN_AUDIO);
« talk/session/media/mediasession.cc ('K') | « talk/session/media/mediasession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698