Reland "Adds resource path support for video files in scenario tests."
This is a reland of 8306a733f0dc45f19462268e29c90ada9f46b28e Original change's description: > Adds resource path support for video files in scenario tests. > > Bug: webrtc:9510 > Change-Id: Id41a32325cc5b16b119e62fba483cec88f52975b > Reviewed-on: https://webrtc-review.googlesource.com/c/123189 > Commit-Queue: Sebastian Jansson <srte@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#26804} Bug: webrtc:9510 Change-Id: I97a5568063569ca66d87f28204200a582d01e2e1 Reviewed-on: https://webrtc-review.googlesource.com/c/123960 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26836}
This commit is contained in:

committed by
Commit Bot

parent
715c4765b1
commit
d37307c561
@ -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) {
|
if (rtc_include_tests) {
|
||||||
rtc_source_set("scenario") {
|
rtc_source_set("scenario") {
|
||||||
testonly = true
|
testonly = true
|
||||||
@ -123,6 +147,10 @@ if (rtc_include_tests) {
|
|||||||
if (!build_with_chromium && is_clang) {
|
if (!build_with_chromium && is_clang) {
|
||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||||
}
|
}
|
||||||
|
data = scenario_resources
|
||||||
|
if (is_ios) {
|
||||||
|
deps += [ ":scenario_resources_bundle_data" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rtc_source_set("scenario_unittests") {
|
rtc_source_set("scenario_unittests") {
|
||||||
testonly = true
|
testonly = true
|
||||||
@ -145,6 +173,10 @@ if (rtc_include_tests) {
|
|||||||
"//testing/gmock",
|
"//testing/gmock",
|
||||||
"//third_party/abseil-cpp/absl/memory",
|
"//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") {
|
rtc_source_set("scenario_slow_tests") {
|
||||||
testonly = true
|
testonly = true
|
||||||
|
@ -286,7 +286,7 @@ std::unique_ptr<FrameGenerator> CreateFrameGenerator(
|
|||||||
case Capture::kVideoFile:
|
case Capture::kVideoFile:
|
||||||
RTC_CHECK(source.video_file.width && source.video_file.height);
|
RTC_CHECK(source.video_file.width && source.video_file.height);
|
||||||
return FrameGenerator::CreateFromYuvFile(
|
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);
|
source.video_file.height, /*frame_repeat_count*/ 1);
|
||||||
case Capture::kGenerateSlides:
|
case Capture::kGenerateSlides:
|
||||||
return FrameGenerator::CreateSlideGenerator(
|
return FrameGenerator::CreateSlideGenerator(
|
||||||
|
@ -15,11 +15,61 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace {
|
namespace {
|
||||||
|
using Capture = VideoStreamConfig::Source::Capture;
|
||||||
|
using ContentType = VideoStreamConfig::Encoder::ContentType;
|
||||||
using Codec = VideoStreamConfig::Encoder::Codec;
|
using Codec = VideoStreamConfig::Encoder::Codec;
|
||||||
using CodecImpl = VideoStreamConfig::Encoder::Implementation;
|
using CodecImpl = VideoStreamConfig::Encoder::Implementation;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// TODO(srte): Enable after landing fix causing flakiness.
|
// TODO(srte): Enable this after resolving flakiness issues.
|
||||||
|
TEST(VideoStreamTest, DISABLED_ReceivesFramesFromFileBasedStreams) {
|
||||||
|
TimeDelta kRunTime = TimeDelta::ms(500);
|
||||||
|
std::vector<int> kFrameRates = {15, 30};
|
||||||
|
std::deque<std::atomic<int>> 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<int> expected_counts;
|
||||||
|
for (int fps : kFrameRates)
|
||||||
|
expected_counts.push_back(
|
||||||
|
static_cast<int>(kRunTime.seconds<double>() * fps * 0.8));
|
||||||
|
|
||||||
|
EXPECT_GE(frame_counts[0], expected_counts[0]);
|
||||||
|
EXPECT_GE(frame_counts[1], expected_counts[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(srte): Enable this after resolving flakiness issues.
|
||||||
TEST(VideoStreamTest, DISABLED_RecievesVp8SimulcastFrames) {
|
TEST(VideoStreamTest, DISABLED_RecievesVp8SimulcastFrames) {
|
||||||
TimeDelta kRunTime = TimeDelta::ms(500);
|
TimeDelta kRunTime = TimeDelta::ms(500);
|
||||||
int kFrameRate = 30;
|
int kFrameRate = 30;
|
||||||
|
Reference in New Issue
Block a user