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

Side by Side Diff: webrtc/modules/video_coding/media_opt_util.h

Issue 1528503003: Lint enabled for webrtc/modules/video_coding folder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPT_UTIL_H_ 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPT_UTIL_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPT_UTIL_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPT_UTIL_H_
13 13
14 #include <math.h> 14 #include <math.h>
15 #include <stdlib.h> 15 #include <stdlib.h>
16 16
17 #include "webrtc/base/exp_filter.h" 17 #include "webrtc/base/exp_filter.h"
18 #include "webrtc/base/scoped_ptr.h" 18 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/modules/video_coding/internal_defines.h" 19 #include "webrtc/modules/video_coding/internal_defines.h"
20 #include "webrtc/modules/video_coding/qm_select.h" 20 #include "webrtc/modules/video_coding/qm_select.h"
21 #include "webrtc/system_wrappers/include/trace.h" 21 #include "webrtc/system_wrappers/include/trace.h"
22 #include "webrtc/typedefs.h" 22 #include "webrtc/typedefs.h"
23 23
24 namespace webrtc { 24 namespace webrtc {
25 namespace media_optimization { 25 namespace media_optimization {
26 26
27 // Number of time periods used for (max) window filter for packet loss 27 // Number of time periods used for (max) window filter for packet loss
28 // TODO (marpan): set reasonable window size for filtered packet loss, 28 // TODO(marpan): set reasonable window size for filtered packet loss,
29 // adjustment should be based on logged/real data of loss stats/correlation. 29 // adjustment should be based on logged/real data of loss stats/correlation.
30 enum { kLossPrHistorySize = 10 }; 30 enum { kLossPrHistorySize = 10 };
31 31
32 // 1000 ms, total filter length is (kLossPrHistorySize * 1000) ms 32 // 1000 ms, total filter length is (kLossPrHistorySize * 1000) ms
33 enum { kLossPrShortFilterWinMs = 1000 }; 33 enum { kLossPrShortFilterWinMs = 1000 };
34 34
35 // The type of filter used on the received packet loss reports. 35 // The type of filter used on the received packet loss reports.
36 enum FilterPacketLossMode { 36 enum FilterPacketLossMode {
37 kNoFilter, // No filtering on received loss. 37 kNoFilter, // No filtering on received loss.
38 kAvgFilter, // Recursive average filter. 38 kAvgFilter, // Recursive average filter.
39 kMaxFilter // Max-window filter, over the time interval of: 39 kMaxFilter // Max-window filter, over the time interval of:
40 // (kLossPrHistorySize * kLossPrShortFilterWinMs) ms. 40 // (kLossPrHistorySize * kLossPrShortFilterWinMs) ms.
41 }; 41 };
42 42
43 // Thresholds for hybrid NACK/FEC 43 // Thresholds for hybrid NACK/FEC
44 // common to media optimization and the jitter buffer. 44 // common to media optimization and the jitter buffer.
45 const int64_t kLowRttNackMs = 20; 45 const int64_t kLowRttNackMs = 20;
46 46
47 struct VCMProtectionParameters 47 struct VCMProtectionParameters {
48 { 48 VCMProtectionParameters()
49 VCMProtectionParameters() : rtt(0), lossPr(0.0f), bitRate(0.0f), 49 : rtt(0),
50 packetsPerFrame(0.0f), packetsPerFrameKey(0.0f), frameRate(0.0f), 50 lossPr(0.0f),
51 keyFrameSize(0.0f), fecRateDelta(0), fecRateKey(0), 51 bitRate(0.0f),
52 codecWidth(0), codecHeight(0), 52 packetsPerFrame(0.0f),
53 numLayers(1) 53 packetsPerFrameKey(0.0f),
54 {} 54 frameRate(0.0f),
55 55 keyFrameSize(0.0f),
56 int64_t rtt; 56 fecRateDelta(0),
57 float lossPr; 57 fecRateKey(0),
58 float bitRate; 58 codecWidth(0),
59 float packetsPerFrame; 59 codecHeight(0),
60 float packetsPerFrameKey; 60 numLayers(1) {}
61 float frameRate; 61
62 float keyFrameSize; 62 int64_t rtt;
63 uint8_t fecRateDelta; 63 float lossPr;
64 uint8_t fecRateKey; 64 float bitRate;
65 uint16_t codecWidth; 65 float packetsPerFrame;
66 uint16_t codecHeight; 66 float packetsPerFrameKey;
67 int numLayers; 67 float frameRate;
68 }; 68 float keyFrameSize;
69 69 uint8_t fecRateDelta;
70 uint8_t fecRateKey;
71 uint16_t codecWidth;
72 uint16_t codecHeight;
73 int numLayers;
74 };
70 75
71 /******************************/ 76 /******************************/
72 /* VCMProtectionMethod class */ 77 /* VCMProtectionMethod class */
73 /******************************/ 78 /******************************/
74 79
75 enum VCMProtectionMethodEnum 80 enum VCMProtectionMethodEnum { kNack, kFec, kNackFec, kNone };
76 { 81
77 kNack, 82 class VCMLossProbabilitySample {
78 kFec, 83 public:
79 kNackFec, 84 VCMLossProbabilitySample() : lossPr255(0), timeMs(-1) {}
80 kNone 85
81 }; 86 uint8_t lossPr255;
82 87 int64_t timeMs;
83 class VCMLossProbabilitySample 88 };
84 { 89
85 public: 90 class VCMProtectionMethod {
86 VCMLossProbabilitySample() : lossPr255(0), timeMs(-1) {}; 91 public:
87 92 VCMProtectionMethod();
88 uint8_t lossPr255; 93 virtual ~VCMProtectionMethod();
89 int64_t timeMs; 94
90 }; 95 // Updates the efficiency of the method using the parameters provided
91 96 //
92 97 // Input:
93 class VCMProtectionMethod 98 // - parameters : Parameters used to calculate efficiency
94 { 99 //
95 public: 100 // Return value : True if this method is recommended in
96 VCMProtectionMethod(); 101 // the given conditions.
97 virtual ~VCMProtectionMethod(); 102 virtual bool UpdateParameters(const VCMProtectionParameters* parameters) = 0;
98 103
99 // Updates the efficiency of the method using the parameters provided 104 // Returns the protection type
100 // 105 //
101 // Input: 106 // Return value : The protection type
102 // - parameters : Parameters used to calculate efficiency 107 enum VCMProtectionMethodEnum Type() const { return _type; }
103 // 108
104 // Return value : True if this method is recommended in 109 // Returns the effective packet loss for ER, required by this protection
105 // the given conditions. 110 // method
106 virtual bool UpdateParameters(const VCMProtectionParameters* parameters) = 0 ; 111 //
107 112 // Return value : Required effective packet loss
108 // Returns the protection type 113 virtual uint8_t RequiredPacketLossER() { return _effectivePacketLoss; }
109 // 114
110 // Return value : The protection type 115 // Extracts the FEC protection factor for Key frame, required by this
111 enum VCMProtectionMethodEnum Type() const { return _type; } 116 // protection method
112 117 //
113 // Returns the effective packet loss for ER, required by this protection met hod 118 // Return value : Required protectionFactor for Key frame
114 // 119 virtual uint8_t RequiredProtectionFactorK() { return _protectionFactorK; }
115 // Return value : Required effective packet loss 120
116 virtual uint8_t RequiredPacketLossER() { return _effectivePacketLoss; } 121 // Extracts the FEC protection factor for Delta frame, required by this
117 122 // protection method
118 // Extracts the FEC protection factor for Key frame, required by this protec tion method 123 //
119 // 124 // Return value : Required protectionFactor for delta frame
120 // Return value : Required protectionFactor for Key frame 125 virtual uint8_t RequiredProtectionFactorD() { return _protectionFactorD; }
121 virtual uint8_t RequiredProtectionFactorK() { return _protectionFactorK; } 126
122 127 // Extracts whether the FEC Unequal protection (UEP) is used for Key frame.
123 // Extracts the FEC protection factor for Delta frame, required by this prot ection method 128 //
124 // 129 // Return value : Required Unequal protection on/off state.
125 // Return value : Required protectionFactor for delta frame 130 virtual bool RequiredUepProtectionK() { return _useUepProtectionK; }
126 virtual uint8_t RequiredProtectionFactorD() { return _protectionFactorD; } 131
127 132 // Extracts whether the the FEC Unequal protection (UEP) is used for Delta
128 // Extracts whether the FEC Unequal protection (UEP) is used for Key frame. 133 // frame.
129 // 134 //
130 // Return value : Required Unequal protection on/off state. 135 // Return value : Required Unequal protection on/off state.
131 virtual bool RequiredUepProtectionK() { return _useUepProtectionK; } 136 virtual bool RequiredUepProtectionD() { return _useUepProtectionD; }
132 137
133 // Extracts whether the the FEC Unequal protection (UEP) is used for Delta f rame. 138 virtual int MaxFramesFec() const { return 1; }
134 // 139
135 // Return value : Required Unequal protection on/off state. 140 // Updates content metrics
136 virtual bool RequiredUepProtectionD() { return _useUepProtectionD; } 141 void UpdateContentMetrics(const VideoContentMetrics* contentMetrics);
137 142
138 virtual int MaxFramesFec() const { return 1; } 143 protected:
139 144 uint8_t _effectivePacketLoss;
140 // Updates content metrics 145 uint8_t _protectionFactorK;
141 void UpdateContentMetrics(const VideoContentMetrics* contentMetrics); 146 uint8_t _protectionFactorD;
142 147 // Estimation of residual loss after the FEC
143 protected: 148 float _scaleProtKey;
144 149 int32_t _maxPayloadSize;
145 uint8_t _effectivePacketLoss; 150
146 uint8_t _protectionFactorK; 151 VCMQmRobustness* _qmRobustness;
147 uint8_t _protectionFactorD; 152 bool _useUepProtectionK;
148 // Estimation of residual loss after the FEC 153 bool _useUepProtectionD;
149 float _scaleProtKey; 154 float _corrFecCost;
150 int32_t _maxPayloadSize; 155 enum VCMProtectionMethodEnum _type;
151 156 };
152 VCMQmRobustness* _qmRobustness; 157
153 bool _useUepProtectionK; 158 class VCMNackMethod : public VCMProtectionMethod {
154 bool _useUepProtectionD; 159 public:
155 float _corrFecCost; 160 VCMNackMethod();
156 enum VCMProtectionMethodEnum _type; 161 virtual ~VCMNackMethod();
157 }; 162 virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
158 163 // Get the effective packet loss
159 class VCMNackMethod : public VCMProtectionMethod 164 bool EffectivePacketLoss(const VCMProtectionParameters* parameter);
160 { 165 };
161 public: 166
162 VCMNackMethod(); 167 class VCMFecMethod : public VCMProtectionMethod {
163 virtual ~VCMNackMethod(); 168 public:
164 virtual bool UpdateParameters(const VCMProtectionParameters* parameters); 169 VCMFecMethod();
165 // Get the effective packet loss 170 virtual ~VCMFecMethod();
166 bool EffectivePacketLoss(const VCMProtectionParameters* parameter); 171 virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
167 }; 172 // Get the effective packet loss for ER
168 173 bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
169 class VCMFecMethod : public VCMProtectionMethod 174 // Get the FEC protection factors
170 { 175 bool ProtectionFactor(const VCMProtectionParameters* parameters);
171 public: 176 // Get the boost for key frame protection
172 VCMFecMethod(); 177 uint8_t BoostCodeRateKey(uint8_t packetFrameDelta,
173 virtual ~VCMFecMethod(); 178 uint8_t packetFrameKey) const;
174 virtual bool UpdateParameters(const VCMProtectionParameters* parameters); 179 // Convert the rates: defined relative to total# packets or source# packets
175 // Get the effective packet loss for ER 180 uint8_t ConvertFECRate(uint8_t codeRate) const;
176 bool EffectivePacketLoss(const VCMProtectionParameters* parameters); 181 // Get the average effective recovery from FEC: for random loss model
177 // Get the FEC protection factors 182 float AvgRecoveryFEC(const VCMProtectionParameters* parameters) const;
178 bool ProtectionFactor(const VCMProtectionParameters* parameters); 183 // Update FEC with protectionFactorD
179 // Get the boost for key frame protection 184 void UpdateProtectionFactorD(uint8_t protectionFactorD);
180 uint8_t BoostCodeRateKey(uint8_t packetFrameDelta, 185 // Update FEC with protectionFactorK
181 uint8_t packetFrameKey) const; 186 void UpdateProtectionFactorK(uint8_t protectionFactorK);
182 // Convert the rates: defined relative to total# packets or source# packets 187 // Compute the bits per frame. Account for temporal layers when applicable.
183 uint8_t ConvertFECRate(uint8_t codeRate) const; 188 int BitsPerFrame(const VCMProtectionParameters* parameters);
184 // Get the average effective recovery from FEC: for random loss model 189
185 float AvgRecoveryFEC(const VCMProtectionParameters* parameters) const; 190 protected:
186 // Update FEC with protectionFactorD 191 enum { kUpperLimitFramesFec = 6 };
187 void UpdateProtectionFactorD(uint8_t protectionFactorD); 192 // Thresholds values for the bytes/frame and round trip time, below which we
188 // Update FEC with protectionFactorK 193 // may turn off FEC, depending on |_numLayers| and |_maxFramesFec|.
189 void UpdateProtectionFactorK(uint8_t protectionFactorK); 194 // Max bytes/frame for VGA, corresponds to ~140k at 25fps.
190 // Compute the bits per frame. Account for temporal layers when applicable. 195 enum { kMaxBytesPerFrameForFec = 700 };
191 int BitsPerFrame(const VCMProtectionParameters* parameters); 196 // Max bytes/frame for CIF and lower: corresponds to ~80k at 25fps.
192 197 enum { kMaxBytesPerFrameForFecLow = 400 };
193 protected: 198 // Max bytes/frame for frame size larger than VGA, ~200k at 25fps.
194 enum { kUpperLimitFramesFec = 6 }; 199 enum { kMaxBytesPerFrameForFecHigh = 1000 };
195 // Thresholds values for the bytes/frame and round trip time, below which we 200 };
196 // may turn off FEC, depending on |_numLayers| and |_maxFramesFec|. 201
197 // Max bytes/frame for VGA, corresponds to ~140k at 25fps. 202 class VCMNackFecMethod : public VCMFecMethod {
198 enum { kMaxBytesPerFrameForFec = 700 }; 203 public:
199 // Max bytes/frame for CIF and lower: corresponds to ~80k at 25fps. 204 VCMNackFecMethod(int64_t lowRttNackThresholdMs,
200 enum { kMaxBytesPerFrameForFecLow = 400 }; 205 int64_t highRttNackThresholdMs);
201 // Max bytes/frame for frame size larger than VGA, ~200k at 25fps. 206 virtual ~VCMNackFecMethod();
202 enum { kMaxBytesPerFrameForFecHigh = 1000 }; 207 virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
203 }; 208 // Get the effective packet loss for ER
204 209 bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
205 210 // Get the protection factors
206 class VCMNackFecMethod : public VCMFecMethod 211 bool ProtectionFactor(const VCMProtectionParameters* parameters);
207 { 212 // Get the max number of frames the FEC is allowed to be based on.
208 public: 213 int MaxFramesFec() const;
209 VCMNackFecMethod(int64_t lowRttNackThresholdMs, 214 // Turn off the FEC based on low bitrate and other factors.
210 int64_t highRttNackThresholdMs); 215 bool BitRateTooLowForFec(const VCMProtectionParameters* parameters);
211 virtual ~VCMNackFecMethod(); 216
212 virtual bool UpdateParameters(const VCMProtectionParameters* parameters); 217 private:
213 // Get the effective packet loss for ER 218 int ComputeMaxFramesFec(const VCMProtectionParameters* parameters);
214 bool EffectivePacketLoss(const VCMProtectionParameters* parameters); 219
215 // Get the protection factors 220 int64_t _lowRttNackMs;
216 bool ProtectionFactor(const VCMProtectionParameters* parameters); 221 int64_t _highRttNackMs;
217 // Get the max number of frames the FEC is allowed to be based on. 222 int _maxFramesFec;
218 int MaxFramesFec() const; 223 };
219 // Turn off the FEC based on low bitrate and other factors. 224
220 bool BitRateTooLowForFec(const VCMProtectionParameters* parameters); 225 class VCMLossProtectionLogic {
221 private: 226 public:
222 int ComputeMaxFramesFec(const VCMProtectionParameters* parameters); 227 explicit VCMLossProtectionLogic(int64_t nowMs);
223 228 ~VCMLossProtectionLogic();
224 int64_t _lowRttNackMs; 229
225 int64_t _highRttNackMs; 230 // Set the protection method to be used
226 int _maxFramesFec; 231 //
227 }; 232 // Input:
228 233 // - newMethodType : New requested protection method type. If one
229 class VCMLossProtectionLogic 234 // is already set, it will be deleted and replaced
230 { 235 void SetMethod(VCMProtectionMethodEnum newMethodType);
231 public: 236
232 VCMLossProtectionLogic(int64_t nowMs); 237 // Update the round-trip time
233 ~VCMLossProtectionLogic(); 238 //
234 239 // Input:
235 // Set the protection method to be used 240 // - rtt : Round-trip time in seconds.
236 // 241 void UpdateRtt(int64_t rtt);
237 // Input: 242
238 // - newMethodType : New requested protection method type. If one 243 // Update the filtered packet loss.
239 // is already set, it will be deleted and replaced 244 //
240 void SetMethod(VCMProtectionMethodEnum newMethodType); 245 // Input:
241 246 // - packetLossEnc : The reported packet loss filtered
242 // Update the round-trip time 247 // (max window or average)
243 // 248 void UpdateFilteredLossPr(uint8_t packetLossEnc);
244 // Input: 249
245 // - rtt : Round-trip time in seconds. 250 // Update the current target bit rate.
246 void UpdateRtt(int64_t rtt); 251 //
247 252 // Input:
248 // Update the filtered packet loss. 253 // - bitRate : The current target bit rate in kbits/s
249 // 254 void UpdateBitRate(float bitRate);
250 // Input: 255
251 // - packetLossEnc : The reported packet loss filtered 256 // Update the number of packets per frame estimate, for delta frames
252 // (max window or average) 257 //
253 void UpdateFilteredLossPr(uint8_t packetLossEnc); 258 // Input:
254 259 // - nPackets : Number of packets in the latest sent frame.
255 // Update the current target bit rate. 260 void UpdatePacketsPerFrame(float nPackets, int64_t nowMs);
256 // 261
257 // Input: 262 // Update the number of packets per frame estimate, for key frames
258 // - bitRate : The current target bit rate in kbits/s 263 //
259 void UpdateBitRate(float bitRate); 264 // Input:
260 265 // - nPackets : umber of packets in the latest sent frame.
261 // Update the number of packets per frame estimate, for delta frames 266 void UpdatePacketsPerFrameKey(float nPackets, int64_t nowMs);
262 // 267
263 // Input: 268 // Update the keyFrameSize estimate
264 // - nPackets : Number of packets in the latest sent frame. 269 //
265 void UpdatePacketsPerFrame(float nPackets, int64_t nowMs); 270 // Input:
266 271 // - keyFrameSize : The size of the latest sent key frame.
267 // Update the number of packets per frame estimate, for key frames 272 void UpdateKeyFrameSize(float keyFrameSize);
268 // 273
269 // Input: 274 // Update the frame rate
270 // - nPackets : umber of packets in the latest sent frame. 275 //
271 void UpdatePacketsPerFrameKey(float nPackets, int64_t nowMs); 276 // Input:
272 277 // - frameRate : The current target frame rate.
273 // Update the keyFrameSize estimate 278 void UpdateFrameRate(float frameRate) { _frameRate = frameRate; }
274 // 279
275 // Input: 280 // Update the frame size
276 // - keyFrameSize : The size of the latest sent key frame. 281 //
277 void UpdateKeyFrameSize(float keyFrameSize); 282 // Input:
278 283 // - width : The codec frame width.
279 // Update the frame rate 284 // - height : The codec frame height.
280 // 285 void UpdateFrameSize(uint16_t width, uint16_t height);
281 // Input: 286
282 // - frameRate : The current target frame rate. 287 // Update the number of active layers
283 void UpdateFrameRate(float frameRate) { _frameRate = frameRate; } 288 //
284 289 // Input:
285 // Update the frame size 290 // - numLayers : Number of layers used.
286 // 291 void UpdateNumLayers(int numLayers);
287 // Input: 292
288 // - width : The codec frame width. 293 // The amount of packet loss to cover for with FEC.
289 // - height : The codec frame height. 294 //
290 void UpdateFrameSize(uint16_t width, uint16_t height); 295 // Input:
291 296 // - fecRateKey : Packet loss to cover for with FEC when
292 // Update the number of active layers 297 // sending key frames.
293 // 298 // - fecRateDelta : Packet loss to cover for with FEC when
294 // Input: 299 // sending delta frames.
295 // - numLayers : Number of layers used. 300 void UpdateFECRates(uint8_t fecRateKey, uint8_t fecRateDelta) {
296 void UpdateNumLayers(int numLayers); 301 _fecRateKey = fecRateKey;
297 302 _fecRateDelta = fecRateDelta;
298 // The amount of packet loss to cover for with FEC. 303 }
299 // 304
300 // Input: 305 // Update the protection methods with the current VCMProtectionParameters
301 // - fecRateKey : Packet loss to cover for with FEC when 306 // and set the requested protection settings.
302 // sending key frames. 307 // Return value : Returns true on update
303 // - fecRateDelta : Packet loss to cover for with FEC when 308 bool UpdateMethod();
304 // sending delta frames. 309
305 void UpdateFECRates(uint8_t fecRateKey, uint8_t fecRateDelta) 310 // Returns the method currently selected.
306 { _fecRateKey = fecRateKey; 311 //
307 _fecRateDelta = fecRateDelta; } 312 // Return value : The protection method currently selected.
308 313 VCMProtectionMethod* SelectedMethod() const;
309 // Update the protection methods with the current VCMProtectionParameters 314
310 // and set the requested protection settings. 315 // Return the protection type of the currently selected method
311 // Return value : Returns true on update 316 VCMProtectionMethodEnum SelectedType() const;
312 bool UpdateMethod(); 317
313 318 // Updates the filtered loss for the average and max window packet loss,
314 // Returns the method currently selected. 319 // and returns the filtered loss probability in the interval [0, 255].
315 // 320 // The returned filtered loss value depends on the parameter |filter_mode|.
316 // Return value : The protection method currently selected. 321 // The input parameter |lossPr255| is the received packet loss.
317 VCMProtectionMethod* SelectedMethod() const; 322
318 323 // Return value : The filtered loss probability
319 // Return the protection type of the currently selected method 324 uint8_t FilteredLoss(int64_t nowMs,
320 VCMProtectionMethodEnum SelectedType() const; 325 FilterPacketLossMode filter_mode,
321 326 uint8_t lossPr255);
322 // Updates the filtered loss for the average and max window packet loss, 327
323 // and returns the filtered loss probability in the interval [0, 255]. 328 void Reset(int64_t nowMs);
324 // The returned filtered loss value depends on the parameter |filter_mode|. 329
325 // The input parameter |lossPr255| is the received packet loss. 330 void Release();
326 331
327 // Return value : The filtered loss probability 332 private:
328 uint8_t FilteredLoss(int64_t nowMs, FilterPacketLossMode filter_mode, 333 // Sets the available loss protection methods.
329 uint8_t lossPr255); 334 void UpdateMaxLossHistory(uint8_t lossPr255, int64_t now);
330 335 uint8_t MaxFilteredLossPr(int64_t nowMs) const;
331 void Reset(int64_t nowMs); 336 rtc::scoped_ptr<VCMProtectionMethod> _selectedMethod;
332 337 VCMProtectionParameters _currentParameters;
333 void Release(); 338 int64_t _rtt;
334 339 float _lossPr;
335 private: 340 float _bitRate;
336 // Sets the available loss protection methods. 341 float _frameRate;
337 void UpdateMaxLossHistory(uint8_t lossPr255, int64_t now); 342 float _keyFrameSize;
338 uint8_t MaxFilteredLossPr(int64_t nowMs) const; 343 uint8_t _fecRateKey;
339 rtc::scoped_ptr<VCMProtectionMethod> _selectedMethod; 344 uint8_t _fecRateDelta;
340 VCMProtectionParameters _currentParameters; 345 int64_t _lastPrUpdateT;
341 int64_t _rtt; 346 int64_t _lastPacketPerFrameUpdateT;
342 float _lossPr; 347 int64_t _lastPacketPerFrameUpdateTKey;
343 float _bitRate; 348 rtc::ExpFilter _lossPr255;
344 float _frameRate; 349 VCMLossProbabilitySample _lossPrHistory[kLossPrHistorySize];
345 float _keyFrameSize; 350 uint8_t _shortMaxLossPr255;
346 uint8_t _fecRateKey; 351 rtc::ExpFilter _packetsPerFrame;
347 uint8_t _fecRateDelta; 352 rtc::ExpFilter _packetsPerFrameKey;
348 int64_t _lastPrUpdateT; 353 uint16_t _codecWidth;
349 int64_t _lastPacketPerFrameUpdateT; 354 uint16_t _codecHeight;
350 int64_t _lastPacketPerFrameUpdateTKey; 355 int _numLayers;
351 rtc::ExpFilter _lossPr255;
352 VCMLossProbabilitySample _lossPrHistory[kLossPrHistorySize];
353 uint8_t _shortMaxLossPr255;
354 rtc::ExpFilter _packetsPerFrame;
355 rtc::ExpFilter _packetsPerFrameKey;
356 uint16_t _codecWidth;
357 uint16_t _codecHeight;
358 int _numLayers;
359 }; 356 };
360 357
361 } // namespace media_optimization 358 } // namespace media_optimization
362 } // namespace webrtc 359 } // namespace webrtc
363 360
364 #endif // WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPT_UTIL_H_ 361 #endif // WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPT_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698