Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/producer_fec.h

Issue 2305793003: Simplify public interface of ProducerFec. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 void SetFecParameters(const FecProtectionParams* params, 52 void SetFecParameters(const FecProtectionParams* params,
53 int num_first_partition); 53 int num_first_partition);
54 54
55 // Adds a media packet to the internal buffer. When enough media packets 55 // Adds a media packet to the internal buffer. When enough media packets
56 // have been added, the FEC packets are generated and stored internally. 56 // have been added, the FEC packets are generated and stored internally.
57 // These FEC packets are then obtained by calling GetFecPacketsAsRed(). 57 // These FEC packets are then obtained by calling GetFecPacketsAsRed().
58 int AddRtpPacketAndGenerateFec(const uint8_t* data_buffer, 58 int AddRtpPacketAndGenerateFec(const uint8_t* data_buffer,
59 size_t payload_length, 59 size_t payload_length,
60 size_t rtp_header_length); 60 size_t rtp_header_length);
61 61
62 // Returns true if the excess overhead (actual - target) for the FEC is below
63 // the amount |kMaxExcessOverhead|. This effects the lower protection level
64 // cases and low number of media packets/frame. The target overhead is given
65 // by |params_.fec_rate|, and is only achievable in the limit of large number
66 // of media packets.
67 bool ExcessOverheadBelowMax() const;
68
69 // Returns true if the number of added media packets is at least
70 // |min_num_media_packets_|. This condition tries to capture the effect
71 // that, for the same amount of protection/overhead, longer codes
72 // (e.g. (2k,2m) vs (k,m)) are generally more effective at recovering losses.
73 bool MinimumMediaPacketsReached() const;
74
75 // Returns true if there are generated FEC packets available.
76 bool FecAvailable() const;
77
78 size_t NumAvailableFecPackets() const; 62 size_t NumAvailableFecPackets() const;
79 63
80 size_t MaxPacketOverhead() const; 64 size_t MaxPacketOverhead() const;
81 65
82 // Returns generated FEC packets with RED headers added. 66 // Returns generated FEC packets with RED headers added.
83 std::vector<std::unique_ptr<RedPacket>> GetFecPacketsAsRed( 67 std::vector<std::unique_ptr<RedPacket>> GetFecPacketsAsRed(
84 int red_payload_type, 68 int red_payload_type,
85 int ulpfec_payload_type, 69 int ulpfec_payload_type,
86 uint16_t first_seq_num, 70 uint16_t first_seq_num,
87 size_t rtp_header_length); 71 size_t rtp_header_length);
88 72
89 private: 73 private:
90 void DeleteMediaPackets(); 74 // Overhead is defined as relative to the number of media packets, and not
75 // relative to total number of packets. This definition is inherited from the
76 // protection factor produced by video_coding module and how the FEC
77 // generation is implemented.
91 int Overhead() const; 78 int Overhead() const;
79
80 // Returns true if the excess overhead (actual - target) for the FEC is below
81 // the amount |kMaxExcessOverhead|. This effects the lower protection level
82 // cases and low number of media packets/frame. The target overhead is given
83 // by |params_.fec_rate|, and is only achievable in the limit of large number
84 // of media packets.
85 bool ExcessOverheadBelowMax() const;
86
87 // Returns true if the number of added media packets is at least
88 // |min_num_media_packets_|. This condition tries to capture the effect
89 // that, for the same amount of protection/overhead, longer codes
90 // (e.g. (2k,2m) vs (k,m)) are generally more effective at recovering losses.
91 bool MinimumMediaPacketsReached() const;
92
92 std::unique_ptr<ForwardErrorCorrection> fec_; 93 std::unique_ptr<ForwardErrorCorrection> fec_;
93 ForwardErrorCorrection::PacketList media_packets_; 94 ForwardErrorCorrection::PacketList media_packets_;
94 std::list<ForwardErrorCorrection::Packet*> generated_fec_packets_; 95 std::list<ForwardErrorCorrection::Packet*> generated_fec_packets_;
95 int num_protected_frames_; 96 int num_protected_frames_;
96 int num_important_packets_; 97 int num_important_packets_;
97 int min_num_media_packets_; 98 int min_num_media_packets_;
98 FecProtectionParams params_; 99 FecProtectionParams params_;
99 FecProtectionParams new_params_; 100 FecProtectionParams new_params_;
100 }; 101 };
101 102
102 } // namespace webrtc 103 } // namespace webrtc
103 104
104 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_PRODUCER_FEC_H_ 105 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_PRODUCER_FEC_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/producer_fec.cc » ('j') | webrtc/modules/rtp_rtcp/source/producer_fec.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698