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_PRODUCER_FEC_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_PRODUCER_FEC_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_PRODUCER_FEC_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 class RtpPacketToSend; |
21 | 22 |
22 class RedPacket { | 23 class RedPacket { |
23 public: | 24 public: |
24 explicit RedPacket(size_t length); | 25 explicit RedPacket(size_t length); |
25 | 26 |
26 void CreateHeader(const uint8_t* rtp_header, | 27 void CreateHeader(const uint8_t* rtp_header, |
27 size_t header_length, | 28 size_t header_length, |
28 int red_payload_type, | 29 int red_payload_type, |
29 int payload_type); | 30 int payload_type); |
30 void SetSeqNum(int seq_num); | 31 void SetSeqNum(int seq_num); |
(...skipping 10 matching lines...) Expand all Loading... |
41 | 42 |
42 class ProducerFec { | 43 class ProducerFec { |
43 public: | 44 public: |
44 explicit ProducerFec(ForwardErrorCorrection* fec); | 45 explicit ProducerFec(ForwardErrorCorrection* fec); |
45 ~ProducerFec(); | 46 ~ProducerFec(); |
46 | 47 |
47 static std::unique_ptr<RedPacket> BuildRedPacket(const uint8_t* data_buffer, | 48 static std::unique_ptr<RedPacket> BuildRedPacket(const uint8_t* data_buffer, |
48 size_t payload_length, | 49 size_t payload_length, |
49 size_t rtp_header_length, | 50 size_t rtp_header_length, |
50 int red_payload_type); | 51 int red_payload_type); |
| 52 static void BuildRedPacket(int red_payload_type, |
| 53 const RtpPacketToSend& media_packet, |
| 54 RtpPacketToSend* red_packet); |
51 | 55 |
52 void SetFecParameters(const FecProtectionParams* params, | 56 void SetFecParameters(const FecProtectionParams* params, |
53 int num_first_partition); | 57 int num_first_partition); |
54 | 58 |
55 // Adds a media packet to the internal buffer. When enough media packets | 59 // Adds a media packet to the internal buffer. When enough media packets |
56 // have been added, the FEC packets are generated and stored internally. | 60 // have been added, the FEC packets are generated and stored internally. |
57 // These FEC packets are then obtained by calling GetFecPacketsAsRed(). | 61 // These FEC packets are then obtained by calling GetFecPacketsAsRed(). |
58 int AddRtpPacketAndGenerateFec(const uint8_t* data_buffer, | 62 int AddRtpPacketAndGenerateFec(const uint8_t* data_buffer, |
59 size_t payload_length, | 63 size_t payload_length, |
60 size_t rtp_header_length); | 64 size_t rtp_header_length); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 int num_protected_frames_; | 97 int num_protected_frames_; |
94 int num_important_packets_; | 98 int num_important_packets_; |
95 int min_num_media_packets_; | 99 int min_num_media_packets_; |
96 FecProtectionParams params_; | 100 FecProtectionParams params_; |
97 FecProtectionParams new_params_; | 101 FecProtectionParams new_params_; |
98 }; | 102 }; |
99 | 103 |
100 } // namespace webrtc | 104 } // namespace webrtc |
101 | 105 |
102 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_PRODUCER_FEC_H_ | 106 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_PRODUCER_FEC_H_ |
OLD | NEW |