 Chromium Code Reviews
 Chromium Code Reviews Issue 2254703003:
  Remove TMMBRSet class  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master
    
  
    Issue 2254703003:
  Remove TMMBRSet class  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 int64_t RTCPReceiver::LastReceived() { | 100 int64_t RTCPReceiver::LastReceived() { | 
| 101 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 101 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 
| 102 return _lastReceived; | 102 return _lastReceived; | 
| 103 } | 103 } | 
| 104 | 104 | 
| 105 int64_t RTCPReceiver::LastReceivedReceiverReport() const { | 105 int64_t RTCPReceiver::LastReceivedReceiverReport() const { | 
| 106 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 106 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 
| 107 int64_t last_received_rr = -1; | 107 int64_t last_received_rr = -1; | 
| 108 for (ReceivedInfoMap::const_iterator it = _receivedInfoMap.begin(); | 108 for (ReceivedInfoMap::const_iterator it = _receivedInfoMap.begin(); | 
| 109 it != _receivedInfoMap.end(); ++it) { | 109 it != _receivedInfoMap.end(); ++it) { | 
| 110 if (it->second->lastTimeReceived > last_received_rr) { | 110 if (it->second->last_time_received_ms > last_received_rr) { | 
| 111 last_received_rr = it->second->lastTimeReceived; | 111 last_received_rr = it->second->last_time_received_ms; | 
| 112 } | 112 } | 
| 113 } | 113 } | 
| 114 return last_received_rr; | 114 return last_received_rr; | 
| 115 } | 115 } | 
| 116 | 116 | 
| 117 void RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) { | 117 void RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) { | 
| 118 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 118 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 
| 119 | 119 | 
| 120 // new SSRC reset old reports | 120 // new SSRC reset old reports | 
| 121 memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo)); | 121 memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo)); | 
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 << " RTCP blocks were skipped due to being malformed or of " | 375 << " RTCP blocks were skipped due to being malformed or of " | 
| 376 "unrecognized/unsupported type, during the past " | 376 "unrecognized/unsupported type, during the past " | 
| 377 << (kMaxWarningLogIntervalMs / 1000) << " second period."; | 377 << (kMaxWarningLogIntervalMs / 1000) << " second period."; | 
| 378 } | 378 } | 
| 379 | 379 | 
| 380 return 0; | 380 return 0; | 
| 381 } | 381 } | 
| 382 | 382 | 
| 383 void | 383 void | 
| 384 RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser, | 384 RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser, | 
| 385 RTCPPacketInformation& rtcpPacketInform ation) | 385 RTCPPacketInformation& rtcpPacketInform ation) | 
| 
philipel
2016/08/17 13:53:06
git cl format
 
danilchap
2016/08/17 14:56:05
that would require
git cl format --full
and would
 
philipel
2016/08/17 15:30:06
Acknowledged.
 | |
