[Adaptation] Don't toggle EncoderUsageResource on/off
Instead it should be ensured that it is started with the correct config. This removes confusion regarding a resource state. If the resource check is stopped then the adaptations for that resource should be removed, and there is no way to determine that if we have one method for stop for both reconfigure and shutdown. Bug: webrtc:11843 Change-Id: I491f2fd1f4f803a4610124c7b0026ad75ab4a9cc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181368 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@google.com> Cr-Commit-Position: refs/heads/master@{#31913}
This commit is contained in:
parent
c45b65a951
commit
552eed534c
@ -336,10 +336,12 @@ VideoStreamEncoderResourceManager::degradation_preference() const {
|
||||
return degradation_preference_;
|
||||
}
|
||||
|
||||
void VideoStreamEncoderResourceManager::StartEncodeUsageResource() {
|
||||
void VideoStreamEncoderResourceManager::EnsureEncodeUsageResourceStarted() {
|
||||
RTC_DCHECK_RUN_ON(encoder_queue_);
|
||||
RTC_DCHECK(!encode_usage_resource_->is_started());
|
||||
RTC_DCHECK(encoder_settings_.has_value());
|
||||
if (encode_usage_resource_->is_started()) {
|
||||
encode_usage_resource_->StopCheckForOveruse();
|
||||
}
|
||||
encode_usage_resource_->StartCheckForOveruse(GetCpuOveruseOptions());
|
||||
}
|
||||
|
||||
|
||||
@ -89,9 +89,7 @@ class VideoStreamEncoderResourceManager
|
||||
void SetDegradationPreferences(DegradationPreference degradation_preference);
|
||||
DegradationPreference degradation_preference() const;
|
||||
|
||||
// Starts the encode usage resource. The quality scaler resource is
|
||||
// automatically started on being configured.
|
||||
void StartEncodeUsageResource();
|
||||
void EnsureEncodeUsageResourceStarted();
|
||||
// Stops the encode usage and quality scaler resources if not already stopped.
|
||||
void StopManagedResources();
|
||||
|
||||
|
||||
@ -841,8 +841,7 @@ void VideoStreamEncoder::ReconfigureEncoder() {
|
||||
// We may be able to change this to "EnsureStarted()" if it took care of
|
||||
// reconfiguring the QualityScaler as well. (ConfigureQualityScaler() is
|
||||
// invoked later in this method.)
|
||||
stream_resource_manager_.StopManagedResources();
|
||||
stream_resource_manager_.StartEncodeUsageResource();
|
||||
stream_resource_manager_.EnsureEncodeUsageResourceStarted();
|
||||
pending_encoder_creation_ = false;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user