NetEq: Implement logging of Delayed Packet Outage Events

Measures the duration of each packet loss concealment (a.k.a. expand)
event that is not followed by a merge operation.

Having decoded and played packet m−1, the next expected packet is
m. If packet m arrives after some time of packet loss concealment, we
have a delayed packet outage event. However, if instead packet n>m
arrives, we have a lost packet outage event. In NetEq, the two outage
types results in different operations. Both types start with expand
operations to generate audio to play while the buffer is empty. When a
lost packet outage happens, the expand operation(s) are followed by
one merge operation. For delayed packet outages, merge is not done,
and the expand operations are immediately followed by normal
operations.

This change also includes unit tests for the new statistics.

BUG=webrtc:4915, chromium:488124
R=minyue@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9725}
diff --git a/webrtc/modules/audio_coding/neteq/expand.h b/webrtc/modules/audio_coding/neteq/expand.h
index 5fb117d..3fbafdb 100644
--- a/webrtc/modules/audio_coding/neteq/expand.h
+++ b/webrtc/modules/audio_coding/neteq/expand.h
@@ -23,6 +23,7 @@
 // Forward declarations.
 class BackgroundNoise;
 class RandomVector;
+class StatisticsCalculator;
 class SyncBuffer;
 
 // This class handles extrapolation of audio data from the sync_buffer to
@@ -34,6 +35,7 @@
   Expand(BackgroundNoise* background_noise,
          SyncBuffer* sync_buffer,
          RandomVector* random_vector,
+         StatisticsCalculator* statistics,
          int fs,
          size_t num_channels);
 
@@ -86,8 +88,8 @@
   // necessary to produce concealment data.
   void AnalyzeSignal(int16_t* random_vector);
 
-  RandomVector* random_vector_;
-  SyncBuffer* sync_buffer_;
+  RandomVector* const random_vector_;
+  SyncBuffer* const sync_buffer_;
   bool first_expand_;
   const int fs_hz_;
   const size_t num_channels_;
@@ -127,13 +129,15 @@
 
   void UpdateLagIndex();
 
-  BackgroundNoise* background_noise_;
+  BackgroundNoise* const background_noise_;
+  StatisticsCalculator* const statistics_;
   const size_t overlap_length_;
   int16_t max_lag_;
   size_t expand_lags_[kNumLags];
   int lag_index_direction_;
   int current_lag_index_;
   bool stop_muting_;
+  size_t expand_duration_samples_;
   rtc::scoped_ptr<ChannelParameters[]> channel_parameters_;
 
   DISALLOW_COPY_AND_ASSIGN(Expand);
@@ -146,6 +150,7 @@
   virtual Expand* Create(BackgroundNoise* background_noise,
                          SyncBuffer* sync_buffer,
                          RandomVector* random_vector,
+                         StatisticsCalculator* statistics,
                          int fs,
                          size_t num_channels) const;
 };