| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
| 11 #include <stdio.h> | 11 #include <stdio.h> |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 | 14 |
| 15 #include "gflags/gflags.h" | 15 #include "gflags/gflags.h" |
| 16 #include "webrtc/common_types.h" | 16 #include "webrtc/common_types.h" |
| 17 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" |
| 17 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 18 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
| 18 #include "webrtc/modules/audio_coding/test/Channel.h" | 19 #include "webrtc/modules/audio_coding/test/Channel.h" |
| 19 #include "webrtc/modules/audio_coding/test/PCMFile.h" | 20 #include "webrtc/modules/audio_coding/test/PCMFile.h" |
| 20 #include "webrtc/modules/include/module_common_types.h" | 21 #include "webrtc/modules/include/module_common_types.h" |
| 21 #include "webrtc/system_wrappers/include/clock.h" | 22 #include "webrtc/system_wrappers/include/clock.h" |
| 22 #include "webrtc/test/gtest.h" | 23 #include "webrtc/test/gtest.h" |
| 23 #include "webrtc/test/testsupport/fileutils.h" | 24 #include "webrtc/test/testsupport/fileutils.h" |
| 24 | 25 |
| 25 // Codec. | 26 // Codec. |
| 26 DEFINE_string(codec, "opus", "Codec Name"); | 27 DEFINE_string(codec, "opus", "Codec Name"); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ASSERT_TRUE(playout_timing_fid_ != NULL); | 88 ASSERT_TRUE(playout_timing_fid_ != NULL); |
| 88 | 89 |
| 89 next_receive_ts_ = ReceiveTimestamp(); | 90 next_receive_ts_ = ReceiveTimestamp(); |
| 90 | 91 |
| 91 CodecInst codec; | 92 CodecInst codec; |
| 92 ASSERT_EQ(0, AudioCodingModule::Codec(FLAGS_codec.c_str(), &codec, | 93 ASSERT_EQ(0, AudioCodingModule::Codec(FLAGS_codec.c_str(), &codec, |
| 93 FLAGS_codec_sample_rate_hz, | 94 FLAGS_codec_sample_rate_hz, |
| 94 FLAGS_codec_channels)); | 95 FLAGS_codec_channels)); |
| 95 ASSERT_EQ(0, receive_acm_->InitializeReceiver()); | 96 ASSERT_EQ(0, receive_acm_->InitializeReceiver()); |
| 96 ASSERT_EQ(0, send_acm_->RegisterSendCodec(codec)); | 97 ASSERT_EQ(0, send_acm_->RegisterSendCodec(codec)); |
| 97 ASSERT_EQ(0, receive_acm_->RegisterReceiveCodec(codec)); | 98 ASSERT_EQ(true, receive_acm_->RegisterReceiveCodec(codec.pltype, |
| 99 CodecInstToSdp(codec))); |
| 98 | 100 |
| 99 // Set codec-dependent parameters. | 101 // Set codec-dependent parameters. |
| 100 samples_in_1ms_ = codec.plfreq / 1000; | 102 samples_in_1ms_ = codec.plfreq / 1000; |
| 101 num_10ms_in_codec_frame_ = codec.pacsize / (codec.plfreq / 100); | 103 num_10ms_in_codec_frame_ = codec.pacsize / (codec.plfreq / 100); |
| 102 | 104 |
| 103 channel_->RegisterReceiverACM(receive_acm_.get()); | 105 channel_->RegisterReceiverACM(receive_acm_.get()); |
| 104 send_acm_->RegisterTransportCallback(channel_); | 106 send_acm_->RegisterTransportCallback(channel_); |
| 105 | 107 |
| 106 if (FLAGS_input.size() == 0) { | 108 if (FLAGS_input.size() == 0) { |
| 107 std::string file_name = test::ResourcePath("audio_coding/testfile32kHz", | 109 std::string file_name = test::ResourcePath("audio_coding/testfile32kHz", |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 if (delay_log != NULL) { | 303 if (delay_log != NULL) { |
| 302 fprintf(delay_log, "%3d %3d\n", optimal_delay_ms, current_delay_ms); | 304 fprintf(delay_log, "%3d %3d\n", optimal_delay_ms, current_delay_ms); |
| 303 } | 305 } |
| 304 } | 306 } |
| 305 } | 307 } |
| 306 std::cout << std::endl; | 308 std::cout << std::endl; |
| 307 test.TearDown(); | 309 test.TearDown(); |
| 308 if (delay_log != NULL) | 310 if (delay_log != NULL) |
| 309 fclose(delay_log); | 311 fclose(delay_log); |
| 310 } | 312 } |
| OLD | NEW |