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_PRODUCER_FEC_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_ULPFEC_GENERATOR_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_PRODUCER_FEC_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_ULPFEC_GENERATOR_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <memory> | 15 #include <memory> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 18 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
22 class RedPacket { | 22 class RedPacket { |
23 public: | 23 public: |
24 explicit RedPacket(size_t length); | 24 explicit RedPacket(size_t length); |
25 | 25 |
26 void CreateHeader(const uint8_t* rtp_header, | 26 void CreateHeader(const uint8_t* rtp_header, |
27 size_t header_length, | 27 size_t header_length, |
28 int red_payload_type, | 28 int red_payload_type, |
29 int payload_type); | 29 int payload_type); |
30 void SetSeqNum(int seq_num); | 30 void SetSeqNum(int seq_num); |
31 void AssignPayload(const uint8_t* payload, size_t length); | 31 void AssignPayload(const uint8_t* payload, size_t length); |
32 void ClearMarkerBit(); | 32 void ClearMarkerBit(); |
33 uint8_t* data() const; | 33 uint8_t* data() const; |
34 size_t length() const; | 34 size_t length() const; |
35 | 35 |
36 private: | 36 private: |
37 std::unique_ptr<uint8_t[]> data_; | 37 std::unique_ptr<uint8_t[]> data_; |
38 size_t length_; | 38 size_t length_; |
39 size_t header_length_; | 39 size_t header_length_; |
40 }; | 40 }; |
41 | 41 |
42 class ProducerFec { | 42 class UlpfecGenerator { |
43 public: | 43 public: |
44 ProducerFec(); | 44 UlpfecGenerator(); |
45 ~ProducerFec(); | 45 ~UlpfecGenerator(); |
46 | 46 |
47 static std::unique_ptr<RedPacket> BuildRedPacket(const uint8_t* data_buffer, | 47 static std::unique_ptr<RedPacket> BuildRedPacket(const uint8_t* data_buffer, |
48 size_t payload_length, | 48 size_t payload_length, |
49 size_t rtp_header_length, | 49 size_t rtp_header_length, |
50 int red_payload_type); | 50 int red_payload_type); |
51 | 51 |
52 void SetFecParameters(const FecProtectionParams* params); | 52 void SetFecParameters(const FecProtectionParams* params); |
53 | 53 |
54 // Adds a media packet to the internal buffer. When enough media packets | 54 // Adds a media packet to the internal buffer. When enough media packets |
55 // have been added, the FEC packets are generated and stored internally. | 55 // have been added, the FEC packets are generated and stored internally. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 ForwardErrorCorrection::PacketList media_packets_; | 99 ForwardErrorCorrection::PacketList media_packets_; |
100 std::list<ForwardErrorCorrection::Packet*> generated_fec_packets_; | 100 std::list<ForwardErrorCorrection::Packet*> generated_fec_packets_; |
101 int num_protected_frames_; | 101 int num_protected_frames_; |
102 int min_num_media_packets_; | 102 int min_num_media_packets_; |
103 FecProtectionParams params_; | 103 FecProtectionParams params_; |
104 FecProtectionParams new_params_; | 104 FecProtectionParams new_params_; |
105 }; | 105 }; |
106 | 106 |
107 } // namespace webrtc | 107 } // namespace webrtc |
108 | 108 |
109 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_PRODUCER_FEC_H_ | 109 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_ULPFEC_GENERATOR_H_ |
OLD | NEW |