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

Side by Side Diff: talk/media/webrtc/webrtcvideoengine2_unittest.cc

Issue 1429753003: Filter overlapping RTP header extensions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: size_t conversion fix Created 5 years, 1 month 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
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 1059
1060 // Verify that adding receive RTP header extensions adds them for existing 1060 // Verify that adding receive RTP header extensions adds them for existing
1061 // streams. 1061 // streams.
1062 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 1062 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
1063 recv_stream = fake_call_->GetVideoReceiveStreams()[0]; 1063 recv_stream = fake_call_->GetVideoReceiveStreams()[0];
1064 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); 1064 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size());
1065 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id); 1065 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id);
1066 EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name); 1066 EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name);
1067 } 1067 }
1068 1068
1069 void TestExtensionFilter(const std::vector<std::string>& extensions,
1070 const std::string& expected_extension) {
1071 cricket::VideoSendParameters parameters = send_parameters_;
1072 int expected_id = -1;
1073 int id = 1;
1074 for (const std::string& extension : extensions) {
1075 if (extension == expected_extension)
1076 expected_id = id;
1077 parameters.extensions.push_back(
1078 cricket::RtpHeaderExtension(extension, id++));
1079 }
1080 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1081 FakeVideoSendStream* send_stream =
1082 AddSendStream(cricket::StreamParams::CreateLegacy(123));
1083
1084 // Verify that only one of them has been set, and that it is the one with
1085 // highest priority (transport sequence number).
1086 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
1087 EXPECT_EQ(expected_id, send_stream->GetConfig().rtp.extensions[0].id);
1088 EXPECT_EQ(expected_extension,
1089 send_stream->GetConfig().rtp.extensions[0].name);
1090 }
1091
1069 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare); 1092 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare);
1070 void TestReceiverLocalSsrcConfiguration(bool receiver_first); 1093 void TestReceiverLocalSsrcConfiguration(bool receiver_first);
1071 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type, 1094 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type,
1072 bool expect_created_receive_stream); 1095 bool expect_created_receive_stream);
1073 1096
1074 FakeVideoSendStream* SetDenoisingOption( 1097 FakeVideoSendStream* SetDenoisingOption(
1075 const cricket::VideoSendParameters& parameters, bool enabled) { 1098 const cricket::VideoSendParameters& parameters, bool enabled) {
1076 cricket::VideoSendParameters params = parameters; 1099 cricket::VideoSendParameters params = parameters;
1077 params.options.video_noise_reduction.Set(enabled); 1100 params.options.video_noise_reduction.Set(enabled);
1078 channel_->SetSendParameters(params); 1101 channel_->SetSendParameters(params);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 // Test support for absolute send time header extension. 1215 // Test support for absolute send time header extension.
1193 TEST_F(WebRtcVideoChannel2Test, SendAbsoluteSendTimeHeaderExtensions) { 1216 TEST_F(WebRtcVideoChannel2Test, SendAbsoluteSendTimeHeaderExtensions) {
1194 TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension, 1217 TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension,
1195 webrtc::RtpExtension::kAbsSendTime); 1218 webrtc::RtpExtension::kAbsSendTime);
1196 } 1219 }
1197 TEST_F(WebRtcVideoChannel2Test, RecvAbsoluteSendTimeHeaderExtensions) { 1220 TEST_F(WebRtcVideoChannel2Test, RecvAbsoluteSendTimeHeaderExtensions) {
1198 TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension, 1221 TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension,
1199 webrtc::RtpExtension::kAbsSendTime); 1222 webrtc::RtpExtension::kAbsSendTime);
1200 } 1223 }
1201 1224
1225 TEST_F(WebRtcVideoChannel2Test, FiltersExtensionsPicksTransportSeqNum) {
1226 // Enable three redundant extensions.
1227 std::vector<std::string> extensions;
1228 extensions.push_back(kRtpAbsoluteSenderTimeHeaderExtension);
1229 extensions.push_back(kRtpTimestampOffsetHeaderExtension);
1230 extensions.push_back(kRtpTransportSequenceNumberHeaderExtension);
1231 TestExtensionFilter(extensions, kRtpTransportSequenceNumberHeaderExtension);
1232 }
1233
1234 TEST_F(WebRtcVideoChannel2Test, FiltersExtensionsPicksAbsSendTime) {
1235 // Enable two redundant extensions.
1236 std::vector<std::string> extensions;
1237 extensions.push_back(kRtpAbsoluteSenderTimeHeaderExtension);
1238 extensions.push_back(kRtpTimestampOffsetHeaderExtension);
1239 TestExtensionFilter(extensions, kRtpAbsoluteSenderTimeHeaderExtension);
1240 }
1241
1202 class WebRtcVideoChannel2WithSendSideBweTest : public WebRtcVideoChannel2Test { 1242 class WebRtcVideoChannel2WithSendSideBweTest : public WebRtcVideoChannel2Test {
1203 public: 1243 public:
1204 WebRtcVideoChannel2WithSendSideBweTest() 1244 WebRtcVideoChannel2WithSendSideBweTest()
1205 : WebRtcVideoChannel2Test("WebRTC-SendSideBwe/Enabled/") {} 1245 : WebRtcVideoChannel2Test("WebRTC-SendSideBwe/Enabled/") {}
1206 }; 1246 };
1207 1247
1208 // Test support for transport sequence number header extension. 1248 // Test support for transport sequence number header extension.
1209 TEST_F(WebRtcVideoChannel2WithSendSideBweTest, 1249 TEST_F(WebRtcVideoChannel2WithSendSideBweTest,
1210 SendTransportSequenceNumberHeaderExtensions) { 1250 SendTransportSequenceNumberHeaderExtensions) {
1211 TestSetSendRtpHeaderExtensions( 1251 TestSetSendRtpHeaderExtensions(
(...skipping 11 matching lines...) Expand all
1223 TEST_F(WebRtcVideoChannel2Test, SendVideoRotationHeaderExtensions) { 1263 TEST_F(WebRtcVideoChannel2Test, SendVideoRotationHeaderExtensions) {
1224 TestSetSendRtpHeaderExtensions(kRtpVideoRotationHeaderExtension, 1264 TestSetSendRtpHeaderExtensions(kRtpVideoRotationHeaderExtension,
1225 webrtc::RtpExtension::kVideoRotation); 1265 webrtc::RtpExtension::kVideoRotation);
1226 } 1266 }
1227 TEST_F(WebRtcVideoChannel2Test, RecvVideoRotationHeaderExtensions) { 1267 TEST_F(WebRtcVideoChannel2Test, RecvVideoRotationHeaderExtensions) {
1228 TestSetRecvRtpHeaderExtensions(kRtpVideoRotationHeaderExtension, 1268 TestSetRecvRtpHeaderExtensions(kRtpVideoRotationHeaderExtension,
1229 webrtc::RtpExtension::kVideoRotation); 1269 webrtc::RtpExtension::kVideoRotation);
1230 } 1270 }
1231 1271
1232 TEST_F(WebRtcVideoChannel2Test, IdenticalSendExtensionsDoesntRecreateStream) { 1272 TEST_F(WebRtcVideoChannel2Test, IdenticalSendExtensionsDoesntRecreateStream) {
1233 const int kTOffsetId = 1; 1273 const int kAbsSendTimeId = 1;
1234 const int kAbsSendTimeId = 2; 1274 const int kVideoRotationId = 2;
1235 const int kVideoRotationId = 3;
1236 send_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1275 send_parameters_.extensions.push_back(cricket::RtpHeaderExtension(
1237 kRtpAbsoluteSenderTimeHeaderExtension, kAbsSendTimeId)); 1276 kRtpAbsoluteSenderTimeHeaderExtension, kAbsSendTimeId));
1238 send_parameters_.extensions.push_back(cricket::RtpHeaderExtension( 1277 send_parameters_.extensions.push_back(cricket::RtpHeaderExtension(
1239 kRtpTimestampOffsetHeaderExtension, kTOffsetId));
1240 send_parameters_.extensions.push_back(cricket::RtpHeaderExtension(
1241 kRtpVideoRotationHeaderExtension, kVideoRotationId)); 1278 kRtpVideoRotationHeaderExtension, kVideoRotationId));
1242 1279
1243 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 1280 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
1244 FakeVideoSendStream* send_stream = 1281 FakeVideoSendStream* send_stream =
1245 AddSendStream(cricket::StreamParams::CreateLegacy(123)); 1282 AddSendStream(cricket::StreamParams::CreateLegacy(123));
1246 1283
1247 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams()); 1284 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams());
1248 ASSERT_EQ(3u, send_stream->GetConfig().rtp.extensions.size()); 1285 ASSERT_EQ(2u, send_stream->GetConfig().rtp.extensions.size());
1249 1286
1250 // Setting the same extensions (even if in different order) shouldn't 1287 // Setting the same extensions (even if in different order) shouldn't
1251 // reallocate the stream. 1288 // reallocate the stream.
1252 std::reverse(send_parameters_.extensions.begin(), 1289 std::reverse(send_parameters_.extensions.begin(),
1253 send_parameters_.extensions.end()); 1290 send_parameters_.extensions.end());
1254 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 1291 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
1255 1292
1256 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams()); 1293 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams());
1257 1294
1258 // Setting different extensions should recreate the stream. 1295 // Setting different extensions should recreate the stream.
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after
3234 // Ensures that the correct settings are applied to the codec when two temporal 3271 // Ensures that the correct settings are applied to the codec when two temporal
3235 // layer screencasting is enabled, and that the correct simulcast settings are 3272 // layer screencasting is enabled, and that the correct simulcast settings are
3236 // reapplied when disabling screencasting. 3273 // reapplied when disabling screencasting.
3237 TEST_F(WebRtcVideoChannel2SimulcastTest, 3274 TEST_F(WebRtcVideoChannel2SimulcastTest,
3238 DISABLED_TwoTemporalLayerScreencastSettings) { 3275 DISABLED_TwoTemporalLayerScreencastSettings) {
3239 // TODO(pbos): Implement. 3276 // TODO(pbos): Implement.
3240 FAIL() << "Not implemented."; 3277 FAIL() << "Not implemented.";
3241 } 3278 }
3242 3279
3243 } // namespace cricket 3280 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698