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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc

Issue 1376673004: Add a PacketOptions struct to webrtc::Transport. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comment added Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void DropEveryNthPacket(int n) { 89 void DropEveryNthPacket(int n) {
90 packet_loss_ = n; 90 packet_loss_ = n;
91 } 91 }
92 92
93 void DropConsecutivePackets(int start, int total) { 93 void DropConsecutivePackets(int start, int total) {
94 consecutive_drop_start_ = start; 94 consecutive_drop_start_ = start;
95 consecutive_drop_end_ = start + total; 95 consecutive_drop_end_ = start + total;
96 packet_loss_ = 0; 96 packet_loss_ = 0;
97 } 97 }
98 98
99 bool SendRtp(const uint8_t* data, size_t len) override { 99 bool SendRtp(const uint8_t* data,
100 size_t len,
101 const PacketOptions& options) override {
100 count_++; 102 count_++;
101 const unsigned char* ptr = static_cast<const unsigned char*>(data); 103 const unsigned char* ptr = static_cast<const unsigned char*>(data);
102 uint32_t ssrc = (ptr[8] << 24) + (ptr[9] << 16) + (ptr[10] << 8) + ptr[11]; 104 uint32_t ssrc = (ptr[8] << 24) + (ptr[9] << 16) + (ptr[10] << 8) + ptr[11];
103 if (ssrc == rtx_ssrc_) count_rtx_ssrc_++; 105 if (ssrc == rtx_ssrc_) count_rtx_ssrc_++;
104 uint16_t sequence_number = (ptr[2] << 8) + ptr[3]; 106 uint16_t sequence_number = (ptr[2] << 8) + ptr[3];
105 size_t packet_length = len; 107 size_t packet_length = len;
106 // TODO(pbos): Figure out why this needs to be initialized. Likely this 108 // TODO(pbos): Figure out why this needs to be initialized. Likely this
107 // is hiding a bug either in test setup or other code. 109 // is hiding a bug either in test setup or other code.
108 // https://code.google.com/p/webrtc/issues/detail?id=3183 110 // https://code.google.com/p/webrtc/issues/detail?id=3183
109 uint8_t restored_packet[1500] = {0}; 111 uint8_t restored_packet[1500] = {0};
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 344
343 TEST_F(RtpRtcpRtxNackTest, RtxNack) { 345 TEST_F(RtpRtcpRtxNackTest, RtxNack) {
344 RunRtxTest(kRtxRetransmitted, 10); 346 RunRtxTest(kRtxRetransmitted, 10);
345 EXPECT_EQ(kTestSequenceNumber, *(receiver_.sequence_numbers_.begin())); 347 EXPECT_EQ(kTestSequenceNumber, *(receiver_.sequence_numbers_.begin()));
346 EXPECT_EQ(kTestSequenceNumber + kTestNumberOfPackets - 1, 348 EXPECT_EQ(kTestSequenceNumber + kTestNumberOfPackets - 1,
347 *(receiver_.sequence_numbers_.rbegin())); 349 *(receiver_.sequence_numbers_.rbegin()));
348 EXPECT_EQ(kTestNumberOfPackets, receiver_.sequence_numbers_.size()); 350 EXPECT_EQ(kTestNumberOfPackets, receiver_.sequence_numbers_.size());
349 EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_); 351 EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_);
350 EXPECT_TRUE(ExpectedPacketsReceived()); 352 EXPECT_TRUE(ExpectedPacketsReceived());
351 } 353 }
OLDNEW
« no previous file with comments | « webrtc/call/transport_adapter.cc ('k') | webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698