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

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

Issue 2254703003: Remove TMMBRSet class (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Feedback Created 4 years, 4 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
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
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
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 TimedTmmbrItem* entry = &tmmbr_[sender_ssrc];
125 entry->tmmbr_item = rtcp::TmmbItem(sender_ssrc,
126 tmmbr_item.bitrate_bps(),
127 tmmbr_item.packet_overhead());
128 entry->last_updated_ms = current_time_ms;
123 } 129 }
124 130
125 RTCPReceiveInformation::~RTCPReceiveInformation() { 131 void RTCPReceiveInformation::GetTmmbrSet(
126 } 132 int64_t current_time_ms,
127 133 std::vector<rtcp::TmmbItem>* candidates) {
128 // Increase size of TMMBRSet if needed, and also take care of 134 // Use audio define since we don't know what interval the remote peer use.
129 // the _tmmbrSetTimeouts vector. 135 int64_t timeouted_ms = current_time_ms - 5 * RTCP_INTERVAL_AUDIO_MS;
130 void RTCPReceiveInformation::VerifyAndAllocateTMMBRSet( 136 for (auto it = tmmbr_.begin(); it != tmmbr_.end();) {
131 const uint32_t minimumSize) { 137 if (it->second.last_updated_ms < timeouted_ms) {
132 if (minimumSize > TmmbrSet.sizeOfSet()) { 138 // Erase timeout entries.
133 TmmbrSet.VerifyAndAllocateSetKeepingData(minimumSize); 139 it = tmmbr_.erase(it);
134 // make sure that our buffers are big enough 140 } else {
135 _tmmbrSetTimeouts.reserve(minimumSize); 141 candidates->push_back(it->second.tmmbr_item);
142 ++it;
143 }
136 } 144 }
137 } 145 }
138 146
139 void RTCPReceiveInformation::InsertTMMBRItem( 147 void RTCPReceiveInformation::ClearTmmbr() {
140 const uint32_t senderSSRC, 148 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 } 149 }
161 150
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 151 } // namespace RTCPHelp
186 } // namespace webrtc 152 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698