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:
@ -577,7 +577,6 @@ if (rtc_include_tests) {
|
||||
":video_coding",
|
||||
":video_coding_utility",
|
||||
"../../:webrtc_common",
|
||||
"../../api:mock_video_encoder",
|
||||
"../../api:simulcast_test_fixture_api",
|
||||
"../../api/video:encoded_image",
|
||||
"../../api/video:video_frame",
|
||||
@ -736,7 +735,6 @@ if (rtc_include_tests) {
|
||||
"../..:webrtc_common",
|
||||
"../../api:create_videocodec_test_fixture_api",
|
||||
"../../api:mock_video_codec_factory",
|
||||
"../../api:mock_video_encoder",
|
||||
"../../api:videocodec_test_fixture_api",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video:video_frame_i420",
|
||||
@ -855,7 +853,6 @@ if (rtc_include_tests) {
|
||||
"..:module_api",
|
||||
"../..:webrtc_common",
|
||||
"../../api:create_simulcast_test_fixture_api",
|
||||
"../../api:mock_video_encoder",
|
||||
"../../api:simulcast_test_fixture_api",
|
||||
"../../api:videocodec_test_fixture_api",
|
||||
"../../api/video:video_bitrate_allocator",
|
||||
|
@ -51,7 +51,6 @@ class MultiplexEncoderAdapter : public VideoEncoder {
|
||||
uint32_t new_framerate) override;
|
||||
int Release() override;
|
||||
const char* ImplementationName() const override;
|
||||
bool HasTrustedRateController() const override;
|
||||
|
||||
EncodedImageCallback::Result OnEncodedImage(
|
||||
AlphaCodecStream stream_idx,
|
||||
@ -82,8 +81,6 @@ class MultiplexEncoderAdapter : public VideoEncoder {
|
||||
|
||||
const bool supports_augmented_data_;
|
||||
int augmenting_data_size_ = 0;
|
||||
|
||||
bool has_trusted_rate_controllers_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -53,8 +53,7 @@ MultiplexEncoderAdapter::MultiplexEncoderAdapter(
|
||||
: factory_(factory),
|
||||
associated_format_(associated_format),
|
||||
encoded_complete_callback_(nullptr),
|
||||
supports_augmented_data_(supports_augmented_data),
|
||||
has_trusted_rate_controllers_(false) {}
|
||||
supports_augmented_data_(supports_augmented_data) {}
|
||||
|
||||
MultiplexEncoderAdapter::~MultiplexEncoderAdapter() {
|
||||
Release();
|
||||
@ -93,7 +92,6 @@ int MultiplexEncoderAdapter::InitEncode(const VideoCodec* inst,
|
||||
break;
|
||||
}
|
||||
|
||||
has_trusted_rate_controllers_ = true;
|
||||
for (size_t i = 0; i < kAlphaCodecStreams; ++i) {
|
||||
std::unique_ptr<VideoEncoder> encoder =
|
||||
factory_->CreateVideoEncoder(associated_format_);
|
||||
@ -103,7 +101,6 @@ int MultiplexEncoderAdapter::InitEncode(const VideoCodec* inst,
|
||||
RTC_LOG(LS_ERROR) << "Failed to create multiplex codec index " << i;
|
||||
return rv;
|
||||
}
|
||||
has_trusted_rate_controllers_ &= encoder->HasTrustedRateController();
|
||||
adapter_callbacks_.emplace_back(new AdapterEncodedImageCallback(
|
||||
this, static_cast<AlphaCodecStream>(i)));
|
||||
encoder->RegisterEncodeCompleteCallback(adapter_callbacks_.back().get());
|
||||
@ -245,10 +242,6 @@ const char* MultiplexEncoderAdapter::ImplementationName() const {
|
||||
return "MultiplexEncoderAdapter";
|
||||
}
|
||||
|
||||
bool MultiplexEncoderAdapter::HasTrustedRateController() const {
|
||||
return has_trusted_rate_controllers_;
|
||||
}
|
||||
|
||||
EncodedImageCallback::Result MultiplexEncoderAdapter::OnEncodedImage(
|
||||
AlphaCodecStream stream_idx,
|
||||
const EncodedImage& encodedImage,
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/test/mock_video_encoder.h"
|
||||
#include "api/test/videocodec_test_fixture.h"
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
|
@ -28,8 +28,6 @@
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
const char kVp8GfBoostFieldTrial[] = "WebRTC-VP8-GfBoost";
|
||||
const char kVp8TrustedRateControllerFieldTrial[] =
|
||||
"WebRTC-Vp8TrustedRateController";
|
||||
|
||||
// QP is obtained from VP8-bitstream for HW, so the QP corresponds to the
|
||||
// bitstream range of [0, 127] and not the user-level range of [0,63].
|
||||
@ -160,8 +158,6 @@ LibvpxVp8Encoder::LibvpxVp8Encoder()
|
||||
LibvpxVp8Encoder::LibvpxVp8Encoder(std::unique_ptr<LibvpxInterface> interface)
|
||||
: libvpx_(std::move(interface)),
|
||||
use_gf_boost_(webrtc::field_trial::IsEnabled(kVp8GfBoostFieldTrial)),
|
||||
trusted_rate_controller_(
|
||||
webrtc::field_trial::IsEnabled(kVp8TrustedRateControllerFieldTrial)),
|
||||
encoded_complete_callback_(nullptr),
|
||||
inited_(false),
|
||||
timestamp_(0),
|
||||
@ -286,10 +282,6 @@ const char* LibvpxVp8Encoder::ImplementationName() const {
|
||||
return "libvpx";
|
||||
}
|
||||
|
||||
bool LibvpxVp8Encoder::HasTrustedRateController() const {
|
||||
return trusted_rate_controller_;
|
||||
}
|
||||
|
||||
void LibvpxVp8Encoder::SetStreamState(bool send_stream, int stream_idx) {
|
||||
if (send_stream && !send_stream_[stream_idx]) {
|
||||
// Need a key frame if we have not sent this stream before.
|
||||
|
@ -56,8 +56,6 @@ class LibvpxVp8Encoder : public VideoEncoder {
|
||||
|
||||
const char* ImplementationName() const override;
|
||||
|
||||
bool HasTrustedRateController() const override;
|
||||
|
||||
static vpx_enc_frame_flags_t EncodeFlags(
|
||||
const TemporalLayers::FrameConfig& references);
|
||||
|
||||
@ -90,7 +88,6 @@ class LibvpxVp8Encoder : public VideoEncoder {
|
||||
|
||||
const std::unique_ptr<LibvpxInterface> libvpx_;
|
||||
const bool use_gf_boost_;
|
||||
const bool trusted_rate_controller_;
|
||||
|
||||
EncodedImageCallback* encoded_complete_callback_;
|
||||
VideoCodec codec_;
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "api/test/mock_video_encoder.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/video_coding/codecs/test/video_codec_unittest.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
|
@ -169,11 +169,6 @@ bool VCMGenericEncoder::SupportsNativeHandle() const {
|
||||
return encoder_->SupportsNativeHandle();
|
||||
}
|
||||
|
||||
bool VCMGenericEncoder::HasTrustedRateController() const {
|
||||
RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
|
||||
return encoder_->HasTrustedRateController();
|
||||
}
|
||||
|
||||
VCMEncodedFrameCallback::VCMEncodedFrameCallback(
|
||||
EncodedImageCallback* post_encode_callback,
|
||||
media_optimization::MediaOptimization* media_opt)
|
||||
|
@ -147,7 +147,6 @@ class VCMGenericEncoder {
|
||||
int32_t RequestFrame(const std::vector<FrameType>& frame_types);
|
||||
bool InternalSource() const;
|
||||
bool SupportsNativeHandle() const;
|
||||
bool HasTrustedRateController() const;
|
||||
|
||||
private:
|
||||
rtc::RaceChecker race_checker_;
|
||||
|
@ -19,6 +19,36 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockEncodedImageCallback : public EncodedImageCallback {
|
||||
public:
|
||||
MOCK_METHOD3(OnEncodedImage,
|
||||
Result(const EncodedImage& encodedImage,
|
||||
const CodecSpecificInfo* codecSpecificInfo,
|
||||
const RTPFragmentationHeader* fragmentation));
|
||||
};
|
||||
|
||||
class MockVideoEncoder : public VideoEncoder {
|
||||
public:
|
||||
MOCK_CONST_METHOD2(Version, int32_t(int8_t* version, int32_t length));
|
||||
MOCK_METHOD3(InitEncode,
|
||||
int32_t(const VideoCodec* codecSettings,
|
||||
int32_t numberOfCores,
|
||||
size_t maxPayloadSize));
|
||||
MOCK_METHOD3(Encode,
|
||||
int32_t(const VideoFrame& inputImage,
|
||||
const CodecSpecificInfo* codecSpecificInfo,
|
||||
const std::vector<FrameType>* frame_types));
|
||||
MOCK_METHOD1(RegisterEncodeCompleteCallback,
|
||||
int32_t(EncodedImageCallback* callback));
|
||||
MOCK_METHOD0(Release, int32_t());
|
||||
MOCK_METHOD0(Reset, int32_t());
|
||||
MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int64_t rtt));
|
||||
MOCK_METHOD2(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate));
|
||||
MOCK_METHOD2(SetRateAllocation,
|
||||
int32_t(const VideoBitrateAllocation& newBitRate,
|
||||
uint32_t frameRate));
|
||||
};
|
||||
|
||||
class MockDecodedImageCallback : public DecodedImageCallback {
|
||||
public:
|
||||
MOCK_METHOD1(Decoded, int32_t(VideoFrame& decodedImage)); // NOLINT
|
||||
|
@ -14,15 +14,14 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "api/test/mock_video_encoder.h"
|
||||
#include "api/test/simulcast_test_fixture.h"
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "api/video/video_frame.h"
|
||||
#include "api/video_codecs/video_decoder_factory.h"
|
||||
#include "api/video_codecs/video_encoder_factory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/video_coding/include/mock/mock_video_codec_interface.h"
|
||||
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
|
||||
#include "modules/video_coding/include/mock/mock_video_codec_interface.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
@ -96,15 +96,10 @@ int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec,
|
||||
numLayers = 1;
|
||||
}
|
||||
|
||||
// Disable frame dropper if either:
|
||||
// * We have screensharing with layers.
|
||||
// * "WebRTC-FrameDropper" field trial is "Disabled".
|
||||
// * Encoder has a trusted rate controller.
|
||||
// If we have screensharing and we have layers, we disable frame dropper.
|
||||
const bool disable_frame_dropper =
|
||||
field_trial::IsDisabled(kFrameDropperFieldTrial) ||
|
||||
(numLayers > 1 && sendCodec->mode == VideoCodecMode::kScreensharing) ||
|
||||
_encoder->HasTrustedRateController();
|
||||
|
||||
(numLayers > 1 && sendCodec->mode == VideoCodecMode::kScreensharing);
|
||||
if (disable_frame_dropper) {
|
||||
_mediaOpt.EnableFrameDropper(false);
|
||||
} else if (frame_dropper_enabled_) {
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "api/test/mock_video_encoder.h"
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8_temporal_layers.h"
|
||||
@ -393,17 +392,6 @@ TEST_F(TestVideoSenderWithMockEncoder,
|
||||
AddFrame();
|
||||
}
|
||||
|
||||
TEST_F(TestVideoSenderWithMockEncoder, ChecksTrustedRateController) {
|
||||
// Checks that encoder is asked if rate controller is trusted.
|
||||
EXPECT_CALL(encoder_, HasTrustedRateController())
|
||||
.Times(1)
|
||||
.WillOnce(Return(true));
|
||||
|
||||
VideoCodec codec;
|
||||
webrtc::test::CodecSettings(kVideoCodecVP8, &codec);
|
||||
EXPECT_EQ(0, sender_->RegisterSendCodec(&codec, 1, 1200));
|
||||
}
|
||||
|
||||
class TestVideoSenderWithVp8 : public TestVideoSender {
|
||||
public:
|
||||
TestVideoSenderWithVp8()
|
||||
|
Reference in New Issue
Block a user