From 719dba7e793cf259882180a30f3880a38ff16f4c Mon Sep 17 00:00:00 2001 From: "phoglund@webrtc.org" Date: Wed, 2 May 2012 07:32:37 +0000 Subject: [PATCH] Further cleaned up voe_standard_test. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/522003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2157 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../fakes/fake_external_transport.cc | 98 ++++++ .../auto_test/fakes/fake_external_transport.h | 46 +++ .../test/auto_test/fakes/fake_media_process.h | 6 +- .../standard/audio_processing_test.cc | 22 +- .../test/auto_test/standard/network_test.cc | 11 +- .../test/auto_test/standard/rtp_rtcp_test.cc | 105 ++++++- .../main/test/auto_test/voe_cpu_test.cc | 8 +- .../main/test/auto_test/voe_extended_test.cc | 224 +++++++------- .../main/test/auto_test/voe_standard_test.cc | 287 +----------------- .../main/test/auto_test/voe_standard_test.h | 104 ------- .../main/test/auto_test/voe_stress_test.cc | 8 +- .../main/test/auto_test/voe_test_interface.h | 38 +-- .../main/test/auto_test/voe_unit_test.cc | 55 ++-- .../main/test/auto_test/voe_unit_test.h | 5 +- .../main/test/voice_engine_tests.gypi | 2 + .../main/test/win_test/WinTestDlg.cc | 8 +- 16 files changed, 443 insertions(+), 584 deletions(-) create mode 100644 src/voice_engine/main/test/auto_test/fakes/fake_external_transport.cc create mode 100644 src/voice_engine/main/test/auto_test/fakes/fake_external_transport.h diff --git a/src/voice_engine/main/test/auto_test/fakes/fake_external_transport.cc b/src/voice_engine/main/test/auto_test/fakes/fake_external_transport.cc new file mode 100644 index 000000000..d1575ca01 --- /dev/null +++ b/src/voice_engine/main/test/auto_test/fakes/fake_external_transport.cc @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "system_wrappers/interface/critical_section_wrapper.h" +#include "system_wrappers/interface/event_wrapper.h" +#include "system_wrappers/interface/thread_wrapper.h" +#include "voice_engine/main/interface/voe_network.h" +#include "voice_engine/main/source/voice_engine_defines.h" +#include "voice_engine/main/test/auto_test/fakes/fake_external_transport.h" + +FakeExternalTransport::FakeExternalTransport(webrtc::VoENetwork* ptr) + : my_network_(ptr), + thread_(NULL), + lock_(NULL), + event_(NULL), + length_(0), + channel_(0), + delay_is_enabled_(0), + delay_time_in_ms_(0) { + const char* thread_name = "external_thread"; + lock_ = webrtc::CriticalSectionWrapper::CreateCriticalSection(); + event_ = webrtc::EventWrapper::Create(); + thread_ = webrtc::ThreadWrapper::CreateThread( + Run, this, webrtc::kHighPriority, thread_name); + if (thread_) { + unsigned int id; + thread_->Start(id); + } +} + +FakeExternalTransport::~FakeExternalTransport() { + if (thread_) { + thread_->SetNotAlive(); + event_->Set(); + if (thread_->Stop()) { + delete thread_; + thread_ = NULL; + delete event_; + event_ = NULL; + delete lock_; + lock_ = NULL; + } + } +} + +bool FakeExternalTransport::Run(void* ptr) { + return static_cast (ptr)->Process(); +} + +bool FakeExternalTransport::Process() { + switch (event_->Wait(500)) { + case webrtc::kEventSignaled: + lock_->Enter(); + my_network_->ReceivedRTPPacket(channel_, packet_buffer_, length_); + lock_->Leave(); + return true; + case webrtc::kEventTimeout: + return true; + case webrtc::kEventError: + break; + } + return true; +} + +int FakeExternalTransport::SendPacket(int channel, const void *data, int len) { + lock_->Enter(); + if (len < 1612) { + memcpy(packet_buffer_, (const unsigned char*) data, len); + length_ = len; + channel_ = channel; + } + lock_->Leave(); + event_->Set(); // Triggers ReceivedRTPPacket() from worker thread. + return len; +} + +int FakeExternalTransport::SendRTCPPacket(int channel, + const void *data, + int len) { + if (delay_is_enabled_) { + Sleep(delay_time_in_ms_); + } + my_network_->ReceivedRTCPPacket(channel, data, len); + return len; +} + +void FakeExternalTransport::SetDelayStatus(bool enable, + unsigned int delayInMs) { + delay_is_enabled_ = enable; + delay_time_in_ms_ = delayInMs; +} diff --git a/src/voice_engine/main/test/auto_test/fakes/fake_external_transport.h b/src/voice_engine/main/test/auto_test/fakes/fake_external_transport.h new file mode 100644 index 000000000..25d34c725 --- /dev/null +++ b/src/voice_engine/main/test/auto_test/fakes/fake_external_transport.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ +#ifndef VOICE_ENGINE_MAIN_TEST_AUTO_TEST_FAKES_FAKE_EXTERNAL_TRANSPORT_H_ +#define VOICE_ENGINE_MAIN_TEST_AUTO_TEST_FAKES_FAKE_EXTERNAL_TRANSPORT_H_ + +#include "common_types.h" + +namespace webrtc { +class CriticalSectionWrapper; +class EventWrapper; +class ThreadWrapper; +class VoENetwork; +} + +class FakeExternalTransport : public webrtc::Transport { + public: + explicit FakeExternalTransport(webrtc::VoENetwork* ptr); + virtual ~FakeExternalTransport(); + int SendPacket(int channel, const void *data, int len); + int SendRTCPPacket(int channel, const void *data, int len); + void SetDelayStatus(bool enabled, unsigned int delayInMs = 100); + + webrtc::VoENetwork* my_network_; + private: + static bool Run(void* ptr); + bool Process(); + private: + webrtc::ThreadWrapper* thread_; + webrtc::CriticalSectionWrapper* lock_; + webrtc::EventWrapper* event_; + private: + unsigned char packet_buffer_[1612]; + int length_; + int channel_; + bool delay_is_enabled_; + int delay_time_in_ms_; +}; + +#endif // VOICE_ENGINE_MAIN_TEST_AUTO_TEST_FAKES_FAKE_EXTERNAL_TRANSPORT_H_ diff --git a/src/voice_engine/main/test/auto_test/fakes/fake_media_process.h b/src/voice_engine/main/test/auto_test/fakes/fake_media_process.h index ee0ebd6d7..9c45129c0 100644 --- a/src/voice_engine/main/test/auto_test/fakes/fake_media_process.h +++ b/src/voice_engine/main/test/auto_test/fakes/fake_media_process.h @@ -7,8 +7,8 @@ * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ -#ifndef FAKE_MEDIA_PROCESS_H_ -#define FAKE_MEDIA_PROCESS_H_ +#ifndef VOICE_ENGINE_MAIN_TEST_AUTO_TEST_FAKE_MEDIA_PROCESS_H_ +#define VOICE_ENGINE_MAIN_TEST_AUTO_TEST_FAKE_MEDIA_PROCESS_H_ #include @@ -41,4 +41,4 @@ class FakeMediaProcess : public webrtc::VoEMediaProcess { int frequency; }; -#endif // FAKE_MEDIA_PROCESS_H_ +#endif // VOICE_ENGINE_MAIN_TEST_AUTO_TEST_FAKE_MEDIA_PROCESS_H_ diff --git a/src/voice_engine/main/test/auto_test/standard/audio_processing_test.cc b/src/voice_engine/main/test/auto_test/standard/audio_processing_test.cc index 719e6c56e..13aa673c1 100644 --- a/src/voice_engine/main/test/auto_test/standard/audio_processing_test.cc +++ b/src/voice_engine/main/test/auto_test/standard/audio_processing_test.cc @@ -11,6 +11,22 @@ #include "after_streaming_fixture.h" #include "voe_standard_test.h" +class RxCallback : public webrtc::VoERxVadCallback { + public: + RxCallback() : + vad_decision(-1) { + } + + virtual void OnRxVad(int, int vadDecision) { + char msg[128]; + sprintf(msg, "RX VAD detected decision %d \n", vadDecision); + TEST_LOG("%s", msg); + vad_decision = vadDecision; + } + + int vad_decision; +}; + class AudioProcessingTest : public AfterStreamingFixture { protected: // Note: Be careful with this one, it is used in the @@ -188,7 +204,7 @@ TEST_F(AudioProcessingTest, ManualTestEcMetrics) { // TODO(phoglund): Reenable below test when it's no longer flaky. TEST_F(AudioProcessingTest, DISABLED_TestVoiceActivityDetectionWithObserver) { - voetest::RxCallback rx_callback; + RxCallback rx_callback; EXPECT_EQ(0, voe_apm_->RegisterRxVadObserver(channel_, rx_callback)); // The extra sleeps are to allow decisions some time to propagate to the @@ -196,12 +212,12 @@ TEST_F(AudioProcessingTest, DISABLED_TestVoiceActivityDetectionWithObserver) { TryDetectingSilence(); Sleep(100); - EXPECT_EQ(0, rx_callback._vadDecision); + EXPECT_EQ(0, rx_callback.vad_decision); TryDetectingSpeechAfterSilence(); Sleep(100); - EXPECT_EQ(1, rx_callback._vadDecision); + EXPECT_EQ(1, rx_callback.vad_decision); EXPECT_EQ(0, voe_apm_->DeRegisterRxVadObserver(channel_)); } diff --git a/src/voice_engine/main/test/auto_test/standard/network_test.cc b/src/voice_engine/main/test/auto_test/standard/network_test.cc index 335fba6b4..2082c7751 100644 --- a/src/voice_engine/main/test/auto_test/standard/network_test.cc +++ b/src/voice_engine/main/test/auto_test/standard/network_test.cc @@ -8,10 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "after_streaming_fixture.h" -#include "mock/mock_voe_observer.h" -#include "mock/mock_voe_connection_observer.h" -#include "voe_test_interface.h" +#include "voice_engine/main/test/auto_test/fakes/fake_external_transport.h" +#include "voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.h" +#include "voice_engine/main/test/auto_test/voe_test_interface.h" +#include "voice_engine/main/interface/mock/mock_voe_connection_observer.h" +#include "voice_engine/main/interface/mock/mock_voe_observer.h" static const int kDefaultRtpPort = 8000; static const int kDefaultRtcpPort = 8001; @@ -181,7 +182,7 @@ TEST_F(NetworkTest, CanSwitchToExternalTransport) { EXPECT_EQ(0, voe_base_->DeleteChannel(channel_)); channel_ = voe_base_->CreateChannel(); - voetest::FakeExternalTransport external_transport(voe_network_); + FakeExternalTransport external_transport(voe_network_); EXPECT_EQ(0, voe_network_->RegisterExternalTransport( channel_, external_transport)); diff --git a/src/voice_engine/main/test/auto_test/standard/rtp_rtcp_test.cc b/src/voice_engine/main/test/auto_test/standard/rtp_rtcp_test.cc index 325ec25b9..8e2021739 100644 --- a/src/voice_engine/main/test/auto_test/standard/rtp_rtcp_test.cc +++ b/src/voice_engine/main/test/auto_test/standard/rtp_rtcp_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -12,6 +12,86 @@ #include "voe_standard_test.h" #include "testsupport/fileutils.h" +class TestRtpObserver : public webrtc::VoERTPObserver { + public: + TestRtpObserver(); + virtual ~TestRtpObserver(); + virtual void OnIncomingCSRCChanged(const int channel, + const unsigned int CSRC, + const bool added); + virtual void OnIncomingSSRCChanged(const int channel, + const unsigned int SSRC); + void Reset(); + public: + unsigned int ssrc_[2]; + unsigned int csrc_[2][2]; // Stores 2 CSRCs for each channel. + bool added_[2][2]; + int size_[2]; +}; + +TestRtpObserver::TestRtpObserver() { + Reset(); +} + +TestRtpObserver::~TestRtpObserver() { +} + +void TestRtpObserver::Reset() { + for (int i = 0; i < 2; i++) { + ssrc_[i] = 0; + csrc_[i][0] = 0; + csrc_[i][1] = 0; + added_[i][0] = false; + added_[i][1] = false; + size_[i] = 0; + } +} + +void TestRtpObserver::OnIncomingCSRCChanged(const int channel, + const unsigned int CSRC, + const bool added) { + char msg[128]; + sprintf(msg, "=> OnIncomingCSRCChanged(channel=%d, CSRC=%u, added=%d)\n", + channel, CSRC, added); + TEST_LOG("%s", msg); + + if (channel > 1) + return; // Not enough memory. + + csrc_[channel][size_[channel]] = CSRC; + added_[channel][size_[channel]] = added; + + size_[channel]++; + if (size_[channel] == 2) + size_[channel] = 0; +} + +void TestRtpObserver::OnIncomingSSRCChanged(const int channel, + const unsigned int SSRC) { + char msg[128]; + sprintf(msg, "\n=> OnIncomingSSRCChanged(channel=%d, SSRC=%u)\n", channel, + SSRC); + TEST_LOG("%s", msg); + + ssrc_[channel] = SSRC; +} + +class RtcpAppHandler : public webrtc::VoERTCPObserver { + public: + void OnApplicationDataReceived(const int channel, + const unsigned char sub_type, + const unsigned int name, + const unsigned char* data, + const unsigned short length_in_bytes); + void Reset(); + ~RtcpAppHandler() {} + unsigned short length_in_bytes_; + unsigned char data_[256]; + unsigned char sub_type_; + unsigned int name_; +}; + + static const char* const RTCP_CNAME = "Whatever"; class RtpRtcpTest : public AfterStreamingFixture { @@ -41,6 +121,23 @@ class RtpRtcpTest : public AfterStreamingFixture { int second_channel_; }; +void RtcpAppHandler::OnApplicationDataReceived( + const int /*channel*/, const unsigned char sub_type, + const unsigned int name, const unsigned char* data, + const unsigned short length_in_bytes) { + length_in_bytes_ = length_in_bytes; + memcpy(data_, &data[0], length_in_bytes); + sub_type_ = sub_type; + name_ = name; +} + +void RtcpAppHandler::Reset() { + length_in_bytes_ = 0; + memset(data_, 0, sizeof(data_)); + sub_type_ = 0; + name_ = 0; +} + TEST_F(RtpRtcpTest, RemoteRtcpCnameHasPropagatedToRemoteSide) { // We need to sleep a bit here for the name to propagate. For instance, // 200 milliseconds is not enough, so we'll go with one second here. @@ -68,7 +165,7 @@ TEST_F(RtpRtcpTest, SSRCPropagatesCorrectly) { } TEST_F(RtpRtcpTest, RtcpApplicationDefinedPacketsCanBeSentAndReceived) { - voetest::RtcpAppHandler rtcp_app_handler; + RtcpAppHandler rtcp_app_handler; EXPECT_EQ(0, voe_rtp_rtcp_->RegisterRTCPObserver( channel_, rtcp_app_handler)); @@ -94,7 +191,7 @@ TEST_F(RtpRtcpTest, RtcpApplicationDefinedPacketsCanBeSentAndReceived) { } TEST_F(RtpRtcpTest, DisabledRtcpObserverDoesNotReceiveData) { - voetest::RtcpAppHandler rtcp_app_handler; + RtcpAppHandler rtcp_app_handler; EXPECT_EQ(0, voe_rtp_rtcp_->RegisterRTCPObserver( channel_, rtcp_app_handler)); @@ -167,7 +264,7 @@ TEST_F(RtpRtcpTest, DISABLED_CanCreateRtpDumpFilesWithoutError) { } TEST_F(RtpRtcpTest, ObserverGetsNotifiedOnSsrcChange) { - voetest::TestRtpObserver rtcp_observer; + TestRtpObserver rtcp_observer; EXPECT_EQ(0, voe_rtp_rtcp_->RegisterRTPObserver( channel_, rtcp_observer)); rtcp_observer.Reset(); diff --git a/src/voice_engine/main/test/auto_test/voe_cpu_test.cc b/src/voice_engine/main/test/auto_test/voe_cpu_test.cc index 051bce96a..14e4a00ec 100644 --- a/src/voice_engine/main/test/auto_test/voe_cpu_test.cc +++ b/src/voice_engine/main/test/auto_test/voe_cpu_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -31,12 +31,6 @@ namespace voetest { return -1; \ } -extern char* GetFilename(char* filename); -extern const char* GetFilename(const char* filename); -extern int GetResource(char* resource, char* dest, int destLen); -extern char* GetResource(char* resource); -extern const char* GetResource(const char* resource); - VoECpuTest::VoECpuTest(VoETestManager& mgr) : _mgr(mgr) { diff --git a/src/voice_engine/main/test/auto_test/voe_extended_test.cc b/src/voice_engine/main/test/auto_test/voe_extended_test.cc index 55db29bd8..ee3e9adb7 100644 --- a/src/voice_engine/main/test/auto_test/voe_extended_test.cc +++ b/src/voice_engine/main/test/auto_test/voe_extended_test.cc @@ -10,15 +10,15 @@ #include #include - #include -#include "critical_section_wrapper.h" -#include "event_wrapper.h" -#include "thread_wrapper.h" -#include "voe_extended_test.h" -#include "../../source/voice_engine_defines.h" // defines build macros +#include "system_wrappers/interface/critical_section_wrapper.h" +#include "system_wrappers/interface/event_wrapper.h" #include "system_wrappers/interface/ref_count.h" +#include "system_wrappers/interface/thread_wrapper.h" +#include "testsupport/fileutils.h" +#include "voice_engine/main/source/voice_engine_defines.h" +#include "voice_engine/main/test/auto_test/voe_extended_test.h" #if defined(_WIN32) #include @@ -53,12 +53,6 @@ extern void* globalJavaVM; extern void* globalContext; #endif -extern char* GetFilename(char* filename); -extern const char* GetFilename(const char* filename); -extern int GetResource(char* resource, char* dest, int destLen); -extern char* GetResource(char* resource); -extern const char* GetResource(const char* resource); - // ---------------------------------------------------------------------------- // External AudioDeviceModule implementation // ---------------------------------------------------------------------------- @@ -106,7 +100,8 @@ int32_t AudioDeviceModuleImpl::Release() { // ---------------------------------------------------------------------------- ExtendedTestTransport::ExtendedTestTransport(VoENetwork* ptr) : - myNetw(ptr), _thread(NULL), _lock(NULL), _event(NULL), _length(0), _channel(0) { + myNetw(ptr), _thread(NULL), _lock(NULL), _event(NULL), _length(0), + _channel(0) { const char* threadName = "voe_extended_test_external_thread"; _lock = CriticalSectionWrapper::CreateCriticalSection(); _event = EventWrapper::Create(); @@ -353,14 +348,14 @@ int VoEExtendedTest::TestBase() { #ifdef _USE_EXTENDED_TRACE_ TEST(SetTraceFileName - SetDebugTraceFileName); ANL(); - TEST_MUSTPASS(VoiceEngine::SetTraceFile(NULL)); MARK(); // don't use these files - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename("" - "VoEBase_trace_dont_use.txt"))); MARK(); + std::string output_path = webrtc::test::OutputPath(); + TEST_MUSTPASS(VoiceEngine::SetTraceFile( + (output_path + "VoEBase_trace_dont_use.txt").c_str())); MARK(); // use these instead TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename("" - "VoEBase_trace.txt"))); MARK(); + (output_path + "VoEBase_trace.txt").c_str())); MARK(); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStream | kTraceStateInfo | kTraceWarning | @@ -1472,7 +1467,7 @@ int VoEExtendedTest::TestBase() { TEST(SetTraceFilter); ANL(); TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename("" - "VoEBase_trace_filter.txt"))); MARK(); + "VoEBase_trace_filter.txt").c_str())); MARK(); SLEEP(100); // Test a few different filters, verify in trace file @@ -1572,7 +1567,8 @@ int VoEExtendedTest::TestCallReport() { } #ifdef _USE_EXTENDED_TRACE_ - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename("VoECallReport_trace.txt"))); + TEST_MUSTPASS(VoiceEngine::SetTraceFile( + GetFilename("VoECallReport_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -1712,7 +1708,8 @@ int VoEExtendedTest::TestCodec() { VoEFile* file = _mgr.FilePtr(); #ifdef _USE_EXTENDED_TRACE_ - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename("VoECodec_trace.txt"))); + TEST_MUSTPASS(VoiceEngine::SetTraceFile( + GetFilename("VoECodec_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -3011,8 +3008,9 @@ int VoEExtendedTest::TestCodec() { TEST_MUSTPASS(voe_base_->StartPlayout(0)); TEST_MUSTPASS(voe_base_->StartSend(0)); TEST_MUSTPASS(voe_base_->StartReceive(0)); + std::string output_path = webrtc::test::OutputPath(); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - 0, GetFilename("audio_long16.pcm"), true , true)); + 0, (output_path + "audio_long16.pcm").c_str(), true , true)); cinst.channels = 1; TEST_LOG("Testing codec: Switch between iSAC-wb and iSAC-swb \n"); TEST_LOG("Testing codec: iSAC wideband \n"); @@ -3075,8 +3073,9 @@ int VoEExtendedTest::TestDtmf() { VoECodec* codec = _mgr.CodecPtr(); VoEVolumeControl* volume = _mgr.VolumeControlPtr(); - //#ifdef _USE_EXTENDED_TRACE_ - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename("VoEDtmf_trace.txt"))); + std::string output_path = webrtc::test::OutputPath(); + TEST_MUSTPASS(VoiceEngine::SetTraceFile( + (output_path + "VoEDtmf_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -3467,7 +3466,7 @@ int VoEExtendedTest::TestEncryption() { #ifdef _USE_EXTENDED_TRACE_ TEST_MUSTPASS(VoiceEngine::SetTraceFile( - GetFilename("VoEEncryption_trace.txt"))); + GetFilename("VoEEncryption_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -3984,7 +3983,7 @@ int VoEExtendedTest::TestExternalMedia() { #ifdef _USE_EXTENDED_TRACE_ TEST_MUSTPASS(VoiceEngine::SetTraceFile( - GetFilename("VoEExternalMedia_trace.txt"))); + GetFilename("VoEExternalMedia_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter( kTraceStateInfo | kTraceStateInfo | kTraceWarning | kTraceError | kTraceCritical | kTraceApiCall | @@ -4101,7 +4100,7 @@ int VoEExtendedTest::TestFile() { #ifdef _USE_EXTENDED_TRACE_ TEST_MUSTPASS(VoiceEngine::SetTraceFile( - GetFilename("VoEFile_trace.txt"))); MARK(); + GetFilename("VoEFile_trace.txt").c_str())); MARK(); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -4131,43 +4130,47 @@ int VoEExtendedTest::TestFile() { ANL(); voe_base_->StopPlayout(0); + std::string output_path = webrtc::test::OutputPath(); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long16.pcm")));MARK(); + 0, (output_path + "audio_long16.pcm").c_str()));MARK(); voe_base_->StartPlayout(0); MARK(); // file should be mixed in and played out SLEEP(dT); TEST_MUSTPASS(!file->StartPlayingFileLocally( - 0, GetResource("audio_long16.pcm"))); + 0, (output_path + "audio_long16.pcm").c_str())); MARK(); // should fail (must stop first) TEST_MUSTPASS(voe_base_->LastError() != VE_ALREADY_PLAYING); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long16.pcm"))); + 0, (output_path + "audio_long16.pcm").c_str())); MARK(); // should work again (restarts file) SLEEP(dT); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long16.pcm"), false, kFileFormatPcm16kHzFile)); + 0, (output_path + "audio_long16.pcm").c_str(), + false, kFileFormatPcm16kHzFile)); MARK(); SLEEP(dT); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long8.pcm"), false, kFileFormatPcm8kHzFile)); + 0, (output_path + "audio_long8.pcm").c_str(), + false, kFileFormatPcm8kHzFile)); MARK(); SLEEP(dT); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long16.wav"), false, kFileFormatPcm8kHzFile)); + 0, (output_path + "audio_long16.wav").c_str(), + false, kFileFormatPcm8kHzFile)); MARK(); SLEEP(dT); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long8mulaw.wav"), false, + 0, (output_path + "audio_long8mulaw.wav").c_str(), false, kFileFormatPcm8kHzFile)); MARK(); SLEEP(dT); @@ -4176,34 +4179,34 @@ int VoEExtendedTest::TestFile() { // TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); // TEST_MUSTPASS(file->StartPlayingFileLocally( - // 0, GetResource("audio_short16.pcm"), true, + // 0, (output_path + "audio_short16.pcm").c_str(), true, // kFileFormatPcm16kHzFile)); MARK(); // loop TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_short16.pcm"), false, + 0, (output_path + "audio_short16.pcm").c_str(), false, kFileFormatPcm16kHzFile, 1.0, 0, 2000)); MARK(); // play segment SLEEP(2500); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); TEST_MUSTPASS(!file->StartPlayingFileLocally( - 0, GetResource("audio_short16.pcm"), false, + 0, (output_path + "audio_short16.pcm").c_str(), false, kFileFormatPcm16kHzFile, 1.0, 2000, 1000)); MARK(); // invalid segment TEST_MUSTPASS(voe_base_->LastError() != VE_BAD_FILE); TEST_MUSTPASS(!file->StartPlayingFileLocally( - 0, GetResource("audio_short16.pcm"), false, + 0, (output_path + "audio_short16.pcm").c_str(), false, kFileFormatPcm16kHzFile, 1.0, 21000, 30000)); MARK(); // start > file size TEST_MUSTPASS(voe_base_->LastError() != VE_BAD_FILE); TEST_MUSTPASS(!file->StartPlayingFileLocally( - 0, GetResource("audio_short16.pcm"), false, + 0, (output_path + "audio_short16.pcm").c_str(), false, kFileFormatPcm16kHzFile, 1.0, 100, 100)); MARK(); // invalid segment TEST_MUSTPASS(voe_base_->LastError() != VE_BAD_FILE); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long16.pcm"))); + 0, (output_path + "audio_long16.pcm").c_str())); MARK(); // should work again (restarts file) TEST_MUSTPASS(file->StopPlayingFileLocally(0)); MARK(); @@ -4220,7 +4223,7 @@ int VoEExtendedTest::TestFile() { TEST_MUSTPASS(0 != file->IsPlayingFileLocally(0)); MARK(); // inactive TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long16.pcm"))); + 0, (output_path + "audio_long16.pcm").c_str())); MARK(); TEST_MUSTPASS(1 != file->IsPlayingFileLocally(0)); MARK(); // active @@ -4315,27 +4318,27 @@ int VoEExtendedTest::TestFile() { " 3 in 8 kHz no mix, 4 in 8 kHz mix \n"); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - ch, GetResource("audio_long16.pcm"))); + ch, (output_path + "audio_long16.pcm").c_str())); MARK(); // don't mix SLEEP(2000); TEST_MUSTPASS(file->StopPlayingFileAsMicrophone(ch)); MARK(); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - ch, GetResource("audio_long16.wav"), false, true, + ch, (output_path + "audio_long16.wav").c_str(), false, true, kFileFormatWavFile)); MARK(); // mix SLEEP(2000); TEST_MUSTPASS(file->StopPlayingFileAsMicrophone(ch)); MARK(); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - ch, GetResource("audio_long8.pcm"), false, false, + ch, (output_path + "audio_long8.pcm").c_str(), false, false, kFileFormatPcm8kHzFile)); MARK(); // don't mix SLEEP(2000); TEST_MUSTPASS(file->StopPlayingFileAsMicrophone(ch)); MARK(); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - ch, GetResource("audio_long8.pcm"), false, true, + ch, (output_path + "audio_long8.pcm").c_str(), false, true, kFileFormatPcm8kHzFile)); MARK(); // mix SLEEP(2000); @@ -4348,7 +4351,7 @@ int VoEExtendedTest::TestFile() { ANL(); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - ch, GetResource("audio_long16.pcm"))); + ch, (output_path + "audio_long16.pcm").c_str())); TEST_MUSTPASS(1 != file->IsPlayingFileAsMicrophone(ch)); TEST_MUSTPASS(file->StopPlayingFileAsMicrophone(ch)); TEST_MUSTPASS(0 != file->IsPlayingFileAsMicrophone(ch)); @@ -4356,7 +4359,7 @@ int VoEExtendedTest::TestFile() { ANL(); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - ch, GetResource("audio_long16.pcm"))); + ch, (output_path + "audio_long16.pcm").c_str())); TEST_MUSTPASS(file->ScaleFileAsMicrophonePlayout(ch, 1.0)); MARK(); SLEEP(1000); @@ -4386,7 +4389,7 @@ int VoEExtendedTest::TestFile() { ANL(); TEST_MUSTPASS(file->StartRecordingPlayout(0, - GetFilename("rec_play16.pcm"))); + (output_path + "rec_play16.pcm").c_str())); MARK(); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingPlayout(0)); @@ -4394,16 +4397,16 @@ int VoEExtendedTest::TestFile() { fcomp.plfreq = 8000; strcpy(fcomp.plname, "L16"); - TEST_MUSTPASS(file->StartRecordingPlayout(0, GetFilename("rec_play8.wav"), - &fcomp)); + TEST_MUSTPASS(file->StartRecordingPlayout(0, + (output_path + "rec_play8.wav").c_str(), &fcomp)); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingPlayout(0)); MARK(); fcomp.plfreq = 16000; strcpy(fcomp.plname, "L16"); - TEST_MUSTPASS(file->StartRecordingPlayout(0, GetFilename("rec_play16.wav"), - &fcomp)); + TEST_MUSTPASS(file->StartRecordingPlayout(0, + (output_path + "rec_play16.wav").c_str(), &fcomp)); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingPlayout(0)); MARK(); @@ -4416,7 +4419,7 @@ int VoEExtendedTest::TestFile() { fcomp.channels = 1; TEST_MUSTPASS(file->StartRecordingPlayout(0, - GetFilename("rec_play_pcmu.wav"), + (output_path + "rec_play_pcmu.wav").c_str(), &fcomp)); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingPlayout(0)); @@ -4426,7 +4429,7 @@ int VoEExtendedTest::TestFile() { fcomp.plfreq = 8000; strcpy(fcomp.plname, "PCMA"); TEST_MUSTPASS(file->StartRecordingPlayout(0, - GetFilename("rec_play_pcma.wav"), + (output_path + "rec_play_pcma.wav").c_str(), &fcomp)); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingPlayout(0)); @@ -4438,14 +4441,14 @@ int VoEExtendedTest::TestFile() { fcomp.plfreq = 8000; strcpy(fcomp.plname, "ILBC"); TEST_MUSTPASS(file->StartRecordingPlayout(0, - GetFilename("rec_play.ilbc"), + (output_path + "rec_play.ilbc").c_str(), &fcomp)); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingPlayout(0)); MARK(); TEST_MUSTPASS(file->StartRecordingPlayout( - -1, GetFilename("rec_play16_mixed.pcm"))); + -1, (output_path + "rec_play16_mixed.pcm").c_str())); MARK(); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingPlayout(-1)); @@ -4454,7 +4457,8 @@ int VoEExtendedTest::TestFile() { // TEST_MUSTPASS(file->StopPlayingFileLocally(0)); // Why should this work? TEST_LOG("\nplaying out...\n"); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetFilename("rec_play.ilbc"), false, kFileFormatCompressedFile)); + 0, (output_path + "rec_play.ilbc").c_str(), false, + kFileFormatCompressedFile)); MARK(); SLEEP(2000); @@ -4467,14 +4471,16 @@ int VoEExtendedTest::TestFile() { TEST(StopRecordingMicrophone); ANL(); - TEST_MUSTPASS(file->StartRecordingMicrophone(GetFilename("rec_mic16.pcm"))); + TEST_MUSTPASS(file->StartRecordingMicrophone( + (output_path + "rec_mic16.pcm").c_str())); MARK(); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingMicrophone()); MARK(); voe_base_->StopSend(0); - TEST_MUSTPASS(file->StartRecordingMicrophone(GetFilename("rec_mic16.pcm"))); + TEST_MUSTPASS(file->StartRecordingMicrophone( + (output_path + "rec_mic16.pcm").c_str())); MARK(); // record without sending as well SLEEP(1000); TEST_MUSTPASS(file->StopRecordingMicrophone()); @@ -4484,7 +4490,7 @@ int VoEExtendedTest::TestFile() { fcomp.plfreq = 8000; strcpy(fcomp.plname, "L16"); TEST_MUSTPASS(file->StartRecordingMicrophone( - GetFilename("rec_play8.wav"), &fcomp)); + (output_path + "rec_play8.wav").c_str(), &fcomp)); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingMicrophone()); MARK(); @@ -4492,7 +4498,7 @@ int VoEExtendedTest::TestFile() { fcomp.plfreq = 16000; strcpy(fcomp.plname, "L16"); TEST_MUSTPASS(file->StartRecordingMicrophone( - GetFilename("rec_play16.wav"), &fcomp)); + (output_path + "rec_play16.wav").c_str(), &fcomp)); SLEEP(1000); TEST_MUSTPASS(file->StopRecordingMicrophone()); MARK(); @@ -4521,9 +4527,9 @@ int VoEExtendedTest::TestFile() { strcpy(fcomp.plname, "L16"); TEST_LOG("Recording microphone to L16, please speak \n"); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - 0, GetResource("audio_long16.pcm"), true , true)); + 0, (output_path + "audio_long16.pcm").c_str(), true , true)); TEST_MUSTPASS(file->StartRecordingMicrophone( - GetFilename("rec_play_ch.wav"), &fcomp)); + (output_path + "rec_play_ch.wav").c_str(), &fcomp)); MARK(); SLEEP(3000); TEST_MUSTPASS(file->StopRecordingMicrophone()); @@ -4531,14 +4537,15 @@ int VoEExtendedTest::TestFile() { TEST_MUSTPASS(file->StopPlayingFileAsMicrophone(0)); TEST_LOG("Playing recording file, you should only hear what you said \n"); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetFilename("rec_play_ch.wav"), false, kFileFormatWavFile)); + 0, (output_path + "rec_play_ch.wav").c_str(), + false, kFileFormatWavFile)); SLEEP(2500); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); TEST_LOG("Recording microphone 0 to L16, please speak \n"); TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - -1, GetResource("audio_long16.pcm"), true , true)); + -1, (output_path + "audio_long16.pcm").c_str(), true , true)); TEST_MUSTPASS(file->StartRecordingMicrophone( - GetFilename("rec_play_ch_0.wav"), &fcomp)); + (output_path + "rec_play_ch_0.wav").c_str(), &fcomp)); MARK(); SLEEP(3000); TEST_MUSTPASS(file->StopRecordingMicrophone()); @@ -4547,7 +4554,8 @@ int VoEExtendedTest::TestFile() { TEST_LOG("Playing recording file, you should hear what you said and" " audio_long16.pcm \n"); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetFilename("rec_play_ch_0.wav"), false, kFileFormatWavFile)); + 0, (output_path + "rec_play_ch_0.wav").c_str(), + false, kFileFormatWavFile)); SLEEP(2500); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); TEST_LOG("Recording microphone to ilbc, please speak \n"); @@ -4558,9 +4566,9 @@ int VoEExtendedTest::TestFile() { fcomp.channels = 1; fcomp.pltype = 97; TEST_MUSTPASS(file->StartPlayingFileAsMicrophone( - 0, GetResource("audio_long16.pcm"), true , true)); + 0, (output_path + "audio_long16.pcm").c_str(), true , true)); TEST_MUSTPASS(file->StartRecordingMicrophone( - GetFilename("rec_play_ch_0.ilbc"), &fcomp)); + (output_path + "rec_play_ch_0.ilbc").c_str(), &fcomp)); MARK(); SLEEP(3000); TEST_MUSTPASS(file->StopRecordingMicrophone()); @@ -4568,7 +4576,7 @@ int VoEExtendedTest::TestFile() { TEST_MUSTPASS(file->StopPlayingFileAsMicrophone(0)); TEST_LOG("Playing recording file, you should only hear what you said \n"); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetFilename("rec_play_ch_0.ilbc"), false, + 0, (output_path + "rec_play_ch_0.ilbc").c_str(), false, kFileFormatCompressedFile)); SLEEP(2500); TEST_MUSTPASS(file->StopPlayingFileLocally(0)); @@ -4632,8 +4640,8 @@ int VoEExtendedTest::TestFile() { ANL(); TEST_MUSTPASS(file->ConvertPCMToWAV( - GetResource("audio_long16.pcm"), - GetFilename("singleUserDemoConv.wav"))); + (output_path + "audio_long16.pcm").c_str(), + (output_path + "singleUserDemoConv.wav").c_str())); MARK(); TEST_MUSTPASS(!file->ConvertPCMToWAV((InStream*)NULL, (OutStream*)NULL));MARK(); // invalid stream handles @@ -4644,8 +4652,8 @@ int VoEExtendedTest::TestFile() { ANL(); TEST_MUSTPASS(file->ConvertWAVToPCM( - GetResource("audio_long16.wav"), - GetFilename("singleUserDemoConv.pcm"))); + (output_path + "audio_long16.wav").c_str(), + (output_path + "singleUserDemoConv.pcm").c_str())); MARK(); TEST_MUSTPASS(!file->ConvertWAVToPCM((InStream*)NULL, (OutStream*)NULL)); MARK(); // invalid stream handles @@ -4658,8 +4666,8 @@ int VoEExtendedTest::TestFile() { fcomp.plfreq = 16000; strcpy(fcomp.plname, "L16"); TEST_MUSTPASS(!file->ConvertPCMToCompressed( - GetResource("audio_long16.pcm"), - GetFilename("singleUserDemoConv16_dummy.wav"), &fcomp)); + (output_path + "audio_long16.pcm").c_str(), + (output_path + "singleUserDemoConv16_dummy.wav").c_str(), &fcomp)); MARK(); // should not be supported fcomp.plfreq = 8000; @@ -4669,19 +4677,19 @@ int VoEExtendedTest::TestFile() { fcomp.pltype = 97; fcomp.channels = 1; TEST_MUSTPASS(file->ConvertPCMToCompressed( - GetResource("audio_long16.pcm"), - GetFilename("singleUserDemoConv.ilbc"), &fcomp));MARK(); + (output_path + "audio_long16.pcm").c_str(), + (output_path + "singleUserDemoConv.ilbc").c_str(), &fcomp));MARK(); AOK();ANL(); TEST(ConvertCompressedToPCM); ANL(); TEST_MUSTPASS(file->ConvertCompressedToPCM( - GetFilename("singleUserDemoConv.ilbc"), - GetFilename("singleUserDemoConv_ilbc.pcm")));MARK(); + (output_path + "singleUserDemoConv.ilbc").c_str(), + (output_path + "singleUserDemoConv_ilbc.pcm").c_str()));MARK(); TEST_MUSTPASS(!file->ConvertCompressedToPCM( - GetResource("audio_long16.pcm"), - GetFilename("singleUserDemoConv_dummy.pcm")));MARK(); + (output_path + "audio_long16.pcm").c_str(), + (output_path + "singleUserDemoConv_dummy.pcm").c_str()));MARK(); AOK();ANL(); #if defined(MAC_IPHONE) || defined(WEBRTC_ANDROID) @@ -4696,15 +4704,18 @@ int VoEExtendedTest::TestFile() { int dur; TEST_MUSTPASS(file->GetFileDuration( - GetResource("audio_long16.pcm"), dur)); + (output_path + "audio_long16.pcm").c_str(), dur)); TEST_MUSTPASS(file->GetFileDuration( - GetResource("audio_long8.pcm"), dur, kFileFormatPcm8kHzFile)); + (output_path + "audio_long8.pcm").c_str(), + dur, kFileFormatPcm8kHzFile)); TEST_MUSTPASS(file->GetFileDuration( - GetResource("audio_long16.pcm"), dur, kFileFormatPcm16kHzFile)); + (output_path + "audio_long16.pcm").c_str(), + dur, kFileFormatPcm16kHzFile)); TEST_MUSTPASS(file->GetFileDuration( - GetResource("audio_long16.wav"), dur, kFileFormatPcm8kHzFile)); + (output_path + "audio_long16.wav").c_str(), + dur, kFileFormatPcm8kHzFile)); TEST_MUSTPASS(file->GetFileDuration( - GetFilename("singleUserDemoConv.ilbc"), dur, + (output_path + "singleUserDemoConv.ilbc").c_str(), dur, kFileFormatCompressedFile)); AOK(); @@ -4716,7 +4727,7 @@ int VoEExtendedTest::TestFile() { int pos; TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource("audio_long16.pcm"))); + 0, (output_path + "audio_long16.pcm").c_str())); SLEEP(1000); TEST_MUSTPASS(file->GetPlaybackPosition(0, pos)); MARK(); // position should be ~1000 @@ -4740,7 +4751,8 @@ int VoEExtendedTest::TestFile() { for (int i = 0; i < 7; i++) { TEST_LOG("Playing file %s, in %s KHz \n", localFiles[i], freq[i]); TEST_MUSTPASS(file->StartPlayingFileLocally( - 0, GetResource(localFiles[i]),false, kFileFormatWavFile, 1)); + 0, (output_path + localFiles[i]).c_str(), + false, kFileFormatWavFile, 1)); SLEEP(4500); // The file should not end TEST_MUSTPASS(file->StopPlayingFileLocally(0)); } @@ -4939,8 +4951,8 @@ int VoEExtendedTest::TestHardware() { VoEHardware* hardware = _mgr.HardwarePtr(); #ifdef _USE_EXTENDED_TRACE_ - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename( - "VoEHardware_trace.txt"))); + TEST_MUSTPASS(VoiceEngine::SetTraceFile((output_path + + "VoEHardware_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -5275,8 +5287,8 @@ int VoEExtendedTest::TestNetwork() { VoENetwork* netw = _mgr.NetworkPtr(); #ifdef _USE_EXTENDED_TRACE_ - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename( - "VoENetwork_trace.txt"))); + TEST_MUSTPASS(VoiceEngine::SetTraceFile((output_path + + "VoENetwork_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -6825,8 +6837,8 @@ int VoEExtendedTest::TestRTP_RTCP() { #endif #ifdef _USE_EXTENDED_TRACE_ - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename( - "VoERTP_RTCP_trace.txt"))); + TEST_MUSTPASS(VoiceEngine::SetTraceFile((output_path + + "VoERTP_RTCP_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -7054,11 +7066,12 @@ int VoEExtendedTest::TestRTP_RTCP() { MARK(); TEST_MUSTPASS(rtp_rtcp->StopRTPDump(0, kRtpOutgoing)); MARK(); - TEST_MUSTPASS(rtp_rtcp->StartRTPDump(0, GetFilename("dump_in_1sec.rtp"), - kRtpIncoming)); + std::string output_path = webrtc::test::OutputPath(); + TEST_MUSTPASS(rtp_rtcp->StartRTPDump( + 0, (output_path + "dump_in_1sec.rtp").c_str(), kRtpIncoming)); MARK(); - TEST_MUSTPASS(rtp_rtcp->StartRTPDump(0, GetFilename("dump_out_2sec.rtp"), - kRtpOutgoing)); + TEST_MUSTPASS(rtp_rtcp->StartRTPDump( + 0, (output_path + "dump_out_2sec.rtp").c_str(), kRtpOutgoing)); MARK(); SLEEP(1000); TEST_MUSTPASS(rtp_rtcp->StopRTPDump(0, kRtpIncoming)); @@ -7073,7 +7086,7 @@ int VoEExtendedTest::TestRTP_RTCP() { // for (i = 0; i < 10; i++) { TEST_MUSTPASS(rtp_rtcp->StartRTPDump(0, - GetFilename("dump_in_200ms.rtp"))); + (output_path + "dump_in_200ms.rtp").c_str())); MARK(); SLEEP(200); TEST_MUSTPASS(rtp_rtcp->StopRTPDump(0)); @@ -7452,8 +7465,8 @@ int VoEExtendedTest::TestVideoSync() } #ifdef _USE_EXTENDED_TRACE_ - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename( - "VoEVideoSync_trace.txt"))); + TEST_MUSTPASS(VoiceEngine::SetTraceFile((output_path + + "VoEVideoSync_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -7554,7 +7567,7 @@ int VoEExtendedTest::TestVolumeControl() #ifdef _USE_EXTENDED_TRACE_ TEST_MUSTPASS(VoiceEngine::SetTraceFile( - GetFilename("VoEVolumeControl_trace.txt"))); + (output_path + "VoEVolumeControl_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -7682,7 +7695,9 @@ int VoEExtendedTest::TestAPM() { VoEAudioProcessing* apm = _mgr.APMPtr(); //#ifdef _USE_EXTENDED_TRACE_ - TEST_MUSTPASS(VoiceEngine::SetTraceFile(GetFilename("apm_trace.txt"))); + std::string output_path = webrtc::test::OutputPath(); + TEST_MUSTPASS(VoiceEngine::SetTraceFile( + (output_path + "apm_trace.txt").c_str())); TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceStateInfo | kTraceWarning | @@ -8364,7 +8379,8 @@ int VoEExtendedTest::TestAPM() { //////////////////////////// // StopDebugRecording TEST_LOG("StartDebugRecording"); - TEST_MUSTPASS(apm->StartDebugRecording(GetFilename("apm_debug.txt"))); + TEST_MUSTPASS(apm->StartDebugRecording( + (output_path + "apm_debug.txt").c_str())); SLEEP(1000); TEST_LOG("StopDebugRecording"); TEST_MUSTPASS(apm->StopDebugRecording()); diff --git a/src/voice_engine/main/test/auto_test/voe_standard_test.cc b/src/voice_engine/main/test/auto_test/voe_standard_test.cc index f5015269e..01242766f 100644 --- a/src/voice_engine/main/test/auto_test/voe_standard_test.cc +++ b/src/voice_engine/main/test/auto_test/voe_standard_test.cc @@ -11,302 +11,41 @@ #include #include #include + #include "engine_configurations.h" #if defined(_WIN32) -#include // exists only on windows +#include // Exists only on windows. #include #endif -#include "voe_standard_test.h" +#include "voice_engine/main/test/auto_test/voe_standard_test.h" #if defined (_ENABLE_VISUAL_LEAK_DETECTOR_) && defined(_DEBUG) && \ defined(_WIN32) && !defined(_INSTRUMENTATION_TESTING_) #include "vld.h" #endif -#ifdef MAC_IPHONE -#include "../../source/voice_engine_defines.h" // defines build macros -#else -#include "../../source/voice_engine_defines.h" // defines build macros -#endif - -#include "automated_mode.h" -#include "critical_section_wrapper.h" -#include "event_wrapper.h" -#include "thread_wrapper.h" +#include "system_wrappers/interface/critical_section_wrapper.h" +#include "system_wrappers/interface/event_wrapper.h" +#include "system_wrappers/interface/thread_wrapper.h" +#include "voice_engine/main/source/voice_engine_defines.h" +#include "voice_engine/main/test/auto_test/automated_mode.h" #ifdef _TEST_NETEQ_STATS_ -#include "../../interface/voe_neteq_stats.h" // Not available in delivery folder +#include "voice_engine/main/interface/voe_neteq_stats.h" #endif -#include "voe_extended_test.h" -#include "voe_stress_test.h" -#include "voe_unit_test.h" -#include "voe_cpu_test.h" +#include "voice_engine/main/test/auto_test/voe_cpu_test.h" +#include "voice_engine/main/test/auto_test/voe_extended_test.h" +#include "voice_engine/main/test/auto_test/voe_stress_test.h" +#include "voice_engine/main/test/auto_test/voe_unit_test.h" using namespace webrtc; namespace voetest { -#ifdef MAC_IPHONE -// Defined in iPhone specific test file -int GetDocumentsDir(char* buf, int bufLen); -char* GetFilename(char* filename); -const char* GetFilename(const char* filename); -int GetResource(char* resource, char* dest, int destLen); -char* GetResource(char* resource); -const char* GetResource(const char* resource); -// #ifdef MAC_IPHONE -#elif defined(WEBRTC_ANDROID) -char filenameStr[2][256]; -int currentStr = 0; - -char* GetFilename(char* filename) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/sdcard/%s", filename); - return filenameStr[currentStr]; -} - -const char* GetFilename(const char* filename) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/sdcard/%s", filename); - return filenameStr[currentStr]; -} - -int GetResource(char* resource, char* dest, int destLen) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/sdcard/%s", resource); - strncpy(dest, filenameStr[currentStr], destLen-1); - return 0; -} - -char* GetResource(char* resource) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/sdcard/%s", resource); - return filenameStr[currentStr]; -} - -const char* GetResource(const char* resource) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/sdcard/%s", resource); - return filenameStr[currentStr]; -} - -#else -char filenameStr[2][256]; -int currentStr = 0; - -char* GetFilename(char* filename) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/tmp/%s", filename); - return filenameStr[currentStr]; -} -const char* GetFilename(const char* filename) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/tmp/%s", filename); - return filenameStr[currentStr]; -} -int GetResource(char* resource, char* dest, int destLen) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/tmp/%s", resource); - strncpy(dest, filenameStr[currentStr], destLen - 1); - return 0; -} -char* GetResource(char* resource) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/tmp/%s", resource); - return filenameStr[currentStr]; -} -const char* GetResource(const char* resource) { - currentStr = !currentStr; - sprintf(filenameStr[currentStr], "/tmp/%s", resource); - return filenameStr[currentStr]; -} -#endif - -#if !defined(MAC_IPHONE) -const char* summaryFilename = "/tmp/VoiceEngineSummary.txt"; -#endif -// For iPhone the summary filename is created in createSummary - int dummy = 0; // Dummy used in different functions to avoid warnings -TestRtpObserver::TestRtpObserver() { - Reset(); -} - -TestRtpObserver::~TestRtpObserver() { -} - -void TestRtpObserver::Reset() { - for (int i = 0; i < 2; i++) { - ssrc_[i] = 0; - csrc_[i][0] = 0; - csrc_[i][1] = 0; - added_[i][0] = false; - added_[i][1] = false; - size_[i] = 0; - } -} - -void TestRtpObserver::OnIncomingCSRCChanged(const int channel, - const unsigned int CSRC, - const bool added) { - char msg[128]; - sprintf(msg, "=> OnIncomingCSRCChanged(channel=%d, CSRC=%u, added=%d)\n", - channel, CSRC, added); - TEST_LOG("%s", msg); - - if (channel > 1) - return; // Not enough memory. - - csrc_[channel][size_[channel]] = CSRC; - added_[channel][size_[channel]] = added; - - size_[channel]++; - if (size_[channel] == 2) - size_[channel] = 0; -} - -void TestRtpObserver::OnIncomingSSRCChanged(const int channel, - const unsigned int SSRC) { - char msg[128]; - sprintf(msg, "\n=> OnIncomingSSRCChanged(channel=%d, SSRC=%u)\n", channel, - SSRC); - TEST_LOG("%s", msg); - - ssrc_[channel] = SSRC; -} - -void MyDeadOrAlive::OnPeriodicDeadOrAlive(const int /*channel*/, - const bool alive) { - if (alive) { - TEST_LOG("ALIVE\n"); - } else { - TEST_LOG("DEAD\n"); - } - fflush(NULL); -} - -FakeExternalTransport::FakeExternalTransport(VoENetwork* ptr) - : my_network_(ptr), - thread_(NULL), - lock_(NULL), - event_(NULL), - length_(0), - channel_(0), - delay_is_enabled_(0), - delay_time_in_ms_(0) { - const char* threadName = "external_thread"; - lock_ = CriticalSectionWrapper::CreateCriticalSection(); - event_ = EventWrapper::Create(); - thread_ = ThreadWrapper::CreateThread(Run, this, kHighPriority, threadName); - if (thread_) { - unsigned int id; - thread_->Start(id); - } -} - -FakeExternalTransport::~FakeExternalTransport() { - if (thread_) { - thread_->SetNotAlive(); - event_->Set(); - if (thread_->Stop()) { - delete thread_; - thread_ = NULL; - delete event_; - event_ = NULL; - delete lock_; - lock_ = NULL; - } - } -} - -bool FakeExternalTransport::Run(void* ptr) { - return static_cast (ptr)->Process(); -} - -bool FakeExternalTransport::Process() { - switch (event_->Wait(500)) { - case kEventSignaled: - lock_->Enter(); - my_network_->ReceivedRTPPacket(channel_, packet_buffer_, length_); - lock_->Leave(); - return true; - case kEventTimeout: - return true; - case kEventError: - break; - } - return true; -} - -int FakeExternalTransport::SendPacket(int channel, const void *data, int len) { - lock_->Enter(); - if (len < 1612) { - memcpy(packet_buffer_, (const unsigned char*) data, len); - length_ = len; - channel_ = channel; - } - lock_->Leave(); - event_->Set(); // triggers ReceivedRTPPacket() from worker thread - return len; -} - -int FakeExternalTransport::SendRTCPPacket(int channel, const void *data, int len) { - if (delay_is_enabled_) { - Sleep(delay_time_in_ms_); - } - my_network_->ReceivedRTCPPacket(channel, data, len); - return len; -} - -void FakeExternalTransport::SetDelayStatus(bool enable, unsigned int delayInMs) { - delay_is_enabled_ = enable; - delay_time_in_ms_ = delayInMs; -} - -ErrorObserver::ErrorObserver() { - code = -1; -} -void ErrorObserver::CallbackOnError(const int channel, const int errCode) { - code = errCode; -#ifndef _INSTRUMENTATION_TESTING_ - TEST_LOG("\n************************\n"); - TEST_LOG(" RUNTIME ERROR: %d \n", errCode); - TEST_LOG("************************\n"); -#endif -} - -void MyTraceCallback::Print(const TraceLevel level, - const char *traceString, - const int length) { - if (traceString) { - char* tmp = new char[length]; - memcpy(tmp, traceString, length); - TEST_LOG("%s", tmp); - TEST_LOG("\n"); - delete[] tmp; - } -} - -void RtcpAppHandler::OnApplicationDataReceived( - const int /*channel*/, const unsigned char sub_type, - const unsigned int name, const unsigned char* data, - const unsigned short length_in_bytes) { - length_in_bytes_ = length_in_bytes; - memcpy(data_, &data[0], length_in_bytes); - sub_type_ = sub_type; - name_ = name; -} - -void RtcpAppHandler::Reset() { - length_in_bytes_ = 0; - memset(data_, 0, sizeof(data_)); - sub_type_ = 0; - name_ = 0; -} - void SubAPIManager::DisplayStatus() const { TEST_LOG("Supported sub APIs:\n\n"); if (_base) diff --git a/src/voice_engine/main/test/auto_test/voe_standard_test.h b/src/voice_engine/main/test/auto_test/voe_standard_test.h index 76b209236..bbb6d2e7d 100644 --- a/src/voice_engine/main/test/auto_test/voe_standard_test.h +++ b/src/voice_engine/main/test/auto_test/voe_standard_test.h @@ -62,110 +62,6 @@ extern char mobileLogMsg[640]; namespace voetest { -void createSummary(VoiceEngine* ve); -void prepareDelivery(); - -class TestRtpObserver : public VoERTPObserver { - public: - TestRtpObserver(); - virtual ~TestRtpObserver(); - virtual void OnIncomingCSRCChanged(const int channel, - const unsigned int CSRC, - const bool added); - virtual void OnIncomingSSRCChanged(const int channel, - const unsigned int SSRC); - void Reset(); - public: - unsigned int ssrc_[2]; - unsigned int csrc_[2][2]; // Stores 2 CSRCs for each channel. - bool added_[2][2]; - int size_[2]; -}; - -class MyTraceCallback : public TraceCallback { - public: - void Print(const TraceLevel level, const char *traceString, const int length); -}; - -class MyDeadOrAlive : public VoEConnectionObserver { - public: - void OnPeriodicDeadOrAlive(const int channel, const bool alive); -}; - -class ErrorObserver : public VoiceEngineObserver { - public: - ErrorObserver(); - void CallbackOnError(const int channel, const int errCode); - public: - int code; -}; - -class RtcpAppHandler : public VoERTCPObserver { - public: - void OnApplicationDataReceived(const int channel, - const unsigned char sub_type, - const unsigned int name, - const unsigned char* data, - const unsigned short length_in_bytes); - void Reset(); - ~RtcpAppHandler() {} - unsigned short length_in_bytes_; - unsigned char data_[256]; - unsigned char sub_type_; - unsigned int name_; -}; - -class DtmfCallback : public VoETelephoneEventObserver { - public: - int counter; - DtmfCallback() { - counter = 0; - } - virtual void OnReceivedTelephoneEventInband(int channel, - int eventCode, - bool endOfEvent) { - char msg[128]; - if (endOfEvent) - sprintf(msg, "(event=%d, [END])", eventCode); - else - sprintf(msg, "(event=%d, [START])", eventCode); - TEST_LOG("%s", msg); - if (!endOfEvent) - counter++; // cound start of event only - fflush(NULL); - } - - virtual void OnReceivedTelephoneEventOutOfBand(int channel, - int eventCode, - bool endOfEvent) { - char msg[128]; - if (endOfEvent) - sprintf(msg, "(event=%d, [END])", eventCode); - else - sprintf(msg, "(event=%d, [START])", eventCode); - TEST_LOG("%s", msg); - if (!endOfEvent) - counter++; // cound start of event only - fflush(NULL); - } -}; - -class RxCallback : public VoERxVadCallback { - public: - RxCallback() : - _vadDecision(-1) { - } - - virtual void OnRxVad(int, int vadDecision) { - char msg[128]; - sprintf(msg, "RX VAD detected decision %d \n", vadDecision); - TEST_LOG("%s", msg); - _vadDecision = vadDecision; - } - - int _vadDecision; -}; - class SubAPIManager { public: SubAPIManager() diff --git a/src/voice_engine/main/test/auto_test/voe_stress_test.cc b/src/voice_engine/main/test/auto_test/voe_stress_test.cc index b7098ecdf..024a25ba6 100644 --- a/src/voice_engine/main/test/auto_test/voe_stress_test.cc +++ b/src/voice_engine/main/test/auto_test/voe_stress_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -47,12 +47,6 @@ namespace voetest { #define PAUSE_OR_SLEEP(x) SLEEP(x); #endif -extern char* GetFilename(char* filename); -extern const char* GetFilename(const char* filename); -extern int GetResource(char* resource, char* dest, int destLen); -extern char* GetResource(char* resource); -extern const char* GetResource(const char* resource); - const char* VoEStressTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0ds" "b2JhbCBJUCBTb3VuZAAC\nAAAAIwAAAExpY2Vuc2VkIHRvIE5vcnRlbCBOZXR3cm9rcwAAAAA" "xAAAAZxZ7/u0M\niFYyTwSwko5Uutf7mh8S0O4rYZYTFidbzQeuGonuL17F/2oD/2pfDp3jL4" diff --git a/src/voice_engine/main/test/auto_test/voe_test_interface.h b/src/voice_engine/main/test/auto_test/voe_test_interface.h index 87b37a458..2d9c80baa 100644 --- a/src/voice_engine/main/test/auto_test/voe_test_interface.h +++ b/src/voice_engine/main/test/auto_test/voe_test_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -17,15 +17,8 @@ #include "common_types.h" -namespace webrtc { -class CriticalSectionWrapper; -class EventWrapper; -class ThreadWrapper; -class VoENetwork; -} - namespace voetest { -// TODO(andrew): using directives are not permitted. +// TODO(andrew): Using directives not permitted. using namespace webrtc; // TestType enumerator @@ -55,33 +48,6 @@ enum ExtendedSelection { XSEL_AudioProcessing, }; -// ---------------------------------------------------------------------------- -// External transport (Transport) -// ---------------------------------------------------------------------------- - -class FakeExternalTransport : public Transport { - public: - FakeExternalTransport(VoENetwork* ptr); - virtual ~FakeExternalTransport(); - VoENetwork* my_network_; - int SendPacket(int channel, const void *data, int len); - int SendRTCPPacket(int channel, const void *data, int len); - void SetDelayStatus(bool enabled, unsigned int delayInMs = 100); - private: - static bool Run(void* ptr); - bool Process(); - private: - ThreadWrapper* thread_; - CriticalSectionWrapper* lock_; - EventWrapper* event_; - private: - unsigned char packet_buffer_[1612]; - int length_; - int channel_; - bool delay_is_enabled_; - int delay_time_in_ms_; -}; - // Main test function int runAutoTest(TestType testType, ExtendedSelection extendedSel); diff --git a/src/voice_engine/main/test/auto_test/voe_unit_test.cc b/src/voice_engine/main/test/auto_test/voe_unit_test.cc index d3a6e7293..a53255bc2 100644 --- a/src/voice_engine/main/test/auto_test/voe_unit_test.cc +++ b/src/voice_engine/main/test/auto_test/voe_unit_test.cc @@ -19,6 +19,7 @@ #endif #include "system_wrappers/interface/thread_wrapper.h" +#include "testsupport/fileutils.h" #include "voice_engine/main/source/voice_engine_defines.h" #include "voice_engine/main/test/auto_test/fakes/fake_media_process.h" @@ -35,19 +36,6 @@ namespace voetest { return -1; \ } -extern char* GetFilename(char* filename); -extern const char* GetFilename(const char* filename); -extern int GetResource(char* resource, char* dest, int destLen); -extern char* GetResource(char* resource); -extern const char* GetResource(const char* resource); - -const char* VoEUnitTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0dsb2" - "JhbCBJUCBTb3VuZAAC\nAAAAIwAAAExpY2Vuc2VkIHRvIE5vcnRlbCBOZXR3cm9rcwAAAAAxA" - "AAAZxZ7/u0M\niFYyTwSwko5Uutf7mh8S0O4rYZYTFidbzQeuGonuL17F/2oD/2pfDp3jL4Rf" - "3z/A\nnlJsEJgEtASkDNFuwLILjGY0pzjjAYQp3pCl6z6k2MtE06AirdjGLYCjENpq/opX\nO" - "rs3sIuwdYK5va/aFcsjBDmlsGCUM48RDYG9s23bIHYafXUC4ofOaubbZPWiPTmL\nEVJ8WH4F" - "9pgNjALc14oJXfON7r/3\n=EsLx"; - // ---------------------------------------------------------------------------- // >>> R E A D M E F I R S T <<< // ---------------------------------------------------------------------------- @@ -286,8 +274,9 @@ int VoEUnitTest::StartMedia(int channel, int rtpPort, bool listen, bool playout, true, mixWithMic)); } if (localFile) { + std::string inputFile = webrtc::test::OutputPath() + "audio_short16.pcm"; CHECK(file->StartPlayingFileLocally(channel, - GetResource("audio_short16.pcm"), + inputFile.c_str(), false, kFileFormatPcm16kHzFile)); } @@ -369,7 +358,9 @@ int VoEUnitTest::MixerTest() { // Set trace // - VoiceEngine::SetTraceFile(GetFilename("UnitTest_Mixer_trace.txt")); + std::string outputDir = webrtc::test::OutputPath(); + std::string traceFile = outputDir + "UnitTest_Mixer_trace.txt"; + VoiceEngine::SetTraceFile(outputDir.c_str()); VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceWarning | kTraceError | kTraceCritical | kTraceApiCall | kTraceMemory | kTraceInfo); @@ -416,7 +407,8 @@ int VoEUnitTest::MixerTest() { Sleep(testTime); Test("(ch 0) Playing 16kHz file locally <=> mixing at 16kHz..."); - CHECK(file->StartPlayingFileLocally(0, GetResource("audio_long16.pcm"), + std::string inputFile = outputDir + "audio_long16.pcm"; + CHECK(file->StartPlayingFileLocally(0, inputFile.c_str(), false, kFileFormatPcm16kHzFile)); Sleep(testTime); CHECK(file->StopPlayingFileLocally(0)); @@ -720,15 +712,18 @@ int VoEUnitTest::MixerTest() { Sleep(testTime); Test("(ch 0) Recording of playout to 16kHz PCM file..."); + + std::string recordedPlayoutFile = webrtc::test::OutputPath() + + "RecordedPlayout16kHz.pcm"; CHECK(file->StartRecordingPlayout( - 0, GetFilename("RecordedPlayout16kHz.pcm"), NULL)); + 0, recordedPlayoutFile.c_str(), NULL)); Sleep(testTime); CHECK(file->StopRecordingPlayout(0)); Test("(ch 0) Playing out the recorded file..."); CHECK(volume->SetInputMute(0, true)); CHECK(file->StartPlayingFileLocally( - 0, GetFilename("RecordedPlayout16kHz.pcm"))); + 0, recordedPlayoutFile.c_str())); Sleep(testTime); CHECK(file->StopPlayingFileLocally(0)); CHECK(volume->SetInputMute(0, false)); @@ -739,14 +734,14 @@ int VoEUnitTest::MixerTest() { Test("(ch 0) Recording of playout to 16kHz PCM file..."); CHECK(file->StartRecordingPlayout( - 0, GetFilename("RecordedPlayout16kHz.pcm"), NULL)); + 0, recordedPlayoutFile.c_str(), NULL)); Sleep(testTime); CHECK(file->StopRecordingPlayout(0)); Test("(ch 0) Playing out the recorded file..."); CHECK(volume->SetInputMute(0, true)); CHECK(file->StartPlayingFileLocally( - 0, GetFilename("RecordedPlayout16kHz.pcm"))); + 0, recordedPlayoutFile.c_str())); Sleep(testTime); CHECK(file->StopPlayingFileLocally(0)); CHECK(volume->SetInputMute(0, false)); @@ -757,14 +752,14 @@ int VoEUnitTest::MixerTest() { Test("(ch 0) Recording of playout to 16kHz PCM file..."); CHECK(file->StartRecordingPlayout( - 0, GetFilename("RecordedPlayout16kHz.pcm"), NULL)); + 0, recordedPlayoutFile.c_str(), NULL)); Sleep(testTime); CHECK(file->StopRecordingPlayout(0)); Test("(ch 0) Playing out the recorded file..."); CHECK(volume->SetInputMute(0, true)); CHECK(file->StartPlayingFileLocally( - 0, GetFilename("RecordedPlayout16kHz.pcm"))); + 0, recordedPlayoutFile.c_str())); Sleep(testTime); CHECK(file->StopPlayingFileLocally(0)); CHECK(volume->SetInputMute(0, false)); @@ -778,14 +773,14 @@ int VoEUnitTest::MixerTest() { Test("(ch 0) Recording of playout to 16kHz PCM file..."); CHECK(file->StartRecordingPlayout( - 0, GetFilename("RecordedPlayout16kHz.pcm"), NULL)); + 0, recordedPlayoutFile.c_str(), NULL)); Sleep(testTime); CHECK(file->StopRecordingPlayout(0)); CHECK(file->StopPlayingFileLocally(0)); Test("(ch 0) Playing out the recorded file..."); CHECK(file->StartPlayingFileLocally( - 0, GetFilename("RecordedPlayout16kHz.pcm"))); + 0, recordedPlayoutFile.c_str())); Sleep(testTime); CHECK(file->StopPlayingFileLocally(0)); @@ -802,7 +797,7 @@ int VoEUnitTest::MixerTest() { Test("(ch -1) Speak while recording all channels to add mixer input on " "channel 0..."); CHECK(file->StartRecordingPlayout( - -1, GetFilename("RecordedPlayout16kHz.pcm"), NULL)); + -1, recordedPlayoutFile.c_str(), NULL)); Sleep(testTime); CHECK(file->StopRecordingPlayout(-1)); CHECK(file->StopPlayingFileLocally(1)); @@ -810,7 +805,7 @@ int VoEUnitTest::MixerTest() { Test("(ch 0) Playing out the recorded file..."); CHECK(volume->SetInputMute(0, true)); CHECK(file->StartPlayingFileLocally( - 0, GetFilename("RecordedPlayout16kHz.pcm"))); + 0, recordedPlayoutFile.c_str())); Sleep(testTime); CHECK(file->StopPlayingFileLocally(0)); CHECK(volume->SetInputMute(0, false)); @@ -845,15 +840,15 @@ int VoEUnitTest::MixerTest() { Test("(ch 0) Playing out the recorded file for the left channel (10%%)..."); CHECK(volume->SetInputMute(0, true)); - CHECK(file->StartPlayingFileLocally( - 0, GetFilename("RecordedPlayout_Left_16kHz.pcm"))); + std::string leftFilename = outputDir + "RecordedPlayout_Left_16kHz.pcm"; + CHECK(file->StartPlayingFileLocally(0, leftFilename.c_str())); Sleep(testTime); CHECK(file->StopPlayingFileLocally(0)); Test("(ch 0) Playing out the recorded file for the right channel (100%%) =>" " should sound louder than the left channel..."); - CHECK(file->StartPlayingFileLocally( - 0, GetFilename("RecordedPlayout_Right_16kHz.pcm"))); + std::string rightFilename = outputDir + "RecordedPlayout_Right_16kHz.pcm"; + CHECK(file->StartPlayingFileLocally(0, rightFilename.c_str())); Sleep(testTime); CHECK(file->StopPlayingFileLocally(0)); CHECK(volume->SetInputMute(0, false)); diff --git a/src/voice_engine/main/test/auto_test/voe_unit_test.h b/src/voice_engine/main/test/auto_test/voe_unit_test.h index ce532415d..5e9537c66 100644 --- a/src/voice_engine/main/test/auto_test/voe_unit_test.h +++ b/src/voice_engine/main/test/auto_test/voe_unit_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -11,7 +11,7 @@ #ifndef WEBRTC_VOICE_ENGINE_VOE_UNIT_TEST_H #define WEBRTC_VOICE_ENGINE_VOE_UNIT_TEST_H -#include "voe_standard_test.h" +#include "voice_engine/main/test/auto_test/voe_standard_test.h" namespace voetest { @@ -52,7 +52,6 @@ class VoEUnitTest : public Encryption { private: VoETestManager& _mgr; - static const char* _key; private: bool _listening[32]; diff --git a/src/voice_engine/main/test/voice_engine_tests.gypi b/src/voice_engine/main/test/voice_engine_tests.gypi index 554e68ad2..03b03713e 100644 --- a/src/voice_engine/main/test/voice_engine_tests.gypi +++ b/src/voice_engine/main/test/voice_engine_tests.gypi @@ -30,6 +30,8 @@ ], 'sources': [ 'auto_test/automated_mode.cc', + 'auto_test/fakes/fake_external_transport.cc', + 'auto_test/fakes/fake_external_transport.h', 'auto_test/fixtures/after_initialization_fixture.cc', 'auto_test/fixtures/after_initialization_fixture.h', 'auto_test/fixtures/after_streaming_fixture.cc', diff --git a/src/voice_engine/main/test/win_test/WinTestDlg.cc b/src/voice_engine/main/test/win_test/WinTestDlg.cc index 85da41d3b..d5fd3a488 100644 --- a/src/voice_engine/main/test/win_test/WinTestDlg.cc +++ b/src/voice_engine/main/test/win_test/WinTestDlg.cc @@ -403,14 +403,14 @@ void TelephoneEventObserver::OnReceivedTelephoneEventOutOfBand(int channel, class RxCallback : public VoERxVadCallback { public: - RxCallback() : _vadDecision(-1) {}; + RxCallback() : vad_decision(-1) {}; virtual void OnRxVad(int , int vadDecision) { - _vadDecision = vadDecision; + vad_decision = vadDecision; } - int _vadDecision; + int vad_decision; }; // ---------------------------------------------------------------------------- @@ -3495,7 +3495,7 @@ void CWinTestDlg::OnTimer(UINT_PTR nIDEvent) if (_rxVad && _veApmPtr && _rxVadObserverPtr) { - SetDlgItemInt(IDC_EDIT_RXVAD, _rxVadObserverPtr->_vadDecision); + SetDlgItemInt(IDC_EDIT_RXVAD, _rxVadObserverPtr->vad_decision); } if (_veHardwarePtr)