| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |    2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 
|    3  * |    3  * | 
|    4  *  Use of this source code is governed by a BSD-style license |    4  *  Use of this source code is governed by a BSD-style license | 
|    5  *  that can be found in the LICENSE file in the root of the source |    5  *  that can be found in the LICENSE file in the root of the source | 
|    6  *  tree. An additional intellectual property rights grant can be found |    6  *  tree. An additional intellectual property rights grant can be found | 
|    7  *  in the file PATENTS.  All contributing project authors may |    7  *  in the file PATENTS.  All contributing project authors may | 
|    8  *  be found in the AUTHORS file in the root of the source tree. |    8  *  be found in the AUTHORS file in the root of the source tree. | 
|    9  */ |    9  */ | 
|   10  |   10  | 
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  164   // Create and initialize two ACMs, one for each side of a one-to-one call. |  164   // Create and initialize two ACMs, one for each side of a one-to-one call. | 
|  165   ASSERT_TRUE((acm_a_.get() != NULL) && (acm_b_.get() != NULL)); |  165   ASSERT_TRUE((acm_a_.get() != NULL) && (acm_b_.get() != NULL)); | 
|  166   EXPECT_EQ(0, acm_a_->InitializeReceiver()); |  166   EXPECT_EQ(0, acm_a_->InitializeReceiver()); | 
|  167   EXPECT_EQ(0, acm_b_->InitializeReceiver()); |  167   EXPECT_EQ(0, acm_b_->InitializeReceiver()); | 
|  168  |  168  | 
|  169   // Register all available codes as receiving codecs. |  169   // Register all available codes as receiving codecs. | 
|  170   uint8_t num_encoders = acm_a_->NumberOfCodecs(); |  170   uint8_t num_encoders = acm_a_->NumberOfCodecs(); | 
|  171   CodecInst my_codec_param; |  171   CodecInst my_codec_param; | 
|  172   for (uint8_t n = 0; n < num_encoders; n++) { |  172   for (uint8_t n = 0; n < num_encoders; n++) { | 
|  173     EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param)); |  173     EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param)); | 
|  174     EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(my_codec_param)); |  174     EXPECT_EQ(true, acm_b_->RegisterReceiveCodec( | 
 |  175                         my_codec_param.pltype, CodecInstToSdp(my_codec_param))); | 
|  175   } |  176   } | 
|  176  |  177  | 
|  177   // Test that unregister all receive codecs works. |  178   // Test that unregister all receive codecs works. | 
|  178   for (uint8_t n = 0; n < num_encoders; n++) { |  179   for (uint8_t n = 0; n < num_encoders; n++) { | 
|  179     EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param)); |  180     EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param)); | 
|  180     EXPECT_EQ(0, acm_b_->UnregisterReceiveCodec(my_codec_param.pltype)); |  181     EXPECT_EQ(0, acm_b_->UnregisterReceiveCodec(my_codec_param.pltype)); | 
|  181   } |  182   } | 
|  182  |  183  | 
|  183   // Register all available codes as receiving codecs once more. |  184   // Register all available codes as receiving codecs once more. | 
|  184   for (uint8_t n = 0; n < num_encoders; n++) { |  185   for (uint8_t n = 0; n < num_encoders; n++) { | 
|  185     EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param)); |  186     EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param)); | 
|  186     EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(my_codec_param)); |  187     EXPECT_EQ(true, acm_b_->RegisterReceiveCodec( | 
 |  188                         my_codec_param.pltype, CodecInstToSdp(my_codec_param))); | 
