blob: 9dd0b0f77ae0440a98b4523c0e76b67958c4bc58 [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +00001/*
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.org143ce522013-01-02 16:06:39 +000011#include "webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h"
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000012
minyue@webrtc.org0de00492013-09-30 08:43:50 +000013#include "gflags/gflags.h"
14#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
andrew@webrtc.org143ce522013-01-02 16:06:39 +000015#include "webrtc/system_wrappers/interface/sleep.h"
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000016
minyue@webrtc.org0de00492013-09-30 08:43:50 +000017DECLARE_bool(use_acm_version_2);
18
19BeforeInitializationFixture::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.orgb015cbe2012-10-22 18:19:23 +000026 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
44BeforeInitializationFixture::~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
63void BeforeInitializationFixture::Sleep(long milliseconds) {
andrew@webrtc.org143ce522013-01-02 16:06:39 +000064 webrtc::SleepMs(milliseconds);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000065}