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_root)/common_audio/common_audio.gyp:resampler',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/../test/test.gyp:test_support',
],
'sources': [
'../test/audio_device_test_func.cc',

View File

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

View File

@ -13,6 +13,8 @@
#include "../source/audio_device_utility.h"
#include <string>
#include "typedefs.h"
#include "audio_device.h"
#include "audio_device_test_defines.h"
@ -208,6 +210,13 @@ private:
WebRtc_Word32 SelectRecordingDevice();
WebRtc_Word32 TestAdvancedMBAPI();
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;
AudioDeviceModule* _audioDevice;
AudioEventObserver* _audioEventObserver;