andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
andrew@webrtc.org | 143ce52 | 2013-01-02 16:06:39 +0000 | [diff] [blame] | 11 | #include "webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h" |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 12 | |
minyue@webrtc.org | 0de0049 | 2013-09-30 08:43:50 +0000 | [diff] [blame^] | 13 | #include "gflags/gflags.h" |
| 14 | #include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h" |
andrew@webrtc.org | 143ce52 | 2013-01-02 16:06:39 +0000 | [diff] [blame] | 15 | #include "webrtc/system_wrappers/interface/sleep.h" |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 16 | |
minyue@webrtc.org | 0de0049 | 2013-09-30 08:43:50 +0000 | [diff] [blame^] | 17 | DECLARE_bool(use_acm_version_2); |
| 18 | |
| 19 | BeforeInitializationFixture::BeforeInitializationFixture() { |
| 20 | // TODO(minyue): Remove when the old ACM is removed (latest 2014-04-01). |
| 21 | config_.Set<webrtc::AudioCodingModuleFactory>(FLAGS_use_acm_version_2 ? |
| 22 | new webrtc::NewAudioCodingModuleFactory() : |
| 23 | new webrtc::AudioCodingModuleFactory()); |
| 24 | voice_engine_ = webrtc::VoiceEngine::Create(config_); |
| 25 | |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 26 | EXPECT_TRUE(voice_engine_ != NULL); |
| 27 | |
| 28 | voe_base_ = webrtc::VoEBase::GetInterface(voice_engine_); |
| 29 | voe_codec_ = webrtc::VoECodec::GetInterface(voice_engine_); |
| 30 | voe_volume_control_ = webrtc::VoEVolumeControl::GetInterface(voice_engine_); |
| 31 | voe_dtmf_ = webrtc::VoEDtmf::GetInterface(voice_engine_); |
| 32 | voe_rtp_rtcp_ = webrtc::VoERTP_RTCP::GetInterface(voice_engine_); |
| 33 | voe_apm_ = webrtc::VoEAudioProcessing::GetInterface(voice_engine_); |
| 34 | voe_network_ = webrtc::VoENetwork::GetInterface(voice_engine_); |
| 35 | voe_file_ = webrtc::VoEFile::GetInterface(voice_engine_); |
| 36 | voe_vsync_ = webrtc::VoEVideoSync::GetInterface(voice_engine_); |
| 37 | voe_encrypt_ = webrtc::VoEEncryption::GetInterface(voice_engine_); |
| 38 | voe_hardware_ = webrtc::VoEHardware::GetInterface(voice_engine_); |
| 39 | voe_xmedia_ = webrtc::VoEExternalMedia::GetInterface(voice_engine_); |
| 40 | voe_call_report_ = webrtc::VoECallReport::GetInterface(voice_engine_); |
| 41 | voe_neteq_stats_ = webrtc::VoENetEqStats::GetInterface(voice_engine_); |
| 42 | } |
| 43 | |
| 44 | BeforeInitializationFixture::~BeforeInitializationFixture() { |
| 45 | voe_base_->Release(); |
| 46 | voe_codec_->Release(); |
| 47 | voe_volume_control_->Release(); |
| 48 | voe_dtmf_->Release(); |
| 49 | voe_rtp_rtcp_->Release(); |
| 50 | voe_apm_->Release(); |
| 51 | voe_network_->Release(); |
| 52 | voe_file_->Release(); |
| 53 | voe_vsync_->Release(); |
| 54 | voe_encrypt_->Release(); |
| 55 | voe_hardware_->Release(); |
| 56 | voe_xmedia_->Release(); |
| 57 | voe_call_report_->Release(); |
| 58 | voe_neteq_stats_->Release(); |
| 59 | |
| 60 | EXPECT_TRUE(webrtc::VoiceEngine::Delete(voice_engine_)); |
| 61 | } |
| 62 | |
| 63 | void BeforeInitializationFixture::Sleep(long milliseconds) { |
andrew@webrtc.org | 143ce52 | 2013-01-02 16:06:39 +0000 | [diff] [blame] | 64 | webrtc::SleepMs(milliseconds); |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 65 | } |