Cleaned out boundingSet member from TMMBRHelp class

BUG=webrtc:5565
R=philipel@webrtc.org

Review URL: https://codereview.webrtc.org/2224933002 .

Cr-Commit-Position: refs/heads/master@{#13702}
diff --git a/webrtc/modules/rtp_rtcp/source/CPPLINT.cfg b/webrtc/modules/rtp_rtcp/source/CPPLINT.cfg
index c318452..baec43c 100644
--- a/webrtc/modules/rtp_rtcp/source/CPPLINT.cfg
+++ b/webrtc/modules/rtp_rtcp/source/CPPLINT.cfg
@@ -1,5 +1,3 @@
-#tmmbr_help is refactored in CL#1474693002
-exclude_files=tmmbr_help.*
 #rtcp_utility planned to be removed when webrtc:5260 will be finished.
 exclude_files=rtcp_utility.*
 #rtcp_receiver/rtcp_receiver_help will be refactored more deeply as part of webrtc:5260
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
index ae1f875..31a11e2 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -1234,7 +1234,6 @@
 }
 int32_t RTCPReceiver::UpdateTMMBR() {
   TMMBRHelp tmmbr_help;
-  int32_t numBoundingSet = 0;
   uint32_t bitrate = 0;
   uint32_t accNumCandidates = 0;
 
@@ -1245,19 +1244,14 @@
     accNumCandidates = TMMBRReceived(size, accNumCandidates, candidateSet);
   }
   // Find bounding set
-  TMMBRSet* boundingSet = NULL;
-  numBoundingSet = tmmbr_help.FindTMMBRBoundingSet(boundingSet);
-  if (numBoundingSet == -1) {
-    LOG(LS_WARNING) << "Failed to find TMMBR bounding set.";
-    return -1;
-  }
+  std::vector<rtcp::TmmbItem> bounding = tmmbr_help.FindTMMBRBoundingSet();
   // Set bounding set
   // Inform remote clients about the new bandwidth
   // inform the remote client
-  _rtpRtcp.SetTMMBN(boundingSet);
+  _rtpRtcp.SetTMMBN(&bounding);
 
   // might trigger a TMMBN
-  if (numBoundingSet == 0) {
+  if (bounding.empty()) {
     // owner of max bitrate request has timed out
     // empty bounding set has been sent
     return 0;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
index d4c1cd1..23da9ca 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -614,13 +614,10 @@
       // add current tuple
       candidateSet->SetEntry(lengthOfBoundingSet, tmmbr_send_, packet_oh_send_,
                              ssrc_);
-      int numCandidates = lengthOfBoundingSet + 1;
 
       // find bounding set
-      TMMBRSet* boundingSet = nullptr;
-      int numBoundingSet = tmmbr_help.FindTMMBRBoundingSet(boundingSet);
-      if (numBoundingSet > 0 || numBoundingSet <= numCandidates)
-        tmmbrOwner = tmmbr_help.IsOwner(ssrc_, numBoundingSet);
+      std::vector<rtcp::TmmbItem> bounding = tmmbr_help.FindTMMBRBoundingSet();
+      tmmbrOwner = TMMBRHelp::IsOwner(bounding, ssrc_);
       if (!tmmbrOwner) {
         // Did not enter bounding set, no meaning to send this request.
         return nullptr;
diff --git a/webrtc/modules/rtp_rtcp/source/tmmbr_help.cc b/webrtc/modules/rtp_rtcp/source/tmmbr_help.cc
index c153181..5aa8f94 100644
--- a/webrtc/modules/rtp_rtcp/source/tmmbr_help.cc
+++ b/webrtc/modules/rtp_rtcp/source/tmmbr_help.cc
@@ -12,6 +12,7 @@
 
 #include <algorithm>
 #include <limits>
+#include <utility>
 
 #include "webrtc/base/checks.h"
 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
@@ -60,7 +61,7 @@
   return &_candidateSet;
 }
 
-int32_t TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet) {
+std::vector<rtcp::TmmbItem> TMMBRHelp::FindTMMBRBoundingSet() {
   // Work on local variable, will be modified
   TMMBRSet candidateSet;
   candidateSet.VerifyAndAllocateSet(_candidateSet.capacity());
@@ -80,16 +81,14 @@
   // Number of set candidates
   int32_t numSetCandidates = candidateSet.lengthOfSet();
   // Find bounding set
-  uint32_t numBoundingSet = 0;
+  std::vector<rtcp::TmmbItem> bounding;
   if (numSetCandidates > 0) {
-    FindBoundingSet(std::move(candidateSet), &_boundingSet);
-    numBoundingSet = _boundingSet.size();
-    if (numBoundingSet < 1 || (numBoundingSet > _candidateSet.size())) {
-      return -1;
-    }
-    boundingSet = &_boundingSet;
+    FindBoundingSet(std::move(candidateSet), &bounding);
+    size_t numBoundingSet = bounding.size();
+    RTC_DCHECK_GE(numBoundingSet, 1u);
+    RTC_DCHECK_LE(numBoundingSet, _candidateSet.size());
   }
-  return numBoundingSet;
+  return bounding;
 }
 
 void TMMBRHelp::FindBoundingSet(std::vector<rtcp::TmmbItem> candidates,
@@ -231,13 +230,10 @@
   }
 }
 
-bool TMMBRHelp::IsOwner(const uint32_t ssrc, const uint32_t length) const {
-  if (length == 0) {
-    // Empty bounding set.
-    return false;
-  }
-  for (size_t i = 0; (i < length) && (i < _boundingSet.size()); ++i) {
-    if (_boundingSet.Ssrc(i) == ssrc) {
+bool TMMBRHelp::IsOwner(const std::vector<rtcp::TmmbItem>& bounding,
+                        uint32_t ssrc) {
+  for (const rtcp::TmmbItem& item : bounding) {
+    if (item.ssrc() == ssrc) {
       return true;
     }
   }
diff --git a/webrtc/modules/rtp_rtcp/source/tmmbr_help.h b/webrtc/modules/rtp_rtcp/source/tmmbr_help.h
index f901b37..ecae946 100644
--- a/webrtc/modules/rtp_rtcp/source/tmmbr_help.h
+++ b/webrtc/modules/rtp_rtcp/source/tmmbr_help.h
@@ -44,9 +44,10 @@
   TMMBRSet* CandidateSet();
 
   TMMBRSet* VerifyAndAllocateCandidateSet(const uint32_t minimumSize);
-  int32_t FindTMMBRBoundingSet(TMMBRSet*& boundingSet);
+  std::vector<rtcp::TmmbItem> FindTMMBRBoundingSet();
 
-  bool IsOwner(const uint32_t ssrc, const uint32_t length) const;
+  static bool IsOwner(const std::vector<rtcp::TmmbItem>& bounding,
+                      uint32_t ssrc);
 
   bool CalcMinBitRate(uint32_t* minBitrateKbit) const;
 
@@ -55,7 +56,6 @@
 
  private:
   TMMBRSet _candidateSet;
-  TMMBRSet _boundingSet;
 };
 }  // namespace webrtc