Project import generated by Copybara.
GitOrigin-RevId: 6a704ded0bf489614797082e7e7cda1068477ef5
This commit is contained in:
@@ -30,7 +30,7 @@ TEST(DefaultInputStreamHandlerTest, NoBatchingWorks) {
|
||||
// A single calculator with two input streams, and two output streams. This
|
||||
// calculator passes all the input packets along.
|
||||
CalculatorGraphConfig config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "input0"
|
||||
input_stream: "input1"
|
||||
node {
|
||||
@@ -47,7 +47,7 @@ TEST(DefaultInputStreamHandlerTest, NoBatchingWorks) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})");
|
||||
})pb");
|
||||
std::vector<Packet> sink_0, sink_1;
|
||||
tool::AddVectorSink("output0", &config, &sink_0);
|
||||
tool::AddVectorSink("output1", &config, &sink_1);
|
||||
@@ -88,7 +88,7 @@ TEST(DefaultInputStreamHandlerTest, Batches) {
|
||||
// A single batching calculator with one input stream and one output stream.
|
||||
// This calculator passes all the input packets onto the output streams.
|
||||
CalculatorGraphConfig config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "input0"
|
||||
node {
|
||||
calculator: "PassThroughCalculator"
|
||||
@@ -102,7 +102,7 @@ TEST(DefaultInputStreamHandlerTest, Batches) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})");
|
||||
})pb");
|
||||
std::vector<Packet> sink;
|
||||
tool::AddVectorSink("output0", &config, &sink);
|
||||
|
||||
@@ -152,7 +152,7 @@ TEST(DefaultInputStreamHandlerTest, BatchIsFlushedWhenClosing) {
|
||||
// A single batching calculator with one input stream and one output stream.
|
||||
// This calculator passes all the input packets onto the output streams.
|
||||
CalculatorGraphConfig config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "input0"
|
||||
node {
|
||||
calculator: "PassThroughCalculator"
|
||||
@@ -166,7 +166,7 @@ TEST(DefaultInputStreamHandlerTest, BatchIsFlushedWhenClosing) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})");
|
||||
})pb");
|
||||
std::vector<Packet> sink;
|
||||
tool::AddVectorSink("output0", &config, &sink);
|
||||
|
||||
@@ -211,7 +211,7 @@ TEST(DefaultInputStreamHandlerTest, BatchIsFlushedWhenClosing) {
|
||||
// batching except for the first timestamp of the batch.
|
||||
TEST(DefaultInputStreamHandlerTest, DoesntPropagateTimestampWhenBatching) {
|
||||
CalculatorGraphConfig config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "input0"
|
||||
input_stream: "input1"
|
||||
node {
|
||||
@@ -233,7 +233,7 @@ TEST(DefaultInputStreamHandlerTest, DoesntPropagateTimestampWhenBatching) {
|
||||
input_stream: "input1_batched"
|
||||
output_stream: "output"
|
||||
output_stream: "dummy"
|
||||
})");
|
||||
})pb");
|
||||
std::vector<Packet> sink;
|
||||
tool::AddVectorSink("output", &config, &sink);
|
||||
CalculatorGraph graph;
|
||||
|
||||
@@ -149,18 +149,18 @@ TEST_P(FixedSizeInputStreamHandlerTest, DropsPackets) {
|
||||
// regulated by FixedSizeInputStreamHandler.
|
||||
CalculatorGraphConfig graph_config =
|
||||
ParseTextProtoOrDie<CalculatorGraphConfig>(
|
||||
R"(node {
|
||||
calculator: "TestSourceCalculator"
|
||||
output_stream: "input_packets"
|
||||
}
|
||||
node {
|
||||
calculator: "TestSlowCalculator"
|
||||
input_stream: "input_packets"
|
||||
output_stream: "output_packets"
|
||||
input_stream_handler {
|
||||
input_stream_handler: "FixedSizeInputStreamHandler"
|
||||
R"pb(node {
|
||||
calculator: "TestSourceCalculator"
|
||||
output_stream: "input_packets"
|
||||
}
|
||||
})");
|
||||
node {
|
||||
calculator: "TestSlowCalculator"
|
||||
input_stream: "input_packets"
|
||||
output_stream: "output_packets"
|
||||
input_stream_handler {
|
||||
input_stream_handler: "FixedSizeInputStreamHandler"
|
||||
}
|
||||
})pb");
|
||||
SetFixedMinSize(graph_config.mutable_node(1), GetParam());
|
||||
std::vector<Packet> output_packets;
|
||||
tool::AddVectorSink("output_packets", &graph_config, &output_packets);
|
||||
@@ -190,21 +190,21 @@ TEST_P(FixedSizeInputStreamHandlerTest, DropsPacketsInFullStream) {
|
||||
// CountingSourceCalculator will stay throttled and the test will time out.
|
||||
CalculatorGraphConfig graph_config =
|
||||
ParseTextProtoOrDie<CalculatorGraphConfig>(
|
||||
R"(max_queue_size: 10
|
||||
node {
|
||||
calculator: "CountingSourceCalculator"
|
||||
input_side_packet: "MAX_COUNT:max_count"
|
||||
input_side_packet: "BATCH_SIZE:batch_size"
|
||||
output_stream: "input_packets"
|
||||
}
|
||||
node {
|
||||
calculator: "PassThroughCalculator"
|
||||
input_stream: "input_packets"
|
||||
output_stream: "output_packets"
|
||||
input_stream_handler {
|
||||
input_stream_handler: "FixedSizeInputStreamHandler"
|
||||
R"pb(max_queue_size: 10
|
||||
node {
|
||||
calculator: "CountingSourceCalculator"
|
||||
input_side_packet: "MAX_COUNT:max_count"
|
||||
input_side_packet: "BATCH_SIZE:batch_size"
|
||||
output_stream: "input_packets"
|
||||
}
|
||||
})");
|
||||
node {
|
||||
calculator: "PassThroughCalculator"
|
||||
input_stream: "input_packets"
|
||||
output_stream: "output_packets"
|
||||
input_stream_handler {
|
||||
input_stream_handler: "FixedSizeInputStreamHandler"
|
||||
}
|
||||
})pb");
|
||||
SetFixedMinSize(graph_config.mutable_node(1), GetParam());
|
||||
std::vector<Packet> output_packets;
|
||||
tool::AddVectorSink("output_packets", &graph_config, &output_packets);
|
||||
@@ -220,7 +220,7 @@ TEST_P(FixedSizeInputStreamHandlerTest, DropsPacketsInFullStream) {
|
||||
TEST_P(FixedSizeInputStreamHandlerTest, ParallelWriteAndRead) {
|
||||
CalculatorGraphConfig graph_config =
|
||||
ParseTextProtoOrDie<CalculatorGraphConfig>(
|
||||
R"(
|
||||
R"pb(
|
||||
input_stream: "in_0"
|
||||
input_stream: "in_1"
|
||||
input_stream: "in_2"
|
||||
@@ -241,7 +241,7 @@ TEST_P(FixedSizeInputStreamHandlerTest, ParallelWriteAndRead) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})");
|
||||
})pb");
|
||||
SetFixedMinSize(graph_config.mutable_node(0), GetParam());
|
||||
std::vector<Packet> output_packets[3];
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
@@ -289,7 +289,7 @@ TEST_P(FixedSizeInputStreamHandlerTest, ParallelWriteAndRead) {
|
||||
TEST_P(FixedSizeInputStreamHandlerTest, LateArrivalDrop) {
|
||||
CalculatorGraphConfig graph_config =
|
||||
ParseTextProtoOrDie<CalculatorGraphConfig>(
|
||||
R"(
|
||||
R"pb(
|
||||
input_stream: "in_0"
|
||||
input_stream: "in_1"
|
||||
input_stream: "in_2"
|
||||
@@ -310,7 +310,7 @@ TEST_P(FixedSizeInputStreamHandlerTest, LateArrivalDrop) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})");
|
||||
})pb");
|
||||
SetFixedMinSize(graph_config.mutable_node(0), GetParam());
|
||||
std::vector<Packet> output_packets[3];
|
||||
std::string in_streams[3];
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace {
|
||||
// MuxInputStreamHandler should fail when running this test.
|
||||
TEST(MuxInputStreamHandlerTest, AtomicAccessToControlAndDataStreams) {
|
||||
CalculatorGraphConfig config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "input"
|
||||
node {
|
||||
calculator: "RoundRobinDemuxCalculator"
|
||||
@@ -75,7 +75,7 @@ TEST(MuxInputStreamHandlerTest, AtomicAccessToControlAndDataStreams) {
|
||||
input_stream: "SELECT:select"
|
||||
output_stream: "OUTPUT:output"
|
||||
input_stream_handler { input_stream_handler: "MuxInputStreamHandler" }
|
||||
})");
|
||||
})pb");
|
||||
CalculatorGraph graph;
|
||||
MP_ASSERT_OK(graph.Initialize(config));
|
||||
MP_ASSERT_OK(graph.StartRun({}));
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace {
|
||||
// MuxInputStreamHandler should fail when running this test.
|
||||
TEST(MuxInputStreamHandlerTest, AtomicAccessToControlAndDataStreams) {
|
||||
CalculatorGraphConfig config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "input"
|
||||
node {
|
||||
calculator: "RoundRobinDemuxCalculator"
|
||||
@@ -82,7 +82,7 @@ TEST(MuxInputStreamHandlerTest, AtomicAccessToControlAndDataStreams) {
|
||||
input_stream: "SELECT:select"
|
||||
output_stream: "OUTPUT:output"
|
||||
# MuxInputStreamHandler set in GetContract().
|
||||
})");
|
||||
})pb");
|
||||
CalculatorGraph graph;
|
||||
MP_ASSERT_OK(graph.Initialize(config));
|
||||
MP_ASSERT_OK(graph.StartRun({}));
|
||||
@@ -195,7 +195,7 @@ TEST(FixedSizeInputStreamHandlerTest, ParallelWriteAndRead) {
|
||||
#define NUM_STREAMS 4
|
||||
CalculatorGraphConfig graph_config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(
|
||||
R"(
|
||||
R"pb(
|
||||
input_stream: "in_0"
|
||||
input_stream: "in_1"
|
||||
input_stream: "in_2"
|
||||
@@ -211,7 +211,7 @@ TEST(FixedSizeInputStreamHandlerTest, ParallelWriteAndRead) {
|
||||
output_stream: "out_2"
|
||||
output_stream: "out_3"
|
||||
# FixedSizeInputStreamHandler set in GetContract()
|
||||
})");
|
||||
})pb");
|
||||
std::vector<Packet> output_packets[NUM_STREAMS];
|
||||
for (int i = 0; i < NUM_STREAMS; ++i) {
|
||||
tool::AddVectorSink(absl::StrCat("out_", i), &graph_config,
|
||||
|
||||
@@ -84,7 +84,7 @@ absl::Status InputsToDebugString(const InputStreamShardSet& inputs,
|
||||
|
||||
TEST(SyncSetInputStreamHandlerTest, OrdinaryOperation) {
|
||||
CalculatorGraphConfig config = ParseTextProtoOrDie<CalculatorGraphConfig>(
|
||||
R"(
|
||||
R"pb(
|
||||
input_stream: "a"
|
||||
input_stream: "b"
|
||||
input_stream: "c"
|
||||
@@ -123,7 +123,7 @@ TEST(SyncSetInputStreamHandlerTest, OrdinaryOperation) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})");
|
||||
})pb");
|
||||
// The sync sets by stream name and CollectionItemId.
|
||||
// {a, c, e}, {b, d}, {f}, {g}, {h}
|
||||
// {0, 2, 4}, {1, 3}, {5}, {6}, {7}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace {
|
||||
|
||||
TEST(TimestampAlignInputStreamHandlerTest, Initialization) {
|
||||
CalculatorGraphConfig config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "input_video"
|
||||
input_stream: "input_camera"
|
||||
node {
|
||||
@@ -43,7 +43,7 @@ TEST(TimestampAlignInputStreamHandlerTest, Initialization) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})");
|
||||
})pb");
|
||||
std::vector<Packet> sink_video, sink_camera;
|
||||
tool::AddVectorSink("output_video", &config, &sink_video);
|
||||
tool::AddVectorSink("output_camera", &config, &sink_camera);
|
||||
@@ -121,7 +121,7 @@ TEST(TimestampAlignInputStreamHandlerTest, Initialization) {
|
||||
|
||||
TEST(TimestampAlignInputStreamHandlerTest, TickRate) {
|
||||
CalculatorGraphConfig config =
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "input_video"
|
||||
input_stream: "input_camera"
|
||||
node {
|
||||
@@ -139,7 +139,7 @@ TEST(TimestampAlignInputStreamHandlerTest, TickRate) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})");
|
||||
})pb");
|
||||
std::vector<Packet> sink_video, sink_camera;
|
||||
tool::AddVectorSink("output_video", &config, &sink_video);
|
||||
tool::AddVectorSink("output_camera", &config, &sink_camera);
|
||||
|
||||
Reference in New Issue
Block a user