blob: f994ff704932ebc7ddddef5f1abebc4fcf667a66 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000011#include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000012
hta@webrtc.org54536bb2012-05-03 14:07:23 +000013#include <assert.h>
hta@webrtc.org54536bb2012-05-03 14:07:23 +000014#include <string.h>
danilchapb8b6fbb2015-12-10 05:05:27 -080015
16#include <limits>
17
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000018#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000019
20namespace webrtc {
21TMMBRSet::TMMBRSet() :
hta@webrtc.org54536bb2012-05-03 14:07:23 +000022 _sizeOfSet(0),
23 _lengthOfSet(0)
niklase@google.com470e71d2011-07-07 08:21:25 +000024{
25}
26
27TMMBRSet::~TMMBRSet()
28{
hta@webrtc.org54536bb2012-05-03 14:07:23 +000029 _sizeOfSet = 0;
30 _lengthOfSet = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000031}
32
33void
pbos@webrtc.org2f446732013-04-08 11:08:41 +000034TMMBRSet::VerifyAndAllocateSet(uint32_t minimumSize)
niklase@google.com470e71d2011-07-07 08:21:25 +000035{
hta@webrtc.org54536bb2012-05-03 14:07:23 +000036 if(minimumSize > _sizeOfSet)
niklase@google.com470e71d2011-07-07 08:21:25 +000037 {
38 // make sure that our buffers are big enough
hta@webrtc.org54536bb2012-05-03 14:07:23 +000039 _data.resize(minimumSize);
40 _sizeOfSet = minimumSize;
niklase@google.com470e71d2011-07-07 08:21:25 +000041 }
42 // reset memory
pbos@webrtc.org2f446732013-04-08 11:08:41 +000043 for(uint32_t i = 0; i < _sizeOfSet; i++)
niklase@google.com470e71d2011-07-07 08:21:25 +000044 {
hta@webrtc.org54536bb2012-05-03 14:07:23 +000045 _data.at(i).tmmbr = 0;
46 _data.at(i).packet_oh = 0;
47 _data.at(i).ssrc = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000048 }
hta@webrtc.org54536bb2012-05-03 14:07:23 +000049 _lengthOfSet = 0;
50}
51
52void
pbos@webrtc.org2f446732013-04-08 11:08:41 +000053TMMBRSet::VerifyAndAllocateSetKeepingData(uint32_t minimumSize)
hta@webrtc.org54536bb2012-05-03 14:07:23 +000054{
55 if(minimumSize > _sizeOfSet)
56 {
57 {
58 _data.resize(minimumSize);
59 }
60 _sizeOfSet = minimumSize;
61 }
62}
63
64void TMMBRSet::SetEntry(unsigned int i,
pbos@webrtc.org2f446732013-04-08 11:08:41 +000065 uint32_t tmmbrSet,
66 uint32_t packetOHSet,
67 uint32_t ssrcSet) {
hta@webrtc.org54536bb2012-05-03 14:07:23 +000068 assert(i < _sizeOfSet);
69 _data.at(i).tmmbr = tmmbrSet;
70 _data.at(i).packet_oh = packetOHSet;
71 _data.at(i).ssrc = ssrcSet;
72 if (i >= _lengthOfSet) {
73 _lengthOfSet = i + 1;
74 }
75}
76
pbos@webrtc.org2f446732013-04-08 11:08:41 +000077void TMMBRSet::AddEntry(uint32_t tmmbrSet,
78 uint32_t packetOHSet,
79 uint32_t ssrcSet) {
hta@webrtc.org54536bb2012-05-03 14:07:23 +000080 assert(_lengthOfSet < _sizeOfSet);
81 SetEntry(_lengthOfSet, tmmbrSet, packetOHSet, ssrcSet);
82}
83
pbos@webrtc.org2f446732013-04-08 11:08:41 +000084void TMMBRSet::RemoveEntry(uint32_t sourceIdx) {
hta@webrtc.org54536bb2012-05-03 14:07:23 +000085 assert(sourceIdx < _lengthOfSet);
86 _data.erase(_data.begin() + sourceIdx);
87 _lengthOfSet--;
88 _data.resize(_sizeOfSet); // Ensure that size remains the same.
89}
90
pbos@webrtc.org2f446732013-04-08 11:08:41 +000091void TMMBRSet::SwapEntries(uint32_t i, uint32_t j) {
hta@webrtc.org54536bb2012-05-03 14:07:23 +000092 SetElement temp;
93 temp = _data[i];
94 _data[i] = _data[j];
95 _data[j] = temp;
96}
97
pbos@webrtc.org2f446732013-04-08 11:08:41 +000098void TMMBRSet::ClearEntry(uint32_t idx) {
hta@webrtc.org54536bb2012-05-03 14:07:23 +000099 SetEntry(idx, 0, 0, 0);
niklase@google.com470e71d2011-07-07 08:21:25 +0000100}
101
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000102TMMBRHelp::TMMBRHelp()
103 : _criticalSection(CriticalSectionWrapper::CreateCriticalSection()),
104 _candidateSet(),
105 _boundingSet(),
106 _boundingSetToSend(),
107 _ptrIntersectionBoundingSet(NULL),
108 _ptrMaxPRBoundingSet(NULL) {
niklase@google.com470e71d2011-07-07 08:21:25 +0000109}
110
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000111TMMBRHelp::~TMMBRHelp() {
112 delete [] _ptrIntersectionBoundingSet;
113 delete [] _ptrMaxPRBoundingSet;
114 _ptrIntersectionBoundingSet = 0;
115 _ptrMaxPRBoundingSet = 0;
116 delete _criticalSection;
niklase@google.com470e71d2011-07-07 08:21:25 +0000117}
118
119TMMBRSet*
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000120TMMBRHelp::VerifyAndAllocateBoundingSet(uint32_t minimumSize)
niklase@google.com470e71d2011-07-07 08:21:25 +0000121{
122 CriticalSectionScoped lock(_criticalSection);
123
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000124 if(minimumSize > _boundingSet.sizeOfSet())
niklase@google.com470e71d2011-07-07 08:21:25 +0000125 {
126 // make sure that our buffers are big enough
127 if(_ptrIntersectionBoundingSet)
128 {
129 delete [] _ptrIntersectionBoundingSet;
130 delete [] _ptrMaxPRBoundingSet;
131 }
132 _ptrIntersectionBoundingSet = new float[minimumSize];
133 _ptrMaxPRBoundingSet = new float[minimumSize];
134 }
135 _boundingSet.VerifyAndAllocateSet(minimumSize);
136 return &_boundingSet;
137}
138
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000139TMMBRSet* TMMBRHelp::BoundingSet() {
140 return &_boundingSet;
niklase@google.com470e71d2011-07-07 08:21:25 +0000141}
142
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000143int32_t
niklase@google.com470e71d2011-07-07 08:21:25 +0000144TMMBRHelp::SetTMMBRBoundingSetToSend(const TMMBRSet* boundingSetToSend,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000145 const uint32_t maxBitrateKbit)
niklase@google.com470e71d2011-07-07 08:21:25 +0000146{
147 CriticalSectionScoped lock(_criticalSection);
148
149 if (boundingSetToSend == NULL)
150 {
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000151 _boundingSetToSend.clearSet();
niklase@google.com470e71d2011-07-07 08:21:25 +0000152 return 0;
153 }
154
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000155 VerifyAndAllocateBoundingSetToSend(boundingSetToSend->lengthOfSet());
156 _boundingSetToSend.clearSet();
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000157 for (uint32_t i = 0; i < boundingSetToSend->lengthOfSet(); i++)
niklase@google.com470e71d2011-07-07 08:21:25 +0000158 {
159 // cap at our configured max bitrate
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000160 uint32_t bitrate = boundingSetToSend->Tmmbr(i);
niklase@google.com470e71d2011-07-07 08:21:25 +0000161 if(maxBitrateKbit)
162 {
163 // do we have a configured max bitrate?
164 if(bitrate > maxBitrateKbit)
165 {
166 bitrate = maxBitrateKbit;
167 }
168 }
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000169 _boundingSetToSend.SetEntry(i, bitrate,
170 boundingSetToSend->PacketOH(i),
171 boundingSetToSend->Ssrc(i));
niklase@google.com470e71d2011-07-07 08:21:25 +0000172 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000173 return 0;
174}
175
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000176int32_t
177TMMBRHelp::VerifyAndAllocateBoundingSetToSend(uint32_t minimumSize)
niklase@google.com470e71d2011-07-07 08:21:25 +0000178{
179 CriticalSectionScoped lock(_criticalSection);
180
181 _boundingSetToSend.VerifyAndAllocateSet(minimumSize);
182 return 0;
183}
184
185TMMBRSet*
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000186TMMBRHelp::VerifyAndAllocateCandidateSet(uint32_t minimumSize)
niklase@google.com470e71d2011-07-07 08:21:25 +0000187{
188 CriticalSectionScoped lock(_criticalSection);
189
190 _candidateSet.VerifyAndAllocateSet(minimumSize);
191 return &_candidateSet;
192}
193
194TMMBRSet*
195TMMBRHelp::CandidateSet()
196{
197 return &_candidateSet;
198}
199
200TMMBRSet*
201TMMBRHelp::BoundingSetToSend()
202{
203 return &_boundingSetToSend;
204}
205
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000206int32_t
niklase@google.com470e71d2011-07-07 08:21:25 +0000207TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet)
208{
209 CriticalSectionScoped lock(_criticalSection);
210
211 // Work on local variable, will be modified
212 TMMBRSet candidateSet;
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000213 candidateSet.VerifyAndAllocateSet(_candidateSet.sizeOfSet());
niklase@google.com470e71d2011-07-07 08:21:25 +0000214
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000215 // TODO(hta) Figure out if this should be lengthOfSet instead.
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000216 for (uint32_t i = 0; i < _candidateSet.sizeOfSet(); i++)
niklase@google.com470e71d2011-07-07 08:21:25 +0000217 {
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000218 if(_candidateSet.Tmmbr(i))
niklase@google.com470e71d2011-07-07 08:21:25 +0000219 {
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000220 candidateSet.AddEntry(_candidateSet.Tmmbr(i),
221 _candidateSet.PacketOH(i),
222 _candidateSet.Ssrc(i));
niklase@google.com470e71d2011-07-07 08:21:25 +0000223 }
224 else
225 {
226 // make sure this is zero if tmmbr = 0
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000227 assert(_candidateSet.PacketOH(i) == 0);
228 // Old code:
229 // _candidateSet.ptrPacketOHSet[i] = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000230 }
231 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000232
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000233 // Number of set candidates
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000234 int32_t numSetCandidates = candidateSet.lengthOfSet();
niklase@google.com470e71d2011-07-07 08:21:25 +0000235 // Find bounding set
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000236 uint32_t numBoundingSet = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000237 if (numSetCandidates > 0)
238 {
239 numBoundingSet = FindTMMBRBoundingSet(numSetCandidates, candidateSet);
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000240 if(numBoundingSet < 1 || (numBoundingSet > _candidateSet.sizeOfSet()))
niklase@google.com470e71d2011-07-07 08:21:25 +0000241 {
242 return -1;
243 }
244 boundingSet = &_boundingSet;
245 }
246 return numBoundingSet;
247}
248
249
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000250int32_t
251TMMBRHelp::FindTMMBRBoundingSet(int32_t numCandidates, TMMBRSet& candidateSet)
niklase@google.com470e71d2011-07-07 08:21:25 +0000252{
253 CriticalSectionScoped lock(_criticalSection);
254
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000255 uint32_t numBoundingSet = 0;
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000256 VerifyAndAllocateBoundingSet(candidateSet.sizeOfSet());
niklase@google.com470e71d2011-07-07 08:21:25 +0000257
258 if (numCandidates == 1)
259 {
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000260 // TODO(hta): lengthOfSet instead of sizeOfSet?
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000261 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
niklase@google.com470e71d2011-07-07 08:21:25 +0000262 {
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000263 if (candidateSet.Tmmbr(i) > 0)
niklase@google.com470e71d2011-07-07 08:21:25 +0000264 {
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000265 _boundingSet.AddEntry(candidateSet.Tmmbr(i),
266 candidateSet.PacketOH(i),
267 candidateSet.Ssrc(i));
niklase@google.com470e71d2011-07-07 08:21:25 +0000268 numBoundingSet++;
269 }
270 }
tommi@webrtc.orgeec6ecd2014-07-11 19:09:59 +0000271 return (numBoundingSet == 1) ? 1 : -1;
niklase@google.com470e71d2011-07-07 08:21:25 +0000272 }
tommi@webrtc.orgeec6ecd2014-07-11 19:09:59 +0000273
274 // 1. Sort by increasing packetOH
275 for (int i = candidateSet.sizeOfSet() - 1; i >= 0; i--)
276 {
277 for (int j = 1; j <= i; j++)
278 {
279 if (candidateSet.PacketOH(j-1) > candidateSet.PacketOH(j))
280 {
281 candidateSet.SwapEntries(j-1, j);
282 }
283 }
284 }
285 // 2. For tuples with same OH, keep the one w/ the lowest bitrate
286 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
287 {
288 if (candidateSet.Tmmbr(i) > 0)
289 {
290 // get min bitrate for packets w/ same OH
291 uint32_t currentPacketOH = candidateSet.PacketOH(i);
292 uint32_t currentMinTMMBR = candidateSet.Tmmbr(i);
293 uint32_t currentMinIndexTMMBR = i;
294 for (uint32_t j = i+1; j < candidateSet.sizeOfSet(); j++)
295 {
296 if(candidateSet.PacketOH(j) == currentPacketOH)
297 {
298 if(candidateSet.Tmmbr(j) < currentMinTMMBR)
299 {
300 currentMinTMMBR = candidateSet.Tmmbr(j);
301 currentMinIndexTMMBR = j;
302 }
303 }
304 }
305 // keep lowest bitrate
306 for (uint32_t j = 0; j < candidateSet.sizeOfSet(); j++)
307 {
308 if(candidateSet.PacketOH(j) == currentPacketOH
309 && j != currentMinIndexTMMBR)
310 {
311 candidateSet.ClearEntry(j);
312 }
313 }
314 }
315 }
316 // 3. Select and remove tuple w/ lowest tmmbr.
317 // (If more than 1, choose the one w/ highest OH).
318 uint32_t minTMMBR = 0;
319 uint32_t minIndexTMMBR = 0;
320 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
321 {
322 if (candidateSet.Tmmbr(i) > 0)
323 {
324 minTMMBR = candidateSet.Tmmbr(i);
325 minIndexTMMBR = i;
326 break;
327 }
328 }
329
330 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
331 {
332 if (candidateSet.Tmmbr(i) > 0 && candidateSet.Tmmbr(i) <= minTMMBR)
333 {
334 // get min bitrate
335 minTMMBR = candidateSet.Tmmbr(i);
336 minIndexTMMBR = i;
337 }
338 }
339 // first member of selected list
340 _boundingSet.SetEntry(numBoundingSet,
341 candidateSet.Tmmbr(minIndexTMMBR),
342 candidateSet.PacketOH(minIndexTMMBR),
343 candidateSet.Ssrc(minIndexTMMBR));
344
345 // set intersection value
346 _ptrIntersectionBoundingSet[numBoundingSet] = 0;
347 // calculate its maximum packet rate (where its line crosses x-axis)
348 _ptrMaxPRBoundingSet[numBoundingSet]
349 = _boundingSet.Tmmbr(numBoundingSet) * 1000
350 / float(8 * _boundingSet.PacketOH(numBoundingSet));
351 numBoundingSet++;
352 // remove from candidate list
353 candidateSet.ClearEntry(minIndexTMMBR);
354 numCandidates--;
355
356 // 4. Discard from candidate list all tuple w/ lower OH
357 // (next tuple must be steeper)
358 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
359 {
360 if(candidateSet.Tmmbr(i) > 0
361 && candidateSet.PacketOH(i) < _boundingSet.PacketOH(0))
362 {
363 candidateSet.ClearEntry(i);
364 numCandidates--;
365 }
366 }
367
368 if (numCandidates == 0)
369 {
370 // Should be true already:_boundingSet.lengthOfSet = numBoundingSet;
371 assert(_boundingSet.lengthOfSet() == numBoundingSet);
372 return numBoundingSet;
373 }
374
375 bool getNewCandidate = true;
376 int curCandidateTMMBR = 0;
377 int curCandidateIndex = 0;
378 int curCandidatePacketOH = 0;
379 int curCandidateSSRC = 0;
380 do
381 {
382 if (getNewCandidate)
383 {
384 // 5. Remove first remaining tuple from candidate list
385 for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
386 {
387 if (candidateSet.Tmmbr(i) > 0)
388 {
389 curCandidateTMMBR = candidateSet.Tmmbr(i);
390 curCandidatePacketOH = candidateSet.PacketOH(i);
391 curCandidateSSRC = candidateSet.Ssrc(i);
392 curCandidateIndex = i;
393 candidateSet.ClearEntry(curCandidateIndex);
394 break;
395 }
396 }
397 }
398
399 // 6. Calculate packet rate and intersection of the current
400 // line with line of last tuple in selected list
401 float packetRate
402 = float(curCandidateTMMBR
403 - _boundingSet.Tmmbr(numBoundingSet-1))*1000
404 / (8*(curCandidatePacketOH
405 - _boundingSet.PacketOH(numBoundingSet-1)));
406
407 // 7. If the packet rate is equal or lower than intersection of
408 // last tuple in selected list,
409 // remove last tuple in selected list & go back to step 6
410 if(packetRate <= _ptrIntersectionBoundingSet[numBoundingSet-1])
411 {
412 // remove last tuple and goto step 6
413 numBoundingSet--;
414 _boundingSet.ClearEntry(numBoundingSet);
415 _ptrIntersectionBoundingSet[numBoundingSet] = 0;
416 _ptrMaxPRBoundingSet[numBoundingSet] = 0;
417 getNewCandidate = false;
418 } else
419 {
420 // 8. If packet rate is lower than maximum packet rate of
421 // last tuple in selected list, add current tuple to selected
422 // list
423 if (packetRate < _ptrMaxPRBoundingSet[numBoundingSet-1])
424 {
425 _boundingSet.SetEntry(numBoundingSet,
426 curCandidateTMMBR,
427 curCandidatePacketOH,
428 curCandidateSSRC);
429 _ptrIntersectionBoundingSet[numBoundingSet] = packetRate;
430 _ptrMaxPRBoundingSet[numBoundingSet]
431 = _boundingSet.Tmmbr(numBoundingSet)*1000
432 / float(8*_boundingSet.PacketOH(numBoundingSet));
433 numBoundingSet++;
434 }
435 numCandidates--;
436 getNewCandidate = true;
437 }
438
439 // 9. Go back to step 5 if any tuple remains in candidate list
440 } while (numCandidates > 0);
441
niklase@google.com470e71d2011-07-07 08:21:25 +0000442 return numBoundingSet;
443}
444
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000445bool TMMBRHelp::IsOwner(const uint32_t ssrc,
446 const uint32_t length) const {
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000447 CriticalSectionScoped lock(_criticalSection);
niklase@google.com470e71d2011-07-07 08:21:25 +0000448
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000449 if (length == 0) {
450 // Empty bounding set.
henrike@webrtc.org0ad51862012-03-30 16:54:13 +0000451 return false;
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000452 }
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000453 for(uint32_t i = 0;
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000454 (i < length) && (i < _boundingSet.sizeOfSet()); ++i) {
455 if(_boundingSet.Ssrc(i) == ssrc) {
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000456 return true;
457 }
458 }
459 return false;
niklase@google.com470e71d2011-07-07 08:21:25 +0000460}
461
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000462bool TMMBRHelp::CalcMinBitRate( uint32_t* minBitrateKbit) const {
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000463 CriticalSectionScoped lock(_criticalSection);
niklase@google.com470e71d2011-07-07 08:21:25 +0000464
hta@webrtc.org54536bb2012-05-03 14:07:23 +0000465 if (_candidateSet.sizeOfSet() == 0) {
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000466 // Empty bounding set.
467 return false;
468 }
469 *minBitrateKbit = std::numeric_limits<uint32_t>::max();
470
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000471 for (uint32_t i = 0; i < _candidateSet.lengthOfSet(); ++i) {
472 uint32_t curNetBitRateKbit = _candidateSet.Tmmbr(i);
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000473 if (curNetBitRateKbit < MIN_VIDEO_BW_MANAGEMENT_BITRATE) {
474 curNetBitRateKbit = MIN_VIDEO_BW_MANAGEMENT_BITRATE;
niklase@google.com470e71d2011-07-07 08:21:25 +0000475 }
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +0000476 *minBitrateKbit = curNetBitRateKbit < *minBitrateKbit ?
477 curNetBitRateKbit : *minBitrateKbit;
478 }
479 return true;
niklase@google.com470e71d2011-07-07 08:21:25 +0000480}
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +0000481} // namespace webrtc