Bug 1069646: scale frame rate initialization in webrtc media_opimization r=gcp

This commit is contained in:
Randell Jesup 2014-09-22 23:35:58 -04:00
parent 9b6ecb79ab
commit 1c3d38be3d
3 changed files with 10 additions and 10 deletions

View File

@ -21,7 +21,7 @@ namespace webrtc {
//////////////////////////////////
VCMContentMetricsProcessing::VCMContentMetricsProcessing()
: recursive_avg_factor_(1 / 150.0f), // matched to 30fps.
: recursive_avg_factor_(1 / 150.0f), // matched to 15fps.
frame_cnt_uniform_avg_(0),
avg_motion_level_(0.0f),
avg_spatial_level_(0.0f) {
@ -43,7 +43,7 @@ int VCMContentMetricsProcessing::Reset() {
return VCM_OK;
}
void VCMContentMetricsProcessing::UpdateFrameRate(uint32_t frameRate) {
void VCMContentMetricsProcessing::UpdateFrameRate(float frameRate) {
// Update factor for recursive averaging.
recursive_avg_factor_ = static_cast<float> (1000.0f) /
static_cast<float>(frameRate * kQmMinIntervalMs);

View File

@ -45,7 +45,7 @@ class VCMContentMetricsProcessing {
int Reset();
// Inform class of current frame rate.
void UpdateFrameRate(uint32_t frameRate);
void UpdateFrameRate(float frameRate);
// Returns the long-term averaged content data: recursive average over longer
// time scale.

View File

@ -152,9 +152,9 @@ static int GreatestCommonDenominator(int a, int b) {
}
void MediaOptimization::SetEncodingData(VideoCodecType send_codec_type,
int32_t max_bit_rate,
uint32_t frame_rate,
uint32_t target_bitrate,
int32_t max_bit_rate, // in bits/s
uint32_t frame_rate, // in fps*1000
uint32_t target_bitrate, // in bits/s
uint16_t width,
uint16_t height,
uint8_t divisor,
@ -166,19 +166,19 @@ void MediaOptimization::SetEncodingData(VideoCodecType send_codec_type,
// after the processing of the first frame.
last_change_time_ = clock_->TimeInMilliseconds();
content_->Reset();
content_->UpdateFrameRate(frame_rate);
content_->UpdateFrameRate(static_cast<float>(frame_rate) / 1000.0f);
max_bit_rate_ = max_bit_rate;
send_codec_type_ = send_codec_type;
target_bit_rate_ = target_bitrate;
float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f;
loss_prot_logic_->UpdateBitRate(target_bitrate_kbps);
loss_prot_logic_->UpdateFrameRate(static_cast<float>(frame_rate));
loss_prot_logic_->UpdateFrameRate(static_cast<float>(frame_rate) / 1000.0f);
loss_prot_logic_->UpdateFrameSize(width, height);
loss_prot_logic_->UpdateNumLayers(num_layers);
frame_dropper_->Reset();
frame_dropper_->SetRates(target_bitrate_kbps, static_cast<float>(frame_rate));
user_frame_rate_ = static_cast<float>(frame_rate);
frame_dropper_->SetRates(target_bitrate_kbps, static_cast<float>(frame_rate) / 1000.0f);
user_frame_rate_ = static_cast<float>(frame_rate)/1000.0f;
codec_width_ = width;
codec_height_ = height;
int gcd = GreatestCommonDenominator(codec_width_, codec_height_);