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

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2437503004: Set actual transport overhead in rtp_rtcp (Closed)
Patch Set: Fix bugs discoverd with unittest. Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #include <algorithm> // max 10 #include <algorithm> // max
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 EXPECT_GE(call_->GetStats().send_bandwidth_bps, kStartBitrateBps); 1318 EXPECT_GE(call_->GetStats().send_bandwidth_bps, kStartBitrateBps);
1319 } 1319 }
1320 1320
1321 private: 1321 private:
1322 Call* call_; 1322 Call* call_;
1323 } test; 1323 } test;
1324 1324
1325 RunBaseTest(&test); 1325 RunBaseTest(&test);
1326 } 1326 }
1327 1327
1328 TEST_F(VideoSendStreamTest, ChangingTransportOverhead) {
1329 class ChangingTransportOverheadTest : public test::EndToEndTest {
1330 public:
1331 ChangingTransportOverheadTest()
1332 : EndToEndTest(test::CallTest::kDefaultTimeoutMs),
1333 call_(nullptr),
1334 packets_sent_(0) {}
1335
1336 void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
1337 call_ = sender_call;
1338 }
1339
1340 Action OnSendRtp(const uint8_t* packet, size_t length) override {
1341 EXPECT_LE(length, IP_PACKET_SIZE - transport_overhead_);
1342 if (++packets_sent_ < 100)
1343 return SEND_PACKET;
1344 observation_complete_.Set();
1345 return SEND_PACKET;
1346 }
1347
1348 void PerformTest() override {
1349 transport_overhead_ = 500;
1350 call_->OnTransportOverheadChanged(webrtc::MediaType::VIDEO,
1351 transport_overhead_);
1352 EXPECT_TRUE(Wait());
1353 packets_sent_ = 0;
1354 transport_overhead_ = 1000;
1355 call_->OnTransportOverheadChanged(webrtc::MediaType::VIDEO,
1356 transport_overhead_);
1357 EXPECT_TRUE(Wait());
1358 }
1359
1360 private:
1361 Call* call_;
1362 int packets_sent_;
1363 size_t transport_overhead_;
1364 } test;
1365
1366 RunBaseTest(&test);
1367 }
1368
1328 class MaxPaddingSetTest : public test::SendTest { 1369 class MaxPaddingSetTest : public test::SendTest {
1329 public: 1370 public:
1330 static const uint32_t kMinTransmitBitrateBps = 400000; 1371 static const uint32_t kMinTransmitBitrateBps = 400000;
1331 static const uint32_t kActualEncodeBitrateBps = 40000; 1372 static const uint32_t kActualEncodeBitrateBps = 40000;
1332 static const uint32_t kMinPacketsToSend = 50; 1373 static const uint32_t kMinPacketsToSend = 50;
1333 1374
1334 explicit MaxPaddingSetTest(bool test_switch_content_type) 1375 explicit MaxPaddingSetTest(bool test_switch_content_type)
1335 : SendTest(test::CallTest::kDefaultTimeoutMs), 1376 : SendTest(test::CallTest::kDefaultTimeoutMs),
1336 call_(nullptr), 1377 call_(nullptr),
1337 send_stream_(nullptr), 1378 send_stream_(nullptr),
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { 2990 RequestSourceRotateIfVideoOrientationExtensionNotSupported) {
2950 TestRequestSourceRotateVideo(false); 2991 TestRequestSourceRotateVideo(false);
2951 } 2992 }
2952 2993
2953 TEST_F(VideoSendStreamTest, 2994 TEST_F(VideoSendStreamTest,
2954 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { 2995 DoNotRequestsRotationIfVideoOrientationExtensionSupported) {
2955 TestRequestSourceRotateVideo(true); 2996 TestRequestSourceRotateVideo(true);
2956 } 2997 }
2957 2998
2958 } // namespace webrtc 2999 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698