Remove unused members in VCMJitterEstimator.

Bug: none
Change-Id: I0b6649906d4e73ef0819e00884b5a17d317c7619
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131260
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27484}
diff --git a/modules/video_coding/jitter_estimator.cc b/modules/video_coding/jitter_estimator.cc
index 424f86a..e380f9e 100644
--- a/modules/video_coding/jitter_estimator.cc
+++ b/modules/video_coding/jitter_estimator.cc
@@ -32,12 +32,8 @@
 static constexpr double kDefaultMaxTimestampDeviationInSigmas = 3.5;
 }  // namespace
 
-VCMJitterEstimator::VCMJitterEstimator(Clock* clock,
-                                       int32_t vcmId,
-                                       int32_t receiverId)
-    : _vcmId(vcmId),
-      _receiverId(receiverId),
-      _phi(0.97),
+VCMJitterEstimator::VCMJitterEstimator(Clock* clock)
+    : _phi(0.97),
       _psi(0.9999),
       _alphaCountMax(400),
       _thetaLow(0.000001),
@@ -65,8 +61,6 @@
     memcpy(_thetaCov, rhs._thetaCov, sizeof(_thetaCov));
     memcpy(_Qcov, rhs._Qcov, sizeof(_Qcov));
 
-    _vcmId = rhs._vcmId;
-    _receiverId = rhs._receiverId;
     _avgFrameSize = rhs._avgFrameSize;
     _varFrameSize = rhs._varFrameSize;
     _maxFrameSize = rhs._maxFrameSize;
@@ -87,7 +81,7 @@
   return *this;
 }
 
-// Resets the JitterEstimate
+// Resets the JitterEstimate.
 void VCMJitterEstimator::Reset() {
   _theta[0] = 1 / (512e3 / 8);
   _theta[1] = 0;
@@ -122,7 +116,7 @@
   _nackCount = 0;
 }
 
-// Updates the estimates with the new measurements
+// Updates the estimates with the new measurements.
 void VCMJitterEstimator::UpdateEstimate(int64_t frameDelayMS,
                                         uint32_t frameSizeBytes,
                                         bool incompleteFrame /* = false */) {
@@ -134,27 +128,25 @@
     _fsSum += frameSizeBytes;
     _fsCount++;
   } else if (_fsCount == kFsAccuStartupSamples) {
-    // Give the frame size filter
+    // Give the frame size filter.
     _avgFrameSize = static_cast<double>(_fsSum) / static_cast<double>(_fsCount);
     _fsCount++;
   }
   if (!incompleteFrame || frameSizeBytes > _avgFrameSize) {
     double avgFrameSize = _phi * _avgFrameSize + (1 - _phi) * frameSizeBytes;
     if (frameSizeBytes < _avgFrameSize + 2 * sqrt(_varFrameSize)) {
-      // Only update the average frame size if this sample wasn't a
-      // key frame
+      // Only update the average frame size if this sample wasn't a key frame.
       _avgFrameSize = avgFrameSize;
     }
     // Update the variance anyway since we want to capture cases where we only
-    // get
-    // key frames.
+    // get key frames.
     _varFrameSize = VCM_MAX(
         _phi * _varFrameSize + (1 - _phi) * (frameSizeBytes - avgFrameSize) *
                                    (frameSizeBytes - avgFrameSize),
         1.0);
   }
 
-  // Update max frameSize estimate
+  // Update max frameSize estimate.
   _maxFrameSize =
       VCM_MAX(_psi * _maxFrameSize, static_cast<double>(frameSizeBytes));
 
@@ -170,24 +162,24 @@
   frameDelayMS = std::max(std::min(frameDelayMS, max_time_deviation_ms),
                           -max_time_deviation_ms);
 
