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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1226 RTCPHelp::RTCPPacketInformation* rtcp_packet_information) { | 1226 RTCPHelp::RTCPPacketInformation* rtcp_packet_information) { |
1227 rtcp::RtcpPacket* packet = rtcp_parser->ReleaseRtcpPacket(); | 1227 rtcp::RtcpPacket* packet = rtcp_parser->ReleaseRtcpPacket(); |
1228 RTC_DCHECK(packet != nullptr); | 1228 RTC_DCHECK(packet != nullptr); |
1229 rtcp_packet_information->rtcpPacketTypeFlags |= kRtcpTransportFeedback; | 1229 rtcp_packet_information->rtcpPacketTypeFlags |= kRtcpTransportFeedback; |
1230 rtcp_packet_information->transport_feedback_.reset( | 1230 rtcp_packet_information->transport_feedback_.reset( |
1231 static_cast<rtcp::TransportFeedback*>(packet)); | 1231 static_cast<rtcp::TransportFeedback*>(packet)); |
1232 | 1232 |
1233 rtcp_parser->Iterate(); | 1233 rtcp_parser->Iterate(); |
1234 } | 1234 } |
1235 int32_t RTCPReceiver::UpdateTMMBR() { | 1235 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); | 1236 int32_t size = TMMBRReceived(0, 0, NULL); |
1237 TMMBRSet candidates; | |
1241 if (size > 0) { | 1238 if (size > 0) { |
1242 TMMBRSet* candidateSet = tmmbr_help.VerifyAndAllocateCandidateSet(size); | 1239 candidates.reserve(size); |
1243 // Get candidate set from receiver. | 1240 // Get candidate set from receiver. |
1244 accNumCandidates = TMMBRReceived(size, accNumCandidates, candidateSet); | 1241 TMMBRReceived(size, 0, &candidates); |
1245 } | 1242 } |
1246 // Find bounding set | 1243 // Find bounding set |
1247 std::vector<rtcp::TmmbItem> bounding = tmmbr_help.FindTMMBRBoundingSet(); | 1244 std::vector<rtcp::TmmbItem> bounding = |
1245 TMMBRHelp::FindBoundingSet(std::move(candidates)); | |
1248 // Set bounding set | 1246 // Set bounding set |
1249 // Inform remote clients about the new bandwidth | 1247 // Inform remote clients about the new bandwidth |
1250 // inform the remote client | 1248 // inform the remote client |
1251 _rtpRtcp.SetTMMBN(&bounding); | 1249 _rtpRtcp.SetTMMBN(&bounding); |
1252 | 1250 |
1253 // might trigger a TMMBN | 1251 // might trigger a TMMBN |
1254 if (bounding.empty()) { | 1252 if (bounding.empty()) { |
1255 // owner of max bitrate request has timed out | 1253 // owner of max bitrate request has timed out |
1256 // empty bounding set has been sent | 1254 // empty bounding set has been sent |
1257 return 0; | 1255 return 0; |
1258 } | 1256 } |
1259 // Get net bitrate from bounding set depending on sent packet rate | 1257 // We have a new bandwidth estimate on this channel. |
danilchap
2016/08/10 11:18:48
comment say bounding set is used, but code used ca
| |
1260 if (tmmbr_help.CalcMinBitRate(&bitrate)) { | 1258 if (_cbRtcpBandwidthObserver) { |
1261 // we have a new bandwidth estimate on this channel | 1259 uint64_t bitrate_bps = TMMBRHelp::CalcMinBitrateBps(bounding); |
1262 if (_cbRtcpBandwidthObserver) { | 1260 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate_bps); |
1263 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate * 1000); | |
1264 } | |
1265 } | 1261 } |
1266 return 0; | 1262 return 0; |
1267 } | 1263 } |
1268 | 1264 |
1269 void RTCPReceiver::RegisterRtcpStatisticsCallback( | 1265 void RTCPReceiver::RegisterRtcpStatisticsCallback( |
1270 RtcpStatisticsCallback* callback) { | 1266 RtcpStatisticsCallback* callback) { |
1271 rtc::CritScope cs(&_criticalSectionFeedbacks); | 1267 rtc::CritScope cs(&_criticalSectionFeedbacks); |
1272 stats_callback_ = callback; | 1268 stats_callback_ = callback; |
1273 } | 1269 } |
1274 | 1270 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1434 return -1; | 1430 return -1; |
1435 } | 1431 } |
1436 num += receiveInfo->TmmbrSet.lengthOfSet(); | 1432 num += receiveInfo->TmmbrSet.lengthOfSet(); |
1437 receiveInfoIt++; | 1433 receiveInfoIt++; |
1438 } | 1434 } |
1439 } | 1435 } |
1440 return num; | 1436 return num; |
1441 } | 1437 } |
1442 | 1438 |
1443 } // namespace webrtc | 1439 } // namespace webrtc |
OLD | NEW |