Add tests for Vp9 temporal layers to VideoSendStreamTest

Including config via scalability mode.

Bug: webrtc:11607
Change-Id: I6c6737614d7c121b0a428584f41535ea8abc5866
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264831
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37165}
This commit is contained in:
Niels Möller
2022-06-09 15:05:47 +02:00
committed by WebRTC LUCI CQ
parent f65d735e7d
commit fd0f6b9bf5
2 changed files with 19 additions and 1 deletions

View File

@ -994,6 +994,7 @@ if (rtc_include_tests) {
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/functional:bind_front",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/abseil-cpp/absl/types:variant",
]

View File

@ -12,6 +12,7 @@
#include <vector>
#include "absl/algorithm/container.h"
#include "absl/strings/match.h"
#include "api/sequence_checker.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/task_queue/task_queue_base.h"
@ -4029,7 +4030,11 @@ void VideoSendStreamTest::TestTemporalLayers(
payload_name_, /*max_qp=*/56, /*is_screenshare=*/false,
/*conference_mode=*/false);
encoder_config->max_bitrate_bps = kMaxBitrateBps;
if (absl::EqualsIgnoreCase(payload_name_, "VP9")) {
encoder_config->encoder_specific_settings = rtc::make_ref_counted<
VideoEncoderConfig::Vp9EncoderSpecificSettings>(
VideoEncoder::GetDefaultVp9Settings());
}
if (scalability_mode_.empty()) {
for (size_t i = 0; i < num_temporal_layers_.size(); ++i) {
VideoStream& stream = encoder_config->simulcast_layers[i];
@ -4073,6 +4078,9 @@ void VideoSendStreamTest::TestTemporalLayers(
if (const auto* vp8_header = absl::get_if<RTPVideoHeaderVP8>(
&parsed_payload->video_header.video_type_header)) {
parsed.temporal_idx = vp8_header->temporalIdx;
} else if (const auto* vp9_header = absl::get_if<RTPVideoHeaderVP9>(
&parsed_payload->video_header.video_type_header)) {
parsed.temporal_idx = vp9_header->temporal_idx;
} else {
RTC_DCHECK_NOTREACHED();
}
@ -4238,4 +4246,13 @@ TEST_F(VideoSendStreamTest, TestScalabilityModeVp8SimulcastWithoutSimAdapter) {
{ScalabilityMode::kL1T2, ScalabilityMode::kL1T2});
}
TEST_F(VideoSendStreamTest, TestTemporalLayersVp9) {
test::FunctionVideoEncoderFactory encoder_factory(
[]() { return VP9Encoder::Create(); });
TestTemporalLayers(&encoder_factory, "VP9",
/*num_temporal_layers=*/{2},
/*scalability_mode=*/{});
}
} // namespace webrtc