Adding three frame sizes to Opus

Adding support for 10, 40 and 60 ms packet sizes for Opus.

BUG=issue1015

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3454 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc b/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc
index d4d74c2..5a59053 100644
--- a/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc
+++ b/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc
@@ -624,19 +624,19 @@
   test_count_++;
   OpenOutFile(test_count_);
   char codec_opus[] = "OPUS";
-  RegisterSendCodec('A', codec_opus, 48000, 6000, 960, -1);
+  RegisterSendCodec('A', codec_opus, 48000, 6000, 480, -1);
   Run(channel_a_to_b_);
-  RegisterSendCodec('A', codec_opus, 48000, 20000, 960, -1);
+  RegisterSendCodec('A', codec_opus, 48000, 20000, 480*2, -1);
   Run(channel_a_to_b_);
-  RegisterSendCodec('A', codec_opus, 48000, 32000, 960, -1);
+  RegisterSendCodec('A', codec_opus, 48000, 32000, 480*4, -1);
   Run(channel_a_to_b_);
-  RegisterSendCodec('A', codec_opus, 48000, 48000, 960, -1);
+  RegisterSendCodec('A', codec_opus, 48000, 48000, 480, -1);
   Run(channel_a_to_b_);
-  RegisterSendCodec('A', codec_opus, 48000, 64000, 960, -1);
+  RegisterSendCodec('A', codec_opus, 48000, 64000, 480*4, -1);
   Run(channel_a_to_b_);
-  RegisterSendCodec('A', codec_opus, 48000, 96000, 960, -1);
+  RegisterSendCodec('A', codec_opus, 48000, 96000, 480*6, -1);
   Run(channel_a_to_b_);
-  RegisterSendCodec('A', codec_opus, 48000, 500000, 960, -1);
+  RegisterSendCodec('A', codec_opus, 48000, 500000, 480*2, -1);
   Run(channel_a_to_b_);
   outfile_b_.Close();
 #endif
diff --git a/webrtc/modules/audio_coding/main/test/TestStereo.cc b/webrtc/modules/audio_coding/main/test/TestStereo.cc
index 3a4b652..52508e2 100644
--- a/webrtc/modules/audio_coding/main/test/TestStereo.cc
+++ b/webrtc/modules/audio_coding/main/test/TestStereo.cc
@@ -230,7 +230,7 @@
   EXPECT_EQ(0, acm_a_->VAD(dtx, vad, vad_mode));
   EXPECT_FALSE(dtx);
   EXPECT_FALSE(vad);
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("\n");
   }
 
@@ -243,7 +243,7 @@
   // All codecs are tested for all allowed sampling frequencies, rates and
   // packet sizes.
 #ifdef WEBRTC_CODEC_G722
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===========================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-stereo\n");
@@ -273,7 +273,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_PCM16
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===========================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-stereo\n");
@@ -296,7 +296,7 @@
   Run(channel_a2b_, audio_channels, codec_channels);
   out_file_.Close();
 
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===========================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-stereo\n");
@@ -317,7 +317,7 @@
   Run(channel_a2b_, audio_channels, codec_channels);
   out_file_.Close();
 
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===========================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-stereo\n");
@@ -412,7 +412,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_CELT
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===========================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-stereo\n");
@@ -435,7 +435,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_OPUS
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===========================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-stereo\n");
@@ -445,11 +445,26 @@
   codec_channels = 2;
   test_cntr_++;
   OpenOutFile(test_cntr_);
+
   char codec_opus[] = "opus";
-  RegisterSendCodec('A', codec_opus, 48000, 40000, 960, codec_channels,
+  // Run Opus with 10 ms frame size.
+  RegisterSendCodec('A', codec_opus, 48000, 64000, 480, codec_channels,
                     opus_pltype_);
   Run(channel_a2b_, audio_channels, codec_channels);
-  RegisterSendCodec('A', codec_opus, 48000, 64000, 960, codec_channels,
+  // Run Opus with 20 ms frame size.
+  RegisterSendCodec('A', codec_opus, 48000, 64000, 480*2, codec_channels,
+                    opus_pltype_);
+  Run(channel_a2b_, audio_channels, codec_channels);
+  // Run Opus with 40 ms frame size.
+  RegisterSendCodec('A', codec_opus, 48000, 64000, 480*4, codec_channels,
+                    opus_pltype_);
+  Run(channel_a2b_, audio_channels, codec_channels);
+  // Run Opus with 60 ms frame size.
+  RegisterSendCodec('A', codec_opus, 48000, 64000, 480*6, codec_channels,
+                    opus_pltype_);
+  Run(channel_a2b_, audio_channels, codec_channels);
+  // Run Opus with 20 ms frame size and different bitrates.
+  RegisterSendCodec('A', codec_opus, 48000, 40000, 960, codec_channels,
                     opus_pltype_);
   Run(channel_a2b_, audio_channels, codec_channels);
   RegisterSendCodec('A', codec_opus, 48000, 510000, 960, codec_channels,
@@ -464,7 +479,7 @@
   codec_channels = 2;
 
 #ifdef WEBRTC_CODEC_G722
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Mono-to-stereo\n");
@@ -478,7 +493,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_PCM16
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Mono-to-stereo\n");
@@ -490,7 +505,7 @@
                     l16_8khz_pltype_);
   Run(channel_a2b_, audio_channels, codec_channels);
   out_file_.Close();
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Mono-to-stereo\n");
@@ -501,7 +516,7 @@
                     l16_16khz_pltype_);
   Run(channel_a2b_, audio_channels, codec_channels);
   out_file_.Close();
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Mono-to-stereo\n");
@@ -514,7 +529,7 @@
   out_file_.Close();
 #endif
 #ifdef PCMA_AND_PCMU
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Mono-to-stereo\n");
@@ -531,7 +546,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_CELT
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Mono-to-stereo\n");
@@ -545,7 +560,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_OPUS
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Mono-to-stereo\n");
@@ -574,7 +589,7 @@
 
 #ifdef WEBRTC_CODEC_G722
   // Run stereo audio and mono codec.
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-mono\n");
@@ -596,7 +611,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_PCM16
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-mono\n");
@@ -607,7 +622,7 @@
                     l16_8khz_pltype_);
   Run(channel_a2b_, audio_channels, codec_channels);
   out_file_.Close();
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-mono\n");
@@ -618,7 +633,7 @@
                     l16_16khz_pltype_);
   Run(channel_a2b_, audio_channels, codec_channels);
   out_file_.Close();
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
      printf("==============================================================\n");
      printf("Test number: %d\n",test_cntr_ + 1);
      printf("Test type: Stereo-to-mono\n");
@@ -631,7 +646,7 @@
    out_file_.Close();
 #endif
 #ifdef PCMA_AND_PCMU
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-mono\n");
@@ -647,7 +662,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_CELT
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-mono\n");
@@ -660,7 +675,7 @@
   out_file_.Close();
 #endif
 #ifdef WEBRTC_CODEC_OPUS
-  if(test_mode_ != 0) {
+  if (test_mode_ != 0) {
     printf("===============================================================\n");
     printf("Test number: %d\n",test_cntr_ + 1);
     printf("Test type: Stereo-to-mono\n");