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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_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 (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 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
11 #include <algorithm> 11 #include <algorithm>
12 #include <map> 12 #include <map>
13 #include <memory> 13 #include <memory>
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/arraysize.h" 16 #include "webrtc/base/arraysize.h"
17 #include "webrtc/base/gunit.h" 17 #include "webrtc/base/gunit.h"
18 #include "webrtc/base/stringutils.h" 18 #include "webrtc/base/stringutils.h"
19 #include "webrtc/media/base/testutils.h" 19 #include "webrtc/media/base/testutils.h"
20 #include "webrtc/media/base/videoengine_unittest.h" 20 #include "webrtc/media/base/videoengine_unittest.h"
21 #include "webrtc/media/engine/fakewebrtccall.h" 21 #include "webrtc/media/engine/fakewebrtccall.h"
22 #include "webrtc/media/engine/fakewebrtcvideoengine.h" 22 #include "webrtc/media/engine/fakewebrtcvideoengine.h"
23 #include "webrtc/media/engine/simulcast.h" 23 #include "webrtc/media/engine/simulcast.h"
24 #include "webrtc/media/engine/webrtcvideochannelfactory.h" 24 #include "webrtc/media/engine/webrtcvideochannelfactory.h"
25 #include "webrtc/media/engine/webrtcvideoengine2.h" 25 #include "webrtc/media/engine/webrtcvideoengine2.h"
26 #include "webrtc/media/engine/webrtcvoiceengine.h" 26 #include "webrtc/media/engine/webrtcvoiceengine.h"
27 #include "webrtc/test/field_trial.h" 27 #include "webrtc/test/field_trial.h"
28 #include "webrtc/video_encoder.h" 28 #include "webrtc/video_encoder.h"
29 29
30 using webrtc::RtpExtension;
31
30 namespace { 32 namespace {
31 static const int kDefaultQpMax = 56; 33 static const int kDefaultQpMax = 56;
32 static const int kDefaultFramerate = 30; 34 static const int kDefaultFramerate = 30;
33 35
34 static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30); 36 static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30);
35 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30); 37 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30);
36 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30); 38 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30);
37 39
38 static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30); 40 static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30);
39 static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30); 41 static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 &associated_payload_type)); 177 &associated_payload_type));
176 EXPECT_EQ(default_codec_.id, associated_payload_type); 178 EXPECT_EQ(default_codec_.id, associated_payload_type);
177 return; 179 return;
178 } 180 }
179 FAIL() << "No RTX codec found among default codecs."; 181 FAIL() << "No RTX codec found among default codecs.";
180 } 182 }
181 183
182 TEST_F(WebRtcVideoEngine2Test, SupportsTimestampOffsetHeaderExtension) { 184 TEST_F(WebRtcVideoEngine2Test, SupportsTimestampOffsetHeaderExtension) {
183 RtpCapabilities capabilities = engine_.GetCapabilities(); 185 RtpCapabilities capabilities = engine_.GetCapabilities();
184 ASSERT_FALSE(capabilities.header_extensions.empty()); 186 ASSERT_FALSE(capabilities.header_extensions.empty());
185 for (const RtpHeaderExtension& extension : capabilities.header_extensions) { 187 for (const RtpExtension& extension : capabilities.header_extensions) {
186 if (extension.uri == kRtpTimestampOffsetHeaderExtension) { 188 if (extension.uri == RtpExtension::kTimestampOffsetUri) {
187 EXPECT_EQ(kRtpTimestampOffsetHeaderExtensionDefaultId, extension.id); 189 EXPECT_EQ(RtpExtension::kTimestampOffsetDefaultId, extension.id);
188 return; 190 return;
189 } 191 }
190 } 192 }
191 FAIL() << "Timestamp offset extension not in header-extension list."; 193 FAIL() << "Timestamp offset extension not in header-extension list.";
192 } 194 }
193 195
194 TEST_F(WebRtcVideoEngine2Test, SupportsAbsoluteSenderTimeHeaderExtension) { 196 TEST_F(WebRtcVideoEngine2Test, SupportsAbsoluteSenderTimeHeaderExtension) {
195 RtpCapabilities capabilities = engine_.GetCapabilities(); 197 RtpCapabilities capabilities = engine_.GetCapabilities();
196 ASSERT_FALSE(capabilities.header_extensions.empty()); 198 ASSERT_FALSE(capabilities.header_extensions.empty());
197 for (const RtpHeaderExtension& extension : capabilities.header_extensions) { 199 for (const RtpExtension& extension : capabilities.header_extensions) {
198 if (extension.uri == kRtpAbsoluteSenderTimeHeaderExtension) { 200 if (extension.uri == RtpExtension::kAbsSendTimeUri) {
199 EXPECT_EQ(kRtpAbsoluteSenderTimeHeaderExtensionDefaultId, extension.id); 201 EXPECT_EQ(RtpExtension::kAbsSendTimeDefaultId, extension.id);
200 return; 202 return;
201 } 203 }
202 } 204 }
203 FAIL() << "Absolute Sender Time extension not in header-extension list."; 205 FAIL() << "Absolute Sender Time extension not in header-extension list.";
204 } 206 }
205 207
206 class WebRtcVideoEngine2WithSendSideBweTest : public WebRtcVideoEngine2Test { 208 class WebRtcVideoEngine2WithSendSideBweTest : public WebRtcVideoEngine2Test {
207 public: 209 public:
208 WebRtcVideoEngine2WithSendSideBweTest() 210 WebRtcVideoEngine2WithSendSideBweTest()
209 : WebRtcVideoEngine2Test("WebRTC-SendSideBwe/Enabled/") {} 211 : WebRtcVideoEngine2Test("WebRTC-SendSideBwe/Enabled/") {}
210 }; 212 };
211 213
212 TEST_F(WebRtcVideoEngine2WithSendSideBweTest, 214 TEST_F(WebRtcVideoEngine2WithSendSideBweTest,
213 SupportsTransportSequenceNumberHeaderExtension) { 215 SupportsTransportSequenceNumberHeaderExtension) {
214 RtpCapabilities capabilities = engine_.GetCapabilities(); 216 RtpCapabilities capabilities = engine_.GetCapabilities();
215 ASSERT_FALSE(capabilities.header_extensions.empty()); 217 ASSERT_FALSE(capabilities.header_extensions.empty());
216 for (const RtpHeaderExtension& extension : capabilities.header_extensions) { 218 for (const RtpExtension& extension : capabilities.header_extensions) {
217 if (extension.uri == kRtpTransportSequenceNumberHeaderExtension) { 219 if (extension.uri == RtpExtension::kTransportSequenceNumberUri) {
218 EXPECT_EQ(kRtpTransportSequenceNumberHeaderExtensionDefaultId, 220 EXPECT_EQ(RtpExtension::kTransportSequenceNumberDefaultId, extension.id);
219 extension.id);
220 return; 221 return;
221 } 222 }
222 } 223 }
223 FAIL() << "Transport sequence number extension not in header-extension list."; 224 FAIL() << "Transport sequence number extension not in header-extension list.";
224 } 225 }
225 226
226 TEST_F(WebRtcVideoEngine2Test, SupportsVideoRotationHeaderExtension) { 227 TEST_F(WebRtcVideoEngine2Test, SupportsVideoRotationHeaderExtension) {
227 RtpCapabilities capabilities = engine_.GetCapabilities(); 228 RtpCapabilities capabilities = engine_.GetCapabilities();
228 ASSERT_FALSE(capabilities.header_extensions.empty()); 229 ASSERT_FALSE(capabilities.header_extensions.empty());
229 for (const RtpHeaderExtension& extension : capabilities.header_extensions) { 230 for (const RtpExtension& extension : capabilities.header_extensions) {
230 if (extension.uri == kRtpVideoRotationHeaderExtension) { 231 if (extension.uri == RtpExtension::kVideoRotationUri) {
231 EXPECT_EQ(kRtpVideoRotationHeaderExtensionDefaultId, extension.id); 232 EXPECT_EQ(RtpExtension::kVideoRotationDefaultId, extension.id);
232 return; 233 return;
233 } 234 }
234 } 235 }
235 FAIL() << "Video Rotation extension not in header-extension list."; 236 FAIL() << "Video Rotation extension not in header-extension list.";
236 } 237 }
237 238
238 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeCapturer) { 239 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeCapturer) {
239 // Allocate the capturer first to prevent early destruction before channel's 240 // Allocate the capturer first to prevent early destruction before channel's
240 // dtor is called. 241 // dtor is called.
241 cricket::FakeVideoCapturer capturer; 242 cricket::FakeVideoCapturer capturer;
242 243
243 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; 244 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
244 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); 245 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8");
245 cricket::VideoSendParameters parameters; 246 cricket::VideoSendParameters parameters;
246 parameters.codecs.push_back(kVp8Codec); 247 parameters.codecs.push_back(kVp8Codec);
247 248
248 std::unique_ptr<VideoMediaChannel> channel( 249 std::unique_ptr<VideoMediaChannel> channel(
249 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); 250 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs));
250 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc))); 251 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc)));
251 252
252 // Add CVO extension. 253 // Add CVO extension.
253 const int id = 1; 254 const int id = 1;
254 parameters.extensions.push_back( 255 parameters.extensions.push_back(
255 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); 256 RtpExtension(RtpExtension::kVideoRotationUri, id));
256 EXPECT_TRUE(channel->SetSendParameters(parameters)); 257 EXPECT_TRUE(channel->SetSendParameters(parameters));
257 258
258 // Set capturer. 259 // Set capturer.
259 channel->SetSource(kSsrc, &capturer); 260 channel->SetSource(kSsrc, &capturer);
260 261
261 // Verify capturer has turned off applying rotation. 262 // Verify capturer has turned off applying rotation.
262 EXPECT_FALSE(capturer.GetApplyRotation()); 263 EXPECT_FALSE(capturer.GetApplyRotation());
263 264
264 // Verify removing header extension turns on applying rotation. 265 // Verify removing header extension turns on applying rotation.
265 parameters.extensions.clear(); 266 parameters.extensions.clear();
266 EXPECT_TRUE(channel->SetSendParameters(parameters)); 267 EXPECT_TRUE(channel->SetSendParameters(parameters));
267 EXPECT_TRUE(capturer.GetApplyRotation()); 268 EXPECT_TRUE(capturer.GetApplyRotation());
268 } 269 }
269 270
270 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeAddSendStream) { 271 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeAddSendStream) {
271 // Allocate the capturer first to prevent early destruction before channel's 272 // Allocate the capturer first to prevent early destruction before channel's
272 // dtor is called. 273 // dtor is called.
273 cricket::FakeVideoCapturer capturer; 274 cricket::FakeVideoCapturer capturer;
274 275
275 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; 276 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
276 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); 277 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8");
277 cricket::VideoSendParameters parameters; 278 cricket::VideoSendParameters parameters;
278 parameters.codecs.push_back(kVp8Codec); 279 parameters.codecs.push_back(kVp8Codec);
279 280
280 std::unique_ptr<VideoMediaChannel> channel( 281 std::unique_ptr<VideoMediaChannel> channel(
281 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); 282 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs));
282 // Add CVO extension. 283 // Add CVO extension.
283 const int id = 1; 284 const int id = 1;
284 parameters.extensions.push_back( 285 parameters.extensions.push_back(
285 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); 286 RtpExtension(RtpExtension::kVideoRotationUri, id));
286 EXPECT_TRUE(channel->SetSendParameters(parameters)); 287 EXPECT_TRUE(channel->SetSendParameters(parameters));
287 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc))); 288 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc)));
288 289
289 // Set capturer. 290 // Set capturer.
290 channel->SetSource(kSsrc, &capturer); 291 channel->SetSource(kSsrc, &capturer);
291 292
292 // Verify capturer has turned off applying rotation. 293 // Verify capturer has turned off applying rotation.
293 EXPECT_FALSE(capturer.GetApplyRotation()); 294 EXPECT_FALSE(capturer.GetApplyRotation());
294 } 295 }
295 296
(...skipping 13 matching lines...) Expand all
309 310
310 // Set capturer. 311 // Set capturer.
311 channel->SetSource(kSsrc, &capturer); 312 channel->SetSource(kSsrc, &capturer);
312 313
313 // Verify capturer has turned on applying rotation. 314 // Verify capturer has turned on applying rotation.
314 EXPECT_TRUE(capturer.GetApplyRotation()); 315 EXPECT_TRUE(capturer.GetApplyRotation());
315 316
316 // Add CVO extension. 317 // Add CVO extension.
317 const int id = 1; 318 const int id = 1;
318 parameters.extensions.push_back( 319 parameters.extensions.push_back(
319 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); 320 RtpExtension(RtpExtension::kVideoRotationUri, id));
320 // Also remove the first codec to trigger a codec change as well. 321 // Also remove the first codec to trigger a codec change as well.
321 parameters.codecs.erase(parameters.codecs.begin()); 322 parameters.codecs.erase(parameters.codecs.begin());
322 EXPECT_TRUE(channel->SetSendParameters(parameters)); 323 EXPECT_TRUE(channel->SetSendParameters(parameters));
323 324
324 // Verify capturer has turned off applying rotation. 325 // Verify capturer has turned off applying rotation.
325 EXPECT_FALSE(capturer.GetApplyRotation()); 326 EXPECT_FALSE(capturer.GetApplyRotation());
326 327
327 // Verify removing header extension turns on applying rotation. 328 // Verify removing header extension turns on applying rotation.
328 parameters.extensions.clear(); 329 parameters.extensions.clear();
329 EXPECT_TRUE(channel->SetSendParameters(parameters)); 330 EXPECT_TRUE(channel->SetSendParameters(parameters));
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 961 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
961 962
962 EXPECT_EQ(expected_min_bitrate_bps, 963 EXPECT_EQ(expected_min_bitrate_bps,
963 fake_call_->GetConfig().bitrate_config.min_bitrate_bps); 964 fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
964 EXPECT_EQ(expected_start_bitrate_bps, 965 EXPECT_EQ(expected_start_bitrate_bps,
965 fake_call_->GetConfig().bitrate_config.start_bitrate_bps); 966 fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
966 EXPECT_EQ(expected_max_bitrate_bps, 967 EXPECT_EQ(expected_max_bitrate_bps,
967 fake_call_->GetConfig().bitrate_config.max_bitrate_bps); 968 fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
968 } 969 }
969 970
970 void TestSetSendRtpHeaderExtensions(const std::string& cricket_ext, 971 void TestSetSendRtpHeaderExtensions(const std::string& ext_uri) {
971 const std::string& webrtc_ext) {
972 // Enable extension. 972 // Enable extension.
973 const int id = 1; 973 const int id = 1;
974 cricket::VideoSendParameters parameters = send_parameters_; 974 cricket::VideoSendParameters parameters = send_parameters_;
975 parameters.extensions.push_back( 975 parameters.extensions.push_back(RtpExtension(ext_uri, id));
976 cricket::RtpHeaderExtension(cricket_ext, id));
977 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 976 EXPECT_TRUE(channel_->SetSendParameters(parameters));
978 FakeVideoSendStream* send_stream = 977 FakeVideoSendStream* send_stream =
979 AddSendStream(cricket::StreamParams::CreateLegacy(123)); 978 AddSendStream(cricket::StreamParams::CreateLegacy(123));
980 979
981 // Verify the send extension id. 980 // Verify the send extension id.
982 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size()); 981 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
983 EXPECT_EQ(id, send_stream->GetConfig().rtp.extensions[0].id); 982 EXPECT_EQ(id, send_stream->GetConfig().rtp.extensions[0].id);
984 EXPECT_EQ(webrtc_ext, send_stream->GetConfig().rtp.extensions[0].name); 983 EXPECT_EQ(ext_uri, send_stream->GetConfig().rtp.extensions[0].uri);
985 // Verify call with same set of extensions returns true. 984 // Verify call with same set of extensions returns true.
986 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 985 EXPECT_TRUE(channel_->SetSendParameters(parameters));
987 // Verify that SetSendRtpHeaderExtensions doesn't implicitly add them for 986 // Verify that SetSendRtpHeaderExtensions doesn't implicitly add them for
988 // receivers. 987 // receivers.
989 EXPECT_TRUE(AddRecvStream(cricket::StreamParams::CreateLegacy(123)) 988 EXPECT_TRUE(AddRecvStream(cricket::StreamParams::CreateLegacy(123))
990 ->GetConfig() 989 ->GetConfig()
991 .rtp.extensions.empty()); 990 .rtp.extensions.empty());
992 991
993 // Verify that existing RTP header extensions can be removed. 992 // Verify that existing RTP header extensions can be removed.
994 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 993 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
995 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); 994 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
996 send_stream = fake_call_->GetVideoSendStreams()[0]; 995 send_stream = fake_call_->GetVideoSendStreams()[0];
997 EXPECT_TRUE(send_stream->GetConfig().rtp.extensions.empty()); 996 EXPECT_TRUE(send_stream->GetConfig().rtp.extensions.empty());
998 997
999 // Verify that adding receive RTP header extensions adds them for existing 998 // Verify that adding receive RTP header extensions adds them for existing
1000 // streams. 999 // streams.
1001 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1000 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1002 send_stream = fake_call_->GetVideoSendStreams()[0]; 1001 send_stream = fake_call_->GetVideoSendStreams()[0];
1003 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size()); 1002 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
1004 EXPECT_EQ(id, send_stream->GetConfig().rtp.extensions[0].id); 1003 EXPECT_EQ(id, send_stream->GetConfig().rtp.extensions[0].id);
1005 EXPECT_EQ(webrtc_ext, send_stream->GetConfig().rtp.extensions[0].name); 1004 EXPECT_EQ(ext_uri, send_stream->GetConfig().rtp.extensions[0].uri);
1006 } 1005 }
1007 1006
1008 void TestSetRecvRtpHeaderExtensions(const std::string& cricket_ext, 1007 void TestSetRecvRtpHeaderExtensions(const std::string& ext_uri) {
1009 const std::string& webrtc_ext) {
1010 // Enable extension. 1008 // Enable extension.
1011 const int id = 1; 1009 const int id = 1;
1012 cricket::VideoRecvParameters parameters = recv_parameters_; 1010 cricket::VideoRecvParameters parameters = recv_parameters_;
1013 parameters.extensions.push_back( 1011 parameters.extensions.push_back(RtpExtension(ext_uri, id));
1014 cricket::RtpHeaderExtension(cricket_ext, id));
1015 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 1012 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
1016 1013
1017 FakeVideoReceiveStream* recv_stream = 1014 FakeVideoReceiveStream* recv_stream =
1018 AddRecvStream(cricket::StreamParams::CreateLegacy(123)); 1015 AddRecvStream(cricket::StreamParams::CreateLegacy(123));
1019 1016
1020 // Verify the recv extension id. 1017 // Verify the recv extension id.
1021 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); 1018 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size());
1022 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id); 1019 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id);
1023 EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name); 1020 EXPECT_EQ(ext_uri, recv_stream->GetConfig().rtp.extensions[0].uri);
1024 // Verify call with same set of extensions returns true. 1021 // Verify call with same set of extensions returns true.
1025 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 1022 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
1026 1023
1027 // Verify that SetRecvRtpHeaderExtensions doesn't implicitly add them for 1024 // Verify that SetRecvRtpHeaderExtensions doesn't implicitly add them for
1028 // senders. 1025 // senders.
1029 EXPECT_TRUE(AddSendStream(cricket::StreamParams::CreateLegacy(123)) 1026 EXPECT_TRUE(AddSendStream(cricket::StreamParams::CreateLegacy(123))
1030 ->GetConfig() 1027 ->GetConfig()
1031 .rtp.extensions.empty()); 1028 .rtp.extensions.empty());
1032 1029
1033 // Verify that existing RTP header extensions can be removed. 1030 // Verify that existing RTP header extensions can be removed.
1034 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 1031 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
1035 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()); 1032 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size());
1036 recv_stream = fake_call_->GetVideoReceiveStreams()[0]; 1033 recv_stream = fake_call_->GetVideoReceiveStreams()[0];
1037 EXPECT_TRUE(recv_stream->GetConfig().rtp.extensions.empty()); 1034 EXPECT_TRUE(recv_stream->GetConfig().rtp.extensions.empty());
1038 1035
1039 // Verify that adding receive RTP header extensions adds them for existing 1036 // Verify that adding receive RTP header extensions adds them for existing
1040 // streams. 1037 // streams.
1041 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 1038 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
1042 recv_stream = fake_call_->GetVideoReceiveStreams()[0]; 1039 recv_stream = fake_call_->GetVideoReceiveStreams()[0];
1043 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); 1040 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size());
1044 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id); 1041 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id);
1045 EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name); 1042 EXPECT_EQ(ext_uri, recv_stream->GetConfig().rtp.extensions[0].uri);
1046 } 1043 }
1047 1044
1048 void TestExtensionFilter(const std::vector<std::string>& extensions, 1045 void TestExtensionFilter(const std::vector<std::string>& extensions,
1049 const std::string& expected_extension) { 1046 const std::string& expected_extension) {
1050 cricket::VideoSendParameters parameters = send_parameters_; 1047 cricket::VideoSendParameters parameters = send_parameters_;
1051 int expected_id = -1; 1048 int expected_id = -1;
1052 int id = 1; 1049 int id = 1;
1053 for (const std::string& extension : extensions) { 1050 for (const std::string& extension : extensions) {
1054 if (extension == expected_extension) 1051 if (extension == expected_extension)
1055 expected_id = id; 1052 expected_id = id;
1056 parameters.extensions.push_back( 1053 parameters.extensions.push_back(RtpExtension(extension, id++));
1057 cricket::RtpHeaderExtension(extension, id++));
1058 } 1054 }
1059 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1055 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1060 FakeVideoSendStream* send_stream = 1056 FakeVideoSendStream* send_stream =
1061 AddSendStream(cricket::StreamParams::CreateLegacy(123)); 1057 AddSendStream(cricket::StreamParams::CreateLegacy(123));
1062 1058
1063 // Verify that only one of them has been set, and that it is the one with 1059 // Verify that only one of them has been set, and that it is the one with
1064 // highest priority (transport sequence number). 1060 // highest priority (transport sequence number).
1065 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size()); 1061 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
1066 EXPECT_EQ(expected_id, send_stream->GetConfig().rtp.extensions[0].id); 1062 EXPECT_EQ(expected_id, send_stream->GetConfig().rtp.extensions[0].id);
1067 EXPECT_EQ(expected_extension, 1063 EXPECT_EQ(expected_extension,
1068 send_stream->GetConfig().rtp.extensions[0].name); 1064 send_stream->GetConfig().rtp.extensions[0].uri);
1069 } 1065 }
1070 1066
1071 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare); 1067 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare);
1072 void TestReceiverLocalSsrcConfiguration(bool receiver_first); 1068 void TestReceiverLocalSsrcConfiguration(bool receiver_first);
1073 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type, 1069 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type,
1074 bool expect_created_receive_stream); 1070 bool expect_created_receive_stream);
1075 1071
1076 FakeVideoSendStream* SetDenoisingOption( 1072 FakeVideoSendStream* SetDenoisingOption(
1077 uint32_t ssrc, 1073 uint32_t ssrc,
1078 cricket::FakeVideoCapturer* capturer, 1074 cricket::FakeVideoCapturer* capturer,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 AddSendStream(cricket::StreamParams::CreateLegacy(kSsrcs1[0])); 1209 AddSendStream(cricket::StreamParams::CreateLegacy(kSsrcs1[0]));
1214 ASSERT_TRUE(send_stream->GetConfig().rtp.extensions.empty()); 1210 ASSERT_TRUE(send_stream->GetConfig().rtp.extensions.empty());
1215 1211
1216 FakeVideoReceiveStream* recv_stream = 1212 FakeVideoReceiveStream* recv_stream =
1217 AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrcs1[0])); 1213 AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrcs1[0]));
1218 ASSERT_TRUE(recv_stream->GetConfig().rtp.extensions.empty()); 1214 ASSERT_TRUE(recv_stream->GetConfig().rtp.extensions.empty());
1219 } 1215 }
1220 1216
1221 // Test support for RTP timestamp offset header extension. 1217 // Test support for RTP timestamp offset header extension.
1222 TEST_F(WebRtcVideoChannel2Test, SendRtpTimestampOffsetHeaderExtensions) { 1218 TEST_F(WebRtcVideoChannel2Test, SendRtpTimestampOffsetHeaderExtensions) {
1223 TestSetSendRtpHeaderExtensions(kRtpTimestampOffsetHeaderExtension, 1219 TestSetSendRtpHeaderExtensions(RtpExtension::kTimestampOffsetUri);
1224 webrtc::RtpExtension::kTOffset);
1225 } 1220 }
1221
1226 TEST_F(WebRtcVideoChannel2Test, RecvRtpTimestampOffsetHeaderExtensions) { 1222 TEST_F(WebRtcVideoChannel2Test, RecvRtpTimestampOffsetHeaderExtensions) {
1227 TestSetRecvRtpHeaderExtensions(kRtpTimestampOffsetHeaderExtension, 1223 TestSetRecvRtpHeaderExtensions(RtpExtension::kTimestampOffsetUri);
1228 webrtc::RtpExtension::kTOffset);
1229 } 1224 }
1230 1225
1231 // Test support for absolute send time header extension. 1226 // Test support for absolute send time header extension.
1232 TEST_F(WebRtcVideoChannel2Test, SendAbsoluteSendTimeHeaderExtensions) { 1227 TEST_F(WebRtcVideoChannel2Test, SendAbsoluteSendTimeHeaderExtensions) {
1233 TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension, 1228 TestSetSendRtpHeaderExtensions(RtpExtension::kAbsSendTimeUri);
1234 webrtc::RtpExtension::kAbsSendTime);
1235 } 1229 }
1230
1236 TEST_F(WebRtcVideoChannel2Test, RecvAbsoluteSendTimeHeaderExtensions) { 1231 TEST_F(WebRtcVideoChannel2Test, RecvAbsoluteSendTimeHeaderExtensions) {
1237 TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension, 1232 TestSetRecvRtpHeaderExtensions(RtpExtension::kAbsSendTimeUri);
1238 webrtc::RtpExtension::kAbsSendTime);
1239 } 1233 }
1240 1234
1241 TEST_F(WebRtcVideoChannel2Test, FiltersExtensionsPicksTransportSeqNum) { 1235 TEST_F(WebRtcVideoChannel2Test, FiltersExtensionsPicksTransportSeqNum) {
1242 // Enable three redundant extensions. 1236 // Enable three redundant extensions.
1243 std::vector<std::string> extensions; 1237 std::vector<std::string> extensions;
1244 extensions.push_back(kRtpAbsoluteSenderTimeHeaderExtension); 1238 extensions.push_back(RtpExtension::kAbsSendTimeUri);
1245 extensions.push_back(kRtpTimestampOffsetHeaderExtension); 1239 extensions.push_back(RtpExtension::kTimestampOffsetUri);
1246 extensions.push_back(kRtpTransportSequenceNumberHeaderExtension); 1240 extensions.push_back(RtpExtension::kTransportSequenceNumberUri);
1247 TestExtensionFilter(extensions, kRtpTransportSequenceNumberHeaderExtension); 1241 TestExtensionFilter(extensions, RtpExtension::kTransportSequenceNumberUri);
1248 } 1242 }
1249 1243
1250 TEST_F(WebRtcVideoChannel2Test, FiltersExtensionsPicksAbsSendTime) { 1244 TEST_F(WebRtcVideoChannel2Test, FiltersExtensionsPicksAbsSendTime) {
1251 // Enable two redundant extensions. 1245 // Enable two redundant extensions.
1252 std::vector<std::string> extensions; 1246 std::vector<std::string> extensions;
1253 extensions.push_back(kRtpAbsoluteSenderTimeHeaderExtension); 1247 extensions.push_back(RtpExtension::kAbsSendTimeUri);
1254 extensions.push_back(kRtpTimestampOffsetHeaderExtension); 1248 extensions.push_back(RtpExtension::kTimestampOffsetUri);
1255 TestExtensionFilter(extensions, kRtpAbsoluteSenderTimeHeaderExtension); 1249 TestExtensionFilter(extensions, RtpExtension::kAbsSendTimeUri);
1256 } 1250 }
1257 1251
1258 class WebRtcVideoChannel2WithSendSideBweTest : public WebRtcVideoChannel2Test { 1252 class WebRtcVideoChannel2WithSendSideBweTest : public WebRtcVideoChannel2Test {
1259 public: 1253 public:
1260 WebRtcVideoChannel2WithSendSideBweTest() 1254 WebRtcVideoChannel2WithSendSideBweTest()
1261 : WebRtcVideoChannel2Test("WebRTC-SendSideBwe/Enabled/") {} 1255 : WebRtcVideoChannel2Test("WebRTC-SendSideBwe/Enabled/") {}
1262 }; 1256 };
1263 1257
1264 // Test support for transport sequence number header extension. 1258 // Test support for transport sequence number header extension.
1265 TEST_F(WebRtcVideoChannel2WithSendSideBweTest, 1259 TEST_F(WebRtcVideoChannel2WithSendSideBweTest,
1266 SendTransportSequenceNumberHeaderExtensions) { 1260 SendTransportSequenceNumberHeaderExtensions) {
1267 TestSetSendRtpHeaderExtensions( 1261 TestSetSendRtpHeaderExtensions(RtpExtension::kTransportSequenceNumberUri);
1268 kRtpTransportSequenceNumberHeaderExtension,
1269 webrtc::RtpExtension::kTransportSequenceNumber);
1270 } 1262 }
1271 TEST_F(WebRtcVideoChannel2WithSendSideBweTest, 1263 TEST_F(WebRtcVideoChannel2WithSendSideBweTest,
1272 RecvTransportSequenceNumberHeaderExtensions) { 1264 RecvTransportSequenceNumberHeaderExtensions) {
1273 TestSetRecvRtpHeaderExtensions( 1265 TestSetRecvRtpHeaderExtensions(RtpExtension::kTransportSequenceNumberUri);
1274 kRtpTransportSequenceNumberHeaderExtension,
1275 webrtc::RtpExtension::kTransportSequenceNumber);
1276 } 1266 }
1277 1267
1278 // Test support for video rotation header extension. 1268 // Test support for video rotation header extension.
1279 TEST_F(WebRtcVideoChannel2Test, SendVideoRotationHeaderExtensions) { 1269 TEST_F(WebRtcVideoChannel2Test, SendVideoRotationHeaderExtensions) {
1280 TestSetSendRtpHeaderExtensions(kRtpVideoRotationHeaderExtension, 1270 TestSetSendRtpHeaderExtensions(RtpExtension::kVideoRotationUri);
1281 webrtc::RtpExtension::kVideoRotation);
1282 } 1271 }
1283 TEST_F(WebRtcVideoChannel2Test, RecvVideoRotationHeaderExtensions) { 1272 TEST_F(WebRtcVideoChannel2Test, RecvVideoRotationHeaderExtensions) {
1284 TestSetRecvRtpHeaderExtensions(kRtpVideoRotationHeaderExtension, 1273 TestSetRecvRtpHeaderExtensions(RtpExtension::kVideoRotationUri);
1285 webrtc::RtpExtension::kVideoRotation);
1286 } 1274 }
1287 1275
1288 TEST_F(WebRtcVideoChannel2Test, IdenticalSendExtensionsDoesntRecreateStream) { 1276 TEST_F(WebRtcVideoChannel2Test, IdenticalSendExtensionsDoesntRecreateStream) {
1289 const int kAbsSendTimeId = 1; 1277 const int kAbsSendTimeId = 1;
1290 const int kVideoRotationId = 2; 1278 const int kVideoRotationId = 2;
1291 send_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1279 send_parameters_.extensions.push_back(
1292 kRtpAbsoluteSenderTimeHeaderExtension, kAbsSendTimeId)); 1280 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId));
1293 send_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1281 send_parameters_.extensions.push_back(
1294 kRtpVideoRotationHeaderExtension, kVideoRotationId)); 1282 RtpExtension(RtpExtension::kVideoRotationUri, kVideoRotationId));
1295 1283
1296 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 1284 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
1297 FakeVideoSendStream* send_stream = 1285 FakeVideoSendStream* send_stream =
1298 AddSendStream(cricket::StreamParams::CreateLegacy(123)); 1286 AddSendStream(cricket::StreamParams::CreateLegacy(123));
1299 1287
1300 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams()); 1288 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams());
1301 ASSERT_EQ(2u, send_stream->GetConfig().rtp.extensions.size()); 1289 ASSERT_EQ(2u, send_stream->GetConfig().rtp.extensions.size());
1302 1290
1303 // Setting the same extensions (even if in different order) shouldn't 1291 // Setting the same extensions (even if in different order) shouldn't
1304 // reallocate the stream. 1292 // reallocate the stream.
1305 std::reverse(send_parameters_.extensions.begin(), 1293 std::reverse(send_parameters_.extensions.begin(),
1306 send_parameters_.extensions.end()); 1294 send_parameters_.extensions.end());
1307 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 1295 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
1308 1296
1309 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams()); 1297 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams());
1310 1298
1311 // Setting different extensions should recreate the stream. 1299 // Setting different extensions should recreate the stream.
1312 send_parameters_.extensions.resize(1); 1300 send_parameters_.extensions.resize(1);
1313 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 1301 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
1314 1302
1315 EXPECT_EQ(2, fake_call_->GetNumCreatedSendStreams()); 1303 EXPECT_EQ(2, fake_call_->GetNumCreatedSendStreams());
1316 } 1304 }
1317 1305
1318 TEST_F(WebRtcVideoChannel2Test, IdenticalRecvExtensionsDoesntRecreateStream) { 1306 TEST_F(WebRtcVideoChannel2Test, IdenticalRecvExtensionsDoesntRecreateStream) {
1319 const int kTOffsetId = 1; 1307 const int kTOffsetId = 1;
1320 const int kAbsSendTimeId = 2; 1308 const int kAbsSendTimeId = 2;
1321 const int kVideoRotationId = 3; 1309 const int kVideoRotationId = 3;
1322 recv_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1310 recv_parameters_.extensions.push_back(
1323 kRtpAbsoluteSenderTimeHeaderExtension, kAbsSendTimeId)); 1311 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId));
1324 recv_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1312 recv_parameters_.extensions.push_back(
1325 kRtpTimestampOffsetHeaderExtension, kTOffsetId)); 1313 RtpExtension(RtpExtension::kTimestampOffsetUri, kTOffsetId));
1326 recv_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1314 recv_parameters_.extensions.push_back(
1327 kRtpVideoRotationHeaderExtension, kVideoRotationId)); 1315 RtpExtension(RtpExtension::kVideoRotationUri, kVideoRotationId));
1328 1316
1329 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 1317 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
1330 FakeVideoReceiveStream* recv_stream = 1318 FakeVideoReceiveStream* recv_stream =
1331 AddRecvStream(cricket::StreamParams::CreateLegacy(123)); 1319 AddRecvStream(cricket::StreamParams::CreateLegacy(123));
1332 1320
1333 EXPECT_EQ(1, fake_call_->GetNumCreatedReceiveStreams()); 1321 EXPECT_EQ(1, fake_call_->GetNumCreatedReceiveStreams());
1334 ASSERT_EQ(3u, recv_stream->GetConfig().rtp.extensions.size()); 1322 ASSERT_EQ(3u, recv_stream->GetConfig().rtp.extensions.size());
1335 1323
1336 // Setting the same extensions (even if in different order) shouldn't 1324 // Setting the same extensions (even if in different order) shouldn't
1337 // reallocate the stream. 1325 // reallocate the stream.
1338 std::reverse(recv_parameters_.extensions.begin(), 1326 std::reverse(recv_parameters_.extensions.begin(),
1339 recv_parameters_.extensions.end()); 1327 recv_parameters_.extensions.end());
1340 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 1328 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
1341 1329
1342 EXPECT_EQ(1, fake_call_->GetNumCreatedReceiveStreams()); 1330 EXPECT_EQ(1, fake_call_->GetNumCreatedReceiveStreams());
1343 1331
1344 // Setting different extensions should recreate the stream. 1332 // Setting different extensions should recreate the stream.
1345 recv_parameters_.extensions.resize(1); 1333 recv_parameters_.extensions.resize(1);
1346 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 1334 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
1347 1335
1348 EXPECT_EQ(2, fake_call_->GetNumCreatedReceiveStreams()); 1336 EXPECT_EQ(2, fake_call_->GetNumCreatedReceiveStreams());
1349 } 1337 }
1350 1338
1351 TEST_F(WebRtcVideoChannel2Test, 1339 TEST_F(WebRtcVideoChannel2Test,
1352 SetSendRtpHeaderExtensionsExcludeUnsupportedExtensions) { 1340 SetSendRtpHeaderExtensionsExcludeUnsupportedExtensions) {
1353 const int kUnsupportedId = 1; 1341 const int kUnsupportedId = 1;
1354 const int kTOffsetId = 2; 1342 const int kTOffsetId = 2;
1355 1343
1356 send_parameters_.extensions.push_back( 1344 send_parameters_.extensions.push_back(
1357 cricket::RtpHeaderExtension(kUnsupportedExtensionName, kUnsupportedId)); 1345 RtpExtension(kUnsupportedExtensionName, kUnsupportedId));
1358 send_parameters_.extensions.push_back( 1346 send_parameters_.extensions.push_back(
1359 cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, kTOffsetId)); 1347 RtpExtension(RtpExtension::kTimestampOffsetUri, kTOffsetId));
1360 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 1348 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
1361 FakeVideoSendStream* send_stream = 1349 FakeVideoSendStream* send_stream =
1362 AddSendStream(cricket::StreamParams::CreateLegacy(123)); 1350 AddSendStream(cricket::StreamParams::CreateLegacy(123));
1363 1351
1364 // Only timestamp offset extension is set to send stream, 1352 // Only timestamp offset extension is set to send stream,
1365 // unsupported rtp extension is ignored. 1353 // unsupported rtp extension is ignored.
1366 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size()); 1354 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
1367 EXPECT_STREQ(webrtc::RtpExtension::kTOffset, 1355 EXPECT_STREQ(RtpExtension::kTimestampOffsetUri,
1368 send_stream->GetConfig().rtp.extensions[0].name.c_str()); 1356 send_stream->GetConfig().rtp.extensions[0].uri.c_str());
1369 } 1357 }
1370 1358
1371 TEST_F(WebRtcVideoChannel2Test, 1359 TEST_F(WebRtcVideoChannel2Test,
1372 SetRecvRtpHeaderExtensionsExcludeUnsupportedExtensions) { 1360 SetRecvRtpHeaderExtensionsExcludeUnsupportedExtensions) {
1373 const int kUnsupportedId = 1; 1361 const int kUnsupportedId = 1;
1374 const int kTOffsetId = 2; 1362 const int kTOffsetId = 2;
1375 1363
1376 recv_parameters_.extensions.push_back( 1364 recv_parameters_.extensions.push_back(
1377 cricket::RtpHeaderExtension(kUnsupportedExtensionName, kUnsupportedId)); 1365 RtpExtension(kUnsupportedExtensionName, kUnsupportedId));
1378 recv_parameters_.extensions.push_back( 1366 recv_parameters_.extensions.push_back(
1379 cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, kTOffsetId)); 1367 RtpExtension(RtpExtension::kTimestampOffsetUri, kTOffsetId));
1380 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 1368 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
1381 FakeVideoReceiveStream* recv_stream = 1369 FakeVideoReceiveStream* recv_stream =
1382 AddRecvStream(cricket::StreamParams::CreateLegacy(123)); 1370 AddRecvStream(cricket::StreamParams::CreateLegacy(123));
1383 1371
1384 // Only timestamp offset extension is set to receive stream, 1372 // Only timestamp offset extension is set to receive stream,
1385 // unsupported rtp extension is ignored. 1373 // unsupported rtp extension is ignored.
1386 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); 1374 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size());
1387 EXPECT_STREQ(webrtc::RtpExtension::kTOffset, 1375 EXPECT_STREQ(RtpExtension::kTimestampOffsetUri,
1388 recv_stream->GetConfig().rtp.extensions[0].name.c_str()); 1376 recv_stream->GetConfig().rtp.extensions[0].uri.c_str());
1389 } 1377 }
1390 1378
1391 TEST_F(WebRtcVideoChannel2Test, SetSendRtpHeaderExtensionsRejectsIncorrectIds) { 1379 TEST_F(WebRtcVideoChannel2Test, SetSendRtpHeaderExtensionsRejectsIncorrectIds) {
1392 const int kIncorrectIds[] = {-2, -1, 0, 15, 16}; 1380 const int kIncorrectIds[] = {-2, -1, 0, 15, 16};
1393 for (size_t i = 0; i < arraysize(kIncorrectIds); ++i) { 1381 for (size_t i = 0; i < arraysize(kIncorrectIds); ++i) {
1394 send_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1382 send_parameters_.extensions.push_back(
1395 webrtc::RtpExtension::kTOffset, kIncorrectIds[i])); 1383 RtpExtension(RtpExtension::kTimestampOffsetUri, kIncorrectIds[i]));
1396 EXPECT_FALSE(channel_->SetSendParameters(send_parameters_)) 1384 EXPECT_FALSE(channel_->SetSendParameters(send_parameters_))
1397 << "Bad extension id '" << kIncorrectIds[i] << "' accepted."; 1385 << "Bad extension id '" << kIncorrectIds[i] << "' accepted.";
1398 } 1386 }
1399 } 1387 }
1400 1388
1401 TEST_F(WebRtcVideoChannel2Test, SetRecvRtpHeaderExtensionsRejectsIncorrectIds) { 1389 TEST_F(WebRtcVideoChannel2Test, SetRecvRtpHeaderExtensionsRejectsIncorrectIds) {
1402 const int kIncorrectIds[] = {-2, -1, 0, 15, 16}; 1390 const int kIncorrectIds[] = {-2, -1, 0, 15, 16};
1403 for (size_t i = 0; i < arraysize(kIncorrectIds); ++i) { 1391 for (size_t i = 0; i < arraysize(kIncorrectIds); ++i) {
1404 recv_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1392 recv_parameters_.extensions.push_back(
1405 webrtc::RtpExtension::kTOffset, kIncorrectIds[i])); 1393 RtpExtension(RtpExtension::kTimestampOffsetUri, kIncorrectIds[i]));
1406 EXPECT_FALSE(channel_->SetRecvParameters(recv_parameters_)) 1394 EXPECT_FALSE(channel_->SetRecvParameters(recv_parameters_))
1407 << "Bad extension id '" << kIncorrectIds[i] << "' accepted."; 1395 << "Bad extension id '" << kIncorrectIds[i] << "' accepted.";
1408 } 1396 }
1409 } 1397 }
1410 1398
1411 TEST_F(WebRtcVideoChannel2Test, SetSendRtpHeaderExtensionsRejectsDuplicateIds) { 1399 TEST_F(WebRtcVideoChannel2Test, SetSendRtpHeaderExtensionsRejectsDuplicateIds) {
1412 const int id = 1; 1400 const int id = 1;
1413 send_parameters_.extensions.push_back( 1401 send_parameters_.extensions.push_back(
1414 cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, id)); 1402 RtpExtension(RtpExtension::kTimestampOffsetUri, id));
1415 send_parameters_.extensions.push_back( 1403 send_parameters_.extensions.push_back(
1416 cricket::RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension, id)); 1404 RtpExtension(RtpExtension::kAbsSendTimeUri, id));
1417 EXPECT_FALSE(channel_->SetSendParameters(send_parameters_)); 1405 EXPECT_FALSE(channel_->SetSendParameters(send_parameters_));
1418 1406
1419 // Duplicate entries are also not supported. 1407 // Duplicate entries are also not supported.
1420 send_parameters_.extensions.clear(); 1408 send_parameters_.extensions.clear();
1421 send_parameters_.extensions.push_back( 1409 send_parameters_.extensions.push_back(
1422 cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, id)); 1410 RtpExtension(RtpExtension::kTimestampOffsetUri, id));
1423 send_parameters_.extensions.push_back(send_parameters_.extensions.back()); 1411 send_parameters_.extensions.push_back(send_parameters_.extensions.back());
1424 EXPECT_FALSE(channel_->SetSendParameters(send_parameters_)); 1412 EXPECT_FALSE(channel_->SetSendParameters(send_parameters_));
1425 } 1413 }
1426 1414
1427 TEST_F(WebRtcVideoChannel2Test, SetRecvRtpHeaderExtensionsRejectsDuplicateIds) { 1415 TEST_F(WebRtcVideoChannel2Test, SetRecvRtpHeaderExtensionsRejectsDuplicateIds) {
1428 const int id = 1; 1416 const int id = 1;
1429 recv_parameters_.extensions.push_back( 1417 recv_parameters_.extensions.push_back(
1430 cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, id)); 1418 RtpExtension(RtpExtension::kTimestampOffsetUri, id));
1431 recv_parameters_.extensions.push_back( 1419 recv_parameters_.extensions.push_back(
1432 cricket::RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension, id)); 1420 RtpExtension(RtpExtension::kAbsSendTimeUri, id));
1433 EXPECT_FALSE(channel_->SetRecvParameters(recv_parameters_)); 1421 EXPECT_FALSE(channel_->SetRecvParameters(recv_parameters_));
1434 1422
1435 // Duplicate entries are also not supported. 1423 // Duplicate entries are also not supported.
1436 recv_parameters_.extensions.clear(); 1424 recv_parameters_.extensions.clear();
1437 recv_parameters_.extensions.push_back( 1425 recv_parameters_.extensions.push_back(
1438 cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, id)); 1426 RtpExtension(RtpExtension::kTimestampOffsetUri, id));
1439 recv_parameters_.extensions.push_back(recv_parameters_.extensions.back()); 1427 recv_parameters_.extensions.push_back(recv_parameters_.extensions.back());
1440 EXPECT_FALSE(channel_->SetRecvParameters(recv_parameters_)); 1428 EXPECT_FALSE(channel_->SetRecvParameters(recv_parameters_));
1441 } 1429 }
1442 1430
1443 TEST_F(WebRtcVideoChannel2Test, AddRecvStreamOnlyUsesOneReceiveStream) { 1431 TEST_F(WebRtcVideoChannel2Test, AddRecvStreamOnlyUsesOneReceiveStream) {
1444 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); 1432 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
1445 EXPECT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()); 1433 EXPECT_EQ(1u, fake_call_->GetVideoReceiveStreams().size());
1446 } 1434 }
1447 1435
1448 TEST_F(WebRtcVideoChannel2Test, RtcpIsCompoundByDefault) { 1436 TEST_F(WebRtcVideoChannel2Test, RtcpIsCompoundByDefault) {
(...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3779 } 3767 }
3780 3768
3781 // Test that we normalize send codec format size in simulcast. 3769 // Test that we normalize send codec format size in simulcast.
3782 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3770 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3783 cricket::VideoCodec codec(kVp8Codec270p); 3771 cricket::VideoCodec codec(kVp8Codec270p);
3784 codec.width += 1; 3772 codec.width += 1;
3785 codec.height += 1; 3773 codec.height += 1;
3786 VerifySimulcastSettings(codec, 2, 2); 3774 VerifySimulcastSettings(codec, 2, 2);
3787 } 3775 }
3788 } // namespace cricket 3776 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698