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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 1236 TMMBRHelp tmmbr_help; |
1237 int32_t numBoundingSet = 0; | |
1238 uint32_t bitrate = 0; | 1237 uint32_t bitrate = 0; |
1239 uint32_t accNumCandidates = 0; | 1238 uint32_t accNumCandidates = 0; |
1240 | 1239 |
1241 int32_t size = TMMBRReceived(0, 0, NULL); | 1240 int32_t size = TMMBRReceived(0, 0, NULL); |
1242 if (size > 0) { | 1241 if (size > 0) { |
1243 TMMBRSet* candidateSet = tmmbr_help.VerifyAndAllocateCandidateSet(size); | 1242 TMMBRSet* candidateSet = tmmbr_help.VerifyAndAllocateCandidateSet(size); |
1244 // Get candidate set from receiver. | 1243 // Get candidate set from receiver. |
1245 accNumCandidates = TMMBRReceived(size, accNumCandidates, candidateSet); | 1244 accNumCandidates = TMMBRReceived(size, accNumCandidates, candidateSet); |
1246 } | 1245 } |
1247 // Find bounding set | 1246 // Find bounding set |
1248 TMMBRSet* boundingSet = NULL; | 1247 std::vector<rtcp::TmmbItem> bounding = tmmbr_help.FindTMMBRBoundingSet(); |
1249 numBoundingSet = tmmbr_help.FindTMMBRBoundingSet(boundingSet); | |
1250 if (numBoundingSet == -1) { | |
1251 LOG(LS_WARNING) << "Failed to find TMMBR bounding set."; | |
1252 return -1; | |
1253 } | |
1254 // Set bounding set | 1248 // Set bounding set |
1255 // Inform remote clients about the new bandwidth | 1249 // Inform remote clients about the new bandwidth |
1256 // inform the remote client | 1250 // inform the remote client |
1257 _rtpRtcp.SetTMMBN(boundingSet); | 1251 _rtpRtcp.SetTMMBN(&bounding); |
1258 | 1252 |
1259 // might trigger a TMMBN | 1253 // might trigger a TMMBN |
1260 if (numBoundingSet == 0) { | 1254 if (bounding.empty()) { |
1261 // owner of max bitrate request has timed out | 1255 // owner of max bitrate request has timed out |
1262 // empty bounding set has been sent | 1256 // empty bounding set has been sent |
1263 return 0; | 1257 return 0; |
1264 } | 1258 } |
1265 // Get net bitrate from bounding set depending on sent packet rate | 1259 // Get net bitrate from bounding set depending on sent packet rate |
1266 if (tmmbr_help.CalcMinBitRate(&bitrate)) { | 1260 if (tmmbr_help.CalcMinBitRate(&bitrate)) { |
1267 // we have a new bandwidth estimate on this channel | 1261 // we have a new bandwidth estimate on this channel |
1268 if (_cbRtcpBandwidthObserver) { | 1262 if (_cbRtcpBandwidthObserver) { |
1269 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate * 1000); | 1263 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate * 1000); |
1270 } | 1264 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 return -1; | 1434 return -1; |
1441 } | 1435 } |
1442 num += receiveInfo->TmmbrSet.lengthOfSet(); | 1436 num += receiveInfo->TmmbrSet.lengthOfSet(); |
1443 receiveInfoIt++; | 1437 receiveInfoIt++; |
1444 } | 1438 } |
1445 } | 1439 } |
1446 return num; | 1440 return num; |
1447 } | 1441 } |
1448 | 1442 |
1449 } // namespace webrtc | 1443 } // namespace webrtc |
OLD | NEW |