Remove VideoEncoder::SetChannelParameters.

The SetChannelParameters function was used when WebRTC supported decoding
with errors, which we no longer do.

This cleanup CL is related to the work tracked by 9946.

Bug: webrtc:9946
Change-Id: Id2d5ed23031388f890c42651bfbe5f79eda701e5
Reviewed-on: https://webrtc-review.googlesource.com/c/108861
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25505}
This commit is contained in:
philipel 2018-11-05 17:30:22 +01:00 committed by Commit Bot
parent c22f551842
commit ee49f7087f
41 changed files with 11 additions and 193 deletions

View File

@ -45,7 +45,6 @@ class MockVideoEncoder : public VideoEncoder {
int32_t(EncodedImageCallback* callback)); int32_t(EncodedImageCallback* callback));
MOCK_METHOD0(Release, int32_t()); MOCK_METHOD0(Release, int32_t());
MOCK_METHOD0(Reset, 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(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate));
MOCK_METHOD2(SetRateAllocation, MOCK_METHOD2(SetRateAllocation,
int32_t(const VideoBitrateAllocation& newBitRate, int32_t(const VideoBitrateAllocation& newBitRate,

View File

@ -78,11 +78,6 @@ class VideoEncoderSoftwareFallbackWrapperTest : public ::testing::Test {
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override {
++set_channel_parameters_count_;
return WEBRTC_VIDEO_CODEC_OK;
}
int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation, int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate) override { uint32_t framerate) override {
++set_rates_count_; ++set_rates_count_;
@ -101,7 +96,6 @@ class VideoEncoderSoftwareFallbackWrapperTest : public ::testing::Test {
int encode_count_ = 0; int encode_count_ = 0;
EncodedImageCallback* encode_complete_callback_ = nullptr; EncodedImageCallback* encode_complete_callback_ = nullptr;
int release_count_ = 0; int release_count_ = 0;
int set_channel_parameters_count_ = 0;
int set_rates_count_ = 0; int set_rates_count_ = 0;
mutable int supports_native_handle_count_ = 0; mutable int supports_native_handle_count_ = 0;
bool supports_native_handle_ = false; bool supports_native_handle_ = false;
@ -262,15 +256,6 @@ TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_->Release()); EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_->Release());
} }
TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
SetChannelParametersForwardedDuringFallback) {
UtilizeFallbackEncoder();
EXPECT_EQ(0, fake_encoder_->set_channel_parameters_count_);
fallback_wrapper_->SetChannelParameters(1, 1);
EXPECT_EQ(1, fake_encoder_->set_channel_parameters_count_);
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_->Release());
}
TEST_F(VideoEncoderSoftwareFallbackWrapperTest, TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
SetRatesForwardedDuringFallback) { SetRatesForwardedDuringFallback) {
UtilizeFallbackEncoder(); UtilizeFallbackEncoder();

View File

@ -124,4 +124,8 @@ VideoEncoder::EncoderInfo VideoEncoder::GetEncoderInfo() const {
return EncoderInfo(GetScalingSettings(), SupportsNativeHandle(), return EncoderInfo(GetScalingSettings(), SupportsNativeHandle(),
ImplementationName()); ImplementationName());
} }
int32_t VideoEncoder::SetChannelParameters(uint32_t packet_loss, int64_t rtt) {
return 0;
}
} // namespace webrtc } // namespace webrtc

View File

@ -203,7 +203,7 @@ class RTC_EXPORT VideoEncoder {
// - rtt : Round-trip time in milliseconds // - rtt : Round-trip time in milliseconds
// Return value : WEBRTC_VIDEO_CODEC_OK if OK // Return value : WEBRTC_VIDEO_CODEC_OK if OK
// <0 - Errors: WEBRTC_VIDEO_CODEC_ERROR // <0 - Errors: WEBRTC_VIDEO_CODEC_ERROR
virtual int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) = 0; virtual int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt);
// Inform the encoder about the new target bit rate. // Inform the encoder about the new target bit rate.
// //

View File

