Revert "Move creating encoder to VideoStreamEncoder."
This reverts commit fb82fcc7f9c414dc8ba1ddd314e9524fee54cb80. Reason for revert: Appears to break Chromium, see https://ci.chromium.org/buildbot/chromium.webrtc.fyi/Linux%20Tester/43756, where remoting_unittests failed. Original change's description: > Move creating encoder to VideoStreamEncoder. > > This used to be in WebRtcVideoChannel::WebRtcVideoSendStream. > One implication is that encoder is not created until the first > frame arrives, and some of the tests needed updates to emit a > frame or two. > > Bug: webrtc:8830 > Change-Id: I78169b2bb4dfa4197b4b4229af9fd69d0f747835 > Reviewed-on: https://webrtc-review.googlesource.com/64885 > Commit-Queue: Niels Moller <nisse@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22905} TBR=magjed@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,sprang@webrtc.org,stefan@webrtc.org Change-Id: I47ee3ac42e62472d825a08c98e28f9ae53ec9fff No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8830 Reviewed-on: https://webrtc-review.googlesource.com/70600 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22914}
This commit is contained in:
@ -21,7 +21,6 @@
|
||||
#include "rtc_base/logging.h"
|
||||
#include "system_wrappers/include/metrics_default.h"
|
||||
#include "system_wrappers/include/sleep.h"
|
||||
#include "test/encoder_proxy_factory.h"
|
||||
#include "test/encoder_settings.h"
|
||||
#include "test/fake_encoder.h"
|
||||
#include "test/frame_generator.h"
|
||||
@ -84,8 +83,6 @@ class CpuOveruseDetectorProxy : public OveruseFrameDetector {
|
||||
return last_target_framerate_fps_;
|
||||
}
|
||||
|
||||
CpuOveruseOptions GetOptions() { return options_; }
|
||||
|
||||
private:
|
||||
rtc::CriticalSection lock_;
|
||||
int last_target_framerate_fps_ RTC_GUARDED_BY(lock_);
|
||||
@ -275,7 +272,6 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
codec_height_(240),
|
||||
max_framerate_(30),
|
||||
fake_encoder_(),
|
||||
encoder_factory_(&fake_encoder_),
|
||||
stats_proxy_(new MockableSendStatisticsProxy(
|
||||
Clock::GetRealTimeClock(),
|
||||
video_send_config_,
|
||||
@ -285,7 +281,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
metrics::Reset();
|
||||
video_send_config_ = VideoSendStream::Config(nullptr);
|
||||
video_send_config_.encoder_settings.encoder_factory = &encoder_factory_;
|
||||
video_send_config_.encoder_settings.encoder = &fake_encoder_;
|
||||
video_send_config_.rtp.payload_name = "FAKE";
|
||||
video_send_config_.rtp.payload_type = 125;
|
||||
|
||||
@ -687,7 +683,6 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
int codec_height_;
|
||||
int max_framerate_;
|
||||
TestEncoder fake_encoder_;
|
||||
test::EncoderProxyFactory encoder_factory_;
|
||||
std::unique_ptr<MockableSendStatisticsProxy> stats_proxy_;
|
||||
TestSink sink_;
|
||||
AdaptingFrameForwarder video_source_;
|
||||
@ -1442,16 +1437,11 @@ TEST_F(VideoStreamEncoderTest,
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Leave source unchanged, but disable quality scaler.
|
||||
// Set source with adaptation still enabled but quality scaler is off.
|
||||
fake_encoder_.SetQualityScaling(false);
|
||||
|
||||
VideoEncoderConfig video_encoder_config;
|
||||
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
||||
// Make format different, to force recreation of encoder.
|
||||
video_encoder_config.video_format.parameters["foo"] = "foo";
|
||||
video_stream_encoder_->ConfigureEncoder(std::move(video_encoder_config),
|
||||
kMaxPayloadLength,
|
||||
true /* nack_enabled */);
|
||||
video_stream_encoder_->SetSource(
|
||||
&video_source_,
|
||||
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
||||
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight));
|
||||
WaitForEncodedFrame(4);
|
||||
@ -2526,14 +2516,6 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropOffWhenEncoderDisabledScaling) {
|
||||
const int kWidth = 640;
|
||||
const int kHeight = 360;
|
||||
fake_encoder_.SetQualityScaling(false);
|
||||
|
||||
VideoEncoderConfig video_encoder_config;
|
||||
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
||||
// Make format different, to force recreation of encoder.
|
||||
video_encoder_config.video_format.parameters["foo"] = "foo";
|
||||
video_stream_encoder_->ConfigureEncoder(std::move(video_encoder_config),
|
||||
kMaxPayloadLength,
|
||||
true /* nack_enabled */);
|
||||
video_stream_encoder_->OnBitrateUpdated(kLowTargetBitrateBps, 0, 0);
|
||||
|
||||
// Force quality scaler reconfiguration by resetting the source.
|
||||
@ -3332,44 +3314,4 @@ TEST_F(VideoStreamEncoderTest, DoesNotUpdateBitrateAllocationWhenSuspended) {
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
|
||||
TEST_F(VideoStreamEncoderTest,
|
||||
DefaultCpuAdaptationThresholdsForSoftwareEncoder) {
|
||||
const int kFrameWidth = 1280;
|
||||
const int kFrameHeight = 720;
|
||||
const CpuOveruseOptions default_options;
|
||||
video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(1, kFrameWidth, kFrameHeight));
|
||||
WaitForEncodedFrame(1);
|
||||
EXPECT_EQ(video_stream_encoder_->overuse_detector_proxy_->GetOptions()
|
||||
.low_encode_usage_threshold_percent,
|
||||
default_options.low_encode_usage_threshold_percent);
|
||||
EXPECT_EQ(video_stream_encoder_->overuse_detector_proxy_->GetOptions()
|
||||
.high_encode_usage_threshold_percent,
|
||||
default_options.high_encode_usage_threshold_percent);
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
|
||||
TEST_F(VideoStreamEncoderTest,
|
||||
HigherCpuAdaptationThresholdsForHardwareEncoder) {
|
||||
const int kFrameWidth = 1280;
|
||||
const int kFrameHeight = 720;
|
||||
CpuOveruseOptions hardware_options;
|
||||
hardware_options.low_encode_usage_threshold_percent = 150;
|
||||
hardware_options.high_encode_usage_threshold_percent = 200;
|
||||
encoder_factory_.SetIsHardwareAccelerated(true);
|
||||
|
||||
video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(1, kFrameWidth, kFrameHeight));
|
||||
WaitForEncodedFrame(1);
|
||||
EXPECT_EQ(video_stream_encoder_->overuse_detector_proxy_->GetOptions()
|
||||
.low_encode_usage_threshold_percent,
|
||||
hardware_options.low_encode_usage_threshold_percent);
|
||||
EXPECT_EQ(video_stream_encoder_->overuse_detector_proxy_->GetOptions()
|
||||
.high_encode_usage_threshold_percent,
|
||||
hardware_options.high_encode_usage_threshold_percent);
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user