OLD | NEW |
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 /* | 11 /* |
12 * Test application for core FEC algorithm. Calls encoding and decoding | 12 * Test application for core FEC algorithm. Calls encoding and decoding |
13 * functions in ForwardErrorCorrection directly. | 13 * functions in ForwardErrorCorrection directly. |
14 */ | 14 */ |
15 | 15 |
16 #include <assert.h> | 16 #include <assert.h> |
17 #include <stdio.h> | 17 #include <stdio.h> |
18 #include <stdlib.h> | 18 #include <stdlib.h> |
19 #include <string.h> | 19 #include <string.h> |
20 #include <time.h> | 20 #include <time.h> |
21 | 21 |
22 #include <list> | 22 #include <list> |
23 | 23 |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "webrtc/modules/rtp_rtcp/source/fec_private_tables_bursty.h" | |
26 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 25 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
27 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h" | 26 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h" |
28 | 27 |
29 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 28 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
30 #include "webrtc/test/testsupport/fileutils.h" | 29 #include "webrtc/test/testsupport/fileutils.h" |
31 | 30 |
32 //#define VERBOSE_OUTPUT | 31 //#define VERBOSE_OUTPUT |
33 | 32 |
34 namespace webrtc { | 33 namespace webrtc { |
| 34 namespace fec_private_tables { |
| 35 extern const uint8_t** kPacketMaskBurstyTbl[12]; |
| 36 } |
35 namespace test { | 37 namespace test { |
| 38 using fec_private_tables::kPacketMaskBurstyTbl; |
36 | 39 |
37 void ReceivePackets( | 40 void ReceivePackets( |
38 ForwardErrorCorrection::ReceivedPacketList* toDecodeList, | 41 ForwardErrorCorrection::ReceivedPacketList* toDecodeList, |
39 ForwardErrorCorrection::ReceivedPacketList* receivedPacketList, | 42 ForwardErrorCorrection::ReceivedPacketList* receivedPacketList, |
40 uint32_t numPacketsToDecode, float reorderRate, float duplicateRate) { | 43 uint32_t numPacketsToDecode, float reorderRate, float duplicateRate) { |
41 assert(toDecodeList->empty()); | 44 assert(toDecodeList->empty()); |
42 assert(numPacketsToDecode <= receivedPacketList->size()); | 45 assert(numPacketsToDecode <= receivedPacketList->size()); |
43 | 46 |
44 ForwardErrorCorrection::ReceivedPacketList::iterator it; | 47 ForwardErrorCorrection::ReceivedPacketList::iterator it; |
45 for (uint32_t i = 0; i < numPacketsToDecode; i++) { | 48 for (uint32_t i = 0; i < numPacketsToDecode; i++) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 const uint32_t kNumMaskBytesL0 = 2; | 90 const uint32_t kNumMaskBytesL0 = 2; |
88 const uint32_t kNumMaskBytesL1 = 6; | 91 const uint32_t kNumMaskBytesL1 = 6; |
89 | 92 |
90 // FOR UEP | 93 // FOR UEP |
91 const bool kUseUnequalProtection = true; | 94 const bool kUseUnequalProtection = true; |
92 | 95 |
93 // FEC mask types. | 96 // FEC mask types. |
94 const FecMaskType kMaskTypes[] = { kFecMaskRandom, kFecMaskBursty }; | 97 const FecMaskType kMaskTypes[] = { kFecMaskRandom, kFecMaskBursty }; |
95 const int kNumFecMaskTypes = sizeof(kMaskTypes) / sizeof(*kMaskTypes); | 98 const int kNumFecMaskTypes = sizeof(kMaskTypes) / sizeof(*kMaskTypes); |
96 | 99 |
97 // TODO(pbos): Fix this. Hack to prevent a warning | |
98 // ('-Wunneeded-internal-declaration') from clang. | |
99 (void) kPacketMaskBurstyTbl; | |
100 | |
101 // Maximum number of media packets allowed for the mask type. | 100 // Maximum number of media packets allowed for the mask type. |
102 const uint16_t kMaxMediaPackets[] = {kMaxNumberMediaPackets, | 101 const uint16_t kMaxMediaPackets[] = {kMaxNumberMediaPackets, |
103 sizeof(kPacketMaskBurstyTbl) / sizeof(*kPacketMaskBurstyTbl)}; | 102 sizeof(kPacketMaskBurstyTbl) / sizeof(*kPacketMaskBurstyTbl)}; |
104 | 103 |
105 ASSERT_EQ(12, kMaxMediaPackets[1]) << "Max media packets for bursty mode not " | 104 ASSERT_EQ(12, kMaxMediaPackets[1]) << "Max media packets for bursty mode not " |
106 << "equal to 12."; | 105 << "equal to 12."; |
107 | 106 |
108 ForwardErrorCorrection fec; | 107 ForwardErrorCorrection fec; |
109 ForwardErrorCorrection::PacketList mediaPacketList; | 108 ForwardErrorCorrection::PacketList mediaPacketList; |
110 ForwardErrorCorrection::PacketList fecPacketList; | 109 ForwardErrorCorrection::PacketList fecPacketList; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 } // loop over mask types | 482 } // loop over mask types |
484 | 483 |
485 // Have DecodeFEC free allocated memory. | 484 // Have DecodeFEC free allocated memory. |
486 fec.ResetState(&recoveredPacketList); | 485 fec.ResetState(&recoveredPacketList); |
487 ASSERT_TRUE(recoveredPacketList.empty()) | 486 ASSERT_TRUE(recoveredPacketList.empty()) |
488 << "Recovered packet list is not empty"; | 487 << "Recovered packet list is not empty"; |
489 } | 488 } |
490 | 489 |
491 } // namespace test | 490 } // namespace test |
492 } // namespace webrtc | 491 } // namespace webrtc |
OLD | NEW |