OLD | NEW |
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 DataCodec(127, "utf8-text")}; | 105 DataCodec(127, "utf8-text")}; |
106 | 106 |
107 static const DataCodec kDataCodecsAnswer[] = {DataCodec(98, "binary-data"), | 107 static const DataCodec kDataCodecsAnswer[] = {DataCodec(98, "binary-data"), |
108 DataCodec(99, "utf8-text")}; | 108 DataCodec(99, "utf8-text")}; |
109 | 109 |
110 static const RtpExtension kAudioRtpExtension1[] = { | 110 static const RtpExtension kAudioRtpExtension1[] = { |
111 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), | 111 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), |
112 RtpExtension("http://google.com/testing/audio_something", 10), | 112 RtpExtension("http://google.com/testing/audio_something", 10), |
113 }; | 113 }; |
114 | 114 |
| 115 static const RtpExtension kAudioRtpExtensionEncrypted1[] = { |
| 116 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), |
| 117 RtpExtension("http://google.com/testing/audio_something", 10), |
| 118 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 12, true), |
| 119 }; |
| 120 |
115 static const RtpExtension kAudioRtpExtension2[] = { | 121 static const RtpExtension kAudioRtpExtension2[] = { |
116 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2), | 122 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2), |
117 RtpExtension("http://google.com/testing/audio_something_else", 8), | 123 RtpExtension("http://google.com/testing/audio_something_else", 8), |
118 RtpExtension("http://google.com/testing/both_audio_and_video", 7), | 124 RtpExtension("http://google.com/testing/both_audio_and_video", 7), |
119 }; | 125 }; |
120 | 126 |
121 static const RtpExtension kAudioRtpExtension3[] = { | 127 static const RtpExtension kAudioRtpExtension3[] = { |
122 RtpExtension("http://google.com/testing/audio_something", 2), | 128 RtpExtension("http://google.com/testing/audio_something", 2), |
123 RtpExtension("http://google.com/testing/both_audio_and_video", 3), | 129 RtpExtension("http://google.com/testing/both_audio_and_video", 3), |
124 }; | 130 }; |
125 | 131 |
126 static const RtpExtension kAudioRtpExtensionAnswer[] = { | 132 static const RtpExtension kAudioRtpExtensionAnswer[] = { |
127 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), | 133 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), |
128 }; | 134 }; |
129 | 135 |
| 136 static const RtpExtension kAudioRtpExtensionEncryptedAnswer[] = { |
| 137 RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 12, true), |
| 138 }; |
| 139 |
130 static const RtpExtension kVideoRtpExtension1[] = { | 140 static const RtpExtension kVideoRtpExtension1[] = { |
131 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14), | 141 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14), |
132 RtpExtension("http://google.com/testing/video_something", 13), | 142 RtpExtension("http://google.com/testing/video_something", 13), |
133 }; | 143 }; |
134 | 144 |
| 145 static const RtpExtension kVideoRtpExtensionEncrypted1[] = { |
| 146 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14), |
| 147 RtpExtension("http://google.com/testing/video_something", 13), |
| 148 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 11, true), |
| 149 }; |
| 150 |
135 static const RtpExtension kVideoRtpExtension2[] = { | 151 static const RtpExtension kVideoRtpExtension2[] = { |
136 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 2), | 152 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 2), |
137 RtpExtension("http://google.com/testing/video_something_else", 14), | 153 RtpExtension("http://google.com/testing/video_something_else", 14), |
138 RtpExtension("http://google.com/testing/both_audio_and_video", 7), | 154 RtpExtension("http://google.com/testing/both_audio_and_video", 7), |
139 }; | 155 }; |
140 | 156 |
141 static const RtpExtension kVideoRtpExtension3[] = { | 157 static const RtpExtension kVideoRtpExtension3[] = { |
142 RtpExtension("http://google.com/testing/video_something", 4), | 158 RtpExtension("http://google.com/testing/video_something", 4), |
143 RtpExtension("http://google.com/testing/both_audio_and_video", 5), | 159 RtpExtension("http://google.com/testing/both_audio_and_video", 5), |
144 }; | 160 }; |
145 | 161 |
146 static const RtpExtension kVideoRtpExtensionAnswer[] = { | 162 static const RtpExtension kVideoRtpExtensionAnswer[] = { |
147 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14), | 163 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14), |
148 }; | 164 }; |
149 | 165 |
| 166 static const RtpExtension kVideoRtpExtensionEncryptedAnswer[] = { |
| 167 RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 11, true), |
| 168 }; |
| 169 |
150 static const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31}; | 170 static const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31}; |
151 static const uint32_t kSimSsrc[] = {10, 20, 30}; | 171 static const uint32_t kSimSsrc[] = {10, 20, 30}; |
152 static const uint32_t kFec1Ssrc[] = {10, 11}; | 172 static const uint32_t kFec1Ssrc[] = {10, 11}; |
153 static const uint32_t kFec2Ssrc[] = {20, 21}; | 173 static const uint32_t kFec2Ssrc[] = {20, 21}; |
154 static const uint32_t kFec3Ssrc[] = {30, 31}; | 174 static const uint32_t kFec3Ssrc[] = {30, 31}; |
155 | 175 |
156 static const char kMediaStream1[] = "stream_1"; | 176 static const char kMediaStream1[] = "stream_1"; |
157 static const char kMediaStream2[] = "stream_2"; | 177 static const char kMediaStream2[] = "stream_2"; |
158 static const char kVideoTrack1[] = "video_1"; | 178 static const char kVideoTrack1[] = "video_1"; |
159 static const char kVideoTrack2[] = "video_2"; | 179 static const char kVideoTrack2[] = "video_2"; |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 GetFirstVideoContentDescription( | 1166 GetFirstVideoContentDescription( |
1147 offer.get())->rtp_header_extensions()); | 1167 offer.get())->rtp_header_extensions()); |
1148 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionAnswer), | 1168 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionAnswer), |
1149 GetFirstAudioContentDescription( | 1169 GetFirstAudioContentDescription( |
1150 answer.get())->rtp_header_extensions()); | 1170 answer.get())->rtp_header_extensions()); |
1151 EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionAnswer), | 1171 EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionAnswer), |
1152 GetFirstVideoContentDescription( | 1172 GetFirstVideoContentDescription( |
1153 answer.get())->rtp_header_extensions()); | 1173 answer.get())->rtp_header_extensions()); |
1154 } | 1174 } |
1155 | 1175 |
| 1176 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1177 TestOfferAnswerWithEncryptedRtpExtensionsBoth) { |
| 1178 MediaSessionOptions opts; |
| 1179 opts.recv_video = true; |
| 1180 |
| 1181 f1_.set_enable_encrypted_rtp_header_extensions(true); |
| 1182 f2_.set_enable_encrypted_rtp_header_extensions(true); |
| 1183 |
| 1184 f1_.set_audio_rtp_header_extensions( |
| 1185 MAKE_VECTOR(kAudioRtpExtension1)); |
| 1186 f1_.set_video_rtp_header_extensions( |
| 1187 MAKE_VECTOR(kVideoRtpExtension1)); |
| 1188 f2_.set_audio_rtp_header_extensions( |
| 1189 MAKE_VECTOR(kAudioRtpExtension2)); |
| 1190 f2_.set_video_rtp_header_extensions( |
| 1191 MAKE_VECTOR(kVideoRtpExtension2)); |
| 1192 |
| 1193 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1194 ASSERT_TRUE(offer.get() != NULL); |
| 1195 std::unique_ptr<SessionDescription> answer( |
| 1196 f2_.CreateAnswer(offer.get(), opts, NULL)); |
| 1197 |
| 1198 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionEncrypted1), |
| 1199 GetFirstAudioContentDescription( |
| 1200 offer.get())->rtp_header_extensions()); |
| 1201 EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionEncrypted1), |
| 1202 GetFirstVideoContentDescription( |
| 1203 offer.get())->rtp_header_extensions()); |
| 1204 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionEncryptedAnswer), |
| 1205 GetFirstAudioContentDescription( |
| 1206 answer.get())->rtp_header_extensions()); |
| 1207 EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionEncryptedAnswer), |
| 1208 GetFirstVideoContentDescription( |
| 1209 answer.get())->rtp_header_extensions()); |
| 1210 } |
| 1211 |
| 1212 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1213 TestOfferAnswerWithEncryptedRtpExtensionsOffer) { |
| 1214 MediaSessionOptions opts; |
| 1215 opts.recv_video = true; |
| 1216 |
| 1217 f1_.set_enable_encrypted_rtp_header_extensions(true); |
| 1218 |
| 1219 f1_.set_audio_rtp_header_extensions( |
| 1220 MAKE_VECTOR(kAudioRtpExtension1)); |
| 1221 f1_.set_video_rtp_header_extensions( |
| 1222 MAKE_VECTOR(kVideoRtpExtension1)); |
| 1223 f2_.set_audio_rtp_header_extensions( |
| 1224 MAKE_VECTOR(kAudioRtpExtension2)); |
| 1225 f2_.set_video_rtp_header_extensions( |
| 1226 MAKE_VECTOR(kVideoRtpExtension2)); |
| 1227 |
| 1228 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1229 ASSERT_TRUE(offer.get() != NULL); |
| 1230 std::unique_ptr<SessionDescription> answer( |
| 1231 f2_.CreateAnswer(offer.get(), opts, NULL)); |
| 1232 |
| 1233 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionEncrypted1), |
| 1234 GetFirstAudioContentDescription( |
| 1235 offer.get())->rtp_header_extensions()); |
| 1236 EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionEncrypted1), |
| 1237 GetFirstVideoContentDescription( |
| 1238 offer.get())->rtp_header_extensions()); |
| 1239 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionAnswer), |
| 1240 GetFirstAudioContentDescription( |
| 1241 answer.get())->rtp_header_extensions()); |
| 1242 EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionAnswer), |
| 1243 GetFirstVideoContentDescription( |
| 1244 answer.get())->rtp_header_extensions()); |
| 1245 } |
| 1246 |
| 1247 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1248 TestOfferAnswerWithEncryptedRtpExtensionsAnswer) { |
| 1249 MediaSessionOptions opts; |
| 1250 opts.recv_video = true; |
| 1251 |
| 1252 f2_.set_enable_encrypted_rtp_header_extensions(true); |
| 1253 |
| 1254 f1_.set_audio_rtp_header_extensions( |
| 1255 MAKE_VECTOR(kAudioRtpExtension1)); |
| 1256 f1_.set_video_rtp_header_extensions( |
| 1257 MAKE_VECTOR(kVideoRtpExtension1)); |
| 1258 f2_.set_audio_rtp_header_extensions( |
| 1259 MAKE_VECTOR(kAudioRtpExtension2)); |
| 1260 f2_.set_video_rtp_header_extensions( |
| 1261 MAKE_VECTOR(kVideoRtpExtension2)); |
| 1262 |
| 1263 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1264 ASSERT_TRUE(offer.get() != NULL); |
| 1265 std::unique_ptr<SessionDescription> answer( |
| 1266 f2_.CreateAnswer(offer.get(), opts, NULL)); |
| 1267 |
| 1268 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension1), |
| 1269 GetFirstAudioContentDescription( |
| 1270 offer.get())->rtp_header_extensions()); |
| 1271 EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtension1), |
| 1272 GetFirstVideoContentDescription( |
| 1273 offer.get())->rtp_header_extensions()); |
| 1274 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionAnswer), |
| 1275 GetFirstAudioContentDescription( |
| 1276 answer.get())->rtp_header_extensions()); |
| 1277 EXPECT_EQ(MAKE_VECTOR(kVideoRtpExtensionAnswer), |
| 1278 GetFirstVideoContentDescription( |
| 1279 answer.get())->rtp_header_extensions()); |
| 1280 } |
| 1281 |
1156 // Create an audio, video, data answer without legacy StreamParams. | 1282 // Create an audio, video, data answer without legacy StreamParams. |
1157 TEST_F(MediaSessionDescriptionFactoryTest, | 1283 TEST_F(MediaSessionDescriptionFactoryTest, |
1158 TestCreateAnswerWithoutLegacyStreams) { | 1284 TestCreateAnswerWithoutLegacyStreams) { |
1159 MediaSessionOptions opts; | 1285 MediaSessionOptions opts; |
1160 opts.recv_video = true; | 1286 opts.recv_video = true; |
1161 opts.data_channel_type = cricket::DCT_RTP; | 1287 opts.data_channel_type = cricket::DCT_RTP; |
1162 f1_.set_add_legacy_streams(false); | 1288 f1_.set_add_legacy_streams(false); |
1163 f2_.set_add_legacy_streams(false); | 1289 f2_.set_add_legacy_streams(false); |
1164 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 1290 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
1165 ASSERT_TRUE(offer.get() != NULL); | 1291 ASSERT_TRUE(offer.get() != NULL); |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 ::testing::Combine( | 3145 ::testing::Combine( |
3020 ::testing::Values(cricket::MD_SENDONLY, | 3146 ::testing::Values(cricket::MD_SENDONLY, |
3021 cricket::MD_RECVONLY, | 3147 cricket::MD_RECVONLY, |
3022 cricket::MD_SENDRECV, | 3148 cricket::MD_SENDRECV, |
3023 cricket::MD_INACTIVE), | 3149 cricket::MD_INACTIVE), |
3024 ::testing::Values(cricket::MD_SENDONLY, | 3150 ::testing::Values(cricket::MD_SENDONLY, |
3025 cricket::MD_RECVONLY, | 3151 cricket::MD_RECVONLY, |
3026 cricket::MD_SENDRECV, | 3152 cricket::MD_SENDRECV, |
3027 cricket::MD_INACTIVE), | 3153 cricket::MD_INACTIVE), |
3028 ::testing::Bool())); | 3154 ::testing::Bool())); |
OLD | NEW |