Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / video / rampup_tests.cc
1 /*
2  *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #include <assert.h>
11
12 #include <map>
13 #include <string>
14 #include <vector>
15
16 #include "testing/gtest/include/gtest/gtest.h"
17
18 #include "webrtc/call.h"
19 #include "webrtc/common.h"
20 #include "webrtc/experiments.h"
21 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
22 #include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
23 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
24 #include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
25 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
27 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
28 #include "webrtc/system_wrappers/interface/event_wrapper.h"
29 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
30 #include "webrtc/test/direct_transport.h"
31 #include "webrtc/test/encoder_settings.h"
32 #include "webrtc/test/fake_decoder.h"
33 #include "webrtc/test/fake_encoder.h"
34 #include "webrtc/test/frame_generator_capturer.h"
35 #include "webrtc/test/testsupport/perf_test.h"
36 #include "webrtc/video/transport_adapter.h"
37
38 namespace webrtc {
39
40 namespace {
41 static const int kAbsoluteSendTimeExtensionId = 7;
42 static const int kMaxPacketSize = 1500;
43
44 class StreamObserver : public newapi::Transport, public RemoteBitrateObserver {
45  public:
46   typedef std::map<uint32_t, int> BytesSentMap;
47   typedef std::map<uint32_t, uint32_t> SsrcMap;
48   StreamObserver(const SsrcMap& rtx_media_ssrcs,
49                  newapi::Transport* feedback_transport,
50                  Clock* clock)
51       : critical_section_(CriticalSectionWrapper::CreateCriticalSection()),
52         test_done_(EventWrapper::Create()),
53         rtp_parser_(RtpHeaderParser::Create()),
54         feedback_transport_(feedback_transport),
55         receive_stats_(ReceiveStatistics::Create(clock)),
56         payload_registry_(
57             new RTPPayloadRegistry(-1,
58                                    RTPPayloadStrategy::CreateStrategy(false))),
59         clock_(clock),
60         expected_bitrate_bps_(0),
61         rtx_media_ssrcs_(rtx_media_ssrcs),
62         total_sent_(0),
63         padding_sent_(0),
64         rtx_media_sent_(0),
65         total_packets_sent_(0),
66         padding_packets_sent_(0),
67         rtx_media_packets_sent_(0) {
68     // Ideally we would only have to instantiate an RtcpSender, an
69     // RtpHeaderParser and a RemoteBitrateEstimator here, but due to the current
70     // state of the RTP module we need a full module and receive statistics to
71     // be able to produce an RTCP with REMB.
72     RtpRtcp::Configuration config;
73     config.receive_statistics = receive_stats_.get();
74     feedback_transport_.Enable();
75     config.outgoing_transport = &feedback_transport_;
76     rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(config));
77     rtp_rtcp_->SetREMBStatus(true);
78     rtp_rtcp_->SetRTCPStatus(kRtcpNonCompound);
79     rtp_parser_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime,
80                                             kAbsoluteSendTimeExtensionId);
81     AbsoluteSendTimeRemoteBitrateEstimatorFactory rbe_factory;
82     const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
83     remote_bitrate_estimator_.reset(
84         rbe_factory.Create(this, clock, kMimdControl,
85                            kRemoteBitrateEstimatorMinBitrateBps));
86   }
87
88   void set_expected_bitrate_bps(unsigned int expected_bitrate_bps) {
89     expected_bitrate_bps_ = expected_bitrate_bps;
90   }
91
92   virtual void OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs,
93                                        unsigned int bitrate) OVERRIDE {
94     CriticalSectionScoped lock(critical_section_.get());
95     assert(expected_bitrate_bps_ > 0);
96     if (bitrate >= expected_bitrate_bps_) {
97       // Just trigger if there was any rtx padding packet.
98       if (rtx_media_ssrcs_.empty() || rtx_media_sent_ > 0) {
99         TriggerTestDone();
100       }
101     }
102     rtp_rtcp_->SetREMBData(
103         bitrate, static_cast<uint8_t>(ssrcs.size()), &ssrcs[0]);
104     rtp_rtcp_->Process();
105   }
106
107   virtual bool SendRtp(const uint8_t* packet, size_t length) OVERRIDE {
108     CriticalSectionScoped lock(critical_section_.get());
109     RTPHeader header;
110     EXPECT_TRUE(rtp_parser_->Parse(packet, static_cast<int>(length), &header));
111     receive_stats_->IncomingPacket(header, length, false);
112     payload_registry_->SetIncomingPayloadType(header);
113     remote_bitrate_estimator_->IncomingPacket(
114         clock_->TimeInMilliseconds(), static_cast<int>(length - 12), header);
115     if (remote_bitrate_estimator_->TimeUntilNextProcess() <= 0) {
116       remote_bitrate_estimator_->Process();
117     }
118     total_sent_ += length;
119     padding_sent_ += header.paddingLength;
120     ++total_packets_sent_;
121     if (header.paddingLength > 0)
122       ++padding_packets_sent_;
123     if (rtx_media_ssrcs_.find(header.ssrc) != rtx_media_ssrcs_.end()) {
124       rtx_media_sent_ += length - header.headerLength - header.paddingLength;
125       if (header.paddingLength == 0)
126         ++rtx_media_packets_sent_;
127       uint8_t restored_packet[kMaxPacketSize];
128       uint8_t* restored_packet_ptr = restored_packet;
129       int restored_length = static_cast<int>(length);
130       payload_registry_->RestoreOriginalPacket(&restored_packet_ptr,
131                                                packet,
132                                                &restored_length,
133                                                rtx_media_ssrcs_[header.ssrc],
134                                                header);
135       length = restored_length;
136       EXPECT_TRUE(rtp_parser_->Parse(
137           restored_packet, static_cast<int>(length), &header));
138     } else {
139       rtp_rtcp_->SetRemoteSSRC(header.ssrc);
140     }
141     return true;
142   }
143
144   virtual bool SendRtcp(const uint8_t* packet, size_t length) OVERRIDE {
145     return true;
146   }
147
148   EventTypeWrapper Wait() { return test_done_->Wait(120 * 1000); }
149
150  private:
151   void ReportResult(const std::string& measurement,
152                     size_t value,
153                     const std::string& units) {
154     webrtc::test::PrintResult(
155         measurement, "",
156         ::testing::UnitTest::GetInstance()->current_test_info()->name(),
157         value, units, false);
158   }
159
160   void TriggerTestDone() {
161     ReportResult("total-sent", total_sent_, "bytes");
162     ReportResult("padding-sent", padding_sent_, "bytes");
163     ReportResult("rtx-media-sent", rtx_media_sent_, "bytes");
164     ReportResult("total-packets-sent", total_packets_sent_, "packets");
165     ReportResult("padding-packets-sent", padding_packets_sent_, "packets");
166     ReportResult("rtx-packets-sent", rtx_media_packets_sent_, "packets");
167     test_done_->Set();
168   }
169
170   scoped_ptr<CriticalSectionWrapper> critical_section_;
171   scoped_ptr<EventWrapper> test_done_;
172   scoped_ptr<RtpHeaderParser> rtp_parser_;
173   scoped_ptr<RtpRtcp> rtp_rtcp_;
174   internal::TransportAdapter feedback_transport_;
175   scoped_ptr<ReceiveStatistics> receive_stats_;
176   scoped_ptr<RTPPayloadRegistry> payload_registry_;
177   scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
178   Clock* clock_;
179   unsigned int expected_bitrate_bps_;
180   SsrcMap rtx_media_ssrcs_;
181   size_t total_sent_;
182   size_t padding_sent_;
183   size_t rtx_media_sent_;
184   int total_packets_sent_;
185   int padding_packets_sent_;
186   int rtx_media_packets_sent_;
187 };
188
189 class LowRateStreamObserver : public test::DirectTransport,
190                               public RemoteBitrateObserver,
191                               public PacketReceiver {
192  public:
193   LowRateStreamObserver(newapi::Transport* feedback_transport,
194                         Clock* clock,
195                         size_t number_of_streams,
196                         bool rtx_used)
197       : critical_section_(CriticalSectionWrapper::CreateCriticalSection()),
198         test_done_(EventWrapper::Create()),
199         rtp_parser_(RtpHeaderParser::Create()),
200         feedback_transport_(feedback_transport),
201         receive_stats_(ReceiveStatistics::Create(clock)),
202         clock_(clock),
203         test_state_(kFirstRampup),
204         state_start_ms_(clock_->TimeInMilliseconds()),
205         interval_start_ms_(state_start_ms_),
206         last_remb_bps_(0),
207         sent_bytes_(0),
208         total_overuse_bytes_(0),
209         number_of_streams_(number_of_streams),
210         rtx_used_(rtx_used),
211         send_stream_(NULL),
212         suspended_in_stats_(false) {
213     RtpRtcp::Configuration config;
214     config.receive_statistics = receive_stats_.get();
215     feedback_transport_.Enable();
216     config.outgoing_transport = &feedback_transport_;
217     rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(config));
218     rtp_rtcp_->SetREMBStatus(true);
219     rtp_rtcp_->SetRTCPStatus(kRtcpNonCompound);
220     rtp_parser_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime,
221                                             kAbsoluteSendTimeExtensionId);
222     AbsoluteSendTimeRemoteBitrateEstimatorFactory rbe_factory;
223     const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 10000;
224     remote_bitrate_estimator_.reset(
225         rbe_factory.Create(this, clock, kMimdControl,
226                            kRemoteBitrateEstimatorMinBitrateBps));
227     forward_transport_config_.link_capacity_kbps =
228         kHighBandwidthLimitBps / 1000;
229     forward_transport_config_.queue_length = 100;  // Something large.
230     test::DirectTransport::SetConfig(forward_transport_config_);
231     test::DirectTransport::SetReceiver(this);
232   }
233
234   virtual void SetSendStream(const VideoSendStream* send_stream) {
235     send_stream_ = send_stream;
236   }
237
238   virtual void OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs,
239                                        unsigned int bitrate) {
240     CriticalSectionScoped lock(critical_section_.get());
241     rtp_rtcp_->SetREMBData(
242         bitrate, static_cast<uint8_t>(ssrcs.size()), &ssrcs[0]);
243     rtp_rtcp_->Process();
244     last_remb_bps_ = bitrate;
245   }
246
247   virtual bool SendRtp(const uint8_t* data, size_t length) OVERRIDE {
248     sent_bytes_ += length;
249     int64_t now_ms = clock_->TimeInMilliseconds();
250     if (now_ms > interval_start_ms_ + 1000) {  // Let at least 1 second pass.
251       // Verify that the send rate was about right.
252       unsigned int average_rate_bps = static_cast<unsigned int>(sent_bytes_) *
253                                       8 * 1000 / (now_ms - interval_start_ms_);
254       // TODO(holmer): Why is this failing?
255       // EXPECT_LT(average_rate_bps, last_remb_bps_ * 1.1);
256       if (average_rate_bps > last_remb_bps_ * 1.1) {
257         total_overuse_bytes_ +=
258             sent_bytes_ -
259             last_remb_bps_ / 8 * (now_ms - interval_start_ms_) / 1000;
260       }
261       EvolveTestState(average_rate_bps);
262       interval_start_ms_ = now_ms;
263       sent_bytes_ = 0;
264     }
265     return test::DirectTransport::SendRtp(data, length);
266   }
267
268   virtual bool DeliverPacket(const uint8_t* packet, size_t length) OVERRIDE {
269     CriticalSectionScoped lock(critical_section_.get());
270     RTPHeader header;
271     EXPECT_TRUE(rtp_parser_->Parse(packet, static_cast<int>(length), &header));
272     receive_stats_->IncomingPacket(header, length, false);
273     remote_bitrate_estimator_->IncomingPacket(
274         clock_->TimeInMilliseconds(), static_cast<int>(length - 12), header);
275     if (remote_bitrate_estimator_->TimeUntilNextProcess() <= 0) {
276       remote_bitrate_estimator_->Process();
277     }
278     suspended_in_stats_ = send_stream_->GetStats().suspended;
279     return true;
280   }
281
282   virtual bool SendRtcp(const uint8_t* packet, size_t length) OVERRIDE {
283     return true;
284   }
285
286   // Produces a string similar to "1stream_nortx", depending on the values of
287   // number_of_streams_ and rtx_used_;
288   std::string GetModifierString() {
289     std::string str("_");
290     char temp_str[5];
291     sprintf(temp_str, "%i", static_cast<int>(number_of_streams_));
292     str += std::string(temp_str);
293     str += "stream";
294     str += (number_of_streams_ > 1 ? "s" : "");
295     str += "_";
296     str += (rtx_used_ ? "" : "no");
297     str += "rtx";
298     return str;
299   }
300
301   // This method defines the state machine for the ramp up-down-up test.
302   void EvolveTestState(unsigned int bitrate_bps) {
303     int64_t now = clock_->TimeInMilliseconds();
304     assert(send_stream_ != NULL);
305     CriticalSectionScoped lock(critical_section_.get());
306     switch (test_state_) {
307       case kFirstRampup: {
308         EXPECT_FALSE(suspended_in_stats_);
309         if (bitrate_bps > kExpectedHighBitrateBps) {
310           // The first ramp-up has reached the target bitrate. Change the
311           // channel limit, and move to the next test state.
312           forward_transport_config_.link_capacity_kbps =
313               kLowBandwidthLimitBps / 1000;
314           test::DirectTransport::SetConfig(forward_transport_config_);
315           test_state_ = kLowRate;
316           webrtc::test::PrintResult("ramp_up_down_up",
317                                     GetModifierString(),
318                                     "first_rampup",
319                                     now - state_start_ms_,
320                                     "ms",
321                                     false);
322           state_start_ms_ = now;
323           interval_start_ms_ = now;
324           sent_bytes_ = 0;
325         }
326         break;
327       }
328       case kLowRate: {
329         if (bitrate_bps < kExpectedLowBitrateBps && suspended_in_stats_) {
330           // The ramp-down was successful. Change the channel limit back to a
331           // high value, and move to the next test state.
332           forward_transport_config_.link_capacity_kbps =
333               kHighBandwidthLimitBps / 1000;
334           test::DirectTransport::SetConfig(forward_transport_config_);
335           test_state_ = kSecondRampup;
336           webrtc::test::PrintResult("ramp_up_down_up",
337                                     GetModifierString(),
338                                     "rampdown",
339                                     now - state_start_ms_,
340                                     "ms",
341                                     false);
342           state_start_ms_ = now;
343           interval_start_ms_ = now;
344           sent_bytes_ = 0;
345         }
346         break;
347       }
348       case kSecondRampup: {
349         if (bitrate_bps > kExpectedHighBitrateBps && !suspended_in_stats_) {
350           webrtc::test::PrintResult("ramp_up_down_up",
351                                     GetModifierString(),
352                                     "second_rampup",
353                                     now - state_start_ms_,
354                                     "ms",
355                                     false);
356           webrtc::test::PrintResult("ramp_up_down_up",
357                                     GetModifierString(),
358                                     "total_overuse",
359                                     total_overuse_bytes_,
360                                     "bytes",
361                                     false);
362           test_done_->Set();
363         }
364         break;
365       }
366     }
367   }
368
369   EventTypeWrapper Wait() { return test_done_->Wait(120 * 1000); }
370
371  private:
372   static const unsigned int kHighBandwidthLimitBps = 80000;
373   static const unsigned int kExpectedHighBitrateBps = 60000;
374   static const unsigned int kLowBandwidthLimitBps = 20000;
375   static const unsigned int kExpectedLowBitrateBps = 20000;
376   enum TestStates { kFirstRampup, kLowRate, kSecondRampup };
377
378   scoped_ptr<CriticalSectionWrapper> critical_section_;
379   scoped_ptr<EventWrapper> test_done_;
380   scoped_ptr<RtpHeaderParser> rtp_parser_;
381   scoped_ptr<RtpRtcp> rtp_rtcp_;
382   internal::TransportAdapter feedback_transport_;
383   scoped_ptr<ReceiveStatistics> receive_stats_;
384   scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
385   Clock* clock_;
386   FakeNetworkPipe::Config forward_transport_config_;
387   TestStates test_state_;
388   int64_t state_start_ms_;
389   int64_t interval_start_ms_;
390   unsigned int last_remb_bps_;
391   size_t sent_bytes_;
392   size_t total_overuse_bytes_;
393   const size_t number_of_streams_;
394   const bool rtx_used_;
395   const VideoSendStream* send_stream_;
396   bool suspended_in_stats_ GUARDED_BY(critical_section_);
397 };
398 }
399
400 class RampUpTest : public ::testing::Test {
401  public:
402   virtual void SetUp() { reserved_ssrcs_.clear(); }
403
404  protected:
405   void RunRampUpTest(bool pacing, bool rtx, size_t num_streams) {
406     std::vector<uint32_t> ssrcs(GenerateSsrcs(num_streams, 100));
407     std::vector<uint32_t> rtx_ssrcs(GenerateSsrcs(num_streams, 200));
408     StreamObserver::SsrcMap rtx_ssrc_map;
409     if (rtx) {
410       for (size_t i = 0; i < ssrcs.size(); ++i)
411         rtx_ssrc_map[rtx_ssrcs[i]] = ssrcs[i];
412     }
413     test::DirectTransport receiver_transport;
414     StreamObserver stream_observer(rtx_ssrc_map,
415                                    &receiver_transport,
416                                    Clock::GetRealTimeClock());
417
418     Call::Config call_config(&stream_observer);
419     webrtc::Config webrtc_config;
420     call_config.webrtc_config = &webrtc_config;
421     webrtc_config.Set<PaddingStrategy>(new PaddingStrategy(rtx));
422     scoped_ptr<Call> call(Call::Create(call_config));
423     VideoSendStream::Config send_config = call->GetDefaultSendConfig();
424
425     receiver_transport.SetReceiver(call->Receiver());
426
427     test::FakeEncoder encoder(Clock::GetRealTimeClock());
428     send_config.encoder_settings =
429         test::CreateEncoderSettings(&encoder, "FAKE", 125, num_streams);
430
431     if (num_streams == 1) {
432       send_config.encoder_settings.streams[0].target_bitrate_bps = 2000000;
433       send_config.encoder_settings.streams[0].max_bitrate_bps = 2000000;
434     }
435
436     send_config.pacing = pacing;
437     send_config.rtp.nack.rtp_history_ms = 1000;
438     send_config.rtp.ssrcs = ssrcs;
439     if (rtx) {
440       send_config.rtp.rtx.payload_type = 96;
441       send_config.rtp.rtx.ssrcs = rtx_ssrcs;
442     }
443     send_config.rtp.extensions.push_back(
444         RtpExtension(RtpExtension::kAbsSendTime, kAbsoluteSendTimeExtensionId));
445
446     if (num_streams == 1) {
447       // For single stream rampup until 1mbps
448       stream_observer.set_expected_bitrate_bps(1000000);
449     } else {
450       // For multi stream rampup until all streams are being sent. That means
451       // enough birate to sent all the target streams plus the min bitrate of
452       // the last one.
453       int expected_bitrate_bps =
454           send_config.encoder_settings.streams.back().min_bitrate_bps;
455       for (size_t i = 0; i < send_config.encoder_settings.streams.size() - 1;
456            ++i) {
457         expected_bitrate_bps +=
458             send_config.encoder_settings.streams[i].target_bitrate_bps;
459       }
460       stream_observer.set_expected_bitrate_bps(expected_bitrate_bps);
461     }
462
463     VideoSendStream* send_stream = call->CreateVideoSendStream(send_config);
464
465     scoped_ptr<test::FrameGeneratorCapturer> frame_generator_capturer(
466         test::FrameGeneratorCapturer::Create(
467             send_stream->Input(),
468             send_config.encoder_settings.streams.back().width,
469             send_config.encoder_settings.streams.back().height,
470             send_config.encoder_settings.streams.back().max_framerate,
471             Clock::GetRealTimeClock()));
472
473     send_stream->StartSending();
474     frame_generator_capturer->Start();
475
476     EXPECT_EQ(kEventSignaled, stream_observer.Wait());
477
478     frame_generator_capturer->Stop();
479     send_stream->StopSending();
480
481     call->DestroyVideoSendStream(send_stream);
482   }
483
484   void RunRampUpDownUpTest(size_t number_of_streams, bool rtx) {
485     std::vector<uint32_t> ssrcs;
486     for (size_t i = 0; i < number_of_streams; ++i)
487       ssrcs.push_back(static_cast<uint32_t>(i + 1));
488     test::DirectTransport receiver_transport;
489     LowRateStreamObserver stream_observer(
490         &receiver_transport, Clock::GetRealTimeClock(), number_of_streams, rtx);
491
492     Call::Config call_config(&stream_observer);
493     webrtc::Config webrtc_config;
494     call_config.webrtc_config = &webrtc_config;
495     webrtc_config.Set<PaddingStrategy>(new PaddingStrategy(rtx));
496     scoped_ptr<Call> call(Call::Create(call_config));
497     VideoSendStream::Config send_config = call->GetDefaultSendConfig();
498
499     receiver_transport.SetReceiver(call->Receiver());
500
501     test::FakeEncoder encoder(Clock::GetRealTimeClock());
502     send_config.encoder_settings =
503         test::CreateEncoderSettings(&encoder, "FAKE", 125, number_of_streams);
504     send_config.rtp.nack.rtp_history_ms = 1000;
505     send_config.rtp.ssrcs.insert(
506         send_config.rtp.ssrcs.begin(), ssrcs.begin(), ssrcs.end());
507     send_config.rtp.extensions.push_back(
508         RtpExtension(RtpExtension::kAbsSendTime, kAbsoluteSendTimeExtensionId));
509     send_config.suspend_below_min_bitrate = true;
510
511     VideoSendStream* send_stream = call->CreateVideoSendStream(send_config);
512     stream_observer.SetSendStream(send_stream);
513
514     size_t width = 0;
515     size_t height = 0;
516     for (size_t i = 0; i < send_config.encoder_settings.streams.size(); ++i) {
517       size_t stream_width = send_config.encoder_settings.streams[i].width;
518       size_t stream_height = send_config.encoder_settings.streams[i].height;
519       if (stream_width > width)
520         width = stream_width;
521       if (stream_height > height)
522         height = stream_height;
523     }
524
525     scoped_ptr<test::FrameGeneratorCapturer> frame_generator_capturer(
526         test::FrameGeneratorCapturer::Create(send_stream->Input(),
527                                              width,
528                                              height,
529                                              30,
530                                              Clock::GetRealTimeClock()));
531
532     send_stream->StartSending();
533     frame_generator_capturer->Start();
534
535     EXPECT_EQ(kEventSignaled, stream_observer.Wait());
536
537     stream_observer.StopSending();
538     receiver_transport.StopSending();
539     frame_generator_capturer->Stop();
540     send_stream->StopSending();
541
542     call->DestroyVideoSendStream(send_stream);
543   }
544
545  private:
546   std::vector<uint32_t> GenerateSsrcs(size_t num_streams,
547                                       uint32_t ssrc_offset) {
548     std::vector<uint32_t> ssrcs;
549     for (size_t i = 0; i != num_streams; ++i)
550       ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i));
551     return ssrcs;
552   }
553
554   std::map<uint32_t, bool> reserved_ssrcs_;
555 };
556
557 TEST_F(RampUpTest, SingleStreamWithoutPacing) {
558   RunRampUpTest(false, false, 1);
559 }
560
561 TEST_F(RampUpTest, SingleStreamWithPacing) {
562   RunRampUpTest(true, false, 1);
563 }
564
565 TEST_F(RampUpTest, SimulcastWithoutPacing) {
566   RunRampUpTest(false, false, 3);
567 }
568
569 TEST_F(RampUpTest, SimulcastWithPacing) {
570   RunRampUpTest(true, false, 3);
571 }
572
573 // TODO(pbos): Re-enable, webrtc:2992.
574 TEST_F(RampUpTest, DISABLED_SimulcastWithPacingAndRtx) {
575   RunRampUpTest(true, true, 3);
576 }
577
578 TEST_F(RampUpTest, UpDownUpOneStream) { RunRampUpDownUpTest(1, false); }
579
580 TEST_F(RampUpTest, UpDownUpThreeStreams) { RunRampUpDownUpTest(3, false); }
581
582 TEST_F(RampUpTest, UpDownUpOneStreamRtx) { RunRampUpDownUpTest(1, true); }
583
584 TEST_F(RampUpTest, UpDownUpThreeStreamsRtx) { RunRampUpDownUpTest(3, true); }
585
586 }  // namespace webrtc