Adding separate payload types for stereo modes

BUG=Issue 452
TEST=audio_coding_test, voe_auto_test, voe_cmd_test

Edit: adding Patrik to review:
src/modules/rtp_rtcp/source/rtp_receiver.cc
...and Shijing to review:
src/voice_engine/main/source/channel.cc
src/voice_engine/main/test/cmd_test/voe_cmd_test.cc

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2340 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/audio_coding/main/test/EncodeDecodeTest.cc b/src/modules/audio_coding/main/test/EncodeDecodeTest.cc
index 1127fa3..15e91be 100644
--- a/src/modules/audio_coding/main/test/EncodeDecodeTest.cc
+++ b/src/modules/audio_coding/main/test/EncodeDecodeTest.cc
@@ -149,9 +149,6 @@
   noOfCodecs = acm->NumberOfCodecs();
   for (int i = 0; i < noOfCodecs; i++) {
     acm->Codec((WebRtc_UWord8) i, recvCodec);
-    if (!strcmp(recvCodec.plname, "CELT")) {
-      recvCodec.channels = 1;
-    }
     if (acm->RegisterReceiveCodec(recvCodec) != 0) {
       printf("Unable to register codec: for run: codecId: %d\n", codeId);
       exit(1);
@@ -220,7 +217,6 @@
    if (ok != 0) {
      printf("Error when inserting packet to ACM, for run: codecId: %d\n",
             codeId);
-     exit(1);
    }
    _realPayloadSizeBytes = _rtpStream->Read(&_rtpInfo, _incomingPayload,
                                             _payloadSizeBytes, &_nextTime);
@@ -296,20 +292,24 @@
   }
 
   int numCodecs = 1;
-  int codePars[3]; //freq, pacsize, rate
-  int numPars[52]; //number of codec parameters sets (rate,freq,pacsize)to test,
-                   //for a given codec
+  int codePars[3]; // Frequency, packet size, rate.
+  int numPars[52]; // Number of codec parameters sets (freq, pacsize, rate)
+                   // to test, for a given codec.
 
   codePars[0] = 0;
   codePars[1] = 0;
   codePars[2] = 0;
 
+  AudioCodingModule *acmTmp = AudioCodingModule::Create(0);
+  struct CodecInst sendCodecTmp;
+  numCodecs = acmTmp->NumberOfCodecs();
+  AudioCodingModule::Destroy(acmTmp);
+
   if (_testMode == 1) {
-    AudioCodingModule *acmTmp = AudioCodingModule::Create(0);
-    struct CodecInst sendCodecTmp;
-    numCodecs = acmTmp->NumberOfCodecs();
     printf("List of supported codec.\n");
-    for(int n = 0; n < numCodecs; n++) {
+  }
+  if (_testMode != 2) {
+    for (int n = 0; n < numCodecs; n++) {
       acmTmp->Codec(n, sendCodecTmp);
       if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) {
         numPars[n] = 0;
@@ -317,28 +317,13 @@
         numPars[n] = 0;
       } else if (STR_CASE_CMP(sendCodecTmp.plname, "red") == 0) {
         numPars[n] = 0;
+      } else if (sendCodecTmp.channels == 2) {
+        numPars[n] = 0;
       } else {
         numPars[n] = 1;
-        printf("%d %s\n", n, sendCodecTmp.plname);
-      }
-    }
-    AudioCodingModule::Destroy(acmTmp);
-  } else if (_testMode == 0) {
-    AudioCodingModule *acmTmp = AudioCodingModule::Create(0);
-    numCodecs = acmTmp->NumberOfCodecs();
-    AudioCodingModule::Destroy(acmTmp);
-    struct CodecInst dummyCodec;
-
-    //chose range of testing for codecs/parameters
-    for(int i = 0 ; i < numCodecs ; i++) {
-      numPars[i] = 1;
-      acmTmp->Codec(i, dummyCodec);
-      if (STR_CASE_CMP(dummyCodec.plname, "telephone-event") == 0) {
-        numPars[i] = 0;
-      } else if (STR_CASE_CMP(dummyCodec.plname, "cn") == 0) {
-        numPars[i] = 0;
-      } else if (STR_CASE_CMP(dummyCodec.plname, "red") == 0) {
-        numPars[i] = 0;
+        if (_testMode == 1) {
+          printf("%d %s\n", n, sendCodecTmp.plname);
+        }
       }
     }
   } else {
@@ -348,9 +333,9 @@
 
   _receiver.testMode = _testMode;
 
-  //loop over all codecs:
+  // Loop over all mono codecs:
   for (int codeId = 0; codeId < numCodecs; codeId++) {
-    //only encode using real encoders, not telephone-event anc cn
+    // Only encode using real mono encoders, not telephone-event and cng.
     for (int loopPars = 1; loopPars <= numPars[codeId]; loopPars++) {
       if (_testMode == 1) {
         printf("\n");