| 386 { | 386 { | 
| 387 RTCPUtility::RTCPPacketTypes rtcpPacketType = rtcpParser.PacketType(); | 387 RTCPUtility::RTCPPacketTypes rtcpPacketType = rtcpParser.PacketType(); | 
| 388 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); | 388 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); | 
| 389 | 389 | 
| 390 assert((rtcpPacketType == RTCPPacketTypes::kRr) || | 390 assert((rtcpPacketType == RTCPPacketTypes::kRr) || | 
| 391 (rtcpPacketType == RTCPPacketTypes::kSr)); | 391 (rtcpPacketType == RTCPPacketTypes::kSr)); | 
| 392 | 392 | 
| 393 // SR.SenderSSRC | 393 // SR.SenderSSRC | 
| 394 // The synchronization source identifier for the originator of this SR packe t | 394 // The synchronization source identifier for the originator of this SR packe t | 
| 395 | 395 | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 { | 438 { | 
| 439 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRr; | 439 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRr; | 
| 440 } | 440 } | 
| 441 } else | 441 } else | 
| 442 { | 442 { | 
| 443 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR", | 443 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR", | 
| 444 "remote_ssrc", remoteSSRC, "ssrc", main_ssrc_); | 444 "remote_ssrc", remoteSSRC, "ssrc", main_ssrc_); | 
| 445 | 445 | 
| 446 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRr; | 446 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRr; | 
| 447 } | 447 } | 
| 448 UpdateReceiveInformation(*ptrReceiveInfo); | 448 // Update that this remote is alive. | 
| 449 ptrReceiveInfo->last_time_received_ms = _clock->TimeInMilliseconds(); | |
| 449 | 450 | 
| 450 rtcpPacketType = rtcpParser.Iterate(); | 451 rtcpPacketType = rtcpParser.Iterate(); | 
| 451 | 452 | 
| 452 while (rtcpPacketType == RTCPPacketTypes::kReportBlockItem) { | 453 while (rtcpPacketType == RTCPPacketTypes::kReportBlockItem) { | 
| 453 HandleReportBlock(rtcpPacket, rtcpPacketInformation, remoteSSRC); | 454 HandleReportBlock(rtcpPacket, rtcpPacketInformation, remoteSSRC); | 
| 454 rtcpPacketType = rtcpParser.Iterate(); | 455 rtcpPacketType = rtcpParser.Iterate(); | 
| 455 } | 456 } | 
| 456 } | 457 } | 
| 457 | 458 | 
| 458 void RTCPReceiver::HandleReportBlock( | 459 void RTCPReceiver::HandleReportBlock( | 
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 633 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 
| 633 | 634 | 
| 634 std::map<uint32_t, RTCPReceiveInformation*>::iterator it = | 635 std::map<uint32_t, RTCPReceiveInformation*>::iterator it = | 
| 635 _receivedInfoMap.find(remoteSSRC); | 636 _receivedInfoMap.find(remoteSSRC); | 
| 636 if (it == _receivedInfoMap.end()) { | 637 if (it == _receivedInfoMap.end()) { | 
| 637 return NULL; | 638 return NULL; | 
| 638 } | 639 } | 
| 639 return it->second; | 640 return it->second; | 
| 640 } | 641 } | 
| 641 | 642 | 
| 642 void RTCPReceiver::UpdateReceiveInformation( | |
| 643 RTCPReceiveInformation& receiveInformation) { | |
| 644 // Update that this remote is alive | |
| 645 receiveInformation.lastTimeReceived = _clock->TimeInMilliseconds(); | |
| 646 } | |
| 647 | |
| 648 bool RTCPReceiver::RtcpRrTimeout(int64_t rtcp_interval_ms) { | 643 bool RTCPReceiver::RtcpRrTimeout(int64_t rtcp_interval_ms) { | 
| 649 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 644 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 
| 650 if (_lastReceivedRrMs == 0) | 645 if (_lastReceivedRrMs == 0) | 
| 651 return false; | 646 return false; | 
| 652 | 647 | 
| 653 int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms; | 648 int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms; | 
| 654 if (_clock->TimeInMilliseconds() > _lastReceivedRrMs + time_out_ms) { | 649 if (_clock->TimeInMilliseconds() > _lastReceivedRrMs + time_out_ms) { | 
| 655 // Reset the timer to only trigger one log. | 650 // Reset the timer to only trigger one log. | 
| 656 _lastReceivedRrMs = 0; | 651 _lastReceivedRrMs = 0; | 
| 657 return true; | 652 return true; | 
| (...skipping 26 matching lines...) Expand all Loading... | |
| 684 _receivedInfoMap.begin(); | 679 _receivedInfoMap.begin(); | 
| 685 | 680 | 
| 686 while (receiveInfoIt != _receivedInfoMap.end()) { | 681 while (receiveInfoIt != _receivedInfoMap.end()) { | 
| 687 RTCPReceiveInformation* receiveInfo = receiveInfoIt->second; | 682 RTCPReceiveInformation* receiveInfo = receiveInfoIt->second; | 
| 688 if (receiveInfo == NULL) { | 683 if (receiveInfo == NULL) { | 
| 689 return updateBoundingSet; | 684 return updateBoundingSet; | 
| 690 } | 685 } | 
| 691 // time since last received rtcp packet | 686 // time since last received rtcp packet | 
| 692 // when we dont have a lastTimeReceived and the object is marked | 687 // when we dont have a lastTimeReceived and the object is marked | 
| 693 // readyForDelete it's removed from the map | 688 // readyForDelete it's removed from the map | 
| 694 if (receiveInfo->lastTimeReceived) { | 689 if (receiveInfo->last_time_received_ms > 0) { | 
| 695 /// use audio define since we don't know what interval the remote peer is | 690 /// use audio define since we don't know what interval the remote peer is | 
| 696 // using | 691 // using | 
| 697 if ((timeNow - receiveInfo->lastTimeReceived) > | 692 if ((timeNow - receiveInfo->last_time_received_ms) > | 
| 698 5 * RTCP_INTERVAL_AUDIO_MS) { | 693 5 * RTCP_INTERVAL_AUDIO_MS) { | 
| 699 // no rtcp packet for the last five regular intervals, reset limitations | 694 // no rtcp packet for the last five regular intervals, reset limitations | 
| 700 receiveInfo->TmmbrSet.clearSet(); | 695 receiveInfo->ClearTmmbr(); | 
| 701 // prevent that we call this over and over again | 696 // prevent that we call this over and over again | 
| 702 receiveInfo->lastTimeReceived = 0; | 697 receiveInfo->last_time_received_ms = 0; | 
| 703 // send new TMMBN to all channels using the default codec | 698 // send new TMMBN to all channels using the default codec | 
| 704 updateBoundingSet = true; | 699 updateBoundingSet = true; | 
| 705 } | 700 } | 
| 706 receiveInfoIt++; | 701 receiveInfoIt++; | 
| 707 } else if (receiveInfo->readyForDelete) { | 702 } else if (receiveInfo->ready_for_delete) { | 
| 708 // store our current receiveInfoItem | 703 // store our current receiveInfoItem | 
| 709 std::map<uint32_t, RTCPReceiveInformation*>::iterator | 704 std::map<uint32_t, RTCPReceiveInformation*>::iterator | 
| 710 receiveInfoItemToBeErased = receiveInfoIt; | 705 receiveInfoItemToBeErased = receiveInfoIt; | 
| 711 receiveInfoIt++; | 706 receiveInfoIt++; | 
| 712 delete receiveInfoItemToBeErased->second; | 707 delete receiveInfoItemToBeErased->second; | 
| 713 _receivedInfoMap.erase(receiveInfoItemToBeErased); | 708 _receivedInfoMap.erase(receiveInfoItemToBeErased); | 
| 714 } else { | 709 } else { | 
| 715 receiveInfoIt++; | 710 receiveInfoIt++; | 
| 716 } | 711 } | 
| 717 } | 712 } | 
| 718 return updateBoundingSet; | 713 return updateBoundingSet; | 
| 719 } | 714 } | 
| 720 | 715 | 
| 721 int32_t RTCPReceiver::BoundingSet(bool* tmmbrOwner, TMMBRSet* boundingSetRec) { | 716 std::vector<rtcp::TmmbItem> RTCPReceiver::BoundingSet(bool* tmmbr_owner) { | 
| 722 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 717 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 
| 723 | 718 | 
| 724 std::map<uint32_t, RTCPReceiveInformation*>::iterator receiveInfoIt = | 719 std::map<uint32_t, RTCPReceiveInformation*>::iterator receiveInfoIt = | 
| 725 _receivedInfoMap.find(_remoteSSRC); | 720 _receivedInfoMap.find(_remoteSSRC); | 
| 726 | 721 | 
| 727 if (receiveInfoIt == _receivedInfoMap.end()) { | 722 if (receiveInfoIt == _receivedInfoMap.end()) { | 
| 728 return -1; | 723 return std::vector<rtcp::TmmbItem>(); | 
| 729 } | 724 } | 
| 730 RTCPReceiveInformation* receiveInfo = receiveInfoIt->second; | 725 RTCPReceiveInformation* receiveInfo = receiveInfoIt->second; | 
| 731 if (receiveInfo == NULL) { | 726 RTC_DCHECK(receiveInfo); | 
| 732 return -1; | 727 | 
| 733 } | 728 *tmmbr_owner = TMMBRHelp::IsOwner(receiveInfo->tmmbn, main_ssrc_); | 
| 734 if (receiveInfo->TmmbnBoundingSet.lengthOfSet() > 0) { | 729 return receiveInfo->tmmbn; | 
| 735 boundingSetRec->VerifyAndAllocateSet( | |
| 736 receiveInfo->TmmbnBoundingSet.lengthOfSet() + 1); | |
| 737 for(uint32_t i=0; i< receiveInfo->TmmbnBoundingSet.lengthOfSet(); | |
| 738 i++) { | |
| 739 if(receiveInfo->TmmbnBoundingSet.Ssrc(i) == main_ssrc_) { | |
| 740 // owner of bounding set | |
| 741 *tmmbrOwner = true; | |
| 742 } | |
| 743 boundingSetRec->SetEntry(i, | |
| 744 receiveInfo->TmmbnBoundingSet.Tmmbr(i), | |
| 745 receiveInfo->TmmbnBoundingSet.PacketOH(i), | |
| 746 receiveInfo->TmmbnBoundingSet.Ssrc(i)); | |
| 747 } | |
| 748 } | |
| 749 return receiveInfo->TmmbnBoundingSet.lengthOfSet(); | |
| 750 } | 730 } | 
| 751 | 731 | 
| 752 void RTCPReceiver::HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser, | 732 void RTCPReceiver::HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser, | 
| 753 RTCPPacketInformation& rtcpPacketInformation) { | 733 RTCPPacketInformation& rtcpPacketInformation) { | 
| 754 RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); | 734 RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); | 
| 755 while (pktType == RTCPPacketTypes::kSdesChunk) { | 735 while (pktType == RTCPPacketTypes::kSdesChunk) { | 
| 756 HandleSDESChunk(rtcpParser); | 736 HandleSDESChunk(rtcpParser); | 
| 757 pktType = rtcpParser.Iterate(); | 737 pktType = rtcpParser.Iterate(); | 
| 758 } | 738 } | 
| 759 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSdes; | 739 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSdes; | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 831 delete it_info->second; | 811 delete it_info->second; | 
| 832 info_map->erase(it_info); | 812 info_map->erase(it_info); | 
| 833 } | 813 } | 
| 834 } | 814 } | 
| 835 | 815 | 
| 836 // we can't delete it due to TMMBR | 816 // we can't delete it due to TMMBR | 
| 837 std::map<uint32_t, RTCPReceiveInformation*>::iterator receiveInfoIt = | 817 std::map<uint32_t, RTCPReceiveInformation*>::iterator receiveInfoIt = | 
| 838 _receivedInfoMap.find(rtcpPacket.BYE.SenderSSRC); | 818 _receivedInfoMap.find(rtcpPacket.BYE.SenderSSRC); | 
| 839 | 819 | 
| 840 if (receiveInfoIt != _receivedInfoMap.end()) { | 820 if (receiveInfoIt != _receivedInfoMap.end()) { | 
| 841 receiveInfoIt->second->readyForDelete = true; | 821 receiveInfoIt->second->ready_for_delete = true; | 
| 842 } | 822 } | 
| 843 | 823 | 
| 844 std::map<uint32_t, RTCPCnameInformation*>::iterator cnameInfoIt = | 824 std::map<uint32_t, RTCPCnameInformation*>::iterator cnameInfoIt = | 
| 845 _receivedCnameMap.find(rtcpPacket.BYE.SenderSSRC); | 825 _receivedCnameMap.find(rtcpPacket.BYE.SenderSSRC); | 
| 846 | 826 | 
| 847 if (cnameInfoIt != _receivedCnameMap.end()) { | 827 if (cnameInfoIt != _receivedCnameMap.end()) { | 
| 848 delete cnameInfoIt->second; | 828 delete cnameInfoIt->second; | 
| 849 _receivedCnameMap.erase(cnameInfoIt); | 829 _receivedCnameMap.erase(cnameInfoIt); | 
| 850 } | 830 } | 
| 851 xr_rr_rtt_ms_ = 0; | 831 xr_rr_rtt_ms_ = 0; | 
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 // Use packet length to calc max number of TMMBR blocks | 980 // Use packet length to calc max number of TMMBR blocks | 
| 1001 // each TMMBR block is 8 bytes | 981 // each TMMBR block is 8 bytes | 
| 1002 ptrdiff_t maxNumOfTMMBRBlocks = rtcpParser.LengthLeft() / 8; | 982 ptrdiff_t maxNumOfTMMBRBlocks = rtcpParser.LengthLeft() / 8; | 
| 1003 | 983 | 
| 1004 // sanity, we can't have more than what's in one packet | 984 // sanity, we can't have more than what's in one packet | 
| 1005 if (maxNumOfTMMBRBlocks > 200) { | 985 if (maxNumOfTMMBRBlocks > 200) { | 
| 1006 assert(false); | 986 assert(false); | 
| 1007 rtcpParser.Iterate(); | 987 rtcpParser.Iterate(); | 
| 1008 return; | 988 return; | 
| 1009 } | 989 } | 
| 1010 ptrReceiveInfo->VerifyAndAllocateTMMBRSet((uint32_t)maxNumOfTMMBRBlocks); | |
| 1011 | 990 | 
| 1012 RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); | 991 RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); | 
| 1013 while (pktType == RTCPPacketTypes::kRtpfbTmmbrItem) { | 992 while (pktType == RTCPPacketTypes::kRtpfbTmmbrItem) { | 
| 1014 HandleTMMBRItem(*ptrReceiveInfo, rtcpPacket, rtcpPacketInformation, senderSS RC); | 993 HandleTMMBRItem(*ptrReceiveInfo, rtcpPacket, rtcpPacketInformation, senderSS RC); | 
| 1015 pktType = rtcpParser.Iterate(); | 994 pktType = rtcpParser.Iterate(); | 
| 1016 } | 995 } | 
| 1017 } | 996 } | 
| 1018 | 997 | 
| 1019 void RTCPReceiver::HandleTMMBRItem(RTCPReceiveInformation& receiveInfo, | 998 void RTCPReceiver::HandleTMMBRItem(RTCPReceiveInformation& receiveInfo, | 
| 1020 const RTCPUtility::RTCPPacket& rtcpPacket, | 999 const RTCPUtility::RTCPPacket& rtcpPacket, | 
| 1021 RTCPPacketInformation& rtcpPacketInformation, | 1000 RTCPPacketInformation& rtcpPacketInformation, | 
| 1022 uint32_t senderSSRC) { | 1001 uint32_t senderSSRC) { | 
| 1023 if (main_ssrc_ == rtcpPacket.TMMBRItem.SSRC && | 1002 if (main_ssrc_ == rtcpPacket.TMMBRItem.SSRC && | 
| 1024 rtcpPacket.TMMBRItem.MaxTotalMediaBitRate > 0) { | 1003 rtcpPacket.TMMBRItem.MaxTotalMediaBitRate > 0) { | 
| 1025 receiveInfo.InsertTMMBRItem(senderSSRC, rtcpPacket.TMMBRItem, | 1004 receiveInfo.InsertTmmbrItem( | 
| 1026 _clock->TimeInMilliseconds()); | 1005 senderSSRC, | 
| 1006 rtcp::TmmbItem(rtcpPacket.TMMBRItem.SSRC, | |
| 1007 rtcpPacket.TMMBRItem.MaxTotalMediaBitRate * 1000, | |
| 1008 rtcpPacket.TMMBRItem.MeasuredOverhead), | |
| 1009 _clock->TimeInMilliseconds()); | |
| 1027 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbr; | 1010 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbr; | 
| 1028 } | 1011 } | 
| 1029 } | 1012 } | 
| 1030 | 1013 | 
| 1031 void RTCPReceiver::HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser, | 1014 void RTCPReceiver::HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser, | 
| 1032 RTCPPacketInformation& rtcpPacketInformation) { | 1015 RTCPPacketInformation& rtcpPacketInformation) { | 
| 1033 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); | 1016 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); | 
| 1034 RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation( | 1017 RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation( | 
| 1035 rtcpPacket.TMMBN.SenderSSRC); | 1018 rtcpPacket.TMMBN.SenderSSRC); | 
| 1036 if (ptrReceiveInfo == NULL) { | 1019 if (ptrReceiveInfo == NULL) { | 
| 1037 // This remote SSRC must be saved before. | 1020 // This remote SSRC must be saved before. | 
| 1038 rtcpParser.Iterate(); | 1021 rtcpParser.Iterate(); | 
| 1039 return; | 1022 return; | 
| 1040 } | 1023 } | 
| 1041 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbn; | 1024 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbn; | 
| 1042 // Use packet length to calc max number of TMMBN blocks | 1025 // Use packet length to calc max number of TMMBN blocks | 
| 1043 // each TMMBN block is 8 bytes | 1026 // each TMMBN block is 8 bytes | 
| 1044 ptrdiff_t maxNumOfTMMBNBlocks = rtcpParser.LengthLeft() / 8; | 1027 ptrdiff_t maxNumOfTMMBNBlocks = rtcpParser.LengthLeft() / 8; | 
| 1045 | 1028 | 
| 1046 // sanity, we cant have more than what's in one packet | 1029 // sanity, we cant have more than what's in one packet | 
| 1047 if (maxNumOfTMMBNBlocks > 200) { | 1030 if (maxNumOfTMMBNBlocks > 200) { | 
| 1048 assert(false); | 1031 assert(false); | 
| 1049 rtcpParser.Iterate(); | 1032 rtcpParser.Iterate(); | 
| 1050 return; | 1033 return; | 
| 1051 } | 1034 } | 
| 1052 | 1035 | 
| 1053 ptrReceiveInfo->VerifyAndAllocateBoundingSet((uint32_t)maxNumOfTMMBNBlocks); | |
| 1054 | |
| 1055 RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); | 1036 RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); | 
| 1056 while (pktType == RTCPPacketTypes::kRtpfbTmmbnItem) { | 1037 while (pktType == RTCPPacketTypes::kRtpfbTmmbnItem) { | 
| 1057 HandleTMMBNItem(*ptrReceiveInfo, rtcpPacket); | 1038 HandleTMMBNItem(*ptrReceiveInfo, rtcpPacket); | 
| 1058 pktType = rtcpParser.Iterate(); | 1039 pktType = rtcpParser.Iterate(); | 
| 1059 } | 1040 } | 
| 1060 } | 1041 } | 
| 1061 | 1042 | 
| 1062 void RTCPReceiver::HandleSR_REQ(RTCPUtility::RTCPParserV2& rtcpParser, | 1043 void RTCPReceiver::HandleSR_REQ(RTCPUtility::RTCPParserV2& rtcpParser, | 
| 1063 RTCPPacketInformation& rtcpPacketInformation) { | 1044 RTCPPacketInformation& rtcpPacketInformation) { | 
| 1064 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSrReq; | 1045 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSrReq; | 
| 1065 rtcpParser.Iterate(); | 1046 rtcpParser.Iterate(); | 
| 1066 } | 1047 } | 
| 1067 | 1048 | 
| 1068 void RTCPReceiver::HandleTMMBNItem(RTCPReceiveInformation& receiveInfo, | 1049 void RTCPReceiver::HandleTMMBNItem(RTCPReceiveInformation& receiveInfo, | 
| 1069 const RTCPUtility::RTCPPacket& rtcpPacket) { | 1050 const RTCPUtility::RTCPPacket& rtcpPacket) { | 
| 1070 receiveInfo.TmmbnBoundingSet.AddEntry( | 1051 receiveInfo.tmmbn.push_back( | 
| 
philipel
2016/08/17 13:53:05
use emplace_back(SSRC, Max... * 1000, Measured...)
 
danilchap
2016/08/17 14:56:05
Done.
 | |
| 1071 rtcpPacket.TMMBNItem.MaxTotalMediaBitRate, | 1052 rtcp::TmmbItem(rtcpPacket.TMMBNItem.SSRC, | 
| 1072 rtcpPacket.TMMBNItem.MeasuredOverhead, | 1053 rtcpPacket.TMMBNItem.MaxTotalMediaBitRate * 1000, | 
| 1073 rtcpPacket.TMMBNItem.SSRC); | 1054 rtcpPacket.TMMBNItem.MeasuredOverhead)); | 
| 1074 } | 1055 } | 
| 1075 | 1056 | 
| 1076 void RTCPReceiver::HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser, | 1057 void RTCPReceiver::HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser, | 
| 1077 RTCPPacketInformation& rtcpPacketInformation) { | 1058 RTCPPacketInformation& rtcpPacketInformation) { | 
| 1078 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); | 1059 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); | 
| 1079 RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); | 1060 RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); | 
| 1080 while (pktType == RTCPPacketTypes::kPsfbSliItem) { | 1061 while (pktType == RTCPPacketTypes::kPsfbSliItem) { | 
| 1081 HandleSLIItem(rtcpPacket, rtcpPacketInformation); | 1062 HandleSLIItem(rtcpPacket, rtcpPacketInformation); | 
| 1082 pktType = rtcpParser.Iterate(); | 1063 pktType = rtcpParser.Iterate(); | 
| 1083 } | 1064 } | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1179 return; | 1160 return; | 
| 1180 } | 1161 } | 
| 1181 | 1162 | 
| 1182 ++packet_type_counter_.fir_packets; | 1163 ++packet_type_counter_.fir_packets; | 
| 1183 | 1164 | 
| 1184 // rtcpPacket.FIR.MediaSSRC SHOULD be 0 but we ignore to check it | 1165 // rtcpPacket.FIR.MediaSSRC SHOULD be 0 but we ignore to check it | 
| 1185 // we don't know who this originate from | 1166 // we don't know who this originate from | 
| 1186 if (receiveInfo) { | 1167 if (receiveInfo) { | 
| 1187 // check if we have reported this FIRSequenceNumber before | 1168 // check if we have reported this FIRSequenceNumber before | 
| 1188 if (rtcpPacket.FIRItem.CommandSequenceNumber != | 1169 if (rtcpPacket.FIRItem.CommandSequenceNumber != | 
| 1189 receiveInfo->lastFIRSequenceNumber) { | 1170 receiveInfo->last_fir_sequence_number) { | 
| 1190 int64_t now = _clock->TimeInMilliseconds(); | 1171 int64_t now = _clock->TimeInMilliseconds(); | 
| 1191 // sanity; don't go crazy with the callbacks | 1172 // sanity; don't go crazy with the callbacks | 
| 1192 if ((now - receiveInfo->lastFIRRequest) > RTCP_MIN_FRAME_LENGTH_MS) { | 1173 if ((now - receiveInfo->last_fir_request_ms) > RTCP_MIN_FRAME_LENGTH_MS) { | 
| 1193 receiveInfo->lastFIRRequest = now; | 1174 receiveInfo->last_fir_request_ms = now; | 
| 1194 receiveInfo->lastFIRSequenceNumber = | 1175 receiveInfo->last_fir_sequence_number = | 
| 1195 rtcpPacket.FIRItem.CommandSequenceNumber; | 1176 rtcpPacket.FIRItem.CommandSequenceNumber; | 
| 1196 // received signal that we need to send a new key frame | 1177 // received signal that we need to send a new key frame | 
| 1197 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpFir; | 1178 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpFir; | 
| 1198 } | 1179 } | 
| 1199 } | 1180 } | 
| 1200 } else { | 1181 } else { | 
| 1201 // received signal that we need to send a new key frame | 1182 // received signal that we need to send a new key frame | 
| 1202 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpFir; | 1183 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpFir; | 
| 1203 } | 1184 } | 
| 1204 } | 1185 } | 
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1395 | 1376 | 
| 1396 std::vector<rtcp::TmmbItem> RTCPReceiver::TMMBRReceived() const { | 1377 std::vector<rtcp::TmmbItem> RTCPReceiver::TMMBRReceived() const { | 
| 1397 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 1378 rtc::CritScope lock(&_criticalSectionRTCPReceiver); | 
| 1398 std::vector<rtcp::TmmbItem> candidates; | 1379 std::vector<rtcp::TmmbItem> candidates; | 
| 1399 | 1380 | 
| 1400 int64_t now_ms = _clock->TimeInMilliseconds(); | 1381 int64_t now_ms = _clock->TimeInMilliseconds(); | 
| 1401 | 1382 | 
| 1402 for (const auto& kv : _receivedInfoMap) { | 1383 for (const auto& kv : _receivedInfoMap) { | 
| 1403 RTCPReceiveInformation* receive_info = kv.second; | 1384 RTCPReceiveInformation* receive_info = kv.second; | 
| 1404 RTC_DCHECK(receive_info); | 1385 RTC_DCHECK(receive_info); | 
| 1405 receive_info->GetTMMBRSet(now_ms, &candidates); | 1386 receive_info->GetTmmbrSet(now_ms, &candidates); | 
| 1406 } | 1387 } | 
| 1407 return candidates; | 1388 return candidates; | 
| 1408 } | 1389 } | 
| 1409 | 1390 | 
| 1410 } // namespace webrtc | 1391 } // namespace webrtc | 
| OLD | NEW |