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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc

Issue 1474693002: [Splitting] TMMBRHelp class simplifted (and disappear because become too simple) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc
index bfcc1bdfde02d4b822d367f4f3404d335f761d05..ded9b02bac9d4e21cfd9f31e32d8a3f149ed2d07 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc
@@ -129,8 +129,8 @@ RTCPReceiveInformation::~RTCPReceiveInformation() {
// the _tmmbrSetTimeouts vector.
void RTCPReceiveInformation::VerifyAndAllocateTMMBRSet(
const uint32_t minimumSize) {
- if (minimumSize > TmmbrSet.sizeOfSet()) {
- TmmbrSet.VerifyAndAllocateSetKeepingData(minimumSize);
+ if (minimumSize > TmmbrSet.capacity()) {
+ TmmbrSet.reserve(minimumSize);
// make sure that our buffers are big enough
_tmmbrSetTimeouts.reserve(minimumSize);
}
@@ -141,53 +141,43 @@ void RTCPReceiveInformation::InsertTMMBRItem(
const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem,
const int64_t currentTimeMS) {
// serach to see if we have it in our list
- for (uint32_t i = 0; i < TmmbrSet.lengthOfSet(); i++) {
- if (TmmbrSet.Ssrc(i) == senderSSRC) {
+ for (uint32_t i = 0; i < TmmbrSet.size(); i++) {
+ if (TmmbrSet[i].ssrc() == senderSSRC) {
// we already have this SSRC in our list update it
- TmmbrSet.SetEntry(i,
- TMMBRItem.MaxTotalMediaBitRate,
- TMMBRItem.MeasuredOverhead,
- senderSSRC);
+ TmmbrSet[i].set_bitrate_bps(1000 * TMMBRItem.MaxTotalMediaBitRate);
+ TmmbrSet[i].set_packet_overhead(TMMBRItem.MeasuredOverhead);
_tmmbrSetTimeouts[i] = currentTimeMS;
return;
}
}
- VerifyAndAllocateTMMBRSet(TmmbrSet.lengthOfSet() + 1);
- TmmbrSet.AddEntry(TMMBRItem.MaxTotalMediaBitRate,
- TMMBRItem.MeasuredOverhead,
- senderSSRC);
+ VerifyAndAllocateTMMBRSet(TmmbrSet.capacity() + 1);
+ TmmbrSet.push_back(rtcp::TmmbItem(senderSSRC,
+ TMMBRItem.MaxTotalMediaBitRate * 1000,
+ TMMBRItem.MeasuredOverhead));
_tmmbrSetTimeouts.push_back(currentTimeMS);
}
-int32_t RTCPReceiveInformation::GetTMMBRSet(
- const uint32_t sourceIdx,
- const uint32_t targetIdx,
- TMMBRSet* candidateSet,
- const int64_t currentTimeMS) {
- if (sourceIdx >= TmmbrSet.lengthOfSet()) {
- return -1;
- }
- if (targetIdx >= candidateSet->sizeOfSet()) {
- return -1;
- }
- // use audio define since we don't know what interval the remote peer is using
- if (currentTimeMS - _tmmbrSetTimeouts[sourceIdx] >
- 5 * RTCP_INTERVAL_AUDIO_MS) {
- // value timed out
- TmmbrSet.RemoveEntry(sourceIdx);
- _tmmbrSetTimeouts.erase(_tmmbrSetTimeouts.begin() + sourceIdx);
- return -1;
+void RTCPReceiveInformation::GetTMMBRSet(
+ int64_t current_time_ms,
+ std::vector<rtcp::TmmbItem>* candidates) {
+ for (size_t i = 0; i < TmmbrSet.size();) {
+ // use audio define since we don't know what interval the remote peer is
+ // using
+ if (current_time_ms - _tmmbrSetTimeouts[i] > 5 * RTCP_INTERVAL_AUDIO_MS) {
+ // value timed out
+ TmmbrSet.erase(TmmbrSet.begin() + i);
+ _tmmbrSetTimeouts.erase(_tmmbrSetTimeouts.begin() + i);
+ } else {
+ candidates->push_back(TmmbrSet[i]);
+ ++i;
+ }
}
- candidateSet->SetEntry(targetIdx,
- TmmbrSet.Tmmbr(sourceIdx),
- TmmbrSet.PacketOH(sourceIdx),
- TmmbrSet.Ssrc(sourceIdx));
- return 0;
}
void RTCPReceiveInformation::VerifyAndAllocateBoundingSet(
const uint32_t minimumSize) {
- TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize);
+ TmmbnBoundingSet.clear();
+ TmmbnBoundingSet.reserve(minimumSize);
}
} // namespace RTCPHelp
} // namespace webrtc
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698