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

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

Issue 2234783002: Cleaned out candidateSet member from TMMBRHelp class (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Simplify CalcMinBitrateBps moving out lower limit into RtcpReceiver 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
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <string.h> 14 #include <string.h>
15 15
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 #include "webrtc/base/logging.h" 17 #include "webrtc/base/logging.h"
18 #include "webrtc/base/trace_event.h" 18 #include "webrtc/base/trace_event.h"
19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
22 #include "webrtc/modules/rtp_rtcp/source/time_util.h" 23 #include "webrtc/modules/rtp_rtcp/source/time_util.h"
23 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" 24 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h"
24 #include "webrtc/system_wrappers/include/ntp_time.h" 25 #include "webrtc/system_wrappers/include/ntp_time.h"
25 26
26 namespace webrtc { 27 namespace webrtc {
27 using RTCPHelp::RTCPPacketInformation; 28 using RTCPHelp::RTCPPacketInformation;
28 using RTCPHelp::RTCPReceiveInformation; 29 using RTCPHelp::RTCPReceiveInformation;
29 using RTCPHelp::RTCPReportBlockInformation; 30 using RTCPHelp::RTCPReportBlockInformation;
30 using RTCPUtility::kBtVoipMetric; 31 using RTCPUtility::kBtVoipMetric;
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 RTCPHelp::RTCPPacketInformation* rtcp_packet_information) { 1227 RTCPHelp::RTCPPacketInformation* rtcp_packet_information) {
1227 rtcp::RtcpPacket* packet = rtcp_parser->ReleaseRtcpPacket(); 1228 rtcp::RtcpPacket* packet = rtcp_parser->ReleaseRtcpPacket();
1228 RTC_DCHECK(packet != nullptr); 1229 RTC_DCHECK(packet != nullptr);
1229 rtcp_packet_information->rtcpPacketTypeFlags |= kRtcpTransportFeedback; 1230 rtcp_packet_information->rtcpPacketTypeFlags |= kRtcpTransportFeedback;
1230 rtcp_packet_information->transport_feedback_.reset( 1231 rtcp_packet_information->transport_feedback_.reset(
1231 static_cast<rtcp::TransportFeedback*>(packet)); 1232 static_cast<rtcp::TransportFeedback*>(packet));
1232 1233
1233 rtcp_parser->Iterate(); 1234 rtcp_parser->Iterate();
1234 } 1235 }
1235 int32_t RTCPReceiver::UpdateTMMBR() { 1236 int32_t RTCPReceiver::UpdateTMMBR() {
1236 TMMBRHelp tmmbr_help;
1237 uint32_t bitrate = 0;
1238 uint32_t accNumCandidates = 0;
1239
1240 int32_t size = TMMBRReceived(0, 0, NULL); 1237 int32_t size = TMMBRReceived(0, 0, NULL);
1238 TMMBRSet candidates;
1241 if (size > 0) { 1239 if (size > 0) {
1242 TMMBRSet* candidateSet = tmmbr_help.VerifyAndAllocateCandidateSet(size); 1240 candidates.reserve(size);
1243 // Get candidate set from receiver. 1241 // Get candidate set from receiver.
1244 accNumCandidates = TMMBRReceived(size, accNumCandidates, candidateSet); 1242 TMMBRReceived(size, 0, &candidates);
1245 } 1243 }
1246 // Find bounding set 1244 // Find bounding set
1247 std::vector<rtcp::TmmbItem> bounding = tmmbr_help.FindTMMBRBoundingSet(); 1245 std::vector<rtcp::TmmbItem> bounding =
1246 TMMBRHelp::FindBoundingSet(std::move(candidates));
1248 // Set bounding set 1247 // Set bounding set
1249 // Inform remote clients about the new bandwidth 1248 // Inform remote clients about the new bandwidth
1250 // inform the remote client 1249 // inform the remote client
1251 _rtpRtcp.SetTMMBN(&bounding); 1250 _rtpRtcp.SetTMMBN(&bounding);
1252 1251
1253 // might trigger a TMMBN 1252 // might trigger a TMMBN
1254 if (bounding.empty()) { 1253 if (bounding.empty()) {
1255 // owner of max bitrate request has timed out 1254 // owner of max bitrate request has timed out
1256 // empty bounding set has been sent 1255 // empty bounding set has been sent
1257 return 0; 1256 return 0;
1258 } 1257 }
1259 // Get net bitrate from bounding set depending on sent packet rate 1258 // We have a new bandwidth estimate on this channel.
1260 if (tmmbr_help.CalcMinBitRate(&bitrate)) { 1259 if (_cbRtcpBandwidthObserver) {
1261 // we have a new bandwidth estimate on this channel 1260 constexpr uint64_t kMinVideoBwManagementBitrateBps =
1262 if (_cbRtcpBandwidthObserver) { 1261 MIN_VIDEO_BW_MANAGEMENT_BITRATE * 1000;
1263 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate * 1000); 1262 uint64_t bitrate_bps = std::max(TMMBRHelp::CalcMinBitrateBps(bounding),
1264 } 1263 kMinVideoBwManagementBitrateBps);
philipel 2016/08/11 11:57:12 Remove kMinVideoBwManagementBitrateBps and just us
danilchap 2016/08/11 13:08:36 On the 2nd thought I think it is better to remove
1264 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate_bps);
1265 } 1265 }
1266 return 0; 1266 return 0;
1267 } 1267 }
1268 1268
1269 void RTCPReceiver::RegisterRtcpStatisticsCallback( 1269 void RTCPReceiver::RegisterRtcpStatisticsCallback(
1270 RtcpStatisticsCallback* callback) { 1270 RtcpStatisticsCallback* callback) {
1271 rtc::CritScope cs(&_criticalSectionFeedbacks); 1271 rtc::CritScope cs(&_criticalSectionFeedbacks);
1272 stats_callback_ = callback; 1272 stats_callback_ = callback;
1273 } 1273 }
1274 1274
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 return -1; 1434 return -1;
1435 } 1435 }
1436 num += receiveInfo->TmmbrSet.lengthOfSet(); 1436 num += receiveInfo->TmmbrSet.lengthOfSet();
1437 receiveInfoIt++; 1437 receiveInfoIt++;
1438 } 1438 }
1439 } 1439 }
1440 return num; 1440 return num;
1441 } 1441 }
1442 1442
1443 } // namespace webrtc 1443 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_sender.cc » ('j') | webrtc/modules/rtp_rtcp/source/tmmbr_help.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698