webrtc_m130/call/call_perf_tests.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1220 lines
49 KiB
C++
Raw Normal View History

/*
* 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 <algorithm>
#include <limits>
#include <memory>
#include <string>
#include "absl/strings/string_view.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/numerics/samples_stats_counter.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/pending_task_safety_flag.h"
#include "api/task_queue/task_queue_base.h"
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
#include "api/test/metrics/metric.h"
#include "api/test/simulated_network.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video_codecs/video_encoder.h"
#include "call/call.h"
#include "call/fake_network_pipe.h"
#include "call/simulated_network.h"
#include "media/engine/internal_encoder_factory.h"
#include "media/engine/simulcast_encoder_adapter.h"
#include "modules/audio_coding/include/audio_coding_module.h"
#include "modules/audio_device/include/test_audio_device.h"
#include "modules/audio_mixer/audio_mixer_impl.h"
#include "modules/rtp_rtcp/source/rtp_packet.h"
#include "rtc_base/checks.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/task_queue_for_test.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
#include "system_wrappers/include/metrics.h"
#include "test/call_test.h"
#include "test/direct_transport.h"
#include "test/drifting_clock.h"
#include "test/encoder_settings.h"
#include "test/fake_encoder.h"
#include "test/field_trial.h"
#include "test/frame_generator_capturer.h"
#include "test/gtest.h"
#include "test/null_transport.h"
#include "test/rtp_rtcp_observer.h"
#include "test/testsupport/file_utils.h"
#include "test/video_encoder_proxy_factory.h"
#include "video/config/video_encoder_config.h"
#include "video/transport_adapter.h"
using webrtc::test::DriftingClock;
namespace webrtc {
Reland "Delete test/constants.h" This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6. Reason for revert: Failing tests fixed. Original change's description: > Revert "Delete test/constants.h" > > This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de. > > Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate > > Original change's description: > > Delete test/constants.h > > > > It's not possible to use constants.h for all RTP extensions > > after the number of extensions exceeds 14, which is the maximum > > number of one-byte RTP extensions. This is because some extensions > > would have to be assigned a number greater than 14, even if the > > test only involves 14 extensions or less. > > > > For uniformity's sake, this CL also edits some files to use an > > enum as the files involved in this CL, rather than free-floating > > const-ints. > > > > Bug: webrtc:10288 > > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/123048 > > Commit-Queue: Elad Alon <eladalon@webrtc.org> > > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#26728} > > TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org > > Bug: webrtc:10288, chromium:933127 > Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4 > Reviewed-on: https://webrtc-review.googlesource.com/c/123381 > Commit-Queue: Oleh Prypin <oprypin@webrtc.org> > Reviewed-by: Oleh Prypin <oprypin@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#26744} TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954 Bug: webrtc:10288, chromium:933127 Reviewed-on: https://webrtc-review.googlesource.com/c/123384 Reviewed-by: Elad Alon <eladalon@webrtc.org> Commit-Queue: Elad Alon <eladalon@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
namespace {
using ::webrtc::test::GetGlobalMetricsLogger;
using ::webrtc::test::ImprovementDirection;
using ::webrtc::test::Unit;
Reland "Delete test/constants.h" This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6. Reason for revert: Failing tests fixed. Original change's description: > Revert "Delete test/constants.h" > > This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de. > > Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate > > Original change's description: > > Delete test/constants.h > > > > It's not possible to use constants.h for all RTP extensions > > after the number of extensions exceeds 14, which is the maximum > > number of one-byte RTP extensions. This is because some extensions > > would have to be assigned a number greater than 14, even if the > > test only involves 14 extensions or less. > > > > For uniformity's sake, this CL also edits some files to use an > > enum as the files involved in this CL, rather than free-floating > > const-ints. > > > > Bug: webrtc:10288 > > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/123048 > > Commit-Queue: Elad Alon <eladalon@webrtc.org> > > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#26728} > > TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org > > Bug: webrtc:10288, chromium:933127 > Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4 > Reviewed-on: https://webrtc-review.googlesource.com/c/123381 > Commit-Queue: Oleh Prypin <oprypin@webrtc.org> > Reviewed-by: Oleh Prypin <oprypin@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#26744} TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954 Bug: webrtc:10288, chromium:933127 Reviewed-on: https://webrtc-review.googlesource.com/c/123384 Reviewed-by: Elad Alon <eladalon@webrtc.org> Commit-Queue: Elad Alon <eladalon@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
enum : int { // The first valid value is 1.
kTransportSequenceNumberExtensionId = 1,
};
Reland "Delete test/constants.h" This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6. Reason for revert: Failing tests fixed. Original change's description: > Revert "Delete test/constants.h" > > This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de. > > Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate > > Original change's description: > > Delete test/constants.h > > > > It's not possible to use constants.h for all RTP extensions > > after the number of extensions exceeds 14, which is the maximum > > number of one-byte RTP extensions. This is because some extensions > > would have to be assigned a number greater than 14, even if the > > test only involves 14 extensions or less. > > > > For uniformity's sake, this CL also edits some files to use an > > enum as the files involved in this CL, rather than free-floating > > const-ints. > > > > Bug: webrtc:10288 > > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/123048 > > Commit-Queue: Elad Alon <eladalon@webrtc.org> > > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#26728} > > TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org > > Bug: webrtc:10288, chromium:933127 > Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4 > Reviewed-on: https://webrtc-review.googlesource.com/c/123381 > Commit-Queue: Oleh Prypin <oprypin@webrtc.org> > Reviewed-by: Oleh Prypin <oprypin@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#26744} TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954 Bug: webrtc:10288, chromium:933127 Reviewed-on: https://webrtc-review.googlesource.com/c/123384 Reviewed-by: Elad Alon <eladalon@webrtc.org> Commit-Queue: Elad Alon <eladalon@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
} // namespace
class CallPerfTest : public test::CallTest {
Reland "Delete test/constants.h" This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6. Reason for revert: Failing tests fixed. Original change's description: > Revert "Delete test/constants.h" > > This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de. > > Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate > > Original change's description: > > Delete test/constants.h > > > > It's not possible to use constants.h for all RTP extensions > > after the number of extensions exceeds 14, which is the maximum > > number of one-byte RTP extensions. This is because some extensions > > would have to be assigned a number greater than 14, even if the > > test only involves 14 extensions or less. > > > > For uniformity's sake, this CL also edits some files to use an > > enum as the files involved in this CL, rather than free-floating > > const-ints. > > > > Bug: webrtc:10288 > > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/123048 > > Commit-Queue: Elad Alon <eladalon@webrtc.org> > > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#26728} > > TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org > > Bug: webrtc:10288, chromium:933127 > Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4 > Reviewed-on: https://webrtc-review.googlesource.com/c/123381 > Commit-Queue: Oleh Prypin <oprypin@webrtc.org> > Reviewed-by: Oleh Prypin <oprypin@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#26744} TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954 Bug: webrtc:10288, chromium:933127 Reviewed-on: https://webrtc-review.googlesource.com/c/123384 Reviewed-by: Elad Alon <eladalon@webrtc.org> Commit-Queue: Elad Alon <eladalon@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
public:
CallPerfTest() {
RegisterRtpExtension(RtpExtension(RtpExtension::kTransportSequenceNumberUri,
kTransportSequenceNumberExtensionId));
}
protected:
enum class FecMode { kOn, kOff };
enum class CreateOrder { kAudioFirst, kVideoFirst };
void TestAudioVideoSync(FecMode fec,
CreateOrder create_first,
float video_ntp_speed,
float video_rtp_speed,
float audio_rtp_speed,
absl::string_view test_label);
void TestMinTransmitBitrate(bool pad_to_min_bitrate);
void TestCaptureNtpTime(const BuiltInNetworkBehaviorConfig& net_config,
int threshold_ms,
int start_time_ms,
int run_time_ms);
void TestMinAudioVideoBitrate(int test_bitrate_from,
int test_bitrate_to,
int test_bitrate_step,
int min_bwe,
int start_bwe,
int max_bwe);
void TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
absl::string_view payload_name,
const std::vector<int>& max_framerates);
};
class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver,
public rtc::VideoSinkInterface<VideoFrame> {
static const int kInSyncThresholdMs = 50;
static const int kStartupTimeMs = 2000;
static const int kMinRunTimeMs = 30000;
public:
explicit VideoRtcpAndSyncObserver(TaskQueueBase* task_queue,
Clock* clock,
absl::string_view test_label)
: test::RtpRtcpObserver(CallPerfTest::kLongTimeout),
clock_(clock),
test_label_(test_label),
creation_time_ms_(clock_->TimeInMilliseconds()),
task_queue_(task_queue) {}
void OnFrame(const VideoFrame& video_frame) override {
task_queue_->PostTask([this]() { CheckStats(); });
}
void CheckStats() {
if (!receive_stream_)
return;
VideoReceiveStreamInterface::Stats stats = receive_stream_->GetStats();
if (stats.sync_offset_ms == std::numeric_limits<int>::max())
return;
int64_t now_ms = clock_->TimeInMilliseconds();
int64_t time_since_creation = now_ms - creation_time_ms_;
// During the first couple of seconds audio and video can falsely be
// estimated as being synchronized. We don't want to trigger on those.
if (time_since_creation < kStartupTimeMs)
return;
if (std::abs(stats.sync_offset_ms) < kInSyncThresholdMs) {
if (first_time_in_sync_ == -1) {
first_time_in_sync_ = now_ms;
GetGlobalMetricsLogger()->LogSingleValueMetric(
"sync_convergence_time" + test_label_, "synchronization",
time_since_creation, Unit::kMilliseconds,
ImprovementDirection::kSmallerIsBetter);
}
if (time_since_creation > kMinRunTimeMs)
observation_complete_.Set();
}
if (first_time_in_sync_ != -1)
sync_offset_ms_list_.AddSample(stats.sync_offset_ms);
}
void set_receive_stream(VideoReceiveStreamInterface* receive_stream) {
RTC_DCHECK_EQ(task_queue_, TaskQueueBase::Current());
// Note that receive_stream may be nullptr.
receive_stream_ = receive_stream;
}
void PrintResults() {
GetGlobalMetricsLogger()->LogMetric(
"stream_offset" + test_label_, "synchronization", sync_offset_ms_list_,
Unit::kMilliseconds, ImprovementDirection::kNeitherIsBetter);
}
private:
Clock* const clock_;
const std::string test_label_;
const int64_t creation_time_ms_;
int64_t first_time_in_sync_ = -1;
VideoReceiveStreamInterface* receive_stream_ = nullptr;
SamplesStatsCounter sync_offset_ms_list_;
TaskQueueBase* const task_queue_;
};
void CallPerfTest::TestAudioVideoSync(FecMode fec,
CreateOrder create_first,
float video_ntp_speed,
float video_rtp_speed,
float audio_rtp_speed,
absl::string_view test_label) {
const char* kSyncGroup = "av_sync";
const uint32_t kAudioSendSsrc = 1234;
const uint32_t kAudioRecvSsrc = 5678;
BuiltInNetworkBehaviorConfig audio_net_config;
audio_net_config.queue_delay_ms = 500;
audio_net_config.loss_percent = 5;
auto observer = std::make_unique<VideoRtcpAndSyncObserver>(
task_queue(), Clock::GetRealTimeClock(), test_label);
std::map<uint8_t, MediaType> audio_pt_map;
std::map<uint8_t, MediaType> video_pt_map;
std::unique_ptr<test::PacketTransport> audio_send_transport;
std::unique_ptr<test::PacketTransport> video_send_transport;
std::unique_ptr<test::PacketTransport> receive_transport;
AudioSendStream* audio_send_stream;
AudioReceiveStreamInterface* audio_receive_stream;
std::unique_ptr<DriftingClock> drifting_clock;
SendTask(task_queue(), [&]() {
metrics::Reset();
rtc::scoped_refptr<TestAudioDeviceModule> fake_audio_device =
Reland "Delete TestAudioDeviceModule factory which uses GlobalTaskQueueFactory" This reverts commit fd5166c305068772d00ad7edf50151bba215400b. Reason for revert: Stop using CreateTestAudioDeviceModule in downstream Original change's description: > Revert "Delete TestAudioDeviceModule factory which uses GlobalTaskQueueFactory" > > This reverts commit fc961357a721cd87dcd45ed409c66cb8cda6f4a2. > > Reason for revert: Breaks downstream importer. > > Original change's description: > > Delete TestAudioDeviceModule factory which uses GlobalTaskQueueFactory > > > > Bug: webrtc:10284 > > Change-Id: Ic92f6ff31b40c48a3362745a0a81179af0595fe0 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141409 > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#28227} > > TBR=danilchap@webrtc.org,kwiberg@webrtc.org > > Change-Id: Id6d7571f48771646ddce0f05139a7ea0107759fb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10284 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141414 > Reviewed-by: Philip Eliasson <philipel@webrtc.org> > Commit-Queue: Philip Eliasson <philipel@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#28228} TBR=danilchap@webrtc.org,kwiberg@webrtc.org,philipel@webrtc.org Change-Id: I42bc19793d48350ca45b751d7e1b26124ac7fbb9 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:10284 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141670 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28254}
2019-06-12 11:49:17 +00:00
TestAudioDeviceModule::Create(
task_queue_factory_.get(),
TestAudioDeviceModule::CreatePulsedNoiseCapturer(256, 48000),
TestAudioDeviceModule::CreateDiscardRenderer(48000),
audio_rtp_speed);
EXPECT_EQ(0, fake_audio_device->Init());
AudioState::Config send_audio_state_config;
send_audio_state_config.audio_mixer = AudioMixerImpl::Create();
send_audio_state_config.audio_processing =
AudioProcessingBuilder().Create();
Remove voe::TransmitMixer TransmitMixer's functionality is moved into the AudioTransportProxy owned by AudioState. This removes the need for an AudioTransport implementation in VoEBaseImpl, which means that the proxy is no longer a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl. In the short term, AudioState needs to know which AudioDeviceModule is used, so it is added in AudioState::Config. AudioTransportImpl needs to know which AudioSendStream:s are currently enabled to send, so AudioState maintains a map of them, which is reduced into a simple vector for AudioTransportImpl. To encode and transmit audio, AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame) is introduced, which is used in both the Chromium and standalone use cases. This removes the need for two different instances of voe::Channel::ProcessAndEncodeAudio(), so there is now only one, taking an AudioFrame as argument. Callers need to allocate their own AudioFrame:s, which is wasteful but not a regression since this was already happening in the voe::Channel functions. Most of the logic changed resides in AudioTransportImpl::RecordedDataIsAvailable(), where two strange things were found: 1. The clock drift parameter was ineffective since apm->echo_cancellation()->enable_drift_compensation(false) is called during initialization. 2. The output parameter 'new_mic_volume' was never set - instead it was returned as a result, causing the ADM to never update the analog mic gain (https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100). Besides this, tests are updated, and some dead code is removed which was found in the process. Bug: webrtc:4690, webrtc:8591 Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2 Reviewed-on: https://webrtc-review.googlesource.com/26681 Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org> Reviewed-by: Oskar Sundbom <ossu@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
send_audio_state_config.audio_device_module = fake_audio_device;
Call::Config sender_config(send_event_log_.get());
auto audio_state = AudioState::Create(send_audio_state_config);
fake_audio_device->RegisterAudioCallback(audio_state->audio_transport());
sender_config.audio_state = audio_state;
Call::Config receiver_config(recv_event_log_.get());
receiver_config.audio_state = audio_state;
CreateCalls(sender_config, receiver_config);
std::copy_if(std::begin(payload_type_map_), std::end(payload_type_map_),
std::inserter(audio_pt_map, audio_pt_map.end()),
[](const std::pair<const uint8_t, MediaType>& pair) {
return pair.second == MediaType::AUDIO;
});
std::copy_if(std::begin(payload_type_map_), std::end(payload_type_map_),
std::inserter(video_pt_map, video_pt_map.end()),
[](const std::pair<const uint8_t, MediaType>& pair) {
return pair.second == MediaType::VIDEO;
});
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
audio_send_transport = std::make_unique<test::PacketTransport>(
task_queue(), sender_call_.get(), observer.get(),
test::PacketTransport::kSender, audio_pt_map,
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<FakeNetworkPipe>(
Clock::GetRealTimeClock(),
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<SimulatedNetwork>(audio_net_config)));
audio_send_transport->SetReceiver(receiver_call_->Receiver());
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
video_send_transport = std::make_unique<test::PacketTransport>(
task_queue(), sender_call_.get(), observer.get(),
test::PacketTransport::kSender, video_pt_map,
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
std::make_unique<SimulatedNetwork>(
BuiltInNetworkBehaviorConfig())));
video_send_transport->SetReceiver(receiver_call_->Receiver());
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
receive_transport = std::make_unique<test::PacketTransport>(
task_queue(), receiver_call_.get(), observer.get(),
test::PacketTransport::kReceiver, payload_type_map_,
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
std::make_unique<SimulatedNetwork>(
BuiltInNetworkBehaviorConfig())));
receive_transport->SetReceiver(sender_call_->Receiver());
CreateSendConfig(1, 0, 0, video_send_transport.get());
CreateMatchingReceiveConfigs(receive_transport.get());
AudioSendStream::Config audio_send_config(audio_send_transport.get());
audio_send_config.rtp.ssrc = kAudioSendSsrc;
// TODO(bugs.webrtc.org/14683): Let the tests fail with invalid config.
audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
kAudioSendPayloadType, {"OPUS", 48000, 2});
audio_send_config.min_bitrate_bps = 6000;
audio_send_config.max_bitrate_bps = 510000;
audio_send_config.encoder_factory = CreateBuiltinAudioEncoderFactory();
audio_send_stream = sender_call_->CreateAudioSendStream(audio_send_config);
GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
if (fec == FecMode::kOn) {
GetVideoSendConfig()->rtp.ulpfec.red_payload_type = kRedPayloadType;
GetVideoSendConfig()->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
video_receive_configs_[0].rtp.red_payload_type = kRedPayloadType;
video_receive_configs_[0].rtp.ulpfec_payload_type = kUlpfecPayloadType;
}
video_receive_configs_[0].rtp.nack.rtp_history_ms = 1000;
video_receive_configs_[0].renderer = observer.get();
video_receive_configs_[0].sync_group = kSyncGroup;
AudioReceiveStreamInterface::Config audio_recv_config;
audio_recv_config.rtp.remote_ssrc = kAudioSendSsrc;
audio_recv_config.rtp.local_ssrc = kAudioRecvSsrc;
audio_recv_config.rtcp_send_transport = receive_transport.get();
audio_recv_config.sync_group = kSyncGroup;
audio_recv_config.decoder_factory = audio_decoder_factory_;
audio_recv_config.decoder_map = {
{kAudioSendPayloadType, {"OPUS", 48000, 2}}};
if (create_first == CreateOrder::kAudioFirst) {
audio_receive_stream =
receiver_call_->CreateAudioReceiveStream(audio_recv_config);
CreateVideoStreams();
} else {
CreateVideoStreams();
audio_receive_stream =
receiver_call_->CreateAudioReceiveStream(audio_recv_config);
}
EXPECT_EQ(1u, video_receive_streams_.size());
observer->set_receive_stream(video_receive_streams_[0]);
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
drifting_clock = std::make_unique<DriftingClock>(clock_, video_ntp_speed);
CreateFrameGeneratorCapturerWithDrift(drifting_clock.get(), video_rtp_speed,
kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
Start();
audio_send_stream->Start();
audio_receive_stream->Start();
});
EXPECT_TRUE(observer->Wait())
<< "Timed out while waiting for audio and video to be synchronized.";
SendTask(task_queue(), [&]() {
// Clear the pointer to the receive stream since it will now be deleted.
observer->set_receive_stream(nullptr);
audio_send_stream->Stop();
audio_receive_stream->Stop();
Stop();
DestroyStreams();
sender_call_->DestroyAudioSendStream(audio_send_stream);
receiver_call_->DestroyAudioReceiveStream(audio_receive_stream);
DestroyCalls();
// Call may post periodic rtcp packet to the transport on the process
// thread, thus transport should be destroyed after the call objects.
// Though transports keep pointers to the call objects, transports handle
// packets on the task_queue() and thus wouldn't create a race while current
// destruction happens in the same task as destruction of the call objects.
video_send_transport.reset();
audio_send_transport.reset();
receive_transport.reset();
});
observer->PrintResults();
// In quick test synchronization may not be achieved in time.
if (!field_trial::IsEnabled("WebRTC-QuickPerfTest")) {
// TODO(bugs.webrtc.org/10417): Reenable this for iOS
#if !defined(WEBRTC_IOS)
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs"));
#endif
}
task_queue()->PostTask(
[to_delete = observer.release()]() { delete to_delete; });
}
TEST_F(CallPerfTest, Synchronization_PlaysOutAudioAndVideoWithoutClockDrift) {
TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst,
DriftingClock::kNoDrift, DriftingClock::kNoDrift,
DriftingClock::kNoDrift, "_video_no_drift");
}
TEST_F(CallPerfTest, Synchronization_PlaysOutAudioAndVideoWithVideoNtpDrift) {
TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst,
DriftingClock::PercentsFaster(10.0f),
DriftingClock::kNoDrift, DriftingClock::kNoDrift,
"_video_ntp_drift");
}
TEST_F(CallPerfTest,
Synchronization_PlaysOutAudioAndVideoWithAudioFasterThanVideoDrift) {
TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst,
DriftingClock::kNoDrift,
DriftingClock::PercentsSlower(30.0f),
DriftingClock::PercentsFaster(30.0f), "_audio_faster");
}
TEST_F(CallPerfTest,
Synchronization_PlaysOutAudioAndVideoWithVideoFasterThanAudioDrift) {
TestAudioVideoSync(FecMode::kOn, CreateOrder::kVideoFirst,
DriftingClock::kNoDrift,
DriftingClock::PercentsFaster(30.0f),
DriftingClock::PercentsSlower(30.0f), "_video_faster");
}
void CallPerfTest::TestCaptureNtpTime(
const BuiltInNetworkBehaviorConfig& net_config,
int threshold_ms,
int start_time_ms,
int run_time_ms) {
class CaptureNtpTimeObserver : public test::EndToEndTest,
public rtc::VideoSinkInterface<VideoFrame> {
public:
CaptureNtpTimeObserver(const BuiltInNetworkBehaviorConfig& net_config,
int threshold_ms,
int start_time_ms,
int run_time_ms)
: EndToEndTest(kLongTimeout),
net_config_(net_config),
clock_(Clock::GetRealTimeClock()),
threshold_ms_(threshold_ms),
start_time_ms_(start_time_ms),
run_time_ms_(run_time_ms),
creation_time_ms_(clock_->TimeInMilliseconds()),
capturer_(nullptr),
rtp_start_timestamp_set_(false),
rtp_start_timestamp_(0) {}
private:
std::unique_ptr<test::PacketTransport> CreateSendTransport(
TaskQueueBase* task_queue,
Call* sender_call) override {
return std::make_unique<test::PacketTransport>(
task_queue, sender_call, this, test::PacketTransport::kSender,
payload_type_map_,
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<FakeNetworkPipe>(
Clock::GetRealTimeClock(),
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<SimulatedNetwork>(net_config_)));
}
std::unique_ptr<test::PacketTransport> CreateReceiveTransport(
TaskQueueBase* task_queue) override {
return std::make_unique<test::PacketTransport>(
task_queue, nullptr, this, test::PacketTransport::kReceiver,
payload_type_map_,
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<FakeNetworkPipe>(
Clock::GetRealTimeClock(),
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<SimulatedNetwork>(net_config_)));
}
void OnFrame(const VideoFrame& video_frame) override {
MutexLock lock(&mutex_);
if (video_frame.ntp_time_ms() <= 0) {
// Haven't got enough RTCP SR in order to calculate the capture ntp
// time.
return;
}
int64_t now_ms = clock_->TimeInMilliseconds();
int64_t time_since_creation = now_ms - creation_time_ms_;
if (time_since_creation < start_time_ms_) {
// Wait for `start_time_ms_` before start measuring.
return;
}
if (time_since_creation > run_time_ms_) {
observation_complete_.Set();
}
FrameCaptureTimeList::iterator iter =
capture_time_list_.find(video_frame.timestamp());
EXPECT_TRUE(iter != capture_time_list_.end());
// The real capture time has been wrapped to uint32_t before converted
// to rtp timestamp in the sender side. So here we convert the estimated
// capture time to a uint32_t 90k timestamp also for comparing.
uint32_t estimated_capture_timestamp =
90 * static_cast<uint32_t>(video_frame.ntp_time_ms());
uint32_t real_capture_timestamp = iter->second;
int time_offset_ms = real_capture_timestamp - estimated_capture_timestamp;
time_offset_ms = time_offset_ms / 90;
time_offset_ms_list_.AddSample(time_offset_ms);
EXPECT_TRUE(std::abs(time_offset_ms) < threshold_ms_);
}
Action OnSendRtp(const uint8_t* packet, size_t length) override {
MutexLock lock(&mutex_);
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet, length));
if (!rtp_start_timestamp_set_) {
// Calculate the rtp timestamp offset in order to calculate the real
// capture time.
uint32_t first_capture_timestamp =
90 * static_cast<uint32_t>(capturer_->first_frame_capture_time());
rtp_start_timestamp_ = rtp_packet.Timestamp() - first_capture_timestamp;
rtp_start_timestamp_set_ = true;
}
uint32_t capture_timestamp =
rtp_packet.Timestamp() - rtp_start_timestamp_;
capture_time_list_.insert(
capture_time_list_.end(),
std::make_pair(rtp_packet.Timestamp(), capture_timestamp));
return SEND_PACKET;
}
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
capturer_ = frame_generator_capturer;
}
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
(*receive_configs)[0].renderer = this;
// Enable the receiver side rtt calculation.
(*receive_configs)[0].rtp.rtcp_xr.receiver_reference_time_report = true;
}
void PerformTest() override {
EXPECT_TRUE(Wait()) << "Timed out while waiting for estimated capture "
"NTP time to be within bounds.";
GetGlobalMetricsLogger()->LogMetric(
"capture_ntp_time", "real - estimated", time_offset_ms_list_,
Unit::kMilliseconds, ImprovementDirection::kNeitherIsBetter);
}
Mutex mutex_;
const BuiltInNetworkBehaviorConfig net_config_;
Clock* const clock_;
const int threshold_ms_;
const int start_time_ms_;
const int run_time_ms_;
const int64_t creation_time_ms_;
test::FrameGeneratorCapturer* capturer_;
bool rtp_start_timestamp_set_;
uint32_t rtp_start_timestamp_;
typedef std::map<uint32_t, uint32_t> FrameCaptureTimeList;
FrameCaptureTimeList capture_time_list_ RTC_GUARDED_BY(&mutex_);
SamplesStatsCounter time_offset_ms_list_;
} test(net_config, threshold_ms, start_time_ms, run_time_ms);
RunBaseTest(&test);
}
// Flaky tests, disabled on Mac and Windows due to webrtc:8291.
#if !(defined(WEBRTC_MAC) || defined(WEBRTC_WIN))
TEST_F(CallPerfTest, Real_Estimated_CaptureNtpTimeWithNetworkDelay) {
BuiltInNetworkBehaviorConfig net_config;
net_config.queue_delay_ms = 100;
// TODO(wu): lower the threshold as the calculation/estimation becomes more
// accurate.
const int kThresholdMs = 100;
const int kStartTimeMs = 10000;
const int kRunTimeMs = 20000;
TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs);
}
TEST_F(CallPerfTest, Real_Estimated_CaptureNtpTimeWithNetworkJitter) {
BuiltInNetworkBehaviorConfig net_config;
net_config.queue_delay_ms = 100;
net_config.delay_standard_deviation_ms = 10;
// TODO(wu): lower the threshold as the calculation/estimation becomes more
// accurate.
const int kThresholdMs = 100;
const int kStartTimeMs = 10000;
const int kRunTimeMs = 20000;
TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs);
}
#endif
Reland of Set scaling limit at 320 * 180 for all implementations. (patchset #1 id:1 of https://codereview.webrtc.org/2711913007/ ) Reason for revert: Reland after fixing broken perf tests. Original issue's description: > Revert of Set scaling limit at 320 * 180 for all implementations. (patchset #2 id:20001 of https://codereview.webrtc.org/2709153002/ ) > > Reason for revert: > Looks like webrtc_perf_test started failing on linux, mac and windows after this cl landed. > > Example failure: > > https://build.chromium.org/p/client.webrtc.perf/builders/Linux%20Trusty/builds/1386/steps/webrtc_perf_tests/logs/stdio > > [ RUN ] CallPerfTest.ReceivesCpuOveruseAndUnderuse > ../../webrtc/call/call_perf_tests.cc:522: Failure > Value of: Wait() > Actual: false > Expected: true > Timed out before receiving an overuse callback. > [ FAILED ] CallPerfTest.ReceivesCpuOveruseAndUnderuse (120056 ms) > > > Original issue's description: > > Set scaling limit at 320 * 180 for all implementations. > > > > The MediaCodec decoder on android has trouble decoding video at > > so low resolutions. We set the limit a bit higher for all implementations > > pending a robust software fallback implementation for MediaCodec. > > > > BUG=webrtc:7206 > > > > Review-Url: https://codereview.webrtc.org/2709153002 > > Cr-Commit-Position: refs/heads/master@{#16798} > > Committed: https://chromium.googlesource.com/external/webrtc/+/560ddb7321f2ae42ff1eb4c79d7c65d59f61dfe2 > > TBR=magjed@webrtc.org,sprang@webrtc.org,kthelgason@webrtc.org > # Not skipping CQ checks because original CL landed more than 1 days ago. > BUG=webrtc:7206 > > Review-Url: https://codereview.webrtc.org/2711913007 > Cr-Commit-Position: refs/heads/master@{#16839} > Committed: https://chromium.googlesource.com/external/webrtc/+/37510bf0946afef1015eabb66a801af3ac30042a TBR=magjed@webrtc.org,sprang@webrtc.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:7206 Review-Url: https://codereview.webrtc.org/2718013002 Cr-Commit-Position: refs/heads/master@{#16853}
2017-02-27 00:15:31 -08:00
TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) {
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ ) Reason for revert: Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test. Original issue's description: > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ ) > > Reason for revert: > This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780 > > Original issue's description: > > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ ) > > > > Reason for revert: > > Found issue with test case, will add fix to reland cl. > > > > Original issue's description: > > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ ) > > > > > > Reason for revert: > > > Breaks perf tests: > > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679 > > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325 > > > > > > Original issue's description: > > > > Add framerate to VideoSinkWants and ability to signal on overuse > > > > > > > > In ViEEncoder, try to reduce framerate instead of resolution if the > > > > current degradation preference is maintain-resolution rather than > > > > balanced. > > > > > > > > BUG=webrtc:4172 > > > > > > > > Review-Url: https://codereview.webrtc.org/2716643002 > > > > Cr-Commit-Position: refs/heads/master@{#17327} > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6 > > > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:4172 > > > > > > Review-Url: https://codereview.webrtc.org/2764133002 > > > Cr-Commit-Position: refs/heads/master@{#17331} > > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:4172 > > > > Review-Url: https://codereview.webrtc.org/2781433002 > > Cr-Commit-Position: refs/heads/master@{#17474} > > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51 > > TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:4172 > > Review-Url: https://codereview.webrtc.org/2783183003 > Cr-Commit-Position: refs/heads/master@{#17477} > Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59 R=ilnik@webrtc.org,stefan@webrtc.org BUG=webrtc:4172 Review-Url: https://codereview.webrtc.org/2789823002 Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
// Minimal normal usage at the start, then 30s overuse to allow filter to
// settle, and then 80s underuse to allow plenty of time for rampup again.
test::ScopedFieldTrials fake_overuse_settings(
"WebRTC-ForceSimulatedOveruseIntervalMs/1-30000-80000/");
class LoadObserver : public test::SendTest,
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
LoadObserver() : SendTest(kLongTimeout), test_phase_(TestPhase::kInit) {}
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
frame_generator_capturer->SetSinkWantsObserver(this);
Reland of Set scaling limit at 320 * 180 for all implementations. (patchset #1 id:1 of https://codereview.webrtc.org/2711913007/ ) Reason for revert: Reland after fixing broken perf tests. Original issue's description: > Revert of Set scaling limit at 320 * 180 for all implementations. (patchset #2 id:20001 of https://codereview.webrtc.org/2709153002/ ) > > Reason for revert: > Looks like webrtc_perf_test started failing on linux, mac and windows after this cl landed. > > Example failure: > > https://build.chromium.org/p/client.webrtc.perf/builders/Linux%20Trusty/builds/1386/steps/webrtc_perf_tests/logs/stdio > > [ RUN ] CallPerfTest.ReceivesCpuOveruseAndUnderuse > ../../webrtc/call/call_perf_tests.cc:522: Failure > Value of: Wait() > Actual: false > Expected: true > Timed out before receiving an overuse callback. > [ FAILED ] CallPerfTest.ReceivesCpuOveruseAndUnderuse (120056 ms) > > > Original issue's description: > > Set scaling limit at 320 * 180 for all implementations. > > > > The MediaCodec decoder on android has trouble decoding video at > > so low resolutions. We set the limit a bit higher for all implementations > > pending a robust software fallback implementation for MediaCodec. > > > > BUG=webrtc:7206 > > > > Review-Url: https://codereview.webrtc.org/2709153002 > > Cr-Commit-Position: refs/heads/master@{#16798} > > Committed: https://chromium.googlesource.com/external/webrtc/+/560ddb7321f2ae42ff1eb4c79d7c65d59f61dfe2 > > TBR=magjed@webrtc.org,sprang@webrtc.org,kthelgason@webrtc.org > # Not skipping CQ checks because original CL landed more than 1 days ago. > BUG=webrtc:7206 > > Review-Url: https://codereview.webrtc.org/2711913007 > Cr-Commit-Position: refs/heads/master@{#16839} > Committed: https://chromium.googlesource.com/external/webrtc/+/37510bf0946afef1015eabb66a801af3ac30042a TBR=magjed@webrtc.org,sprang@webrtc.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:7206 Review-Url: https://codereview.webrtc.org/2718013002 Cr-Commit-Position: refs/heads/master@{#16853}
2017-02-27 00:15:31 -08:00
// Set a high initial resolution to be sure that we can scale down.
frame_generator_capturer->ChangeResolution(1920, 1080);
}
// OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink
// is called.
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ ) Reason for revert: Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test. Original issue's description: > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ ) > > Reason for revert: > This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780 > > Original issue's description: > > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ ) > > > > Reason for revert: > > Found issue with test case, will add fix to reland cl. > > > > Original issue's description: > > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ ) > > > > > > Reason for revert: > > > Breaks perf tests: > > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679 > > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325 > > > > > > Original issue's description: > > > > Add framerate to VideoSinkWants and ability to signal on overuse > > > > > > > > In ViEEncoder, try to reduce framerate instead of resolution if the > > > > current degradation preference is maintain-resolution rather than > > > > balanced. > > > > > > > > BUG=webrtc:4172 > > > > > > > > Review-Url: https://codereview.webrtc.org/2716643002 > > > > Cr-Commit-Position: refs/heads/master@{#17327} > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6 > > > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:4172 > > > > > > Review-Url: https://codereview.webrtc.org/2764133002 > > > Cr-Commit-Position: refs/heads/master@{#17331} > > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:4172 > > > > Review-Url: https://codereview.webrtc.org/2781433002 > > Cr-Commit-Position: refs/heads/master@{#17474} > > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51 > > TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:4172 > > Review-Url: https://codereview.webrtc.org/2783183003 > Cr-Commit-Position: refs/heads/master@{#17477} > Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59 R=ilnik@webrtc.org,stefan@webrtc.org BUG=webrtc:4172 Review-Url: https://codereview.webrtc.org/2789823002 Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
// TODO(sprang): Add integration test for maintain-framerate mode?
void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {
// The sink wants can change either because an adaptation happened (i.e.
// the pixels or frame rate changed) or for other reasons, such as encoded
// resolutions being communicated (happens whenever we capture a new frame
// size). In this test, we only care about adaptations.
bool did_adapt =
last_wants_.max_pixel_count != wants.max_pixel_count ||
last_wants_.target_pixel_count != wants.target_pixel_count ||
last_wants_.max_framerate_fps != wants.max_framerate_fps;
last_wants_ = wants;
if (!did_adapt) {
return;
}
Reland "Add initial support for RtpEncodingParameters max_framerate." This reverts commit 948b7e37557af68b3bc9b81b29ae2daffb2784ad. Reason for revert: downstream project fixed. Original change's description: > Revert "Add initial support for RtpEncodingParameters max_framerate." > > This reverts commit ced5cfdb35a20c684df927eab37e16d35979555f. > > Reason for revert: Breaks downstream project. > > Original change's description: > > Add initial support for RtpEncodingParameters max_framerate. > > > > Add support to set the framerate to the maximum of |max_framerate|. > > Different framerates are currently not supported per stream for video. > > > > Bug: webrtc:9597 > > Change-Id: Ie326617b66bd97be387f809a7f82b97b8f3ff5fe > > Reviewed-on: https://webrtc-review.googlesource.com/92392 > > Reviewed-by: Sebastian Jansson <srte@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Commit-Queue: Åsa Persson <asapersson@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24270} > > TBR=steveanton@webrtc.org,magjed@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org,srte@webrtc.org > > Change-Id: I508fe48e0c53996654f657357913ac307dc256bd > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9597 > Reviewed-on: https://webrtc-review.googlesource.com/94060 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24277} TBR=steveanton@webrtc.org,mbonadei@webrtc.org,magjed@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org,srte@webrtc.org Bug: webrtc:9597 Change-Id: Ieed9d62787f3e9dcb439399bfe7529012292381e Reviewed-on: https://webrtc-review.googlesource.com/100080 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24720}
2018-09-13 10:42:19 +02:00
// At kStart expect CPU overuse. Then expect CPU underuse when the encoder
// delay has been decreased.
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ ) Reason for revert: Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test. Original issue's description: > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ ) > > Reason for revert: > This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780 > > Original issue's description: > > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ ) > > > > Reason for revert: > > Found issue with test case, will add fix to reland cl. > > > > Original issue's description: > > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ ) > > > > > > Reason for revert: > > > Breaks perf tests: > > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679 > > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325 > > > > > > Original issue's description: > > > > Add framerate to VideoSinkWants and ability to signal on overuse > > > > > > > > In ViEEncoder, try to reduce framerate instead of resolution if the > > > > current degradation preference is maintain-resolution rather than > > > > balanced. > > > > > > > > BUG=webrtc:4172 > > > > > > > > Review-Url: https://codereview.webrtc.org/2716643002 > > > > Cr-Commit-Position: refs/heads/master@{#17327} > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6 > > > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:4172 > > > > > > Review-Url: https://codereview.webrtc.org/2764133002 > > > Cr-Commit-Position: refs/heads/master@{#17331} > > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:4172 > > > > Review-Url: https://codereview.webrtc.org/2781433002 > > Cr-Commit-Position: refs/heads/master@{#17474} > > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51 > > TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:4172 > > Review-Url: https://codereview.webrtc.org/2783183003 > Cr-Commit-Position: refs/heads/master@{#17477} > Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59 R=ilnik@webrtc.org,stefan@webrtc.org BUG=webrtc:4172 Review-Url: https://codereview.webrtc.org/2789823002 Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
switch (test_phase_) {
Reland "Add initial support for RtpEncodingParameters max_framerate." This reverts commit 948b7e37557af68b3bc9b81b29ae2daffb2784ad. Reason for revert: downstream project fixed. Original change's description: > Revert "Add initial support for RtpEncodingParameters max_framerate." > > This reverts commit ced5cfdb35a20c684df927eab37e16d35979555f. > > Reason for revert: Breaks downstream project. > > Original change's description: > > Add initial support for RtpEncodingParameters max_framerate. > > > > Add support to set the framerate to the maximum of |max_framerate|. > > Different framerates are currently not supported per stream for video. > > > > Bug: webrtc:9597 > > Change-Id: Ie326617b66bd97be387f809a7f82b97b8f3ff5fe > > Reviewed-on: https://webrtc-review.googlesource.com/92392 > > Reviewed-by: Sebastian Jansson <srte@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Commit-Queue: Åsa Persson <asapersson@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24270} > > TBR=steveanton@webrtc.org,magjed@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org,srte@webrtc.org > > Change-Id: I508fe48e0c53996654f657357913ac307dc256bd > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9597 > Reviewed-on: https://webrtc-review.googlesource.com/94060 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24277} TBR=steveanton@webrtc.org,mbonadei@webrtc.org,magjed@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org,srte@webrtc.org Bug: webrtc:9597 Change-Id: Ieed9d62787f3e9dcb439399bfe7529012292381e Reviewed-on: https://webrtc-review.googlesource.com/100080 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24720}
2018-09-13 10:42:19 +02:00
case TestPhase::kInit:
// Max framerate should be set initially.
if (wants.max_framerate_fps != std::numeric_limits<int>::max() &&
wants.max_pixel_count == std::numeric_limits<int>::max()) {
test_phase_ = TestPhase::kStart;
} else {
ADD_FAILURE() << "Got unexpected adaptation request, max res = "
<< wants.max_pixel_count << ", target res = "
<< wants.target_pixel_count.value_or(-1)
<< ", max fps = " << wants.max_framerate_fps;
}
break;
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ ) Reason for revert: Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test. Original issue's description: > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ ) > > Reason for revert: > This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780 > > Original issue's description: > > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ ) > > > > Reason for revert: > > Found issue with test case, will add fix to reland cl. > > > > Original issue's description: > > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ ) > > > > > > Reason for revert: > > > Breaks perf tests: > > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679 > > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325 > > > > > > Original issue's description: > > > > Add framerate to VideoSinkWants and ability to signal on overuse > > > > > > > > In ViEEncoder, try to reduce framerate instead of resolution if the > > > > current degradation preference is maintain-resolution rather than > > > > balanced. > > > > > > > > BUG=webrtc:4172 > > > > > > > > Review-Url: https://codereview.webrtc.org/2716643002 > > > > Cr-Commit-Position: refs/heads/master@{#17327} > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6 > > > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:4172 > > > > > > Review-Url: https://codereview.webrtc.org/2764133002 > > > Cr-Commit-Position: refs/heads/master@{#17331} > > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:4172 > > > > Review-Url: https://codereview.webrtc.org/2781433002 > > Cr-Commit-Position: refs/heads/master@{#17474} > > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51 > > TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:4172 > > Review-Url: https://codereview.webrtc.org/2783183003 > Cr-Commit-Position: refs/heads/master@{#17477} > Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59 R=ilnik@webrtc.org,stefan@webrtc.org BUG=webrtc:4172 Review-Url: https://codereview.webrtc.org/2789823002 Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
case TestPhase::kStart:
if (wants.max_pixel_count < std::numeric_limits<int>::max()) {
// On adapting down, VideoStreamEncoder::VideoSourceProxy will set
// only the max pixel count, leaving the target unset.
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ ) Reason for revert: Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test. Original issue's description: > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ ) > > Reason for revert: > This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780 > > Original issue's description: > > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ ) > > > > Reason for revert: > > Found issue with test case, will add fix to reland cl. > > > > Original issue's description: > > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ ) > > > > > > Reason for revert: > > > Breaks perf tests: > > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679 > > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325 > > > > > > Original issue's description: > > > > Add framerate to VideoSinkWants and ability to signal on overuse > > > > > > > > In ViEEncoder, try to reduce framerate instead of resolution if the > > > > current degradation preference is maintain-resolution rather than > > > > balanced. > > > > > > > > BUG=webrtc:4172 > > > > > > > > Review-Url: https://codereview.webrtc.org/2716643002 > > > > Cr-Commit-Position: refs/heads/master@{#17327} > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6 > > > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:4172 > > > > > > Review-Url: https://codereview.webrtc.org/2764133002 > > > Cr-Commit-Position: refs/heads/master@{#17331} > > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b > > > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:4172 > > > > Review-Url: https://codereview.webrtc.org/2781433002 > > Cr-Commit-Position: refs/heads/master@{#17474} > > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51 > > TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:4172 > > Review-Url: https://codereview.webrtc.org/2783183003 > Cr-Commit-Position: refs/heads/master@{#17477} > Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59 R=ilnik@webrtc.org,stefan@webrtc.org BUG=webrtc:4172 Review-Url: https://codereview.webrtc.org/2789823002 Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
test_phase_ = TestPhase::kAdaptedDown;
} else {
ADD_FAILURE() << "Got unexpected adaptation request, max res = "
<< wants.max_pixel_count << ", target res = "
<< wants.target_pixel_count.value_or(-1)
<< ", max fps = " << wants.max_framerate_fps;
}
break;
case TestPhase::kAdaptedDown:
// On adapting up, the adaptation counter will again be at zero, and
// so all constraints will be reset.
if (wants.max_pixel_count == std::numeric_limits<int>::max() &&
!wants.target_pixel_count) {
test_phase_ = TestPhase::kAdaptedUp;
observation_complete_.Set();
} else {
ADD_FAILURE() << "Got unexpected adaptation request, max res = "
<< wants.max_pixel_count << ", target res = "
<< wants.target_pixel_count.value_or(-1)
<< ", max fps = " << wants.max_framerate_fps;
}
break;
case TestPhase::kAdaptedUp:
ADD_FAILURE() << "Got unexpected adaptation request, max res = "
<< wants.max_pixel_count << ", target res = "
<< wants.target_pixel_count.value_or(-1)
<< ", max fps = " << wants.max_framerate_fps;
}
}
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {}
void PerformTest() override {
EXPECT_TRUE(Wait()) << "Timed out before receiving an overuse callback.";
}
Reland "Add initial support for RtpEncodingParameters max_framerate." This reverts commit 948b7e37557af68b3bc9b81b29ae2daffb2784ad. Reason for revert: downstream project fixed. Original change's description: > Revert "Add initial support for RtpEncodingParameters max_framerate." > > This reverts commit ced5cfdb35a20c684df927eab37e16d35979555f. > > Reason for revert: Breaks downstream project. > > Original change's description: > > Add initial support for RtpEncodingParameters max_framerate. > > > > Add support to set the framerate to the maximum of |max_framerate|. > > Different framerates are currently not supported per stream for video. > > > > Bug: webrtc:9597 > > Change-Id: Ie326617b66bd97be387f809a7f82b97b8f3ff5fe > > Reviewed-on: https://webrtc-review.googlesource.com/92392 > > Reviewed-by: Sebastian Jansson <srte@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Commit-Queue: Åsa Persson <asapersson@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24270} > > TBR=steveanton@webrtc.org,magjed@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org,srte@webrtc.org > > Change-Id: I508fe48e0c53996654f657357913ac307dc256bd > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9597 > Reviewed-on: https://webrtc-review.googlesource.com/94060 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24277} TBR=steveanton@webrtc.org,mbonadei@webrtc.org,magjed@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org,srte@webrtc.org Bug: webrtc:9597 Change-Id: Ieed9d62787f3e9dcb439399bfe7529012292381e Reviewed-on: https://webrtc-review.googlesource.com/100080 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24720}
2018-09-13 10:42:19 +02:00
enum class TestPhase {
kInit,
kStart,
kAdaptedDown,
kAdaptedUp
} test_phase_;
private:
rtc::VideoSinkWants last_wants_;
} test;
RunBaseTest(&test);
}
void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
static const int kMaxEncodeBitrateKbps = 30;
static const int kMinTransmitBitrateBps = 150000;
static const int kMinAcceptableTransmitBitrate = 130;
static const int kMaxAcceptableTransmitBitrate = 170;
static const int kNumBitrateObservationsInRange = 100;
static const int kAcceptableBitrateErrorMargin = 15; // +- 7
class BitrateObserver : public test::EndToEndTest {
public:
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
explicit BitrateObserver(bool using_min_transmit_bitrate,
TaskQueueBase* task_queue)
: EndToEndTest(kLongTimeout),
send_stream_(nullptr),
converged_(false),
pad_to_min_bitrate_(using_min_transmit_bitrate),
min_acceptable_bitrate_(using_min_transmit_bitrate
? kMinAcceptableTransmitBitrate
: (kMaxEncodeBitrateKbps -
kAcceptableBitrateErrorMargin / 2)),
max_acceptable_bitrate_(using_min_transmit_bitrate
? kMaxAcceptableTransmitBitrate
: (kMaxEncodeBitrateKbps +
kAcceptableBitrateErrorMargin / 2)),
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
num_bitrate_observations_in_range_(0),
task_queue_(task_queue),
task_safety_flag_(PendingTaskSafetyFlag::CreateDetached()) {}
private:
// TODO(holmer): Run this with a timer instead of once per packet.
Action OnSendRtp(const uint8_t* packet, size_t length) override {
task_queue_->PostTask(SafeTask(task_safety_flag_, [this]() {
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
VideoSendStream::Stats stats = send_stream_->GetStats();
if (!stats.substreams.empty()) {
RTC_DCHECK_EQ(1, stats.substreams.size());
int bitrate_kbps =
stats.substreams.begin()->second.total_bitrate_bps / 1000;
if (bitrate_kbps > min_acceptable_bitrate_ &&
bitrate_kbps < max_acceptable_bitrate_) {
converged_ = true;
++num_bitrate_observations_in_range_;
if (num_bitrate_observations_in_range_ ==
kNumBitrateObservationsInRange)
observation_complete_.Set();
}
if (converged_)
bitrate_kbps_list_.AddSample(bitrate_kbps);
}
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
}));
return SEND_PACKET;
}
void OnVideoStreamsCreated(VideoSendStream* send_stream,
const std::vector<VideoReceiveStreamInterface*>&
receive_streams) override {
send_stream_ = send_stream;
}
void OnStreamsStopped() override { task_safety_flag_->SetNotAlive(); }
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
if (pad_to_min_bitrate_) {
encoder_config->min_transmit_bitrate_bps = kMinTransmitBitrateBps;
} else {
RTC_DCHECK_EQ(0, encoder_config->min_transmit_bitrate_bps);
}
}
void PerformTest() override {
EXPECT_TRUE(Wait()) << "Timeout while waiting for send-bitrate stats.";
GetGlobalMetricsLogger()->LogMetric(
std::string("bitrate_stats_") +
(pad_to_min_bitrate_ ? "min_transmit_bitrate"
: "without_min_transmit_bitrate"),
"bitrate_kbps", bitrate_kbps_list_, Unit::kUnitless,
ImprovementDirection::kNeitherIsBetter);
}
VideoSendStream* send_stream_;
bool converged_;
const bool pad_to_min_bitrate_;
const int min_acceptable_bitrate_;
const int max_acceptable_bitrate_;
int num_bitrate_observations_in_range_;
SamplesStatsCounter bitrate_kbps_list_;
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
TaskQueueBase* task_queue_;
rtc::scoped_refptr<PendingTaskSafetyFlag> task_safety_flag_;
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
} test(pad_to_min_bitrate, task_queue());
fake_encoder_max_bitrate_ = kMaxEncodeBitrateKbps;
RunBaseTest(&test);
}
TEST_F(CallPerfTest, Bitrate_Kbps_PadsToMinTransmitBitrate) {
TestMinTransmitBitrate(true);
}
TEST_F(CallPerfTest, Bitrate_Kbps_NoPadWithoutMinTransmitBitrate) {
TestMinTransmitBitrate(false);
}
// TODO(bugs.webrtc.org/8878)
#if defined(WEBRTC_MAC)
#define MAYBE_KeepsHighBitrateWhenReconfiguringSender \
DISABLED_KeepsHighBitrateWhenReconfiguringSender
#else
#define MAYBE_KeepsHighBitrateWhenReconfiguringSender \
KeepsHighBitrateWhenReconfiguringSender
#endif
TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
static const uint32_t kInitialBitrateKbps = 400;
static const uint32_t kInitialBitrateOverheadKpbs = 6;
static const uint32_t kReconfigureThresholdKbps = 600;
class VideoStreamFactory
: public VideoEncoderConfig::VideoStreamFactoryInterface {
public:
VideoStreamFactory() {}
private:
std::vector<VideoStream> CreateEncoderStreams(
int frame_width,
int frame_height,
const webrtc::VideoEncoderConfig& encoder_config) override {
std::vector<VideoStream> streams =
test::CreateVideoStreams(frame_width, frame_height, encoder_config);
streams[0].min_bitrate_bps = 50000;
streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000;
return streams;
}
};
class BitrateObserver : public test::EndToEndTest, public test::FakeEncoder {
public:
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
explicit BitrateObserver(TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout),
FakeEncoder(Clock::GetRealTimeClock()),
encoder_inits_(0),
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
last_set_bitrate_kbps_(0),
send_stream_(nullptr),
frame_generator_(nullptr),
encoder_factory_(this),
bitrate_allocator_factory_(
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
CreateBuiltinVideoBitrateAllocatorFactory()),
task_queue_(task_queue) {}
int32_t InitEncode(const VideoCodec* config,
const VideoEncoder::Settings& settings) override {
++encoder_inits_;
if (encoder_inits_ == 1) {
// First time initialization. Frame size is known.
// `expected_bitrate` is affected by bandwidth estimation before the
// first frame arrives to the encoder.
uint32_t expected_bitrate =
last_set_bitrate_kbps_ > 0
? last_set_bitrate_kbps_
: kInitialBitrateKbps - kInitialBitrateOverheadKpbs;
EXPECT_EQ(expected_bitrate, config->startBitrate)
<< "Encoder not initialized at expected bitrate.";
EXPECT_EQ(kDefaultWidth, config->width);
EXPECT_EQ(kDefaultHeight, config->height);
} else if (encoder_inits_ == 2) {
EXPECT_EQ(2 * kDefaultWidth, config->width);
EXPECT_EQ(2 * kDefaultHeight, config->height);
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
EXPECT_GE(last_set_bitrate_kbps_, kReconfigureThresholdKbps);
EXPECT_GT(config->startBitrate, kReconfigureThresholdKbps)
<< "Encoder reconfigured with bitrate too far away from last set.";
observation_complete_.Set();
}
return FakeEncoder::InitEncode(config, settings);
}
void SetRates(const RateControlParameters& parameters) override {
last_set_bitrate_kbps_ = parameters.bitrate.get_sum_kbps();
if (encoder_inits_ == 1 &&
parameters.bitrate.get_sum_kbps() > kReconfigureThresholdKbps) {
time_to_reconfigure_.Set();
}
FakeEncoder::SetRates(parameters);
}
void ModifySenderBitrateConfig(
BitrateConstraints* bitrate_config) override {
bitrate_config->start_bitrate_bps = kInitialBitrateKbps * 1000;
}
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->encoder_settings.bitrate_allocator_factory =
bitrate_allocator_factory_.get();
encoder_config->max_bitrate_bps = 2 * kReconfigureThresholdKbps * 1000;
encoder_config->video_stream_factory =
rtc::make_ref_counted<VideoStreamFactory>();
encoder_config_ = encoder_config->Copy();
}
void OnVideoStreamsCreated(VideoSendStream* send_stream,
const std::vector<VideoReceiveStreamInterface*>&
receive_streams) override {
send_stream_ = send_stream;
}
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
frame_generator_ = frame_generator_capturer;
}
void PerformTest() override {
ASSERT_TRUE(time_to_reconfigure_.Wait(kDefaultTimeout))
<< "Timed out before receiving an initial high bitrate.";
frame_generator_->ChangeResolution(kDefaultWidth * 2, kDefaultHeight * 2);
SendTask(task_queue_, [&]() {
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
});
EXPECT_TRUE(Wait())
<< "Timed out while waiting for a couple of high bitrate estimates "
"after reconfiguring the send stream.";
}
private:
rtc::Event time_to_reconfigure_;
int encoder_inits_;
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
uint32_t last_set_bitrate_kbps_;
VideoSendStream* send_stream_;
test::FrameGeneratorCapturer* frame_generator_;
test::VideoEncoderProxyFactory encoder_factory_;
std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory_;
VideoEncoderConfig encoder_config_;
Reland "Remove Invoke from VideoChannel::FillBitrateInfo." This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
2021-05-03 16:23:08 +02:00
TaskQueueBase* task_queue_;
} test(task_queue());
RunBaseTest(&test);
}
// Discovers the minimal supported audio+video bitrate. The test bitrate is
// considered supported if Rtt does not go above 400ms with the network
// contrained to the test bitrate.
//
// |test_bitrate_from test_bitrate_to| bitrate constraint range
// `test_bitrate_step` bitrate constraint update step during the test
// |min_bwe max_bwe| BWE range
// `start_bwe` initial BWE
void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from,
int test_bitrate_to,
int test_bitrate_step,
int min_bwe,
int start_bwe,
int max_bwe) {
static const std::string kAudioTrackId = "audio_track_0";
static constexpr int kOpusBitrateFbBps = 32000;
static constexpr int kBitrateStabilizationMs = 10000;
static constexpr int kBitrateMeasurements = 10;
static constexpr int kBitrateMeasurementMs = 1000;
static constexpr int kShortDelayMs = 10;
static constexpr int kMinGoodRttMs = 400;
class MinVideoAndAudioBitrateTester : public test::EndToEndTest {
public:
MinVideoAndAudioBitrateTester(int test_bitrate_from,
int test_bitrate_to,
int test_bitrate_step,
int min_bwe,
int start_bwe,
int max_bwe,
TaskQueueBase* task_queue)
: EndToEndTest(),
test_bitrate_from_(test_bitrate_from),
test_bitrate_to_(test_bitrate_to),
test_bitrate_step_(test_bitrate_step),
min_bwe_(min_bwe),
start_bwe_(start_bwe),
max_bwe_(max_bwe),
task_queue_(task_queue) {}
protected:
BuiltInNetworkBehaviorConfig GetFakeNetworkPipeConfig() {
BuiltInNetworkBehaviorConfig pipe_config;
pipe_config.link_capacity_kbps = test_bitrate_from_;
return pipe_config;
}
std::unique_ptr<test::PacketTransport> CreateSendTransport(
TaskQueueBase* task_queue,
Call* sender_call) override {
auto network =
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<SimulatedNetwork>(GetFakeNetworkPipeConfig());
send_simulated_network_ = network.get();
return std::make_unique<test::PacketTransport>(
task_queue, sender_call, this, test::PacketTransport::kSender,
test::CallTest::payload_type_map_,
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
std::move(network)));
}
std::unique_ptr<test::PacketTransport> CreateReceiveTransport(
TaskQueueBase* task_queue) override {
auto network =
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<SimulatedNetwork>(GetFakeNetworkPipeConfig());
receive_simulated_network_ = network.get();
return std::make_unique<test::PacketTransport>(
task_queue, nullptr, this, test::PacketTransport::kReceiver,
test::CallTest::payload_type_map_,
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
std::move(network)));
}
void PerformTest() override {
// Quick test mode, just to exercise all the code paths without actually
// caring about performance measurements.
const bool quick_perf_test =
field_trial::IsEnabled("WebRTC-QuickPerfTest");
int last_passed_test_bitrate = -1;
for (int test_bitrate = test_bitrate_from_;
test_bitrate_from_ < test_bitrate_to_
? test_bitrate <= test_bitrate_to_
: test_bitrate >= test_bitrate_to_;
test_bitrate += test_bitrate_step_) {
BuiltInNetworkBehaviorConfig pipe_config;
pipe_config.link_capacity_kbps = test_bitrate;
send_simulated_network_->SetConfig(pipe_config);
receive_simulated_network_->SetConfig(pipe_config);
rtc::Thread::SleepMs(quick_perf_test ? kShortDelayMs
: kBitrateStabilizationMs);
int64_t avg_rtt = 0;
for (int i = 0; i < kBitrateMeasurements; i++) {
Call::Stats call_stats;
SendTask(task_queue_, [this, &call_stats]() {
call_stats = sender_call_->GetStats();
});
avg_rtt += call_stats.rtt_ms;
rtc::Thread::SleepMs(quick_perf_test ? kShortDelayMs
: kBitrateMeasurementMs);
}
avg_rtt = avg_rtt / kBitrateMeasurements;
if (avg_rtt > kMinGoodRttMs) {
break;
} else {
last_passed_test_bitrate = test_bitrate;
}
}
EXPECT_GT(last_passed_test_bitrate, -1)
<< "Minimum supported bitrate out of the test scope";
GetGlobalMetricsLogger()->LogSingleValueMetric(
"min_test_bitrate_", "min_bitrate", last_passed_test_bitrate,
Unit::kUnitless, ImprovementDirection::kNeitherIsBetter);
}
void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
sender_call_ = sender_call;
BitrateConstraints bitrate_config;
bitrate_config.min_bitrate_bps = min_bwe_;
bitrate_config.start_bitrate_bps = start_bwe_;
bitrate_config.max_bitrate_bps = max_bwe_;
sender_call->GetTransportControllerSend()->SetSdpBitrateParameters(
bitrate_config);
}
size_t GetNumVideoStreams() const override { return 1; }
size_t GetNumAudioStreams() const override { return 1; }
void ModifyAudioConfigs(AudioSendStream::Config* send_config,
std::vector<AudioReceiveStreamInterface::Config>*
receive_configs) override {
send_config->send_codec_spec->target_bitrate_bps =
absl::optional<int>(kOpusBitrateFbBps);
}
private:
const int test_bitrate_from_;
const int test_bitrate_to_;
const int test_bitrate_step_;
const int min_bwe_;
const int start_bwe_;
const int max_bwe_;
SimulatedNetwork* send_simulated_network_;
SimulatedNetwork* receive_simulated_network_;
Call* sender_call_;
TaskQueueBase* const task_queue_;
} test(test_bitrate_from, test_bitrate_to, test_bitrate_step, min_bwe,
start_bwe, max_bwe, task_queue());
RunBaseTest(&test);
}
// TODO(bugs.webrtc.org/8878)
#if defined(WEBRTC_MAC)
#define MAYBE_Min_Bitrate_VideoAndAudio DISABLED_Min_Bitrate_VideoAndAudio
#else
#define MAYBE_Min_Bitrate_VideoAndAudio Min_Bitrate_VideoAndAudio
#endif
TEST_F(CallPerfTest, MAYBE_Min_Bitrate_VideoAndAudio) {
TestMinAudioVideoBitrate(110, 40, -10, 10000, 70000, 200000);
}
void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
absl::string_view payload_name,
const std::vector<int>& max_framerates) {
static constexpr double kAllowedFpsDiff = 1.5;
static constexpr TimeDelta kMinGetStatsInterval = TimeDelta::Millis(400);
static constexpr TimeDelta kMinRunTime = TimeDelta::Seconds(15);
static constexpr DataRate kMaxBitrate = DataRate::KilobitsPerSec(1000);
class FramerateObserver
: public test::EndToEndTest,
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
FramerateObserver(VideoEncoderFactory* encoder_factory,
absl::string_view payload_name,
const std::vector<int>& max_framerates,
TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout),
clock_(Clock::GetRealTimeClock()),
encoder_factory_(encoder_factory),
payload_name_(payload_name),
max_framerates_(max_framerates),
task_queue_(task_queue),
start_time_(clock_->CurrentTime()),
last_getstats_time_(start_time_),
send_stream_(nullptr) {}
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
frame_generator_capturer->ChangeResolution(640, 360);
}
void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {}
void ModifySenderBitrateConfig(
BitrateConstraints* bitrate_config) override {
bitrate_config->start_bitrate_bps = kMaxBitrate.bps() / 2;
}
void OnVideoStreamsCreated(VideoSendStream* send_stream,
const std::vector<VideoReceiveStreamInterface*>&
receive_streams) override {
send_stream_ = send_stream;
}
size_t GetNumVideoStreams() const override {
return max_framerates_.size();
}
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
send_config->encoder_settings.encoder_factory = encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.payload_type = test::CallTest::kVideoSendPayloadType;
encoder_config->video_format.name = payload_name_;
encoder_config->codec_type = PayloadStringToCodecType(payload_name_);
encoder_config->max_bitrate_bps = kMaxBitrate.bps();
for (size_t i = 0; i < max_framerates_.size(); ++i) {
encoder_config->simulcast_layers[i].max_framerate = max_framerates_[i];
configured_framerates_[send_config->rtp.ssrcs[i]] = max_framerates_[i];
}
}
void PerformTest() override {
EXPECT_TRUE(Wait()) << "Timeout while waiting for framerate stats.";
}
void VerifyStats() const {
double input_fps = 0.0;
for (const auto& configured_framerate : configured_framerates_) {
input_fps = std::max(configured_framerate.second, input_fps);
}
for (const auto& encode_frame_rate_list : encode_frame_rate_lists_) {
const SamplesStatsCounter& values = encode_frame_rate_list.second;
GetGlobalMetricsLogger()->LogMetric(
"substream_fps", "encode_frame_rate", values, Unit::kUnitless,
ImprovementDirection::kNeitherIsBetter);
if (values.IsEmpty()) {
continue;
}
double average_fps = values.GetAverage();
uint32_t ssrc = encode_frame_rate_list.first;
double expected_fps = configured_framerates_.find(ssrc)->second;
if (expected_fps != input_fps)
EXPECT_NEAR(expected_fps, average_fps, kAllowedFpsDiff);
}
}
Action OnSendRtp(const uint8_t* packet, size_t length) override {
const Timestamp now = clock_->CurrentTime();
if (now - last_getstats_time_ > kMinGetStatsInterval) {
last_getstats_time_ = now;
task_queue_->PostTask([this, now]() {
VideoSendStream::Stats stats = send_stream_->GetStats();
for (const auto& stat : stats.substreams) {
encode_frame_rate_lists_[stat.first].AddSample(
stat.second.encode_frame_rate);
}
if (now - start_time_ > kMinRunTime) {
VerifyStats();
observation_complete_.Set();
}
});
}
return SEND_PACKET;
}
Clock* const clock_;
VideoEncoderFactory* const encoder_factory_;
const std::string payload_name_;
const std::vector<int> max_framerates_;
TaskQueueBase* const task_queue_;
const Timestamp start_time_;
Timestamp last_getstats_time_;
VideoSendStream* send_stream_;
std::map<uint32_t, SamplesStatsCounter> encode_frame_rate_lists_;
std::map<uint32_t, double> configured_framerates_;
} test(encoder_factory, payload_name, max_framerates, task_queue());
RunBaseTest(&test);
}
TEST_F(CallPerfTest, TestEncodeFramerateVp8Simulcast) {
InternalEncoderFactory internal_encoder_factory;
test::FunctionVideoEncoderFactory encoder_factory(
[&internal_encoder_factory]() {
return std::make_unique<SimulcastEncoderAdapter>(
&internal_encoder_factory, SdpVideoFormat("VP8"));
});
TestEncodeFramerate(&encoder_factory, "VP8",
/*max_framerates=*/{20, 30});
}
TEST_F(CallPerfTest, TestEncodeFramerateVp8SimulcastLowerInputFps) {
InternalEncoderFactory internal_encoder_factory;
test::FunctionVideoEncoderFactory encoder_factory(
[&internal_encoder_factory]() {
return std::make_unique<SimulcastEncoderAdapter>(
&internal_encoder_factory, SdpVideoFormat("VP8"));
});
TestEncodeFramerate(&encoder_factory, "VP8",
/*max_framerates=*/{14, 20});
}
} // namespace webrtc