Remove task_queue dependency for QualityScaler
This allows for the possiblity to move the QualityScaler out of the VideoStreamEncoder in the future. Bug: webrtc:11222 Change-Id: I1d563cf08791e27ff5065ce90bcb150a7974d868 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167534 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@google.com> Cr-Commit-Position: refs/heads/master@{#30406}
This commit is contained in:
committed by
Commit Bot
parent
182c2b8334
commit
73a5e916a9
@ -68,14 +68,12 @@ class QualityScaler::QpSmoother {
|
||||
rtc::ExpFilter smoother_;
|
||||
};
|
||||
|
||||
QualityScaler::QualityScaler(rtc::TaskQueue* task_queue,
|
||||
AdaptationObserverInterface* observer,
|
||||
QualityScaler::QualityScaler(AdaptationObserverInterface* observer,
|
||||
VideoEncoder::QpThresholds thresholds)
|
||||
: QualityScaler(task_queue, observer, thresholds, kMeasureMs) {}
|
||||
: QualityScaler(observer, thresholds, kMeasureMs) {}
|
||||
|
||||
// Protected ctor, should not be called directly.
|
||||
QualityScaler::QualityScaler(rtc::TaskQueue* task_queue,
|
||||
AdaptationObserverInterface* observer,
|
||||
QualityScaler::QualityScaler(AdaptationObserverInterface* observer,
|
||||
VideoEncoder::QpThresholds thresholds,
|
||||
int64_t sampling_period_ms)
|
||||
: observer_(observer),
|
||||
@ -106,7 +104,7 @@ QualityScaler::QualityScaler(rtc::TaskQueue* task_queue,
|
||||
}
|
||||
RTC_DCHECK(observer_ != nullptr);
|
||||
check_qp_task_ = RepeatingTaskHandle::DelayedStart(
|
||||
task_queue->Get(), TimeDelta::ms(GetSamplingPeriodMs()), [this]() {
|
||||
TaskQueueBase::Current(), TimeDelta::ms(GetSamplingPeriodMs()), [this]() {
|
||||
CheckQp();
|
||||
return TimeDelta::ms(GetSamplingPeriodMs());
|
||||
});
|
||||
|
||||
@ -53,8 +53,7 @@ class QualityScaler {
|
||||
// Construct a QualityScaler with given |thresholds| and |observer|.
|
||||
// This starts the quality scaler periodically checking what the average QP
|
||||
// has been recently.
|
||||
QualityScaler(rtc::TaskQueue* task_queue,
|
||||
AdaptationObserverInterface* observer,
|
||||
QualityScaler(AdaptationObserverInterface* observer,
|
||||
VideoEncoder::QpThresholds thresholds);
|
||||
virtual ~QualityScaler();
|
||||
// Should be called each time a frame is dropped at encoding.
|
||||
@ -68,8 +67,7 @@ class QualityScaler {
|
||||
|
||||
// The following members declared protected for testing purposes.
|
||||
protected:
|
||||
QualityScaler(rtc::TaskQueue* task_queue,
|
||||
AdaptationObserverInterface* observer,
|
||||
QualityScaler(AdaptationObserverInterface* observer,
|
||||
VideoEncoder::QpThresholds thresholds,
|
||||
int64_t sampling_period_ms);
|
||||
|
||||
|
||||
@ -50,10 +50,9 @@ class MockAdaptationObserver : public AdaptationObserverInterface {
|
||||
// Pass a lower sampling period to speed up the tests.
|
||||
class QualityScalerUnderTest : public QualityScaler {
|
||||
public:
|
||||
explicit QualityScalerUnderTest(rtc::TaskQueue* task_queue,
|
||||
AdaptationObserverInterface* observer,
|
||||
explicit QualityScalerUnderTest(AdaptationObserverInterface* observer,
|
||||
VideoEncoder::QpThresholds thresholds)
|
||||
: QualityScaler(task_queue, observer, thresholds, 5) {}
|
||||
: QualityScaler(observer, thresholds, 5) {}
|
||||
};
|
||||
|
||||
class QualityScalerTest : public ::testing::Test,
|
||||
@ -74,8 +73,7 @@ class QualityScalerTest : public ::testing::Test,
|
||||
task_queue_.SendTask(
|
||||
[this] {
|
||||
qs_ = std::unique_ptr<QualityScaler>(new QualityScalerUnderTest(
|
||||
&task_queue_, observer_.get(),
|
||||
VideoEncoder::QpThresholds(kLowQp, kHighQp)));
|
||||
observer_.get(), VideoEncoder::QpThresholds(kLowQp, kHighQp)));
|
||||
},
|
||||
RTC_FROM_HERE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user