Store the received report blocks map (mapped per remote ssrc) in a map per source ssrc.
When using rtx, receiver reports with two report blocks are received. The report blocks have the same remote ssrc and therefore the first report block was overwritten by the second report block when stored in the ReportBlockInfoMap.

Removed unused function ResetRTT.

BUG=4114
R=mflodman@webrtc.org, stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/33659005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7952 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h
index ecc5ebe..b8fcb41 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -15,6 +15,7 @@
 #include <vector>
 #include <set>
 
+#include "webrtc/base/thread_annotations.h"
 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h"
 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
@@ -77,8 +78,6 @@
                 uint16_t* minRTT,
                 uint16_t* maxRTT) const;
 
-    int32_t ResetRTT(const uint32_t remoteSSRC);
-
     int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const;
 
     bool GetAndResetXrRrRtt(uint16_t* rtt_ms);
@@ -114,9 +113,6 @@
     RtcpStatisticsCallback* GetRtcpStatisticsCallback();
 
 protected:
-    RTCPHelp::RTCPReportBlockInformation* CreateReportBlockInformation(const uint32_t remoteSSRC);
-    RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation(const uint32_t remoteSSRC) const;
-
     RTCPUtility::RTCPCnameInformation* CreateCnameInformation(const uint32_t remoteSSRC);
     RTCPUtility::RTCPCnameInformation* GetCnameInformation(const uint32_t remoteSSRC) const;
 
@@ -220,19 +216,32 @@
  private:
   typedef std::map<uint32_t, RTCPHelp::RTCPReceiveInformation*>
       ReceivedInfoMap;
-  int32_t           _id;
-  Clock*                  _clock;
-  RTCPMethod              _method;
-  int64_t           _lastReceived;
-  ModuleRtpRtcpImpl&      _rtpRtcp;
+  // RTCP report block information mapped by remote SSRC.
+  typedef std::map<uint32_t, RTCPHelp::RTCPReportBlockInformation*>
+      ReportBlockInfoMap;
+  // RTCP report block information map mapped by source SSRC.
+  typedef std::map<uint32_t, ReportBlockInfoMap> ReportBlockMap;
+
+  RTCPHelp::RTCPReportBlockInformation* CreateOrGetReportBlockInformation(
+      uint32_t remote_ssrc, uint32_t source_ssrc)
+          EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
+  RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation(
+      uint32_t remote_ssrc, uint32_t source_ssrc) const
+          EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
+
+  int32_t _id;
+  Clock* _clock;
+  RTCPMethod _method;
+  int64_t _lastReceived;
+  ModuleRtpRtcpImpl& _rtpRtcp;
 
   CriticalSectionWrapper* _criticalSectionFeedbacks;
-  RtcpBandwidthObserver*  _cbRtcpBandwidthObserver;
+  RtcpBandwidthObserver* _cbRtcpBandwidthObserver;
   RtcpIntraFrameObserver* _cbRtcpIntraFrameObserver;
 
   CriticalSectionWrapper* _criticalSectionRTCPReceiver;
-  uint32_t          main_ssrc_;
-  uint32_t          _remoteSSRC;
+  uint32_t main_ssrc_;
+  uint32_t _remoteSSRC;
   std::set<uint32_t> registered_ssrcs_;
 
   // Received send report
@@ -250,18 +259,17 @@
   uint16_t xr_rr_rtt_ms_;
 
   // Received report blocks.
-  std::map<uint32_t, RTCPHelp::RTCPReportBlockInformation*>
-      _receivedReportBlockMap;
+  ReportBlockMap _receivedReportBlockMap
+      GUARDED_BY(_criticalSectionRTCPReceiver);
   ReceivedInfoMap _receivedInfoMap;
-  std::map<uint32_t, RTCPUtility::RTCPCnameInformation*>
-      _receivedCnameMap;
+  std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> _receivedCnameMap;
 
-  uint32_t            _packetTimeOutMS;
+  uint32_t _packetTimeOutMS;
 
   // The last time we received an RTCP RR.
   int64_t _lastReceivedRrMs;
 
-  // The time we last received an RTCP RR telling we have ssuccessfully
+  // The time we last received an RTCP RR telling we have successfully
   // delivered RTP packet to the remote side.
   int64_t _lastIncreasedSequenceNumberMs;