Move stats ID generation from SSRC to local ID

This generates stats IDs for Track stats (which
represents stats on the attachment of a track to
a PeerConnection) from being SSRC-based to being
based on an ID that is allocated when connecting the
track to the PC.

This is a prerequisite to generating stats before
the PeerConnection is connected.

Bug: webrtc:8673
Change-Id: I82f6e521646b0c92b3af4dffb2cdee75e6dc10d4
Reviewed-on: https://webrtc-review.googlesource.com/38360
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21582}
diff --git a/api/rtpsenderinterface.h b/api/rtpsenderinterface.h
index a7fbbda..d253e89 100644
--- a/api/rtpsenderinterface.h
+++ b/api/rtpsenderinterface.h
@@ -59,6 +59,11 @@
   // Returns null for a video sender.
   virtual rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const = 0;
 
+  // Returns an ID that changes every time SetTrack() is called, but
+  // otherwise remains constant. Used to generate IDs for stats.
+  // The special value zero means that no track is attached.
+  virtual int AttachmentId() const = 0;
+
  protected:
   virtual ~RtpSenderInterface() {}
 };
@@ -77,7 +82,8 @@
   PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
   PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
   PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtmfSenderInterface>, GetDtmfSender);
-END_PROXY_MAP()
+  PROXY_CONSTMETHOD0(int, AttachmentId);
+  END_PROXY_MAP()
 
 }  // namespace webrtc