Use designated initializers for webrtc::SimulcastStream
Style change extracted from https://webrtc-review.googlesource.com/c/src/+/264800 Bug: webrtc:11607 Change-Id: I3dd5ca1eef8d70a61023af37d90032225e40b55d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/267841 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37442}
This commit is contained in:
parent
11fdb08282
commit
39b1b42487
@ -42,33 +42,33 @@ TEST(EncoderSimulcastProxy, ChoosesCorrectImplementation) {
|
||||
"SimulcastEncoderAdapter (Fake, Fake, Fake)";
|
||||
VideoCodec codec_settings;
|
||||
webrtc::test::CodecSettings(kVideoCodecVP8, &codec_settings);
|
||||
codec_settings.simulcastStream[0] = {test::kTestWidth,
|
||||
test::kTestHeight,
|
||||
test::kTestFrameRate,
|
||||
2,
|
||||
2000,
|
||||
1000,
|
||||
1000,
|
||||
56,
|
||||
true};
|
||||
codec_settings.simulcastStream[1] = {test::kTestWidth,
|
||||
test::kTestHeight,
|
||||
test::kTestFrameRate,
|
||||
2,
|
||||
3000,
|
||||
1000,
|
||||
1000,
|
||||
56,
|
||||
true};
|
||||
codec_settings.simulcastStream[2] = {test::kTestWidth,
|
||||
test::kTestHeight,
|
||||
test::kTestFrameRate,
|
||||
2,
|
||||
5000,
|
||||
1000,
|
||||
1000,
|
||||
56,
|
||||
true};
|
||||
codec_settings.simulcastStream[0] = {.width = test::kTestWidth,
|
||||
.height = test::kTestHeight,
|
||||
.maxFramerate = test::kTestFrameRate,
|
||||
.numberOfTemporalLayers = 2,
|
||||
.maxBitrate = 2000,
|
||||
.targetBitrate = 1000,
|
||||
.minBitrate = 1000,
|
||||
.qpMax = 56,
|
||||
.active = true};
|
||||
codec_settings.simulcastStream[1] = {.width = test::kTestWidth,
|
||||
.height = test::kTestHeight,
|
||||
.maxFramerate = test::kTestFrameRate,
|
||||
.numberOfTemporalLayers = 2,
|
||||
.maxBitrate = 3000,
|
||||
.targetBitrate = 1000,
|
||||
.minBitrate = 1000,
|
||||
.qpMax = 56,
|
||||
.active = true};
|
||||
codec_settings.simulcastStream[2] = {.width = test::kTestWidth,
|
||||
.height = test::kTestHeight,
|
||||
.maxFramerate = test::kTestFrameRate,
|
||||
.numberOfTemporalLayers = 2,
|
||||
.maxBitrate = 5000,
|
||||
.targetBitrate = 1000,
|
||||
.minBitrate = 1000,
|
||||
.qpMax = 56,
|
||||
.active = true};
|
||||
codec_settings.numberOfSimulcastStreams = 3;
|
||||
|
||||
auto mock_encoder = std::make_unique<NiceMock<MockVideoEncoder>>();
|
||||
|
||||
@ -294,67 +294,187 @@ TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) {
|
||||
TEST_F(TestVp8Impl, ChecksSimulcastSettings) {
|
||||
codec_settings_.numberOfSimulcastStreams = 2;
|
||||
// Resolutions are not in ascending order, temporal layers do not match.
|
||||
codec_settings_.simulcastStream[0] = {kWidth, kHeight, kFramerateFps, 2,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[1] = {kWidth / 2, kHeight / 2, 30, 3,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[0] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 2,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[1] = {.width = kWidth / 2,
|
||||
.height = kHeight / 2,
|
||||
.maxFramerate = 30,
|
||||
.numberOfTemporalLayers = 3,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED,
|
||||
encoder_->InitEncode(&codec_settings_, kSettings));
|
||||
codec_settings_.numberOfSimulcastStreams = 3;
|
||||
// Resolutions are not in ascending order.
|
||||
codec_settings_.simulcastStream[0] = {
|
||||
kWidth / 2, kHeight / 2, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[1] = {
|
||||
kWidth / 2 - 1, kHeight / 2 - 1, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[2] = {kWidth, kHeight, 30, 1,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[0] = {.width = kWidth / 2,
|
||||
.height = kHeight / 2,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[1] = {.width = kWidth / 2 - 1,
|
||||
.height = kHeight / 2 - 1,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[2] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = 30,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED,
|
||||
encoder_->InitEncode(&codec_settings_, kSettings));
|
||||
// Resolutions are not in ascending order.
|
||||
codec_settings_.simulcastStream[0] = {kWidth, kHeight, kFramerateFps, 1,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[1] = {kWidth, kHeight, kFramerateFps, 1,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[2] = {
|
||||
kWidth - 1, kHeight - 1, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[0] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[1] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[2] = {.width = kWidth - 1,
|
||||
.height = kHeight - 1,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED,
|
||||
encoder_->InitEncode(&codec_settings_, kSettings));
|
||||
// Temporal layers do not match.
|
||||
codec_settings_.simulcastStream[0] = {
|
||||
kWidth / 4, kHeight / 4, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[1] = {
|
||||
kWidth / 2, kHeight / 2, kFramerateFps, 2, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[2] = {kWidth, kHeight, kFramerateFps, 3,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[0] = {.width = kWidth / 4,
|
||||
.height = kHeight / 4,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[1] = {.width = kWidth / 2,
|
||||
.height = kHeight / 2,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 2,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[2] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 3,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED,
|
||||
encoder_->InitEncode(&codec_settings_, kSettings));
|
||||
// Resolutions do not match codec config.
|
||||
codec_settings_.simulcastStream[0] = {
|
||||
kWidth / 4 + 1, kHeight / 4 + 1, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[1] = {
|
||||
kWidth / 2 + 2, kHeight / 2 + 2, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[2] = {
|
||||
kWidth + 4, kHeight + 4, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[0] = {.width = kWidth / 4 + 1,
|
||||
.height = kHeight / 4 + 1,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[1] = {.width = kWidth / 2 + 2,
|
||||
.height = kHeight / 2 + 2,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[2] = {.width = kWidth + 4,
|
||||
.height = kHeight + 4,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED,
|
||||
encoder_->InitEncode(&codec_settings_, kSettings));
|
||||
// Everything fine: scaling by 2, top resolution matches video, temporal
|
||||
// settings are the same for all layers.
|
||||
codec_settings_.simulcastStream[0] = {
|
||||
kWidth / 4, kHeight / 4, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[1] = {
|
||||
kWidth / 2, kHeight / 2, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[2] = {kWidth, kHeight, kFramerateFps, 1,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[0] = {.width = kWidth / 4,
|
||||
.height = kHeight / 4,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[1] = {.width = kWidth / 2,
|
||||
.height = kHeight / 2,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[2] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder_->InitEncode(&codec_settings_, kSettings));
|
||||
// Everything fine: custom scaling, top resolution matches video, temporal
|
||||
// settings are the same for all layers.
|
||||
codec_settings_.simulcastStream[0] = {
|
||||
kWidth / 4, kHeight / 4, kFramerateFps, 1, 4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[1] = {kWidth, kHeight, kFramerateFps, 1,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[2] = {kWidth, kHeight, kFramerateFps, 1,
|
||||
4000, 3000, 2000, 80};
|
||||
codec_settings_.simulcastStream[0] = {.width = kWidth / 4,
|
||||
.height = kHeight / 4,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[1] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
codec_settings_.simulcastStream[2] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80};
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder_->InitEncode(&codec_settings_, kSettings));
|
||||
}
|
||||
@ -727,12 +847,33 @@ TEST_P(TestVp8ImplForPixelFormat, EncodeNativeFrameSimulcast) {
|
||||
|
||||
// Configure simulcast.
|
||||
codec_settings_.numberOfSimulcastStreams = 3;
|
||||
codec_settings_.simulcastStream[0] = {
|
||||
kWidth / 4, kHeight / 4, kFramerateFps, 1, 4000, 3000, 2000, 80, true};
|
||||
codec_settings_.simulcastStream[1] = {
|
||||
kWidth / 2, kHeight / 2, kFramerateFps, 1, 4000, 3000, 2000, 80, true};
|
||||
codec_settings_.simulcastStream[2] = {
|
||||
kWidth, kHeight, kFramerateFps, 1, 4000, 3000, 2000, 80, true};
|
||||
codec_settings_.simulcastStream[0] = {.width = kWidth / 4,
|
||||
.height = kHeight / 4,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80,
|
||||
.active = true};
|
||||
codec_settings_.simulcastStream[1] = {.width = kWidth / 2,
|
||||
.height = kHeight / 2,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80,
|
||||
.active = true};
|
||||
codec_settings_.simulcastStream[2] = {.width = kWidth,
|
||||
.height = kHeight,
|
||||
.maxFramerate = kFramerateFps,
|
||||
.numberOfTemporalLayers = 1,
|
||||
.maxBitrate = 4000,
|
||||
.targetBitrate = 3000,
|
||||
.minBitrate = 2000,
|
||||
.qpMax = 80,
|
||||
.active = true};
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder_->InitEncode(&codec_settings_, kSettings));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user