@ -87,7 +87,6 @@ class VideoEncoderSoftwareFallbackWrapper final : public VideoEncoder {
int32_t Encode(const VideoFrame& frame, int32_t Encode(const VideoFrame& frame,
const CodecSpecificInfo* codec_specific_info, const CodecSpecificInfo* codec_specific_info,
const std::vector<FrameType>* frame_types) override; const std::vector<FrameType>* frame_types) override;
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation, int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate) override; uint32_t framerate) override;
EncoderInfo GetEncoderInfo() const override; EncoderInfo GetEncoderInfo() const override;
@ -183,8 +182,6 @@ bool VideoEncoderSoftwareFallbackWrapper::InitFallbackEncoder() {
fallback_encoder_->RegisterEncodeCompleteCallback(callback_); fallback_encoder_->RegisterEncodeCompleteCallback(callback_);
if (rates_set_) if (rates_set_)
fallback_encoder_->SetRateAllocation(bitrate_allocation_, framerate_); fallback_encoder_->SetRateAllocation(bitrate_allocation_, framerate_);
if (channel_parameters_set_)
fallback_encoder_->SetChannelParameters(packet_loss_, rtt_);
// Since we're switching to the fallback encoder, Release the real encoder. It // Since we're switching to the fallback encoder, Release the real encoder. It
// may be re-initialized via InitEncode later, and it will continue to get // may be re-initialized via InitEncode later, and it will continue to get
@ -204,7 +201,6 @@ int32_t VideoEncoderSoftwareFallbackWrapper::InitEncode(
max_payload_size_ = max_payload_size; max_payload_size_ = max_payload_size;
// Clear stored rate/channel parameters. // Clear stored rate/channel parameters.
rates_set_ = false; rates_set_ = false;
channel_parameters_set_ = false;
ValidateSettingsForForcedFallback(); ValidateSettingsForForcedFallback();
// Try to reinit forced software codec if it is in use. // Try to reinit forced software codec if it is in use.
@ -268,18 +264,6 @@ int32_t VideoEncoderSoftwareFallbackWrapper::Encode(
return ret; return ret;
} }
int32_t VideoEncoderSoftwareFallbackWrapper::SetChannelParameters(
uint32_t packet_loss,
int64_t rtt) {
channel_parameters_set_ = true;
packet_loss_ = packet_loss;
rtt_ = rtt;
int32_t ret = encoder_->SetChannelParameters(packet_loss, rtt);
if (use_fallback_encoder_)
return fallback_encoder_->SetChannelParameters(packet_loss, rtt);
return ret;
}
int32_t VideoEncoderSoftwareFallbackWrapper::SetRateAllocation( int32_t VideoEncoderSoftwareFallbackWrapper::SetRateAllocation(
const VideoBitrateAllocation& bitrate_allocation, const VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate) { uint32_t framerate) {

View File

@ -168,11 +168,6 @@ int32_t FakeWebRtcVideoEncoder::Release() {
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }
int32_t FakeWebRtcVideoEncoder::SetChannelParameters(uint32_t packetLoss,
int64_t rtt) {
return WEBRTC_VIDEO_CODEC_OK;
}
int32_t FakeWebRtcVideoEncoder::SetRateAllocation( int32_t FakeWebRtcVideoEncoder::SetRateAllocation(
const webrtc::VideoBitrateAllocation& allocation, const webrtc::VideoBitrateAllocation& allocation,
uint32_t framerate) { uint32_t framerate) {

View File

@ -86,7 +86,6 @@ class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder {
int32_t RegisterEncodeCompleteCallback( int32_t RegisterEncodeCompleteCallback(
webrtc::EncodedImageCallback* callback) override; webrtc::EncodedImageCallback* callback) override;
int32_t Release() override; int32_t Release() override;
int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) override;
int32_t SetRateAllocation(const webrtc::VideoBitrateAllocation& allocation, int32_t SetRateAllocation(const webrtc::VideoBitrateAllocation& allocation,
uint32_t framerate) override; uint32_t framerate) override;

View File

@ -33,7 +33,6 @@ class ScopedVideoEncoder : public webrtc::VideoEncoder {
int32_t Encode(const webrtc::VideoFrame& frame, int32_t Encode(const webrtc::VideoFrame& frame,
const webrtc::CodecSpecificInfo* codec_specific_info, const webrtc::CodecSpecificInfo* codec_specific_info,
const std::vector<webrtc::FrameType>* frame_types) override; const std::vector<webrtc::FrameType>* frame_types) override;
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int32_t SetRates(uint32_t bitrate, uint32_t framerate) override; int32_t SetRates(uint32_t bitrate, uint32_t framerate) override;
int32_t SetRateAllocation(const webrtc::VideoBitrateAllocation& allocation, int32_t SetRateAllocation(const webrtc::VideoBitrateAllocation& allocation,
uint32_t framerate) override; uint32_t framerate) override;
@ -72,11 +71,6 @@ int32_t ScopedVideoEncoder::Encode(
return encoder_->Encode(frame, codec_specific_info, frame_types); return encoder_->Encode(frame, codec_specific_info, frame_types);
} }
int32_t ScopedVideoEncoder::SetChannelParameters(uint32_t packet_loss,
int64_t rtt) {
return encoder_->SetChannelParameters(packet_loss, rtt);
}
int32_t ScopedVideoEncoder::SetRates(uint32_t bitrate, uint32_t framerate) { int32_t ScopedVideoEncoder::SetRates(uint32_t bitrate, uint32_t framerate) {
return encoder_->SetRates(bitrate, framerate); return encoder_->SetRates(bitrate, framerate);
} }

View File

@ -377,15 +377,6 @@ int SimulcastEncoderAdapter::RegisterEncodeCompleteCallback(
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }
int SimulcastEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
int64_t rtt) {
RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_);
for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) {
streaminfos_[stream_idx].encoder->SetChannelParameters(packet_loss, rtt);
}
return WEBRTC_VIDEO_CODEC_OK;
}
int SimulcastEncoderAdapter::SetRateAllocation( int SimulcastEncoderAdapter::SetRateAllocation(
const VideoBitrateAllocation& bitrate, const VideoBitrateAllocation& bitrate,
uint32_t new_framerate) { uint32_t new_framerate) {

View File

@ -48,7 +48,6 @@ class SimulcastEncoderAdapter : public VideoEncoder {
const CodecSpecificInfo* codec_specific_info, const CodecSpecificInfo* codec_specific_info,
const std::vector<FrameType>* frame_types) override; const std::vector<FrameType>* frame_types) override;
int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int SetRateAllocation(const VideoBitrateAllocation& bitrate, int SetRateAllocation(const VideoBitrateAllocation& bitrate,
uint32_t new_framerate) override; uint32_t new_framerate) override;

View File

@ -210,8 +210,6 @@ class MockVideoEncoder : public VideoEncoder {
return 0; return 0;
} }
MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int64_t rtt));
EncoderInfo GetEncoderInfo() const override { EncoderInfo GetEncoderInfo() const override {
EncoderInfo info; EncoderInfo info;
info.supports_native_handle = supports_native_handle_; info.supports_native_handle = supports_native_handle_;
@ -315,15 +313,6 @@ class TestSimulcastEncoderAdapterFakeHelper {
return new SimulcastEncoderAdapter(factory_.get(), SdpVideoFormat("VP8")); return new SimulcastEncoderAdapter(factory_.get(), SdpVideoFormat("VP8"));
} }
void ExpectCallSetChannelParameters(uint32_t packetLoss, int64_t rtt) {
EXPECT_TRUE(!factory_->encoders().empty());
for (size_t i = 0; i < factory_->encoders().size(); ++i) {
EXPECT_CALL(*factory_->encoders()[i],
SetChannelParameters(packetLoss, rtt))
.Times(1);
}
}
MockVideoEncoderFactory* factory() { return factory_.get(); } MockVideoEncoderFactory* factory() { return factory_.get(); }
private: private:
@ -472,14 +461,6 @@ TEST_F(TestSimulcastEncoderAdapterFake, Reinit) {
EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
} }
TEST_F(TestSimulcastEncoderAdapterFake, SetChannelParameters) {
SetupCodec();
const uint32_t packetLoss = 5;
const int64_t rtt = 30;
helper_->ExpectCallSetChannelParameters(packetLoss, rtt);
adapter_->SetChannelParameters(packetLoss, rtt);
}
TEST_F(TestSimulcastEncoderAdapterFake, EncodedCallbackForDifferentEncoders) { TEST_F(TestSimulcastEncoderAdapterFake, EncodedCallbackForDifferentEncoders) {
SetupCodec(); SetupCodec();

View File

@ -55,11 +55,6 @@ int VP8EncoderSimulcastProxy::RegisterEncodeCompleteCallback(
return encoder_->RegisterEncodeCompleteCallback(callback); return encoder_->RegisterEncodeCompleteCallback(callback);
} }
int VP8EncoderSimulcastProxy::SetChannelParameters(uint32_t packet_loss,
int64_t rtt) {
return encoder_->SetChannelParameters(packet_loss, rtt);
}
int VP8EncoderSimulcastProxy::SetRateAllocation( int VP8EncoderSimulcastProxy::SetRateAllocation(
const VideoBitrateAllocation& bitrate, const VideoBitrateAllocation& bitrate,
uint32_t new_framerate) { uint32_t new_framerate) {

View File

@ -42,7 +42,6 @@ class VP8EncoderSimulcastProxy : public VideoEncoder {
const CodecSpecificInfo* codec_specific_info, const CodecSpecificInfo* codec_specific_info,
const std::vector<FrameType>* frame_types) override; const std::vector<FrameType>* frame_types) override;
int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int SetRateAllocation(const VideoBitrateAllocation& bitrate, int SetRateAllocation(const VideoBitrateAllocation& bitrate,
uint32_t new_framerate) override; uint32_t new_framerate) override;
EncoderInfo GetEncoderInfo() const override; EncoderInfo GetEncoderInfo() const override;

View File

@ -51,8 +51,6 @@ class MockEncoder : public VideoEncoder {
const CodecSpecificInfo* codecSpecificInfo, const CodecSpecificInfo* codecSpecificInfo,
const std::vector<FrameType>* frame_types) /* override */); const std::vector<FrameType>* frame_types) /* override */);
MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int64_t rtt));
MOCK_CONST_METHOD0(ImplementationName, const char*()); MOCK_CONST_METHOD0(ImplementationName, const char*());
}; };

