Adds correct absolute paths to all input files in ADM functional unit tests.

Files are now read and played out correctly.
Review URL: http://webrtc-codereview.appspot.com/246006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@811 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrika@webrtc.org 2011-10-25 08:24:20 +00:00
parent 5b5c31d8dd
commit 5423bc2d0b
3 changed files with 54 additions and 39 deletions

View File

@ -180,6 +180,7 @@
'webrtc_utility', 'webrtc_utility',
'<(webrtc_root)/common_audio/common_audio.gyp:resampler', '<(webrtc_root)/common_audio/common_audio.gyp:resampler',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/../test/test.gyp:test_support',
], ],
'sources': [ 'sources': [
'../test/audio_device_test_func.cc', '../test/audio_device_test_func.cc',

View File

@ -14,6 +14,7 @@
#include <string.h> #include <string.h>
#include "func_test_manager.h" #include "func_test_manager.h"
#include "testsupport/fileutils.h"
#include "../source/audio_device_config.h" #include "../source/audio_device_config.h"
#include "../source/audio_device_impl.h" #include "../source/audio_device_impl.h"
@ -25,21 +26,14 @@
#pragma warning( disable : 4996 ) #pragma warning( disable : 4996 )
#endif #endif
const WebRtc_Word8 PlayoutFile48[] = "audio_short48.pcm"; const char* RecordedMicrophoneFile = "recorded_microphone_mono_48.pcm";
const WebRtc_Word8 PlayoutFile44[] = "audio_short44.pcm"; const char* RecordedMicrophoneVolumeFile =
const WebRtc_Word8 PlayoutFile16[] = "audio_short16.pcm"; "recorded_microphone_volume_mono_48.pcm";
const WebRtc_Word8 PlayoutFile8[] = "audio_short8.pcm"; const char* RecordedMicrophoneMuteFile = "recorded_microphone_mute_mono_48.pcm";
const WebRtc_Word8 RecordedMicrophoneFile[] = "recorded_microphone_mono_48.pcm"; const char* RecordedMicrophoneBoostFile =
const WebRtc_Word8 RecordedMicrophoneVolumeFile[] = "recorded_microphone_boost_mono_48.pcm";
"recorded_microphone_volume_mono_48.pcm"; const char* RecordedMicrophoneAGCFile = "recorded_microphone_AGC_mono_48.pcm";
const WebRtc_Word8 RecordedMicrophoneMuteFile[] = const char* RecordedSpeakerFile = "recorded_speaker_48.pcm";
"recorded_microphone_mute_mono_48.pcm";
const WebRtc_Word8 RecordedMicrophoneBoostFile[] =
"recorded_microphone_boost_mono_48.pcm";
const WebRtc_Word8 RecordedMicrophoneAGCFile[] =
"recorded_microphone_AGC_mono_48.pcm";
const WebRtc_Word8 RecordedSpeakerFile[] = "recorded_speaker_48.pcm";
const WebRtc_Word8 ReadMeFile[] = "README.txt";
struct AudioPacket struct AudioPacket
{ {
@ -575,18 +569,23 @@ WebRtc_Word32 AudioTransportImpl::NeedMorePlayData(
; ;
FuncTestManager::FuncTestManager() : FuncTestManager::FuncTestManager() :
_resourcePath(webrtc::test::GetProjectRootPath() +
"test/data/audio_device/"),
_processThread(NULL), _processThread(NULL),
_audioDevice(NULL), _audioDevice(NULL),
_audioEventObserver(NULL), _audioEventObserver(NULL),
_audioTransport(NULL) _audioTransport(NULL)
{ {
assert(!_resourcePath.empty());
_playoutFile48 = _resourcePath + "audio_short48.pcm";
_playoutFile44 = _resourcePath + "audio_short44.pcm";
_playoutFile16 = _resourcePath + "audio_short16.pcm";
_playoutFile8 = _resourcePath + "audio_short8.pcm";
} }
;
FuncTestManager::~FuncTestManager() FuncTestManager::~FuncTestManager()
{ {
} }
;
WebRtc_Word32 FuncTestManager::Init() WebRtc_Word32 FuncTestManager::Init()
{ {
@ -1264,16 +1263,19 @@ WebRtc_Word32 FuncTestManager::TestAudioTransport()
TEST(audioDevice->InitPlayout() == 0); TEST(audioDevice->InitPlayout() == 0);
TEST(audioDevice->PlayoutSampleRate(&samplesPerSec) == 0); TEST(audioDevice->PlayoutSampleRate(&samplesPerSec) == 0);
if (samplesPerSec == 48000) if (samplesPerSec == 48000) {
_audioTransport->SetFilePlayout(true, GetResource(PlayoutFile48)); _audioTransport->SetFilePlayout(
else if (samplesPerSec == 44100 || samplesPerSec == 44000) true, GetResource(_playoutFile48.c_str()));
_audioTransport->SetFilePlayout(true, GetResource(PlayoutFile44)); } else if (samplesPerSec == 44100 || samplesPerSec == 44000) {
else if (samplesPerSec == 16000) _audioTransport->SetFilePlayout(
_audioTransport->SetFilePlayout(true, GetResource(PlayoutFile16)); true, GetResource(_playoutFile44.c_str()));
else if (samplesPerSec == 8000) } else if (samplesPerSec == 16000) {
_audioTransport->SetFilePlayout(true, GetResource(PlayoutFile8)); _audioTransport->SetFilePlayout(
else true, GetResource(_playoutFile16.c_str()));
{ } else if (samplesPerSec == 8000) {
_audioTransport->SetFilePlayout(
true, GetResource(_playoutFile8.c_str()));
} else {
TEST_LOG("\nERROR: Sample rate (%u) is not supported!\n \n", TEST_LOG("\nERROR: Sample rate (%u) is not supported!\n \n",
samplesPerSec); samplesPerSec);
return -1; return -1;
@ -1494,16 +1496,19 @@ WebRtc_Word32 FuncTestManager::TestSpeakerVolume()
{ {
TEST(audioDevice->InitPlayout() == 0); TEST(audioDevice->InitPlayout() == 0);
TEST(audioDevice->PlayoutSampleRate(&samplesPerSec) == 0); TEST(audioDevice->PlayoutSampleRate(&samplesPerSec) == 0);
if (48000 == samplesPerSec) if (48000 == samplesPerSec) {
_audioTransport->SetFilePlayout(true, GetResource(PlayoutFile48)); _audioTransport->SetFilePlayout(
else if (44100 == samplesPerSec || samplesPerSec == 44000) true, GetResource(_playoutFile48.c_str()));
_audioTransport->SetFilePlayout(true, GetResource(PlayoutFile44)); } else if (44100 == samplesPerSec || samplesPerSec == 44000) {
else if (samplesPerSec == 16000) _audioTransport->SetFilePlayout(
_audioTransport->SetFilePlayout(true, GetResource(PlayoutFile16)); true, GetResource(_playoutFile44.c_str()));
else if (samplesPerSec == 8000) } else if (samplesPerSec == 16000) {
_audioTransport->SetFilePlayout(true, GetResource(PlayoutFile8)); _audioTransport->SetFilePlayout(
else true, GetResource(_playoutFile16.c_str()));
{ } else if (samplesPerSec == 8000) {
_audioTransport->SetFilePlayout(
true, GetResource(_playoutFile8.c_str()));
} else {
TEST_LOG("\nERROR: Sample rate (%d) is not supported!\n \n", TEST_LOG("\nERROR: Sample rate (%d) is not supported!\n \n",
samplesPerSec); samplesPerSec);
return -1; return -1;
@ -1594,9 +1599,9 @@ WebRtc_Word32 FuncTestManager::TestSpeakerMute()
TEST(audioDevice->InitPlayout() == 0); TEST(audioDevice->InitPlayout() == 0);
TEST(audioDevice->PlayoutSampleRate(&samplesPerSec) == 0); TEST(audioDevice->PlayoutSampleRate(&samplesPerSec) == 0);
if (48000 == samplesPerSec) if (48000 == samplesPerSec)
_audioTransport->SetFilePlayout(true, PlayoutFile48); _audioTransport->SetFilePlayout(true, _playoutFile48.c_str());
else if (44100 == samplesPerSec || 44000 == samplesPerSec) else if (44100 == samplesPerSec || 44000 == samplesPerSec)
_audioTransport->SetFilePlayout(true, PlayoutFile44); _audioTransport->SetFilePlayout(true, _playoutFile44.c_str());
else else
{ {
TEST_LOG("\nERROR: Sample rate (%d) is not supported!\n \n", TEST_LOG("\nERROR: Sample rate (%d) is not supported!\n \n",

View File

@ -13,6 +13,8 @@
#include "../source/audio_device_utility.h" #include "../source/audio_device_utility.h"
#include <string>
#include "typedefs.h" #include "typedefs.h"
#include "audio_device.h" #include "audio_device.h"
#include "audio_device_test_defines.h" #include "audio_device_test_defines.h"
@ -208,6 +210,13 @@ private:
WebRtc_Word32 SelectRecordingDevice(); WebRtc_Word32 SelectRecordingDevice();
WebRtc_Word32 TestAdvancedMBAPI(); WebRtc_Word32 TestAdvancedMBAPI();
private: private:
// Paths to where the resource files to be used for this test are located.
std::string _resourcePath;
std::string _playoutFile48;
std::string _playoutFile44;
std::string _playoutFile16;
std::string _playoutFile8;
ProcessThread* _processThread; ProcessThread* _processThread;
AudioDeviceModule* _audioDevice; AudioDeviceModule* _audioDevice;
AudioEventObserver* _audioEventObserver; AudioEventObserver* _audioEventObserver;