-  // Only update the Kalman filter if the sample is not considered
-  // an extreme outlier. Even if it is an extreme outlier from a
-  // delay point of view, if the frame size also is large the
-  // deviation is probably due to an incorrect line slope.
+  // Only update the Kalman filter if the sample is not considered an extreme
+  // outlier. Even if it is an extreme outlier from a delay point of view, if
+  // the frame size also is large the deviation is probably due to an incorrect
+  // line slope.
   double deviation = DeviationFromExpectedDelay(frameDelayMS, deltaFS);
 
   if (fabs(deviation) < _numStdDevDelayOutlier * sqrt(_varNoise) ||
       frameSizeBytes >
           _avgFrameSize + _numStdDevFrameSizeOutlier * sqrt(_varFrameSize)) {
-    // Update the variance of the deviation from the
-    // line given by the Kalman filter
+    // Update the variance of the deviation from the line given by the Kalman
+    // filter.
     EstimateRandomJitter(deviation, incompleteFrame);
-    // Prevent updating with frames which have been congested by a large
-    // frame, and therefore arrives almost at the same time as that frame.
-    // This can occur when we receive a large frame (key frame) which
-    // has been delayed. The next frame is of normal size (delta frame),
-    // and thus deltaFS will be << 0. This removes all frame samples
-    // which arrives after a key frame.
+    // Prevent updating with frames which have been congested by a large frame,
+    // and therefore arrives almost at the same time as that frame.
+    // This can occur when we receive a large frame (key frame) which has been
+    // delayed. The next frame is of normal size (delta frame), and thus deltaFS
+    // will be << 0. This removes all frame samples which arrives after a key
+    // frame.
     if ((!incompleteFrame || deviation >= 0.0) &&
         static_cast<double>(deltaFS) > -0.25 * _maxFrameSize) {
       // Update the Kalman filter with the new data
@@ -206,7 +198,7 @@
   }
 }
 
-// Updates the nack/packet ratio
+// Updates the nack/packet ratio.
 void VCMJitterEstimator::FrameNacked() {
   if (_nackCount < _nackLimit) {
     _nackCount++;
@@ -214,7 +206,7 @@
   _latestNackTimestamp = clock_->TimeInMicroseconds();
 }
 
-// Updates Kalman estimate of the channel
+// Updates Kalman estimate of the channel.
 // The caller is expected to sanity check the inputs.
 void VCMJitterEstimator::KalmanEstimateChannel(int64_t frameDelayMS,
                                                int32_t deltaFSBytes) {
@@ -283,7 +275,7 @@
   _thetaCov[1][1] = _thetaCov[1][1] * (1 - kalmanGain[1]) -
                     kalmanGain[1] * deltaFSBytes * t01;
 
-  // Covariance matrix, must be positive semi-definite
+  // Covariance matrix, must be positive semi-definite.
   assert(_thetaCov[0][0] + _thetaCov[1][1] >= 0 &&
          _thetaCov[0][0] * _thetaCov[1][1] -
                  _thetaCov[0][1] * _thetaCov[1][0] >=
@@ -291,16 +283,16 @@
          _thetaCov[0][0] >= 0);
 }
 
-// Calculate difference in delay between a sample and the
-// expected delay estimated by the Kalman filter
+// Calculate difference in delay between a sample and the expected delay
+// estimated by the Kalman filter
 double VCMJitterEstimator::DeviationFromExpectedDelay(
     int64_t frameDelayMS,
     int32_t deltaFSBytes) const {
   return frameDelayMS - (_theta[0] * deltaFSBytes + _theta[1]);
 }
 
-// Estimates the random jitter by calculating the variance of the
-// sample distance from the line given by theta.
+// Estimates the random jitter by calculating the variance of the sample
+// distance from the line given by theta.
 void VCMJitterEstimator::EstimateRandomJitter(double d_dT,
                                               bool incompleteFrame) {
   uint64_t now = clock_->TimeInMicroseconds();
@@ -343,8 +335,8 @@
     _varNoise = varNoise;
   }
   if (_varNoise < 1.0) {
-    // The variance should never be zero, since we might get
-    // stuck and consider all samples as outliers.
+    // The variance should never be zero, since we might get stuck and consider
+    // all samples as outliers.
     _varNoise = 1.0;
   }
 }
@@ -357,11 +349,11 @@
   return noiseThreshold;
 }
 
