Set field trials via command line

Also fix an issue with accessing an unset optional.

Bug: webrtc:14852
Change-Id: I45da8c6add87ac562c3c3f3d11c0021244927f8d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/337580
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41716}
This commit is contained in:
Sergey Silkin 2024-02-02 17:20:34 +01:00 committed by WebRTC LUCI CQ
parent 407367d053
commit 1b5f47f2d3
3 changed files with 9 additions and 2 deletions

View File

@ -1014,6 +1014,7 @@ if (rtc_include_tests) {
"../../modules/video_coding/svc:scalability_mode_util",
"../../rtc_base:logging",
"../../rtc_base:stringutils",
"../../test:explicit_key_value_config",
"../../test:fileutils",
"../../test:test_flags",
"../../test:test_main",

View File

@ -28,6 +28,7 @@
#include "modules/video_coding/svc/scalability_mode_util.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
#include "test/explicit_key_value_config.h"
#include "test/gtest.h"
#include "test/test_flags.h"
#include "test/testsupport/file_utils.h"
@ -60,6 +61,7 @@ ABSL_FLAG(double,
30.0,
"Encode target frame rate of the top temporal layer in fps.");
ABSL_FLAG(int, num_frames, 300, "Number of frames to encode and/or decode.");
ABSL_FLAG(std::string, field_trials, "", "Field trials to apply.");
ABSL_FLAG(std::string, test_name, "", "Test name.");
ABSL_FLAG(bool, dump_decoder_input, false, "Dump decoder input.");
ABSL_FLAG(bool, dump_decoder_output, false, "Dump decoder output.");
@ -531,7 +533,10 @@ INSTANTIATE_TEST_SUITE_P(
FramerateAdaptationTest::TestParamsToString);
TEST(VideoCodecTest, DISABLED_EncodeDecode) {
const Environment env = CreateEnvironment();
const Environment env =
CreateEnvironment(std::make_unique<ExplicitKeyValueConfig>(
absl::GetFlag(FLAGS_field_trials)));
std::vector<std::string> bitrate_str = absl::GetFlag(FLAGS_bitrate_kbps);
std::vector<int> bitrate_kbps;
std::transform(bitrate_str.begin(), bitrate_str.end(),

View File

@ -985,7 +985,8 @@ class Encoder : public EncodedImageCallback {
// layer >X receive encoded lower layers.
int num_spatial_layers =
ScalabilityModeToNumSpatialLayers(last_superframe_->scalability_mode);
for (int sidx = *last_superframe_->encoded_frame.SpatialIndex() + 1;
for (int sidx =
last_superframe_->encoded_frame.SpatialIndex().value_or(0) + 1;
sidx < num_spatial_layers; ++sidx) {
last_superframe_->encoded_frame.SetSpatialIndex(sidx);
DeliverEncodedFrame(last_superframe_->encoded_frame);