Implement new stats interface on NetEq to monitor the operations and internal state.

Currently we use the NetworkStatistics to monitor these metrics, but because these get reset on every call, this makes it impossible to use them for other purposes.

Bug: webrtc:9667
Change-Id: If648085f04d2d58aae263cff5b9491bcad373a96
Reviewed-on: https://webrtc-review.googlesource.com/99740
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24727}
diff --git a/modules/audio_coding/neteq/include/neteq.h b/modules/audio_coding/neteq/include/neteq.h
index f376b05..918b006 100644
--- a/modules/audio_coding/neteq/include/neteq.h
+++ b/modules/audio_coding/neteq/include/neteq.h
@@ -74,6 +74,21 @@
   uint64_t voice_concealed_samples = 0;
 };
 
+// Metrics that describe the operations performed in NetEq, and the internal
+// state.
+struct NetEqOperationsAndState {
+  // These sample counters are cumulative, and don't reset. As a reference, the
+  // total number of output samples can be found in
+  // NetEqLifetimeStatistics::total_samples_received.
+  uint64_t preemptive_samples = 0;
+  uint64_t accelerate_samples = 0;
+  // The statistics below are not cumulative.
+  // The waiting time of the last decoded packet.
+  uint64_t last_waiting_time_ms = 0;
+  // The sum of the packet and jitter buffer size in ms.
+  uint64_t current_buffer_size_ms = 0;
+};
+
 // This is the interface class for NetEq.
 class NetEq {
  public:
@@ -206,6 +221,10 @@
   // never reset.
   virtual NetEqLifetimeStatistics GetLifetimeStatistics() const = 0;
 
+  // Returns statistics about the performed operations and internal state. These
+  // statistics are never reset.
+  virtual NetEqOperationsAndState GetOperationsAndState() const = 0;
+
   // Writes the current RTCP statistics to |stats|. The statistics are reset
   // and a new report period is started with the call.
   virtual void GetRtcpStatistics(RtcpStatistics* stats) = 0;