-// Calculates the current jitter estimate from the filtered estimates
+// Calculates the current jitter estimate from the filtered estimates.
 double VCMJitterEstimator::CalculateEstimate() {
   double ret = _theta[0] * (_maxFrameSize - _avgFrameSize) + NoiseThreshold();
 
-  // A very low estimate (or negative) is neglected
+  // A very low estimate (or negative) is neglected.
   if (ret < 1.0) {
     if (_prevEstimate <= 0.01) {
       ret = 1.0;
diff --git a/modules/video_coding/jitter_estimator.h b/modules/video_coding/jitter_estimator.h
index c6500da..8bffa05 100644
--- a/modules/video_coding/jitter_estimator.h
+++ b/modules/video_coding/jitter_estimator.h
@@ -20,13 +20,11 @@
 
 class VCMJitterEstimator {
  public:
-  explicit VCMJitterEstimator(Clock* clock,
-                              int32_t vcmId = 0,
-                              int32_t receiverId = 0);
+  explicit VCMJitterEstimator(Clock* clock);
   virtual ~VCMJitterEstimator();
   VCMJitterEstimator& operator=(const VCMJitterEstimator& rhs);
 
-  // Resets the estimate to the initial state
+  // Resets the estimate to the initial state.
   void Reset();
   void ResetNackCount();
 
@@ -34,21 +32,21 @@
   //
   // Input:
   //          - frameDelay      : Delay-delta calculated by UTILDelayEstimate in
-  //          milliseconds
+  //                              milliseconds.
   //          - frameSize       : Frame size of the current frame.
   //          - incompleteFrame : Flags if the frame is used to update the
-  //          estimate before it
-  //                              was complete. Default is false.
+  //                              estimate before it was complete.
+  //                              Default is false.
   void UpdateEstimate(int64_t frameDelayMS,
                       uint32_t frameSizeBytes,
                       bool incompleteFrame = false);
 
-  // Returns the current jitter estimate in milliseconds and adds
-  // also adds an RTT dependent term in cases of retransmission.
+  // Returns the current jitter estimate in milliseconds and adds an RTT
+  // dependent term in cases of retransmission.
   //  Input:
   //          - rttMultiplier  : RTT param multiplier (when applicable).
   //
-  // Return value                   : Jitter estimate in milliseconds
+  // Return value              : Jitter estimate in milliseconds.
   virtual int GetJitterEstimate(double rttMultiplier);
 
   // Updates the nack counter.
@@ -57,71 +55,67 @@
   // Updates the RTT filter.
   //
   // Input:
-  //          - rttMs               : RTT in ms
+  //          - rttMs          : RTT in ms.
   void UpdateRtt(int64_t rttMs);
 
   void UpdateMaxFrameSize(uint32_t frameSizeBytes);
 
-  // A constant describing the delay from the jitter buffer
-  // to the delay on the receiving side which is not accounted
-  // for by the jitter buffer nor the decoding delay estimate.
+  // A constant describing the delay from the jitter buffer to the delay on the
+  // receiving side which is not accounted for by the jitter buffer nor the
+  // decoding delay estimate.
   static const uint32_t OPERATING_SYSTEM_JITTER = 10;
 
  protected:
-  // These are protected for better testing possibilities
+  // These are protected for better testing possibilities.
   double _theta[2];  // Estimated line parameters (slope, offset)
   double _varNoise;  // Variance of the time-deviation from the line
 
  private:
-  // Updates the Kalman filter for the line describing
-  // the frame size dependent jitter.
+  // Updates the Kalman filter for the line describing the frame size dependent
+  // jitter.
   //
   // Input:
   //          - frameDelayMS    : Delay-delta calculated by UTILDelayEstimate in
-  //          milliseconds
-  //          - deltaFSBytes    : Frame size delta, i.e.
-  //                            : frame size at time T minus frame size at time
-  //                            T-1
+  //                              milliseconds.
+  //          - deltaFSBytes    : Frame size delta, i.e. frame size at time T
+  //                            : minus frame size at time T-1.
   void KalmanEstimateChannel(int64_t frameDelayMS, int32_t deltaFSBytes);
 
-  // Updates the random jitter estimate, i.e. the variance
-  // of the time deviations from the line given by the Kalman filter.
+  // Updates the random jitter estimate, i.e. the variance of the time
+  // deviations from the line given by the Kalman filter.
   //
   // Input:
-  //          - d_dT              : The deviation from the kalman estimate
+  //          - d_dT              : The deviation from the kalman estimate.
   //          - incompleteFrame   : True if the frame used to update the
-  //          estimate
-  //                                with was incomplete
+  //                                estimate with was incomplete.
   void EstimateRandomJitter(double d_dT, bool incompleteFrame);
 
   double NoiseThreshold() const;
 
   // Calculates the current jitter estimate.
   //
-  // Return value                 : The current jitter estimate in milliseconds
+  // Return value                 : The current jitter estimate in milliseconds.
   double CalculateEstimate();
 
-  // Post process the calculated estimate
+  // Post process the calculated estimate.
   void PostProcessEstimate();
 
-  // Calculates the difference in delay between a sample and the
-  // expected delay estimated by the Kalman filter.
+  // Calculates the difference in delay between a sample and the expected delay
+  // estimated by the Kalman filter.
   //
   // Input:
   //          - frameDelayMS    : Delay-delta calculated by UTILDelayEstimate in
-  //          milliseconds
+  //                              milliseconds.
   //          - deltaFS         : Frame size delta, i.e. frame size at time
-  //                              T minus frame size at time T-1
+  //                              T minus frame size at time T-1.
   //
-  // Return value                 : The difference in milliseconds
+  // Return value               : The difference in milliseconds.
   double DeviationFromExpectedDelay(int64_t frameDelayMS,
                                     int32_t deltaFSBytes) const;
 
   double GetFrameRate() const;
 
-  // Constants, filter parameters
-  int32_t _vcmId;
-  int32_t _receiverId;
+  // Constants, filter parameters.
   const double _phi;
   const double _psi;
   const uint32_t _alphaCountMax;
diff --git a/modules/video_coding/jitter_estimator_tests.cc b/modules/video_coding/jitter_estimator_tests.cc
index e696f0e..fba2bf7 100644
--- a/modules/video_coding/jitter_estimator_tests.cc
+++ b/modules/video_coding/jitter_estimator_tests.cc
@@ -30,7 +30,7 @@
   TestVCMJitterEstimator() : fake_clock_(0) {}
 
   virtual void SetUp() {
-    estimator_ = absl::make_unique<VCMJitterEstimator>(&fake_clock_, 0, 0);
+    estimator_ = absl::make_unique<VCMJitterEstimator>(&fake_clock_);
   }
 
   void AdvanceClock(int64_t microseconds) {
@@ -48,9 +48,9 @@
       : amplitude_(amplitude), counter_(0) {}
   virtual ~ValueGenerator() {}
 
-  int64_t Delay() { return ((counter_ % 11) - 5) * amplitude_; }
+  int64_t Delay() const { return ((counter_ % 11) - 5) * amplitude_; }
 
-  uint32_t FrameSize() { return 1000 + Delay(); }
+  uint32_t FrameSize() const { return 1000 + Delay(); }
 
   void Advance() { ++counter_; }
 
diff --git a/test/fuzzers/frame_buffer2_fuzzer.cc b/test/fuzzers/frame_buffer2_fuzzer.cc
index 6f7c6f6..579a2d7 100644
--- a/test/fuzzers/frame_buffer2_fuzzer.cc
+++ b/test/fuzzers/frame_buffer2_fuzzer.cc
@@ -67,7 +67,7 @@
   }
   DataReader reader(data, size);
   Clock* clock = Clock::GetRealTimeClock();
-  VCMJitterEstimator jitter_estimator(clock, 0, 0);
+  VCMJitterEstimator jitter_estimator(clock);
   VCMTiming timing(clock);
   video_coding::FrameBuffer frame_buffer(clock, &jitter_estimator, &timing,
                                          nullptr);