Chromium Code Reviews| 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 | 18 |
| 19 const uint8_t kFecPayloadType = 96; | 19 const uint8_t kFecPayloadType = 96; |
| 20 const uint8_t kRedPayloadType = 97; | 20 const uint8_t kRedPayloadType = 97; |
| 21 const uint8_t kVp8PayloadType = 120; | 21 const uint8_t kVp8PayloadType = 120; |
| 22 | 22 |
| 23 typedef ForwardErrorCorrection::Packet Packet; | 23 struct FecRtpPacket : public ForwardErrorCorrection::Packet { |
|
stefan-webrtc
2016/02/19 14:21:15
Could you define this within the test namespace in
danilchap
2016/02/19 14:48:29
checked what it containing and renamed to test::Ra
stefan-webrtc
2016/02/19 14:56:21
Ok. test::RtpPacket would work too I guess? Doesn'
| |
| 24 | |
| 25 struct RtpPacket : public Packet { | |
| 26 WebRtcRTPHeader header; | 24 WebRtcRTPHeader header; |
| 27 }; | 25 }; |
| 28 | 26 |
| 29 class FrameGenerator { | 27 class FrameGenerator { |
| 30 public: | 28 public: |
| 31 FrameGenerator(); | 29 FrameGenerator(); |
| 32 | 30 |
| 33 void NewFrame(int num_packets); | 31 void NewFrame(int num_packets); |
| 34 | 32 |
| 35 uint16_t NextSeqNum(); | 33 uint16_t NextSeqNum(); |
| 36 | 34 |
| 37 RtpPacket* NextPacket(int offset, size_t length); | 35 FecRtpPacket* NextPacket(int offset, size_t length); |
| 38 | 36 |
| 39 // Creates a new RtpPacket with the RED header added to the packet. | 37 // Creates a new RtpPacket with the RED header added to the packet. |
| 40 RtpPacket* BuildMediaRedPacket(const RtpPacket* packet); | 38 FecRtpPacket* BuildMediaRedPacket(const FecRtpPacket* packet); |
| 41 | 39 |
| 42 // Creates a new RtpPacket with FEC payload and red header. Does this by | 40 // 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 | 41 // 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|. | 42 // header. Finally replaces the payload with the content of |packet->data|. |
| 45 RtpPacket* BuildFecRedPacket(const Packet* packet); | 43 FecRtpPacket* BuildFecRedPacket(const ForwardErrorCorrection::Packet* packet); |
| 46 | 44 |
| 47 void SetRedHeader(Packet* red_packet, uint8_t payload_type, | 45 void SetRedHeader(ForwardErrorCorrection::Packet* red_packet, |
| 46 uint8_t payload_type, | |
| 48 size_t header_length) const; | 47 size_t header_length) const; |
| 49 | 48 |
| 50 private: | 49 private: |
| 51 static void BuildRtpHeader(uint8_t* data, const RTPHeader* header); | 50 static void BuildRtpHeader(uint8_t* data, const RTPHeader* header); |
| 52 | 51 |
| 53 int num_packets_; | 52 int num_packets_; |
| 54 uint16_t seq_num_; | 53 uint16_t seq_num_; |
| 55 uint32_t timestamp_; | 54 uint32_t timestamp_; |
| 56 }; | 55 }; |
| 57 } // namespace webrtc | 56 } // namespace webrtc |
| 58 | 57 |
| 59 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ | 58 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_TEST_HELPER_H_ |
| OLD | NEW |