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

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

Issue 1338203003: Wire up send-side bandwidth estimation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments, rebase Created 5 years, 3 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) 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> 10 #include <algorithm>
11 #include <map> 11 #include <map>
12 #include <sstream> 12 #include <sstream>
13 #include <string> 13 #include <string>
14 14
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/event.h"
18 #include "webrtc/base/scoped_ptr.h" 19 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/call.h" 20 #include "webrtc/call.h"
20 #include "webrtc/frame_callback.h" 21 #include "webrtc/frame_callback.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
22 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 23 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
23 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 24 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
24 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" 25 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
25 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 26 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
26 #include "webrtc/system_wrappers/interface/event_wrapper.h" 27 #include "webrtc/system_wrappers/interface/event_wrapper.h"
27 #include "webrtc/system_wrappers/interface/metrics.h" 28 #include "webrtc/system_wrappers/interface/metrics.h"
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 return observer_; 1427 return observer_;
1427 } 1428 }
1428 1429
1429 private: 1430 private:
1430 RtpExtensionHeaderObserver* observer_; 1431 RtpExtensionHeaderObserver* observer_;
1431 } tester; 1432 } tester;
1432 1433
1433 tester.RunTest(); 1434 tester.RunTest();
1434 } 1435 }
1435 1436
1437 TEST_F(EndToEndTest, ReceivesTransportFeedback) {
1438 static const int kExtensionId = 5;
1439
1440 class TransportFeedbackObserver : public test::DirectTransport {
1441 public:
1442 TransportFeedbackObserver(rtc::Event* done_event) : done_(done_event) {}
1443 virtual ~TransportFeedbackObserver() {}
1444
1445 bool SendRtcp(const uint8_t* data, size_t length) override {
1446 RTCPUtility::RTCPParserV2 parser(data, length, true);
1447 EXPECT_TRUE(parser.IsValid());
1448
1449 RTCPUtility::RTCPPacketTypes packet_type = parser.Begin();
1450 while (packet_type != RTCPUtility::RTCPPacketTypes::kInvalid) {
1451 if (packet_type == RTCPUtility::RTCPPacketTypes::kTransportFeedback) {
1452 done_->Set();
1453 break;
1454 }
1455 packet_type = parser.Iterate();
1456 }
1457
1458 return test::DirectTransport::SendRtcp(data, length);
1459 }
1460
1461 rtc::Event* done_;
1462 };
1463
1464 class TransportFeedbackTester : public MultiStreamTest {
1465 public:
1466 TransportFeedbackTester() : done_(false, false) {}
1467 virtual ~TransportFeedbackTester() {}
1468
1469 protected:
1470 void Wait() override {
1471 EXPECT_TRUE(done_.Wait(CallTest::kDefaultTimeoutMs));
1472 }
1473
1474 void UpdateSendConfig(
1475 size_t stream_index,
1476 VideoSendStream::Config* send_config,
1477 VideoEncoderConfig* encoder_config,
1478 test::FrameGeneratorCapturer** frame_generator) override {
1479 send_config->rtp.extensions.push_back(
1480 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId));
1481 }
1482
1483 void UpdateReceiveConfig(
1484 size_t stream_index,
1485 VideoReceiveStream::Config* receive_config) override {
1486 receive_config->rtp.extensions.push_back(
1487 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId));
1488 }
1489
1490 virtual test::DirectTransport* CreateReceiveTransport() {
1491 return new TransportFeedbackObserver(&done_);
1492 }
1493
1494 private:
1495 rtc::Event done_;
1496 } tester;
1497 tester.RunTest();
1498 }
1436 TEST_F(EndToEndTest, ObserversEncodedFrames) { 1499 TEST_F(EndToEndTest, ObserversEncodedFrames) {
1437 class EncodedFrameTestObserver : public EncodedFrameObserver { 1500 class EncodedFrameTestObserver : public EncodedFrameObserver {
1438 public: 1501 public:
1439 EncodedFrameTestObserver() 1502 EncodedFrameTestObserver()
1440 : length_(0), 1503 : length_(0),
1441 frame_type_(kFrameEmpty), 1504 frame_type_(kFrameEmpty),
1442 called_(EventWrapper::Create()) {} 1505 called_(EventWrapper::Create()) {}
1443 virtual ~EncodedFrameTestObserver() {} 1506 virtual ~EncodedFrameTestObserver() {}
1444 1507
1445 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) { 1508 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) {
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) 3110 EXPECT_TRUE(default_receive_config.rtp.rtx.empty())
3048 << "Enabling RTX requires rtpmap: rtx negotiation."; 3111 << "Enabling RTX requires rtpmap: rtx negotiation.";
3049 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) 3112 EXPECT_TRUE(default_receive_config.rtp.extensions.empty())
3050 << "Enabling RTP extensions require negotiation."; 3113 << "Enabling RTP extensions require negotiation.";
3051 3114
3052 VerifyEmptyNackConfig(default_receive_config.rtp.nack); 3115 VerifyEmptyNackConfig(default_receive_config.rtp.nack);
3053 VerifyEmptyFecConfig(default_receive_config.rtp.fec); 3116 VerifyEmptyFecConfig(default_receive_config.rtp.fec);
3054 } 3117 }
3055 3118
3056 } // namespace webrtc 3119 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698