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

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

Issue 1746773002: [rtp_rtcp] tmmbr helper simplified by moving set_to_send member out (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 void TMMBRSet::ClearEntry(uint32_t idx) { 65 void TMMBRSet::ClearEntry(uint32_t idx) {
66 SetEntry(idx, 0, 0, 0); 66 SetEntry(idx, 0, 0, 0);
67 } 67 }
68 68
69 TMMBRHelp::TMMBRHelp() 69 TMMBRHelp::TMMBRHelp()
70 : _criticalSection(CriticalSectionWrapper::CreateCriticalSection()), 70 : _criticalSection(CriticalSectionWrapper::CreateCriticalSection()),
71 _candidateSet(), 71 _candidateSet(),
72 _boundingSet(), 72 _boundingSet(),
73 _boundingSetToSend(),
74 _ptrIntersectionBoundingSet(NULL), 73 _ptrIntersectionBoundingSet(NULL),
75 _ptrMaxPRBoundingSet(NULL) { 74 _ptrMaxPRBoundingSet(NULL) {
76 } 75 }
77 76
78 TMMBRHelp::~TMMBRHelp() { 77 TMMBRHelp::~TMMBRHelp() {
79 delete [] _ptrIntersectionBoundingSet; 78 delete [] _ptrIntersectionBoundingSet;
80 delete [] _ptrMaxPRBoundingSet; 79 delete [] _ptrMaxPRBoundingSet;
81 _ptrIntersectionBoundingSet = 0; 80 _ptrIntersectionBoundingSet = 0;
82 _ptrMaxPRBoundingSet = 0; 81 _ptrMaxPRBoundingSet = 0;
83 delete _criticalSection; 82 delete _criticalSection;
(...skipping 16 matching lines...) Expand all
100 _ptrMaxPRBoundingSet = new float[minimumSize]; 99 _ptrMaxPRBoundingSet = new float[minimumSize];
101 } 100 }
102 _boundingSet.VerifyAndAllocateSet(minimumSize); 101 _boundingSet.VerifyAndAllocateSet(minimumSize);
103 return &_boundingSet; 102 return &_boundingSet;
104 } 103 }
105 104
106 TMMBRSet* TMMBRHelp::BoundingSet() { 105 TMMBRSet* TMMBRHelp::BoundingSet() {
107 return &_boundingSet; 106 return &_boundingSet;
108 } 107 }
109 108
110 int32_t
111 TMMBRHelp::SetTMMBRBoundingSetToSend(const TMMBRSet* boundingSetToSend)
112 {
113 CriticalSectionScoped lock(_criticalSection);
114
115 if (boundingSetToSend == NULL)
116 {
117 _boundingSetToSend.clearSet();
118 return 0;
119 }
120
121 VerifyAndAllocateBoundingSetToSend(boundingSetToSend->lengthOfSet());
122 _boundingSetToSend.clearSet();
123 for (uint32_t i = 0; i < boundingSetToSend->lengthOfSet(); i++)
124 {
125 // cap at our configured max bitrate
126 uint32_t bitrate = boundingSetToSend->Tmmbr(i);
127 _boundingSetToSend.SetEntry(i, bitrate,
128 boundingSetToSend->PacketOH(i),
129 boundingSetToSend->Ssrc(i));
130 }
131 return 0;
132 }
133
134 int32_t
135 TMMBRHelp::VerifyAndAllocateBoundingSetToSend(uint32_t minimumSize)
136 {
137 CriticalSectionScoped lock(_criticalSection);
138
139 _boundingSetToSend.VerifyAndAllocateSet(minimumSize);
140 return 0;
141 }
142
143 TMMBRSet* 109 TMMBRSet*
144 TMMBRHelp::VerifyAndAllocateCandidateSet(uint32_t minimumSize) 110 TMMBRHelp::VerifyAndAllocateCandidateSet(uint32_t minimumSize)
145 { 111 {
146 CriticalSectionScoped lock(_criticalSection); 112 CriticalSectionScoped lock(_criticalSection);
147 113
148 _candidateSet.VerifyAndAllocateSet(minimumSize); 114 _candidateSet.VerifyAndAllocateSet(minimumSize);
149 return &_candidateSet; 115 return &_candidateSet;
150 } 116 }
151 117
152 TMMBRSet* 118 TMMBRSet*
153 TMMBRHelp::CandidateSet() 119 TMMBRHelp::CandidateSet()
154 { 120 {
155 return &_candidateSet; 121 return &_candidateSet;
156 } 122 }
157 123
158 TMMBRSet*
159 TMMBRHelp::BoundingSetToSend()
160 {
161 return &_boundingSetToSend;
162 }
163
164 int32_t 124 int32_t
165 TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet) 125 TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet)
166 { 126 {
167 CriticalSectionScoped lock(_criticalSection); 127 CriticalSectionScoped lock(_criticalSection);
168 128
169 // Work on local variable, will be modified 129 // Work on local variable, will be modified
170 TMMBRSet candidateSet; 130 TMMBRSet candidateSet;
171 candidateSet.VerifyAndAllocateSet(_candidateSet.capacity()); 131 candidateSet.VerifyAndAllocateSet(_candidateSet.capacity());
172 132
173 for (uint32_t i = 0; i < _candidateSet.size(); i++) 133 for (uint32_t i = 0; i < _candidateSet.size(); i++)
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 uint32_t curNetBitRateKbit = _candidateSet.Tmmbr(i); 400 uint32_t curNetBitRateKbit = _candidateSet.Tmmbr(i);
441 if (curNetBitRateKbit < MIN_VIDEO_BW_MANAGEMENT_BITRATE) { 401 if (curNetBitRateKbit < MIN_VIDEO_BW_MANAGEMENT_BITRATE) {
442 curNetBitRateKbit = MIN_VIDEO_BW_MANAGEMENT_BITRATE; 402 curNetBitRateKbit = MIN_VIDEO_BW_MANAGEMENT_BITRATE;
443 } 403 }
444 *minBitrateKbit = curNetBitRateKbit < *minBitrateKbit ? 404 *minBitrateKbit = curNetBitRateKbit < *minBitrateKbit ?
445 curNetBitRateKbit : *minBitrateKbit; 405 curNetBitRateKbit : *minBitrateKbit;
446 } 406 }
447 return true; 407 return true;
448 } 408 }
449 } // namespace webrtc 409 } // namespace webrtc
OLDNEW
« webrtc/modules/rtp_rtcp/source/rtcp_sender.h ('K') | « webrtc/modules/rtp_rtcp/source/tmmbr_help.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698