Revert "Replace usage of old SetRates/SetRateAllocation methods"
This reverts commit 7ac0d5f348f0b956089c4ed65c46e65bac125508. Reason for revert: <INSERT REASONING HERE> 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,nisse@webrtc.org,sprang@webrtc.org,perkj@webrtc.org Change-Id: I576760b584e3f258013b0279c0c173c895bbb37e No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:10481 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132561 Reviewed-by: Minyue Li <minyue@webrtc.org> Commit-Queue: Minyue Li <minyue@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27559}
This commit is contained in:
@ -104,7 +104,8 @@ class MediaCodecVideoEncoder : public VideoEncoder {
|
||||
int32_t RegisterEncodeCompleteCallback(
|
||||
EncodedImageCallback* callback) override;
|
||||
int32_t Release() override;
|
||||
void SetRates(const RateControlParameters& parameters) override;
|
||||
int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
|
||||
uint32_t frame_rate) override;
|
||||
EncoderInfo GetEncoderInfo() const override;
|
||||
|
||||
// Fills the input buffer with data from the buffers passed as parameters.
|
||||
@ -899,16 +900,17 @@ int32_t MediaCodecVideoEncoder::Release() {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
void MediaCodecVideoEncoder::SetRates(const RateControlParameters& parameters) {
|
||||
int32_t MediaCodecVideoEncoder::SetRateAllocation(
|
||||
const VideoBitrateAllocation& rate_allocation,
|
||||
uint32_t frame_rate) {
|
||||
RTC_DCHECK_RUN_ON(&encoder_queue_checker_);
|
||||
const uint32_t new_bit_rate = parameters.bitrate.get_sum_kbps();
|
||||
const uint32_t new_bit_rate = rate_allocation.get_sum_kbps();
|
||||
if (sw_fallback_required_)
|
||||
return;
|
||||
uint32_t frame_rate = static_cast<uint32_t>(parameters.framerate_fps + 0.5);
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
frame_rate =
|
||||
(frame_rate < MAX_ALLOWED_VIDEO_FPS) ? frame_rate : MAX_ALLOWED_VIDEO_FPS;
|
||||
if (last_set_bitrate_kbps_ == new_bit_rate && last_set_fps_ == frame_rate) {
|
||||
return;
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
JNIEnv* jni = AttachCurrentThreadIfNeeded();
|
||||
ScopedLocalRefFrame local_ref_frame(jni);
|
||||
@ -924,7 +926,10 @@ void MediaCodecVideoEncoder::SetRates(const RateControlParameters& parameters) {
|
||||
rtc::dchecked_cast<int>(last_set_fps_));
|
||||
if (CheckException(jni) || !ret) {
|
||||
ProcessHWError(true /* reset_if_fallback_unavailable */);
|
||||
return sw_fallback_required_ ? WEBRTC_VIDEO_CODEC_OK
|
||||
: WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
VideoEncoder::EncoderInfo MediaCodecVideoEncoder::GetEncoderInfo() const {
|
||||
|
||||
@ -146,15 +146,16 @@ int32_t VideoEncoderWrapper::Encode(
|
||||
return HandleReturnCode(jni, ret, "encode");
|
||||
}
|
||||
|
||||
void VideoEncoderWrapper::SetRates(const RateControlParameters& parameters) {
|
||||
int32_t VideoEncoderWrapper::SetRateAllocation(
|
||||
const VideoBitrateAllocation& allocation,
|
||||
uint32_t framerate) {
|
||||
JNIEnv* jni = AttachCurrentThreadIfNeeded();
|
||||
|
||||
ScopedJavaLocalRef<jobject> j_bitrate_allocation =
|
||||
ToJavaBitrateAllocation(jni, parameters.bitrate);
|
||||
ToJavaBitrateAllocation(jni, allocation);
|
||||
ScopedJavaLocalRef<jobject> ret = Java_VideoEncoder_setRateAllocation(
|
||||
jni, encoder_, j_bitrate_allocation,
|
||||
(jint)(parameters.framerate_fps + 0.5));
|
||||
HandleReturnCode(jni, ret, "setRateAllocation");
|
||||
jni, encoder_, j_bitrate_allocation, (jint)framerate);
|
||||
return HandleReturnCode(jni, ret, "setRateAllocation");
|
||||
}
|
||||
|
||||
VideoEncoder::EncoderInfo VideoEncoderWrapper::GetEncoderInfo() const {
|
||||
|
||||
@ -44,7 +44,8 @@ class VideoEncoderWrapper : public VideoEncoder {
|
||||
int32_t Encode(const VideoFrame& frame,
|
||||
const std::vector<VideoFrameType>* frame_types) override;
|
||||
|
||||
void SetRates(const RateControlParameters& parameters) override;
|
||||
int32_t SetRateAllocation(const VideoBitrateAllocation& allocation,
|
||||
uint32_t framerate) override;
|
||||
|
||||
EncoderInfo GetEncoderInfo() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user