Index: webrtc/video/full_stack.cc |
diff --git a/webrtc/video/full_stack.cc b/webrtc/video/full_stack.cc |
index 1220482a1dbf597f44c9fac31bf997852a06c735..819c00834c45b5d8231124cc0adaf473d554054b 100644 |
--- a/webrtc/video/full_stack.cc |
+++ b/webrtc/video/full_stack.cc |
@@ -40,6 +40,12 @@ namespace webrtc { |
static const int kFullStackTestDurationSecs = 60; |
static const int kSendStatsPollingIntervalMs = 1000; |
+enum class ContentMode { |
+ kRealTimeVideo, |
+ kScreensharingStaticImage, |
+ kScreensharingScrollingImage, |
+}; |
+ |
struct FullStackTestParams { |
const char* test_label; |
struct { |
@@ -47,7 +53,7 @@ struct FullStackTestParams { |
size_t width, height; |
int fps; |
} clip; |
- bool screenshare; |
+ ContentMode mode; |
int min_bitrate_bps; |
int target_bitrate_bps; |
int max_bitrate_bps; |
@@ -531,7 +537,8 @@ void FullStackTest::RunTest(const FullStackTestParams& params) { |
VideoCodecVP8 vp8_settings; |
VideoCodecVP9 vp9_settings; |
- if (params.screenshare) { |
+ if (params.mode == ContentMode::kScreensharingStaticImage || |
+ params.mode == ContentMode::kScreensharingScrollingImage) { |
encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; |
encoder_config_.min_transmit_bitrate_bps = 400 * 1000; |
if (params.codec == "VP8") { |
@@ -565,34 +572,43 @@ void FullStackTest::RunTest(const FullStackTestParams& params) { |
analyzer.input_ = send_stream_->Input(); |
analyzer.send_stream_ = send_stream_; |
- if (params.screenshare) { |
- std::vector<std::string> slides; |
- slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); |
- slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); |
- slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); |
- slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); |
- |
- rtc::scoped_ptr<test::FrameGenerator> frame_generator( |
- test::FrameGenerator::CreateFromYuvFile( |
- slides, 1850, 1110, |
- 10 * params.clip.fps) // Cycle image every 10 seconds. |
- ); |
- frame_generator_capturer_.reset(new test::FrameGeneratorCapturer( |
- Clock::GetRealTimeClock(), &analyzer, frame_generator.release(), |
- params.clip.fps)); |
- ASSERT_TRUE(frame_generator_capturer_->Init()); |
- } else { |
- frame_generator_capturer_.reset( |
- test::FrameGeneratorCapturer::CreateFromYuvFile( |
- &analyzer, test::ResourcePath(params.clip.name, "yuv"), |
- params.clip.width, params.clip.height, params.clip.fps, |
- Clock::GetRealTimeClock())); |
- |
- ASSERT_TRUE(frame_generator_capturer_.get() != nullptr) |
- << "Could not create capturer for " << params.clip.name |
- << ".yuv. Is this resource file present?"; |
+ std::vector<std::string> slides; |
+ slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); |
+ slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); |
+ slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); |
+ slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); |
+ size_t kSlidesWidth = 1850; |
+ size_t kSlidesHeight = 1110; |
+ |
+ Clock* clock = Clock::GetRealTimeClock(); |
+ rtc::scoped_ptr<test::FrameGenerator> frame_generator; |
+ |
+ switch (params.mode) { |
+ case ContentMode::kRealTimeVideo: |
+ frame_generator.reset(test::FrameGenerator::CreateFromYuvFile( |
+ std::vector<std::string>(1, |
+ test::ResourcePath(params.clip.name, "yuv")), |
+ params.clip.width, params.clip.height, 1)); |
+ break; |
+ case ContentMode::kScreensharingScrollingImage: |
+ frame_generator.reset( |
+ test::FrameGenerator::CreateScrollingInputFromYuvFiles( |
+ clock, slides, kSlidesWidth, kSlidesHeight, params.clip.width, |
+ params.clip.height, 2000, |
+ 8000)); // Scroll for 2 seconds, then pause for 8. |
+ break; |
+ case ContentMode::kScreensharingStaticImage: |
+ frame_generator.reset(test::FrameGenerator::CreateFromYuvFile( |
+ slides, kSlidesWidth, kSlidesHeight, |
+ 10 * params.clip.fps)); // Cycle image every 10 seconds. |
+ break; |
} |
+ ASSERT_TRUE(frame_generator.get() != nullptr); |
+ frame_generator_capturer_.reset(new test::FrameGeneratorCapturer( |
+ clock, &analyzer, frame_generator.release(), params.clip.fps)); |
+ ASSERT_TRUE(frame_generator_capturer_->Init()); |
+ |
Start(); |
analyzer.Wait(); |
@@ -608,7 +624,7 @@ void FullStackTest::RunTest(const FullStackTestParams& params) { |
TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) { |
FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0", |
{"paris_qcif", 176, 144, 30}, |
- false, |
+ ContentMode::kRealTimeVideo, |
300000, |
300000, |
300000, |
@@ -623,7 +639,7 @@ TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) { |
// TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif. |
FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0", |
{"foreman_cif", 352, 288, 30}, |
- false, |
+ ContentMode::kRealTimeVideo, |
700000, |
700000, |
700000, |
@@ -637,7 +653,7 @@ TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) { |
TEST_F(FullStackTest, ForemanCifPlr5) { |
FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5", |
{"foreman_cif", 352, 288, 30}, |
- false, |
+ ContentMode::kRealTimeVideo, |
30000, |
500000, |
2000000, |
@@ -653,7 +669,7 @@ TEST_F(FullStackTest, ForemanCifPlr5) { |
TEST_F(FullStackTest, ForemanCif500kbps) { |
FullStackTestParams foreman_cif = {"foreman_cif_500kbps", |
{"foreman_cif", 352, 288, 30}, |
- false, |
+ ContentMode::kRealTimeVideo, |
30000, |
500000, |
2000000, |
@@ -670,7 +686,7 @@ TEST_F(FullStackTest, ForemanCif500kbps) { |
TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) { |
FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue", |
{"foreman_cif", 352, 288, 30}, |
- false, |
+ ContentMode::kRealTimeVideo, |
30000, |
500000, |
2000000, |
@@ -687,7 +703,7 @@ TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) { |
TEST_F(FullStackTest, ForemanCif500kbps100ms) { |
FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms", |
{"foreman_cif", 352, 288, 30}, |
- false, |
+ ContentMode::kRealTimeVideo, |
30000, |
500000, |
2000000, |
@@ -704,7 +720,7 @@ TEST_F(FullStackTest, ForemanCif500kbps100ms) { |
TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) { |
FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue", |
{"foreman_cif", 352, 288, 30}, |
- false, |
+ ContentMode::kRealTimeVideo, |
30000, |
500000, |
2000000, |
@@ -721,7 +737,7 @@ TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) { |
TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) { |
FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue", |
{"foreman_cif", 352, 288, 30}, |
- false, |
+ ContentMode::kRealTimeVideo, |
30000, |
2000000, |
2000000, |
@@ -742,7 +758,23 @@ TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL)) { |
FullStackTestParams screenshare_params = { |
"screenshare_slides", |
{"screenshare_slides", 1850, 1110, 5}, |
- true, |
+ ContentMode::kScreensharingStaticImage, |
+ 50000, |
+ 200000, |
+ 2000000, |
+ 0.0, |
+ 0.0, |
+ kFullStackTestDurationSecs, |
+ "VP8"}; |
+ RunTest(screenshare_params); |
+} |
+ |
+TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL_Scroll)) { |
+ FullStackTestParams screenshare_params = { |
+ "screenshare_slides_scrolling", |
+ // Crop height by two, scrolling vertically only. |
+ {"screenshare_slides_scrolling", 1850, 1110 / 2, 5}, |
+ ContentMode::kScreensharingScrollingImage, |
50000, |
200000, |
2000000, |
@@ -758,7 +790,7 @@ TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP9_2TL)) { |
FullStackTestParams screenshare_params = { |
"screenshare_slides_vp9_2tl", |
{"screenshare_slides", 1850, 1110, 5}, |
- true, |
+ ContentMode::kScreensharingStaticImage, |
50000, |
200000, |
2000000, |