Implement initial delay. This CL allows clients of VoE to set an initial delay. Playout of audio is delayed and the extra playout delay is maintained during the call. While packets are buffered (in NetEq) to acheive the desired delay. ACM will playout silence (zeros). Initial delay has to be set before any packet is pushed into ACM.

TEST=ACM unit test is added, also a manual integration test is writen. 
Review URL: https://webrtc-codereview.appspot.com/1097009

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3506 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/neteq/automode.c b/webrtc/modules/audio_coding/neteq/automode.c
index d8d56c6..78933cc 100644
--- a/webrtc/modules/audio_coding/neteq/automode.c
+++ b/webrtc/modules/audio_coding/neteq/automode.c
@@ -216,7 +216,7 @@
             streamingMode);
         if (tempvar > 0)
         {
-            inst->optBufLevel = (WebRtc_UWord16) tempvar;
+            inst->optBufLevel = tempvar;
 
             if (streamingMode != 0)
             {
@@ -238,7 +238,7 @@
             maxBufLen = WEBRTC_SPL_LSHIFT_W32(maxBufLen, 8); /* shift to Q8 */
 
             /* Enforce upper limit; 75% of maxBufLen */
-            inst->optBufLevel = (WebRtc_UWord16) WEBRTC_SPL_MIN( inst->optBufLevel,
+            inst->optBufLevel = WEBRTC_SPL_MIN( inst->optBufLevel,
                 (maxBufLen >> 1) + (maxBufLen >> 2) ); /* 1/2 + 1/4 = 75% */
         }
         else
@@ -575,9 +575,8 @@
          *
          * levelFiltFact is in Q8
          */
-        inst->buffLevelFilt = (WebRtc_UWord16) (WEBRTC_SPL_RSHIFT_W32(
-            WEBRTC_SPL_MUL_16_U16(inst->levelFiltFact, inst->buffLevelFilt), 8)
-            + WEBRTC_SPL_MUL_16_16(256 - inst->levelFiltFact, curSizeFrames));
+        inst->buffLevelFilt = ((inst->levelFiltFact * inst->buffLevelFilt) >> 8) +
+            (256 - inst->levelFiltFact) * curSizeFrames;
     }
 
     /* Account for time-scale operations (accelerate and pre-emptive expand) */
@@ -589,7 +588,7 @@
          * from samples to packets in Q8. Make sure that the filtered value is
          * non-negative.
          */
-        inst->buffLevelFilt = (WebRtc_UWord16) WEBRTC_SPL_MAX( inst->buffLevelFilt -
+        inst->buffLevelFilt = WEBRTC_SPL_MAX( inst->buffLevelFilt -
             WebRtcSpl_DivW32W16(
                 WEBRTC_SPL_LSHIFT_W32(inst->sampleMemory, 8), /* sampleMemory in Q8 */
                 inst->packetSpeechLenSamp ), /* divide by packetSpeechLenSamp */