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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc

Issue 2616343003: Refactor TransportFeedback ensuring it's consistency: (Closed)
Patch Set: . Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 packet.reset(new TransportFeedback()); 364 packet.reset(new TransportFeedback());
365 packet->SetBase(0, 0); 365 packet->SetBase(0, 0);
366 EXPECT_TRUE(packet->AddReceivedPacket(0x0, 0)); 366 EXPECT_TRUE(packet->AddReceivedPacket(0x0, 0));
367 EXPECT_FALSE(packet->AddReceivedPacket(0x8000 + 1, 1000)); 367 EXPECT_FALSE(packet->AddReceivedPacket(0x8000 + 1, 1000));
368 368
369 // Packet status count max 0xFFFF. 369 // Packet status count max 0xFFFF.
370 packet.reset(new TransportFeedback()); 370 packet.reset(new TransportFeedback());
371 packet->SetBase(0, 0); 371 packet->SetBase(0, 0);
372 EXPECT_TRUE(packet->AddReceivedPacket(0x0, 0)); 372 EXPECT_TRUE(packet->AddReceivedPacket(0x0, 0));
373 EXPECT_TRUE(packet->AddReceivedPacket(0x8000, 1000)); 373 EXPECT_TRUE(packet->AddReceivedPacket(0x8000, 1000));
374 EXPECT_TRUE(packet->AddReceivedPacket(0xFFFF, 2000)); 374 EXPECT_TRUE(packet->AddReceivedPacket(0xFFFE, 2000));
danilchap 2017/01/11 17:11:57 ([0, 0xffff] has size 0x10000 which exceed maximum
375 EXPECT_FALSE(packet->AddReceivedPacket(0, 3000)); 375 EXPECT_FALSE(packet->AddReceivedPacket(0xFFFF, 3000));
376 376
377 // Too large delta. 377 // Too large delta.
378 packet.reset(new TransportFeedback()); 378 packet.reset(new TransportFeedback());
379 packet->SetBase(0, 0); 379 packet->SetBase(0, 0);
380 int64_t kMaxPositiveTimeDelta = std::numeric_limits<int16_t>::max() * 380 int64_t kMaxPositiveTimeDelta = std::numeric_limits<int16_t>::max() *
381 TransportFeedback::kDeltaScaleFactor; 381 TransportFeedback::kDeltaScaleFactor;
382 EXPECT_FALSE(packet->AddReceivedPacket( 382 EXPECT_FALSE(packet->AddReceivedPacket(
383 1, kMaxPositiveTimeDelta + TransportFeedback::kDeltaScaleFactor)); 383 1, kMaxPositiveTimeDelta + TransportFeedback::kDeltaScaleFactor));
384 EXPECT_TRUE(packet->AddReceivedPacket(1, kMaxPositiveTimeDelta)); 384 EXPECT_TRUE(packet->AddReceivedPacket(1, kMaxPositiveTimeDelta));
385 385
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 rtc::Buffer serialized_packet = feedback.Build(); 473 rtc::Buffer serialized_packet = feedback.Build();
474 std::unique_ptr<TransportFeedback> deserialized_packet = 474 std::unique_ptr<TransportFeedback> deserialized_packet =
475 TransportFeedback::ParseFrom(serialized_packet.data(), 475 TransportFeedback::ParseFrom(serialized_packet.data(),
476 serialized_packet.size()); 476 serialized_packet.size());
477 EXPECT_TRUE(deserialized_packet.get() != nullptr); 477 EXPECT_TRUE(deserialized_packet.get() != nullptr);
478 } 478 }
479 } 479 }
480 480
481 } // namespace 481 } // namespace
482 } // namespace webrtc 482 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698