Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Unified Diff: webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc

Issue 2510583002: Reland #2 of Issue 2434073003: Extract bitrate allocation ... (Closed)
Patch Set: Addressed comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
index 5c0aa1bd4507206de1cf3277c3f282438d3dc623..d411b18bf812768adfca3ade2481564d46c3ab28 100644
--- a/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
+++ b/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
@@ -152,6 +152,14 @@ static void RtpFragmentize(EncodedImage* encoded_image,
H264EncoderImpl::H264EncoderImpl()
: openh264_encoder_(nullptr),
+ width_(0),
+ height_(0),
+ max_frame_rate_(0.0f),
+ target_bps_(0),
+ max_bps_(0),
+ mode_(kRealtimeVideo),
+ frame_dropping_on_(false),
+ key_frame_interval_(0),
number_of_cores_(0),
encoded_image_callback_(nullptr),
has_reported_init_(false),
@@ -263,11 +271,13 @@ int32_t H264EncoderImpl::RegisterEncodeCompleteCallback(
return WEBRTC_VIDEO_CODEC_OK;
}
-int32_t H264EncoderImpl::SetRates(uint32_t bitrate, uint32_t framerate) {
- if (bitrate <= 0 || framerate <= 0) {
+int32_t H264EncoderImpl::SetRateAllocation(
+ const BitrateAllocation& bitrate_allocation,
+ uint32_t framerate) {
+ if (bitrate_allocation.get_sum_bps() <= 0 || framerate <= 0)
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
- }
- target_bps_ = bitrate * 1000;
+
+ target_bps_ = bitrate_allocation.get_sum_bps();
max_frame_rate_ = static_cast<float>(framerate);
quality_scaler_.ReportFramerate(framerate);
« no previous file with comments | « webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h ('k') | webrtc/modules/video_coding/codecs/i420/include/i420.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698