diff --git a/test/scenario/BUILD.gn b/test/scenario/BUILD.gn index 9c5422d527..3f168a7e30 100644 --- a/test/scenario/BUILD.gn +++ b/test/scenario/BUILD.gn @@ -21,6 +21,30 @@ rtc_source_set("column_printer") { ] } +scenario_resources = [ + "../../resources/difficult_photo_1850_1110.yuv", + "../../resources/photo_1850_1110.yuv", + "../../resources/presentation_1850_1110.yuv", + "../../resources/web_screenshot_1850_1110.yuv", +] +scenario_unittest_resources = [ "../../resources/foreman_cif.yuv" ] + +if (is_ios) { + bundle_data("scenario_resources_bundle_data") { + testonly = true + sources = scenario_resources + outputs = [ + "{{bundle_resources_dir}}/{{source_file_part}}", + ] + } + bundle_data("scenario_unittest_resources_bundle_data") { + testonly = true + sources = scenario_unittest_resources + outputs = [ + "{{bundle_resources_dir}}/{{source_file_part}}", + ] + } +} if (rtc_include_tests) { rtc_source_set("scenario") { testonly = true @@ -123,6 +147,10 @@ if (rtc_include_tests) { if (!build_with_chromium && is_clang) { suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] } + data = scenario_resources + if (is_ios) { + deps += [ ":scenario_resources_bundle_data" ] + } } rtc_source_set("scenario_unittests") { testonly = true @@ -145,6 +173,10 @@ if (rtc_include_tests) { "//testing/gmock", "//third_party/abseil-cpp/absl/memory", ] + data = scenario_unittest_resources + if (is_ios) { + deps += [ ":scenario_unittest_resources_bundle_data" ] + } } rtc_source_set("scenario_slow_tests") { testonly = true diff --git a/test/scenario/video_stream.cc b/test/scenario/video_stream.cc index c50167e31b..02ee327818 100644 --- a/test/scenario/video_stream.cc +++ b/test/scenario/video_stream.cc @@ -286,7 +286,7 @@ std::unique_ptr CreateFrameGenerator( case Capture::kVideoFile: RTC_CHECK(source.video_file.width && source.video_file.height); return FrameGenerator::CreateFromYuvFile( - {source.video_file.name}, source.video_file.width, + {TransformFilePath(source.video_file.name)}, source.video_file.width, source.video_file.height, /*frame_repeat_count*/ 1); case Capture::kGenerateSlides: return FrameGenerator::CreateSlideGenerator( diff --git a/test/scenario/video_stream_unittest.cc b/test/scenario/video_stream_unittest.cc index df7adba50d..658ce072c1 100644 --- a/test/scenario/video_stream_unittest.cc +++ b/test/scenario/video_stream_unittest.cc @@ -15,12 +15,72 @@ namespace webrtc { namespace test { namespace { +using Capture = VideoStreamConfig::Source::Capture; +using ContentType = VideoStreamConfig::Encoder::ContentType; using Codec = VideoStreamConfig::Encoder::Codec; using CodecImpl = VideoStreamConfig::Encoder::Implementation; } // namespace -// TODO(srte): Enable after landing fix causing flakiness. -TEST(VideoStreamTest, DISABLED_RecievesVp8SimulcastFrames) { +#if defined(WEBRTC_ANDROID) +#define MAYBE_ReceivesFramesFromFileBasedStreams \ + DISABLED_ReceivesFramesFromFileBasedStreams +#else +#define MAYBE_ReceivesFramesFromFileBasedStreams \ + ReceivesFramesFromFileBasedStreams +#endif +TEST(VideoStreamTest, MAYBE_ReceivesFramesFromFileBasedStreams) { + TimeDelta kRunTime = TimeDelta::ms(500); + std::vector kFrameRates = {15, 30}; + std::deque> frame_counts(2); + frame_counts[0] = 0; + frame_counts[1] = 0; + { + Scenario s; + auto route = s.CreateRoutes(s.CreateClient("caller", CallClientConfig()), + {s.CreateSimulationNode(NetworkNodeConfig())}, + s.CreateClient("callee", CallClientConfig()), + {s.CreateSimulationNode(NetworkNodeConfig())}); + + s.CreateVideoStream(route->forward(), [&](VideoStreamConfig* c) { + c->analyzer.frame_quality_handler = [&](const VideoFrameQualityInfo&) { + frame_counts[0]++; + }; + c->source.capture = Capture::kVideoFile; + c->source.video_file.name = "foreman_cif"; + c->source.video_file.width = 352; + c->source.video_file.height = 288; + c->source.framerate = kFrameRates[0]; + c->encoder.implementation = CodecImpl::kSoftware; + c->encoder.codec = Codec::kVideoCodecVP8; + }); + s.CreateVideoStream(route->forward(), [&](VideoStreamConfig* c) { + c->analyzer.frame_quality_handler = [&](const VideoFrameQualityInfo&) { + frame_counts[1]++; + }; + c->source.capture = Capture::kImageSlides; + c->source.slides.images.crop.width = 320; + c->source.slides.images.crop.height = 240; + c->source.framerate = kFrameRates[1]; + c->encoder.implementation = CodecImpl::kSoftware; + c->encoder.codec = Codec::kVideoCodecVP9; + }); + s.RunFor(kRunTime); + } + std::vector expected_counts; + for (int fps : kFrameRates) + expected_counts.push_back( + static_cast(kRunTime.seconds() * fps * 0.8)); + + EXPECT_GE(frame_counts[0], expected_counts[0]); + EXPECT_GE(frame_counts[1], expected_counts[1]); +} + +#if defined(WEBRTC_ANDROID) +#define MAYBE_RecievesVp8SimulcastFrames DISABLED_RecievesVp8SimulcastFrames +#else +#define MAYBE_RecievesVp8SimulcastFrames RecievesVp8SimulcastFrames +#endif +TEST(VideoStreamTest, MAYBE_RecievesVp8SimulcastFrames) { TimeDelta kRunTime = TimeDelta::ms(500); int kFrameRate = 30;