Formatting ACM tests
Pure formatting of all files located in /webrtc/modules/audio_coding/main/test/ Smaller manual modifications done after using Eclipse formatting tool, like wrapping long lines (mostly comments). BUG=issue1024 Review URL: https://webrtc-codereview.appspot.com/1342004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3946 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -27,20 +27,18 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
TestPacketization::TestPacketization(RTPStream *rtpStream,
|
||||
uint16_t frequency)
|
||||
TestPacketization::TestPacketization(RTPStream *rtpStream, uint16_t frequency)
|
||||
: _rtpStream(rtpStream),
|
||||
_frequency(frequency),
|
||||
_seqNo(0) {
|
||||
}
|
||||
|
||||
TestPacketization::~TestPacketization() { }
|
||||
TestPacketization::~TestPacketization() {
|
||||
}
|
||||
|
||||
int32_t TestPacketization::SendData(
|
||||
const FrameType /* frameType */,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
const uint8_t* payloadData,
|
||||
const FrameType /* frameType */, const uint8_t payloadType,
|
||||
const uint32_t timeStamp, const uint8_t* payloadData,
|
||||
const uint16_t payloadSize,
|
||||
const RTPFragmentationHeader* /* fragmentation */) {
|
||||
_rtpStream->Write(payloadType, timeStamp, _seqNo++, payloadData, payloadSize,
|
||||
@ -62,8 +60,8 @@ void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
||||
int codecNo;
|
||||
|
||||
// Open input file
|
||||
const std::string file_name =
|
||||
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||
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.
|
||||
@ -127,7 +125,7 @@ void Sender::Run() {
|
||||
if (!Add10MsData()) {
|
||||
break;
|
||||
}
|
||||
if (!Process()) { // This could be done in a processing thread
|
||||
if (!Process()) { // This could be done in a processing thread
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -155,16 +153,16 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
||||
int playSampFreq;
|
||||
std::string file_name;
|
||||
std::stringstream file_stream;
|
||||
file_stream << webrtc::test::OutputPath() << "encodeDecode_out" <<
|
||||
static_cast<int>(codeId) << ".pcm";
|
||||
file_stream << webrtc::test::OutputPath() << "encodeDecode_out"
|
||||
<< static_cast<int>(codeId) << ".pcm";
|
||||
file_name = file_stream.str();
|
||||
_rtpStream = rtpStream;
|
||||
|
||||
if (testMode == 1) {
|
||||
playSampFreq=recvCodec.plfreq;
|
||||
playSampFreq = recvCodec.plfreq;
|
||||
_pcmFile.Open(file_name, recvCodec.plfreq, "wb+");
|
||||
} else if (testMode == 0) {
|
||||
playSampFreq=32000;
|
||||
playSampFreq = 32000;
|
||||
_pcmFile.Open(file_name, 32000, "wb+");
|
||||
} else {
|
||||
printf("\nValid output frequencies:\n");
|
||||
@ -172,7 +170,7 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
||||
printf("which means output frequency equal to received signal frequency");
|
||||
printf("\n\nChoose output sampling frequency: ");
|
||||
ASSERT_GT(scanf("%d", &playSampFreq), 0);
|
||||
file_name = webrtc::test::OutputPath() + "encodeDecode_out.pcm";
|
||||
file_name = webrtc::test::OutputPath() + "encodeDecode_out.pcm";
|
||||
_pcmFile.Open(file_name, playSampFreq, "wb+");
|
||||
}
|
||||
|
||||
@ -184,7 +182,7 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
||||
}
|
||||
|
||||
void Receiver::Teardown() {
|
||||
delete [] _playoutBuffer;
|
||||
delete[] _playoutBuffer;
|
||||
_pcmFile.Close();
|
||||
if (testMode > 1)
|
||||
Trace::ReturnTrace();
|
||||
@ -205,16 +203,16 @@ bool Receiver::IncomingPacket() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t ok = _acm->IncomingPacket(_incomingPayload,
|
||||
_realPayloadSizeBytes, _rtpInfo);
|
||||
if (ok != 0) {
|
||||
printf("Error when inserting packet to ACM, for run: codecId: %d\n",
|
||||
codeId);
|
||||
}
|
||||
_realPayloadSizeBytes = _rtpStream->Read(&_rtpInfo, _incomingPayload,
|
||||
_payloadSizeBytes, &_nextTime);
|
||||
int32_t ok = _acm->IncomingPacket(_incomingPayload, _realPayloadSizeBytes,
|
||||
_rtpInfo);
|
||||
if (ok != 0) {
|
||||
printf("Error when inserting packet to ACM, for run: codecId: %d\n",
|
||||
codeId);
|
||||
}
|
||||
_realPayloadSizeBytes = _rtpStream->Read(&_rtpInfo, _incomingPayload,
|
||||
_payloadSizeBytes, &_nextTime);
|
||||
if (_realPayloadSizeBytes == 0 && _rtpStream->EndOfFile()) {
|
||||
_firstTime = true;
|
||||
}
|
||||
@ -233,8 +231,7 @@ bool Receiver::PlayoutData() {
|
||||
if (_playoutLengthSmpls == 0) {
|
||||
return false;
|
||||
}
|
||||
_pcmFile.Write10MsData(audioFrame.data_,
|
||||
audioFrame.samples_per_channel_);
|
||||
_pcmFile.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -265,20 +262,20 @@ void Receiver::Run() {
|
||||
EncodeDecodeTest::EncodeDecodeTest() {
|
||||
_testMode = 2;
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_encdec_trace.txt").c_str());
|
||||
Trace::SetTraceFile(
|
||||
(webrtc::test::OutputPath() + "acm_encdec_trace.txt").c_str());
|
||||
}
|
||||
|
||||
EncodeDecodeTest::EncodeDecodeTest(int testMode) {
|
||||
//testMode == 0 for autotest
|
||||
//testMode == 1 for testing all codecs/parameters
|
||||
//testMode > 1 for specific user-input test (as it was used before)
|
||||
_testMode = testMode;
|
||||
if(_testMode != 0) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_encdec_trace.txt").c_str());
|
||||
}
|
||||
_testMode = testMode;
|
||||
if (_testMode != 0) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile(
|
||||
(webrtc::test::OutputPath() + "acm_encdec_trace.txt").c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void EncodeDecodeTest::Perform() {
|
||||
@ -289,9 +286,9 @@ void EncodeDecodeTest::Perform() {
|
||||
}
|
||||
|
||||
int numCodecs = 1;
|
||||
int codePars[3]; // Frequency, packet size, rate.
|
||||
int numPars[52]; // Number of codec parameters sets (freq, pacsize, rate)
|
||||
// to test, for a given codec.
|
||||
int codePars[3]; // Frequency, packet size, rate.
|
||||
int numPars[52]; // Number of codec parameters sets (freq, pacsize, rate)
|
||||
// to test, for a given codec.
|
||||
|
||||
codePars[0] = 0;
|
||||
codePars[1] = 0;
|
||||
@ -390,4 +387,4 @@ void EncodeDecodeTest::EncodeToFile(int fileType, int codeId, int* codePars,
|
||||
AudioCodingModule::Destroy(acm);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
} // namespace webrtc
|
||||
|
Reference in New Issue
Block a user