Revert "Add ability to specify if rate controller of video encoder is trusted."
This reverts commit 3e335d1423cab06cca8cdb4f1fadb0b16c9e7d38. Reason for revert: breaks downstream project Original change's description: > Add ability to specify if rate controller of video encoder is trusted. > > If rate controller is trusted, we disable the frame dropper in the > media optimization module. > > Bug: webrtc:9722 > Change-Id: I821f21fd74a400ee9d5aa3f6b42d4e569033acbe > Reviewed-on: https://webrtc-review.googlesource.com/c/105020 > Commit-Queue: Erik Språng <sprang@webrtc.org> > Reviewed-by: Per Kjellander <perkj@webrtc.org> > Reviewed-by: Niels Moller <nisse@webrtc.org> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#25107} TBR=brandtr@webrtc.org,ilnik@webrtc.org,nisse@webrtc.org,sprang@webrtc.org,perkj@webrtc.org Change-Id: Ifdb0aae684894854a184ec1e7423a7c62e7ba237 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:9722 Reviewed-on: https://webrtc-review.googlesource.com/c/105360 Commit-Queue: Oleh Prypin <oprypin@webrtc.org> Reviewed-by: Oleh Prypin <oprypin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25117}
This commit is contained in:
@ -21,7 +21,6 @@ if (rtc_include_tests) {
|
||||
"..:builtin_video_encoder_factory",
|
||||
"..:rtc_software_fallback_wrappers",
|
||||
"..:video_codecs_api",
|
||||
"../../../api:mock_video_encoder",
|
||||
"../../../modules/video_coding:video_codec_interface",
|
||||
"../../../modules/video_coding:video_coding_utility",
|
||||
"../../../modules/video_coding:webrtc_vp8",
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "api/test/mock_video_encoder.h"
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
@ -23,12 +22,9 @@
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/fakeclock.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
using ::testing::Return;
|
||||
|
||||
namespace {
|
||||
const int kWidth = 320;
|
||||
const int kHeight = 240;
|
||||
@ -533,88 +529,4 @@ TEST_F(ForcedFallbackTestEnabled, ScalingDisabledIfResizeOff) {
|
||||
EXPECT_FALSE(settings.thresholds.has_value());
|
||||
}
|
||||
|
||||
TEST(SoftwareFallbackEncoderTest, BothRateControllersNotTrusted) {
|
||||
auto* sw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
auto* hw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
EXPECT_CALL(*sw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(false));
|
||||
EXPECT_CALL(*hw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(false));
|
||||
|
||||
std::unique_ptr<VideoEncoder> wrapper =
|
||||
CreateVideoEncoderSoftwareFallbackWrapper(
|
||||
std::unique_ptr<VideoEncoder>(sw_encoder),
|
||||
std::unique_ptr<VideoEncoder>(hw_encoder));
|
||||
EXPECT_FALSE(wrapper->HasTrustedRateController());
|
||||
}
|
||||
|
||||
TEST(SoftwareFallbackEncoderTest, SwRateControllerTrusted) {
|
||||
auto* sw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
auto* hw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
EXPECT_CALL(*sw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(*hw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(false));
|
||||
|
||||
std::unique_ptr<VideoEncoder> wrapper =
|
||||
CreateVideoEncoderSoftwareFallbackWrapper(
|
||||
std::unique_ptr<VideoEncoder>(sw_encoder),
|
||||
std::unique_ptr<VideoEncoder>(hw_encoder));
|
||||
EXPECT_FALSE(wrapper->HasTrustedRateController());
|
||||
}
|
||||
|
||||
TEST(SoftwareFallbackEncoderTest, SwRateControllerTrustedNoHw) {
|
||||
auto* sw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
EXPECT_CALL(*sw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(true));
|
||||
|
||||
std::unique_ptr<VideoEncoder> wrapper =
|
||||
CreateVideoEncoderSoftwareFallbackWrapper(
|
||||
std::unique_ptr<VideoEncoder>(sw_encoder),
|
||||
std::unique_ptr<VideoEncoder>());
|
||||
EXPECT_TRUE(wrapper->HasTrustedRateController());
|
||||
}
|
||||
|
||||
TEST(SoftwareFallbackEncoderTest, HwRateControllerTrusted) {
|
||||
auto* sw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
auto* hw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
EXPECT_CALL(*sw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(false));
|
||||
EXPECT_CALL(*hw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(true));
|
||||
|
||||
std::unique_ptr<VideoEncoder> wrapper =
|
||||
CreateVideoEncoderSoftwareFallbackWrapper(
|
||||
std::unique_ptr<VideoEncoder>(sw_encoder),
|
||||
std::unique_ptr<VideoEncoder>(hw_encoder));
|
||||
EXPECT_FALSE(wrapper->HasTrustedRateController());
|
||||
}
|
||||
|
||||
TEST(SoftwareFallbackEncoderTest, HwRateControllerTrustedNoSw) {
|
||||
auto* hw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
EXPECT_CALL(*hw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(true));
|
||||
|
||||
std::unique_ptr<VideoEncoder> wrapper =
|
||||
CreateVideoEncoderSoftwareFallbackWrapper(
|
||||
std::unique_ptr<VideoEncoder>(),
|
||||
std::unique_ptr<VideoEncoder>(hw_encoder));
|
||||
EXPECT_TRUE(wrapper->HasTrustedRateController());
|
||||
}
|
||||
|
||||
TEST(SoftwareFallbackEncoderTest, BothRateControllersTrusted) {
|
||||
auto* sw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
auto* hw_encoder = new testing::NiceMock<MockVideoEncoder>();
|
||||
EXPECT_CALL(*sw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(*hw_encoder, HasTrustedRateController())
|
||||
.WillRepeatedly(Return(true));
|
||||
|
||||
std::unique_ptr<VideoEncoder> wrapper =
|
||||
CreateVideoEncoderSoftwareFallbackWrapper(
|
||||
std::unique_ptr<VideoEncoder>(sw_encoder),
|
||||
std::unique_ptr<VideoEncoder>(hw_encoder));
|
||||
EXPECT_TRUE(wrapper->HasTrustedRateController());
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -101,8 +101,4 @@ bool VideoEncoder::SupportsNativeHandle() const {
|
||||
const char* VideoEncoder::ImplementationName() const {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
bool VideoEncoder::HasTrustedRateController() const {
|
||||
return false;
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
||||
@ -202,21 +202,6 @@ class VideoEncoder {
|
||||
|
||||
virtual bool SupportsNativeHandle() const;
|
||||
virtual const char* ImplementationName() const;
|
||||
|
||||
// If this method returns true, the encoder rate controller must perform well
|
||||
// even in difficult situations, and produce close to the specified target
|
||||
// bitrate seen over a reasonable time window, drop frames if necessary in
|
||||
// order to keep the rate correct, and react quickly to changing bitrate
|
||||
// targets.
|
||||
// If this method returns true, we disable the frame dropper in the media
|
||||
// optimization module and rely entirely on the encoder to produce media at a
|
||||
// bitrate that closely matches the target. Any overshooting may result in
|
||||
// delay buildup.
|
||||
// If this method returns false (default behavior), the media opt frame
|
||||
// dropper will drop input frames if it suspect encoder misbehavior.
|
||||
// Misbehavior is common, especially in hardware codecs. Disable media opt at
|
||||
// your own risk.
|
||||
virtual bool HasTrustedRateController() const;
|
||||
};
|
||||
} // namespace webrtc
|
||||
#endif // API_VIDEO_CODECS_VIDEO_ENCODER_H_
|
||||
|
||||
@ -93,7 +93,6 @@ class VideoEncoderSoftwareFallbackWrapper final : public VideoEncoder {
|
||||
bool SupportsNativeHandle() const override;
|
||||
ScalingSettings GetScalingSettings() const override;
|
||||
const char* ImplementationName() const override;
|
||||
bool HasTrustedRateController() const override;
|
||||
|
||||
private:
|
||||
bool InitFallbackEncoder();
|
||||
@ -143,8 +142,6 @@ class VideoEncoderSoftwareFallbackWrapper final : public VideoEncoder {
|
||||
|
||||
bool forced_fallback_possible_;
|
||||
ForcedFallbackParams forced_fallback_;
|
||||
|
||||
const bool trust_rate_controller_;
|
||||
};
|
||||
|
||||
VideoEncoderSoftwareFallbackWrapper::VideoEncoderSoftwareFallbackWrapper(
|
||||
@ -161,11 +158,7 @@ VideoEncoderSoftwareFallbackWrapper::VideoEncoderSoftwareFallbackWrapper(
|
||||
encoder_(std::move(hw_encoder)),
|
||||
fallback_encoder_(std::move(sw_encoder)),
|
||||
callback_(nullptr),
|
||||
forced_fallback_possible_(EnableForcedFallback()),
|
||||
trust_rate_controller_(
|
||||
(encoder_ ? encoder_->HasTrustedRateController() : true) &&
|
||||
(fallback_encoder_ ? fallback_encoder_->HasTrustedRateController()
|
||||
: true)) {
|
||||
forced_fallback_possible_(EnableForcedFallback()) {
|
||||
if (forced_fallback_possible_) {
|
||||
GetForcedFallbackParamsFromFieldTrialGroup(
|
||||
&forced_fallback_.min_pixels_, &forced_fallback_.max_pixels_,
|
||||
@ -326,10 +319,6 @@ const char* VideoEncoderSoftwareFallbackWrapper::ImplementationName() const {
|
||||
: encoder_->ImplementationName();
|
||||
}
|
||||
|
||||
bool VideoEncoderSoftwareFallbackWrapper::HasTrustedRateController() const {
|
||||
return trust_rate_controller_;
|
||||
}
|
||||
|
||||
bool VideoEncoderSoftwareFallbackWrapper::IsForcedFallbackActive() const {
|
||||
return (forced_fallback_possible_ && use_fallback_encoder_ &&
|
||||
forced_fallback_.active_);
|
||||
|
||||
Reference in New Issue
Block a user