mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Add --screencast and --frame_drop flags to EncodeDecode test
Bug: b/42225151, b/337757868 Change-Id: I78c053cb47961ff86c001be3150dc1efb13870af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349481 Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42218}
This commit is contained in:
parent
e1607ed3a6
commit
8410b6e9e6
3 changed files with 25 additions and 8 deletions
|
@ -61,6 +61,8 @@ ABSL_FLAG(double,
|
|||
framerate_fps,
|
||||
30.0,
|
||||
"Encode target frame rate of the top temporal layer in fps.");
|
||||
ABSL_FLAG(bool, screencast, false, "Enable screen encoding mode.");
|
||||
ABSL_FLAG(bool, frame_drop, true, "Enable frame dropping.");
|
||||
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.");
|
||||
|
@ -549,12 +551,18 @@ TEST(VideoCodecTest, DISABLED_EncodeDecode) {
|
|||
std::back_inserter(bitrate_kbps),
|
||||
[](const std::string& str) { return std::stoi(str); });
|
||||
|
||||
VideoCodecMode content_type = absl::GetFlag(FLAGS_screencast)
|
||||
? VideoCodecMode::kScreensharing
|
||||
: VideoCodecMode::kRealtimeVideo;
|
||||
|
||||
std::map<uint32_t, EncodingSettings> frames_settings =
|
||||
VideoCodecTester::CreateEncodingSettings(
|
||||
CodecNameToCodecType(absl::GetFlag(FLAGS_encoder)),
|
||||
absl::GetFlag(FLAGS_scalability_mode), absl::GetFlag(FLAGS_width),
|
||||
absl::GetFlag(FLAGS_height), {bitrate_kbps},
|
||||
absl::GetFlag(FLAGS_framerate_fps), absl::GetFlag(FLAGS_num_frames));
|
||||
absl::GetFlag(FLAGS_framerate_fps), absl::GetFlag(FLAGS_num_frames),
|
||||
/*first_timestamp_rtp=*/90000, content_type,
|
||||
absl::GetFlag(FLAGS_frame_drop));
|
||||
|
||||
// TODO(webrtc:14852): Pass encoder and decoder names directly, and update
|
||||
// logged test name (implies lossing history in the chromeperf dashboard).
|
||||
|
|
|
@ -1046,8 +1046,8 @@ class Encoder : public EncodedImageCallback {
|
|||
vc.maxFramerate = top_layer_settings.framerate.hertz<uint32_t>();
|
||||
vc.active = true;
|
||||
vc.numberOfSimulcastStreams = 0;
|
||||
vc.mode = webrtc::VideoCodecMode::kRealtimeVideo;
|
||||
vc.SetFrameDropEnabled(true);
|
||||
vc.mode = es.content_type;
|
||||
vc.SetFrameDropEnabled(es.frame_drop);
|
||||
vc.SetScalabilityMode(es.scalability_mode);
|
||||
vc.SetVideoEncoderComplexity(VideoCodecComplexity::kComplexityNormal);
|
||||
|
||||
|
@ -1297,7 +1297,8 @@ SplitBitrateAndUpdateScalabilityMode(std::string codec_type,
|
|||
int width,
|
||||
int height,
|
||||
std::vector<int> bitrates_kbps,
|
||||
double framerate_fps) {
|
||||
double framerate_fps,
|
||||
VideoCodecMode content_type) {
|
||||
int num_spatial_layers = ScalabilityModeToNumSpatialLayers(scalability_mode);
|
||||
int num_temporal_layers =
|
||||
ScalabilityModeToNumTemporalLayers(scalability_mode);
|
||||
|
@ -1326,7 +1327,7 @@ SplitBitrateAndUpdateScalabilityMode(std::string codec_type,
|
|||
vc.minBitrate = 0;
|
||||
vc.maxFramerate = static_cast<uint32_t>(framerate_fps);
|
||||
vc.numberOfSimulcastStreams = 0;
|
||||
vc.mode = webrtc::VideoCodecMode::kRealtimeVideo;
|
||||
vc.mode = content_type;
|
||||
vc.SetScalabilityMode(scalability_mode);
|
||||
SetDefaultCodecSpecificSettings(&vc, num_temporal_layers);
|
||||
|
||||
|
@ -1489,11 +1490,13 @@ std::map<uint32_t, EncodingSettings> VideoCodecTester::CreateEncodingSettings(
|
|||
std::vector<int> layer_bitrates_kbps,
|
||||
double framerate_fps,
|
||||
int num_frames,
|
||||
uint32_t first_timestamp_rtp) {
|
||||
uint32_t first_timestamp_rtp,
|
||||
webrtc::VideoCodecMode content_type,
|
||||
bool frame_drop) {
|
||||
auto [layer_bitrates, scalability_mode] =
|
||||
SplitBitrateAndUpdateScalabilityMode(
|
||||
codec_type, *ScalabilityModeFromString(scalability_name), width,
|
||||
height, layer_bitrates_kbps, framerate_fps);
|
||||
height, layer_bitrates_kbps, framerate_fps, content_type);
|
||||
|
||||
int num_spatial_layers = ScalabilityModeToNumSpatialLayers(scalability_mode);
|
||||
int num_temporal_layers =
|
||||
|
@ -1532,6 +1535,8 @@ std::map<uint32_t, EncodingSettings> VideoCodecTester::CreateEncodingSettings(
|
|||
frames_settings.emplace(
|
||||
timestamp_rtp, EncodingSettings{.sdp_video_format = sdp_video_format,
|
||||
.scalability_mode = scalability_mode,
|
||||
.content_type = content_type,
|
||||
.frame_drop = frame_drop,
|
||||
.layers_settings = layers_settings});
|
||||
|
||||
timestamp_rtp += k90kHz / Frequency::MilliHertz(1000 * framerate_fps);
|
||||
|
|
|
@ -51,6 +51,8 @@ class VideoCodecTester {
|
|||
struct EncodingSettings {
|
||||
SdpVideoFormat sdp_video_format = SdpVideoFormat::VP8();
|
||||
ScalabilityMode scalability_mode = ScalabilityMode::kL1T1;
|
||||
VideoCodecMode content_type = VideoCodecMode::kRealtimeVideo;
|
||||
bool frame_drop = true;
|
||||
|
||||
struct LayerSettings {
|
||||
Resolution resolution;
|
||||
|
@ -196,7 +198,9 @@ class VideoCodecTester {
|
|||
std::vector<int> bitrates_kbps,
|
||||
double framerate_fps,
|
||||
int num_frames,
|
||||
uint32_t first_timestamp_rtp = 90000);
|
||||
uint32_t first_timestamp_rtp = 90000,
|
||||
VideoCodecMode content_type = VideoCodecMode::kRealtimeVideo,
|
||||
bool frame_drop = true);
|
||||
|
||||
// Decodes video, collects and returns decode metrics.
|
||||
static std::unique_ptr<VideoCodecStats> RunDecodeTest(
|
||||
|
|
Loading…
Reference in a new issue