Chromium Code Reviews

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

Issue 1581113006: Support REMB in combination with send-side BWE. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.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 * 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/event.h"
19 #include "webrtc/base/scoped_ptr.h" 19 #include "webrtc/base/scoped_ptr.h"
20 #include "webrtc/call.h" 20 #include "webrtc/call.h"
21 #include "webrtc/call/transport_adapter.h" 21 #include "webrtc/call/transport_adapter.h"
22 #include "webrtc/frame_callback.h" 22 #include "webrtc/frame_callback.h"
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
24 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
25 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 26 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
26 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 27 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
27 #include "webrtc/modules/video_coding/include/video_coding_defines.h" 28 #include "webrtc/modules/video_coding/include/video_coding_defines.h"
28 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 29 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
29 #include "webrtc/system_wrappers/include/metrics.h" 30 #include "webrtc/system_wrappers/include/metrics.h"
30 #include "webrtc/system_wrappers/include/sleep.h" 31 #include "webrtc/system_wrappers/include/sleep.h"
31 #include "webrtc/test/call_test.h" 32 #include "webrtc/test/call_test.h"
32 #include "webrtc/test/direct_transport.h" 33 #include "webrtc/test/direct_transport.h"
(...skipping 1734 matching lines...)
1767 1768
1768 private: 1769 private:
1769 Call* sender_call_; 1770 Call* sender_call_;
1770 Call* receiver_call_; 1771 Call* receiver_call_;
1771 bool has_seen_pacer_delay_; 1772 bool has_seen_pacer_delay_;
1772 } test; 1773 } test;
1773 1774
1774 RunBaseTest(&test); 1775 RunBaseTest(&test);
1775 } 1776 }
1776 1777
1778 TEST_F(EndToEndTest, RembWithSendSideBwe) {
1779 class BweObserver : public test::EndToEndTest {
1780 public:
1781 BweObserver()
1782 : EndToEndTest(kDefaultTimeoutMs),
1783 sender_call_(nullptr),
1784 clock_(Clock::GetRealTimeClock()),
1785 sender_ssrc_(0),
1786 remb_bitrate_bps_(1000000),
1787 receive_transport_(nullptr),
1788 event_(false, false),
1789 poller_thread_(&BitrateStatsPollingThread,
1790 this,
1791 "BitrateStatsPollingThread"),
1792 state_(kWaitForFirstRampUp) {}
1793
1794 ~BweObserver() {}
1795
1796 test::PacketTransport* CreateReceiveTransport() {
1797 receive_transport_ = new test::PacketTransport(
1798 nullptr, this, test::PacketTransport::kReceiver,
1799 FakeNetworkPipe::Config());
1800 return receive_transport_;
1801 }
1802
1803 Call::Config GetSenderCallConfig() override {
1804 Call::Config config;
1805 // Set a high start bitrate to reduce the test completion time.
1806 config.bitrate_config.start_bitrate_bps = remb_bitrate_bps_;
1807 return config;
1808 }
1809
1810 void ModifyVideoConfigs(
1811 VideoSendStream::Config* send_config,
1812 std::vector<VideoReceiveStream::Config>* receive_configs,
1813 VideoEncoderConfig* encoder_config) override {
1814 ASSERT_EQ(1u, send_config->rtp.ssrcs.size());
1815 send_config->rtp.extensions.clear();
1816 send_config->rtp.extensions.push_back(
1817 RtpExtension(RtpExtension::kTransportSequenceNumber,
1818 test::kTransportSequenceNumberExtensionId));
1819 sender_ssrc_ = send_config->rtp.ssrcs[0];
1820
1821 encoder_config->streams[0].max_bitrate_bps =
1822 encoder_config->streams[0].target_bitrate_bps = 2000000;
1823
1824 ASSERT_EQ(1u, receive_configs->size());
1825 (*receive_configs)[0].rtp.remb = false;
sprang 2016/01/15 13:36:27 Why do we set this to false? Just to explicitly in
stefan-webrtc 2016/01/20 12:50:28 Yes. It should however not have any effect.
1826 (*receive_configs)[0].rtp.transport_cc = true;
1827 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions;
1828 RtpRtcp::Configuration config;
1829 config.receiver_only = true;
1830 config.clock = clock_;
1831 config.outgoing_transport = receive_transport_;
1832 rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(config));
1833 rtp_rtcp_->SetRemoteSSRC((*receive_configs)[0].rtp.remote_ssrc);
1834 rtp_rtcp_->SetSSRC((*receive_configs)[0].rtp.local_ssrc);
1835 rtp_rtcp_->SetREMBStatus(true);
1836 rtp_rtcp_->SetSendingStatus(true);
1837 rtp_rtcp_->SetRTCPStatus(RtcpMode::kReducedSize);
1838 }
1839
1840 void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
1841 sender_call_ = sender_call;
1842 }
1843
1844 static bool BitrateStatsPollingThread(void* obj) {
1845 return static_cast<BweObserver*>(obj)->PollStats();
1846 }
1847
1848 bool PollStats() {
1849 if (sender_call_) {
sprang 2016/01/15 13:36:27 A short description of what this test case does wo
stefan-webrtc 2016/01/20 12:50:28 Done.
1850 Call::Stats stats = sender_call_->GetStats();
1851 switch (state_) {
1852 case kWaitForFirstRampUp:
1853 if (stats.send_bandwidth_bps >= remb_bitrate_bps_) {
1854 state_ = kWaitForRemb;
1855 remb_bitrate_bps_ /= 2;
1856 rtp_rtcp_->SetREMBData(
1857 remb_bitrate_bps_,
1858 std::vector<uint32_t>(&sender_ssrc_, &sender_ssrc_ + 1));
1859 rtp_rtcp_->SendRTCP(kRtcpRr);
1860 }
1861 break;
1862
1863 case kWaitForRemb:
1864 if (stats.send_bandwidth_bps == remb_bitrate_bps_) {
1865 state_ = kWaitForSecondRampUp;
1866 remb_bitrate_bps_ *= 2;
1867 rtp_rtcp_->SetREMBData(
1868 remb_bitrate_bps_,
1869 std::vector<uint32_t>(&sender_ssrc_, &sender_ssrc_ + 1));
1870 rtp_rtcp_->SendRTCP(kRtcpRr);
1871 }
1872 break;
1873
1874 case kWaitForSecondRampUp:
1875 if (stats.send_bandwidth_bps == remb_bitrate_bps_) {
1876 observation_complete_.Set();
1877 }
1878 break;
1879 }
1880 }
1881
1882 return !event_.Wait(1000);
1883 }
1884
1885 void PerformTest() override {
1886 poller_thread_.Start();
1887 EXPECT_TRUE(Wait())
1888 << "Timed out while waiting for bitrate to change according to REMB.";
1889 poller_thread_.Stop();
1890 }
1891
1892 private:
1893 enum TestState { kWaitForFirstRampUp, kWaitForRemb, kWaitForSecondRampUp };
1894
1895 Call* sender_call_;
1896 Clock* const clock_;
1897 uint32_t sender_ssrc_;
1898 int remb_bitrate_bps_;
1899 rtc::scoped_ptr<RtpRtcp> rtp_rtcp_;
1900 test::PacketTransport* receive_transport_;
1901 rtc::Event event_;
1902 rtc::PlatformThread poller_thread_;
1903 TestState state_;
1904 } test;
1905
1906 RunBaseTest(&test);
1907 }
1908
1777 TEST_F(EndToEndTest, VerifyNackStats) { 1909 TEST_F(EndToEndTest, VerifyNackStats) {
1778 static const int kPacketNumberToDrop = 200; 1910 static const int kPacketNumberToDrop = 200;
1779 class NackObserver : public test::EndToEndTest { 1911 class NackObserver : public test::EndToEndTest {
1780 public: 1912 public:
1781 NackObserver() 1913 NackObserver()
1782 : EndToEndTest(kLongTimeoutMs), 1914 : EndToEndTest(kLongTimeoutMs),
1783 sent_rtp_packets_(0), 1915 sent_rtp_packets_(0),
1784 dropped_rtp_packet_(0), 1916 dropped_rtp_packet_(0),
1785 dropped_rtp_packet_requested_(false), 1917 dropped_rtp_packet_requested_(false),
1786 send_stream_(nullptr), 1918 send_stream_(nullptr),
(...skipping 1536 matching lines...)
3323 private: 3455 private:
3324 bool video_observed_; 3456 bool video_observed_;
3325 bool audio_observed_; 3457 bool audio_observed_;
3326 SequenceNumberUnwrapper unwrapper_; 3458 SequenceNumberUnwrapper unwrapper_;
3327 std::set<int64_t> received_packet_ids_; 3459 std::set<int64_t> received_packet_ids_;
3328 } test; 3460 } test;
3329 3461
3330 RunBaseTest(&test); 3462 RunBaseTest(&test);
3331 } 3463 }
3332 } // namespace webrtc 3464 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine