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