OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 EXPECT_NEAR(expected_time, accumulated_delta, | 353 EXPECT_NEAR(expected_time, accumulated_delta, |
354 TransportFeedback::kDeltaScaleFactor / 2); | 354 TransportFeedback::kDeltaScaleFactor / 2); |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 TEST(RtcpPacketTest, TransportFeedback_Limits) { | 358 TEST(RtcpPacketTest, TransportFeedback_Limits) { |
359 // Sequence number wrap above 0x8000. | 359 // Sequence number wrap above 0x8000. |
360 std::unique_ptr<TransportFeedback> packet(new TransportFeedback()); | 360 std::unique_ptr<TransportFeedback> packet(new TransportFeedback()); |
361 packet->WithBase(0, 0); | 361 packet->WithBase(0, 0); |
| 362 EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0)); |
362 EXPECT_TRUE(packet->WithReceivedPacket(0x8000, 1000)); | 363 EXPECT_TRUE(packet->WithReceivedPacket(0x8000, 1000)); |
363 | 364 |
364 packet.reset(new TransportFeedback()); | 365 packet.reset(new TransportFeedback()); |
365 packet->WithBase(0, 0); | 366 packet->WithBase(0, 0); |
| 367 EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0)); |
366 EXPECT_FALSE(packet->WithReceivedPacket(0x8000 + 1, 1000)); | 368 EXPECT_FALSE(packet->WithReceivedPacket(0x8000 + 1, 1000)); |
367 | 369 |
368 // Packet status count max 0xFFFF. | 370 // Packet status count max 0xFFFF. |
369 packet.reset(new TransportFeedback()); | 371 packet.reset(new TransportFeedback()); |
370 packet->WithBase(0, 0); | 372 packet->WithBase(0, 0); |
| 373 EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0)); |
371 EXPECT_TRUE(packet->WithReceivedPacket(0x8000, 1000)); | 374 EXPECT_TRUE(packet->WithReceivedPacket(0x8000, 1000)); |
372 EXPECT_TRUE(packet->WithReceivedPacket(0xFFFF, 2000)); | 375 EXPECT_TRUE(packet->WithReceivedPacket(0xFFFF, 2000)); |
373 EXPECT_FALSE(packet->WithReceivedPacket(0, 3000)); | 376 EXPECT_FALSE(packet->WithReceivedPacket(0, 3000)); |
374 | 377 |
375 // Too large delta. | 378 // Too large delta. |
376 packet.reset(new TransportFeedback()); | 379 packet.reset(new TransportFeedback()); |
377 packet->WithBase(0, 0); | 380 packet->WithBase(0, 0); |
378 int64_t kMaxPositiveTimeDelta = std::numeric_limits<int16_t>::max() * | 381 int64_t kMaxPositiveTimeDelta = std::numeric_limits<int16_t>::max() * |
379 TransportFeedback::kDeltaScaleFactor; | 382 TransportFeedback::kDeltaScaleFactor; |
380 EXPECT_FALSE(packet->WithReceivedPacket( | 383 EXPECT_FALSE(packet->WithReceivedPacket( |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 rtc::Buffer serialized_packet = feedback.Build(); | 474 rtc::Buffer serialized_packet = feedback.Build(); |
472 std::unique_ptr<TransportFeedback> deserialized_packet = | 475 std::unique_ptr<TransportFeedback> deserialized_packet = |
473 TransportFeedback::ParseFrom(serialized_packet.data(), | 476 TransportFeedback::ParseFrom(serialized_packet.data(), |
474 serialized_packet.size()); | 477 serialized_packet.size()); |
475 EXPECT_TRUE(deserialized_packet.get() != nullptr); | 478 EXPECT_TRUE(deserialized_packet.get() != nullptr); |
476 } | 479 } |
477 } | 480 } |
478 | 481 |
479 } // namespace | 482 } // namespace |
480 } // namespace webrtc | 483 } // namespace webrtc |
OLD | NEW |