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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 ByteWriter<uint16_t>::WriteBigEndian( | 447 ByteWriter<uint16_t>::WriteBigEndian( |
448 &mod_buffer[2], ByteReader<uint16_t>::ReadBigEndian(&mod_buffer[2]) + | 448 &mod_buffer[2], ByteReader<uint16_t>::ReadBigEndian(&mod_buffer[2]) + |
449 ((kPaddingBytes + 3) / 4)); | 449 ((kPaddingBytes + 3) / 4)); |
450 | 450 |
451 rtc::scoped_ptr<TransportFeedback> parsed_packet( | 451 rtc::scoped_ptr<TransportFeedback> parsed_packet( |
452 TransportFeedback::ParseFrom(mod_buffer, kExpectedSizeWithPadding)); | 452 TransportFeedback::ParseFrom(mod_buffer, kExpectedSizeWithPadding)); |
453 ASSERT_TRUE(parsed_packet.get() != nullptr); | 453 ASSERT_TRUE(parsed_packet.get() != nullptr); |
454 EXPECT_EQ(kExpectedSizeWords * 4, packet->Length()); // Padding not included. | 454 EXPECT_EQ(kExpectedSizeWords * 4, packet->Length()); // Padding not included. |
455 } | 455 } |
456 | 456 |
457 TEST(RtcpPacketTest, TransportFeedback_HeyWhatsGoingOn) { | |
stefan-webrtc
2015/09/30 10:45:27
There must be a better name than this? :)
sprang_webrtc
2015/09/30 11:09:27
Oops. Fixed. :)
| |
458 const int kOneBitVectorCapacity = 14; | |
459 const int kTwoBitVectorCapacity = 7; | |
460 const int64_t kLargeTimeDelta = | |
461 TransportFeedback::kDeltaScaleFactor * (1 << 8); | |
462 | |
463 // Test that a number of small deltas followed by a large delta results in a | |
464 // correct split into multiple chunks, as needed. | |
465 | |
466 for (int num_small_deltas = kTwoBitVectorCapacity - 1; | |
stefan-webrtc
2015/09/30 10:45:27
I don't follow why you don't start this counter on
sprang_webrtc
2015/09/30 11:09:27
Nah, only that that range wasn't quite so suspect.
| |
467 num_small_deltas <= kOneBitVectorCapacity + 1; ++num_small_deltas) { | |
468 TransportFeedback feedback; | |
469 feedback.WithBase(0, 0); | |
470 for (int i = 0; i < num_small_deltas; ++i) | |
471 feedback.WithReceivedPacket(i, i * 1000); | |
472 feedback.WithReceivedPacket(num_small_deltas, | |
473 num_small_deltas * 1000 + kLargeTimeDelta); | |
474 | |
475 rtc::scoped_ptr<rtcp::RawPacket> serialized_packet = feedback.Build(); | |
476 EXPECT_TRUE(serialized_packet.get() != nullptr); | |
477 rtc::scoped_ptr<TransportFeedback> deserialized_packet = | |
478 TransportFeedback::ParseFrom(serialized_packet->Buffer(), | |
479 serialized_packet->Length()); | |
480 EXPECT_TRUE(deserialized_packet.get() != nullptr); | |
481 } | |
482 } | |
483 | |
457 } // namespace | 484 } // namespace |
458 } // namespace webrtc | 485 } // namespace webrtc |
OLD | NEW |