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

Side by Side Diff: webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc

Issue 1903043003: WIP: Adding a centralized NetEq Clock (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-remove-type-param
Patch Set: Created 4 years, 8 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
11 // Unit tests for PacketBuffer class. 11 // Unit tests for PacketBuffer class.
12 12
13 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h" 13 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
14 14
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h" 17 #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h"
18 #include "webrtc/modules/audio_coding/neteq/packet.h" 18 #include "webrtc/modules/audio_coding/neteq/packet.h"
19 #include "webrtc/modules/audio_coding/neteq/tick_timer.h"
19 20
20 using ::testing::Return; 21 using ::testing::Return;
21 using ::testing::_; 22 using ::testing::_;
22 23
23 namespace webrtc { 24 namespace webrtc {
24 25
25 // Helper class to generate packets. Packets must be deleted by the user. 26 // Helper class to generate packets. Packets must be deleted by the user.
26 class PacketGenerator { 27 class PacketGenerator {
27 public: 28 public:
28 PacketGenerator(uint16_t seq_no, uint32_t ts, uint8_t pt, int frame_size); 29 PacketGenerator(uint16_t seq_no, uint32_t ts, uint8_t pt, int frame_size);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 bool primary; 74 bool primary;
74 // Order of this packet to appear upon extraction, after inserting a series 75 // Order of this packet to appear upon extraction, after inserting a series
75 // of packets. A negative number means that it should have been discarded 76 // of packets. A negative number means that it should have been discarded
76 // before extraction. 77 // before extraction.
77 int extract_order; 78 int extract_order;
78 }; 79 };
79 80
80 // Start of test definitions. 81 // Start of test definitions.
81 82
82 TEST(PacketBuffer, CreateAndDestroy) { 83 TEST(PacketBuffer, CreateAndDestroy) {
83 PacketBuffer* buffer = new PacketBuffer(10); // 10 packets. 84 TickTimer tick_timer;
85 PacketBuffer* buffer = new PacketBuffer(10, tick_timer); // 10 packets.
84 EXPECT_TRUE(buffer->Empty()); 86 EXPECT_TRUE(buffer->Empty());
85 delete buffer; 87 delete buffer;
86 } 88 }
87 89
88 TEST(PacketBuffer, InsertPacket) { 90 TEST(PacketBuffer, InsertPacket) {
89 PacketBuffer buffer(10); // 10 packets. 91 TickTimer tick_timer;
92 PacketBuffer buffer(10, tick_timer); // 10 packets.
90 PacketGenerator gen(17u, 4711u, 0, 10); 93 PacketGenerator gen(17u, 4711u, 0, 10);
91 94
92 const int payload_len = 100; 95 const int payload_len = 100;
93 Packet* packet = gen.NextPacket(payload_len); 96 Packet* packet = gen.NextPacket(payload_len);
94 97
95 EXPECT_EQ(0, buffer.InsertPacket(packet)); 98 EXPECT_EQ(0, buffer.InsertPacket(packet));
96 uint32_t next_ts; 99 uint32_t next_ts;
97 EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts)); 100 EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
98 EXPECT_EQ(4711u, next_ts); 101 EXPECT_EQ(4711u, next_ts);
99 EXPECT_FALSE(buffer.Empty()); 102 EXPECT_FALSE(buffer.Empty());
100 EXPECT_EQ(1u, buffer.NumPacketsInBuffer()); 103 EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
101 const RTPHeader* hdr = buffer.NextRtpHeader(); 104 const RTPHeader* hdr = buffer.NextRtpHeader();
102 EXPECT_EQ(&(packet->header), hdr); // Compare pointer addresses. 105 EXPECT_EQ(&(packet->header), hdr); // Compare pointer addresses.
103 106
104 // Do not explicitly flush buffer or delete packet to test that it is deleted 107 // Do not explicitly flush buffer or delete packet to test that it is deleted
105 // with the buffer. (Tested with Valgrind or similar tool.) 108 // with the buffer. (Tested with Valgrind or similar tool.)
106 } 109 }
107 110
108 // Test to flush buffer. 111 // Test to flush buffer.
109 TEST(PacketBuffer, FlushBuffer) { 112 TEST(PacketBuffer, FlushBuffer) {
110 PacketBuffer buffer(10); // 10 packets. 113 TickTimer tick_timer;
114 PacketBuffer buffer(10, tick_timer); // 10 packets.
111 PacketGenerator gen(0, 0, 0, 10); 115 PacketGenerator gen(0, 0, 0, 10);
112 const int payload_len = 10; 116 const int payload_len = 10;
113 117
114 // Insert 10 small packets; should be ok. 118 // Insert 10 small packets; should be ok.
115 for (int i = 0; i < 10; ++i) { 119 for (int i = 0; i < 10; ++i) {
116 Packet* packet = gen.NextPacket(payload_len); 120 Packet* packet = gen.NextPacket(payload_len);
117 EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(packet)); 121 EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(packet));
118 } 122 }
119 EXPECT_EQ(10u, buffer.NumPacketsInBuffer()); 123 EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
120 EXPECT_FALSE(buffer.Empty()); 124 EXPECT_FALSE(buffer.Empty());
121 125
122 buffer.Flush(); 126 buffer.Flush();
123 // Buffer should delete the payloads itself. 127 // Buffer should delete the payloads itself.
124 EXPECT_EQ(0u, buffer.NumPacketsInBuffer()); 128 EXPECT_EQ(0u, buffer.NumPacketsInBuffer());
125 EXPECT_TRUE(buffer.Empty()); 129 EXPECT_TRUE(buffer.Empty());
126 } 130 }
127 131
128 // Test to fill the buffer over the limits, and verify that it flushes. 132 // Test to fill the buffer over the limits, and verify that it flushes.
129 TEST(PacketBuffer, OverfillBuffer) { 133 TEST(PacketBuffer, OverfillBuffer) {
130 PacketBuffer buffer(10); // 10 packets. 134 TickTimer tick_timer;
135 PacketBuffer buffer(10, tick_timer); // 10 packets.
131 PacketGenerator gen(0, 0, 0, 10); 136 PacketGenerator gen(0, 0, 0, 10);
132 137
133 // Insert 10 small packets; should be ok. 138 // Insert 10 small packets; should be ok.
134 const int payload_len = 10; 139 const int payload_len = 10;
135 int i; 140 int i;
136 for (i = 0; i < 10; ++i) { 141 for (i = 0; i < 10; ++i) {
137 Packet* packet = gen.NextPacket(payload_len); 142 Packet* packet = gen.NextPacket(payload_len);
138 EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(packet)); 143 EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(packet));
139 } 144 }
140 EXPECT_EQ(10u, buffer.NumPacketsInBuffer()); 145 EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
141 uint32_t next_ts; 146 uint32_t next_ts;
142 EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts)); 147 EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
143 EXPECT_EQ(0u, next_ts); // Expect first inserted packet to be first in line. 148 EXPECT_EQ(0u, next_ts); // Expect first inserted packet to be first in line.
144 149
145 // Insert 11th packet; should flush the buffer and insert it after flushing. 150 // Insert 11th packet; should flush the buffer and insert it after flushing.
146 Packet* packet = gen.NextPacket(payload_len); 151 Packet* packet = gen.NextPacket(payload_len);
147 EXPECT_EQ(PacketBuffer::kFlushed, buffer.InsertPacket(packet)); 152 EXPECT_EQ(PacketBuffer::kFlushed, buffer.InsertPacket(packet));
148 EXPECT_EQ(1u, buffer.NumPacketsInBuffer()); 153 EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
149 EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts)); 154 EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
150 // Expect last inserted packet to be first in line. 155 // Expect last inserted packet to be first in line.
151 EXPECT_EQ(packet->header.timestamp, next_ts); 156 EXPECT_EQ(packet->header.timestamp, next_ts);
152 157
153 // Flush buffer to delete all packets. 158 // Flush buffer to delete all packets.
154 buffer.Flush(); 159 buffer.Flush();
155 } 160 }
156 161
157 // Test inserting a list of packets. 162 // Test inserting a list of packets.
158 TEST(PacketBuffer, InsertPacketList) { 163 TEST(PacketBuffer, InsertPacketList) {
159 PacketBuffer buffer(10); // 10 packets. 164 TickTimer tick_timer;
165 PacketBuffer buffer(10, tick_timer); // 10 packets.
160 PacketGenerator gen(0, 0, 0, 10); 166 PacketGenerator gen(0, 0, 0, 10);
161 PacketList list; 167 PacketList list;
162 const int payload_len = 10; 168 const int payload_len = 10;
163 169
164 // Insert 10 small packets. 170 // Insert 10 small packets.
165 for (int i = 0; i < 10; ++i) { 171 for (int i = 0; i < 10; ++i) {
166 Packet* packet = gen.NextPacket(payload_len); 172 Packet* packet = gen.NextPacket(payload_len);
167 list.push_back(packet); 173 list.push_back(packet);
168 } 174 }
169 175
(...skipping 15 matching lines...) Expand all
185 191
186 buffer.Flush(); // Clean up. 192 buffer.Flush(); // Clean up.
187 193
188 EXPECT_CALL(decoder_database, Die()); // Called when object is deleted. 194 EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
189 } 195 }
190 196
191 // Test inserting a list of packets. Last packet is of a different payload type. 197 // Test inserting a list of packets. Last packet is of a different payload type.
192 // Expecting the buffer to flush. 198 // Expecting the buffer to flush.
193 // TODO(hlundin): Remove this test when legacy operation is no longer needed. 199 // TODO(hlundin): Remove this test when legacy operation is no longer needed.
194 TEST(PacketBuffer, InsertPacketListChangePayloadType) { 200 TEST(PacketBuffer, InsertPacketListChangePayloadType) {
195 PacketBuffer buffer(10); // 10 packets. 201 TickTimer tick_timer;
202 PacketBuffer buffer(10, tick_timer); // 10 packets.
196 PacketGenerator gen(0, 0, 0, 10); 203 PacketGenerator gen(0, 0, 0, 10);
197 PacketList list; 204 PacketList list;
198 const int payload_len = 10; 205 const int payload_len = 10;
199 206
200 // Insert 10 small packets. 207 // Insert 10 small packets.
201 for (int i = 0; i < 10; ++i) { 208 for (int i = 0; i < 10; ++i) {
202 Packet* packet = gen.NextPacket(payload_len); 209 Packet* packet = gen.NextPacket(payload_len);
203 list.push_back(packet); 210 list.push_back(packet);
204 } 211 }
205 // Insert 11th packet of another payload type (not CNG). 212 // Insert 11th packet of another payload type (not CNG).
(...skipping 17 matching lines...) Expand all
223 EXPECT_EQ(1u, buffer.NumPacketsInBuffer()); // Only the last packet. 230 EXPECT_EQ(1u, buffer.NumPacketsInBuffer()); // Only the last packet.
224 EXPECT_EQ(1, current_pt); // Current payload type changed to 0. 231 EXPECT_EQ(1, current_pt); // Current payload type changed to 0.
225 EXPECT_EQ(0xFF, current_cng_pt); // CNG payload type not changed. 232 EXPECT_EQ(0xFF, current_cng_pt); // CNG payload type not changed.
226 233
227 buffer.Flush(); // Clean up. 234 buffer.Flush(); // Clean up.
228 235
229 EXPECT_CALL(decoder_database, Die()); // Called when object is deleted. 236 EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
230 } 237 }
231 238
232 TEST(PacketBuffer, ExtractOrderRedundancy) { 239 TEST(PacketBuffer, ExtractOrderRedundancy) {
233 PacketBuffer buffer(100); // 100 packets. 240 TickTimer tick_timer;
241 PacketBuffer buffer(100, tick_timer); // 100 packets.
234 const int kPackets = 18; 242 const int kPackets = 18;
235 const int kFrameSize = 10; 243 const int kFrameSize = 10;
236 const int kPayloadLength = 10; 244 const int kPayloadLength = 10;
237 245
238 PacketsToInsert packet_facts[kPackets] = { 246 PacketsToInsert packet_facts[kPackets] = {
239 {0xFFFD, 0xFFFFFFD7, 0, true, 0}, 247 {0xFFFD, 0xFFFFFFD7, 0, true, 0},
240 {0xFFFE, 0xFFFFFFE1, 0, true, 1}, 248 {0xFFFE, 0xFFFFFFE1, 0, true, 1},
241 {0xFFFE, 0xFFFFFFD7, 1, false, -1}, 249 {0xFFFE, 0xFFFFFFD7, 1, false, -1},
242 {0xFFFF, 0xFFFFFFEB, 0, true, 2}, 250 {0xFFFF, 0xFFFFFFEB, 0, true, 2},
243 {0xFFFF, 0xFFFFFFE1, 1, false, -1}, 251 {0xFFFF, 0xFFFFFFE1, 1, false, -1},
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 Packet* packet = buffer.GetNextPacket(&drop_count); 290 Packet* packet = buffer.GetNextPacket(&drop_count);
283 EXPECT_EQ(0u, drop_count); 291 EXPECT_EQ(0u, drop_count);
284 EXPECT_EQ(packet, expect_order[i]); // Compare pointer addresses. 292 EXPECT_EQ(packet, expect_order[i]); // Compare pointer addresses.
285 delete[] packet->payload; 293 delete[] packet->payload;
286 delete packet; 294 delete packet;
287 } 295 }
288 EXPECT_TRUE(buffer.Empty()); 296 EXPECT_TRUE(buffer.Empty());
289 } 297 }
290 298
291 TEST(PacketBuffer, DiscardPackets) { 299 TEST(PacketBuffer, DiscardPackets) {
292 PacketBuffer buffer(100); // 100 packets. 300 TickTimer tick_timer;
301 PacketBuffer buffer(100, tick_timer); // 100 packets.
293 const uint16_t start_seq_no = 17; 302 const uint16_t start_seq_no = 17;
294 const uint32_t start_ts = 4711; 303 const uint32_t start_ts = 4711;
295 const uint32_t ts_increment = 10; 304 const uint32_t ts_increment = 10;
296 PacketGenerator gen(start_seq_no, start_ts, 0, ts_increment); 305 PacketGenerator gen(start_seq_no, start_ts, 0, ts_increment);
297 PacketList list; 306 PacketList list;
298 const int payload_len = 10; 307 const int payload_len = 10;
299 308
300 // Insert 10 small packets. 309 // Insert 10 small packets.
301 for (int i = 0; i < 10; ++i) { 310 for (int i = 0; i < 10; ++i) {
302 Packet* packet = gen.NextPacket(payload_len); 311 Packet* packet = gen.NextPacket(payload_len);
303 buffer.InsertPacket(packet); 312 buffer.InsertPacket(packet);
304 } 313 }
305 EXPECT_EQ(10u, buffer.NumPacketsInBuffer()); 314 EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
306 315
307 // Discard them one by one and make sure that the right packets are at the 316 // Discard them one by one and make sure that the right packets are at the
308 // front of the buffer. 317 // front of the buffer.
309 uint32_t current_ts = start_ts; 318 uint32_t current_ts = start_ts;
310 for (int i = 0; i < 10; ++i) { 319 for (int i = 0; i < 10; ++i) {
311 uint32_t ts; 320 uint32_t ts;
312 EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&ts)); 321 EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&ts));
313 EXPECT_EQ(current_ts, ts); 322 EXPECT_EQ(current_ts, ts);
314 EXPECT_EQ(PacketBuffer::kOK, buffer.DiscardNextPacket()); 323 EXPECT_EQ(PacketBuffer::kOK, buffer.DiscardNextPacket());
315 current_ts += ts_increment; 324 current_ts += ts_increment;
316 } 325 }
317 EXPECT_TRUE(buffer.Empty()); 326 EXPECT_TRUE(buffer.Empty());
318 } 327 }
319 328
320 TEST(PacketBuffer, Reordering) { 329 TEST(PacketBuffer, Reordering) {
321 PacketBuffer buffer(100); // 100 packets. 330 TickTimer tick_timer;
331 PacketBuffer buffer(100, tick_timer); // 100 packets.
322 const uint16_t start_seq_no = 17; 332 const uint16_t start_seq_no = 17;
323 const uint32_t start_ts = 4711; 333 const uint32_t start_ts = 4711;
324 const uint32_t ts_increment = 10; 334 const uint32_t ts_increment = 10;
325 PacketGenerator gen(start_seq_no, start_ts, 0, ts_increment); 335 PacketGenerator gen(start_seq_no, start_ts, 0, ts_increment);
326 const int payload_len = 10; 336 const int payload_len = 10;
327 337
328 // Generate 10 small packets and insert them into a PacketList. Insert every 338 // Generate 10 small packets and insert them into a PacketList. Insert every
329 // odd packet to the front, and every even packet to the back, thus creating 339 // odd packet to the front, and every even packet to the back, thus creating
330 // a (rather strange) reordering. 340 // a (rather strange) reordering.
331 PacketList list; 341 PacketList list;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 376
367 EXPECT_CALL(decoder_database, Die()); // Called when object is deleted. 377 EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
368 } 378 }
369 379
370 TEST(PacketBuffer, Failures) { 380 TEST(PacketBuffer, Failures) {
371 const uint16_t start_seq_no = 17; 381 const uint16_t start_seq_no = 17;
372 const uint32_t start_ts = 4711; 382 const uint32_t start_ts = 4711;
373 const uint32_t ts_increment = 10; 383 const uint32_t ts_increment = 10;
374 int payload_len = 100; 384 int payload_len = 100;
375 PacketGenerator gen(start_seq_no, start_ts, 0, ts_increment); 385 PacketGenerator gen(start_seq_no, start_ts, 0, ts_increment);
386 TickTimer tick_timer;
376 387
377 PacketBuffer* buffer = new PacketBuffer(100); // 100 packets. 388 PacketBuffer* buffer = new PacketBuffer(100, tick_timer); // 100 packets.
378 Packet* packet = NULL; 389 Packet* packet = NULL;
379 EXPECT_EQ(PacketBuffer::kInvalidPacket, buffer->InsertPacket(packet)); 390 EXPECT_EQ(PacketBuffer::kInvalidPacket, buffer->InsertPacket(packet));
380 packet = gen.NextPacket(payload_len); 391 packet = gen.NextPacket(payload_len);
381 delete [] packet->payload; 392 delete [] packet->payload;
382 packet->payload = NULL; 393 packet->payload = NULL;
383 EXPECT_EQ(PacketBuffer::kInvalidPacket, buffer->InsertPacket(packet)); 394 EXPECT_EQ(PacketBuffer::kInvalidPacket, buffer->InsertPacket(packet));
384 // Packet is deleted by the PacketBuffer. 395 // Packet is deleted by the PacketBuffer.
385 396
386 // Buffer should still be empty. Test all empty-checks. 397 // Buffer should still be empty. Test all empty-checks.
387 uint32_t temp_ts; 398 uint32_t temp_ts;
388 EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->NextTimestamp(&temp_ts)); 399 EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->NextTimestamp(&temp_ts));
389 EXPECT_EQ(PacketBuffer::kBufferEmpty, 400 EXPECT_EQ(PacketBuffer::kBufferEmpty,
390 buffer->NextHigherTimestamp(0, &temp_ts)); 401 buffer->NextHigherTimestamp(0, &temp_ts));
391 EXPECT_EQ(NULL, buffer->NextRtpHeader()); 402 EXPECT_EQ(NULL, buffer->NextRtpHeader());
392 EXPECT_EQ(NULL, buffer->GetNextPacket(NULL)); 403 EXPECT_EQ(NULL, buffer->GetNextPacket(NULL));
393 EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->DiscardNextPacket()); 404 EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->DiscardNextPacket());
394 EXPECT_EQ(0, buffer->DiscardAllOldPackets(0)); // 0 packets discarded. 405 EXPECT_EQ(0, buffer->DiscardAllOldPackets(0)); // 0 packets discarded.
395 406
396 // Insert one packet to make the buffer non-empty. 407 // Insert one packet to make the buffer non-empty.
397 packet = gen.NextPacket(payload_len); 408 packet = gen.NextPacket(payload_len);
398 EXPECT_EQ(PacketBuffer::kOK, buffer->InsertPacket(packet)); 409 EXPECT_EQ(PacketBuffer::kOK, buffer->InsertPacket(packet));
399 EXPECT_EQ(PacketBuffer::kInvalidPointer, buffer->NextTimestamp(NULL)); 410 EXPECT_EQ(PacketBuffer::kInvalidPointer, buffer->NextTimestamp(NULL));
400 EXPECT_EQ(PacketBuffer::kInvalidPointer, 411 EXPECT_EQ(PacketBuffer::kInvalidPointer,
401 buffer->NextHigherTimestamp(0, NULL)); 412 buffer->NextHigherTimestamp(0, NULL));
402 delete buffer; 413 delete buffer;
403 414
404 // Insert packet list of three packets, where the second packet has an invalid 415 // Insert packet list of three packets, where the second packet has an invalid
405 // payload. Expect first packet to be inserted, and the remaining two to be 416 // payload. Expect first packet to be inserted, and the remaining two to be
406 // discarded. 417 // discarded.
407 buffer = new PacketBuffer(100); // 100 packets. 418 buffer = new PacketBuffer(100, tick_timer); // 100 packets.
408 PacketList list; 419 PacketList list;
409 list.push_back(gen.NextPacket(payload_len)); // Valid packet. 420 list.push_back(gen.NextPacket(payload_len)); // Valid packet.
410 packet = gen.NextPacket(payload_len); 421 packet = gen.NextPacket(payload_len);
411 delete [] packet->payload; 422 delete [] packet->payload;
412 packet->payload = NULL; // Invalid. 423 packet->payload = NULL; // Invalid.
413 list.push_back(packet); 424 list.push_back(packet);
414 list.push_back(gen.NextPacket(payload_len)); // Valid packet. 425 list.push_back(gen.NextPacket(payload_len)); // Valid packet.
415 MockDecoderDatabase decoder_database; 426 MockDecoderDatabase decoder_database;
416 EXPECT_CALL(decoder_database, IsComfortNoise(0)) 427 EXPECT_CALL(decoder_database, IsComfortNoise(0))
417 .WillRepeatedly(Return(false)); 428 .WillRepeatedly(Return(false));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // Test the IsObsoleteTimestamp method with different limit timestamps. 580 // Test the IsObsoleteTimestamp method with different limit timestamps.
570 TEST(PacketBuffer, IsObsoleteTimestamp) { 581 TEST(PacketBuffer, IsObsoleteTimestamp) {
571 TestIsObsoleteTimestamp(0); 582 TestIsObsoleteTimestamp(0);
572 TestIsObsoleteTimestamp(1); 583 TestIsObsoleteTimestamp(1);
573 TestIsObsoleteTimestamp(0xFFFFFFFF); // -1 in uint32_t. 584 TestIsObsoleteTimestamp(0xFFFFFFFF); // -1 in uint32_t.
574 TestIsObsoleteTimestamp(0x80000000); // 2^31. 585 TestIsObsoleteTimestamp(0x80000000); // 2^31.
575 TestIsObsoleteTimestamp(0x80000001); // 2^31 + 1. 586 TestIsObsoleteTimestamp(0x80000001); // 2^31 + 1.
576 TestIsObsoleteTimestamp(0x7FFFFFFF); // 2^31 - 1. 587 TestIsObsoleteTimestamp(0x7FFFFFFF); // 2^31 - 1.
577 } 588 }
578 } // namespace webrtc 589 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/packet_buffer.cc ('k') | webrtc/modules/audio_coding/neteq/payload_splitter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698