| 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 |
| 11 // Sets up a simple VoiceEngine loopback call with the default audio devices | 11 // Sets up a simple VoiceEngine loopback call with the default audio devices |
| 12 // and runs forever. Some parameters can be configured through command-line | 12 // and runs forever. Some parameters can be configured through command-line |
| 13 // flags. | 13 // flags. |
| 14 | 14 |
| 15 #include <memory> |
| 16 |
| 15 #include "gflags/gflags.h" | 17 #include "gflags/gflags.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 19 |
| 18 #include "webrtc/base/scoped_ptr.h" | |
| 19 #include "webrtc/test/channel_transport/channel_transport.h" | 20 #include "webrtc/test/channel_transport/channel_transport.h" |
| 20 #include "webrtc/voice_engine/include/voe_audio_processing.h" | 21 #include "webrtc/voice_engine/include/voe_audio_processing.h" |
| 21 #include "webrtc/voice_engine/include/voe_base.h" | 22 #include "webrtc/voice_engine/include/voe_base.h" |
| 22 #include "webrtc/voice_engine/include/voe_codec.h" | 23 #include "webrtc/voice_engine/include/voe_codec.h" |
| 23 #include "webrtc/voice_engine/include/voe_hardware.h" | 24 #include "webrtc/voice_engine/include/voe_hardware.h" |
| 24 #include "webrtc/voice_engine/include/voe_network.h" | 25 #include "webrtc/voice_engine/include/voe_network.h" |
| 25 | 26 |
| 26 DEFINE_string(render, "render", "render device name"); | 27 DEFINE_string(render, "render", "render device name"); |
| 27 DEFINE_string(codec, "ISAC", "codec name"); | 28 DEFINE_string(codec, "ISAC", "codec name"); |
| 28 DEFINE_int32(rate, 16000, "codec sample rate in Hz"); | 29 DEFINE_int32(rate, 16000, "codec sample rate in Hz"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 ASSERT_TRUE(codec != NULL); | 42 ASSERT_TRUE(codec != NULL); |
| 42 VoEHardware* hardware = VoEHardware::GetInterface(voe); | 43 VoEHardware* hardware = VoEHardware::GetInterface(voe); |
| 43 ASSERT_TRUE(hardware != NULL); | 44 ASSERT_TRUE(hardware != NULL); |
| 44 VoENetwork* network = VoENetwork::GetInterface(voe); | 45 VoENetwork* network = VoENetwork::GetInterface(voe); |
| 45 ASSERT_TRUE(network != NULL); | 46 ASSERT_TRUE(network != NULL); |
| 46 | 47 |
| 47 ASSERT_EQ(0, base->Init()); | 48 ASSERT_EQ(0, base->Init()); |
| 48 int channel = base->CreateChannel(); | 49 int channel = base->CreateChannel(); |
| 49 ASSERT_NE(-1, channel); | 50 ASSERT_NE(-1, channel); |
| 50 | 51 |
| 51 rtc::scoped_ptr<VoiceChannelTransport> voice_channel_transport( | 52 std::unique_ptr<VoiceChannelTransport> voice_channel_transport( |
| 52 new VoiceChannelTransport(network, channel)); | 53 new VoiceChannelTransport(network, channel)); |
| 53 | 54 |
| 54 ASSERT_EQ(0, voice_channel_transport->SetSendDestination("127.0.0.1", 1234)); | 55 ASSERT_EQ(0, voice_channel_transport->SetSendDestination("127.0.0.1", 1234)); |
| 55 ASSERT_EQ(0, voice_channel_transport->SetLocalReceiver(1234)); | 56 ASSERT_EQ(0, voice_channel_transport->SetLocalReceiver(1234)); |
| 56 | 57 |
| 57 CodecInst codec_params = {0}; | 58 CodecInst codec_params = {0}; |
| 58 bool codec_found = false; | 59 bool codec_found = false; |
| 59 for (int i = 0; i < codec->NumOfCodecs(); i++) { | 60 for (int i = 0; i < codec->NumOfCodecs(); i++) { |
| 60 ASSERT_EQ(0, codec->GetCodec(i, codec_params)); | 61 ASSERT_EQ(0, codec->GetCodec(i, codec_params)); |
| 61 if (FLAGS_codec.compare(codec_params.plname) == 0 && | 62 if (FLAGS_codec.compare(codec_params.plname) == 0 && |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 | 102 |
| 102 } // namespace test | 103 } // namespace test |
| 103 } // namespace webrtc | 104 } // namespace webrtc |
| 104 | 105 |
| 105 int main(int argc, char** argv) { | 106 int main(int argc, char** argv) { |
| 106 google::ParseCommandLineFlags(&argc, &argv, true); | 107 google::ParseCommandLineFlags(&argc, &argv, true); |
| 107 webrtc::test::RunHarness(); | 108 webrtc::test::RunHarness(); |
| 108 } | 109 } |
| OLD | NEW |