Replace usage of old SetRates/SetRateAllocation methods

This rather large CL replaces all relevant usage of the old
VideoEncoder::SetRates()/SetRateAllocation() methods in WebRTC.
API is unchanged to allow downstream projects to update without
breakage.

Bug: webrtc:10481
Change-Id: Iab8f292ce6be6c3f5056a239d26361962b14bb38
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131949
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27554}
This commit is contained in:
Erik Språng
2019-04-11 09:06:13 +02:00
committed by Commit Bot
parent 71ec39e355
commit 7ac0d5f348
41 changed files with 430 additions and 389 deletions

View File

@ -45,8 +45,7 @@ class MultiplexEncoderAdapter : public VideoEncoder {
int Encode(const VideoFrame& input_image,
const std::vector<VideoFrameType>* frame_types) override;
int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
int SetRateAllocation(const VideoBitrateAllocation& bitrate,
uint32_t new_framerate) override;
void SetRates(const RateControlParameters& parameters) override;
int Release() override;
EncoderInfo GetEncoderInfo() const override;

View File

@ -216,23 +216,21 @@ int MultiplexEncoderAdapter::RegisterEncodeCompleteCallback(
return WEBRTC_VIDEO_CODEC_OK;
}
int MultiplexEncoderAdapter::SetRateAllocation(
const VideoBitrateAllocation& bitrate,
uint32_t framerate) {
VideoBitrateAllocation bitrate_allocation(bitrate);
void MultiplexEncoderAdapter::SetRates(
const RateControlParameters& parameters) {
VideoBitrateAllocation bitrate_allocation(parameters.bitrate);
bitrate_allocation.SetBitrate(
0, 0, bitrate.GetBitrate(0, 0) - augmenting_data_size_);
0, 0, parameters.bitrate.GetBitrate(0, 0) - augmenting_data_size_);
for (auto& encoder : encoders_) {
// TODO(emircan): |framerate| is used to calculate duration in encoder
// instances. We report the total frame rate to keep real time for now.
// Remove this after refactoring duration logic.
const int rv = encoder->SetRateAllocation(
encoder->SetRates(RateControlParameters(
bitrate_allocation,
static_cast<uint32_t>(encoders_.size()) * framerate);
if (rv)
return rv;
static_cast<uint32_t>(encoders_.size() * parameters.framerate_fps),
parameters.bandwidth_allocation -
DataRate::bps(augmenting_data_size_)));
}
return WEBRTC_VIDEO_CODEC_OK;
}
int MultiplexEncoderAdapter::Release() {