Index: webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h |
diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h |
index 8bcc53d6d52ecb7756d46f31d406848ba24919b6..ba69cc4d06dd8eadb29352f8638f02cdc7c13d95 100644 |
--- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h |
+++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h |
@@ -17,6 +17,7 @@ |
#include <memory> |
#include <string> |
#include <utility> |
+#include <vector> |
#if defined(WEBRTC_ANDROID) |
#include "webrtc/modules/video_coding/codecs/test/android_test_initializer.h" |
@@ -37,9 +38,11 @@ |
#include "webrtc/modules/video_coding/include/video_coding.h" |
#include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
#include "webrtc/rtc_base/checks.h" |
+#include "webrtc/rtc_base/event.h" |
#include "webrtc/rtc_base/file.h" |
#include "webrtc/rtc_base/logging.h" |
#include "webrtc/rtc_base/ptr_util.h" |
+#include "webrtc/system_wrappers/include/sleep.h" |
#include "webrtc/test/gtest.h" |
#include "webrtc/test/testsupport/fileutils.h" |
#include "webrtc/test/testsupport/frame_reader.h" |
@@ -65,7 +68,6 @@ const float kScaleKeyFrameSize = 0.5f; |
// Thresholds for the quality metrics. Defaults are maximally minimal. |
struct QualityThresholds { |
- QualityThresholds() {} |
QualityThresholds(double min_avg_psnr, |
double min_min_psnr, |
double min_avg_ssim, |
@@ -74,10 +76,10 @@ struct QualityThresholds { |
min_min_psnr(min_min_psnr), |
min_avg_ssim(min_avg_ssim), |
min_min_ssim(min_min_ssim) {} |
- double min_avg_psnr = std::numeric_limits<double>::min(); |
- double min_min_psnr = std::numeric_limits<double>::min(); |
- double min_avg_ssim = 0.0; |
- double min_min_ssim = 0.0; |
+ double min_avg_psnr; |
+ double min_min_psnr; |
+ double min_avg_ssim; |
+ double min_min_ssim; |
}; |
// The sequence of bit rate and frame rate changes for the encoder, the frame |
@@ -101,8 +103,8 @@ struct RateControlThresholds { |
int max_delta_frame_size_mismatch; |
int max_encoding_rate_mismatch; |
int max_time_hit_target; |
- int num_spatial_resizes; // Set to -1 to disable check. |
- int num_key_frames; // Set to -1 to disable check. |
+ int num_spatial_resizes; |
+ int num_key_frames; |
}; |
// Should video files be saved persistently to disk for post-run visualization? |
@@ -182,9 +184,10 @@ class VideoProcessorIntegrationTest : public testing::Test { |
decoder_factory_->DestroyVideoDecoder(decoder_); |
} |
- void SetUpObjects(const VisualizationParams* visualization_params, |
- const int initial_bitrate_kbps, |
- const int initial_framerate_fps) { |
+ void SetUpAndInitObjects(rtc::TaskQueue* task_queue, |
+ const int initial_bitrate_kbps, |
+ const int initial_framerate_fps, |
+ const VisualizationParams* visualization_params) { |
CreateEncoderAndDecoder(); |
// Create file objects for quality analysis. |
@@ -224,11 +227,43 @@ class VideoProcessorIntegrationTest : public testing::Test { |
packet_manipulator_.reset(new PacketManipulatorImpl( |
&packet_reader_, config_.networking_config, config_.verbose)); |
- processor_ = rtc::MakeUnique<VideoProcessor>( |
- encoder_, decoder_, analysis_frame_reader_.get(), |
- analysis_frame_writer_.get(), packet_manipulator_.get(), config_, |
- &stats_, encoded_frame_writer_.get(), decoded_frame_writer_.get()); |
- processor_->Init(); |
+ |
+ config_.codec_settings.startBitrate = initial_bitrate_kbps; |
+ |
+ rtc::Event sync_event(false, false); |
+ task_queue->PostTask([this, &sync_event]() { |
+ processor_ = rtc::MakeUnique<VideoProcessor>( |
+ encoder_, decoder_, analysis_frame_reader_.get(), |
+ analysis_frame_writer_.get(), packet_manipulator_.get(), config_, |
+ &stats_, encoded_frame_writer_.get(), decoded_frame_writer_.get()); |
+ processor_->Init(); |
+ sync_event.Set(); |
+ }); |
+ sync_event.Wait(rtc::Event::kForever); |
+ } |
+ |
+ void ReleaseAndCloseObjects(rtc::TaskQueue* task_queue) { |
+ rtc::Event sync_event(false, false); |
+ task_queue->PostTask([this, &sync_event]() { |
+ processor_->Release(); |
+ sync_event.Set(); |
+ }); |
+ sync_event.Wait(rtc::Event::kForever); |
+ |
+ // The VideoProcessor must be ::Release()'d before we destroy the codecs. |
+ DestroyEncoderAndDecoder(); |
+ |
+ // Close the analysis files before we use them for SSIM/PSNR calculations. |
+ analysis_frame_reader_->Close(); |
+ analysis_frame_writer_->Close(); |
+ |
+ // Close visualization files. |
+ if (encoded_frame_writer_) { |
+ EXPECT_TRUE(encoded_frame_writer_->Close()); |
+ } |
+ if (decoded_frame_writer_) { |
+ decoded_frame_writer_->Close(); |
+ } |
} |
// Reset quantities after each encoder update, update the target per-frame |
@@ -307,10 +342,19 @@ class VideoProcessorIntegrationTest : public testing::Test { |
} |
// Verify expected behavior of rate control and print out data. |
- void VerifyRateControlMetrics(int rate_update_index, |
- const RateControlThresholds& rc_expected) { |
- int num_dropped_frames = processor_->NumberDroppedFrames(); |
- int num_resize_actions = processor_->NumberSpatialResizes(); |
+ void PrintAndMaybeVerifyRateControlMetrics( |
+ int rate_update_index, |
+ const std::vector<RateControlThresholds>* rc_thresholds, |
+ const std::vector<int>& num_dropped_frames, |
+ const std::vector<int>& num_resize_actions) { |
+ const RateControlThresholds* rc_threshold = nullptr; |
+ if (rc_thresholds) { |
+ rc_threshold = &(*rc_thresholds)[rate_update_index]; |
+ |
+ EXPECT_LE(perc_encoding_rate_mismatch_, |
+ rc_threshold->max_encoding_rate_mismatch); |
+ } |
+ |
printf( |
"Rate update #%d:\n" |
" Target bitrate : %d\n" |
@@ -322,11 +366,10 @@ class VideoProcessorIntegrationTest : public testing::Test { |
" # frames to convergence: %d\n" |
" # dropped frames : %d\n" |
" # spatial resizes : %d\n", |
- num_frames_total_, num_frames_to_hit_target_, num_dropped_frames, |
- num_resize_actions); |
+ num_frames_total_, num_frames_to_hit_target_, |
+ num_dropped_frames[rate_update_index], |
+ num_resize_actions[rate_update_index]); |
- EXPECT_LE(perc_encoding_rate_mismatch_, |
- rc_expected.max_encoding_rate_mismatch); |
if (num_key_frames_ > 0) { |
int perc_key_frame_size_mismatch = |
100 * sum_key_frame_size_mismatch_ / num_key_frames_; |
@@ -334,8 +377,10 @@ class VideoProcessorIntegrationTest : public testing::Test { |
" # key frames : %d\n" |
" Key frame rate mismatch: %d\n", |
num_key_frames_, perc_key_frame_size_mismatch); |
- EXPECT_LE(perc_key_frame_size_mismatch, |
- rc_expected.max_key_frame_size_mismatch); |
+ if (rc_threshold) { |
+ EXPECT_LE(perc_key_frame_size_mismatch, |
+ rc_threshold->max_key_frame_size_mismatch); |
+ } |
} |
const int num_temporal_layers = |
@@ -358,20 +403,22 @@ class VideoProcessorIntegrationTest : public testing::Test { |
i, bitrate_layer_[i], framerate_layer_[i], per_frame_bandwidth_[i], |
encoding_bitrate_[i], perc_frame_size_mismatch, |
perc_encoding_rate_mismatch, num_frames_per_update_[i]); |
- EXPECT_LE(perc_frame_size_mismatch, |
- rc_expected.max_delta_frame_size_mismatch); |
- EXPECT_LE(perc_encoding_rate_mismatch, |
- rc_expected.max_encoding_rate_mismatch); |
+ if (rc_threshold) { |
+ EXPECT_LE(perc_frame_size_mismatch, |
+ rc_threshold->max_delta_frame_size_mismatch); |
+ EXPECT_LE(perc_encoding_rate_mismatch, |
+ rc_threshold->max_encoding_rate_mismatch); |
+ } |
} |
printf("\n"); |
- EXPECT_LE(num_frames_to_hit_target_, rc_expected.max_time_hit_target); |
- EXPECT_LE(num_dropped_frames, rc_expected.max_num_dropped_frames); |
- if (rc_expected.num_spatial_resizes >= 0) { |
- EXPECT_EQ(rc_expected.num_spatial_resizes, num_resize_actions); |
- } |
- if (rc_expected.num_key_frames >= 0) { |
- EXPECT_EQ(rc_expected.num_key_frames, num_key_frames_); |
+ if (rc_threshold) { |
+ EXPECT_LE(num_frames_to_hit_target_, rc_threshold->max_time_hit_target); |
+ EXPECT_LE(num_dropped_frames[rate_update_index], |
+ rc_threshold->max_num_dropped_frames); |
+ EXPECT_EQ(rc_threshold->num_spatial_resizes, |
+ num_resize_actions[rate_update_index]); |
+ EXPECT_EQ(rc_threshold->num_key_frames, num_key_frames_); |
} |
} |
@@ -384,15 +431,6 @@ class VideoProcessorIntegrationTest : public testing::Test { |
EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); |
} |
- void VerifyQpParser(int frame_number) { |
- if (!config_.hw_codec && |
- (config_.codec_settings.codecType == kVideoCodecVP8 || |
- config_.codec_settings.codecType == kVideoCodecVP9)) { |
- EXPECT_EQ(processor_->GetQpFromEncoder(frame_number), |
- processor_->GetQpFromBitstream(frame_number)); |
- } |
- } |
- |
static int NumberOfTemporalLayers(const VideoCodec& codec_settings) { |
if (codec_settings.codecType == kVideoCodecVP8) { |
return codec_settings.VP8().numberOfTemporalLayers; |
@@ -436,8 +474,10 @@ class VideoProcessorIntegrationTest : public testing::Test { |
return tl_idx; |
} |
- // Set the bit rate and frame rate per temporal layer, for up to 3 layers. |
- void SetTemporalLayerRates() { |
+ void UpdateRates(int rate_update_index, const RateProfile& rate_profile) { |
+ bitrate_kbps_ = rate_profile.target_bit_rate[rate_update_index]; |
+ framerate_ = rate_profile.input_frame_rate[rate_update_index]; |
+ |
const int num_temporal_layers = |
NumberOfTemporalLayers(config_.codec_settings); |
RTC_DCHECK_LE(num_temporal_layers, kMaxNumTemporalLayers); |
@@ -460,112 +500,139 @@ class VideoProcessorIntegrationTest : public testing::Test { |
} |
// Processes all frames in the clip and verifies the result. |
- // TODO(brandtr): Change the second last argument to be a |
- // const std::vector<RateControlThresholds>&, so we can ensure that the user |
- // does not expect us to do mid-clip rate updates when we are not able to, |
- // e.g., when we are operating in batch mode. |
- void ProcessFramesAndVerify(const QualityThresholds& quality_thresholds, |
- const RateProfile& rate_profile, |
- RateControlThresholds* rc_thresholds, |
- const VisualizationParams* visualization_params) { |
- config_.codec_settings.startBitrate = rate_profile.target_bit_rate[0]; |
- SetUpObjects(visualization_params, rate_profile.target_bit_rate[0], |
- rate_profile.input_frame_rate[0]); |
+ void ProcessFramesAndMaybeVerify( |
+ const RateProfile& rate_profile, |
+ const std::vector<RateControlThresholds>* rc_thresholds, |
+ const QualityThresholds* quality_thresholds, |
+ const VisualizationParams* visualization_params) { |
+ // The Android HW codec needs to be run on a task queue, so we simply always |
+ // run the test on a task queue. |
+ rtc::TaskQueue task_queue("VidProc TQ"); |
+ rtc::Event sync_event(false, false); |
+ |
+ SetUpAndInitObjects(&task_queue, rate_profile.target_bit_rate[0], |
+ rate_profile.input_frame_rate[0], visualization_params); |
// Set initial rates. |
- bitrate_kbps_ = rate_profile.target_bit_rate[0]; |
- framerate_ = rate_profile.input_frame_rate[0]; |
- SetTemporalLayerRates(); |
- // Set the initial target size for key frame. |
- target_size_key_frame_initial_ = |
- 0.5 * kInitialBufferSize * bitrate_layer_[0]; |
- processor_->SetRates(bitrate_kbps_, framerate_); |
+ int rate_update_index = 0; |
+ task_queue.PostTask([this, &rate_profile, rate_update_index] { |
+ processor_->SetRates(rate_profile.target_bit_rate[rate_update_index], |
+ rate_profile.input_frame_rate[rate_update_index]); |
+ }); |
- // Process each frame, up to |num_frames|. |
+ // Process all frames. |
int frame_number = 0; |
- int update_index = 0; |
- int num_frames = rate_profile.num_frames; |
- ResetRateControlMetrics( |
- rate_profile.frame_index_rate_update[update_index + 1]); |
- |
- if (config_.batch_mode) { |
- // In batch mode, we calculate the metrics for all frames after all frames |
- // have been sent for encoding. |
- |
- // TODO(brandtr): Refactor "frame number accounting" so we don't have to |
- // call ProcessFrame num_frames+1 times here. |
- for (frame_number = 0; frame_number <= num_frames; ++frame_number) { |
- processor_->ProcessFrame(frame_number); |
+ const int num_frames = rate_profile.num_frames; |
+ RTC_DCHECK_GE(num_frames, 1); |
+ while (frame_number < num_frames) { |
+ // In order to not overwhelm the OpenMAX buffers in the Android |
+ // MediaCodec API, we roughly pace the frames here. The downside |
+ // of this is that the encode run will be done in real-time. |
+ // TODO(brandtr): Investigate if this is needed on iOS. |
+ if (config_.hw_codec) { |
+ SleepMs(rtc::kNumMillisecsPerSec / |
+ rate_profile.input_frame_rate[rate_update_index]); |
} |
- for (frame_number = 0; frame_number < num_frames; ++frame_number) { |
- const int tl_idx = TemporalLayerIndexForFrame(frame_number); |
- ++num_frames_per_update_[tl_idx]; |
- ++num_frames_total_; |
- UpdateRateControlMetrics(frame_number); |
- } |
- } else { |
- // In online mode, we calculate the metrics for a given frame right after |
- // it has been sent for encoding. |
+ task_queue.PostTask( |
+ [this, frame_number] { processor_->ProcessFrame(frame_number); }); |
+ ++frame_number; |
- if (config_.hw_codec) { |
- LOG(LS_WARNING) << "HW codecs should mostly be run in batch mode, " |
- "since they may be pipelining."; |
- } |
+ if (frame_number == |
+ rate_profile.frame_index_rate_update[rate_update_index + 1]) { |
+ ++rate_update_index; |
- while (frame_number < num_frames) { |
- processor_->ProcessFrame(frame_number); |
- VerifyQpParser(frame_number); |
- const int tl_idx = TemporalLayerIndexForFrame(frame_number); |
- ++num_frames_per_update_[tl_idx]; |
- ++num_frames_total_; |
- UpdateRateControlMetrics(frame_number); |
- |
- ++frame_number; |
- |
- // If we hit another/next update, verify stats for current state and |
- // update layers and codec with new rates. |
- if (frame_number == |
- rate_profile.frame_index_rate_update[update_index + 1]) { |
- VerifyRateControlMetrics(update_index, rc_thresholds[update_index]); |
- |
- // Update layer rates and the codec with new rates. |
- ++update_index; |
- bitrate_kbps_ = rate_profile.target_bit_rate[update_index]; |
- framerate_ = rate_profile.input_frame_rate[update_index]; |
- SetTemporalLayerRates(); |
- ResetRateControlMetrics( |
- rate_profile.frame_index_rate_update[update_index + 1]); |
- processor_->SetRates(bitrate_kbps_, framerate_); |
- } |
+ task_queue.PostTask([this, &rate_profile, rate_update_index] { |
+ processor_->SetRates( |
+ rate_profile.target_bit_rate[rate_update_index], |
+ rate_profile.input_frame_rate[rate_update_index]); |
+ }); |
} |
- // TODO(brandtr): Refactor "frame number accounting" so we don't have to |
- // call ProcessFrame one extra time here. |
- processor_->ProcessFrame(frame_number); |
} |
- // Verify rate control metrics for all frames (if in batch mode), or for all |
- // frames since the last rate update (if not in batch mode). |
- VerifyRateControlMetrics(update_index, rc_thresholds[update_index]); |
- EXPECT_EQ(num_frames, frame_number); |
- EXPECT_EQ(num_frames + 1, static_cast<int>(stats_.stats_.size())); |
- |
- // Release encoder and decoder to make sure they have finished processing. |
- processor_->Release(); |
- DestroyEncoderAndDecoder(); |
+ // TODO(brandtr): Verify the assumption that HW codecs never |
+ // drop frames internally. |
+ if (config_.hw_codec) { |
+ // Ensure that all the frames have been encoded and decoded. |
+ int last_decoded_frame_num = -1; |
+ int wait_count = 0; |
+ while (last_decoded_frame_num != (num_frames - 1) && wait_count++ < 10) { |
+ sync_event.Reset(); |
+ task_queue.PostTask([this, &last_decoded_frame_num, &sync_event]() { |
+ last_decoded_frame_num = processor_->LastDecodedFrameNumber(); |
+ sync_event.Set(); |
+ }); |
+ sync_event.Wait(rtc::Event::kForever); |
+ |
+ SleepMs(1000); |
+ } |
+ EXPECT_LT(wait_count, 10) << "Lost frames in the VideoProcessor."; |
+ } |
- // Close the analysis files before we use them for SSIM/PSNR calculations. |
- analysis_frame_reader_->Close(); |
- analysis_frame_writer_->Close(); |
+ ReleaseAndCloseObjects(&task_queue); |
- // Close visualization files. |
- if (encoded_frame_writer_) { |
- EXPECT_TRUE(encoded_frame_writer_->Close()); |
+ // Verify QP parsing. |
+ // TODO(brandtr): This verification is somewhat orthogonal to the rest of |
+ // this test, which is focused on measuring image quality and rate control |
+ // quality. We should create a whole separate test that verifies the QP |
+ // parsing. This could be done by instantiating a VideoProcessor, encoding |
+ // a number of frames, and then verifying the parsing. |
+ if (!config_.hw_codec && |
+ (config_.codec_settings.codecType == kVideoCodecVP8 || |
+ config_.codec_settings.codecType == kVideoCodecVP9)) { |
+ for (int frame_number = 0; frame_number < num_frames; ++frame_number) { |
+ task_queue.PostTask([this, frame_number] { |
+ EXPECT_EQ(processor_->GetQpFromEncoder(frame_number), |
+ processor_->GetQpFromBitstream(frame_number)); |
+ }); |
+ } |
} |
- if (decoded_frame_writer_) { |
- decoded_frame_writer_->Close(); |
+ |
+ // Calculate and print rate control statistics. |
+ rate_update_index = 0; |
+ frame_number = 0; |
+ UpdateRates(rate_update_index, rate_profile); |
+ ResetRateControlMetrics( |
+ rate_profile.frame_index_rate_update[rate_update_index + 1]); |
+ target_size_key_frame_initial_ = |
+ 0.5 * kInitialBufferSize * bitrate_layer_[0]; |
+ std::vector<int> num_dropped_frames; |
+ std::vector<int> num_resize_actions; |
+ sync_event.Reset(); |
+ task_queue.PostTask( |
+ [this, &num_dropped_frames, &num_resize_actions, &sync_event]() { |
+ num_dropped_frames = processor_->NumberDroppedFramesPerRateUpdate(); |
+ num_resize_actions = processor_->NumberSpatialResizesPerRateUpdate(); |
+ sync_event.Set(); |
+ }); |
+ sync_event.Wait(rtc::Event::kForever); |
+ while (frame_number < num_frames) { |
+ ++num_frames_per_update_[TemporalLayerIndexForFrame(frame_number)]; |
+ ++num_frames_total_; |
+ UpdateRateControlMetrics(frame_number); |
+ |
+ ++frame_number; |
+ |
+ if (frame_number == |
+ rate_profile.frame_index_rate_update[rate_update_index + 1]) { |
+ PrintAndMaybeVerifyRateControlMetrics(rate_update_index, rc_thresholds, |
+ num_dropped_frames, |
+ num_resize_actions); |
+ ++rate_update_index; |
+ UpdateRates(rate_update_index, rate_profile); |
+ ResetRateControlMetrics( |
+ rate_profile.frame_index_rate_update[rate_update_index + 1]); |
+ } |
} |
+ PrintAndMaybeVerifyRateControlMetrics(rate_update_index, rc_thresholds, |
+ num_dropped_frames, |
+ num_resize_actions); |
+ // Calculate and print other statistics. |
+ EXPECT_EQ(num_frames, static_cast<int>(stats_.stats_.size())); |
+ stats_.PrintSummary(); |
+ |
+ // Calculate and print image quality statistics. |
// TODO(marpan): Should compute these quality metrics per SetRates update. |
QualityMetricsResult psnr_result, ssim_result; |
EXPECT_EQ(0, I420MetricsFromFiles(config_.input_filename.c_str(), |
@@ -573,8 +640,9 @@ class VideoProcessorIntegrationTest : public testing::Test { |
config_.codec_settings.width, |
config_.codec_settings.height, |
&psnr_result, &ssim_result)); |
- VerifyQuality(psnr_result, ssim_result, quality_thresholds); |
- stats_.PrintSummary(); |
+ if (quality_thresholds) { |
+ VerifyQuality(psnr_result, ssim_result, *quality_thresholds); |
+ } |
printf("PSNR avg: %f, min: %f\nSSIM avg: %f, min: %f\n", |
psnr_result.average, psnr_result.min, ssim_result.average, |
ssim_result.min); |
@@ -591,8 +659,7 @@ class VideoProcessorIntegrationTest : public testing::Test { |
bool use_single_core, |
float packet_loss_probability, |
std::string filename, |
- bool verbose_logging, |
- bool batch_mode) { |
+ bool verbose_logging) { |
config->filename = filename; |
config->input_filename = ResourcePath(filename, "yuv"); |
// Generate an output filename in a safe way. |
@@ -602,7 +669,6 @@ class VideoProcessorIntegrationTest : public testing::Test { |
config->use_single_core = use_single_core; |
config->verbose = verbose_logging; |
config->hw_codec = hw_codec; |
- config->batch_mode = batch_mode; |
} |
static void SetCodecSettings(TestConfig* config, |
@@ -663,25 +729,26 @@ class VideoProcessorIntegrationTest : public testing::Test { |
frame_index_rate_update; |
} |
- static void SetRateControlThresholds(RateControlThresholds* rc_thresholds, |
- int update_index, |
- int max_num_dropped_frames, |
- int max_key_frame_size_mismatch, |
- int max_delta_frame_size_mismatch, |
- int max_encoding_rate_mismatch, |
- int max_time_hit_target, |
- int num_spatial_resizes, |
- int num_key_frames) { |
- rc_thresholds[update_index].max_num_dropped_frames = max_num_dropped_frames; |
- rc_thresholds[update_index].max_key_frame_size_mismatch = |
- max_key_frame_size_mismatch; |
- rc_thresholds[update_index].max_delta_frame_size_mismatch = |
- max_delta_frame_size_mismatch; |
- rc_thresholds[update_index].max_encoding_rate_mismatch = |
- max_encoding_rate_mismatch; |
- rc_thresholds[update_index].max_time_hit_target = max_time_hit_target; |
- rc_thresholds[update_index].num_spatial_resizes = num_spatial_resizes; |
- rc_thresholds[update_index].num_key_frames = num_key_frames; |
+ static void AddRateControlThresholds( |
+ int max_num_dropped_frames, |
+ int max_key_frame_size_mismatch, |
+ int max_delta_frame_size_mismatch, |
+ int max_encoding_rate_mismatch, |
+ int max_time_hit_target, |
+ int num_spatial_resizes, |
+ int num_key_frames, |
+ std::vector<RateControlThresholds>* rc_thresholds) { |
+ RTC_DCHECK(rc_thresholds); |
+ |
+ rc_thresholds->emplace_back(); |
+ RateControlThresholds* rc_threshold = &rc_thresholds->back(); |
+ rc_threshold->max_num_dropped_frames = max_num_dropped_frames; |
+ rc_threshold->max_key_frame_size_mismatch = max_key_frame_size_mismatch; |
+ rc_threshold->max_delta_frame_size_mismatch = max_delta_frame_size_mismatch; |
+ rc_threshold->max_encoding_rate_mismatch = max_encoding_rate_mismatch; |
+ rc_threshold->max_time_hit_target = max_time_hit_target; |
+ rc_threshold->num_spatial_resizes = num_spatial_resizes; |
+ rc_threshold->num_key_frames = num_key_frames; |
} |
// Config. |