Internal change
PiperOrigin-RevId: 523611358
This commit is contained in:
parent
f923f6bcda
commit
52e934a539
|
@ -30,7 +30,7 @@ namespace mediapipe {
|
|||
typedef ClipVectorSizeCalculator<int> TestClipIntVectorSizeCalculator;
|
||||
REGISTER_CALCULATOR(TestClipIntVectorSizeCalculator);
|
||||
|
||||
void AddInputVector(const std::vector<int>& input, int64 timestamp,
|
||||
void AddInputVector(const std::vector<int>& input, int64_t timestamp,
|
||||
CalculatorRunner* runner) {
|
||||
runner->MutableInputs()->Index(0).packets.push_back(
|
||||
MakePacket<std::vector<int>>(input).At(Timestamp(timestamp)));
|
||||
|
|
|
@ -63,7 +63,7 @@ void ValidateCombinedLandmarks(
|
|||
|
||||
void AddInputLandmarkLists(
|
||||
const std::vector<NormalizedLandmarkList>& input_landmarks_vec,
|
||||
int64 timestamp, CalculatorRunner* runner) {
|
||||
int64_t timestamp, CalculatorRunner* runner) {
|
||||
for (int i = 0; i < input_landmarks_vec.size(); ++i) {
|
||||
runner->MutableInputs()->Index(i).packets.push_back(
|
||||
MakePacket<NormalizedLandmarkList>(input_landmarks_vec[i])
|
||||
|
@ -73,7 +73,7 @@ void AddInputLandmarkLists(
|
|||
|
||||
void AddInputClassificationLists(
|
||||
const std::vector<ClassificationList>& input_classifications_vec,
|
||||
int64 timestamp, CalculatorRunner* runner) {
|
||||
int64_t timestamp, CalculatorRunner* runner) {
|
||||
for (int i = 0; i < input_classifications_vec.size(); ++i) {
|
||||
runner->MutableInputs()->Index(i).packets.push_back(
|
||||
MakePacket<ClassificationList>(input_classifications_vec[i])
|
||||
|
|
|
@ -46,10 +46,10 @@ MEDIAPIPE_REGISTER_NODE(ConcatenateFloatVectorCalculator);
|
|||
// input_stream: "int32_vector_2"
|
||||
// output_stream: "concatenated_int32_vector"
|
||||
// }
|
||||
typedef ConcatenateVectorCalculator<int32> ConcatenateInt32VectorCalculator;
|
||||
typedef ConcatenateVectorCalculator<int32_t> ConcatenateInt32VectorCalculator;
|
||||
MEDIAPIPE_REGISTER_NODE(ConcatenateInt32VectorCalculator);
|
||||
|
||||
typedef ConcatenateVectorCalculator<uint64> ConcatenateUInt64VectorCalculator;
|
||||
typedef ConcatenateVectorCalculator<uint64_t> ConcatenateUInt64VectorCalculator;
|
||||
MEDIAPIPE_REGISTER_NODE(ConcatenateUInt64VectorCalculator);
|
||||
|
||||
typedef ConcatenateVectorCalculator<bool> ConcatenateBoolVectorCalculator;
|
||||
|
|
|
@ -30,26 +30,26 @@ namespace mediapipe {
|
|||
typedef ConcatenateVectorCalculator<int> TestConcatenateIntVectorCalculator;
|
||||
MEDIAPIPE_REGISTER_NODE(TestConcatenateIntVectorCalculator);
|
||||
|
||||
void AddInputVector(int index, const std::vector<int>& input, int64 timestamp,
|
||||
void AddInputVector(int index, const std::vector<int>& input, int64_t timestamp,
|
||||
CalculatorRunner* runner) {
|
||||
runner->MutableInputs()->Index(index).packets.push_back(
|
||||
MakePacket<std::vector<int>>(input).At(Timestamp(timestamp)));
|
||||
}
|
||||
|
||||
void AddInputVectors(const std::vector<std::vector<int>>& inputs,
|
||||
int64 timestamp, CalculatorRunner* runner) {
|
||||
int64_t timestamp, CalculatorRunner* runner) {
|
||||
for (int i = 0; i < inputs.size(); ++i) {
|
||||
AddInputVector(i, inputs[i], timestamp, runner);
|
||||
}
|
||||
}
|
||||
|
||||
void AddInputItem(int index, int input, int64 timestamp,
|
||||
void AddInputItem(int index, int input, int64_t timestamp,
|
||||
CalculatorRunner* runner) {
|
||||
runner->MutableInputs()->Index(index).packets.push_back(
|
||||
MakePacket<int>(input).At(Timestamp(timestamp)));
|
||||
}
|
||||
|
||||
void AddInputItems(const std::vector<int>& inputs, int64 timestamp,
|
||||
void AddInputItems(const std::vector<int>& inputs, int64_t timestamp,
|
||||
CalculatorRunner* runner) {
|
||||
for (int i = 0; i < inputs.size(); ++i) {
|
||||
AddInputItem(i, inputs[i], timestamp, runner);
|
||||
|
@ -279,7 +279,7 @@ TEST(TestConcatenateIntVectorCalculatorTest, MixedVectorsAndItemsAnother) {
|
|||
}
|
||||
|
||||
void AddInputVectors(const std::vector<std::vector<float>>& inputs,
|
||||
int64 timestamp, CalculatorRunner* runner) {
|
||||
int64_t timestamp, CalculatorRunner* runner) {
|
||||
for (int i = 0; i < inputs.size(); ++i) {
|
||||
runner->MutableInputs()->Index(i).packets.push_back(
|
||||
MakePacket<std::vector<float>>(inputs[i]).At(Timestamp(timestamp)));
|
||||
|
|
|
@ -61,8 +61,8 @@ class AtomicSemaphore {
|
|||
};
|
||||
|
||||
// Returns the timestamp values for a vector of Packets.
|
||||
std::vector<int64> TimestampValues(const std::vector<Packet>& packets) {
|
||||
std::vector<int64> result;
|
||||
std::vector<int64_t> TimestampValues(const std::vector<Packet>& packets) {
|
||||
std::vector<int64_t> result;
|
||||
for (const Packet& packet : packets) {
|
||||
result.push_back(packet.Timestamp().Value());
|
||||
}
|
||||
|
@ -180,9 +180,9 @@ TEST_F(FlowLimiterCalculatorSemaphoreTest, FramesDropped) {
|
|||
InitializeGraph(1);
|
||||
MP_ASSERT_OK(graph_.StartRun({}));
|
||||
|
||||
auto send_packet = [this](const std::string& input_name, int64 n) {
|
||||
auto send_packet = [this](const std::string& input_name, int64_t n) {
|
||||
MP_EXPECT_OK(graph_.AddPacketToInputStream(
|
||||
input_name, MakePacket<int64>(n).At(Timestamp(n))));
|
||||
input_name, MakePacket<int64_t>(n).At(Timestamp(n))));
|
||||
};
|
||||
|
||||
Packet allow_packet;
|
||||
|
@ -207,12 +207,12 @@ TEST_F(FlowLimiterCalculatorSemaphoreTest, FramesDropped) {
|
|||
EXPECT_EQ(10, out_1_packets_.size());
|
||||
|
||||
// Timestamps have not been altered.
|
||||
EXPECT_EQ(PacketValues<int64>(out_1_packets_),
|
||||
EXPECT_EQ(PacketValues<int64_t>(out_1_packets_),
|
||||
TimestampValues(out_1_packets_));
|
||||
|
||||
// Extra inputs on in_1 have been dropped.
|
||||
EXPECT_EQ(TimestampValues(out_1_packets_),
|
||||
(std::vector<int64>{0, 10, 20, 30, 40, 50, 60, 70, 80, 90}));
|
||||
(std::vector<int64_t>{0, 10, 20, 30, 40, 50, 60, 70, 80, 90}));
|
||||
}
|
||||
|
||||
// A calculator that sleeps during Process.
|
||||
|
@ -221,8 +221,8 @@ class SleepCalculator : public CalculatorBase {
|
|||
static absl::Status GetContract(CalculatorContract* cc) {
|
||||
cc->Inputs().Tag(kPacketTag).SetAny();
|
||||
cc->Outputs().Tag(kPacketTag).SetSameAs(&cc->Inputs().Tag(kPacketTag));
|
||||
cc->InputSidePackets().Tag(kSleepTimeTag).Set<int64>();
|
||||
cc->InputSidePackets().Tag(kWarmupTimeTag).Set<int64>();
|
||||
cc->InputSidePackets().Tag(kSleepTimeTag).Set<int64_t>();
|
||||
cc->InputSidePackets().Tag(kWarmupTimeTag).Set<int64_t>();
|
||||
cc->InputSidePackets().Tag(kClockTag).Set<mediapipe::Clock*>();
|
||||
cc->SetTimestampOffset(0);
|
||||
return absl::OkStatus();
|
||||
|
@ -237,8 +237,8 @@ class SleepCalculator : public CalculatorBase {
|
|||
++packet_count;
|
||||
absl::Duration sleep_time = absl::Microseconds(
|
||||
packet_count == 1
|
||||
? cc->InputSidePackets().Tag(kWarmupTimeTag).Get<int64>()
|
||||
: cc->InputSidePackets().Tag(kSleepTimeTag).Get<int64>());
|
||||
? cc->InputSidePackets().Tag(kWarmupTimeTag).Get<int64_t>()
|
||||
: cc->InputSidePackets().Tag(kSleepTimeTag).Get<int64_t>());
|
||||
clock_->Sleep(sleep_time);
|
||||
cc->Outputs()
|
||||
.Tag(kPacketTag)
|
||||
|
@ -375,8 +375,8 @@ TEST_F(FlowLimiterCalculatorTest, FinishedTimestamps) {
|
|||
std::map<std::string, Packet> side_packets = {
|
||||
{"limiter_options",
|
||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||
{"warmup_time", MakePacket<int64>(22000)},
|
||||
{"sleep_time", MakePacket<int64>(22000)},
|
||||
{"warmup_time", MakePacket<int64_t>(22000)},
|
||||
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||
{"drop_timesamps", MakePacket<bool>(false)},
|
||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||
};
|
||||
|
@ -447,8 +447,8 @@ TEST_F(FlowLimiterCalculatorTest, FinishedLost) {
|
|||
std::map<std::string, Packet> side_packets = {
|
||||
{"limiter_options",
|
||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||
{"warmup_time", MakePacket<int64>(22000)},
|
||||
{"sleep_time", MakePacket<int64>(22000)},
|
||||
{"warmup_time", MakePacket<int64_t>(22000)},
|
||||
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||
{"drop_timesamps", MakePacket<bool>(true)},
|
||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||
};
|
||||
|
@ -511,8 +511,8 @@ TEST_F(FlowLimiterCalculatorTest, FinishedDelayed) {
|
|||
std::map<std::string, Packet> side_packets = {
|
||||
{"limiter_options",
|
||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||
{"warmup_time", MakePacket<int64>(500000)},
|
||||
{"sleep_time", MakePacket<int64>(22000)},
|
||||
{"warmup_time", MakePacket<int64_t>(500000)},
|
||||
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||
{"drop_timesamps", MakePacket<bool>(false)},
|
||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||
};
|
||||
|
@ -606,8 +606,8 @@ TEST_F(FlowLimiterCalculatorTest, TwoInputStreams) {
|
|||
std::map<std::string, Packet> side_packets = {
|
||||
{"limiter_options",
|
||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||
{"warmup_time", MakePacket<int64>(22000)},
|
||||
{"sleep_time", MakePacket<int64>(22000)},
|
||||
{"warmup_time", MakePacket<int64_t>(22000)},
|
||||
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||
{"drop_timesamps", MakePacket<bool>(true)},
|
||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||
};
|
||||
|
@ -715,8 +715,8 @@ TEST_F(FlowLimiterCalculatorTest, ZeroQueue) {
|
|||
std::map<std::string, Packet> side_packets = {
|
||||
{"limiter_options",
|
||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||
{"warmup_time", MakePacket<int64>(12000)},
|
||||
{"sleep_time", MakePacket<int64>(12000)},
|
||||
{"warmup_time", MakePacket<int64_t>(12000)},
|
||||
{"sleep_time", MakePacket<int64_t>(12000)},
|
||||
{"drop_timesamps", MakePacket<bool>(true)},
|
||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||
};
|
||||
|
@ -862,9 +862,9 @@ TEST_F(FlowLimiterCalculatorTest, AuxiliaryInputs) {
|
|||
|
||||
std::map<std::string, Packet> side_packets = {
|
||||
// Fake processing lazy initialization time in microseconds.
|
||||
{"warmup_time", MakePacket<int64>(22000)},
|
||||
{"warmup_time", MakePacket<int64_t>(22000)},
|
||||
// Fake processing duration in microseconds.
|
||||
{"sleep_time", MakePacket<int64>(22000)},
|
||||
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||
// The SimulationClock to count virtual elapsed time.
|
||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||
};
|
||||
|
|
|
@ -94,17 +94,17 @@ class GraphProfileCalculatorTest : public ::testing::Test {
|
|||
&graph_config_));
|
||||
}
|
||||
|
||||
static Packet PacketAt(int64 ts) {
|
||||
return Adopt(new int64(999)).At(Timestamp(ts));
|
||||
static Packet PacketAt(int64_t ts) {
|
||||
return Adopt(new int64_t(999)).At(Timestamp(ts));
|
||||
}
|
||||
static Packet None() { return Packet().At(Timestamp::OneOverPostStream()); }
|
||||
static bool IsNone(const Packet& packet) {
|
||||
return packet.Timestamp() == Timestamp::OneOverPostStream();
|
||||
}
|
||||
// Return the values of the timestamps of a vector of Packets.
|
||||
static std::vector<int64> TimestampValues(
|
||||
static std::vector<int64_t> TimestampValues(
|
||||
const std::vector<Packet>& packets) {
|
||||
std::vector<int64> result;
|
||||
std::vector<int64_t> result;
|
||||
for (const Packet& p : packets) {
|
||||
result.push_back(p.Timestamp().Value());
|
||||
}
|
||||
|
|
|
@ -191,17 +191,17 @@ class ImmediateMuxCalculatorTest : public ::testing::Test {
|
|||
&graph_config_));
|
||||
}
|
||||
|
||||
static Packet PacketAt(int64 ts) {
|
||||
return Adopt(new int64(999)).At(Timestamp(ts));
|
||||
static Packet PacketAt(int64_t ts) {
|
||||
return Adopt(new int64_t(999)).At(Timestamp(ts));
|
||||
}
|
||||
static Packet None() { return Packet().At(Timestamp::OneOverPostStream()); }
|
||||
static bool IsNone(const Packet& packet) {
|
||||
return packet.Timestamp() == Timestamp::OneOverPostStream();
|
||||
}
|
||||
// Return the values of the timestamps of a vector of Packets.
|
||||
static std::vector<int64> TimestampValues(
|
||||
static std::vector<int64_t> TimestampValues(
|
||||
const std::vector<Packet>& packets) {
|
||||
std::vector<int64> result;
|
||||
std::vector<int64_t> result;
|
||||
for (const Packet& p : packets) {
|
||||
result.push_back(p.Timestamp().Value());
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ class SimpleRunner : public CalculatorRunner {
|
|||
MutableInputs()->Index(0).header = Adopt(video_header.release());
|
||||
}
|
||||
|
||||
std::vector<int64> GetOutputTimestamps() const {
|
||||
std::vector<int64> timestamps;
|
||||
std::vector<int64_t> GetOutputTimestamps() const {
|
||||
std::vector<int64_t> timestamps;
|
||||
for (const Packet& packet : Outputs().Index(0).packets) {
|
||||
timestamps.emplace_back(packet.Timestamp().Value());
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ TEST(PacketThinnerCalculatorTest, StartAndEndTimeTest) {
|
|||
runner.SetInput({2, 3, 5, 7, 11, 13, 17, 19, 23, 29});
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {5, 11};
|
||||
const std::vector<int64_t> expected_timestamps = {5, 11};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ TEST(PacketThinnerCalculatorTest, AsyncUniformStreamThinningTest) {
|
|||
runner.SetInput({2, 4, 6, 8, 10, 12, 14});
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {2, 8, 14};
|
||||
const std::vector<int64_t> expected_timestamps = {2, 8, 14};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -123,10 +123,10 @@ TEST(PacketThinnerCalculatorTest, ASyncUniformStreamThinningTestBySidePacket) {
|
|||
|
||||
SimpleRunner runner(node);
|
||||
runner.SetInput({2, 4, 6, 8, 10, 12, 14});
|
||||
runner.MutableSidePackets()->Tag(kPeriodTag) = MakePacket<int64>(5);
|
||||
runner.MutableSidePackets()->Tag(kPeriodTag) = MakePacket<int64_t>(5);
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {2, 8, 14};
|
||||
const std::vector<int64_t> expected_timestamps = {2, 8, 14};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ TEST(PacketThinnerCalculatorTest, SyncUniformStreamThinningTest1) {
|
|||
runner.SetInput({2, 4, 6, 8, 10, 12, 14});
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {2, 6, 10, 14};
|
||||
const std::vector<int64_t> expected_timestamps = {2, 6, 10, 14};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -162,10 +162,10 @@ TEST(PacketThinnerCalculatorTest, SyncUniformStreamThinningTestBySidePacket1) {
|
|||
|
||||
SimpleRunner runner(node);
|
||||
runner.SetInput({2, 4, 6, 8, 10, 12, 14});
|
||||
runner.MutableSidePackets()->Tag(kPeriodTag) = MakePacket<int64>(5);
|
||||
runner.MutableSidePackets()->Tag(kPeriodTag) = MakePacket<int64_t>(5);
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {2, 6, 10, 14};
|
||||
const std::vector<int64_t> expected_timestamps = {2, 6, 10, 14};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ TEST(PacketThinnerCalculatorTest, SyncUniformStreamThinningTest2) {
|
|||
runner.SetInput({2, 4, 6, 8, 10, 12, 14});
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {0, 5, 10, 15};
|
||||
const std::vector<int64_t> expected_timestamps = {0, 5, 10, 15};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ TEST(PacketThinnerCalculatorTest, PrimeStreamThinningTest1) {
|
|||
runner.SetInput({2, 3, 5, 7, 11, 13, 17, 19, 23, 29});
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {2, 7, 13, 19, 29};
|
||||
const std::vector<int64_t> expected_timestamps = {2, 7, 13, 19, 29};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ TEST(PacketThinnerCalculatorTest, PrimeStreamThinningTest2) {
|
|||
runner.SetInput({2, 3, 5, 7, 11, 13, 17, 19, 23, 29});
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {2, 5, 11, 17, 19, 23, 29};
|
||||
const std::vector<int64_t> expected_timestamps = {2, 5, 11, 17, 19, 23, 29};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ TEST(PacketThinnerCalculatorTest, BoundaryTimestampTest1) {
|
|||
runner.SetInput({2, 3});
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {0, 5};
|
||||
const std::vector<int64_t> expected_timestamps = {0, 5};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ TEST(PacketThinnerCalculatorTest, BoundaryTimestampTest2) {
|
|||
runner.SetInput({-4, -3, 8, 9});
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {-6, 0, 6, 12};
|
||||
const std::vector<int64_t> expected_timestamps = {-6, 0, 6, 12};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ TEST(PacketThinnerCalculatorTest, FrameRateTest1) {
|
|||
runner.SetFrameRate(1000000.0 / 2);
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {2, 8, 14};
|
||||
const std::vector<int64_t> expected_timestamps = {2, 8, 14};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
// The true sampling period is 6.
|
||||
EXPECT_DOUBLE_EQ(1000000.0 / 6, runner.GetFrameRate());
|
||||
|
@ -287,7 +287,7 @@ TEST(PacketThinnerCalculatorTest, FrameRateTest2) {
|
|||
runner.SetInput({8, 16, 24, 32, 40, 48, 56});
|
||||
runner.SetFrameRate(1000000.0 / 8);
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
const std::vector<int64> expected_timestamps = {8, 16, 24, 32, 40, 48, 56};
|
||||
const std::vector<int64_t> expected_timestamps = {8, 16, 24, 32, 40, 48, 56};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
// The true sampling period is still 8.
|
||||
EXPECT_DOUBLE_EQ(1000000.0 / 8, runner.GetFrameRate());
|
||||
|
@ -308,7 +308,7 @@ TEST(PacketThinnerCalculatorTest, FrameRateTest3) {
|
|||
runner.SetFrameRate(1000000.0 / 2);
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {2, 6, 10, 14};
|
||||
const std::vector<int64_t> expected_timestamps = {2, 6, 10, 14};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
// The true (long-run) sampling period is 5.
|
||||
EXPECT_DOUBLE_EQ(1000000.0 / 5, runner.GetFrameRate());
|
||||
|
@ -329,7 +329,7 @@ TEST(PacketThinnerCalculatorTest, FrameRateTest4) {
|
|||
runner.SetFrameRate(1000000.0 / 2);
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {0, 5, 10, 15};
|
||||
const std::vector<int64_t> expected_timestamps = {0, 5, 10, 15};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
// The true (long-run) sampling period is 5.
|
||||
EXPECT_DOUBLE_EQ(1000000.0 / 5, runner.GetFrameRate());
|
||||
|
@ -349,7 +349,7 @@ TEST(PacketThinnerCalculatorTest, FrameRateTest5) {
|
|||
runner.SetFrameRate(1000000.0 / 8);
|
||||
MP_ASSERT_OK(runner.Run());
|
||||
|
||||
const std::vector<int64> expected_timestamps = {10, 15, 25, 30, 40, 50, 55};
|
||||
const std::vector<int64_t> expected_timestamps = {10, 15, 25, 30, 40, 50, 55};
|
||||
EXPECT_EQ(expected_timestamps, runner.GetOutputTimestamps());
|
||||
// The true (long-run) sampling period is 8.
|
||||
EXPECT_DOUBLE_EQ(1000000.0 / 8, runner.GetFrameRate());
|
||||
|
|
|
@ -52,8 +52,8 @@ class AtomicSemaphore {
|
|||
};
|
||||
|
||||
// Returns the timestamp values for a vector of Packets.
|
||||
std::vector<int64> TimestampValues(const std::vector<Packet>& packets) {
|
||||
std::vector<int64> result;
|
||||
std::vector<int64_t> TimestampValues(const std::vector<Packet>& packets) {
|
||||
std::vector<int64_t> result;
|
||||
for (const Packet& packet : packets) {
|
||||
result.push_back(packet.Timestamp().Value());
|
||||
}
|
||||
|
@ -283,9 +283,9 @@ TEST_F(RealTimeFlowLimiterCalculatorTest, BackEdgeCloses) {
|
|||
InitializeGraph(1);
|
||||
MP_ASSERT_OK(graph_.StartRun({}));
|
||||
|
||||
auto send_packet = [this](const std::string& input_name, int64 n) {
|
||||
auto send_packet = [this](const std::string& input_name, int64_t n) {
|
||||
MP_EXPECT_OK(graph_.AddPacketToInputStream(
|
||||
input_name, MakePacket<int64>(n).At(Timestamp(n))));
|
||||
input_name, MakePacket<int64_t>(n).At(Timestamp(n))));
|
||||
};
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
@ -307,14 +307,14 @@ TEST_F(RealTimeFlowLimiterCalculatorTest, BackEdgeCloses) {
|
|||
EXPECT_EQ(10, out_2_packets_.size());
|
||||
|
||||
// Timestamps have not been messed with.
|
||||
EXPECT_EQ(PacketValues<int64>(out_1_packets_),
|
||||
EXPECT_EQ(PacketValues<int64_t>(out_1_packets_),
|
||||
TimestampValues(out_1_packets_));
|
||||
EXPECT_EQ(PacketValues<int64>(out_2_packets_),
|
||||
EXPECT_EQ(PacketValues<int64_t>(out_2_packets_),
|
||||
TimestampValues(out_2_packets_));
|
||||
|
||||
// Extra inputs on in_1 have been dropped
|
||||
EXPECT_EQ(TimestampValues(out_1_packets_),
|
||||
(std::vector<int64>{0, 10, 20, 30, 40, 50, 60, 70, 80, 90}));
|
||||
(std::vector<int64_t>{0, 10, 20, 30, 40, 50, 60, 70, 80, 90}));
|
||||
EXPECT_EQ(TimestampValues(out_1_packets_), TimestampValues(out_2_packets_));
|
||||
|
||||
// The closing of the stream has been propagated.
|
||||
|
@ -339,7 +339,7 @@ TEST_F(RealTimeFlowLimiterCalculatorTest, AllStreamsClose) {
|
|||
|
||||
EXPECT_EQ(TimestampValues(out_1_packets_), TimestampValues(out_2_packets_));
|
||||
EXPECT_EQ(TimestampValues(out_1_packets_),
|
||||
(std::vector<int64>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}));
|
||||
(std::vector<int64_t>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}));
|
||||
EXPECT_EQ(1, close_count_);
|
||||
}
|
||||
|
||||
|
@ -392,50 +392,50 @@ TEST(RealTimeFlowLimiterCalculator, TwoStreams) {
|
|||
send_packet("in_a", 1);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(allow, false);
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64>{}));
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64_t>{}));
|
||||
|
||||
send_packet("in_a", 2);
|
||||
send_packet("in_b", 1);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(allow, false);
|
||||
|
||||
send_packet("finished", 1);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(allow, true);
|
||||
|
||||
send_packet("in_b", 2);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(allow, true);
|
||||
|
||||
send_packet("in_b", 3);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64>{1, 3}));
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64_t>{1, 3}));
|
||||
EXPECT_EQ(allow, false);
|
||||
|
||||
send_packet("in_b", 4);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64>{1, 3}));
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64_t>{1}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64_t>{1, 3}));
|
||||
EXPECT_EQ(allow, false);
|
||||
|
||||
send_packet("in_a", 3);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64>{1, 3}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64>{1, 3}));
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64_t>{1, 3}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64_t>{1, 3}));
|
||||
EXPECT_EQ(allow, false);
|
||||
|
||||
send_packet("finished", 3);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64>{1, 3}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64>{1, 3}));
|
||||
EXPECT_EQ(TimestampValues(a_passed), (std::vector<int64_t>{1, 3}));
|
||||
EXPECT_EQ(TimestampValues(b_passed), (std::vector<int64_t>{1, 3}));
|
||||
EXPECT_EQ(allow, true);
|
||||
|
||||
MP_EXPECT_OK(graph_.CloseAllInputStreams());
|
||||
|
@ -486,7 +486,7 @@ TEST(RealTimeFlowLimiterCalculator, CanConsume) {
|
|||
send_packet("in", 1);
|
||||
MP_EXPECT_OK(graph_.WaitUntilIdle());
|
||||
EXPECT_EQ(allow, false);
|
||||
EXPECT_EQ(TimestampValues(in_sampled_packets_), (std::vector<int64>{1}));
|
||||
EXPECT_EQ(TimestampValues(in_sampled_packets_), (std::vector<int64_t>{1}));
|
||||
|
||||
MP_EXPECT_OK(in_sampled_packets_[0].Consume<int>());
|
||||
|
||||
|
|
|
@ -322,10 +322,10 @@ TEST(SidePacketToStreamCalculator, AtTimestamp) {
|
|||
|
||||
MP_ASSERT_OK(graph.Initialize(graph_config));
|
||||
const int expected_value = 20;
|
||||
const int64 expected_timestamp = 5;
|
||||
const int64_t expected_timestamp = 5;
|
||||
MP_ASSERT_OK(
|
||||
graph.StartRun({{"side_packet", MakePacket<int>(expected_value)},
|
||||
{"timestamp", MakePacket<int64>(expected_timestamp)}}));
|
||||
{"timestamp", MakePacket<int64_t>(expected_timestamp)}}));
|
||||
|
||||
MP_ASSERT_OK(graph.WaitUntilDone());
|
||||
|
||||
|
@ -360,11 +360,11 @@ TEST(SidePacketToStreamCalculator, AtTimestamp_MultipleOutputs) {
|
|||
MP_ASSERT_OK(graph.Initialize(graph_config));
|
||||
const int expected_value0 = 20;
|
||||
const int expected_value1 = 15;
|
||||
const int64 expected_timestamp = 5;
|
||||
const int64_t expected_timestamp = 5;
|
||||
MP_ASSERT_OK(
|
||||
graph.StartRun({{"side_packet0", MakePacket<int>(expected_value0)},
|
||||
{"side_packet1", MakePacket<int>(expected_value1)},
|
||||
{"timestamp", MakePacket<int64>(expected_timestamp)}}));
|
||||
{"timestamp", MakePacket<int64_t>(expected_timestamp)}}));
|
||||
|
||||
MP_ASSERT_OK(graph.WaitUntilDone());
|
||||
|
||||
|
|
|
@ -156,9 +156,9 @@ class SplitListsCalculator : public CalculatorBase {
|
|||
virtual ItemType* AddItem(ListType& list) const = 0;
|
||||
|
||||
private:
|
||||
std::vector<std::pair<int32, int32>> ranges_;
|
||||
int32 max_range_end_ = -1;
|
||||
int32 total_elements_ = 0;
|
||||
std::vector<std::pair<int32_t, int32_t>> ranges_;
|
||||
int32_t max_range_end_ = -1;
|
||||
int32_t total_elements_ = 0;
|
||||
bool element_only_ = false;
|
||||
bool combine_outputs_ = false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user