[Adaptation] Delete AdaptationListener
It was not used by any class and all future uses can use the VideoSourceRestrictionsListener. Bug: webrtc:11834 Change-Id: I5c71b93cc503f458dce0ccdd78b91b5a1debc56d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181062 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@google.com> Cr-Commit-Position: refs/heads/master@{#31896}
This commit is contained in:
parent
a1c77f6d0d
commit
b9c1654cc7
@ -12,8 +12,6 @@ rtc_library("resource_adaptation") {
|
||||
sources = [
|
||||
"adaptation_constraint.cc",
|
||||
"adaptation_constraint.h",
|
||||
"adaptation_listener.cc",
|
||||
"adaptation_listener.h",
|
||||
"broadcast_resource_listener.cc",
|
||||
"broadcast_resource_listener.h",
|
||||
"degradation_preference_provider.cc",
|
||||
@ -98,8 +96,6 @@ if (rtc_include_tests) {
|
||||
sources = [
|
||||
"test/fake_adaptation_constraint.cc",
|
||||
"test/fake_adaptation_constraint.h",
|
||||
"test/fake_adaptation_listener.cc",
|
||||
"test/fake_adaptation_listener.h",
|
||||
"test/fake_frame_rate_provider.cc",
|
||||
"test/fake_frame_rate_provider.h",
|
||||
"test/fake_resource.cc",
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 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/adaptation_listener.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
AdaptationListener::~AdaptationListener() {}
|
||||
|
||||
} // namespace webrtc
|
||||
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 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.
|
||||
*/
|
||||
|
||||
#ifndef CALL_ADAPTATION_ADAPTATION_LISTENER_H_
|
||||
#define CALL_ADAPTATION_ADAPTATION_LISTENER_H_
|
||||
|
||||
#include "api/adaptation/resource.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "call/adaptation/video_source_restrictions.h"
|
||||
#include "call/adaptation/video_stream_input_state.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// TODO(hbos): Can this be consolidated with
|
||||
// ResourceAdaptationProcessorListener::OnVideoSourceRestrictionsUpdated()? Both
|
||||
// listen to adaptations being applied, but on different layers with different
|
||||
// arguments.
|
||||
class AdaptationListener {
|
||||
public:
|
||||
virtual ~AdaptationListener();
|
||||
|
||||
// TODO(https://crbug.com/webrtc/11172): When we have multi-stream adaptation
|
||||
// support, this interface needs to indicate which stream the adaptation
|
||||
// applies to.
|
||||
virtual void OnAdaptationApplied(
|
||||
const VideoStreamInputState& input_state,
|
||||
const VideoSourceRestrictions& restrictions_before,
|
||||
const VideoSourceRestrictions& restrictions_after,
|
||||
rtc::scoped_refptr<Resource> reason_resource) = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // CALL_ADAPTATION_ADAPTATION_LISTENER_H_
|
||||
@ -22,7 +22,6 @@
|
||||
#include "api/video/video_adaptation_counters.h"
|
||||
#include "api/video/video_frame.h"
|
||||
#include "call/adaptation/adaptation_constraint.h"
|
||||
#include "call/adaptation/adaptation_listener.h"
|
||||
#include "call/adaptation/encoder_settings.h"
|
||||
#include "call/adaptation/video_source_restrictions.h"
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/video/video_adaptation_counters.h"
|
||||
#include "call/adaptation/resource_adaptation_processor_interface.h"
|
||||
#include "call/adaptation/test/fake_adaptation_listener.h"
|
||||
#include "call/adaptation/test/fake_frame_rate_provider.h"
|
||||
#include "call/adaptation/test/fake_resource.h"
|
||||
#include "call/adaptation/video_source_restrictions.h"
|
||||
@ -89,7 +88,6 @@ class ResourceAdaptationProcessorTest : public ::testing::Test {
|
||||
input_state_provider_(&frame_rate_provider_),
|
||||
resource_(FakeResource::Create("FakeResource")),
|
||||
other_resource_(FakeResource::Create("OtherFakeResource")),
|
||||
adaptation_listener_(),
|
||||
video_stream_adapter_(
|
||||
std::make_unique<VideoStreamAdapter>(&input_state_provider_)),
|
||||
processor_(std::make_unique<ResourceAdaptationProcessor>(
|
||||
@ -99,7 +97,6 @@ class ResourceAdaptationProcessorTest : public ::testing::Test {
|
||||
video_stream_adapter_->AddRestrictionsListener(&restrictions_listener_);
|
||||
processor_->AddResource(resource_);
|
||||
processor_->AddResource(other_resource_);
|
||||
video_stream_adapter_->AddAdaptationListener(&adaptation_listener_);
|
||||
}
|
||||
~ResourceAdaptationProcessorTest() override {
|
||||
if (processor_) {
|
||||
@ -128,7 +125,6 @@ class ResourceAdaptationProcessorTest : public ::testing::Test {
|
||||
if (other_resource_) {
|
||||
processor_->RemoveResource(other_resource_);
|
||||
}
|
||||
video_stream_adapter_->RemoveAdaptationListener(&adaptation_listener_);
|
||||
video_stream_adapter_->RemoveRestrictionsListener(&restrictions_listener_);
|
||||
processor_.reset();
|
||||
}
|
||||
@ -142,7 +138,6 @@ class ResourceAdaptationProcessorTest : public ::testing::Test {
|
||||
VideoStreamInputStateProvider input_state_provider_;
|
||||
rtc::scoped_refptr<FakeResource> resource_;
|
||||
rtc::scoped_refptr<FakeResource> other_resource_;
|
||||
FakeAdaptationListener adaptation_listener_;
|
||||
std::unique_ptr<VideoStreamAdapter> video_stream_adapter_;
|
||||
std::unique_ptr<ResourceAdaptationProcessor> processor_;
|
||||
VideoSourceRestrictionsListenerForTesting restrictions_listener_;
|
||||
@ -404,14 +399,6 @@ TEST_F(ResourceAdaptationProcessorTest,
|
||||
EXPECT_EQ(last_total, restrictions_listener_.adaptation_counters().Total());
|
||||
}
|
||||
|
||||
TEST_F(ResourceAdaptationProcessorTest, AdaptingTriggersOnAdaptationApplied) {
|
||||
video_stream_adapter_->SetDegradationPreference(
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
SetInputStates(true, kDefaultFrameRate, kDefaultFrameSize);
|
||||
resource_->SetUsageState(ResourceUsageState::kOveruse);
|
||||
EXPECT_EQ(1u, adaptation_listener_.num_adaptations_applied());
|
||||
}
|
||||
|
||||
TEST_F(ResourceAdaptationProcessorTest,
|
||||
AdaptsDownWhenOtherResourceIsAlwaysUnderused) {
|
||||
video_stream_adapter_->SetDegradationPreference(
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 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/test/fake_adaptation_listener.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
FakeAdaptationListener::FakeAdaptationListener()
|
||||
: num_adaptations_applied_(0) {}
|
||||
|
||||
FakeAdaptationListener::~FakeAdaptationListener() {}
|
||||
|
||||
size_t FakeAdaptationListener::num_adaptations_applied() const {
|
||||
return num_adaptations_applied_;
|
||||
}
|
||||
|
||||
void FakeAdaptationListener::OnAdaptationApplied(
|
||||
const VideoStreamInputState& input_state,
|
||||
const VideoSourceRestrictions& restrictions_before,
|
||||
const VideoSourceRestrictions& restrictions_after,
|
||||
rtc::scoped_refptr<Resource> reason_resource) {
|
||||
++num_adaptations_applied_;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 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.
|
||||
*/
|
||||
|
||||
#ifndef CALL_ADAPTATION_TEST_FAKE_ADAPTATION_LISTENER_H_
|
||||
#define CALL_ADAPTATION_TEST_FAKE_ADAPTATION_LISTENER_H_
|
||||
|
||||
#include "call/adaptation/adaptation_listener.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class FakeAdaptationListener : public AdaptationListener {
|
||||
public:
|
||||
FakeAdaptationListener();
|
||||
~FakeAdaptationListener() override;
|
||||
|
||||
size_t num_adaptations_applied() const;
|
||||
|
||||
// AdaptationListener implementation.
|
||||
void OnAdaptationApplied(
|
||||
const VideoStreamInputState& input_state,
|
||||
const VideoSourceRestrictions& restrictions_before,
|
||||
const VideoSourceRestrictions& restrictions_after,
|
||||
rtc::scoped_refptr<Resource> reason_resource) override;
|
||||
|
||||
private:
|
||||
size_t num_adaptations_applied_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // CALL_ADAPTATION_TEST_FAKE_ADAPTATION_LISTENER_H_
|
||||
@ -213,9 +213,6 @@ VideoStreamAdapter::VideoStreamAdapter(
|
||||
}
|
||||
|
||||
VideoStreamAdapter::~VideoStreamAdapter() {
|
||||
RTC_DCHECK(adaptation_listeners_.empty())
|
||||
<< "There are listener(s) attached to a VideoStreamAdapter being "
|
||||
"destroyed.";
|
||||
RTC_DCHECK(adaptation_constraints_.empty())
|
||||
<< "There are constaint(s) attached to a VideoStreamAdapter being "
|
||||
"destroyed.";
|
||||
@ -261,24 +258,6 @@ void VideoStreamAdapter::RemoveRestrictionsListener(
|
||||
restrictions_listeners_.erase(it);
|
||||
}
|
||||
|
||||
void VideoStreamAdapter::AddAdaptationListener(
|
||||
AdaptationListener* adaptation_listener) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
RTC_DCHECK(std::find(adaptation_listeners_.begin(),
|
||||
adaptation_listeners_.end(),
|
||||
adaptation_listener) == adaptation_listeners_.end());
|
||||
adaptation_listeners_.push_back(adaptation_listener);
|
||||
}
|
||||
|
||||
void VideoStreamAdapter::RemoveAdaptationListener(
|
||||
AdaptationListener* adaptation_listener) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
auto it = std::find(adaptation_listeners_.begin(),
|
||||
adaptation_listeners_.end(), adaptation_listener);
|
||||
RTC_DCHECK(it != adaptation_listeners_.end());
|
||||
adaptation_listeners_.erase(it);
|
||||
}
|
||||
|
||||
void VideoStreamAdapter::AddAdaptationConstraint(
|
||||
AdaptationConstraint* adaptation_constraint) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
@ -705,11 +684,6 @@ void VideoStreamAdapter::BroadcastVideoRestrictionsUpdate(
|
||||
filtered, current_restrictions_.counters, resource,
|
||||
source_restrictions());
|
||||
}
|
||||
for (auto* adaptation_listener : adaptation_listeners_) {
|
||||
adaptation_listener->OnAdaptationApplied(
|
||||
input_state, last_video_source_restrictions_,
|
||||
current_restrictions_.restrictions, resource);
|
||||
}
|
||||
last_video_source_restrictions_ = current_restrictions_.restrictions;
|
||||
last_filtered_restrictions_ = filtered;
|
||||
}
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "api/video/video_adaptation_counters.h"
|
||||
#include "call/adaptation/adaptation_constraint.h"
|
||||
#include "call/adaptation/adaptation_listener.h"
|
||||
#include "call/adaptation/degradation_preference_provider.h"
|
||||
#include "call/adaptation/video_source_restrictions.h"
|
||||
#include "call/adaptation/video_stream_input_state.h"
|
||||
@ -139,8 +138,6 @@ class VideoStreamAdapter {
|
||||
VideoSourceRestrictionsListener* restrictions_listener);
|
||||
void RemoveRestrictionsListener(
|
||||
VideoSourceRestrictionsListener* restrictions_listener);
|
||||
void AddAdaptationListener(AdaptationListener* adaptation_listener);
|
||||
void RemoveAdaptationListener(AdaptationListener* adaptation_listener);
|
||||
void AddAdaptationConstraint(AdaptationConstraint* adaptation_constraint);
|
||||
void RemoveAdaptationConstraint(AdaptationConstraint* adaptation_constraint);
|
||||
|
||||
@ -263,8 +260,6 @@ class VideoStreamAdapter {
|
||||
|
||||
std::vector<VideoSourceRestrictionsListener*> restrictions_listeners_
|
||||
RTC_GUARDED_BY(&sequence_checker_);
|
||||
std::vector<AdaptationListener*> adaptation_listeners_
|
||||
RTC_GUARDED_BY(&sequence_checker_);
|
||||
std::vector<AdaptationConstraint*> adaptation_constraints_
|
||||
RTC_GUARDED_BY(&sequence_checker_);
|
||||
|
||||
|
||||
@ -20,9 +20,7 @@
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "api/video_codecs/video_encoder_config.h"
|
||||
#include "call/adaptation/adaptation_constraint.h"
|
||||
#include "call/adaptation/adaptation_listener.h"
|
||||
#include "call/adaptation/encoder_settings.h"
|
||||
#include "call/adaptation/test/fake_adaptation_listener.h"
|
||||
#include "call/adaptation/test/fake_resource.h"
|
||||
#include "call/adaptation/video_source_restrictions.h"
|
||||
#include "call/adaptation/video_stream_input_state.h"
|
||||
@ -155,17 +153,6 @@ class FakeVideoStreamAdapterListner : public VideoSourceRestrictionsListener {
|
||||
VideoSourceRestrictions last_restrictions_;
|
||||
};
|
||||
|
||||
class MockAdaptationListener : public AdaptationListener {
|
||||
public:
|
||||
MOCK_METHOD(void,
|
||||
OnAdaptationApplied,
|
||||
(const VideoStreamInputState& input_state,
|
||||
const VideoSourceRestrictions& restrictions_before,
|
||||
const VideoSourceRestrictions& restrictions_after,
|
||||
rtc::scoped_refptr<Resource> reason_resource),
|
||||
(override));
|
||||
};
|
||||
|
||||
class MockAdaptationConstraint : public AdaptationConstraint {
|
||||
public:
|
||||
MOCK_METHOD(bool,
|
||||
@ -907,26 +894,6 @@ TEST_F(VideoStreamAdapterTest,
|
||||
adapter_.GetAdaptDownResolution().status());
|
||||
}
|
||||
|
||||
TEST_F(VideoStreamAdapterTest, AdaptationListenerReceivesSignalOnAdaptation) {
|
||||
testing::StrictMock<MockAdaptationListener> adaptation_listener;
|
||||
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
adapter_.AddAdaptationListener(&adaptation_listener);
|
||||
input_state_provider_.SetInputState(1280 * 720, 30,
|
||||
kDefaultMinPixelsPerFrame);
|
||||
VideoSourceRestrictions restrictions_before;
|
||||
VideoSourceRestrictions restrictions_after;
|
||||
EXPECT_CALL(adaptation_listener, OnAdaptationApplied)
|
||||
.WillOnce(DoAll(SaveArg<1>(&restrictions_before),
|
||||
SaveArg<2>(&restrictions_after)));
|
||||
auto adaptation = adapter_.GetAdaptationDown();
|
||||
adapter_.ApplyAdaptation(adaptation, nullptr);
|
||||
EXPECT_EQ(VideoSourceRestrictions(), restrictions_before);
|
||||
EXPECT_EQ(adaptation.restrictions(), restrictions_after);
|
||||
|
||||
// Clean up.
|
||||
adapter_.RemoveAdaptationListener(&adaptation_listener);
|
||||
}
|
||||
|
||||
TEST_F(VideoStreamAdapterTest, AdaptationConstraintAllowsAdaptationsUp) {
|
||||
testing::StrictMock<MockAdaptationConstraint> adaptation_constraint;
|
||||
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/video/video_adaptation_reason.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "call/adaptation/adaptation_listener.h"
|
||||
#include "call/adaptation/degradation_preference_provider.h"
|
||||
#include "call/adaptation/resource_adaptation_processor_interface.h"
|
||||
#include "modules/video_coding/utility/quality_scaler.h"
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#include "api/adaptation/resource.h"
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "call/adaptation/adaptation_constraint.h"
|
||||
#include "call/adaptation/adaptation_listener.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
#include "rtc_base/synchronization/sequence_checker.h"
|
||||
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
#include "api/video_codecs/video_codec.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "call/adaptation/adaptation_constraint.h"
|
||||
#include "call/adaptation/adaptation_listener.h"
|
||||
#include "call/adaptation/resource_adaptation_processor.h"
|
||||
#include "call/adaptation/resource_adaptation_processor_interface.h"
|
||||
#include "call/adaptation/video_source_restrictions.h"
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
#include "api/video_codecs/vp8_temporal_layers.h"
|
||||
#include "api/video_codecs/vp8_temporal_layers_factory.h"
|
||||
#include "call/adaptation/test/fake_adaptation_constraint.h"
|
||||
#include "call/adaptation/test/fake_adaptation_listener.h"
|
||||
#include "call/adaptation/test/fake_resource.h"
|
||||
#include "common_video/h264/h264_common.h"
|
||||
#include "common_video/include/video_frame_buffer.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user