OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/test/simple_test_tick_clock.h" | 5 #include "base/test/simple_test_tick_clock.h" |
6 #include "media/cast/cast_defines.h" | 6 #include "media/cast/cast_defines.h" |
7 #include "media/cast/pacing/paced_sender.h" | 7 #include "media/cast/pacing/paced_sender.h" |
8 #include "media/cast/rtcp/mock_rtcp_receiver_feedback.h" | 8 #include "media/cast/rtcp/mock_rtcp_receiver_feedback.h" |
9 #include "media/cast/rtcp/mock_rtcp_sender_feedback.h" | 9 #include "media/cast/rtcp/mock_rtcp_sender_feedback.h" |
10 #include "media/cast/rtcp/rtcp.h" | 10 #include "media/cast/rtcp/rtcp.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 uint32 new_timestamp = 0; | 330 uint32 new_timestamp = 0; |
331 uint32 old_timestamp = 0; | 331 uint32 old_timestamp = 0; |
332 EXPECT_EQ(0, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); | 332 EXPECT_EQ(0, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); |
333 new_timestamp = 1234567890; | 333 new_timestamp = 1234567890; |
334 old_timestamp = 1234567000; | 334 old_timestamp = 1234567000; |
335 EXPECT_EQ(0, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); | 335 EXPECT_EQ(0, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); |
336 new_timestamp = 1234567000; | 336 new_timestamp = 1234567000; |
337 old_timestamp = 1234567890; | 337 old_timestamp = 1234567890; |
338 EXPECT_EQ(0, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); | 338 EXPECT_EQ(0, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); |
339 new_timestamp = 123; | 339 new_timestamp = 123; |
340 old_timestamp = 4234567890; | 340 old_timestamp = 4234567890u; |
341 EXPECT_EQ(1, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); | 341 EXPECT_EQ(1, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); |
342 new_timestamp = 4234567890; | 342 new_timestamp = 4234567890u; |
343 old_timestamp = 123; | 343 old_timestamp = 123; |
344 EXPECT_EQ(-1, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); | 344 EXPECT_EQ(-1, rtcp_peer.CheckForWrapAround(new_timestamp, old_timestamp)); |
345 } | 345 } |
346 | 346 |
347 TEST_F(RtcpTest, RtpTimestampInSenderTime) { | 347 TEST_F(RtcpTest, RtpTimestampInSenderTime) { |
348 RtcpPeer rtcp_peer(&mock_sender_feedback_, | 348 RtcpPeer rtcp_peer(&mock_sender_feedback_, |
349 NULL, | 349 NULL, |
350 NULL, | 350 NULL, |
351 NULL, | 351 NULL, |
352 kRtcpReducedSize, | 352 kRtcpReducedSize, |
(...skipping 23 matching lines...) Expand all Loading... |
376 EXPECT_EQ(input_time, rtp_timestamp_in_ticks); | 376 EXPECT_EQ(input_time, rtp_timestamp_in_ticks); |
377 | 377 |
378 // Test older rtp_timestamp. | 378 // Test older rtp_timestamp. |
379 rtp_timestamp = 32000; | 379 rtp_timestamp = 32000; |
380 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, | 380 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, |
381 &rtp_timestamp_in_ticks)); | 381 &rtp_timestamp_in_ticks)); |
382 EXPECT_EQ(input_time - base::TimeDelta::FromMilliseconds(1000), | 382 EXPECT_EQ(input_time - base::TimeDelta::FromMilliseconds(1000), |
383 rtp_timestamp_in_ticks); | 383 rtp_timestamp_in_ticks); |
384 | 384 |
385 // Test older rtp_timestamp with wrap. | 385 // Test older rtp_timestamp with wrap. |
386 rtp_timestamp = 4294903296; | 386 rtp_timestamp = 4294903296u; |
387 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, | 387 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, |
388 &rtp_timestamp_in_ticks)); | 388 &rtp_timestamp_in_ticks)); |
389 EXPECT_EQ(input_time - base::TimeDelta::FromMilliseconds(4000), | 389 EXPECT_EQ(input_time - base::TimeDelta::FromMilliseconds(4000), |
390 rtp_timestamp_in_ticks); | 390 rtp_timestamp_in_ticks); |
391 | 391 |
392 // Test newer rtp_timestamp. | 392 // Test newer rtp_timestamp. |
393 rtp_timestamp = 128000; | 393 rtp_timestamp = 128000; |
394 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, | 394 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, |
395 &rtp_timestamp_in_ticks)); | 395 &rtp_timestamp_in_ticks)); |
396 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(2000), | 396 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(2000), |
397 rtp_timestamp_in_ticks); | 397 rtp_timestamp_in_ticks); |
398 | 398 |
399 // Test newer rtp_timestamp with wrap. | 399 // Test newer rtp_timestamp with wrap. |
400 rtp_timestamp = 4294903296; | 400 rtp_timestamp = 4294903296u; |
401 rtcp_peer.OnReceivedLipSyncInfo(rtp_timestamp, ntp_seconds, ntp_fractions); | 401 rtcp_peer.OnReceivedLipSyncInfo(rtp_timestamp, ntp_seconds, ntp_fractions); |
402 rtp_timestamp = 64000; | 402 rtp_timestamp = 64000; |
403 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, | 403 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, |
404 &rtp_timestamp_in_ticks)); | 404 &rtp_timestamp_in_ticks)); |
405 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(4000), | 405 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(4000), |
406 rtp_timestamp_in_ticks); | 406 rtp_timestamp_in_ticks); |
407 } | 407 } |
408 | 408 |
409 } // namespace cast | 409 } // namespace cast |
410 } // namespace media | 410 } // namespace media |
OLD | NEW |