Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Unified Diff: media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc

Issue 556693002: Cast: Logging estimates clock difference based on packets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/logging/receiver_time_offset_estimator_impl.cc ('k') | media/cast/test/sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
diff --git a/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc b/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
index 16f0e515b3f3d3a9893a496e51b1bb9ffc6011d3..c1059aec1873560241049128d9972a971a4c462e 100644
--- a/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
+++ b/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
@@ -24,8 +24,7 @@ class ReceiverTimeOffsetEstimatorImplTest : public ::testing::Test {
scoped_ptr<base::TickClock>(sender_clock_).Pass(),
task_runner_,
task_runner_,
- task_runner_)),
- estimator_(cast_environment_->Clock()) {
+ task_runner_)) {
cast_environment_->Logging()->AddRawEventSubscriber(&estimator_);
}
@@ -73,6 +72,13 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EstimateOffset) {
true,
5678);
+ cast_environment_->Logging()->InsertPacketEvent(
+ sender_clock_->NowTicks(),
+ PACKET_SENT_TO_NETWORK, VIDEO_EVENT,
+ rtp_timestamp,
+ frame_id,
+ 56, 78, 1500);
+
EXPECT_FALSE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound));
AdvanceClocks(base::TimeDelta::FromMilliseconds(10));
@@ -80,6 +86,13 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EstimateOffset) {
receiver_clock_.NowTicks(), FRAME_ACK_SENT, VIDEO_EVENT,
rtp_timestamp, frame_id);
+ cast_environment_->Logging()->InsertPacketEvent(
+ receiver_clock_.NowTicks(),
+ PACKET_RECEIVED, VIDEO_EVENT,
+ rtp_timestamp,
+ frame_id,
+ 56, 78, 1500);
+
EXPECT_FALSE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound));
AdvanceClocks(base::TimeDelta::FromMilliseconds(30));
@@ -122,6 +135,13 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EventCArrivesBeforeEventB) {
true,
5678);
+ cast_environment_->Logging()->InsertPacketEvent(
+ sender_clock_->NowTicks(),
+ PACKET_SENT_TO_NETWORK, VIDEO_EVENT,
+ rtp_timestamp,
+ frame_id,
+ 56, 78, 1500);
+
EXPECT_FALSE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound));
AdvanceClocks(base::TimeDelta::FromMilliseconds(10));
@@ -134,6 +154,13 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EventCArrivesBeforeEventB) {
EXPECT_FALSE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound));
+ cast_environment_->Logging()->InsertPacketEvent(
+ event_b_time,
+ PACKET_RECEIVED, VIDEO_EVENT,
+ rtp_timestamp,
+ frame_id,
+ 56, 78, 1500);
+
cast_environment_->Logging()->InsertFrameEvent(
event_b_time, FRAME_ACK_SENT, VIDEO_EVENT, rtp_timestamp, frame_id);
@@ -176,6 +203,13 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) {
true,
5678);
+ cast_environment_->Logging()->InsertPacketEvent(
+ sender_clock_->NowTicks(),
+ PACKET_SENT_TO_NETWORK, VIDEO_EVENT,
+ rtp_timestamp_a,
+ frame_id_a,
+ 56, 78, 1500);
+
AdvanceClocks(base::TimeDelta::FromMilliseconds(10));
cast_environment_->Logging()->InsertEncodedFrameEvent(
sender_clock_->NowTicks(),
@@ -185,11 +219,27 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) {
1234,
true,
5678);
+
+ cast_environment_->Logging()->InsertPacketEvent(
+ sender_clock_->NowTicks(),
+ PACKET_SENT_TO_NETWORK, VIDEO_EVENT,
+ rtp_timestamp_b,
+ frame_id_b,
+ 56, 78, 1500);
+
cast_environment_->Logging()->InsertFrameEvent(
receiver_clock_.NowTicks(), FRAME_ACK_SENT, VIDEO_EVENT,
rtp_timestamp_a, frame_id_a);
AdvanceClocks(base::TimeDelta::FromMilliseconds(20));
+
+ cast_environment_->Logging()->InsertPacketEvent(
+ receiver_clock_.NowTicks(),
+ PACKET_RECEIVED, VIDEO_EVENT,
+ rtp_timestamp_b,
+ frame_id_b,
+ 56, 78, 1500);
+
cast_environment_->Logging()->InsertFrameEvent(
receiver_clock_.NowTicks(), FRAME_ACK_SENT, VIDEO_EVENT,
rtp_timestamp_b, frame_id_b);
@@ -218,7 +268,21 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) {
true,
5678);
+ cast_environment_->Logging()->InsertPacketEvent(
+ sender_clock_->NowTicks(),
+ PACKET_SENT_TO_NETWORK, VIDEO_EVENT,
+ rtp_timestamp_c,
+ frame_id_c,
+ 56, 78, 1500);
+
AdvanceClocks(base::TimeDelta::FromMilliseconds(3));
+ cast_environment_->Logging()->InsertPacketEvent(
+ receiver_clock_.NowTicks(),
+ PACKET_RECEIVED, VIDEO_EVENT,
+ rtp_timestamp_c,
+ frame_id_c,
+ 56, 78, 1500);
+
cast_environment_->Logging()->InsertFrameEvent(
receiver_clock_.NowTicks(), FRAME_ACK_SENT, VIDEO_EVENT,
rtp_timestamp_c, frame_id_c);
@@ -233,10 +297,10 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) {
EXPECT_TRUE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound));
int64 lower_bound_ms = lower_bound.InMilliseconds();
int64 upper_bound_ms = upper_bound.InMilliseconds();
- EXPECT_EQ(95, lower_bound_ms);
- EXPECT_EQ(103, upper_bound_ms);
- EXPECT_GE(true_offset_ms, lower_bound_ms);
- EXPECT_LE(true_offset_ms, upper_bound_ms);
+ EXPECT_GT(lower_bound_ms, 90);
+ EXPECT_LE(lower_bound_ms, true_offset_ms);
+ EXPECT_LT(upper_bound_ms, 150);
+ EXPECT_GT(upper_bound_ms, true_offset_ms);
}
} // namespace cast
« no previous file with comments | « media/cast/logging/receiver_time_offset_estimator_impl.cc ('k') | media/cast/test/sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698