View File

@ -625,11 +625,6 @@ void H264EncoderImpl::ReportError() {
has_reported_error_ = true; has_reported_error_ = true;
} }
int32_t H264EncoderImpl::SetChannelParameters(uint32_t packet_loss,
int64_t rtt) {
return WEBRTC_VIDEO_CODEC_OK;
}
VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const {
return VideoEncoder::ScalingSettings(kLowH264QpThreshold, return VideoEncoder::ScalingSettings(kLowH264QpThreshold,
kHighH264QpThreshold); kHighH264QpThreshold);

View File

@ -74,9 +74,6 @@ class H264EncoderImpl : public H264Encoder {
VideoEncoder::ScalingSettings GetScalingSettings() const override; VideoEncoder::ScalingSettings GetScalingSettings() const override;
// Unsupported / Do nothing.
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
// Exposed for testing. // Exposed for testing.
H264PacketizationMode PacketizationModeForTesting() const { H264PacketizationMode PacketizationModeForTesting() const {
return packetization_mode_; return packetization_mode_;

View File

@ -65,10 +65,6 @@ class I420Encoder : public VideoEncoder {
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
int Release() override; int Release() override;
int SetChannelParameters(uint32_t /*packetLoss*/, int64_t /*rtt*/) override {
return WEBRTC_VIDEO_CODEC_OK;
}
private: private:
static uint8_t* InsertHeader(uint8_t* buffer, static uint8_t* InsertHeader(uint8_t* buffer,
uint16_t width, uint16_t width,

View File

@ -46,7 +46,6 @@ class MultiplexEncoderAdapter : public VideoEncoder {
const CodecSpecificInfo* codec_specific_info, const CodecSpecificInfo* codec_specific_info,
const std::vector<FrameType>* frame_types) override; const std::vector<FrameType>* frame_types) override;
int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int SetRateAllocation(const VideoBitrateAllocation& bitrate, int SetRateAllocation(const VideoBitrateAllocation& bitrate,
uint32_t new_framerate) override; uint32_t new_framerate) override;
int Release() override; int Release() override;

View File

@ -202,16 +202,6 @@ int MultiplexEncoderAdapter::RegisterEncodeCompleteCallback(
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }
int MultiplexEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
int64_t rtt) {
for (auto& encoder : encoders_) {
const int rv = encoder->SetChannelParameters(packet_loss, rtt);
if (rv)
return rv;
}
return WEBRTC_VIDEO_CODEC_OK;
}
int MultiplexEncoderAdapter::SetRateAllocation( int MultiplexEncoderAdapter::SetRateAllocation(
const VideoBitrateAllocation& bitrate, const VideoBitrateAllocation& bitrate,
uint32_t framerate) { uint32_t framerate) {

View File

@ -925,10 +925,6 @@ VideoEncoder::ScalingSettings LibvpxVp8Encoder::GetScalingSettings() const {
: VideoEncoder::ScalingSettings::kOff; : VideoEncoder::ScalingSettings::kOff;
} }
int LibvpxVp8Encoder::SetChannelParameters(uint32_t packetLoss, int64_t rtt) {
return WEBRTC_VIDEO_CODEC_OK;
}
int LibvpxVp8Encoder::RegisterEncodeCompleteCallback( int LibvpxVp8Encoder::RegisterEncodeCompleteCallback(
EncodedImageCallback* callback) { EncodedImageCallback* callback) {
encoded_complete_callback_ = callback; encoded_complete_callback_ = callback;

View File

@ -47,8 +47,6 @@ class LibvpxVp8Encoder : public VideoEncoder {
int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int SetRateAllocation(const VideoBitrateAllocation& bitrate, int SetRateAllocation(const VideoBitrateAllocation& bitrate,
uint32_t new_framerate) override; uint32_t new_framerate) override;

View File

@ -1239,10 +1239,6 @@ void VP9EncoderImpl::DeliverBufferedFrame(bool end_of_picture) {
} }
} }
int VP9EncoderImpl::SetChannelParameters(uint32_t packet_loss, int64_t rtt) {
return WEBRTC_VIDEO_CODEC_OK;
}
int VP9EncoderImpl::RegisterEncodeCompleteCallback( int VP9EncoderImpl::RegisterEncodeCompleteCallback(
EncodedImageCallback* callback) { EncodedImageCallback* callback) {
encoded_complete_callback_ = callback; encoded_complete_callback_ = callback;

View File

@ -46,8 +46,6 @@ class VP9EncoderImpl : public VP9Encoder {
int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation, int SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
uint32_t frame_rate) override; uint32_t frame_rate) override;

View File

@ -101,26 +101,14 @@ int32_t VCMGenericEncoder::Encode(const VideoFrame& frame,
void VCMGenericEncoder::SetEncoderParameters(const EncoderParameters& params) { void VCMGenericEncoder::SetEncoderParameters(const EncoderParameters& params) {
RTC_DCHECK_RUNS_SERIALIZED(&race_checker_); RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
bool channel_parameters_have_changed;
bool rates_have_changed; bool rates_have_changed;
{ {
rtc::CritScope lock(&params_lock_); rtc::CritScope lock(&params_lock_);
channel_parameters_have_changed =
params.loss_rate != encoder_params_.loss_rate ||
params.rtt != encoder_params_.rtt;
rates_have_changed = rates_have_changed =
params.target_bitrate != encoder_params_.target_bitrate || params.target_bitrate != encoder_params_.target_bitrate ||
params.input_frame_rate != encoder_params_.input_frame_rate; params.input_frame_rate != encoder_params_.input_frame_rate;
encoder_params_ = params; encoder_params_ = params;
} }
if (channel_parameters_have_changed) {
int res = encoder_->SetChannelParameters(params.loss_rate, params.rtt);
if (res != 0) {
RTC_LOG(LS_WARNING) << "Error set encoder parameters (loss = "
<< params.loss_rate << ", rtt = " << params.rtt
<< "): " << res;
}
}
if (rates_have_changed) { if (rates_have_changed) {
int res = encoder_->SetRateAllocation(params.target_bitrate, int res = encoder_->SetRateAllocation(params.target_bitrate,
params.input_frame_rate); params.input_frame_rate);

View File

@ -44,7 +44,6 @@ class MockVideoEncoder : public VideoEncoder {
int32_t(EncodedImageCallback* callback)); int32_t(EncodedImageCallback* callback));
MOCK_METHOD0(Release, int32_t()); MOCK_METHOD0(Release, int32_t());
MOCK_METHOD0(Reset, 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(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate));
MOCK_METHOD2(SetRateAllocation, MOCK_METHOD2(SetRateAllocation,
int32_t(const VideoBitrateAllocation& newBitRate, int32_t(const VideoBitrateAllocation& newBitRate,

View File

@ -369,9 +369,6 @@ TEST_F(TestVideoSenderWithMockEncoder,
// Expect initial call to SetChannelParameters. Rates are initialized through // Expect initial call to SetChannelParameters. Rates are initialized through
// InitEncode and expects no additional call before the framerate (or bitrate) // InitEncode and expects no additional call before the framerate (or bitrate)
// updates. // updates.
EXPECT_CALL(encoder_, SetChannelParameters(kLossRate, kRtt))
.Times(1)
.WillOnce(Return(0));
sender_->SetChannelParameters(settings_.startBitrate * 1000, kLossRate, kRtt, sender_->SetChannelParameters(settings_.startBitrate * 1000, kLossRate, kRtt,
rate_allocator_.get(), nullptr); rate_allocator_.get(), nullptr);
while (clock_.TimeInMilliseconds() < start_time + kRateStatsWindowMs) { while (clock_.TimeInMilliseconds() < start_time + kRateStatsWindowMs) {

View File

@ -216,7 +216,12 @@ public interface VideoEncoder {
* @param packetLoss How many packets are lost on average per 255 packets. * @param packetLoss How many packets are lost on average per 255 packets.
* @param roundTripTimeMs Round-trip time of the network in milliseconds. * @param roundTripTimeMs Round-trip time of the network in milliseconds.
*/ */
@CalledByNative VideoCodecStatus setChannelParameters(short packetLoss, long roundTripTimeMs); // TODO(webrtc:9946): Remove this function when downstream projects have been
// updated.
@Deprecated
default VideoCodecStatus setChannelParameters(short packetLoss, long roundTripTimeMs) {
return VideoCodecStatus.OK;
}
/** Sets the bitrate allocation and the target framerate for the encoder. */ /** Sets the bitrate allocation and the target framerate for the encoder. */
@CalledByNative VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate); @CalledByNative VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate);

View File

@ -403,12 +403,6 @@ class HardwareVideoEncoder implements VideoEncoder {
return VideoCodecStatus.OK; return VideoCodecStatus.OK;
} }
@Override
public VideoCodecStatus setChannelParameters(short packetLoss, long roundTripTimeMs) {
encodeThreadChecker.checkIsOnValidThread();
return VideoCodecStatus.OK; // No op.
}
@Override @Override
public VideoCodecStatus setRateAllocation(BitrateAllocation bitrateAllocation, int framerate) { public VideoCodecStatus setRateAllocation(BitrateAllocation bitrateAllocation, int framerate) {
encodeThreadChecker.checkIsOnValidThread(); encodeThreadChecker.checkIsOnValidThread();

View File

@ -32,11 +32,6 @@ abstract class WrappedNativeVideoEncoder implements VideoEncoder {
throw new UnsupportedOperationException("Not implemented."); throw new UnsupportedOperationException("Not implemented.");
} }
@Override
public VideoCodecStatus setChannelParameters(short packetLoss, long roundTripTimeMs) {
throw new UnsupportedOperationException("Not implemented.");
}
@Override @Override
public VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate) { public VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate) {
throw new UnsupportedOperationException("Not implemented."); throw new UnsupportedOperationException("Not implemented.");

View File

@ -105,8 +105,6 @@ class MediaCodecVideoEncoder : public VideoEncoder {
int32_t RegisterEncodeCompleteCallback( int32_t RegisterEncodeCompleteCallback(
EncodedImageCallback* callback) override; EncodedImageCallback* callback) override;
int32_t Release() override; int32_t Release() override;
int32_t SetChannelParameters(uint32_t /* packet_loss */,
int64_t /* rtt */) override;
int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation, int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
uint32_t frame_rate) override; uint32_t frame_rate) override;
@ -364,11 +362,6 @@ int32_t MediaCodecVideoEncoder::InitEncode(const VideoCodec* codec_settings,
codec_settings->expect_encode_from_texture && has_egl_context_); codec_settings->expect_encode_from_texture && has_egl_context_);
} }
int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */,
int64_t /* rtt */) {
return WEBRTC_VIDEO_CODEC_OK;
}
bool MediaCodecVideoEncoder::ResetCodec() { bool MediaCodecVideoEncoder::ResetCodec() {
RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_checker_); RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_checker_);
ALOGE << "Reset"; ALOGE << "Reset";

View File

@ -136,14 +136,6 @@ int32_t VideoEncoderWrapper::Encode(
return HandleReturnCode(jni, ret, "encode"); return HandleReturnCode(jni, ret, "encode");
} }
int32_t VideoEncoderWrapper::SetChannelParameters(uint32_t packet_loss,
int64_t rtt) {
JNIEnv* jni = AttachCurrentThreadIfNeeded();
ScopedJavaLocalRef<jobject> ret = Java_VideoEncoder_setChannelParameters(
jni, encoder_, (jshort)packet_loss, (jlong)rtt);
return HandleReturnCode(jni, ret, "setChannelParameters");
}
int32_t VideoEncoderWrapper::SetRateAllocation( int32_t VideoEncoderWrapper::SetRateAllocation(
const VideoBitrateAllocation& allocation, const VideoBitrateAllocation& allocation,
uint32_t framerate) { uint32_t framerate) {

View File

@ -45,8 +45,6 @@ class VideoEncoderWrapper : public VideoEncoder {
const CodecSpecificInfo* codec_specific_info, const CodecSpecificInfo* codec_specific_info,
const std::vector<FrameType>* frame_types) override; const std::vector<FrameType>* frame_types) override;
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int32_t SetRateAllocation(const VideoBitrateAllocation& allocation, int32_t SetRateAllocation(const VideoBitrateAllocation& allocation,
uint32_t framerate) override; uint32_t framerate) override;

View File

@ -86,8 +86,6 @@ class ObjCVideoEncoder : public VideoEncoder {
frameTypes:rtcFrameTypes]; frameTypes:rtcFrameTypes];
} }
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) { return WEBRTC_VIDEO_CODEC_OK; }
int32_t SetRates(uint32_t bitrate, uint32_t framerate) { int32_t SetRates(uint32_t bitrate, uint32_t framerate) {
return [encoder_ setBitrate:bitrate framerate:framerate]; return [encoder_ setBitrate:bitrate framerate:framerate];
} }

View File

@ -117,12 +117,6 @@ TEST(ObjCVideoEncoderFactoryTest, ReleaseEncodeReturnsErrorOnFail) {
EXPECT_EQ(encoder->Release(), WEBRTC_VIDEO_CODEC_ERROR); EXPECT_EQ(encoder->Release(), WEBRTC_VIDEO_CODEC_ERROR);
} }
TEST(ObjCVideoEncoderFactoryTest, SetChannelParametersAlwaysReturnsOK) {
std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateErrorEncoderFactory());
EXPECT_EQ(encoder->SetChannelParameters(1, 1), WEBRTC_VIDEO_CODEC_OK);
}
TEST(ObjCVideoEncoderFactoryTest, SetRatesReturnsOKOnSuccess) { TEST(ObjCVideoEncoderFactoryTest, SetRatesReturnsOKOnSuccess) {
std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateOKEncoderFactory()); std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateOKEncoderFactory());

View File

@ -70,11 +70,6 @@ int32_t ConfigurableFrameSizeEncoder::Release() {
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }
int32_t ConfigurableFrameSizeEncoder::SetChannelParameters(uint32_t packet_loss,
int64_t rtt) {
return WEBRTC_VIDEO_CODEC_OK;
}
int32_t ConfigurableFrameSizeEncoder::SetRateAllocation( int32_t ConfigurableFrameSizeEncoder::SetRateAllocation(
const VideoBitrateAllocation& allocation, const VideoBitrateAllocation& allocation,
uint32_t framerate) { uint32_t framerate) {

View File

@ -37,8 +37,6 @@ class ConfigurableFrameSizeEncoder : public VideoEncoder {
int32_t Release() override; int32_t Release() override;
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int32_t SetRateAllocation(const VideoBitrateAllocation& allocation, int32_t SetRateAllocation(const VideoBitrateAllocation& allocation,
uint32_t framerate) override; uint32_t framerate) override;

View File

@ -214,10 +214,6 @@ int32_t FakeEncoder::Release() {
return 0; return 0;
} }
int32_t FakeEncoder::SetChannelParameters(uint32_t packet_loss, int64_t rtt) {
return 0;
}
int32_t FakeEncoder::SetRateAllocation( int32_t FakeEncoder::SetRateAllocation(
const VideoBitrateAllocation& rate_allocation, const VideoBitrateAllocation& rate_allocation,
uint32_t framerate) { uint32_t framerate) {

View File

@ -41,7 +41,6 @@ class FakeEncoder : public VideoEncoder {
int32_t RegisterEncodeCompleteCallback( int32_t RegisterEncodeCompleteCallback(
EncodedImageCallback* callback) override; EncodedImageCallback* callback) override;
int32_t Release() override; int32_t Release() override;
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation, int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
uint32_t framerate) override; uint32_t framerate) override;
const char* ImplementationName() const override; const char* ImplementationName() const override;

View File

@ -76,9 +76,6 @@ class VideoEncoderProxyFactory final : public VideoEncoderFactory {
return encoder_->RegisterEncodeCompleteCallback(callback); return encoder_->RegisterEncodeCompleteCallback(callback);
} }
int32_t Release() override { return encoder_->Release(); } int32_t Release() override { return encoder_->Release(); }
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override {
return encoder_->SetChannelParameters(packet_loss, rtt);
}
int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation, int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
uint32_t framerate) override { uint32_t framerate) override {
return encoder_->SetRateAllocation(rate_allocation, framerate); return encoder_->SetRateAllocation(rate_allocation, framerate);

View File

@ -111,9 +111,6 @@ class QualityTestVideoEncoder : public VideoEncoder,
} }
return encoder_->Encode(frame, codec_specific_info, frame_types); return encoder_->Encode(frame, codec_specific_info, frame_types);
} }
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override {
return encoder_->SetChannelParameters(packet_loss, rtt);
}
int32_t SetRates(uint32_t bitrate, uint32_t framerate) override { int32_t SetRates(uint32_t bitrate, uint32_t framerate) override {
return encoder_->SetRates(bitrate, framerate); return encoder_->SetRates(bitrate, framerate);
} }

View File

@ -2378,11 +2378,6 @@ TEST_P(VideoSendStreamTest, EncoderIsProperlyInitializedAndDestroyed) {
return 0; return 0;
} }
int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) override {
EXPECT_TRUE(IsReadyForEncode());
return 0;
}
int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) override { int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) override {
EXPECT_TRUE(IsReadyForEncode()); EXPECT_TRUE(IsReadyForEncode());
return 0; return 0;