Reland "Replace usage of old SetRates/SetRateAllocation methods"
This is a reland of 7ac0d5f348f0b956089c4ed65c46e65bac125508 Original change's description: > 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} TBR=brandtr@webrtc.org,sakal@webrtc.org,perkj@webrtc.org Bug: webrtc:10481 Change-Id: I2978d5c527a18e885b7845c4e53a2424e8ad5b4b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132551 Commit-Queue: Erik Språng <sprang@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27593}
This commit is contained in:
@ -309,29 +309,33 @@ bool VP9EncoderImpl::SetSvcRates(
|
||||
return true;
|
||||
}
|
||||
|
||||
int VP9EncoderImpl::SetRateAllocation(
|
||||
const VideoBitrateAllocation& bitrate_allocation,
|
||||
uint32_t frame_rate) {
|
||||
void VP9EncoderImpl::SetRates(const RateControlParameters& parameters) {
|
||||
if (!inited_) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
RTC_LOG(LS_WARNING) << "SetRates() calll while uninitialzied.";
|
||||
return;
|
||||
}
|
||||
if (encoder_->err) {
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
RTC_LOG(LS_WARNING) << "Encoder in error state: " << encoder_->err;
|
||||
return;
|
||||
}
|
||||
if (frame_rate < 1) {
|
||||
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
||||
if (parameters.framerate_fps < 1.0) {
|
||||
RTC_LOG(LS_WARNING) << "Unsupported framerate: "
|
||||
<< parameters.framerate_fps;
|
||||
return;
|
||||
}
|
||||
// Update bit rate
|
||||
if (codec_.maxBitrate > 0 &&
|
||||
bitrate_allocation.get_sum_kbps() > codec_.maxBitrate) {
|
||||
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
||||
parameters.bitrate.get_sum_kbps() > codec_.maxBitrate) {
|
||||
RTC_LOG(LS_WARNING) << "Target bitrate exceeds maximum: "
|
||||
<< parameters.bitrate.get_sum_kbps() << " vs "
|
||||
<< codec_.maxBitrate;
|
||||
return;
|
||||
}
|
||||
|
||||
codec_.maxFramerate = frame_rate;
|
||||
codec_.maxFramerate = static_cast<uint32_t>(parameters.framerate_fps + 0.5);
|
||||
requested_bitrate_allocation_ = parameters.bitrate;
|
||||
|
||||
requested_bitrate_allocation_ = bitrate_allocation;
|
||||
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
int VP9EncoderImpl::InitEncode(const VideoCodec* inst,
|
||||
|
Reference in New Issue
Block a user