Moving to use data files in resources, for ACM.
The files are removed in a separate CL. BUG=issue737 Review URL: https://webrtc-codereview.appspot.com/737004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2625 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
2
DEPS
2
DEPS
@ -14,7 +14,7 @@ vars = {
|
|||||||
|
|
||||||
# External resources like video and audio files used for testing purposes.
|
# External resources like video and audio files used for testing purposes.
|
||||||
# Downloaded on demand when needed.
|
# Downloaded on demand when needed.
|
||||||
"webrtc_resources_revision": "9",
|
"webrtc_resources_revision": "10",
|
||||||
}
|
}
|
||||||
|
|
||||||
# NOTE: Prefer revision numbers to tags for svn deps. Use http rather than
|
# NOTE: Prefer revision numbers to tags for svn deps. Use http rather than
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# This script can be used to verify the bit exactness of iLBC fixed-point version 1.0.6
|
# This script can be used to verify the bit exactness of iLBC fixed-point version 1.0.6
|
||||||
#
|
#
|
||||||
|
|
||||||
INP=../../../../../../../data/audio_coding
|
INP=../../../../../../../resources/audio_coding
|
||||||
EXEP=../../../../../../../out/Release
|
EXEP=../../../../../../../out/Release
|
||||||
OUTP=./GeneratedFiles
|
OUTP=./GeneratedFiles
|
||||||
mkdir ./GeneratedFiles
|
mkdir ./GeneratedFiles
|
||||||
|
@ -256,7 +256,6 @@ APITest::SetUp()
|
|||||||
CHECK_ERROR_MT(_acmB->RegisterSendCodec(dummyCodec));
|
CHECK_ERROR_MT(_acmB->RegisterSendCodec(dummyCodec));
|
||||||
_thereIsEncoderB = true;
|
_thereIsEncoderB = true;
|
||||||
|
|
||||||
char fileName[500];
|
|
||||||
WebRtc_UWord16 frequencyHz;
|
WebRtc_UWord16 frequencyHz;
|
||||||
|
|
||||||
printf("\n\nAPI Test\n");
|
printf("\n\nAPI Test\n");
|
||||||
@ -264,31 +263,30 @@ APITest::SetUp()
|
|||||||
printf("Hit enter to accept the default values indicated in []\n\n");
|
printf("Hit enter to accept the default values indicated in []\n\n");
|
||||||
|
|
||||||
//--- Input A
|
//--- Input A
|
||||||
strcpy(fileName, "./data/audio_coding/testfile32kHz.pcm");
|
std::string file_name =
|
||||||
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
frequencyHz = 32000;
|
frequencyHz = 32000;
|
||||||
printf("Enter input file at side A [%s]: ", fileName);
|
printf("Enter input file at side A [%s]: ", file_name.c_str());
|
||||||
PCMFile::ChooseFile(fileName, 499, &frequencyHz);
|
PCMFile::ChooseFile(&file_name, 499, &frequencyHz);
|
||||||
_inFileA.Open(fileName, frequencyHz, "rb", true);
|
_inFileA.Open(file_name, frequencyHz, "rb", true);
|
||||||
|
|
||||||
//--- Output A
|
//--- Output A
|
||||||
std::string outputFileA = webrtc::test::OutputPath() + "outA.pcm";
|
std::string out_file_a = webrtc::test::OutputPath() + "outA.pcm";
|
||||||
strcpy(fileName, outputFileA.c_str());
|
printf("Enter output file at side A [%s]: ", out_file_a.c_str());
|
||||||
printf("Enter output file at side A [%s]: ", fileName);
|
PCMFile::ChooseFile(&out_file_a, 499, &frequencyHz);
|
||||||
PCMFile::ChooseFile(fileName, 499, &frequencyHz);
|
_outFileA.Open(out_file_a, frequencyHz, "wb");
|
||||||
_outFileA.Open(fileName, frequencyHz, "wb");
|
|
||||||
|
|
||||||
//--- Input B
|
//--- Input B
|
||||||
strcpy(fileName, "./data/audio_coding/testfile32kHz.pcm");
|
file_name = webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
printf("\n\nEnter input file at side B [%s]: ", fileName);
|
printf("\n\nEnter input file at side B [%s]: ", file_name.c_str());
|
||||||
PCMFile::ChooseFile(fileName, 499, &frequencyHz);
|
PCMFile::ChooseFile(&file_name, 499, &frequencyHz);
|
||||||
_inFileB.Open(fileName, frequencyHz, "rb", true);
|
_inFileB.Open(file_name, frequencyHz, "rb", true);
|
||||||
|
|
||||||
//--- Output B
|
//--- Output B
|
||||||
std::string outputFileB = webrtc::test::OutputPath() + "outB.pcm";
|
std::string out_file_b = webrtc::test::OutputPath() + "outB.pcm";
|
||||||
strcpy(fileName, outputFileB.c_str());
|
printf("Enter output file at side B [%s]: ", out_file_b.c_str());
|
||||||
printf("Enter output file at side B [%s]: ", fileName);
|
PCMFile::ChooseFile(&out_file_b, 499, &frequencyHz);
|
||||||
PCMFile::ChooseFile(fileName, 499, &frequencyHz);
|
_outFileB.Open(out_file_b, frequencyHz, "wb");
|
||||||
_outFileB.Open(fileName, frequencyHz, "wb");
|
|
||||||
|
|
||||||
//--- Set A-to-B channel
|
//--- Set A-to-B channel
|
||||||
_channel_A2B = new Channel(2);
|
_channel_A2B = new Channel(2);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "EncodeDecodeTest.h"
|
#include "EncodeDecodeTest.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -59,20 +60,17 @@ void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
|||||||
int noOfCodecs = acm->NumberOfCodecs();
|
int noOfCodecs = acm->NumberOfCodecs();
|
||||||
int codecNo;
|
int codecNo;
|
||||||
|
|
||||||
if (testMode == 1) {
|
// Open input file
|
||||||
// Set the codec, input file, and parameters for the current test.
|
const std::string file_name =
|
||||||
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
|
_pcmFile.Open(file_name, 32000, "rb");
|
||||||
|
|
||||||
|
// Set the codec for the current test.
|
||||||
|
if ((testMode == 0) || (testMode == 1)) {
|
||||||
|
// Set the codec id.
|
||||||
codecNo = codeId;
|
codecNo = codeId;
|
||||||
// Use same input file for now.
|
|
||||||
char fileName[] = "./data/audio_coding/testfile32kHz.pcm";
|
|
||||||
_pcmFile.Open(fileName, 32000, "rb");
|
|
||||||
} else if (testMode == 0) {
|
|
||||||
// Set the codec, input file, and parameters for the current test.
|
|
||||||
codecNo = codeId;
|
|
||||||
acm->Codec(codecNo, sendCodec);
|
|
||||||
// Use same input file for now.
|
|
||||||
char fileName[] = "./data/audio_coding/testfile32kHz.pcm";
|
|
||||||
_pcmFile.Open(fileName, 32000, "rb");
|
|
||||||
} else {
|
} else {
|
||||||
|
// Choose codec on command line.
|
||||||
printf("List of supported codec.\n");
|
printf("List of supported codec.\n");
|
||||||
for (int n = 0; n < noOfCodecs; n++) {
|
for (int n = 0; n < noOfCodecs; n++) {
|
||||||
acm->Codec(n, sendCodec);
|
acm->Codec(n, sendCodec);
|
||||||
@ -80,8 +78,6 @@ void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
|||||||
}
|
}
|
||||||
printf("Choose your codec:");
|
printf("Choose your codec:");
|
||||||
ASSERT_GT(scanf("%d", &codecNo), 0);
|
ASSERT_GT(scanf("%d", &codecNo), 0);
|
||||||
char fileName[] = "./data/audio_coding/testfile32kHz.pcm";
|
|
||||||
_pcmFile.Open(fileName, 32000, "rb");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
acm->Codec(codecNo, sendCodec);
|
acm->Codec(codecNo, sendCodec);
|
||||||
@ -95,8 +91,8 @@ void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
|||||||
codeId);
|
codeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
_acm = acm;
|
_acm = acm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sender::Teardown() {
|
void Sender::Teardown() {
|
||||||
_pcmFile.Close();
|
_pcmFile.Close();
|
||||||
@ -155,30 +151,28 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char filename[256];
|
|
||||||
_rtpStream = rtpStream;
|
|
||||||
int playSampFreq;
|
int playSampFreq;
|
||||||
|
std::string file_name;
|
||||||
|
std::stringstream file_stream;
|
||||||
|
file_stream << webrtc::test::OutputPath() << "encodeDecode_out" <<
|
||||||
|
static_cast<int>(codeId) << ".pcm";
|
||||||
|
file_name = file_stream.str();
|
||||||
|
_rtpStream = rtpStream;
|
||||||
|
|
||||||
if (testMode == 1) {
|
if (testMode == 1) {
|
||||||
playSampFreq=recvCodec.plfreq;
|
playSampFreq=recvCodec.plfreq;
|
||||||
//output file for current run
|
_pcmFile.Open(file_name, recvCodec.plfreq, "wb+");
|
||||||
sprintf(filename,"%s/out%dFile.pcm", webrtc::test::OutputPath().c_str(),
|
|
||||||
codeId);
|
|
||||||
_pcmFile.Open(filename, recvCodec.plfreq, "wb+");
|
|
||||||
} else if (testMode == 0) {
|
} else if (testMode == 0) {
|
||||||
playSampFreq=32000;
|
playSampFreq=32000;
|
||||||
//output file for current run
|
_pcmFile.Open(file_name, 32000, "wb+");
|
||||||
sprintf(filename, "%s/encodeDecode_out%d.pcm",
|
|
||||||
webrtc::test::OutputPath().c_str(), codeId);
|
|
||||||
_pcmFile.Open(filename, 32000/*recvCodec.plfreq*/, "wb+");
|
|
||||||
} else {
|
} else {
|
||||||
printf("\nValid output frequencies:\n");
|
printf("\nValid output frequencies:\n");
|
||||||
printf("8000\n16000\n32000\n-1,");
|
printf("8000\n16000\n32000\n-1,");
|
||||||
printf("which means output freq equal to received signal freq");
|
printf("which means output frequency equal to received signal frequency");
|
||||||
printf("\n\nChoose output sampling frequency: ");
|
printf("\n\nChoose output sampling frequency: ");
|
||||||
ASSERT_GT(scanf("%d", &playSampFreq), 0);
|
ASSERT_GT(scanf("%d", &playSampFreq), 0);
|
||||||
sprintf(filename, "%s/outFile.pcm", webrtc::test::OutputPath().c_str());
|
file_name = webrtc::test::OutputPath() + "encodeDecode_out.pcm";
|
||||||
_pcmFile.Open(filename, 32000, "wb+");
|
_pcmFile.Open(file_name, playSampFreq, "wb+");
|
||||||
}
|
}
|
||||||
|
|
||||||
_realPayloadSizeBytes = 0;
|
_realPayloadSizeBytes = 0;
|
||||||
|
@ -46,7 +46,8 @@ PCMFile::PCMFile(WebRtc_UWord32 timestamp)
|
|||||||
timestamp_ = timestamp;
|
timestamp_ = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word16 PCMFile::ChooseFile(char* filename, WebRtc_Word16 max_len) {
|
WebRtc_Word16 PCMFile::ChooseFile(std::string* file_name,
|
||||||
|
WebRtc_Word16 max_len) {
|
||||||
char tmp_name[MAX_FILE_NAME_LENGTH_BYTE];
|
char tmp_name[MAX_FILE_NAME_LENGTH_BYTE];
|
||||||
|
|
||||||
EXPECT_TRUE(fgets(tmp_name, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL);
|
EXPECT_TRUE(fgets(tmp_name, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL);
|
||||||
@ -78,12 +79,14 @@ WebRtc_Word16 PCMFile::ChooseFile(char* filename, WebRtc_Word16 max_len) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
strncpy(filename, tmp_name, len + 1);
|
std::string tmp_string(tmp_name, len + 1);
|
||||||
|
*file_name = tmp_string;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word16 PCMFile::ChooseFile(char* filename, WebRtc_Word16 max_len,
|
WebRtc_Word16 PCMFile::ChooseFile(std::string* file_name,
|
||||||
|
WebRtc_Word16 max_len,
|
||||||
WebRtc_UWord16* frequency_hz) {
|
WebRtc_UWord16* frequency_hz) {
|
||||||
char tmp_name[MAX_FILE_NAME_LENGTH_BYTE];
|
char tmp_name[MAX_FILE_NAME_LENGTH_BYTE];
|
||||||
|
|
||||||
@ -116,7 +119,8 @@ WebRtc_Word16 PCMFile::ChooseFile(char* filename, WebRtc_Word16 max_len,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
strncpy(filename, tmp_name, len + 1);
|
std::string tmp_string(tmp_name, len + 1);
|
||||||
|
*file_name = tmp_string;
|
||||||
}
|
}
|
||||||
printf("Enter the sampling frequency (in Hz) of the above file [%u]: ",
|
printf("Enter the sampling frequency (in Hz) of the above file [%u]: ",
|
||||||
*frequency_hz);
|
*frequency_hz);
|
||||||
@ -128,10 +132,10 @@ WebRtc_Word16 PCMFile::ChooseFile(char* filename, WebRtc_Word16 max_len,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCMFile::Open(const char* filename, WebRtc_UWord16 frequency,
|
void PCMFile::Open(const std::string& file_name, WebRtc_UWord16 frequency,
|
||||||
const char* mode, bool auto_rewind) {
|
const char* mode, bool auto_rewind) {
|
||||||
if ((pcm_file_ = fopen(filename, mode)) == NULL) {
|
if ((pcm_file_ = fopen(file_name.c_str(), mode)) == NULL) {
|
||||||
printf("Cannot open file %s.\n", filename);
|
printf("Cannot open file %s.\n", file_name.c_str());
|
||||||
ADD_FAILURE() << "Unable to read file";
|
ADD_FAILURE() << "Unable to read file";
|
||||||
}
|
}
|
||||||
frequency_ = frequency;
|
frequency_ = frequency;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "module_common_types.h"
|
#include "module_common_types.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
@ -28,8 +29,9 @@ class PCMFile {
|
|||||||
fclose(pcm_file_);
|
fclose(pcm_file_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Open(const char *filename, WebRtc_UWord16 frequency, const char *mode,
|
|
||||||
bool auto_rewind = false);
|
void Open(const std::string& filename, WebRtc_UWord16 frequency,
|
||||||
|
const char* mode, bool auto_rewind = false);
|
||||||
|
|
||||||
WebRtc_Word32 Read10MsData(AudioFrame& audio_frame);
|
WebRtc_Word32 Read10MsData(AudioFrame& audio_frame);
|
||||||
|
|
||||||
@ -44,9 +46,11 @@ class PCMFile {
|
|||||||
return end_of_file_;
|
return end_of_file_;
|
||||||
}
|
}
|
||||||
void Rewind();
|
void Rewind();
|
||||||
static WebRtc_Word16 ChooseFile(char* filename, WebRtc_Word16 max_len,
|
static WebRtc_Word16 ChooseFile(std::string* file_name,
|
||||||
|
WebRtc_Word16 max_len,
|
||||||
WebRtc_UWord16* frequency_hz);
|
WebRtc_UWord16* frequency_hz);
|
||||||
static WebRtc_Word16 ChooseFile(char* filename, WebRtc_Word16 max_len);
|
static WebRtc_Word16 ChooseFile(std::string* file_name,
|
||||||
|
WebRtc_Word16 max_len);
|
||||||
bool Rewinded();
|
bool Rewinded();
|
||||||
void SaveStereo(bool is_stereo = true);
|
void SaveStereo(bool is_stereo = true);
|
||||||
void ReadStereo(bool is_stereo = true);
|
void ReadStereo(bool is_stereo = true);
|
||||||
|
@ -53,62 +53,45 @@ SpatialAudio::Setup()
|
|||||||
// Register the receiver ACM in channel
|
// Register the receiver ACM in channel
|
||||||
_channel->RegisterReceiverACM(_acmReceiver);
|
_channel->RegisterReceiverACM(_acmReceiver);
|
||||||
|
|
||||||
char audioFileName[MAX_FILE_NAME_LENGTH_BYTE];
|
|
||||||
WebRtc_UWord16 sampFreqHz = 32000;
|
WebRtc_UWord16 sampFreqHz = 32000;
|
||||||
|
|
||||||
strncpy(audioFileName, "./data/audio_coding/testfile32kHz.pcm",
|
const std::string file_name =
|
||||||
MAX_FILE_NAME_LENGTH_BYTE - 1);
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
|
_inFile.Open(file_name, sampFreqHz, "rb", false);
|
||||||
|
|
||||||
|
std::string output_file = webrtc::test::OutputPath() +
|
||||||
|
"out_spatial_autotest.pcm";
|
||||||
if(_testMode == 1)
|
if(_testMode == 1)
|
||||||
{
|
{
|
||||||
printf("Enter the input file [%s]: ", audioFileName);
|
output_file = webrtc::test::OutputPath() + "testspatial_out.pcm";
|
||||||
PCMFile::ChooseFile(audioFileName, MAX_FILE_NAME_LENGTH_BYTE, &sampFreqHz);
|
|
||||||
}
|
|
||||||
_inFile.Open(audioFileName, sampFreqHz, "rb", false);
|
|
||||||
|
|
||||||
if(_testMode == 0)
|
|
||||||
{
|
|
||||||
std::string outputFile = webrtc::test::OutputPath() +
|
|
||||||
"out_spatial_autotest.pcm";
|
|
||||||
strncpy(audioFileName, outputFile.c_str(),
|
|
||||||
MAX_FILE_NAME_LENGTH_BYTE - 1);
|
|
||||||
}
|
|
||||||
else if(_testMode == 1)
|
|
||||||
{
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
std::string outputFile = webrtc::test::OutputPath() +
|
printf("Enter the output file [%s]: ", output_file.c_str());
|
||||||
"testspatial_out.pcm";
|
PCMFile::ChooseFile(&output_file, MAX_FILE_NAME_LENGTH_BYTE,
|
||||||
strncpy(audioFileName, outputFile.c_str(),
|
&sampFreqHz);
|
||||||
MAX_FILE_NAME_LENGTH_BYTE - 1);
|
|
||||||
printf("Enter the output file [%s]: ", audioFileName);
|
|
||||||
PCMFile::ChooseFile(audioFileName, MAX_FILE_NAME_LENGTH_BYTE, &sampFreqHz);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string outputFile = webrtc::test::OutputPath() +
|
output_file = webrtc::test::OutputPath() + "testspatial_out.pcm";
|
||||||
"testspatial_out.pcm";
|
|
||||||
strncpy(audioFileName, outputFile.c_str(),
|
|
||||||
MAX_FILE_NAME_LENGTH_BYTE - 1);
|
|
||||||
}
|
}
|
||||||
_outFile.Open(audioFileName, sampFreqHz, "wb", false);
|
_outFile.Open(output_file, sampFreqHz, "wb", false);
|
||||||
_outFile.SaveStereo(true);
|
_outFile.SaveStereo(true);
|
||||||
|
|
||||||
|
// Register all available codes as receiving codecs.
|
||||||
// Register couple of codecs as receive codec
|
|
||||||
CodecInst codecInst;
|
CodecInst codecInst;
|
||||||
|
int status;
|
||||||
_acmLeft->Codec((WebRtc_UWord8)0, codecInst);
|
WebRtc_UWord8 num_encoders = _acmReceiver->NumberOfCodecs();
|
||||||
codecInst.channels = 2;
|
// Register all available codes as receiving codecs once more.
|
||||||
CHECK_ERROR(_acmReceiver->RegisterReceiveCodec(codecInst));
|
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
||||||
|
status = _acmReceiver->Codec(n, codecInst);
|
||||||
_acmLeft->Codec((WebRtc_UWord8)3, codecInst);
|
if (status < 0) {
|
||||||
codecInst.channels = 2;
|
printf("Error in Codec(), no matching codec found");
|
||||||
CHECK_ERROR(_acmReceiver->RegisterReceiveCodec(codecInst));
|
}
|
||||||
|
status = _acmReceiver->RegisterReceiveCodec(codecInst);
|
||||||
_acmLeft->Codec((WebRtc_UWord8)1, codecInst);
|
if (status < 0) {
|
||||||
CHECK_ERROR(_acmReceiver->RegisterReceiveCodec(codecInst));
|
printf("Error in RegisterReceiveCodec() for payload type %d",
|
||||||
|
codecInst.pltype);
|
||||||
_acmLeft->Codec((WebRtc_UWord8)4, codecInst);
|
}
|
||||||
CHECK_ERROR(_acmReceiver->RegisterReceiveCodec(codecInst));
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -119,7 +102,8 @@ SpatialAudio::Perform()
|
|||||||
if(_testMode == 0)
|
if(_testMode == 0)
|
||||||
{
|
{
|
||||||
printf("Running SpatialAudio Test");
|
printf("Running SpatialAudio Test");
|
||||||
WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceAudioCoding, -1, "---------- SpatialAudio ----------");
|
WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceAudioCoding, -1,
|
||||||
|
"---------- SpatialAudio ----------");
|
||||||
}
|
}
|
||||||
|
|
||||||
Setup();
|
Setup();
|
||||||
|
@ -127,8 +127,10 @@ TestAllCodecs::~TestAllCodecs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TestAllCodecs::Perform() {
|
void TestAllCodecs::Perform() {
|
||||||
char file[] = "./data/audio_coding/testfile32kHz.pcm";
|
|
||||||
infile_a_.Open(file, 32000, "rb");
|
const std::string file_name =
|
||||||
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
|
infile_a_.Open(file_name, 32000, "rb");
|
||||||
|
|
||||||
if (test_mode_ == 0) {
|
if (test_mode_ == 0) {
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioCoding, -1,
|
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioCoding, -1,
|
||||||
@ -792,7 +794,7 @@ void TestAllCodecs::OpenOutFile(int test_number) {
|
|||||||
filename += "testallcodecs_out_";
|
filename += "testallcodecs_out_";
|
||||||
filename += test_number_str.str();
|
filename += test_number_str.str();
|
||||||
filename += ".pcm";
|
filename += ".pcm";
|
||||||
outfile_b_.Open(filename.c_str(), 32000, "wb");
|
outfile_b_.Open(filename, 32000, "wb");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestAllCodecs::DisplaySendReceiveCodec() {
|
void TestAllCodecs::DisplaySendReceiveCodec() {
|
||||||
|
@ -59,9 +59,9 @@ void TestFEC::Perform()
|
|||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioCoding, -1,
|
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioCoding, -1,
|
||||||
"---------- TestFEC ----------");
|
"---------- TestFEC ----------");
|
||||||
}
|
}
|
||||||
char fileName[] = "./data/audio_coding/testfile32kHz.pcm";
|
const std::string file_name =
|
||||||
_inFileA.Open(fileName, 32000, "rb");
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
|
_inFileA.Open(file_name, 32000, "rb");
|
||||||
|
|
||||||
bool fecEnabled;
|
bool fecEnabled;
|
||||||
|
|
||||||
@ -599,21 +599,18 @@ void TestFEC::Run()
|
|||||||
_inFileA.Rewind();
|
_inFileA.Rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestFEC::OpenOutFile(WebRtc_Word16 testNumber)
|
void TestFEC::OpenOutFile(WebRtc_Word16 test_number) {
|
||||||
{
|
std::string file_name;
|
||||||
char fileName[500];
|
std::stringstream file_stream;
|
||||||
|
file_stream << webrtc::test::OutputPath();
|
||||||
if(_testMode == 0)
|
if (_testMode == 0) {
|
||||||
{
|
file_stream << "TestFEC_autoFile_";
|
||||||
sprintf(fileName, "%s/TestFEC_autoFile_%02d.pcm",
|
} else {
|
||||||
webrtc::test::OutputPath().c_str(), testNumber);
|
file_stream << "TestFEC_outFile_";
|
||||||
}
|
}
|
||||||
else
|
file_stream << test_number << ".pcm";
|
||||||
{
|
file_name = file_stream.str();
|
||||||
sprintf(fileName, "%s/TestFEC_outFile_%02d.pcm",
|
_outFileB.Open(file_name, 16000, "wb");
|
||||||
webrtc::test::OutputPath().c_str(), testNumber);
|
|
||||||
}
|
|
||||||
_outFileB.Open(fileName, 32000, "wb");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestFEC::DisplaySendReceiveCodec()
|
void TestFEC::DisplaySendReceiveCodec()
|
||||||
|
@ -144,8 +144,6 @@ TestStereo::~TestStereo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TestStereo::Perform() {
|
void TestStereo::Perform() {
|
||||||
char file_name_stereo[500];
|
|
||||||
char file_name_mono[500];
|
|
||||||
WebRtc_UWord16 frequency_hz;
|
WebRtc_UWord16 frequency_hz;
|
||||||
int audio_channels;
|
int audio_channels;
|
||||||
int codec_channels;
|
int codec_channels;
|
||||||
@ -160,9 +158,10 @@ void TestStereo::Perform() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open both mono and stereo test files in 32 kHz.
|
// Open both mono and stereo test files in 32 kHz.
|
||||||
strcpy(file_name_stereo, "./data/audio_coding/teststereo32kHz.pcm");
|
const std::string file_name_stereo =
|
||||||
strcpy(file_name_mono, "./data/audio_coding/testfile32kHz.pcm");
|
webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm");
|
||||||
|
const std::string file_name_mono =
|
||||||
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
frequency_hz = 32000;
|
frequency_hz = 32000;
|
||||||
in_file_stereo_ = new PCMFile();
|
in_file_stereo_ = new PCMFile();
|
||||||
in_file_mono_ = new PCMFile();
|
in_file_mono_ = new PCMFile();
|
||||||
@ -655,7 +654,7 @@ void TestStereo::RegisterSendCodec(char side, char* codec_name,
|
|||||||
int payload_type) {
|
int payload_type) {
|
||||||
if (test_mode_ != 0) {
|
if (test_mode_ != 0) {
|
||||||
// Print out codec and settings
|
// Print out codec and settings
|
||||||
printf("Codec: %s Freq: %d Rate: %d PackSize: %d", codec_name,
|
printf("Codec: %s Freq: %d Rate: %d PackSize: %d\n", codec_name,
|
||||||
sampling_freq_hz, rate, pack_size);
|
sampling_freq_hz, rate, pack_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,9 +775,11 @@ void TestStereo::Run(TestPackStereo* channel, int in_channels, int out_channels,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TestStereo::OpenOutFile(WebRtc_Word16 test_number) {
|
void TestStereo::OpenOutFile(WebRtc_Word16 test_number) {
|
||||||
char file_name[500];
|
std::string file_name;
|
||||||
sprintf(file_name, "%s/teststereo_out_%02d.pcm",
|
std::stringstream file_stream;
|
||||||
webrtc::test::OutputPath().c_str(), test_number);
|
file_stream << webrtc::test::OutputPath() << "teststereo_out_"
|
||||||
|
<< test_number << ".pcm";
|
||||||
|
file_name = file_stream.str();
|
||||||
out_file_.Open(file_name, 32000, "wb");
|
out_file_.Open(file_name, 32000, "wb");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,8 +59,10 @@ void TestVADDTX::Perform()
|
|||||||
WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceAudioCoding, -1,
|
WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceAudioCoding, -1,
|
||||||
"---------- TestVADDTX ----------");
|
"---------- TestVADDTX ----------");
|
||||||
}
|
}
|
||||||
char fileName[] = "./data/audio_coding/testfile32kHz.pcm";
|
|
||||||
_inFileA.Open(fileName, 32000, "rb");
|
const std::string file_name =
|
||||||
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
|
_inFileA.Open(file_name, 32000, "rb");
|
||||||
|
|
||||||
_acmA = AudioCodingModule::Create(0);
|
_acmA = AudioCodingModule::Create(0);
|
||||||
_acmB = AudioCodingModule::Create(1);
|
_acmB = AudioCodingModule::Create(1);
|
||||||
@ -354,20 +356,18 @@ void TestVADDTX::Run()
|
|||||||
_monitor.ResetStatistics();
|
_monitor.ResetStatistics();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestVADDTX::OpenOutFile(WebRtc_Word16 testNumber)
|
void TestVADDTX::OpenOutFile(WebRtc_Word16 test_number) {
|
||||||
{
|
std::string file_name;
|
||||||
char fileName[500];
|
std::stringstream file_stream;
|
||||||
if(_testMode == 0)
|
file_stream << webrtc::test::OutputPath();
|
||||||
{
|
if (_testMode == 0) {
|
||||||
sprintf(fileName, "%s/testVADDTX_autoFile_%02d.pcm",
|
file_stream << "testVADDTX_autoFile_";
|
||||||
webrtc::test::OutputPath().c_str(), testNumber);
|
} else {
|
||||||
}
|
file_stream << "testVADDTX_outFile_";
|
||||||
else
|
}
|
||||||
{
|
file_stream << test_number << ".pcm";
|
||||||
sprintf(fileName, "%s/testVADDTX_outFile_%02d.pcm",
|
file_name = file_stream.str();
|
||||||
webrtc::test::OutputPath().c_str(), testNumber);
|
_outFileB.Open(file_name, 16000, "wb");
|
||||||
}
|
|
||||||
_outFileB.Open(fileName, 16000, "wb");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,64 +95,6 @@ TwoWayCommunication::ChooseCodec(WebRtc_UWord8* codecID_A,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word16
|
|
||||||
TwoWayCommunication::ChooseFile(char* fileName, WebRtc_Word16 maxLen,
|
|
||||||
WebRtc_UWord16* frequencyHz)
|
|
||||||
{
|
|
||||||
char tmpName[MAX_FILE_NAME_LENGTH_BYTE];
|
|
||||||
//strcpy(_fileName, "in.pcm");
|
|
||||||
//printf("\n\nPlease enter the input file: ");
|
|
||||||
EXPECT_TRUE(fgets(tmpName, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL);
|
|
||||||
tmpName[MAX_FILE_NAME_LENGTH_BYTE-1] = '\0';
|
|
||||||
WebRtc_Word16 n = 0;
|
|
||||||
|
|
||||||
// removing leading spaces
|
|
||||||
while((isspace(tmpName[n]) || iscntrl(tmpName[n])) &&
|
|
||||||
(tmpName[n] != 0) &&
|
|
||||||
(n < MAX_FILE_NAME_LENGTH_BYTE))
|
|
||||||
{
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
if(n > 0)
|
|
||||||
{
|
|
||||||
memmove(tmpName, &tmpName[n], MAX_FILE_NAME_LENGTH_BYTE - n);
|
|
||||||
}
|
|
||||||
|
|
||||||
//removing trailing spaces
|
|
||||||
n = (WebRtc_Word16)(strlen(tmpName) - 1);
|
|
||||||
if(n >= 0)
|
|
||||||
{
|
|
||||||
while((isspace(tmpName[n]) || iscntrl(tmpName[n])) &&
|
|
||||||
(n >= 0))
|
|
||||||
{
|
|
||||||
n--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(n >= 0)
|
|
||||||
{
|
|
||||||
tmpName[n + 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word16 len = (WebRtc_Word16)strlen(tmpName);
|
|
||||||
if(len > maxLen)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(len > 0)
|
|
||||||
{
|
|
||||||
strncpy(fileName, tmpName, len+1);
|
|
||||||
}
|
|
||||||
printf("Enter the sampling frequency (in Hz) of the above file [%u]: ",
|
|
||||||
*frequencyHz);
|
|
||||||
EXPECT_TRUE(fgets(tmpName, 6, stdin) != NULL);
|
|
||||||
WebRtc_UWord16 tmpFreq = (WebRtc_UWord16)atoi(tmpName);
|
|
||||||
if(tmpFreq > 0)
|
|
||||||
{
|
|
||||||
*frequencyHz = tmpFreq;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word16 TwoWayCommunication::SetUp()
|
WebRtc_Word16 TwoWayCommunication::SetUp()
|
||||||
{
|
{
|
||||||
_acmA = AudioCodingModule::Create(1);
|
_acmA = AudioCodingModule::Create(1);
|
||||||
@ -198,47 +140,41 @@ WebRtc_Word16 TwoWayCommunication::SetUp()
|
|||||||
CHECK_ERROR(_acmRefB->RegisterSendCodec(codecInst_B));
|
CHECK_ERROR(_acmRefB->RegisterSendCodec(codecInst_B));
|
||||||
CHECK_ERROR(_acmRefB->RegisterReceiveCodec(codecInst_A));
|
CHECK_ERROR(_acmRefB->RegisterReceiveCodec(codecInst_A));
|
||||||
|
|
||||||
char fileName[500];
|
|
||||||
char refFileName[500];
|
|
||||||
WebRtc_UWord16 frequencyHz;
|
WebRtc_UWord16 frequencyHz;
|
||||||
|
|
||||||
//--- Input A
|
//--- Input A
|
||||||
strcpy(fileName, "./data/audio_coding/testfile32kHz.pcm");
|
std::string in_file_name =
|
||||||
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
frequencyHz = 32000;
|
frequencyHz = 32000;
|
||||||
printf("Enter input file at side A [%s]: ", fileName);
|
printf("Enter input file at side A [%s]: ", in_file_name.c_str());
|
||||||
ChooseFile(fileName, 499, &frequencyHz);
|
PCMFile::ChooseFile(&in_file_name, 499, &frequencyHz);
|
||||||
|
_inFileA.Open(in_file_name, frequencyHz, "rb");
|
||||||
|
|
||||||
_inFileA.Open(fileName, frequencyHz, "rb");
|
|
||||||
|
|
||||||
//--- Output A
|
//--- Output A
|
||||||
std::string outputFileA = webrtc::test::OutputPath() + "outA.pcm";
|
std::string out_file_a = webrtc::test::OutputPath() + "outA.pcm";
|
||||||
strcpy(fileName, outputFileA.c_str());
|
printf("Output file at side A: %s\n", out_file_a.c_str());
|
||||||
frequencyHz = 16000;
|
printf("Sampling frequency (in Hz) of the above file: %u\n",
|
||||||
printf("Enter output file at side A [%s]: ", fileName);
|
frequencyHz);
|
||||||
ChooseFile(fileName, 499, &frequencyHz);
|
_outFileA.Open(out_file_a, frequencyHz, "wb");
|
||||||
_outFileA.Open(fileName, frequencyHz, "wb");
|
std::string ref_file_name = webrtc::test::OutputPath() + "ref_outA.pcm";
|
||||||
strcpy(refFileName, "ref_");
|
_outFileRefA.Open(ref_file_name, frequencyHz, "wb");
|
||||||
strcat(refFileName, fileName);
|
|
||||||
_outFileRefA.Open(refFileName, frequencyHz, "wb");
|
|
||||||
|
|
||||||
//--- Input B
|
//--- Input B
|
||||||
strcpy(fileName, "./data/audio_coding/testfile32kHz.pcm");
|
in_file_name =
|
||||||
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
frequencyHz = 32000;
|
frequencyHz = 32000;
|
||||||
printf("\n\nEnter input file at side B [%s]: ", fileName);
|
printf("\n\nEnter input file at side B [%s]: ", in_file_name.c_str());
|
||||||
ChooseFile(fileName, 499, &frequencyHz);
|
PCMFile::ChooseFile(&in_file_name, 499, &frequencyHz);
|
||||||
_inFileB.Open(fileName, frequencyHz, "rb");
|
_inFileB.Open(in_file_name, frequencyHz, "rb");
|
||||||
|
|
||||||
//--- Output B
|
//--- Output B
|
||||||
std::string outputFileB = webrtc::test::OutputPath() + "outB.pcm";
|
std::string out_file_b = webrtc::test::OutputPath() + "outB.pcm";
|
||||||
strcpy(fileName, outputFileB.c_str());
|
printf("Output file at side B: %s\n", out_file_b.c_str());
|
||||||
frequencyHz = 16000;
|
printf("Sampling frequency (in Hz) of the above file: %u\n",
|
||||||
printf("Enter output file at side B [%s]: ", fileName);
|
frequencyHz);
|
||||||
ChooseFile(fileName, 499, &frequencyHz);
|
_outFileB.Open(out_file_b, frequencyHz, "wb");
|
||||||
_outFileB.Open(fileName, frequencyHz, "wb");
|
ref_file_name = webrtc::test::OutputPath() + "ref_outB.pcm";
|
||||||
strcpy(refFileName, "ref_");
|
_outFileRefB.Open(ref_file_name, frequencyHz, "wb");
|
||||||
strcat(refFileName, fileName);
|
|
||||||
_outFileRefB.Open(refFileName, frequencyHz, "wb");
|
|
||||||
|
|
||||||
//--- Set A-to-B channel
|
//--- Set A-to-B channel
|
||||||
_channel_A2B = new Channel;
|
_channel_A2B = new Channel;
|
||||||
@ -308,38 +244,30 @@ WebRtc_Word16 TwoWayCommunication::SetUpAutotest()
|
|||||||
CHECK_ERROR(_acmRefB->RegisterSendCodec(codecInst_B));
|
CHECK_ERROR(_acmRefB->RegisterSendCodec(codecInst_B));
|
||||||
CHECK_ERROR(_acmRefB->RegisterReceiveCodec(codecInst_A));
|
CHECK_ERROR(_acmRefB->RegisterReceiveCodec(codecInst_A));
|
||||||
|
|
||||||
char fileName[500];
|
|
||||||
char refFileName[500];
|
|
||||||
WebRtc_UWord16 frequencyHz;
|
WebRtc_UWord16 frequencyHz;
|
||||||
|
|
||||||
|
//--- Input A and B
|
||||||
//--- Input A
|
std::string in_file_name =
|
||||||
strcpy(fileName, "./data/audio_coding/testfile32kHz.pcm");
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
frequencyHz = 16000;
|
frequencyHz = 16000;
|
||||||
_inFileA.Open(fileName, frequencyHz, "rb");
|
_inFileA.Open(in_file_name, frequencyHz, "rb");
|
||||||
|
_inFileB.Open(in_file_name, frequencyHz, "rb");
|
||||||
|
|
||||||
//--- Output A
|
//--- Output A
|
||||||
std::string outputFileA = webrtc::test::OutputPath() + "outAutotestA.pcm";
|
std::string output_file_a = webrtc::test::OutputPath() + "outAutotestA.pcm";
|
||||||
strcpy(fileName, outputFileA.c_str());
|
|
||||||
frequencyHz = 16000;
|
frequencyHz = 16000;
|
||||||
_outFileA.Open(fileName, frequencyHz, "wb");
|
_outFileA.Open(output_file_a, frequencyHz, "wb");
|
||||||
std::string outputRefFileA = webrtc::test::OutputPath() + "ref_outAutotestA.pcm";
|
std::string output_ref_file_a = webrtc::test::OutputPath() +
|
||||||
strcpy(refFileName, outputRefFileA.c_str());
|
"ref_outAutotestA.pcm";
|
||||||
_outFileRefA.Open(refFileName, frequencyHz, "wb");
|
_outFileRefA.Open(output_ref_file_a, frequencyHz, "wb");
|
||||||
|
|
||||||
//--- Input B
|
|
||||||
strcpy(fileName, "./data/audio_coding/testfile32kHz.pcm");
|
|
||||||
frequencyHz = 16000;
|
|
||||||
_inFileB.Open(fileName, frequencyHz, "rb");
|
|
||||||
|
|
||||||
//--- Output B
|
//--- Output B
|
||||||
std::string outputFileB = webrtc::test::OutputPath() + "outAutotestB.pcm";
|
std::string output_file_b = webrtc::test::OutputPath() + "outAutotestB.pcm";
|
||||||
strcpy(fileName, outputFileB.c_str());
|
|
||||||
frequencyHz = 16000;
|
frequencyHz = 16000;
|
||||||
_outFileB.Open(fileName, frequencyHz, "wb");
|
_outFileB.Open(output_file_b, frequencyHz, "wb");
|
||||||
std::string outputRefFileB = webrtc::test::OutputPath() + "ref_outAutotestB.pcm";
|
std::string output_ref_file_b = webrtc::test::OutputPath() +
|
||||||
strcpy(refFileName, outputRefFileB.c_str());
|
"ref_outAutotestB.pcm";
|
||||||
_outFileRefB.Open(refFileName, frequencyHz, "wb");
|
_outFileRefB.Open(output_ref_file_b, frequencyHz, "wb");
|
||||||
|
|
||||||
//--- Set A-to-B channel
|
//--- Set A-to-B channel
|
||||||
_channel_A2B = new Channel;
|
_channel_A2B = new Channel;
|
||||||
|
@ -28,7 +28,6 @@ public:
|
|||||||
void Perform();
|
void Perform();
|
||||||
private:
|
private:
|
||||||
WebRtc_UWord8 ChooseCodec(WebRtc_UWord8* codecID_A, WebRtc_UWord8* codecID_B);
|
WebRtc_UWord8 ChooseCodec(WebRtc_UWord8* codecID_A, WebRtc_UWord8* codecID_B);
|
||||||
WebRtc_Word16 ChooseFile(char* fileName, WebRtc_Word16 maxLen, WebRtc_UWord16* frequencyHz);
|
|
||||||
WebRtc_Word16 SetUp();
|
WebRtc_Word16 SetUp();
|
||||||
WebRtc_Word16 SetUpAutotest();
|
WebRtc_Word16 SetUpAutotest();
|
||||||
|
|
||||||
|
@ -184,8 +184,8 @@ ISACTest::Setup()
|
|||||||
CHECK_ERROR(_acmB->RegisterTransportCallback(_channel_B2A));
|
CHECK_ERROR(_acmB->RegisterTransportCallback(_channel_B2A));
|
||||||
_channel_B2A->RegisterReceiverACM(_acmA);
|
_channel_B2A->RegisterReceiverACM(_acmA);
|
||||||
|
|
||||||
strncpy(_fileNameSWB, "./data/audio_coding/testfile32kHz.pcm",
|
file_name_swb_ =
|
||||||
MAX_FILE_NAME_LENGTH_BYTE);
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||||
|
|
||||||
_acmB->RegisterSendCodec(_paramISAC16kHz);
|
_acmB->RegisterSendCodec(_paramISAC16kHz);
|
||||||
_acmA->RegisterSendCodec(_paramISAC32kHz);
|
_acmA->RegisterSendCodec(_paramISAC32kHz);
|
||||||
@ -199,11 +199,11 @@ ISACTest::Setup()
|
|||||||
printf("%s %d\n", _paramISAC16kHz.plname, _paramISAC16kHz.plfreq);
|
printf("%s %d\n", _paramISAC16kHz.plname, _paramISAC16kHz.plfreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
_inFileA.Open(_fileNameSWB, 32000, "rb");
|
_inFileA.Open(file_name_swb_, 32000, "rb");
|
||||||
std::string fileNameA = webrtc::test::OutputPath() + "testisac_a.pcm";
|
std::string fileNameA = webrtc::test::OutputPath() + "testisac_a.pcm";
|
||||||
std::string fileNameB = webrtc::test::OutputPath() + "testisac_b.pcm";
|
std::string fileNameB = webrtc::test::OutputPath() + "testisac_b.pcm";
|
||||||
_outFileA.Open(fileNameA.c_str(), 32000, "wb");
|
_outFileA.Open(fileNameA, 32000, "wb");
|
||||||
_outFileB.Open(fileNameB.c_str(), 32000, "wb");
|
_outFileB.Open(fileNameB, 32000, "wb");
|
||||||
|
|
||||||
while(!_inFileA.EndOfFile())
|
while(!_inFileA.EndOfFile())
|
||||||
{
|
{
|
||||||
@ -378,48 +378,32 @@ ISACTest::EncodeDecode(
|
|||||||
{
|
{
|
||||||
printf("\nTest %d:\n\n", testNr);
|
printf("\nTest %d:\n\n", testNr);
|
||||||
}
|
}
|
||||||
char fileNameOut[MAX_FILE_NAME_LENGTH_BYTE];
|
|
||||||
|
|
||||||
// Files in Side A
|
// Files in Side A and B
|
||||||
_inFileA.Open(_fileNameSWB, 32000, "rb", true);
|
_inFileA.Open(file_name_swb_, 32000, "rb", true);
|
||||||
|
_inFileB.Open(file_name_swb_, 32000, "rb", true);
|
||||||
|
|
||||||
|
std::string file_name_out;
|
||||||
|
std::stringstream file_stream_a;
|
||||||
|
std::stringstream file_stream_b;
|
||||||
|
file_stream_a << webrtc::test::OutputPath();
|
||||||
|
file_stream_b << webrtc::test::OutputPath();
|
||||||
if(_testMode == 0)
|
if(_testMode == 0)
|
||||||
{
|
{
|
||||||
sprintf(fileNameOut,
|
file_stream_a << "out_iSACTest_A_" << testNr << ".pcm";
|
||||||
"%s/out_iSACTest_%s_%02d.pcm",
|
file_stream_b << "out_iSACTest_B_" << testNr << ".pcm";
|
||||||
webrtc::test::OutputPath().c_str(),
|
|
||||||
"A",
|
|
||||||
testNr);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(fileNameOut,
|
file_stream_a << "outA_" << testNr << ".pcm";
|
||||||
"%s/out%s_%02d.pcm",
|
file_stream_b << "outB_" << testNr << ".pcm";
|
||||||
webrtc::test::OutputPath().c_str(),
|
|
||||||
"A",
|
|
||||||
testNr);
|
|
||||||
}
|
}
|
||||||
_outFileA.Open(fileNameOut, 32000, "wb");
|
file_name_out = file_stream_a.str();
|
||||||
|
_outFileA.Open(file_name_out, 32000, "wb");
|
||||||
|
file_name_out = file_stream_b.str();
|
||||||
|
_outFileB.Open(file_name_out, 32000, "wb");
|
||||||
|
|
||||||
// Files in Side B
|
|
||||||
_inFileB.Open(_fileNameSWB, 32000, "rb", true);
|
|
||||||
if(_testMode == 0)
|
|
||||||
{
|
|
||||||
sprintf(fileNameOut,
|
|
||||||
"%s/out_iSACTest_%s_%02d.pcm",
|
|
||||||
webrtc::test::OutputPath().c_str(),
|
|
||||||
"B",
|
|
||||||
testNr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(fileNameOut,
|
|
||||||
"%s/out%s_%02d.pcm",
|
|
||||||
webrtc::test::OutputPath().c_str(),
|
|
||||||
"B",
|
|
||||||
testNr);
|
|
||||||
}
|
|
||||||
_outFileB.Open(fileNameOut, 32000, "wb");
|
|
||||||
|
|
||||||
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC16kHz));
|
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC16kHz));
|
||||||
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
|
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
|
||||||
|
|
||||||
@ -491,48 +475,31 @@ ISACTest::SwitchingSamplingRate(
|
|||||||
int testNr,
|
int testNr,
|
||||||
int maxSampRateChange)
|
int maxSampRateChange)
|
||||||
{
|
{
|
||||||
char fileNameOut[MAX_FILE_NAME_LENGTH_BYTE];
|
|
||||||
|
|
||||||
// Files in Side A
|
// Files in Side A
|
||||||
_inFileA.Open(_fileNameSWB, 32000, "rb");
|
_inFileA.Open(file_name_swb_, 32000, "rb");
|
||||||
|
_inFileB.Open(file_name_swb_, 32000, "rb");
|
||||||
|
|
||||||
|
std::string file_name_out;
|
||||||
|
std::stringstream file_stream_a;
|
||||||
|
std::stringstream file_stream_b;
|
||||||
|
file_stream_a << webrtc::test::OutputPath();
|
||||||
|
file_stream_b << webrtc::test::OutputPath();
|
||||||
if(_testMode == 0)
|
if(_testMode == 0)
|
||||||
{
|
{
|
||||||
sprintf(fileNameOut,
|
file_stream_a << "out_iSACTest_A_" << testNr << ".pcm";
|
||||||
"%s/out_iSACTest_%s_%02d.pcm",
|
file_stream_b << "out_iSACTest_B_" << testNr << ".pcm";
|
||||||
webrtc::test::OutputPath().c_str(),
|
|
||||||
"A",
|
|
||||||
testNr);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("\nTest %d", testNr);
|
printf("\nTest %d", testNr);
|
||||||
printf(" Alternate between WB and SWB at the sender Side\n\n");
|
printf(" Alternate between WB and SWB at the sender Side\n\n");
|
||||||
sprintf(fileNameOut,
|
file_stream_a << "outA_" << testNr << ".pcm";
|
||||||
"%s/out%s_%02d.pcm",
|
file_stream_b << "outB_" << testNr << ".pcm";
|
||||||
webrtc::test::OutputPath().c_str(),
|
|
||||||
"A",
|
|
||||||
testNr);
|
|
||||||
}
|
}
|
||||||
_outFileA.Open(fileNameOut, 32000, "wb", true);
|
file_name_out = file_stream_a.str();
|
||||||
|
_outFileA.Open(file_name_out, 32000, "wb");
|
||||||
// Files in Side B
|
file_name_out = file_stream_b.str();
|
||||||
_inFileB.Open(_fileNameSWB, 32000, "rb");
|
_outFileB.Open(file_name_out, 32000, "wb");
|
||||||
if(_testMode == 0)
|
|
||||||
{
|
|
||||||
sprintf(fileNameOut,
|
|
||||||
"%s/out_iSACTest_%s_%02d.pcm",
|
|
||||||
webrtc::test::OutputPath().c_str(),
|
|
||||||
"B",
|
|
||||||
testNr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(fileNameOut, "%s/out%s_%02d.pcm",
|
|
||||||
webrtc::test::OutputPath().c_str(),
|
|
||||||
"B",
|
|
||||||
testNr);
|
|
||||||
}
|
|
||||||
_outFileB.Open(fileNameOut, 32000, "wb", true);
|
|
||||||
|
|
||||||
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
|
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
|
||||||
CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC16kHz));
|
CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC16kHz));
|
||||||
@ -557,14 +524,14 @@ ISACTest::SwitchingSamplingRate(
|
|||||||
{
|
{
|
||||||
if(_testMode != 0) printf("\nSide A switched to Send Super-Wideband\n");
|
if(_testMode != 0) printf("\nSide A switched to Send Super-Wideband\n");
|
||||||
_inFileA.Close();
|
_inFileA.Close();
|
||||||
_inFileA.Open(_fileNameSWB, 32000, "rb");
|
_inFileA.Open(file_name_swb_, 32000, "rb");
|
||||||
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
|
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(_testMode != 0) printf("\nSide A switched to Send Wideband\n");
|
if(_testMode != 0) printf("\nSide A switched to Send Wideband\n");
|
||||||
_inFileA.Close();
|
_inFileA.Close();
|
||||||
_inFileA.Open(_fileNameSWB, 32000, "rb");
|
_inFileA.Open(file_name_swb_, 32000, "rb");
|
||||||
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC16kHz));
|
CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC16kHz));
|
||||||
}
|
}
|
||||||
numSendCodecChanged++;
|
numSendCodecChanged++;
|
||||||
@ -576,14 +543,14 @@ ISACTest::SwitchingSamplingRate(
|
|||||||
{
|
{
|
||||||
if(_testMode != 0) printf("\nSide B switched to Send Super-Wideband\n");
|
if(_testMode != 0) printf("\nSide B switched to Send Super-Wideband\n");
|
||||||
_inFileB.Close();
|
_inFileB.Close();
|
||||||
_inFileB.Open(_fileNameSWB, 32000, "rb");
|
_inFileB.Open(file_name_swb_, 32000, "rb");
|
||||||
CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC32kHz));
|
CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC32kHz));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(_testMode != 0) printf("\nSide B switched to Send Wideband\n");
|
if(_testMode != 0) printf("\nSide B switched to Send Wideband\n");
|
||||||
_inFileB.Close();
|
_inFileB.Close();
|
||||||
_inFileB.Open(_fileNameSWB, 32000, "rb");
|
_inFileB.Open(file_name_swb_, 32000, "rb");
|
||||||
CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC16kHz));
|
CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC16kHz));
|
||||||
}
|
}
|
||||||
numSendCodecChanged++;
|
numSendCodecChanged++;
|
||||||
|
@ -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
|
* 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
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@ -11,6 +11,8 @@
|
|||||||
#ifndef ACM_ISAC_TEST_H
|
#ifndef ACM_ISAC_TEST_H
|
||||||
#define ACM_ISAC_TEST_H
|
#define ACM_ISAC_TEST_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "ACMTest.h"
|
#include "ACMTest.h"
|
||||||
#include "Channel.h"
|
#include "Channel.h"
|
||||||
#include "PCMFile.h"
|
#include "PCMFile.h"
|
||||||
@ -81,8 +83,7 @@ private:
|
|||||||
CodecInst _paramISAC16kHz;
|
CodecInst _paramISAC16kHz;
|
||||||
CodecInst _paramISAC32kHz;
|
CodecInst _paramISAC32kHz;
|
||||||
|
|
||||||
char _fileNameWB[MAX_FILE_NAME_LENGTH_BYTE];
|
std::string file_name_swb_;
|
||||||
char _fileNameSWB[MAX_FILE_NAME_LENGTH_BYTE];
|
|
||||||
|
|
||||||
ACMTestTimer _myTimer;
|
ACMTestTimer _myTimer;
|
||||||
int _testMode;
|
int _testMode;
|
||||||
|
Reference in New Issue
Block a user