| 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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ |
| 13 | 13 |
| 14 #include "webrtc/modules/include/module_common_types.h" | 14 #include "webrtc/modules/include/module_common_types.h" |
| 15 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 15 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
| 16 | 16 |
| 17 namespace webrtc { | 17 namespace webrtc { |
| 18 namespace test { |
| 19 struct RawRtpPacket : public ForwardErrorCorrection::Packet { |
| 20 WebRtcRTPHeader header; |
| 21 }; |
| 22 } // namespace test |
| 18 | 23 |
| 19 const uint8_t kFecPayloadType = 96; | 24 const uint8_t kFecPayloadType = 96; |
| 20 const uint8_t kRedPayloadType = 97; | 25 const uint8_t kRedPayloadType = 97; |
| 21 const uint8_t kVp8PayloadType = 120; | 26 const uint8_t kVp8PayloadType = 120; |
| 22 | 27 |
| 23 typedef ForwardErrorCorrection::Packet Packet; | |
| 24 | |
| 25 struct RtpPacket : public Packet { | |
| 26 WebRtcRTPHeader header; | |
| 27 }; | |
| 28 | |
| 29 class FrameGenerator { | 28 class FrameGenerator { |
| 30 public: | 29 public: |
| 31 FrameGenerator(); | 30 FrameGenerator(); |
| 32 | 31 |
| 33 void NewFrame(int num_packets); | 32 void NewFrame(int num_packets); |
| 34 | 33 |
| 35 uint16_t NextSeqNum(); | 34 uint16_t NextSeqNum(); |
| 36 | 35 |
| 37 RtpPacket* NextPacket(int offset, size_t length); | 36 test::RawRtpPacket* NextPacket(int offset, size_t length); |
| 38 | 37 |
| 39 // Creates a new RtpPacket with the RED header added to the packet. | 38 // Creates a new RtpPacket with the RED header added to the packet. |
| 40 RtpPacket* BuildMediaRedPacket(const RtpPacket* packet); | 39 test::RawRtpPacket* BuildMediaRedPacket(const test::RawRtpPacket* packet); |
| 41 | 40 |
| 42 // Creates a new RtpPacket with FEC payload and red header. Does this by | 41 // Creates a new RtpPacket with FEC payload and red header. Does this by |
| 43 // creating a new fake media RtpPacket, clears the marker bit and adds a RED | 42 // creating a new fake media RtpPacket, clears the marker bit and adds a RED |
| 44 // header. Finally replaces the payload with the content of |packet->data|. | 43 // header. Finally replaces the payload with the content of |packet->data|. |
| 45 RtpPacket* BuildFecRedPacket(const Packet* packet); | 44 test::RawRtpPacket* BuildFecRedPacket( |
| 45 const ForwardErrorCorrection::Packet* packet); |
| 46 | 46 |
| 47 void SetRedHeader(Packet* red_packet, uint8_t payload_type, | 47 void SetRedHeader(ForwardErrorCorrection::Packet* red_packet, |
| 48 uint8_t payload_type, |
| 48 size_t header_length) const; | 49 size_t header_length) const; |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 static void BuildRtpHeader(uint8_t* data, const RTPHeader* header); | 52 static void BuildRtpHeader(uint8_t* data, const RTPHeader* header); |
| 52 | 53 |
| 53 int num_packets_; | 54 int num_packets_; |
| 54 uint16_t seq_num_; | 55 uint16_t seq_num_; |
| 55 uint32_t timestamp_; | 56 uint32_t timestamp_; |
| 56 }; | 57 }; |
| 57 } // namespace webrtc | 58 } // namespace webrtc |
| 58 | 59 |
| 59 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ | 60 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ |
| OLD | NEW |