Changing the buffer size (slots) to 1.5 seconds @ 30 ms packets

This is a relanding of r5725, now with a fix for the failing tests.

BUG=2935
R=turaj@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5738 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc b/webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc
index b189239..87fed6c 100644
--- a/webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc
+++ b/webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc
@@ -85,39 +85,43 @@
   void NbMono() {
     CodecInst codec;
     AudioCodingModule::Codec("L16", &codec, 8000, 1);
-    Run(codec, 2000);
+    codec.pacsize = codec.plfreq * 30 / 1000;  // 30 ms packets.
+    Run(codec, 1000);
   }
 
   void WbMono() {
     CodecInst codec;
     AudioCodingModule::Codec("L16", &codec, 16000, 1);
-    Run(codec, 2000);
+    codec.pacsize = codec.plfreq * 30 / 1000;  // 30 ms packets.
+    Run(codec, 1000);
   }
 
   void SwbMono() {
     CodecInst codec;
     AudioCodingModule::Codec("L16", &codec, 32000, 1);
-    Run(codec, 1500);  // NetEq buffer is not sufficiently large for 3 sec of
-                       // PCM16 super-wideband.
+    codec.pacsize = codec.plfreq * 10 / 1000;  // 10 ms packets.
+    Run(codec, 400);  // Memory constraints limit the buffer at <500 ms.
   }
 
   void NbStereo() {
     CodecInst codec;
     AudioCodingModule::Codec("L16", &codec, 8000, 2);
-    Run(codec, 2000);
+    codec.pacsize = codec.plfreq * 30 / 1000;  // 30 ms packets.
+    Run(codec, 1000);
   }
 
   void WbStereo() {
     CodecInst codec;
     AudioCodingModule::Codec("L16", &codec, 16000, 2);
-    Run(codec, 1500);
+    codec.pacsize = codec.plfreq * 30 / 1000;  // 30 ms packets.
+    Run(codec, 1000);
   }
 
   void SwbStereo() {
     CodecInst codec;
     AudioCodingModule::Codec("L16", &codec, 32000, 2);
-    Run(codec, 600);  // NetEq buffer is not sufficiently large for 3 sec of
-                      // PCM16 super-wideband.
+    codec.pacsize = codec.plfreq * 10 / 1000;  // 10 ms packets.
+    Run(codec, 400);  // Memory constraints limit the buffer at <500 ms.
   }
 
  private:
@@ -137,7 +141,7 @@
 
     uint32_t timestamp = 0;
     double rms = 0;
-    acm_a_->RegisterSendCodec(codec);
+    ASSERT_EQ(0, acm_a_->RegisterSendCodec(codec));
     acm_b_->SetInitialPlayoutDelay(initial_delay_ms);
     while (rms < kAmp / 2) {
       in_audio_frame.timestamp_ = timestamp;
diff --git a/webrtc/modules/audio_coding/neteq4/interface/neteq.h b/webrtc/modules/audio_coding/neteq4/interface/neteq.h
index 6173930..466882a 100644
--- a/webrtc/modules/audio_coding/neteq4/interface/neteq.h
+++ b/webrtc/modules/audio_coding/neteq4/interface/neteq.h
@@ -102,7 +102,7 @@
     kSyncPacketNotAccepted
   };
 
-  static const int kMaxNumPacketsInBuffer = 240;  // TODO(hlundin): Remove.
+  static const int kMaxNumPacketsInBuffer = 50;  // TODO(hlundin): Remove.
   static const int kMaxBytesInBuffer = 113280;  // TODO(hlundin): Remove.
 
   // Creates a new NetEq object, starting at the sample rate |sample_rate_hz|.