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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 return; | 152 return; |
153 } | 153 } |
154 } | 154 } |
155 VerifyAndAllocateTMMBRSet(TmmbrSet.lengthOfSet() + 1); | 155 VerifyAndAllocateTMMBRSet(TmmbrSet.lengthOfSet() + 1); |
156 TmmbrSet.AddEntry(TMMBRItem.MaxTotalMediaBitRate, | 156 TmmbrSet.AddEntry(TMMBRItem.MaxTotalMediaBitRate, |
157 TMMBRItem.MeasuredOverhead, | 157 TMMBRItem.MeasuredOverhead, |
158 senderSSRC); | 158 senderSSRC); |
159 _tmmbrSetTimeouts.push_back(currentTimeMS); | 159 _tmmbrSetTimeouts.push_back(currentTimeMS); |
160 } | 160 } |
161 | 161 |
162 int32_t RTCPReceiveInformation::GetTMMBRSet( | 162 void RTCPReceiveInformation::GetTMMBRSet( |
163 const uint32_t sourceIdx, | 163 int64_t current_time_ms, |
164 const uint32_t targetIdx, | 164 std::vector<rtcp::TmmbItem>* candidates) { |
165 TMMBRSet* candidateSet, | 165 // Erase timeout entries. |
166 const int64_t currentTimeMS) { | 166 for (size_t source_idx = 0; source_idx < TmmbrSet.size();) { |
167 if (sourceIdx >= TmmbrSet.lengthOfSet()) { | 167 // Use audio define since we don't know what interval the remote peer is |
168 return -1; | 168 // using. |
169 if (current_time_ms - _tmmbrSetTimeouts[source_idx] > | |
philipel
2016/08/16 15:12:16
Is there a reason the timeout is stored in a separ
danilchap
2016/08/16 15:35:15
TmmbItem match network structure and doesn't have
philipel
2016/08/16 15:40:06
Do it in a follow-up.
| |
170 5 * RTCP_INTERVAL_AUDIO_MS) { | |
171 // Value timed out. | |
172 TmmbrSet.erase(TmmbrSet.begin() + source_idx); | |
philipel
2016/08/16 15:12:16
Maybe save the indexes of the elements you want to
danilchap
2016/08/16 15:35:15
Not sure separating extracting and cleaning the ar
philipel
2016/08/16 15:40:06
Acknowledged.
| |
173 _tmmbrSetTimeouts.erase(_tmmbrSetTimeouts.begin() + source_idx); | |
174 continue; | |
175 } | |
176 candidates->push_back(TmmbrSet[source_idx]); | |
177 ++source_idx; | |
169 } | 178 } |
170 if (targetIdx >= candidateSet->sizeOfSet()) { | |
171 return -1; | |
172 } | |
173 // use audio define since we don't know what interval the remote peer is using | |
174 if (currentTimeMS - _tmmbrSetTimeouts[sourceIdx] > | |
175 5 * RTCP_INTERVAL_AUDIO_MS) { | |
176 // value timed out | |
177 TmmbrSet.RemoveEntry(sourceIdx); | |
178 _tmmbrSetTimeouts.erase(_tmmbrSetTimeouts.begin() + sourceIdx); | |
179 return -1; | |
180 } | |
181 candidateSet->SetEntry(targetIdx, | |
182 TmmbrSet.Tmmbr(sourceIdx), | |
183 TmmbrSet.PacketOH(sourceIdx), | |
184 TmmbrSet.Ssrc(sourceIdx)); | |
185 return 0; | |
186 } | 179 } |
187 | 180 |
188 void RTCPReceiveInformation::VerifyAndAllocateBoundingSet( | 181 void RTCPReceiveInformation::VerifyAndAllocateBoundingSet( |
189 const uint32_t minimumSize) { | 182 const uint32_t minimumSize) { |
190 TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize); | 183 TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize); |
191 } | 184 } |
192 } // namespace RTCPHelp | 185 } // namespace RTCPHelp |
193 } // namespace webrtc | 186 } // namespace webrtc |
OLD | NEW |