| 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 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 _boundingSet.VerifyAndAllocateSet(minimumSize); | 135 _boundingSet.VerifyAndAllocateSet(minimumSize); |
| 136 return &_boundingSet; | 136 return &_boundingSet; |
| 137 } | 137 } |
| 138 | 138 |
| 139 TMMBRSet* TMMBRHelp::BoundingSet() { | 139 TMMBRSet* TMMBRHelp::BoundingSet() { |
| 140 return &_boundingSet; | 140 return &_boundingSet; |
| 141 } | 141 } |
| 142 | 142 |
| 143 int32_t | 143 int32_t |
| 144 TMMBRHelp::SetTMMBRBoundingSetToSend(const TMMBRSet* boundingSetToSend, | 144 TMMBRHelp::SetTMMBRBoundingSetToSend(const TMMBRSet* boundingSetToSend) |
| 145 const uint32_t maxBitrateKbit) | |
| 146 { | 145 { |
| 147 CriticalSectionScoped lock(_criticalSection); | 146 CriticalSectionScoped lock(_criticalSection); |
| 148 | 147 |
| 149 if (boundingSetToSend == NULL) | 148 if (boundingSetToSend == NULL) |
| 150 { | 149 { |
| 151 _boundingSetToSend.clearSet(); | 150 _boundingSetToSend.clearSet(); |
| 152 return 0; | 151 return 0; |
| 153 } | 152 } |
| 154 | 153 |
| 155 VerifyAndAllocateBoundingSetToSend(boundingSetToSend->lengthOfSet()); | 154 VerifyAndAllocateBoundingSetToSend(boundingSetToSend->lengthOfSet()); |
| 156 _boundingSetToSend.clearSet(); | 155 _boundingSetToSend.clearSet(); |
| 157 for (uint32_t i = 0; i < boundingSetToSend->lengthOfSet(); i++) | 156 for (uint32_t i = 0; i < boundingSetToSend->lengthOfSet(); i++) |
| 158 { | 157 { |
| 159 // cap at our configured max bitrate | 158 // cap at our configured max bitrate |
| 160 uint32_t bitrate = boundingSetToSend->Tmmbr(i); | 159 uint32_t bitrate = boundingSetToSend->Tmmbr(i); |
| 161 if(maxBitrateKbit) | |
| 162 { | |
| 163 // do we have a configured max bitrate? | |
| 164 if(bitrate > maxBitrateKbit) | |
| 165 { | |
| 166 bitrate = maxBitrateKbit; | |
| 167 } | |
| 168 } | |
| 169 _boundingSetToSend.SetEntry(i, bitrate, | 160 _boundingSetToSend.SetEntry(i, bitrate, |
| 170 boundingSetToSend->PacketOH(i), | 161 boundingSetToSend->PacketOH(i), |
| 171 boundingSetToSend->Ssrc(i)); | 162 boundingSetToSend->Ssrc(i)); |
| 172 } | 163 } |
| 173 return 0; | 164 return 0; |
| 174 } | 165 } |
| 175 | 166 |
| 176 int32_t | 167 int32_t |
| 177 TMMBRHelp::VerifyAndAllocateBoundingSetToSend(uint32_t minimumSize) | 168 TMMBRHelp::VerifyAndAllocateBoundingSetToSend(uint32_t minimumSize) |
| 178 { | 169 { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 uint32_t curNetBitRateKbit = _candidateSet.Tmmbr(i); | 463 uint32_t curNetBitRateKbit = _candidateSet.Tmmbr(i); |
| 473 if (curNetBitRateKbit < MIN_VIDEO_BW_MANAGEMENT_BITRATE) { | 464 if (curNetBitRateKbit < MIN_VIDEO_BW_MANAGEMENT_BITRATE) { |
| 474 curNetBitRateKbit = MIN_VIDEO_BW_MANAGEMENT_BITRATE; | 465 curNetBitRateKbit = MIN_VIDEO_BW_MANAGEMENT_BITRATE; |
| 475 } | 466 } |
| 476 *minBitrateKbit = curNetBitRateKbit < *minBitrateKbit ? | 467 *minBitrateKbit = curNetBitRateKbit < *minBitrateKbit ? |
| 477 curNetBitRateKbit : *minBitrateKbit; | 468 curNetBitRateKbit : *minBitrateKbit; |
| 478 } | 469 } |
| 479 return true; | 470 return true; |
| 480 } | 471 } |
| 481 } // namespace webrtc | 472 } // namespace webrtc |
| OLD | NEW |