Fix vp8 simulcast screenshare and perf tests for it

Simulcast screenshare appears broken due to unrelated changes. It
implicitly relied on SimulcastEncoderAdapter fallback, which happened before
if streams had same resolution. It's not the case anymore. Thus, this CL
adds checks for different frame-rate in simulcast streams.

FullStackTests are also updated to use actual parameters.

Bug: none
Change-Id: I2c1ddb1b39edb96464a0915dfcb9cb4e18844187
Reviewed-on: https://webrtc-review.googlesource.com/c/124494
Reviewed-by: Mirta Dvornicic <mirtad@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26869}
This commit is contained in:
Ilya Nikolaevskiy
2019-02-27 10:00:06 +01:00
committed by Commit Bot
parent 08f6a6c672
commit dda5fdcb82
5 changed files with 32 additions and 30 deletions

View File

@ -211,10 +211,8 @@ int32_t H264EncoderImpl::InitEncode(const VideoCodec* inst,
int number_of_streams = SimulcastUtility::NumberOfSimulcastStreams(*inst); int number_of_streams = SimulcastUtility::NumberOfSimulcastStreams(*inst);
bool doing_simulcast = (number_of_streams > 1); bool doing_simulcast = (number_of_streams > 1);
if (doing_simulcast && (!SimulcastUtility::ValidSimulcastResolutions( if (doing_simulcast &&
*inst, number_of_streams) || !SimulcastUtility::ValidSimulcastParameters(*inst, number_of_streams)) {
!SimulcastUtility::ValidSimulcastTemporalLayers(
*inst, number_of_streams))) {
return WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED; return WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED;
} }
downscaled_buffers_.resize(number_of_streams - 1); downscaled_buffers_.resize(number_of_streams - 1);

View File

@ -338,9 +338,7 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst,
int number_of_streams = SimulcastUtility::NumberOfSimulcastStreams(*inst); int number_of_streams = SimulcastUtility::NumberOfSimulcastStreams(*inst);
if (number_of_streams > 1 && if (number_of_streams > 1 &&
(!SimulcastUtility::ValidSimulcastResolutions(*inst, number_of_streams) || !SimulcastUtility::ValidSimulcastParameters(*inst, number_of_streams)) {
!SimulcastUtility::ValidSimulcastTemporalLayers(*inst,
number_of_streams))) {
return WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED; return WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED;
} }

View File

@ -10,6 +10,8 @@
#include <algorithm> #include <algorithm>
#include <cmath>
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/video_coding/utility/simulcast_utility.h" #include "modules/video_coding/utility/simulcast_utility.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
@ -35,8 +37,9 @@ int SimulcastUtility::NumberOfSimulcastStreams(const VideoCodec& codec) {
return streams; return streams;
} }
bool SimulcastUtility::ValidSimulcastResolutions(const VideoCodec& codec, bool SimulcastUtility::ValidSimulcastParameters(const VideoCodec& codec,
int num_streams) { int num_streams) {
// Check resolution.
if (codec.width != codec.simulcastStream[num_streams - 1].width || if (codec.width != codec.simulcastStream[num_streams - 1].width ||
codec.height != codec.simulcastStream[num_streams - 1].height) { codec.height != codec.simulcastStream[num_streams - 1].height) {
return false; return false;
@ -63,11 +66,16 @@ bool SimulcastUtility::ValidSimulcastResolutions(const VideoCodec& codec,
} }
} }
} }
return true;
}
bool SimulcastUtility::ValidSimulcastTemporalLayers(const VideoCodec& codec, // Check frame-rate.
int num_streams) { for (int i = 1; i < num_streams; ++i) {
if (fabs(codec.simulcastStream[i].maxFramerate -
codec.simulcastStream[i - 1].maxFramerate) > 1e-9) {
return false;
}
}
// Check temporal layers.
for (int i = 0; i < num_streams - 1; ++i) { for (int i = 0; i < num_streams - 1; ++i) {
if (codec.simulcastStream[i].numberOfTemporalLayers != if (codec.simulcastStream[i].numberOfTemporalLayers !=
codec.simulcastStream[i + 1].numberOfTemporalLayers) codec.simulcastStream[i + 1].numberOfTemporalLayers)

View File

@ -21,9 +21,7 @@ class SimulcastUtility {
public: public:
static uint32_t SumStreamMaxBitrate(int streams, const VideoCodec& codec); static uint32_t SumStreamMaxBitrate(int streams, const VideoCodec& codec);
static int NumberOfSimulcastStreams(const VideoCodec& codec); static int NumberOfSimulcastStreams(const VideoCodec& codec);
static bool ValidSimulcastResolutions(const VideoCodec& codec, static bool ValidSimulcastParameters(const VideoCodec& codec,
int num_streams);
static bool ValidSimulcastTemporalLayers(const VideoCodec& codec,
int num_streams); int num_streams);
static int NumberOfTemporalLayers(const VideoCodec& codec, int spatial_id); static int NumberOfTemporalLayers(const VideoCodec& codec, int spatial_id);
// TODO(sprang): Remove this hack when ScreenshareLayers is gone. // TODO(sprang): Remove this hack when ScreenshareLayers is gone.

View File

@ -724,24 +724,24 @@ const char kScreenshareSimulcastExperiment[] =
// TODO(bugs.webrtc.org/9840): Investigate why is this test flaky on Win/Mac. // TODO(bugs.webrtc.org/9840): Investigate why is this test flaky on Win/Mac.
#if !defined(WEBRTC_WIN) #if !defined(WEBRTC_WIN)
TEST(FullStackTest, ScreenshareSlidesVP8_3TL_Simulcast) { TEST(FullStackTest, ScreenshareSlidesVP8_2TL_Simulcast) {
test::ScopedFieldTrials field_trial( test::ScopedFieldTrials field_trial(
AppendFieldTrials(kScreenshareSimulcastExperiment)); AppendFieldTrials(kScreenshareSimulcastExperiment));
auto fixture = CreateVideoQualityTestFixture(); auto fixture = CreateVideoQualityTestFixture();
ParamsWithLogging screenshare; ParamsWithLogging screenshare;
screenshare.call.send_side_bwe = true; screenshare.call.send_side_bwe = true;
screenshare.screenshare[0] = {true, false, 10}; screenshare.screenshare[0] = {true, false, 10};
screenshare.video[0] = {true, 1850, 1110, 5, 800000, screenshare.video[0] = {true, 1850, 1110, 30, 800000, 2500000,
2500000, 2500000, false, "VP8", 3, 2500000, false, "VP8", 3, 2, 400000,
2, 400000, false, false, false, ""}; false, false, false, ""};
screenshare.analyzer = {"screenshare_slides_simulcast", 0.0, 0.0, screenshare.analyzer = {"screenshare_slides_simulcast", 0.0, 0.0,
kFullStackTestDurationSecs}; kFullStackTestDurationSecs};
ParamsWithLogging screenshare_params_high; ParamsWithLogging screenshare_params_high;
screenshare_params_high.video[0] = {true, 1850, 1110, 5, 400000, 1000000, screenshare_params_high.video[0] = {
1000000, false, "VP8", 3, 0, 400000, true, 1850, 1110, 60, 600000, 1250000, 1250000, false,
false, false, false, ""}; "VP8", 2, 0, 400000, false, false, false, ""};
VideoQualityTest::Params screenshare_params_low; VideoQualityTest::Params screenshare_params_low;
screenshare_params_low.video[0] = {true, 1850, 1110, 5, 50000, 200000, screenshare_params_low.video[0] = {true, 1850, 1110, 5, 30000, 200000,
1000000, false, "VP8", 2, 0, 400000, 1000000, false, "VP8", 2, 0, 400000,
false, false, false, ""}; false, false, false, ""};
@ -1249,7 +1249,7 @@ class DualStreamsTest : public ::testing::TestWithParam<int> {};
// TODO(bugs.webrtc.org/9840): Investigate why is this test flaky on MAC. // TODO(bugs.webrtc.org/9840): Investigate why is this test flaky on MAC.
#if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) && !defined(WEBRTC_MAC) #if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) && !defined(WEBRTC_MAC)
TEST_P(DualStreamsTest, TEST_P(DualStreamsTest,
ModeratelyRestricted_SlidesVp8_3TL_Simulcast_Video_Simulcast_High) { ModeratelyRestricted_SlidesVp8_2TL_Simulcast_Video_Simulcast_High) {
test::ScopedFieldTrials field_trial( test::ScopedFieldTrials field_trial(
AppendFieldTrials(std::string(kPacerPushBackExperiment) + AppendFieldTrials(std::string(kPacerPushBackExperiment) +
std::string(kScreenshareSimulcastExperiment))); std::string(kScreenshareSimulcastExperiment)));
@ -1264,11 +1264,11 @@ TEST_P(DualStreamsTest,
""}; ""};
ParamsWithLogging screenshare_params_high; ParamsWithLogging screenshare_params_high;
screenshare_params_high.video[0] = {true, 1850, 1110, 5, 400000, 1000000, screenshare_params_high.video[0] = {
1000000, false, "VP8", 3, 0, 400000, true, 1850, 1110, 60, 600000, 1250000, 1250000, false,
false, false, false, ""}; "VP8", 2, 0, 400000, false, false, false, ""};
VideoQualityTest::Params screenshare_params_low; VideoQualityTest::Params screenshare_params_low;
screenshare_params_low.video[0] = {true, 1850, 1110, 5, 50000, 200000, screenshare_params_low.video[0] = {true, 1850, 1110, 5, 30000, 200000,
1000000, false, "VP8", 2, 0, 400000, 1000000, false, "VP8", 2, 0, 400000,
false, false, false, ""}; false, false, false, ""};
std::vector<VideoStream> screenhsare_streams = { std::vector<VideoStream> screenhsare_streams = {