Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/test/simple_test_tick_clock.h" | 9 #include "base/test/simple_test_tick_clock.h" |
| 10 #include "media/cast/cast_environment.h" | 10 #include "media/cast/cast_environment.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 builder.AddCst2(std::vector<uint32_t>{kAckFrameId + 2, kAckFrameId + 3}); | 334 builder.AddCst2(std::vector<uint32_t>{kAckFrameId + 2, kAckFrameId + 3}); |
| 335 | 335 |
| 336 // Parse should succeed with the added CST2 section in the feedback, even | 336 // Parse should succeed with the added CST2 section in the feedback, even |
| 337 // though we don't currently parse it directly. | 337 // though we don't currently parse it directly. |
| 338 RtcpParser parser(kSourceSsrc, kSenderSsrc); | 338 RtcpParser parser(kSourceSsrc, kSenderSsrc); |
| 339 EXPECT_TRUE(parser.Parse(builder.Reader())); | 339 EXPECT_TRUE(parser.Parse(builder.Reader())); |
| 340 ExpectLastReport(parser); | 340 ExpectLastReport(parser); |
| 341 ExpectCastFeedback(parser); | 341 ExpectCastFeedback(parser); |
| 342 } | 342 } |
| 343 | 343 |
| 344 TEST_F(RtcpParserTest, InjectReceiverReportPli) { | |
| 345 // Expect to be ignored since the sender ssrc does not match. | |
| 346 TestRtcpPacketBuilder builder1; | |
| 347 builder1.AddPli(kUnknownSsrc, kSourceSsrc); | |
| 348 RtcpParser parser1(kSourceSsrc, kSenderSsrc); | |
|
Irfan
2016/02/29 16:01:23
I find kSourceSssrc and kSenderSsrc unclear. Shoul
xjz
2016/02/29 19:48:58
Done.
| |
| 349 EXPECT_TRUE(parser1.Parse(builder1.Reader())); | |
| 350 EXPECT_FALSE(parser1.has_picture_loss_indicator()); | |
| 351 | |
| 352 // Expect to be ignored since the receiver ssrc does not match. | |
| 353 TestRtcpPacketBuilder builder2; | |
| 354 builder2.AddPli(kSenderSsrc, kUnknownSsrc); | |
| 355 RtcpParser parser2(kSourceSsrc, kSenderSsrc); | |
| 356 EXPECT_TRUE(parser2.Parse(builder2.Reader())); | |
| 357 EXPECT_FALSE(parser2.has_picture_loss_indicator()); | |
| 358 | |
| 359 TestRtcpPacketBuilder builder3; | |
| 360 builder3.AddPli(kSenderSsrc, kSourceSsrc); | |
| 361 RtcpParser parser3(kSourceSsrc, kSenderSsrc); | |
| 362 EXPECT_TRUE(parser3.Parse(builder3.Reader())); | |
| 363 EXPECT_TRUE(parser3.has_picture_loss_indicator()); | |
| 364 } | |
| 365 | |
| 344 TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationBase) { | 366 TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationBase) { |
| 345 static const uint32_t kTimeBaseMs = 12345678; | 367 static const uint32_t kTimeBaseMs = 12345678; |
| 346 static const uint32_t kTimeDelayMs = 10; | 368 static const uint32_t kTimeDelayMs = 10; |
| 347 static const uint32_t kDelayDeltaMs = 123; | 369 static const uint32_t kDelayDeltaMs = 123; |
| 348 base::SimpleTestTickClock testing_clock; | 370 base::SimpleTestTickClock testing_clock; |
| 349 testing_clock.Advance(base::TimeDelta::FromMilliseconds(kTimeBaseMs)); | 371 testing_clock.Advance(base::TimeDelta::FromMilliseconds(kTimeBaseMs)); |
| 350 | 372 |
| 351 RtcpReceiverLogMessage receiver_log; | 373 RtcpReceiverLogMessage receiver_log; |
| 352 RtcpReceiverFrameLogMessage frame_log(RtpTimeTicks().Expand(kRtpTimestamp)); | 374 RtcpReceiverFrameLogMessage frame_log(RtpTimeTicks().Expand(kRtpTimestamp)); |
| 353 RtcpReceiverEventLogMessage event_log; | 375 RtcpReceiverEventLogMessage event_log; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 base::TimeTicks out_3 = ConvertNtpToTimeTicks(ntp_seconds_3, ntp_fraction_3); | 483 base::TimeTicks out_3 = ConvertNtpToTimeTicks(ntp_seconds_3, ntp_fraction_3); |
| 462 EXPECT_EQ(input_time, out_3); // Verify inverse. | 484 EXPECT_EQ(input_time, out_3); // Verify inverse. |
| 463 | 485 |
| 464 // Verify delta. | 486 // Verify delta. |
| 465 EXPECT_EQ((out_3 - out_2), time_delta); | 487 EXPECT_EQ((out_3 - out_2), time_delta); |
| 466 EXPECT_NEAR((ntp_fraction_3 - ntp_fraction_2), 0xffffffff / 2, 1); | 488 EXPECT_NEAR((ntp_fraction_3 - ntp_fraction_2), 0xffffffff / 2, 1); |
| 467 } | 489 } |
| 468 | 490 |
| 469 } // namespace cast | 491 } // namespace cast |
| 470 } // namespace media | 492 } // namespace media |
| OLD | NEW |