Project import generated by Copybara.

GitOrigin-RevId: 9295f8ea2339edb71073695ed4fb3fded2f48c60
This commit is contained in:
MediaPipe Team
2020-08-13 01:32:08 -04:00
committed by chuoling
parent 6b0ab0e012
commit d7c287c4e9
248 changed files with 10356 additions and 5328 deletions
@@ -123,14 +123,12 @@ TEST_F(OutputStreamManagerTest, Init) {}
TEST_F(OutputStreamManagerTest, ComputeOutputTimestampBoundWithoutOffset) {
Timestamp input_timestamp = Timestamp(0);
Timestamp stream_previous_timestamp_bound =
output_stream_manager_->NextTimestampBound();
Timestamp output_bound = output_stream_manager_->ComputeOutputTimestampBound(
output_stream_shard_, input_timestamp);
// If the offset isn't enabled, the input timestamp and the output bound are
// not related. Since the output stream shard is empty, the output bound is
// still equal to the previous timestamp bound of the stream.
EXPECT_EQ(stream_previous_timestamp_bound, output_bound);
// still Timestamp::Unset().
EXPECT_EQ(Timestamp::Unset(), output_bound);
output_stream_shard_.AddPacket(
MakePacket<std::string>("Packet 1").At(Timestamp(10)));
@@ -253,11 +251,10 @@ TEST_F(OutputStreamManagerTest, ComputeOutputTimestampBoundWithNegativeOffset) {
TEST_F(OutputStreamManagerTest,
ComputeOutputTimestampBoundWithoutOffsetAfterOpenNode) {
Timestamp input_timestamp = Timestamp::Unstarted();
// If the OutputStreamShard is empty, the output_bound is
// Timestamp::PreStream().
// If the OutputStreamShard is empty, the output_bound is Timestamp::Unset().
Timestamp output_bound = output_stream_manager_->ComputeOutputTimestampBound(
output_stream_shard_, input_timestamp);
EXPECT_EQ(Timestamp::PreStream(), output_bound);
EXPECT_EQ(Timestamp::Unset(), output_bound);
output_stream_shard_.AddPacket(
MakePacket<std::string>("Packet 1").At(Timestamp(20)));
@@ -277,10 +274,10 @@ TEST_F(OutputStreamManagerTest,
output_stream_shard_.SetOffset(0);
Timestamp input_timestamp = Timestamp::Unstarted();
// If the OutputStreamShard is empty, the output_bound is always
// Timestamp::PreStream() regardless of the offset.
// Timestamp::Unset() regardless of the offset.
Timestamp output_bound = output_stream_manager_->ComputeOutputTimestampBound(
output_stream_shard_, input_timestamp);
EXPECT_EQ(Timestamp::PreStream(), output_bound);
EXPECT_EQ(Timestamp::Unset(), output_bound);
output_stream_shard_.AddPacket(
MakePacket<std::string>("Packet 1").At(Timestamp(20)));
@@ -298,13 +295,11 @@ TEST_F(OutputStreamManagerTest,
TEST_F(OutputStreamManagerTest,
ComputeOutputTimestampBoundWithoutOffsetForPreStream) {
Timestamp input_timestamp = Timestamp::PreStream();
Timestamp stream_previous_timestamp_bound =
output_stream_manager_->NextTimestampBound();
// If the OutputStreamShard is empty, the output bound is equal to the
// previous timestamp bound of the stream.
// Timestamp::Unset().
Timestamp output_bound = output_stream_manager_->ComputeOutputTimestampBound(
output_stream_shard_, input_timestamp);
EXPECT_EQ(stream_previous_timestamp_bound, output_bound);
EXPECT_EQ(Timestamp::Unset(), output_bound);
output_stream_shard_.AddPacket(
MakePacket<std::string>("Packet 1").At(Timestamp(20)));
@@ -370,13 +365,10 @@ TEST_F(OutputStreamManagerTest, AddPacketUnset) {
ASSERT_EQ(1, errors_.size());
EXPECT_TRUE(output_stream_shard_.IsEmpty());
Timestamp stream_previous_timestamp_bound =
output_stream_manager_->NextTimestampBound();
Timestamp output_bound = output_stream_manager_->ComputeOutputTimestampBound(
output_stream_shard_, input_timestamp);
// The output bound is still equal to the previous timestamp bound of the
// stream.
EXPECT_EQ(stream_previous_timestamp_bound, output_bound);
// The output bound is still equal to Timestamp::Unset().
EXPECT_EQ(Timestamp::Unset(), output_bound);
output_stream_manager_->PropagateUpdatesToMirrors(output_bound,
&output_stream_shard_);
@@ -394,13 +386,10 @@ TEST_F(OutputStreamManagerTest, AddPacketUnstarted) {
ASSERT_EQ(1, errors_.size());
EXPECT_TRUE(output_stream_shard_.IsEmpty());
Timestamp stream_previous_timestamp_bound =
output_stream_manager_->NextTimestampBound();
Timestamp output_bound = output_stream_manager_->ComputeOutputTimestampBound(
output_stream_shard_, input_timestamp);
// The output bound is still equal to the previous timestamp bound of the
// stream.
EXPECT_EQ(stream_previous_timestamp_bound, output_bound);
// The output bound is still equal to Timestamp::Unset().
EXPECT_EQ(Timestamp::Unset(), output_bound);
output_stream_manager_->PropagateUpdatesToMirrors(output_bound,
&output_stream_shard_);
@@ -419,13 +408,10 @@ TEST_F(OutputStreamManagerTest, AddPacketOneOverPostStream) {
ASSERT_EQ(1, errors_.size());
EXPECT_TRUE(output_stream_shard_.IsEmpty());
Timestamp stream_previous_timestamp_bound =
output_stream_manager_->NextTimestampBound();
Timestamp output_bound = output_stream_manager_->ComputeOutputTimestampBound(
output_stream_shard_, input_timestamp);
// The output bound is still equal to the previous timestamp bound of the
// stream.
EXPECT_EQ(stream_previous_timestamp_bound, output_bound);
// The output bound is still equal to Timestamp::Unset().
EXPECT_EQ(Timestamp::Unset(), output_bound);
output_stream_manager_->PropagateUpdatesToMirrors(output_bound,
&output_stream_shard_);
@@ -444,13 +430,10 @@ TEST_F(OutputStreamManagerTest, AddPacketdDone) {
ASSERT_EQ(1, errors_.size());
EXPECT_TRUE(output_stream_shard_.IsEmpty());
Timestamp stream_previous_timestamp_bound =
output_stream_manager_->NextTimestampBound();
Timestamp output_bound = output_stream_manager_->ComputeOutputTimestampBound(
output_stream_shard_, input_timestamp);
// The output bound is still equal to the previous timestamp bound of the
// stream.
EXPECT_EQ(stream_previous_timestamp_bound, output_bound);
// The output bound is still equal to Timestamp::Unset().
EXPECT_EQ(Timestamp::Unset(), output_bound);
output_stream_manager_->PropagateUpdatesToMirrors(output_bound,
&output_stream_shard_);