Fix audioproc build errors on Windows.
BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/254003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@859 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
c4ab8706f4
commit
3119ecfec8
@ -57,6 +57,7 @@
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'audioproc_debug_proto',
|
||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||
'<(webrtc_root)/../third_party/google-gflags/google-gflags.gyp:google-gflags',
|
||||
],
|
||||
'sources': [ 'test/unpack.cc', ],
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "audio_processing.h"
|
||||
#include "cpu_features_wrapper.h"
|
||||
#include "module_common_types.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "tick_util.h"
|
||||
#ifdef WEBRTC_ANDROID
|
||||
#include "external/webrtc/src/modules/audio_processing/debug.pb.h"
|
||||
@ -31,8 +32,10 @@ using webrtc::AudioProcessing;
|
||||
using webrtc::EchoCancellation;
|
||||
using webrtc::GainControl;
|
||||
using webrtc::NoiseSuppression;
|
||||
using webrtc::scoped_array;
|
||||
using webrtc::TickInterval;
|
||||
using webrtc::TickTime;
|
||||
|
||||
using webrtc::audioproc::Event;
|
||||
using webrtc::audioproc::Init;
|
||||
using webrtc::audioproc::ReverseStream;
|
||||
@ -51,15 +54,15 @@ bool ReadMessageFromFile(FILE* file,
|
||||
if (size <= 0) {
|
||||
return false;
|
||||
}
|
||||
size_t usize = static_cast<size_t>(size);
|
||||
const size_t usize = static_cast<size_t>(size);
|
||||
|
||||
char array[usize];
|
||||
if (fread(array, sizeof(char), usize, file) != usize) {
|
||||
scoped_array<char> array(new char[usize]);
|
||||
if (fread(array.get(), sizeof(char), usize, file) != usize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
msg->Clear();
|
||||
return msg->ParseFromArray(array, usize);
|
||||
return msg->ParseFromArray(array.get(), usize);
|
||||
}
|
||||
|
||||
void PrintStat(const AudioProcessing::Statistic& stat) {
|
||||
@ -470,13 +473,14 @@ void void_main(int argc, char* argv[]) {
|
||||
|
||||
const size_t path_size =
|
||||
apm->echo_control_mobile()->echo_path_size_bytes();
|
||||
unsigned char echo_path[path_size];
|
||||
ASSERT_EQ(path_size, fread(echo_path,
|
||||
sizeof(unsigned char),
|
||||
scoped_array<char> echo_path(new char[path_size]);
|
||||
ASSERT_EQ(path_size, fread(echo_path.get(),
|
||||
sizeof(char),
|
||||
path_size,
|
||||
aecm_echo_path_in_file));
|
||||
EXPECT_EQ(apm->kNoError,
|
||||
apm->echo_control_mobile()->SetEchoPath(echo_path, path_size));
|
||||
apm->echo_control_mobile()->SetEchoPath(echo_path.get(),
|
||||
path_size));
|
||||
fclose(aecm_echo_path_in_file);
|
||||
aecm_echo_path_in_file = NULL;
|
||||
}
|
||||
@ -863,10 +867,10 @@ void void_main(int argc, char* argv[]) {
|
||||
if (aecm_echo_path_out_file != NULL) {
|
||||
const size_t path_size =
|
||||
apm->echo_control_mobile()->echo_path_size_bytes();
|
||||
unsigned char echo_path[path_size];
|
||||
apm->echo_control_mobile()->GetEchoPath(echo_path, path_size);
|
||||
ASSERT_EQ(path_size, fwrite(echo_path,
|
||||
sizeof(unsigned char),
|
||||
scoped_array<char> echo_path(new char[path_size]);
|
||||
apm->echo_control_mobile()->GetEchoPath(echo_path.get(), path_size);
|
||||
ASSERT_EQ(path_size, fwrite(echo_path.get(),
|
||||
sizeof(char),
|
||||
path_size,
|
||||
aecm_echo_path_out_file));
|
||||
fclose(aecm_echo_path_out_file);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "audio_processing.h"
|
||||
#include "event_wrapper.h"
|
||||
#include "module_common_types.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "signal_processing_library.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "thread_wrapper.h"
|
||||
@ -31,6 +32,7 @@ using webrtc::GainControl;
|
||||
using webrtc::NoiseSuppression;
|
||||
using webrtc::EchoCancellation;
|
||||
using webrtc::EventWrapper;
|
||||
using webrtc::scoped_array;
|
||||
using webrtc::Trace;
|
||||
using webrtc::LevelEstimator;
|
||||
using webrtc::EchoCancellation;
|
||||
@ -775,26 +777,28 @@ TEST_F(ApmTest, EchoControlMobile) {
|
||||
// Set and get echo path
|
||||
const size_t echo_path_size =
|
||||
apm_->echo_control_mobile()->echo_path_size_bytes();
|
||||
unsigned char echo_path_in[echo_path_size];
|
||||
unsigned char echo_path_out[echo_path_size];
|
||||
scoped_array<char> echo_path_in(new char[echo_path_size]);
|
||||
scoped_array<char> echo_path_out(new char[echo_path_size]);
|
||||
EXPECT_EQ(apm_->kNullPointerError,
|
||||
apm_->echo_control_mobile()->SetEchoPath(NULL, echo_path_size));
|
||||
EXPECT_EQ(apm_->kNullPointerError,
|
||||
apm_->echo_control_mobile()->GetEchoPath(NULL, echo_path_size));
|
||||
EXPECT_EQ(apm_->kBadParameterError,
|
||||
apm_->echo_control_mobile()->GetEchoPath(echo_path_out, 1));
|
||||
apm_->echo_control_mobile()->GetEchoPath(echo_path_out.get(), 1));
|
||||
EXPECT_EQ(apm_->kNoError,
|
||||
apm_->echo_control_mobile()->GetEchoPath(echo_path_out,
|
||||
apm_->echo_control_mobile()->GetEchoPath(echo_path_out.get(),
|
||||
echo_path_size));
|
||||
for (size_t i = 0; i < echo_path_size; i++) {
|
||||
echo_path_in[i] = echo_path_out[i] + 1;
|
||||
}
|
||||
EXPECT_EQ(apm_->kBadParameterError,
|
||||
apm_->echo_control_mobile()->SetEchoPath(echo_path_in, 1));
|
||||
apm_->echo_control_mobile()->SetEchoPath(echo_path_in.get(), 1));
|
||||
EXPECT_EQ(apm_->kNoError,
|
||||
apm_->echo_control_mobile()->SetEchoPath(echo_path_in, echo_path_size));
|
||||
apm_->echo_control_mobile()->SetEchoPath(echo_path_in.get(),
|
||||
echo_path_size));
|
||||
EXPECT_EQ(apm_->kNoError,
|
||||
apm_->echo_control_mobile()->GetEchoPath(echo_path_out, echo_path_size));
|
||||
apm_->echo_control_mobile()->GetEchoPath(echo_path_out.get(),
|
||||
echo_path_size));
|
||||
for (size_t i = 0; i < echo_path_size; i++) {
|
||||
EXPECT_EQ(echo_path_in[i], echo_path_out[i]);
|
||||
}
|
||||
|
@ -16,8 +16,12 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "google/gflags.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
#include "webrtc/audio_processing/debug.pb.h"
|
||||
|
||||
using webrtc::scoped_array;
|
||||
|
||||
using webrtc::audioproc::Event;
|
||||
using webrtc::audioproc::ReverseStream;
|
||||
using webrtc::audioproc::Stream;
|
||||
@ -41,15 +45,15 @@ bool ReadMessageFromFile(FILE* file,
|
||||
if (size <= 0) {
|
||||
return false;
|
||||
}
|
||||
size_t usize = static_cast<size_t>(size);
|
||||
const size_t usize = static_cast<size_t>(size);
|
||||
|
||||
char array[usize];
|
||||
if (fread(array, sizeof(char), usize, file) != usize) {
|
||||
scoped_array<char> array(new char[usize]);
|
||||
if (fread(array.get(), sizeof(char), usize, file) != usize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
msg->Clear();
|
||||
return msg->ParseFromArray(array, usize);
|
||||
return msg->ParseFromArray(array.get(), usize);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user