Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 avgRTT(0), | 108 avgRTT(0), |
| 109 numAverageCalcs(0) | 109 numAverageCalcs(0) |
| 110 { | 110 { |
| 111 memset(&remoteReceiveBlock,0,sizeof(remoteReceiveBlock)); | 111 memset(&remoteReceiveBlock,0,sizeof(remoteReceiveBlock)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 RTCPReportBlockInformation::~RTCPReportBlockInformation() | 114 RTCPReportBlockInformation::~RTCPReportBlockInformation() |
| 115 { | 115 { |
| 116 } | 116 } |
| 117 | 117 |
| 118 RTCPReceiveInformation::RTCPReceiveInformation() | 118 RTCPReceiveInformation::RTCPReceiveInformation() = default; |
| 119 : lastTimeReceived(0), | 119 RTCPReceiveInformation::~RTCPReceiveInformation() = default; |
|
philipel
2016/08/17 13:53:06
Any particular reason for not using a ctor to init
danilchap
2016/08/17 14:56:05
I find member initialization cleaner: harder to mi
philipel
2016/08/17 15:30:06
In that case remove the default ctor/dtor.
danilchap
2016/08/17 16:15:33
Ack
They are default, but complex. This kind of c
| |
| 120 lastFIRSequenceNumber(-1), | 120 |
| 121 lastFIRRequest(0), | 121 void RTCPReceiveInformation::InsertTmmbrItem(uint32_t sender_ssrc, |
| 122 readyForDelete(false) { | 122 const rtcp::TmmbItem& tmmbr_item, |
| 123 int64_t current_time_ms) { | |
| 124 // Serach to see if we have it in our list. | |
| 125 for (auto& entry : tmmbr_) { | |
|
philipel
2016/08/17 13:53:06
How large do we expect |tmmbr_| to be? Should we m
danilchap
2016/08/17 14:56:05
Not large. One per one per participant that active
philipel
2016/08/17 15:30:06
Acknowledged.
| |
| 126 if (entry.tmmbr_item.ssrc() == sender_ssrc) { | |
| 127 // We already have this SSRC in our list. Update it. | |
| 128 entry.tmmbr_item.set_bitrate_bps(tmmbr_item.bitrate_bps()); | |
| 129 entry.tmmbr_item.set_packet_overhead(tmmbr_item.packet_overhead()); | |
| 130 entry.last_updated_ms = current_time_ms; | |
| 131 return; | |
| 132 } | |
| 133 } | |
| 134 TimedTmmbrItem entry = { | |
| 135 {sender_ssrc, tmmbr_item.bitrate_bps(), tmmbr_item.packet_overhead()}, | |
|
philipel
2016/08/17 13:53:06
Implement TimedTmmbrItem(int64_t last, TmmbItem it
danilchap
2016/08/17 14:56:05
Why?
Those strait-forward constructors were helpfu
philipel
2016/08/17 15:30:06
If someone change TimedTmmbrItem or the TmmbrItem
danilchap
2016/08/17 16:15:33
I guess you right. But this constructor doesn't lo
| |
| 136 current_time_ms}; | |
| 137 tmmbr_.push_back(entry); | |
| 123 } | 138 } |
| 124 | 139 |
| 125 RTCPReceiveInformation::~RTCPReceiveInformation() { | 140 void RTCPReceiveInformation::GetTmmbrSet( |
| 126 } | 141 int64_t current_time_ms, |
| 127 | 142 std::vector<rtcp::TmmbItem>* candidates) { |
| 128 // Increase size of TMMBRSet if needed, and also take care of | 143 // Use audio define since we don't know what interval the remote peer use. |
| 129 // the _tmmbrSetTimeouts vector. | 144 int64_t timeouted_ms = current_time_ms - 5 * RTCP_INTERVAL_AUDIO_MS; |
| 130 void RTCPReceiveInformation::VerifyAndAllocateTMMBRSet( | 145 for (auto it = tmmbr_.begin(); it != tmmbr_.end();) { |
| 131 const uint32_t minimumSize) { | 146 if (it->last_updated_ms < timeouted_ms) { |
| 132 if (minimumSize > TmmbrSet.sizeOfSet()) { | 147 // Erase timeout entries. |
| 133 TmmbrSet.VerifyAndAllocateSetKeepingData(minimumSize); | 148 it = tmmbr_.erase(it); |
| 134 // make sure that our buffers are big enough | 149 } else { |
| 135 _tmmbrSetTimeouts.reserve(minimumSize); | 150 candidates->push_back(it->tmmbr_item); |
| 151 ++it; | |
| 152 } | |
| 136 } | 153 } |
| 137 } | 154 } |
| 138 | 155 |
| 139 void RTCPReceiveInformation::InsertTMMBRItem( | 156 void RTCPReceiveInformation::ClearTmmbr() { |
| 140 const uint32_t senderSSRC, | 157 tmmbr_.clear(); |
| 141 const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem, | |
| 142 const int64_t currentTimeMS) { | |
| 143 // serach to see if we have it in our list | |
| 144 for (uint32_t i = 0; i < TmmbrSet.lengthOfSet(); i++) { | |
| 145 if (TmmbrSet.Ssrc(i) == senderSSRC) { | |
| 146 // we already have this SSRC in our list update it | |
| 147 TmmbrSet.SetEntry(i, | |
| 148 TMMBRItem.MaxTotalMediaBitRate, | |
| 149 TMMBRItem.MeasuredOverhead, | |
| 150 senderSSRC); | |
| 151 _tmmbrSetTimeouts[i] = currentTimeMS; | |
| 152 return; | |
| 153 } | |
| 154 } | |
| 155 VerifyAndAllocateTMMBRSet(TmmbrSet.lengthOfSet() + 1); | |
| 156 TmmbrSet.AddEntry(TMMBRItem.MaxTotalMediaBitRate, | |
| 157 TMMBRItem.MeasuredOverhead, | |
| 158 senderSSRC); | |
| 159 _tmmbrSetTimeouts.push_back(currentTimeMS); | |
| 160 } | 158 } |
| 161 | 159 |
| 162 void RTCPReceiveInformation::GetTMMBRSet( | |
| 163 int64_t current_time_ms, | |
| 164 std::vector<rtcp::TmmbItem>* candidates) { | |
| 165 // Erase timeout entries. | |
| 166 for (size_t source_idx = 0; source_idx < TmmbrSet.size();) { | |
| 167 // Use audio define since we don't know what interval the remote peer is | |
| 168 // using. | |
| 169 if (current_time_ms - _tmmbrSetTimeouts[source_idx] > | |
| 170 5 * RTCP_INTERVAL_AUDIO_MS) { | |
| 171 // Value timed out. | |
| 172 TmmbrSet.erase(TmmbrSet.begin() + source_idx); | |
| 173 _tmmbrSetTimeouts.erase(_tmmbrSetTimeouts.begin() + source_idx); | |
| 174 continue; | |
| 175 } | |
| 176 candidates->push_back(TmmbrSet[source_idx]); | |
| 177 ++source_idx; | |
| 178 } | |
| 179 } | |
| 180 | |
| 181 void RTCPReceiveInformation::VerifyAndAllocateBoundingSet( | |
| 182 const uint32_t minimumSize) { | |
| 183 TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize); | |
| 184 } | |
| 185 } // namespace RTCPHelp | 160 } // namespace RTCPHelp |
| 186 } // namespace webrtc | 161 } // namespace webrtc |
| OLD | NEW |