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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/tmmbr_help.cc

Issue 1669323002: TMMBRSet become vector<rtcp::TmmbItem> (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: makes std::vector<rtcp::TmmbItem> compatible with TMMBRSet Created 4 years, 10 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/tmmbr_help.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" 11 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <string.h> 14 #include <string.h>
15 15
16 #include <limits> 16 #include <limits>
17 17
18 #include "webrtc/base/checks.h"
18 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" 19 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 TMMBRSet::TMMBRSet() :
22 _sizeOfSet(0),
23 _lengthOfSet(0)
24 {
25 }
26
27 TMMBRSet::~TMMBRSet()
28 {
29 _sizeOfSet = 0;
30 _lengthOfSet = 0;
31 }
32
33 void 22 void
34 TMMBRSet::VerifyAndAllocateSet(uint32_t minimumSize) 23 TMMBRSet::VerifyAndAllocateSet(uint32_t minimumSize)
35 { 24 {
36 if(minimumSize > _sizeOfSet) 25 clear();
37 { 26 reserve(minimumSize);
38 // make sure that our buffers are big enough
39 _data.resize(minimumSize);
40 _sizeOfSet = minimumSize;
41 }
42 // reset memory
43 for(uint32_t i = 0; i < _sizeOfSet; i++)
44 {
45 _data.at(i).tmmbr = 0;
46 _data.at(i).packet_oh = 0;
47 _data.at(i).ssrc = 0;
48 }
49 _lengthOfSet = 0;
50 } 27 }
51 28
52 void 29 void
53 TMMBRSet::VerifyAndAllocateSetKeepingData(uint32_t minimumSize) 30 TMMBRSet::VerifyAndAllocateSetKeepingData(uint32_t minimumSize)
54 { 31 {
55 if(minimumSize > _sizeOfSet) 32 reserve(minimumSize);
56 {
57 {
58 _data.resize(minimumSize);
59 }
60 _sizeOfSet = minimumSize;
61 }
62 } 33 }
63 34
64 void TMMBRSet::SetEntry(unsigned int i, 35 void TMMBRSet::SetEntry(unsigned int i,
65 uint32_t tmmbrSet, 36 uint32_t tmmbrSet,
66 uint32_t packetOHSet, 37 uint32_t packetOHSet,
67 uint32_t ssrcSet) { 38 uint32_t ssrcSet) {
68 assert(i < _sizeOfSet); 39 RTC_DCHECK_LT(i, capacity());
69 _data.at(i).tmmbr = tmmbrSet; 40 if (i >= size()) {
70 _data.at(i).packet_oh = packetOHSet; 41 resize(i+1);
71 _data.at(i).ssrc = ssrcSet;
72 if (i >= _lengthOfSet) {
73 _lengthOfSet = i + 1;
74 } 42 }
43 (*this)[i].set_bitrate_bps(tmmbrSet * 1000);
44 (*this)[i].set_packet_overhead(packetOHSet);
45 (*this)[i].set_ssrc(ssrcSet);
75 } 46 }
76 47
77 void TMMBRSet::AddEntry(uint32_t tmmbrSet, 48 void TMMBRSet::AddEntry(uint32_t tmmbrSet,
78 uint32_t packetOHSet, 49 uint32_t packetOHSet,
79 uint32_t ssrcSet) { 50 uint32_t ssrcSet) {
80 assert(_lengthOfSet < _sizeOfSet); 51 RTC_DCHECK_LT(size(), capacity());
81 SetEntry(_lengthOfSet, tmmbrSet, packetOHSet, ssrcSet); 52 SetEntry(size(), tmmbrSet, packetOHSet, ssrcSet);
82 } 53 }
83 54
84 void TMMBRSet::RemoveEntry(uint32_t sourceIdx) { 55 void TMMBRSet::RemoveEntry(uint32_t sourceIdx) {
85 assert(sourceIdx < _lengthOfSet); 56 RTC_DCHECK_LT(sourceIdx, size());
86 _data.erase(_data.begin() + sourceIdx); 57 erase(begin() + sourceIdx);
87 _lengthOfSet--;
88 _data.resize(_sizeOfSet); // Ensure that size remains the same.
89 } 58 }
90 59
91 void TMMBRSet::SwapEntries(uint32_t i, uint32_t j) { 60 void TMMBRSet::SwapEntries(uint32_t i, uint32_t j) {
92 SetElement temp; 61 using std::swap;
93 temp = _data[i]; 62 swap((*this)[i], (*this)[j]);
94 _data[i] = _data[j];
95 _data[j] = temp;
96 } 63 }
97 64
98 void TMMBRSet::ClearEntry(uint32_t idx) { 65 void TMMBRSet::ClearEntry(uint32_t idx) {
99 SetEntry(idx, 0, 0, 0); 66 SetEntry(idx, 0, 0, 0);
100 } 67 }
101 68
102 TMMBRHelp::TMMBRHelp() 69 TMMBRHelp::TMMBRHelp()
103 : _criticalSection(CriticalSectionWrapper::CreateCriticalSection()), 70 : _criticalSection(CriticalSectionWrapper::CreateCriticalSection()),
104 _candidateSet(), 71 _candidateSet(),
105 _boundingSet(), 72 _boundingSet(),
106 _boundingSetToSend(), 73 _boundingSetToSend(),
107 _ptrIntersectionBoundingSet(NULL), 74 _ptrIntersectionBoundingSet(NULL),
108 _ptrMaxPRBoundingSet(NULL) { 75 _ptrMaxPRBoundingSet(NULL) {
109 } 76 }
110 77
111 TMMBRHelp::~TMMBRHelp() { 78 TMMBRHelp::~TMMBRHelp() {
112 delete [] _ptrIntersectionBoundingSet; 79 delete [] _ptrIntersectionBoundingSet;
113 delete [] _ptrMaxPRBoundingSet; 80 delete [] _ptrMaxPRBoundingSet;
114 _ptrIntersectionBoundingSet = 0; 81 _ptrIntersectionBoundingSet = 0;
115 _ptrMaxPRBoundingSet = 0; 82 _ptrMaxPRBoundingSet = 0;
116 delete _criticalSection; 83 delete _criticalSection;
117 } 84 }
118 85
119 TMMBRSet* 86 TMMBRSet*
120 TMMBRHelp::VerifyAndAllocateBoundingSet(uint32_t minimumSize) 87 TMMBRHelp::VerifyAndAllocateBoundingSet(uint32_t minimumSize)
121 { 88 {
122 CriticalSectionScoped lock(_criticalSection); 89 CriticalSectionScoped lock(_criticalSection);
123 90
124 if(minimumSize > _boundingSet.sizeOfSet()) 91 if(minimumSize > _boundingSet.capacity())
125 { 92 {
126 // make sure that our buffers are big enough 93 // make sure that our buffers are big enough
127 if(_ptrIntersectionBoundingSet) 94 if(_ptrIntersectionBoundingSet)
128 { 95 {
129 delete [] _ptrIntersectionBoundingSet; 96 delete [] _ptrIntersectionBoundingSet;
130 delete [] _ptrMaxPRBoundingSet; 97 delete [] _ptrMaxPRBoundingSet;
131 } 98 }
132 _ptrIntersectionBoundingSet = new float[minimumSize]; 99 _ptrIntersectionBoundingSet = new float[minimumSize];
133 _ptrMaxPRBoundingSet = new float[minimumSize]; 100 _ptrMaxPRBoundingSet = new float[minimumSize];
134 } 101 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return &_boundingSetToSend; 161 return &_boundingSetToSend;
195 } 162 }
196 163
197 int32_t 164 int32_t
198 TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet) 165 TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet)
199 { 166 {
200 CriticalSectionScoped lock(_criticalSection); 167 CriticalSectionScoped lock(_criticalSection);
201 168
202 // Work on local variable, will be modified 169 // Work on local variable, will be modified
203 TMMBRSet candidateSet; 170 TMMBRSet candidateSet;
204 candidateSet.VerifyAndAllocateSet(_candidateSet.sizeOfSet()); 171 candidateSet.VerifyAndAllocateSet(_candidateSet.capacity());
205 172
206 // TODO(hta) Figure out if this should be lengthOfSet instead. 173 for (uint32_t i = 0; i < _candidateSet.size(); i++)
207 for (uint32_t i = 0; i < _candidateSet.sizeOfSet(); i++)
208 { 174 {
209 if(_candidateSet.Tmmbr(i)) 175 if(_candidateSet.Tmmbr(i))
210 { 176 {
211 candidateSet.AddEntry(_candidateSet.Tmmbr(i), 177 candidateSet.AddEntry(_candidateSet.Tmmbr(i),
212 _candidateSet.PacketOH(i), 178 _candidateSet.PacketOH(i),
213 _candidateSet.Ssrc(i)); 179 _candidateSet.Ssrc(i));
214 } 180 }
215 else 181 else
216 { 182 {
217 // make sure this is zero if tmmbr = 0 183 // make sure this is zero if tmmbr = 0
218 assert(_candidateSet.PacketOH(i) == 0); 184 assert(_candidateSet.PacketOH(i) == 0);
219 // Old code: 185 // Old code:
220 // _candidateSet.ptrPacketOHSet[i] = 0; 186 // _candidateSet.ptrPacketOHSet[i] = 0;
221 } 187 }
222 } 188 }
223 189
224 // Number of set candidates 190 // Number of set candidates
225 int32_t numSetCandidates = candidateSet.lengthOfSet(); 191 int32_t numSetCandidates = candidateSet.lengthOfSet();
226 // Find bounding set 192 // Find bounding set
227 uint32_t numBoundingSet = 0; 193 uint32_t numBoundingSet = 0;
228 if (numSetCandidates > 0) 194 if (numSetCandidates > 0)
229 { 195 {
230 numBoundingSet = FindTMMBRBoundingSet(numSetCandidates, candidateSet); 196 numBoundingSet = FindTMMBRBoundingSet(numSetCandidates, candidateSet);
231 if(numBoundingSet < 1 || (numBoundingSet > _candidateSet.sizeOfSet())) 197 if(numBoundingSet < 1 || (numBoundingSet > _candidateSet.size()))
232 { 198 {
233 return -1; 199 return -1;
234 } 200 }
235 boundingSet = &_boundingSet; 201 boundingSet = &_boundingSet;
236 } 202 }
237 return numBoundingSet; 203 return numBoundingSet;
238 } 204 }
239 205
240 206
241 int32_t 207 int32_t
242 TMMBRHelp::FindTMMBRBoundingSet(int32_t numCandidates, TMMBRSet& candidateSet) 208 TMMBRHelp::FindTMMBRBoundingSet(int32_t numCandidates, TMMBRSet& candidateSet)
243 { 209 {
244 CriticalSectionScoped lock(_criticalSection); 210 CriticalSectionScoped lock(_criticalSection);
245 211
246 uint32_t numBoundingSet = 0; 212 uint32_t numBoundingSet = 0;
247 VerifyAndAllocateBoundingSet(candidateSet.sizeOfSet()); 213 VerifyAndAllocateBoundingSet(candidateSet.capacity());
248 214
249 if (numCandidates == 1) 215 if (numCandidates == 1)
250 { 216 {
251 // TODO(hta): lengthOfSet instead of sizeOfSet? 217 for (uint32_t i = 0; i < candidateSet.size(); i++)
252 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
253 { 218 {
254 if (candidateSet.Tmmbr(i) > 0) 219 if (candidateSet.Tmmbr(i) > 0)
255 { 220 {
256 _boundingSet.AddEntry(candidateSet.Tmmbr(i), 221 _boundingSet.AddEntry(candidateSet.Tmmbr(i),
257 candidateSet.PacketOH(i), 222 candidateSet.PacketOH(i),
258 candidateSet.Ssrc(i)); 223 candidateSet.Ssrc(i));
259 numBoundingSet++; 224 numBoundingSet++;
260 } 225 }
261 } 226 }
262 return (numBoundingSet == 1) ? 1 : -1; 227 return (numBoundingSet == 1) ? 1 : -1;
263 } 228 }
264 229
265 // 1. Sort by increasing packetOH 230 // 1. Sort by increasing packetOH
266 for (int i = candidateSet.sizeOfSet() - 1; i >= 0; i--) 231 for (int i = candidateSet.size() - 1; i >= 0; i--)
267 { 232 {
268 for (int j = 1; j <= i; j++) 233 for (int j = 1; j <= i; j++)
269 { 234 {
270 if (candidateSet.PacketOH(j-1) > candidateSet.PacketOH(j)) 235 if (candidateSet.PacketOH(j-1) > candidateSet.PacketOH(j))
271 { 236 {
272 candidateSet.SwapEntries(j-1, j); 237 candidateSet.SwapEntries(j-1, j);
273 } 238 }
274 } 239 }
275 } 240 }
276 // 2. For tuples with same OH, keep the one w/ the lowest bitrate 241 // 2. For tuples with same OH, keep the one w/ the lowest bitrate
277 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++) 242 for (uint32_t i = 0; i < candidateSet.size(); i++)
278 { 243 {
279 if (candidateSet.Tmmbr(i) > 0) 244 if (candidateSet.Tmmbr(i) > 0)
280 { 245 {
281 // get min bitrate for packets w/ same OH 246 // get min bitrate for packets w/ same OH
282 uint32_t currentPacketOH = candidateSet.PacketOH(i); 247 uint32_t currentPacketOH = candidateSet.PacketOH(i);
283 uint32_t currentMinTMMBR = candidateSet.Tmmbr(i); 248 uint32_t currentMinTMMBR = candidateSet.Tmmbr(i);
284 uint32_t currentMinIndexTMMBR = i; 249 uint32_t currentMinIndexTMMBR = i;
285 for (uint32_t j = i+1; j < candidateSet.sizeOfSet(); j++) 250 for (uint32_t j = i+1; j < candidateSet.size(); j++)
286 { 251 {
287 if(candidateSet.PacketOH(j) == currentPacketOH) 252 if(candidateSet.PacketOH(j) == currentPacketOH)
288 { 253 {
289 if(candidateSet.Tmmbr(j) < currentMinTMMBR) 254 if(candidateSet.Tmmbr(j) < currentMinTMMBR)
290 { 255 {
291 currentMinTMMBR = candidateSet.Tmmbr(j); 256 currentMinTMMBR = candidateSet.Tmmbr(j);
292 currentMinIndexTMMBR = j; 257 currentMinIndexTMMBR = j;
293 } 258 }
294 } 259 }
295 } 260 }
296 // keep lowest bitrate 261 // keep lowest bitrate
297 for (uint32_t j = 0; j < candidateSet.sizeOfSet(); j++) 262 for (uint32_t j = 0; j < candidateSet.size(); j++)
298 { 263 {
299 if(candidateSet.PacketOH(j) == currentPacketOH 264 if(candidateSet.PacketOH(j) == currentPacketOH
300 && j != currentMinIndexTMMBR) 265 && j != currentMinIndexTMMBR)
301 { 266 {
302 candidateSet.ClearEntry(j); 267 candidateSet.ClearEntry(j);
303 } 268 }
304 } 269 }
305 } 270 }
306 } 271 }
307 // 3. Select and remove tuple w/ lowest tmmbr. 272 // 3. Select and remove tuple w/ lowest tmmbr.
308 // (If more than 1, choose the one w/ highest OH). 273 // (If more than 1, choose the one w/ highest OH).
309 uint32_t minTMMBR = 0; 274 uint32_t minTMMBR = 0;
310 uint32_t minIndexTMMBR = 0; 275 uint32_t minIndexTMMBR = 0;
311 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++) 276 for (uint32_t i = 0; i < candidateSet.size(); i++)
312 { 277 {
313 if (candidateSet.Tmmbr(i) > 0) 278 if (candidateSet.Tmmbr(i) > 0)
314 { 279 {
315 minTMMBR = candidateSet.Tmmbr(i); 280 minTMMBR = candidateSet.Tmmbr(i);
316 minIndexTMMBR = i; 281 minIndexTMMBR = i;
317 break; 282 break;
318 } 283 }
319 } 284 }
320 285
321 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++) 286 for (uint32_t i = 0; i < candidateSet.size(); i++)
322 { 287 {
323 if (candidateSet.Tmmbr(i) > 0 && candidateSet.Tmmbr(i) <= minTMMBR) 288 if (candidateSet.Tmmbr(i) > 0 && candidateSet.Tmmbr(i) <= minTMMBR)
324 { 289 {
325 // get min bitrate 290 // get min bitrate
326 minTMMBR = candidateSet.Tmmbr(i); 291 minTMMBR = candidateSet.Tmmbr(i);
327 minIndexTMMBR = i; 292 minIndexTMMBR = i;
328 } 293 }
329 } 294 }
330 // first member of selected list 295 // first member of selected list
331 _boundingSet.SetEntry(numBoundingSet, 296 _boundingSet.SetEntry(numBoundingSet,
332 candidateSet.Tmmbr(minIndexTMMBR), 297 candidateSet.Tmmbr(minIndexTMMBR),
333 candidateSet.PacketOH(minIndexTMMBR), 298 candidateSet.PacketOH(minIndexTMMBR),
334 candidateSet.Ssrc(minIndexTMMBR)); 299 candidateSet.Ssrc(minIndexTMMBR));
335 300
336 // set intersection value 301 // set intersection value
337 _ptrIntersectionBoundingSet[numBoundingSet] = 0; 302 _ptrIntersectionBoundingSet[numBoundingSet] = 0;
338 // calculate its maximum packet rate (where its line crosses x-axis) 303 // calculate its maximum packet rate (where its line crosses x-axis)
339 _ptrMaxPRBoundingSet[numBoundingSet] 304 _ptrMaxPRBoundingSet[numBoundingSet]
340 = _boundingSet.Tmmbr(numBoundingSet) * 1000 305 = _boundingSet.Tmmbr(numBoundingSet) * 1000
341 / float(8 * _boundingSet.PacketOH(numBoundingSet)); 306 / float(8 * _boundingSet.PacketOH(numBoundingSet));
342 numBoundingSet++; 307 numBoundingSet++;
343 // remove from candidate list 308 // remove from candidate list
344 candidateSet.ClearEntry(minIndexTMMBR); 309 candidateSet.ClearEntry(minIndexTMMBR);
345 numCandidates--; 310 numCandidates--;
346 311
347 // 4. Discard from candidate list all tuple w/ lower OH 312 // 4. Discard from candidate list all tuple w/ lower OH
348 // (next tuple must be steeper) 313 // (next tuple must be steeper)
349 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++) 314 for (uint32_t i = 0; i < candidateSet.size(); i++)
350 { 315 {
351 if(candidateSet.Tmmbr(i) > 0 316 if(candidateSet.Tmmbr(i) > 0
352 && candidateSet.PacketOH(i) < _boundingSet.PacketOH(0)) 317 && candidateSet.PacketOH(i) < _boundingSet.PacketOH(0))
353 { 318 {
354 candidateSet.ClearEntry(i); 319 candidateSet.ClearEntry(i);
355 numCandidates--; 320 numCandidates--;
356 } 321 }
357 } 322 }
358 323
359 if (numCandidates == 0) 324 if (numCandidates == 0)
360 { 325 {
361 // Should be true already:_boundingSet.lengthOfSet = numBoundingSet; 326 // Should be true already:_boundingSet.lengthOfSet = numBoundingSet;
362 assert(_boundingSet.lengthOfSet() == numBoundingSet); 327 assert(_boundingSet.lengthOfSet() == numBoundingSet);
363 return numBoundingSet; 328 return numBoundingSet;
364 } 329 }
365 330
366 bool getNewCandidate = true; 331 bool getNewCandidate = true;
367 int curCandidateTMMBR = 0; 332 int curCandidateTMMBR = 0;
368 int curCandidateIndex = 0; 333 int curCandidateIndex = 0;
369 int curCandidatePacketOH = 0; 334 int curCandidatePacketOH = 0;
370 int curCandidateSSRC = 0; 335 int curCandidateSSRC = 0;
371 do 336 do
372 { 337 {
373 if (getNewCandidate) 338 if (getNewCandidate)
374 { 339 {
375 // 5. Remove first remaining tuple from candidate list 340 // 5. Remove first remaining tuple from candidate list
376 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++) 341 for (uint32_t i = 0; i < candidateSet.size(); i++)
377 { 342 {
378 if (candidateSet.Tmmbr(i) > 0) 343 if (candidateSet.Tmmbr(i) > 0)
379 { 344 {
380 curCandidateTMMBR = candidateSet.Tmmbr(i); 345 curCandidateTMMBR = candidateSet.Tmmbr(i);
381 curCandidatePacketOH = candidateSet.PacketOH(i); 346 curCandidatePacketOH = candidateSet.PacketOH(i);
382 curCandidateSSRC = candidateSet.Ssrc(i); 347 curCandidateSSRC = candidateSet.Ssrc(i);
383 curCandidateIndex = i; 348 curCandidateIndex = i;
384 candidateSet.ClearEntry(curCandidateIndex); 349 candidateSet.ClearEntry(curCandidateIndex);
385 break; 350 break;
386 } 351 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 400
436 bool TMMBRHelp::IsOwner(const uint32_t ssrc, 401 bool TMMBRHelp::IsOwner(const uint32_t ssrc,
437 const uint32_t length) const { 402 const uint32_t length) const {
438 CriticalSectionScoped lock(_criticalSection); 403 CriticalSectionScoped lock(_criticalSection);
439 404
440 if (length == 0) { 405 if (length == 0) {
441 // Empty bounding set. 406 // Empty bounding set.
442 return false; 407 return false;
443 } 408 }
444 for(uint32_t i = 0; 409 for(uint32_t i = 0;
445 (i < length) && (i < _boundingSet.sizeOfSet()); ++i) { 410 (i < length) && (i < _boundingSet.size()); ++i) {
446 if(_boundingSet.Ssrc(i) == ssrc) { 411 if(_boundingSet.Ssrc(i) == ssrc) {
447 return true; 412 return true;
448 } 413 }
449 } 414 }
450 return false; 415 return false;
451 } 416 }
452 417
453 bool TMMBRHelp::CalcMinBitRate( uint32_t* minBitrateKbit) const { 418 bool TMMBRHelp::CalcMinBitRate( uint32_t* minBitrateKbit) const {
454 CriticalSectionScoped lock(_criticalSection); 419 CriticalSectionScoped lock(_criticalSection);
455 420
456 if (_candidateSet.sizeOfSet() == 0) { 421 if (_candidateSet.size() == 0) {
457 // Empty bounding set. 422 // Empty bounding set.
458 return false; 423 return false;
459 } 424 }
460 *minBitrateKbit = std::numeric_limits<uint32_t>::max(); 425 *minBitrateKbit = std::numeric_limits<uint32_t>::max();
461 426
462 for (uint32_t i = 0; i < _candidateSet.lengthOfSet(); ++i) { 427 for (uint32_t i = 0; i < _candidateSet.lengthOfSet(); ++i) {
463 uint32_t curNetBitRateKbit = _candidateSet.Tmmbr(i); 428 uint32_t curNetBitRateKbit = _candidateSet.Tmmbr(i);
464 if (curNetBitRateKbit < MIN_VIDEO_BW_MANAGEMENT_BITRATE) { 429 if (curNetBitRateKbit < MIN_VIDEO_BW_MANAGEMENT_BITRATE) {
465 curNetBitRateKbit = MIN_VIDEO_BW_MANAGEMENT_BITRATE; 430 curNetBitRateKbit = MIN_VIDEO_BW_MANAGEMENT_BITRATE;
466 } 431 }
467 *minBitrateKbit = curNetBitRateKbit < *minBitrateKbit ? 432 *minBitrateKbit = curNetBitRateKbit < *minBitrateKbit ?
468 curNetBitRateKbit : *minBitrateKbit; 433 curNetBitRateKbit : *minBitrateKbit;
469 } 434 }
470 return true; 435 return true;
471 } 436 }
472 } // namespace webrtc 437 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/tmmbr_help.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698