2013-12-16 12:24:44 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
#include <functional>
|
|
|
|
|
#include <list>
|
2016-03-12 06:10:44 -08:00
|
|
|
#include <memory>
|
2013-12-16 12:24:44 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/call.h"
|
|
|
|
|
#include "rtc_base/checks.h"
|
|
|
|
|
#include "rtc_base/event.h"
|
|
|
|
|
#include "rtc_base/logging.h"
|
|
|
|
|
#include "rtc_base/thread_annotations.h"
|
|
|
|
|
#include "test/call_test.h"
|
|
|
|
|
#include "test/direct_transport.h"
|
|
|
|
|
#include "test/encoder_settings.h"
|
|
|
|
|
#include "test/fake_decoder.h"
|
|
|
|
|
#include "test/fake_encoder.h"
|
|
|
|
|
#include "test/frame_generator_capturer.h"
|
|
|
|
|
#include "test/gtest.h"
|
2013-12-16 12:24:44 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2014-07-07 08:50:48 +00:00
|
|
|
namespace {
|
2015-04-29 15:24:01 +02:00
|
|
|
// Note: If you consider to re-use this class, think twice and instead consider
|
2015-12-04 16:13:05 +01:00
|
|
|
// writing tests that don't depend on the logging system.
|
|
|
|
|
class LogObserver {
|
2014-07-07 08:50:48 +00:00
|
|
|
public:
|
2015-12-04 16:13:05 +01:00
|
|
|
LogObserver() { rtc::LogMessage::AddLogToStream(&callback_, rtc::LS_INFO); }
|
2014-07-07 08:50:48 +00:00
|
|
|
|
2015-12-04 16:13:05 +01:00
|
|
|
~LogObserver() { rtc::LogMessage::RemoveLogToStream(&callback_); }
|
2014-07-07 08:50:48 +00:00
|
|
|
|
|
|
|
|
void PushExpectedLogLine(const std::string& expected_log_line) {
|
|
|
|
|
callback_.PushExpectedLogLine(expected_log_line);
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-10 13:02:50 +01:00
|
|
|
bool Wait() { return callback_.Wait(); }
|
2014-07-07 08:50:48 +00:00
|
|
|
|
|
|
|
|
private:
|
2015-12-04 16:13:05 +01:00
|
|
|
class Callback : public rtc::LogSink {
|
2014-07-07 08:50:48 +00:00
|
|
|
public:
|
2015-12-10 13:02:50 +01:00
|
|
|
Callback() : done_(false, false) {}
|
2014-07-07 08:50:48 +00:00
|
|
|
|
2015-12-04 16:13:05 +01:00
|
|
|
void OnLogMessage(const std::string& message) override {
|
2015-05-01 13:00:41 +02:00
|
|
|
rtc::CritScope lock(&crit_sect_);
|
2015-12-04 16:13:05 +01:00
|
|
|
// Ignore log lines that are due to missing AST extensions, these are
|
|
|
|
|
// logged when we switch back from AST to TOF until the wrapping bitrate
|
|
|
|
|
// estimator gives up on using AST.
|
|
|
|
|
if (message.find("BitrateEstimator") != std::string::npos &&
|
|
|
|
|
message.find("packet is missing") == std::string::npos) {
|
|
|
|
|
received_log_lines_.push_back(message);
|
2014-07-07 08:50:48 +00:00
|
|
|
}
|
2015-12-04 16:13:05 +01:00
|
|
|
|
2014-07-07 08:50:48 +00:00
|
|
|
int num_popped = 0;
|
|
|
|
|
while (!received_log_lines_.empty() && !expected_log_lines_.empty()) {
|
|
|
|
|
std::string a = received_log_lines_.front();
|
|
|
|
|
std::string b = expected_log_lines_.front();
|
|
|
|
|
received_log_lines_.pop_front();
|
|
|
|
|
expected_log_lines_.pop_front();
|
|
|
|
|
num_popped++;
|
2015-12-04 16:13:05 +01:00
|
|
|
EXPECT_TRUE(a.find(b) != std::string::npos) << a << " != " << b;
|
2014-07-07 08:50:48 +00:00
|
|
|
}
|
|
|
|
|
if (expected_log_lines_.size() <= 0) {
|
|
|
|
|
if (num_popped > 0) {
|
2015-12-10 13:02:50 +01:00
|
|
|
done_.Set();
|
2014-07-07 08:50:48 +00:00
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-10 13:02:50 +01:00
|
|
|
bool Wait() { return done_.Wait(test::CallTest::kDefaultTimeoutMs); }
|
2014-07-07 08:50:48 +00:00
|
|
|
|
|
|
|
|
void PushExpectedLogLine(const std::string& expected_log_line) {
|
2015-05-01 13:00:41 +02:00
|
|
|
rtc::CritScope lock(&crit_sect_);
|
2014-07-07 08:50:48 +00:00
|
|
|
expected_log_lines_.push_back(expected_log_line);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
typedef std::list<std::string> Strings;
|
2015-05-01 13:00:41 +02:00
|
|
|
rtc::CriticalSection crit_sect_;
|
2017-09-09 04:17:22 -07:00
|
|
|
Strings received_log_lines_ RTC_GUARDED_BY(crit_sect_);
|
|
|
|
|
Strings expected_log_lines_ RTC_GUARDED_BY(crit_sect_);
|
2015-12-10 13:02:50 +01:00
|
|
|
rtc::Event done_;
|
2014-07-07 08:50:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Callback callback_;
|
|
|
|
|
};
|
|
|
|
|
} // namespace
|
2013-12-16 12:24:44 +00:00
|
|
|
|
|
|
|
|
static const int kTOFExtensionId = 4;
|
|
|
|
|
static const int kASTExtensionId = 5;
|
|
|
|
|
|
2014-06-27 08:47:52 +00:00
|
|
|
class BitrateEstimatorTest : public test::CallTest {
|
2013-12-16 12:24:44 +00:00
|
|
|
public:
|
2016-11-08 03:44:54 -08:00
|
|
|
BitrateEstimatorTest() : receive_config_(nullptr) {}
|
2013-12-16 12:24:44 +00:00
|
|
|
|
2015-11-03 10:15:49 +01:00
|
|
|
virtual ~BitrateEstimatorTest() { EXPECT_TRUE(streams_.empty()); }
|
2013-12-16 12:24:44 +00:00
|
|
|
|
|
|
|
|
virtual void SetUp() {
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
|
|
|
|
Call::Config config(event_log_.get());
|
|
|
|
|
receiver_call_.reset(Call::Create(config));
|
|
|
|
|
sender_call_.reset(Call::Create(config));
|
|
|
|
|
|
|
|
|
|
send_transport_.reset(new test::DirectTransport(
|
|
|
|
|
&task_queue_, sender_call_.get(), payload_type_map_));
|
|
|
|
|
send_transport_->SetReceiver(receiver_call_->Receiver());
|
|
|
|
|
receive_transport_.reset(new test::DirectTransport(
|
|
|
|
|
&task_queue_, receiver_call_.get(), payload_type_map_));
|
|
|
|
|
receive_transport_->SetReceiver(sender_call_->Receiver());
|
|
|
|
|
|
|
|
|
|
video_send_config_ = VideoSendStream::Config(send_transport_.get());
|
|
|
|
|
video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[0]);
|
2018-04-19 09:04:13 +02:00
|
|
|
video_send_config_.encoder_settings.encoder_factory =
|
|
|
|
|
&fake_encoder_factory_;
|
Reland "Reland "Move rtp-specific config out of EncoderSettings.""
This reverts commit 6c2c13af06b32778b86950681758a7970d1c5d9e.
Reason for revert: Intend to investigate and fix perf problems.
Original change's description:
> Revert "Reland "Move rtp-specific config out of EncoderSettings.""
>
> This reverts commit 04dd1768625eb2241d1fb97fd0137897e703e266.
>
> Reason for revert: Regression in ramp up perf tests.
>
> Original change's description:
> > Reland "Move rtp-specific config out of EncoderSettings."
> >
> > This is a reland of bc900cb1d1810fcf678fe41cf1e3966daa39c88c
> >
> > Original change's description:
> > > Move rtp-specific config out of EncoderSettings.
> > >
> > > In VideoSendStream::Config, move payload_name and payload_type from
> > > EncoderSettings to Rtp.
> > >
> > > EncoderSettings now contains configuration for VideoStreamEncoder only,
> > > and should perhaps be renamed in a follow up cl. It's no longer
> > > passed as an argument to VideoCodecInitializer::SetupCodec.
> > >
> > > The latter then needs a different way to know the codec type,
> > > which is provided by a new codec_type member in VideoEncoderConfig.
> > >
> > > Bug: webrtc:8830
> > > Change-Id: Ifcc691aef1ee6a95e43c0452c5e630d92a511cd6
> > > Reviewed-on: https://webrtc-review.googlesource.com/62062
> > > Commit-Queue: Niels Moller <nisse@webrtc.org>
> > > Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#22532}
> >
> > Bug: webrtc:8830
> > Change-Id: If88ef7d57cdaa4fae3c7b2a97ea5a6e1b833e019
> > Reviewed-on: https://webrtc-review.googlesource.com/63721
> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Commit-Queue: Niels Moller <nisse@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22595}
>
> TBR=brandtr@webrtc.org,magjed@webrtc.org,nisse@webrtc.org,stefan@webrtc.org
>
> Bug: webrtc:8830,chromium:827080
> Change-Id: Iaaf146de91ec5c0d741b8efdf143f7e173084fef
> Reviewed-on: https://webrtc-review.googlesource.com/65520
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22677}
TBR=brandtr@webrtc.org,magjed@webrtc.org,nisse@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:8830, chromium:827080
Change-Id: I9b62987bf5daced90dfeb3ebb6739c80117c487f
Reviewed-on: https://webrtc-review.googlesource.com/66862
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22751}
2018-04-05 15:36:51 +02:00
|
|
|
video_send_config_.rtp.payload_name = "FAKE";
|
|
|
|
|
video_send_config_.rtp.payload_type = kFakeVideoSendPayloadType;
|
|
|
|
|
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config_);
|
2017-08-22 04:02:52 -07:00
|
|
|
|
|
|
|
|
receive_config_ = VideoReceiveStream::Config(receive_transport_.get());
|
|
|
|
|
// receive_config_.decoders will be set by every stream separately.
|
|
|
|
|
receive_config_.rtp.remote_ssrc = video_send_config_.rtp.ssrcs[0];
|
|
|
|
|
receive_config_.rtp.local_ssrc = kReceiverLocalVideoSsrc;
|
|
|
|
|
receive_config_.rtp.remb = true;
|
|
|
|
|
receive_config_.rtp.extensions.push_back(
|
|
|
|
|
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId));
|
|
|
|
|
receive_config_.rtp.extensions.push_back(
|
|
|
|
|
RtpExtension(RtpExtension::kAbsSendTimeUri, kASTExtensionId));
|
|
|
|
|
});
|
2013-12-16 12:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void TearDown() {
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
2018-05-17 22:01:13 +09:00
|
|
|
for (auto* stream : streams_) {
|
|
|
|
|
stream->StopSending();
|
|
|
|
|
delete stream;
|
2017-08-22 04:02:52 -07:00
|
|
|
}
|
2018-05-17 22:01:13 +09:00
|
|
|
streams_.clear();
|
2013-12-16 12:24:44 +00:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
send_transport_.reset();
|
|
|
|
|
receive_transport_.reset();
|
2013-12-16 12:24:44 +00:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
receiver_call_.reset();
|
|
|
|
|
sender_call_.reset();
|
|
|
|
|
});
|
2013-12-16 12:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
friend class Stream;
|
|
|
|
|
|
|
|
|
|
class Stream {
|
|
|
|
|
public:
|
2016-11-08 03:44:54 -08:00
|
|
|
explicit Stream(BitrateEstimatorTest* test)
|
2013-12-16 12:24:44 +00:00
|
|
|
: test_(test),
|
|
|
|
|
is_sending_receiving_(false),
|
2015-03-23 13:12:24 +00:00
|
|
|
send_stream_(nullptr),
|
2013-12-16 12:24:44 +00:00
|
|
|
frame_generator_capturer_(),
|
|
|
|
|
fake_decoder_() {
|
2015-12-21 03:14:00 -08:00
|
|
|
test_->video_send_config_.rtp.ssrcs[0]++;
|
2014-06-06 10:49:19 +00:00
|
|
|
send_stream_ = test_->sender_call_->CreateVideoSendStream(
|
2016-09-01 01:17:40 -07:00
|
|
|
test_->video_send_config_.Copy(),
|
|
|
|
|
test_->video_encoder_config_.Copy());
|
2016-11-28 15:21:39 -08:00
|
|
|
RTC_DCHECK_EQ(1, test_->video_encoder_config_.number_of_streams);
|
2014-09-19 12:30:25 +00:00
|
|
|
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
2018-06-15 12:28:07 +02:00
|
|
|
kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt,
|
2018-03-09 15:03:26 -08:00
|
|
|
kDefaultFramerate, Clock::GetRealTimeClock()));
|
2018-05-16 14:20:41 -07:00
|
|
|
send_stream_->SetSource(frame_generator_capturer_.get(),
|
|
|
|
|
DegradationPreference::MAINTAIN_FRAMERATE);
|
2014-04-24 11:13:21 +00:00
|
|
|
send_stream_->Start();
|
2013-12-16 12:24:44 +00:00
|
|
|
frame_generator_capturer_->Start();
|
|
|
|
|
|
2016-11-08 03:44:54 -08:00
|
|
|
VideoReceiveStream::Decoder decoder;
|
|
|
|
|
decoder.decoder = &fake_decoder_;
|
Reland "Reland "Move rtp-specific config out of EncoderSettings.""
This reverts commit 6c2c13af06b32778b86950681758a7970d1c5d9e.
Reason for revert: Intend to investigate and fix perf problems.
Original change's description:
> Revert "Reland "Move rtp-specific config out of EncoderSettings.""
>
> This reverts commit 04dd1768625eb2241d1fb97fd0137897e703e266.
>
> Reason for revert: Regression in ramp up perf tests.
>
> Original change's description:
> > Reland "Move rtp-specific config out of EncoderSettings."
> >
> > This is a reland of bc900cb1d1810fcf678fe41cf1e3966daa39c88c
> >
> > Original change's description:
> > > Move rtp-specific config out of EncoderSettings.
> > >
> > > In VideoSendStream::Config, move payload_name and payload_type from
> > > EncoderSettings to Rtp.
> > >
> > > EncoderSettings now contains configuration for VideoStreamEncoder only,
> > > and should perhaps be renamed in a follow up cl. It's no longer
> > > passed as an argument to VideoCodecInitializer::SetupCodec.
> > >
> > > The latter then needs a different way to know the codec type,
> > > which is provided by a new codec_type member in VideoEncoderConfig.
> > >
> > > Bug: webrtc:8830
> > > Change-Id: Ifcc691aef1ee6a95e43c0452c5e630d92a511cd6
> > > Reviewed-on: https://webrtc-review.googlesource.com/62062
> > > Commit-Queue: Niels Moller <nisse@webrtc.org>
> > > Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#22532}
> >
> > Bug: webrtc:8830
> > Change-Id: If88ef7d57cdaa4fae3c7b2a97ea5a6e1b833e019
> > Reviewed-on: https://webrtc-review.googlesource.com/63721
> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Commit-Queue: Niels Moller <nisse@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22595}
>
> TBR=brandtr@webrtc.org,magjed@webrtc.org,nisse@webrtc.org,stefan@webrtc.org
>
> Bug: webrtc:8830,chromium:827080
> Change-Id: Iaaf146de91ec5c0d741b8efdf143f7e173084fef
> Reviewed-on: https://webrtc-review.googlesource.com/65520
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22677}
TBR=brandtr@webrtc.org,magjed@webrtc.org,nisse@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:8830, chromium:827080
Change-Id: I9b62987bf5daced90dfeb3ebb6739c80117c487f
Reviewed-on: https://webrtc-review.googlesource.com/66862
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22751}
2018-04-05 15:36:51 +02:00
|
|
|
decoder.payload_type = test_->video_send_config_.rtp.payload_type;
|
|
|
|
|
decoder.payload_name = test_->video_send_config_.rtp.payload_name;
|
2016-11-08 03:44:54 -08:00
|
|
|
test_->receive_config_.decoders.clear();
|
|
|
|
|
test_->receive_config_.decoders.push_back(decoder);
|
|
|
|
|
test_->receive_config_.rtp.remote_ssrc =
|
|
|
|
|
test_->video_send_config_.rtp.ssrcs[0];
|
|
|
|
|
test_->receive_config_.rtp.local_ssrc++;
|
|
|
|
|
test_->receive_config_.renderer = &test->fake_renderer_;
|
|
|
|
|
video_receive_stream_ = test_->receiver_call_->CreateVideoReceiveStream(
|
|
|
|
|
test_->receive_config_.Copy());
|
|
|
|
|
video_receive_stream_->Start();
|
2013-12-16 12:24:44 +00:00
|
|
|
is_sending_receiving_ = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~Stream() {
|
2015-04-29 15:24:01 +02:00
|
|
|
EXPECT_FALSE(is_sending_receiving_);
|
2016-09-15 09:19:20 -07:00
|
|
|
test_->sender_call_->DestroyVideoSendStream(send_stream_);
|
2016-09-16 07:53:41 -07:00
|
|
|
frame_generator_capturer_.reset(nullptr);
|
2015-03-23 13:12:24 +00:00
|
|
|
send_stream_ = nullptr;
|
2015-04-29 15:24:01 +02:00
|
|
|
if (video_receive_stream_) {
|
|
|
|
|
test_->receiver_call_->DestroyVideoReceiveStream(video_receive_stream_);
|
|
|
|
|
video_receive_stream_ = nullptr;
|
|
|
|
|
}
|
2013-12-16 12:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StopSending() {
|
|
|
|
|
if (is_sending_receiving_) {
|
|
|
|
|
frame_generator_capturer_->Stop();
|
2014-04-24 11:13:21 +00:00
|
|
|
send_stream_->Stop();
|
2015-04-29 15:24:01 +02:00
|
|
|
if (video_receive_stream_) {
|
|
|
|
|
video_receive_stream_->Stop();
|
|
|
|
|
}
|
2013-12-16 12:24:44 +00:00
|
|
|
is_sending_receiving_ = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
BitrateEstimatorTest* test_;
|
|
|
|
|
bool is_sending_receiving_;
|
|
|
|
|
VideoSendStream* send_stream_;
|
2015-04-29 15:24:01 +02:00
|
|
|
VideoReceiveStream* video_receive_stream_;
|
2016-03-12 06:10:44 -08:00
|
|
|
std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
|
2013-12-16 12:24:44 +00:00
|
|
|
test::FakeDecoder fake_decoder_;
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-04 16:13:05 +01:00
|
|
|
LogObserver receiver_log_;
|
2016-03-12 06:10:44 -08:00
|
|
|
std::unique_ptr<test::DirectTransport> send_transport_;
|
|
|
|
|
std::unique_ptr<test::DirectTransport> receive_transport_;
|
|
|
|
|
std::unique_ptr<Call> sender_call_;
|
|
|
|
|
std::unique_ptr<Call> receiver_call_;
|
2013-12-16 12:24:44 +00:00
|
|
|
VideoReceiveStream::Config receive_config_;
|
|
|
|
|
std::vector<Stream*> streams_;
|
|
|
|
|
};
|
|
|
|
|
|
2015-07-06 10:50:47 +02:00
|
|
|
static const char* kAbsSendTimeLog =
|
|
|
|
|
"RemoteBitrateEstimatorAbsSendTime: Instantiating.";
|
|
|
|
|
static const char* kSingleStreamLog =
|
|
|
|
|
"RemoteBitrateEstimatorSingleStream: Instantiating.";
|
|
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
TEST_F(BitrateEstimatorTest, InstantiatesTOFPerDefaultForVideo) {
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
|
|
|
|
video_send_config_.rtp.extensions.push_back(
|
|
|
|
|
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId));
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
|
|
|
|
|
streams_.push_back(new Stream(this));
|
|
|
|
|
});
|
2015-12-10 13:02:50 +01:00
|
|
|
EXPECT_TRUE(receiver_log_.Wait());
|
2013-12-16 12:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
TEST_F(BitrateEstimatorTest, ImmediatelySwitchToASTForVideo) {
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
|
|
|
|
video_send_config_.rtp.extensions.push_back(
|
|
|
|
|
RtpExtension(RtpExtension::kAbsSendTimeUri, kASTExtensionId));
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
|
|
|
|
|
receiver_log_.PushExpectedLogLine("Switching to absolute send time RBE.");
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
|
|
|
|
|
streams_.push_back(new Stream(this));
|
|
|
|
|
});
|
2015-12-10 13:02:50 +01:00
|
|
|
EXPECT_TRUE(receiver_log_.Wait());
|
2015-04-29 15:24:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(BitrateEstimatorTest, SwitchesToASTForVideo) {
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
|
|
|
|
video_send_config_.rtp.extensions.push_back(
|
|
|
|
|
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId));
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
|
|
|
|
|
streams_.push_back(new Stream(this));
|
|
|
|
|
});
|
2015-12-10 13:02:50 +01:00
|
|
|
EXPECT_TRUE(receiver_log_.Wait());
|
2013-12-16 12:24:44 +00:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
|
|
|
|
video_send_config_.rtp.extensions[0] =
|
|
|
|
|
RtpExtension(RtpExtension::kAbsSendTimeUri, kASTExtensionId);
|
|
|
|
|
receiver_log_.PushExpectedLogLine("Switching to absolute send time RBE.");
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
|
|
|
|
|
streams_.push_back(new Stream(this));
|
|
|
|
|
});
|
2015-12-10 13:02:50 +01:00
|
|
|
EXPECT_TRUE(receiver_log_.Wait());
|
2013-12-16 12:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
2016-04-22 10:52:40 -07:00
|
|
|
// This test is flaky. See webrtc:5790.
|
|
|
|
|
TEST_F(BitrateEstimatorTest, DISABLED_SwitchesToASTThenBackToTOFForVideo) {
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
|
|
|
|
video_send_config_.rtp.extensions.push_back(
|
|
|
|
|
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId));
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
|
|
|
|
|
streams_.push_back(new Stream(this));
|
|
|
|
|
});
|
2015-12-10 13:02:50 +01:00
|
|
|
EXPECT_TRUE(receiver_log_.Wait());
|
2013-12-16 12:24:44 +00:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
|
|
|
|
video_send_config_.rtp.extensions[0] =
|
|
|
|
|
RtpExtension(RtpExtension::kAbsSendTimeUri, kASTExtensionId);
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
|
|
|
|
|
receiver_log_.PushExpectedLogLine("Switching to absolute send time RBE.");
|
|
|
|
|
streams_.push_back(new Stream(this));
|
|
|
|
|
});
|
2015-12-10 13:02:50 +01:00
|
|
|
EXPECT_TRUE(receiver_log_.Wait());
|
2013-12-16 12:24:44 +00:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue_.SendTask([this]() {
|
|
|
|
|
video_send_config_.rtp.extensions[0] =
|
|
|
|
|
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId);
|
|
|
|
|
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
|
|
|
|
|
receiver_log_.PushExpectedLogLine(
|
|
|
|
|
"WrappingBitrateEstimator: Switching to transmission time offset RBE.");
|
|
|
|
|
streams_.push_back(new Stream(this));
|
|
|
|
|
streams_[0]->StopSending();
|
|
|
|
|
streams_[1]->StopSending();
|
|
|
|
|
});
|
2015-12-10 13:02:50 +01:00
|
|
|
EXPECT_TRUE(receiver_log_.Wait());
|
2013-12-16 12:24:44 +00:00
|
|
|
}
|
|
|
|
|
} // namespace webrtc
|