ACM test are modified to run with both ACM1 and ACM2.

Beside the changes in test files. acm2/acm_generic_codec.cc and acm2/audio_coding_module_impl.cc are modified to fix a bug.

Also, nack{.cc, .h, _unittest.cc} are removed form main/sourc as nack files in both ACM1 and ACM2 are essentially identical.

R=andrew@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4908 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/main/test/APITest.cc b/webrtc/modules/audio_coding/main/test/APITest.cc
index a9e2e71..15bac6a 100644
--- a/webrtc/modules/audio_coding/main/test/APITest.cc
+++ b/webrtc/modules/audio_coding/main/test/APITest.cc
@@ -20,6 +20,7 @@
 #include <string>
 
 #include "testing/gtest/include/gtest/gtest.h"
+#include "webrtc/common.h"
 #include "webrtc/common_types.h"
 #include "webrtc/engine_configurations.h"
 #include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
@@ -54,9 +55,9 @@
   }
 }
 
-APITest::APITest()
-    : _acmA(AudioCodingModule::Create(1)),
-      _acmB(AudioCodingModule::Create(2)),
+APITest::APITest(const Config& config)
+    : _acmA(config.Get<AudioCodingModuleFactory>().Create(1)),
+      _acmB(config.Get<AudioCodingModuleFactory>().Create(2)),
       _channel_A2B(NULL),
       _channel_B2A(NULL),
       _writeToFile(true),
@@ -238,12 +239,12 @@
   //--- Set A-to-B channel
   _channel_A2B = new Channel(2);
   CHECK_ERROR_MT(_acmA->RegisterTransportCallback(_channel_A2B));
-  _channel_A2B->RegisterReceiverACM(_acmB);
+  _channel_A2B->RegisterReceiverACM(_acmB.get());
 
   //--- Set B-to-A channel
   _channel_B2A = new Channel(1);
   CHECK_ERROR_MT(_acmB->RegisterTransportCallback(_channel_B2A));
-  _channel_B2A->RegisterReceiverACM(_acmA);
+  _channel_B2A->RegisterReceiverACM(_acmA.get());
 
   //--- EVENT TIMERS
   // A
@@ -729,11 +730,11 @@
   estimDelayCB.SetArithMean(true);
 
   if (side == 'A') {
-    myACM = _acmA;
+    myACM = _acmA.get();
     myChannel = _channel_B2A;
     myMinDelay = &_minDelayA;
   } else {
-    myACM = _acmB;
+    myACM = _acmB.get();
     myChannel = _channel_A2B;
     myMinDelay = &_minDelayB;
   }
@@ -845,14 +846,14 @@
 
   switch (sendSide) {
     case 'A': {
-      sendACM = _acmA;
-      receiveACM = _acmB;
+      sendACM = _acmA.get();
+      receiveACM = _acmB.get();
       thereIsDecoder = &_thereIsDecoderB;
       break;
     }
     case 'B': {
-      sendACM = _acmB;
-      receiveACM = _acmA;
+      sendACM = _acmB.get();
+      receiveACM = _acmA.get();
       thereIsDecoder = &_thereIsDecoderA;
       break;
     }
@@ -964,17 +965,17 @@
   AudioPlayoutMode* playoutMode = NULL;
   switch (receiveSide) {
     case 'A': {
-      receiveACM = _acmA;
+      receiveACM = _acmA.get();
       playoutMode = &_playoutModeA;
       break;
     }
     case 'B': {
-      receiveACM = _acmB;
+      receiveACM = _acmB.get();
       playoutMode = &_playoutModeB;
       break;
     }
     default:
-      receiveACM = _acmA;
+      receiveACM = _acmA.get();
   }
 
   int32_t receiveFreqHz = receiveACM->ReceiveFrequency();
@@ -1018,7 +1019,6 @@
   }
 }
 
-// set/get receiver VAD status & mode.
 void APITest::TestSendVAD(char side) {
   if (_randomTest) {
     return;
@@ -1044,14 +1044,14 @@
     dtx = &_sendDTXA;
     mode = &_sendVADModeA;
     myChannel = _channel_A2B;
-    myACM = _acmA;
+    myACM = _acmA.get();
   } else {
     AudioCodingModule::Codec(_codecCntrB, &myCodec);
     vad = &_sendVADB;
     dtx = &_sendDTXB;
     mode = &_sendVADModeB;
     myChannel = _channel_B2A;
-    myACM = _acmB;
+    myACM = _acmB.get();
   }
 
   CheckVADStatus(side);
@@ -1137,7 +1137,7 @@
     fprintf(stdout, "Reset Encoder Side A \n");
   }
   if (side == 'A') {
-    myACM = _acmA;
+    myACM = _acmA.get();
     codecCntr = &_codecCntrA;
     {
       WriteLockScoped wl(_apiTestRWLock);
@@ -1148,7 +1148,7 @@
     mode = &_sendVADModeA;
     myChannel = _channel_A2B;
   } else {
-    myACM = _acmB;
+    myACM = _acmB.get();
     codecCntr = &_codecCntrB;
     {
       WriteLockScoped wl(_apiTestRWLock);