|  187   } |  189   } | 
|  188  |  190  | 
|  189   // Create and connect the channel. |  191   // Create and connect the channel. | 
|  190   channel_a2b_ = new TestPackStereo; |  192   channel_a2b_ = new TestPackStereo; | 
|  191   EXPECT_EQ(0, acm_a_->RegisterTransportCallback(channel_a2b_)); |  193   EXPECT_EQ(0, acm_a_->RegisterTransportCallback(channel_a2b_)); | 
|  192   channel_a2b_->RegisterReceiverACM(acm_b_.get()); |  194   channel_a2b_->RegisterReceiverACM(acm_b_.get()); | 
|  193  |  195  | 
|  194   // Start with setting VAD/DTX, before we know we will send stereo. |  196   // Start with setting VAD/DTX, before we know we will send stereo. | 
|  195   // Continue with setting a stereo codec as send codec and verify that |  197   // Continue with setting a stereo codec as send codec and verify that | 
|  196   // VAD/DTX gets turned off. |  198   // VAD/DTX gets turned off. | 
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  590   test_cntr_++; |  592   test_cntr_++; | 
|  591   OpenOutFile(test_cntr_); |  593   OpenOutFile(test_cntr_); | 
|  592   // Encode and decode in mono. |  594   // Encode and decode in mono. | 
|  593   RegisterSendCodec('A', codec_opus, 48000, 32000, 960, codec_channels, |  595   RegisterSendCodec('A', codec_opus, 48000, 32000, 960, codec_channels, | 
|  594       opus_pltype_); |  596       opus_pltype_); | 
|  595   CodecInst opus_codec_param; |  597   CodecInst opus_codec_param; | 
|  596   for (uint8_t n = 0; n < num_encoders; n++) { |  598   for (uint8_t n = 0; n < num_encoders; n++) { | 
|  597     EXPECT_EQ(0, acm_b_->Codec(n, &opus_codec_param)); |  599     EXPECT_EQ(0, acm_b_->Codec(n, &opus_codec_param)); | 
|  598     if (!strcmp(opus_codec_param.plname, "opus")) { |  600     if (!strcmp(opus_codec_param.plname, "opus")) { | 
|  599       opus_codec_param.channels = 1; |  601       opus_codec_param.channels = 1; | 
|  600       EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(opus_codec_param)); |  602       EXPECT_EQ(true, | 
 |  603                 acm_b_->RegisterReceiveCodec(opus_codec_param.pltype, | 
 |  604                                              CodecInstToSdp(opus_codec_param))); | 
|  601       break; |  605       break; | 
|  602     } |  606     } | 
|  603   } |  607   } | 
|  604   Run(channel_a2b_, audio_channels, codec_channels); |  608   Run(channel_a2b_, audio_channels, codec_channels); | 
|  605  |  609  | 
|  606   // Encode in stereo, decode in mono. |  610   // Encode in stereo, decode in mono. | 
|  607   RegisterSendCodec('A', codec_opus, 48000, 32000, 960, 2, opus_pltype_); |  611   RegisterSendCodec('A', codec_opus, 48000, 32000, 960, 2, opus_pltype_); | 
|  608   Run(channel_a2b_, audio_channels, codec_channels); |  612   Run(channel_a2b_, audio_channels, codec_channels); | 
|  609  |  613  | 
|  610   out_file_.Close(); |  614   out_file_.Close(); | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
|  623   out_file_.Close(); |  627   out_file_.Close(); | 
|  624   // Decode in stereo. |  628   // Decode in stereo. | 
|  625   test_cntr_++; |  629   test_cntr_++; | 
|  626   OpenOutFile(test_cntr_); |  630   OpenOutFile(test_cntr_); | 
|  627   if (test_mode_ != 0) { |  631   if (test_mode_ != 0) { | 
|  628     // Print out codec and settings |  632     // Print out codec and settings | 
|  629     printf("Test number: %d\nCodec: Opus Freq: 48000 Rate :32000 PackSize: 960" |  633     printf("Test number: %d\nCodec: Opus Freq: 48000 Rate :32000 PackSize: 960" | 
|  630         " Decode: stereo\n", test_cntr_); |  634         " Decode: stereo\n", test_cntr_); | 
|  631   } |  635   } | 
|  632   opus_codec_param.channels = 2; |  636   opus_codec_param.channels = 2; | 
|  633   EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(opus_codec_param)); |  637   EXPECT_EQ(true, | 
 |  638             acm_b_->RegisterReceiveCodec(opus_codec_param.pltype, | 
 |  639                                          CodecInstToSdp(opus_codec_param))); | 
|  634   Run(channel_a2b_, audio_channels, 2); |  640   Run(channel_a2b_, audio_channels, 2); | 
|  635   out_file_.Close(); |  641   out_file_.Close(); | 
|  636   // Decode in mono. |  642   // Decode in mono. | 
|  637   test_cntr_++; |  643   test_cntr_++; | 
|  638   OpenOutFile(test_cntr_); |  644   OpenOutFile(test_cntr_); | 
|  639   if (test_mode_ != 0) { |  645   if (test_mode_ != 0) { | 
|  640     // Print out codec and settings |  646     // Print out codec and settings | 
|  641     printf("Test number: %d\nCodec: Opus Freq: 48000 Rate :32000 PackSize: 960" |  647     printf("Test number: %d\nCodec: Opus Freq: 48000 Rate :32000 PackSize: 960" | 
|  642         " Decode: mono\n", test_cntr_); |  648         " Decode: mono\n", test_cntr_); | 
|  643   } |  649   } | 
|  644   opus_codec_param.channels = 1; |  650   opus_codec_param.channels = 1; | 
|  645   EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(opus_codec_param)); |  651   EXPECT_EQ(true, | 
 |  652             acm_b_->RegisterReceiveCodec(opus_codec_param.pltype, | 
 |  653                                          CodecInstToSdp(opus_codec_param))); | 
|  646   Run(channel_a2b_, audio_channels, codec_channels); |  654   Run(channel_a2b_, audio_channels, codec_channels); | 
|  647   out_file_.Close(); |  655   out_file_.Close(); | 
|  648  |  656  | 
|  649 #endif |  657 #endif | 
|  650  |  658  | 
|  651   // Print out which codecs were tested, and which were not, in the run. |  659   // Print out which codecs were tested, and which were not, in the run. | 
|  652   if (test_mode_ != 0) { |  660   if (test_mode_ != 0) { | 
|  653     printf("\nThe following codecs was INCLUDED in the test:\n"); |  661     printf("\nThe following codecs was INCLUDED in the test:\n"); | 
|  654 #ifdef WEBRTC_CODEC_G722 |  662 #ifdef WEBRTC_CODEC_G722 | 
|  655     printf("   G.722\n"); |  663     printf("   G.722\n"); | 
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  837     printf("%s -> ", send_codec->plname); |  845     printf("%s -> ", send_codec->plname); | 
|  838   } |  846   } | 
|  839   CodecInst receive_codec; |  847   CodecInst receive_codec; | 
|  840   acm_b_->ReceiveCodec(&receive_codec); |  848   acm_b_->ReceiveCodec(&receive_codec); | 
|  841   if (test_mode_ != 0) { |  849   if (test_mode_ != 0) { | 
|  842     printf("%s\n", receive_codec.plname); |  850     printf("%s\n", receive_codec.plname); | 
|  843   } |  851   } | 
|  844 } |  852 } | 
|  845  |  853  | 
|  846 }  // namespace webrtc |  854 }  // namespace webrtc | 
| OLD | NEW |