This CL adds Resource, ResourceConsumer, ResourceConsumerConfiguration and ResourceAdaptationProcessor and implements the algorithm outlined in https://docs.google.com/presentation/d/13jyqCWNpIa873iKT6yDuB5Q5ma-c0CvxBpX--0tCclY/edit?usp=sharing. Simply put, if any resource (such as "CPU") is overusing, the most expensive consumer (e.g. encoded stream) is adapted one step down. If all resources are underusing, the least expensive consumer is adapted one step up. The current resources, consumers and configurations are all fakes; this CL has no effect on the current adaptation algorithms used in practise, but it lays down the foundation for future work in this area. Bug: webrtc:11167, webrtc:11168, webrtc:11169 Change-Id: I4054ec7728a52a49e137eee6fa67fa27debd9254 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161237 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Evan Shrubsole <eshr@google.com> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30053}
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
/*
|
|
* Copyright 2019 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 "call/adaptation/resource_consumer.h"
|
|
|
|
#include <utility>
|
|
|
|
#include "call/adaptation/resource_consumer_configuration.h"
|
|
#include "rtc_base/checks.h"
|
|
#include "rtc_base/strings/string_builder.h"
|
|
|
|
namespace webrtc {
|
|
|
|
ResourceConsumer::ResourceConsumer(std::string name,
|
|
ResourceConsumerConfiguration* configuration)
|
|
: name_(std::move(name)), configuration_(configuration) {
|
|
RTC_DCHECK(!name_.empty());
|
|
RTC_DCHECK(configuration_);
|
|
}
|
|
|
|
ResourceConsumer::~ResourceConsumer() {}
|
|
|
|
std::string ResourceConsumer::name() const {
|
|
return name_;
|
|
}
|
|
|
|
ResourceConsumerConfiguration* ResourceConsumer::configuration() const {
|
|
return configuration_;
|
|
}
|
|
|
|
void ResourceConsumer::SetConfiguration(
|
|
ResourceConsumerConfiguration* configuration) {
|
|
RTC_DCHECK(configuration);
|
|
configuration_ = configuration;
|
|
}
|
|
|
|
std::string ResourceConsumer::ToString() const {
|
|
rtc::StringBuilder sb;
|
|
sb << name_ << ": " << configuration_->Name();
|
|
return sb.str();
|
|
}
|
|
|
|
} // namespace webrtc
|