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

Side by Side Diff: webrtc/pc/mediasession_unittest.cc

Issue 1984983002: Remove use of RtpHeaderExtension and clean up (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed nit Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 using cricket::GetFirstVideoContentDescription; 60 using cricket::GetFirstVideoContentDescription;
61 using cricket::GetFirstDataContentDescription; 61 using cricket::GetFirstDataContentDescription;
62 using cricket::kAutoBandwidth; 62 using cricket::kAutoBandwidth;
63 using cricket::AudioCodec; 63 using cricket::AudioCodec;
64 using cricket::VideoCodec; 64 using cricket::VideoCodec;
65 using cricket::DataCodec; 65 using cricket::DataCodec;
66 using cricket::NS_JINGLE_RTP; 66 using cricket::NS_JINGLE_RTP;
67 using cricket::MEDIA_TYPE_AUDIO; 67 using cricket::MEDIA_TYPE_AUDIO;
68 using cricket::MEDIA_TYPE_VIDEO; 68 using cricket::MEDIA_TYPE_VIDEO;
69 using cricket::MEDIA_TYPE_DATA; 69 using cricket::MEDIA_TYPE_DATA;
70 using cricket::RtpHeaderExtension;
71 using cricket::SEC_DISABLED; 70 using cricket::SEC_DISABLED;
72 using cricket::SEC_ENABLED; 71 using cricket::SEC_ENABLED;
73 using cricket::SEC_REQUIRED; 72 using cricket::SEC_REQUIRED;
74 using rtc::CS_AES_CM_128_HMAC_SHA1_32; 73 using rtc::CS_AES_CM_128_HMAC_SHA1_32;
75 using rtc::CS_AES_CM_128_HMAC_SHA1_80; 74 using rtc::CS_AES_CM_128_HMAC_SHA1_80;
75 using webrtc::RtpExtension;
76 76
77 static const AudioCodec kAudioCodecs1[] = { 77 static const AudioCodec kAudioCodecs1[] = {
78 AudioCodec(103, "ISAC", 16000, -1, 1), 78 AudioCodec(103, "ISAC", 16000, -1, 1),
79 AudioCodec(102, "iLBC", 8000, 13300, 1), 79 AudioCodec(102, "iLBC", 8000, 13300, 1),
80 AudioCodec(0, "PCMU", 8000, 64000, 1), 80 AudioCodec(0, "PCMU", 8000, 64000, 1),
81 AudioCodec(8, "PCMA", 8000, 64000, 1), 81 AudioCodec(8, "PCMA", 8000, 64000, 1),
82 AudioCodec(117, "red", 8000, 0, 1), 82 AudioCodec(117, "red", 8000, 0, 1),
83 AudioCodec(107, "CN", 48000, 0, 1)}; 83 AudioCodec(107, "CN", 48000, 0, 1)};
84 84
85 static const AudioCodec kAudioCodecs2[] = { 85 static const AudioCodec kAudioCodecs2[] = {
(...skipping 20 matching lines...) Expand all
106 106
107 static const DataCodec kDataCodecs1[] = {DataCodec(98, "binary-data"), 107 static const DataCodec kDataCodecs1[] = {DataCodec(98, "binary-data"),
108 DataCodec(99, "utf8-text")}; 108 DataCodec(99, "utf8-text")};
109 109
110 static const DataCodec kDataCodecs2[] = {DataCodec(126, "binary-data"), 110 static const DataCodec kDataCodecs2[] = {DataCodec(126, "binary-data"),
111 DataCodec(127, "utf8-text")}; 111 DataCodec(127, "utf8-text")};
112 112
113 static const DataCodec kDataCodecsAnswer[] = {DataCodec(98, "binary-data"), 113 static const DataCodec kDataCodecsAnswer[] = {DataCodec(98, "binary-data"),
114 DataCodec(99, "utf8-text")}; 114 DataCodec(99, "utf8-text")};
115 115
116 static const RtpHeaderExtension kAudioRtpExtension1[] = { 116 static const RtpExtension kAudioRtpExtension1[] = {
117 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), 117 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
118 RtpHeaderExtension("http://google.com/testing/audio_something", 10), 118 RtpExtension("http://google.com/testing/audio_something", 10),
119 }; 119 };
120 120
121 static const RtpHeaderExtension kAudioRtpExtension2[] = { 121 static const RtpExtension kAudioRtpExtension2[] = {
122 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2), 122 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2),
123 RtpHeaderExtension("http://google.com/testing/audio_something_else", 8), 123 RtpExtension("http://google.com/testing/audio_something_else", 8),
124 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7), 124 RtpExtension("http://google.com/testing/both_audio_and_video", 7),
125 }; 125 };
126 126
127 static const RtpHeaderExtension kAudioRtpExtension3[] = { 127 static const RtpExtension kAudioRtpExtension3[] = {
128 RtpHeaderExtension("http://google.com/testing/audio_something", 2), 128 RtpExtension("http://google.com/testing/audio_something", 2),
129 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 3), 129 RtpExtension("http://google.com/testing/both_audio_and_video", 3),
130 }; 130 };
131 131
132 static const RtpHeaderExtension kAudioRtpExtensionAnswer[] = { 132 static const RtpExtension kAudioRtpExtensionAnswer[] = {
133 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), 133 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
134 }; 134 };
135 135
136 static const RtpHeaderExtension kVideoRtpExtension1[] = { 136 static const RtpExtension kVideoRtpExtension1[] = {
137 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14), 137 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
138 RtpHeaderExtension("http://google.com/testing/video_something", 13), 138 RtpExtension("http://google.com/testing/video_something", 13),
139 }; 139 };
140 140
141 static const RtpHeaderExtension kVideoRtpExtension2[] = { 141 static const RtpExtension kVideoRtpExtension2[] = {
142 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 2), 142 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 2),
143 RtpHeaderExtension("http://google.com/testing/video_something_else", 14), 143 RtpExtension("http://google.com/testing/video_something_else", 14),
144 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7), 144 RtpExtension("http://google.com/testing/both_audio_and_video", 7),
145 }; 145 };
146 146
147 static const RtpHeaderExtension kVideoRtpExtension3[] = { 147 static const RtpExtension kVideoRtpExtension3[] = {
148 RtpHeaderExtension("http://google.com/testing/video_something", 4), 148 RtpExtension("http://google.com/testing/video_something", 4),
149 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 5), 149 RtpExtension("http://google.com/testing/both_audio_and_video", 5),
150 }; 150 };
151 151
152 static const RtpHeaderExtension kVideoRtpExtensionAnswer[] = { 152 static const RtpExtension kVideoRtpExtensionAnswer[] = {
153 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14), 153 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
154 }; 154 };
155 155
156 static const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31}; 156 static const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31};
157 static const uint32_t kSimSsrc[] = {10, 20, 30}; 157 static const uint32_t kSimSsrc[] = {10, 20, 30};
158 static const uint32_t kFec1Ssrc[] = {10, 11}; 158 static const uint32_t kFec1Ssrc[] = {10, 11};
159 static const uint32_t kFec2Ssrc[] = {20, 21}; 159 static const uint32_t kFec2Ssrc[] = {20, 21};
160 static const uint32_t kFec3Ssrc[] = {30, 31}; 160 static const uint32_t kFec3Ssrc[] = {30, 31};
161 161
162 static const char kMediaStream1[] = "stream_1"; 162 static const char kMediaStream1[] = "stream_1";
163 static const char kMediaStream2[] = "stream_2"; 163 static const char kMediaStream2[] = "stream_2";
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 answer.get())->rtp_header_extensions()); 1897 answer.get())->rtp_header_extensions());
1898 1898
1899 std::unique_ptr<SessionDescription> updated_offer( 1899 std::unique_ptr<SessionDescription> updated_offer(
1900 f2_.CreateOffer(opts, answer.get())); 1900 f2_.CreateOffer(opts, answer.get()));
1901 1901
1902 // The expected RTP header extensions in the new offer are the resulting 1902 // The expected RTP header extensions in the new offer are the resulting
1903 // extensions from the first offer/answer exchange plus the extensions only 1903 // extensions from the first offer/answer exchange plus the extensions only
1904 // |f2_| offer. 1904 // |f2_| offer.
1905 // Since the default local extension id |f2_| uses has already been used by 1905 // Since the default local extension id |f2_| uses has already been used by
1906 // |f1_| for another extensions, it is changed to 13. 1906 // |f1_| for another extensions, it is changed to 13.
1907 const RtpHeaderExtension kUpdatedAudioRtpExtensions[] = { 1907 const RtpExtension kUpdatedAudioRtpExtensions[] = {
1908 kAudioRtpExtensionAnswer[0], 1908 kAudioRtpExtensionAnswer[0], RtpExtension(kAudioRtpExtension2[1].uri, 13),
1909 RtpHeaderExtension(kAudioRtpExtension2[1].uri, 13), 1909 kAudioRtpExtension2[2],
1910 kAudioRtpExtension2[2],
1911 }; 1910 };
1912 1911
1913 // Since the default local extension id |f2_| uses has already been used by 1912 // Since the default local extension id |f2_| uses has already been used by
1914 // |f1_| for another extensions, is is changed to 12. 1913 // |f1_| for another extensions, is is changed to 12.
1915 const RtpHeaderExtension kUpdatedVideoRtpExtensions[] = { 1914 const RtpExtension kUpdatedVideoRtpExtensions[] = {
1916 kVideoRtpExtensionAnswer[0], 1915 kVideoRtpExtensionAnswer[0], RtpExtension(kVideoRtpExtension2[1].uri, 12),
1917 RtpHeaderExtension(kVideoRtpExtension2[1].uri, 12), 1916 kVideoRtpExtension2[2],
1918 kVideoRtpExtension2[2],
1919 }; 1917 };
1920 1918
1921 const AudioContentDescription* updated_acd = 1919 const AudioContentDescription* updated_acd =
1922 GetFirstAudioContentDescription(updated_offer.get()); 1920 GetFirstAudioContentDescription(updated_offer.get());
1923 EXPECT_EQ(MAKE_VECTOR(kUpdatedAudioRtpExtensions), 1921 EXPECT_EQ(MAKE_VECTOR(kUpdatedAudioRtpExtensions),
1924 updated_acd->rtp_header_extensions()); 1922 updated_acd->rtp_header_extensions());
1925 1923
1926 const VideoContentDescription* updated_vcd = 1924 const VideoContentDescription* updated_vcd =
1927 GetFirstVideoContentDescription(updated_offer.get()); 1925 GetFirstVideoContentDescription(updated_offer.get());
1928 EXPECT_EQ(MAKE_VECTOR(kUpdatedVideoRtpExtensions), 1926 EXPECT_EQ(MAKE_VECTOR(kUpdatedVideoRtpExtensions),
1929 updated_vcd->rtp_header_extensions()); 1927 updated_vcd->rtp_header_extensions());
1930 } 1928 }
1931 1929
1932 // Verify that if the same RTP extension URI is used for audio and video, the 1930 // Verify that if the same RTP extension URI is used for audio and video, the
1933 // same ID is used. Also verify that the ID isn't changed when creating an 1931 // same ID is used. Also verify that the ID isn't changed when creating an
1934 // updated offer (this was previously a bug). 1932 // updated offer (this was previously a bug).
1935 TEST_F(MediaSessionDescriptionFactoryTest, 1933 TEST_F(MediaSessionDescriptionFactoryTest, RtpExtensionIdReused) {
1936 RtpHeaderExtensionIdReused) {
1937 MediaSessionOptions opts; 1934 MediaSessionOptions opts;
1938 opts.recv_audio = true; 1935 opts.recv_audio = true;
1939 opts.recv_video = true; 1936 opts.recv_video = true;
1940 1937
1941 f1_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension3)); 1938 f1_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension3));
1942 f1_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension3)); 1939 f1_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension3));
1943 1940
1944 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); 1941 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
1945 1942
1946 // Since the audio extensions used ID 3 for "both_audio_and_video", so should 1943 // Since the audio extensions used ID 3 for "both_audio_and_video", so should
1947 // the video extensions. 1944 // the video extensions.
1948 const RtpHeaderExtension kExpectedVideoRtpExtension[] = { 1945 const RtpExtension kExpectedVideoRtpExtension[] = {
1949 kVideoRtpExtension3[0], 1946 kVideoRtpExtension3[0], kAudioRtpExtension3[1],
1950 kAudioRtpExtension3[1],
1951 }; 1947 };
1952 1948
1953 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension3), 1949 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension3),
1954 GetFirstAudioContentDescription( 1950 GetFirstAudioContentDescription(
1955 offer.get())->rtp_header_extensions()); 1951 offer.get())->rtp_header_extensions());
1956 EXPECT_EQ(MAKE_VECTOR(kExpectedVideoRtpExtension), 1952 EXPECT_EQ(MAKE_VECTOR(kExpectedVideoRtpExtension),
1957 GetFirstVideoContentDescription( 1953 GetFirstVideoContentDescription(
1958 offer.get())->rtp_header_extensions()); 1954 offer.get())->rtp_header_extensions());
1959 1955
1960 // Nothing should change when creating a new offer 1956 // Nothing should change when creating a new offer
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 EXPECT_EQ(GetParam(), acd->protocol()); 2439 EXPECT_EQ(GetParam(), acd->protocol());
2444 EXPECT_EQ(GetParam(), vcd->protocol()); 2440 EXPECT_EQ(GetParam(), vcd->protocol());
2445 } 2441 }
2446 2442
2447 INSTANTIATE_TEST_CASE_P(MediaProtocolPatternTest, 2443 INSTANTIATE_TEST_CASE_P(MediaProtocolPatternTest,
2448 MediaProtocolTest, 2444 MediaProtocolTest,
2449 ::testing::ValuesIn(kMediaProtocols)); 2445 ::testing::ValuesIn(kMediaProtocols));
2450 INSTANTIATE_TEST_CASE_P(MediaProtocolDtlsPatternTest, 2446 INSTANTIATE_TEST_CASE_P(MediaProtocolDtlsPatternTest,
2451 MediaProtocolTest, 2447 MediaProtocolTest,
2452 ::testing::ValuesIn(kMediaProtocolsDtls)); 2448 ::testing::ValuesIn(kMediaProtocolsDtls));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698