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 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Number of packets left to generate, in the current frame. | 82 // Number of packets left to generate, in the current frame. |
83 size_t num_packets_; | 83 size_t num_packets_; |
84 | 84 |
85 private: | 85 private: |
86 uint32_t ssrc_; | 86 uint32_t ssrc_; |
87 uint16_t seq_num_; | 87 uint16_t seq_num_; |
88 uint32_t timestamp_; | 88 uint32_t timestamp_; |
89 }; | 89 }; |
90 | 90 |
| 91 // This class generates media and FlexFEC packets for a single frame. |
| 92 class FlexfecPacketGenerator : public AugmentedPacketGenerator { |
| 93 public: |
| 94 FlexfecPacketGenerator(uint32_t media_ssrc, uint32_t flexfec_ssrc); |
| 95 |
| 96 // Creates a new AugmentedPacket (with RTP headers) from a |
| 97 // FlexFEC packet (without RTP headers). |
| 98 std::unique_ptr<AugmentedPacket> BuildFlexfecPacket( |
| 99 const ForwardErrorCorrection::Packet& packet); |
| 100 |
| 101 private: |
| 102 uint32_t flexfec_ssrc_; |
| 103 uint16_t flexfec_seq_num_; |
| 104 uint32_t flexfec_timestamp_; |
| 105 }; |
| 106 |
91 // This class generates media and ULPFEC packets (both encapsulated in RED) | 107 // This class generates media and ULPFEC packets (both encapsulated in RED) |
92 // for a single frame. | 108 // for a single frame. |
93 class UlpfecPacketGenerator : public AugmentedPacketGenerator { | 109 class UlpfecPacketGenerator : public AugmentedPacketGenerator { |
94 public: | 110 public: |
95 explicit UlpfecPacketGenerator(uint32_t ssrc); | 111 explicit UlpfecPacketGenerator(uint32_t ssrc); |
96 | 112 |
97 // Creates a new AugmentedPacket with the RED header added to the packet. | 113 // Creates a new AugmentedPacket with the RED header added to the packet. |
98 static std::unique_ptr<AugmentedPacket> BuildMediaRedPacket( | 114 static std::unique_ptr<AugmentedPacket> BuildMediaRedPacket( |
99 const AugmentedPacket& packet); | 115 const AugmentedPacket& packet); |
100 | 116 |
101 // Creates a new AugmentedPacket with FEC payload and RED header. Does this by | 117 // Creates a new AugmentedPacket with FEC payload and RED header. Does this by |
102 // creating a new fake media AugmentedPacket, clears the marker bit and adds a | 118 // creating a new fake media AugmentedPacket, clears the marker bit and adds a |
103 // RED header. Finally replaces the payload with the content of | 119 // RED header. Finally replaces the payload with the content of |
104 // |packet->data|. | 120 // |packet->data|. |
105 std::unique_ptr<AugmentedPacket> BuildUlpfecRedPacket( | 121 std::unique_ptr<AugmentedPacket> BuildUlpfecRedPacket( |
106 const ForwardErrorCorrection::Packet& packet); | 122 const ForwardErrorCorrection::Packet& packet); |
107 | 123 |
108 private: | 124 private: |
109 static void SetRedHeader(uint8_t payload_type, | 125 static void SetRedHeader(uint8_t payload_type, |
110 size_t header_length, | 126 size_t header_length, |
111 AugmentedPacket* red_packet); | 127 AugmentedPacket* red_packet); |
112 }; | 128 }; |
113 | 129 |
114 } // namespace fec | 130 } // namespace fec |
115 } // namespace test | 131 } // namespace test |
116 } // namespace webrtc | 132 } // namespace webrtc |
117 | 133 |
118 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ | 134 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ |
OLD | NEW |