Remove use of SetEncodingDataInternal in MediaOptimization.
Add method FilenameWithParams to TestConfig. Bug: none Change-Id: I9f683e661537148dc01bee25f7510938fa656dc5 Reviewed-on: https://webrtc-review.googlesource.com/21382 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Commit-Queue: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20651}
This commit is contained in:
@ -193,5 +193,11 @@ std::string TestConfig::CodecName() const {
|
||||
return codec_name;
|
||||
}
|
||||
|
||||
std::string TestConfig::FilenameWithParams() const {
|
||||
std::string implementation_type = hw_encoder ? "hw" : "sw";
|
||||
return filename + "_" + CodecName() + "_" + implementation_type + "_" +
|
||||
std::to_string(codec_settings.startBitrate);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
@ -57,6 +57,7 @@ struct TestConfig {
|
||||
std::vector<FrameType> FrameTypeForFrame(int frame_idx) const;
|
||||
std::string ToString() const;
|
||||
std::string CodecName() const;
|
||||
std::string FilenameWithParams() const;
|
||||
|
||||
// Plain name of YUV file to process without file extension.
|
||||
std::string filename;
|
||||
|
||||
@ -149,5 +149,14 @@ TEST(TestConfig, ToString_Vp8) {
|
||||
config.ToString());
|
||||
}
|
||||
|
||||
TEST(TestConfig, FilenameWithParams) {
|
||||
TestConfig config;
|
||||
config.filename = "filename";
|
||||
webrtc::test::CodecSettings(kVideoCodecVP8, &config.codec_settings);
|
||||
config.hw_encoder = true;
|
||||
config.codec_settings.startBitrate = 400;
|
||||
EXPECT_EQ("filename_VP8_hw_400", config.FilenameWithParams());
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
@ -407,6 +407,10 @@ void VideoProcessorIntegrationTest::SetUpAndInitObjects(
|
||||
const VisualizationParams* visualization_params) {
|
||||
CreateEncoderAndDecoder();
|
||||
|
||||
config_.codec_settings.minBitrate = 0;
|
||||
config_.codec_settings.startBitrate = initial_bitrate_kbps;
|
||||
config_.codec_settings.maxFramerate = initial_framerate_fps;
|
||||
|
||||
// Create file objects for quality analysis.
|
||||
analysis_frame_reader_.reset(new YuvFrameReaderImpl(
|
||||
config_.input_filename, config_.codec_settings.width,
|
||||
@ -418,15 +422,8 @@ void VideoProcessorIntegrationTest::SetUpAndInitObjects(
|
||||
EXPECT_TRUE(analysis_frame_writer_->Init());
|
||||
|
||||
if (visualization_params) {
|
||||
const std::string codec_name =
|
||||
CodecTypeToPayloadString(config_.codec_settings.codecType);
|
||||
const std::string implementation_type = config_.hw_encoder ? "hw" : "sw";
|
||||
// clang-format off
|
||||
const std::string output_filename_base =
|
||||
OutputPath() + config_.filename + "-" +
|
||||
codec_name + "-" + implementation_type + "-" +
|
||||
std::to_string(initial_bitrate_kbps);
|
||||
// clang-format on
|
||||
OutputPath() + config_.FilenameWithParams();
|
||||
if (visualization_params->save_encoded_ivf) {
|
||||
rtc::File post_encode_file =
|
||||
rtc::File::Create(output_filename_base + ".ivf");
|
||||
@ -445,10 +442,6 @@ void VideoProcessorIntegrationTest::SetUpAndInitObjects(
|
||||
packet_manipulator_.reset(new PacketManipulatorImpl(
|
||||
&packet_reader_, config_.networking_config, false));
|
||||
|
||||
config_.codec_settings.minBitrate = 0;
|
||||
config_.codec_settings.startBitrate = initial_bitrate_kbps;
|
||||
config_.codec_settings.maxFramerate = initial_framerate_fps;
|
||||
|
||||
rtc::Event sync_event(false, false);
|
||||
task_queue->PostTask([this, &sync_event]() {
|
||||
processor_ = rtc::MakeUnique<VideoProcessor>(
|
||||
|
||||
@ -35,11 +35,11 @@ MediaOptimization::~MediaOptimization(void) {
|
||||
|
||||
void MediaOptimization::Reset() {
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
SetEncodingDataInternal(0, 0, 0);
|
||||
memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_));
|
||||
incoming_frame_rate_ = 0.0;
|
||||
frame_dropper_->Reset();
|
||||
frame_dropper_->SetRates(0, 0);
|
||||
max_bit_rate_ = 0;
|
||||
max_frame_rate_ = 0;
|
||||
}
|
||||
|
||||
@ -47,14 +47,7 @@ void MediaOptimization::SetEncodingData(int32_t max_bit_rate,
|
||||
uint32_t target_bitrate,
|
||||
uint32_t max_frame_rate) {
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
SetEncodingDataInternal(max_bit_rate, max_frame_rate, target_bitrate);
|
||||
}
|
||||
|
||||
void MediaOptimization::SetEncodingDataInternal(int32_t max_bit_rate,
|
||||
uint32_t max_frame_rate,
|
||||
uint32_t target_bitrate) {
|
||||
// Everything codec specific should be reset here since this means the codec
|
||||
// has changed.
|
||||
// Everything codec specific should be reset here since the codec has changed.
|
||||
max_bit_rate_ = max_bit_rate;
|
||||
max_frame_rate_ = static_cast<float>(max_frame_rate);
|
||||
float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f;
|
||||
@ -70,10 +63,9 @@ uint32_t MediaOptimization::SetTargetRates(uint32_t target_bitrate) {
|
||||
if (max_bit_rate_ > 0 && video_target_bitrate > max_bit_rate_) {
|
||||
video_target_bitrate = max_bit_rate_;
|
||||
}
|
||||
|
||||
// Update encoding rates following protection settings.
|
||||
float target_video_bitrate_kbps =
|
||||
static_cast<float>(video_target_bitrate) / 1000.0f;
|
||||
|
||||
float framerate = incoming_frame_rate_;
|
||||
if (framerate == 0.0) {
|
||||
// No framerate estimate available, use configured max framerate instead.
|
||||
|
||||
@ -62,12 +62,6 @@ class MediaOptimization {
|
||||
void UpdateIncomingFrameRate() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||
void ProcessIncomingFrameRate(int64_t now)
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||
|
||||
void SetEncodingDataInternal(int32_t max_bit_rate,
|
||||
uint32_t max_frame_rate,
|
||||
uint32_t bit_rate)
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||
|
||||
uint32_t InputFrameRateInternal() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||
|
||||
// Protect all members.
|
||||
|
||||
Reference in New Issue
Block a user