Add Android.mk for apm unit test and make it compile on android

Review URL: http://webrtc-codereview.appspot.com/54001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@132 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
leozwang@google.com 2011-06-29 22:01:00 +00:00
parent 21a4405d01
commit 6fb5d19289
4 changed files with 70 additions and 9 deletions

View File

@ -42,7 +42,7 @@ LOCAL_SHARED_LIBRARIES := \
libstlport \
libwebrtc_audio_preprocessing
LOCAL_MODULE:= webrtc-apmtest
LOCAL_MODULE:= webrtc_apm_process_test
include external/stlport/libstlport.mk
include $(BUILD_EXECUTABLE)

View File

@ -0,0 +1,49 @@
# Copyright (c) 2011 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.
LOCAL_PATH:= $(call my-dir)
# apm test app
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES:= \
unit_test.cc
# Flags passed to both C and C++ files.
LOCAL_CFLAGS := \
'-DWEBRTC_TARGET_PC' \
'-DWEBRTC_LINUX' \
'-DWEBRTC_THREAD_RR' \
'-DWEBRTC_ANDROID' \
'-DANDROID'
LOCAL_CPPFLAGS :=
LOCAL_LDFLAGS :=
LOCAL_C_INCLUDES := \
external/gtest/include \
$(LOCAL_PATH)/../../../../../system_wrappers/interface \
$(LOCAL_PATH)/../../../../../common_audio/signal_processing_library/main/interface \
$(LOCAL_PATH)/../../interface \
$(LOCAL_PATH)/../../../../interface \
$(LOCAL_PATH)/../../../../..
LOCAL_STATIC_LIBRARIES := \
libgtest
LOCAL_SHARED_LIBRARIES := \
libutils \
libstlport \
libwebrtc_audio_preprocessing
LOCAL_MODULE:= webrtc_apm_unit_test
include external/stlport/libstlport.mk
include $(BUILD_EXECUTABLE)

View File

@ -10,15 +10,29 @@
#include "unit_test.h"
#include "tick_util.h"
#include "cpu_features_wrapper.h"
#include "event_wrapper.h"
#include "module_common_types.h"
#include "thread_wrapper.h"
#include "trace.h"
#include "signal_processing_library.h"
#include "audio_processing.h"
namespace webrtc {
using webrtc::AudioProcessing;
using webrtc::AudioFrame;
using webrtc::GainControl;
using webrtc::NoiseSuppression;
using webrtc::EchoCancellation;
using webrtc::TickInterval;
using webrtc::TickTime;
using webrtc::EventWrapper;
using webrtc::Trace;
using webrtc::LevelEstimator;
using webrtc::EchoCancellation;
using webrtc::EchoControlMobile;
using webrtc::VoiceDetection;
namespace {
// If false, this will write out a new statistics file.
@ -465,7 +479,7 @@ TEST_F(ApmTest, Process) {
sizeof(WebRtc_Word16),
render_audio._payloadDataLengthInSamples * 2,
far_file_);
if (read_count !=
if (read_count !=
static_cast<size_t>
(render_audio._payloadDataLengthInSamples * 2)) {
break; // This is expected.
@ -1011,4 +1025,3 @@ int main(int argc, char** argv) {
return RUN_ALL_TESTS();
}
}

View File

@ -14,9 +14,9 @@
#include <gtest/gtest.h>
namespace webrtc {
class AudioProcessing;
class AudioFrame;
}
class ApmTest : public ::testing::Test {
protected:
@ -28,9 +28,8 @@ class ApmTest : public ::testing::Test {
FILE* far_file_;
FILE* near_file_;
FILE* stat_file_;
AudioFrame* frame_;
AudioFrame* reverse_frame_;
webrtc::AudioFrame* frame_;
webrtc::AudioFrame* reverse_frame_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_TEST_UNIT_TEST_UNIT_TEST_H_