Revert r4772 "Compile ACM1 and ACM2."

Breaks Android build.

TBR=turaj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2244004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4777 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2013-09-18 12:34:05 +00:00
parent 40d3fc65f5
commit 1c77dfd521
44 changed files with 679 additions and 140 deletions

View File

@ -22,7 +22,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/common_types.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/test/utility.h"
#include "webrtc/system_wrappers/interface/event_wrapper.h"
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
@ -98,6 +98,11 @@ APITest::APITest()
_payloadUsed[n] = false;
}
for (n = 0; n < 3; n++) {
_receiveVADActivityA[n] = 0;
_receiveVADActivityB[n] = 0;
}
_movingDot[40] = '\0';
for (int n = 0; n < 40; n++) {
@ -347,6 +352,7 @@ bool APITest::PullAudioRunA() {
if (_writeToFile) {
_outFileA.Write10MsData(audioFrame);
}
_receiveVADActivityA[(int) audioFrame.vad_activity_]++;
}
return true;
}
@ -368,6 +374,7 @@ bool APITest::PullAudioRunB() {
if (_writeToFile) {
_outFileB.Write10MsData(audioFrame);
}
_receiveVADActivityB[(int) audioFrame.vad_activity_]++;
}
return true;
}
@ -451,7 +458,7 @@ void APITest::RunTest(char thread) {
{
WriteLockScoped cs(_apiTestRWLock);
if (thread == 'A') {
_testNumA = (_testNumB + 1 + (rand() % 4)) % 5;
_testNumA = (_testNumB + 1 + (rand() % 6)) % 7;
testNum = _testNumA;
_movingDot[_dotPositionA] = ' ';
@ -464,7 +471,7 @@ void APITest::RunTest(char thread) {
_dotPositionA += _dotMoveDirectionA;
_movingDot[_dotPositionA] = (_dotMoveDirectionA > 0) ? '>' : '<';
} else {
_testNumB = (_testNumA + 1 + (rand() % 4)) % 5;
_testNumB = (_testNumA + 1 + (rand() % 6)) % 7;
testNum = _testNumB;
_movingDot[_dotPositionB] = ' ';
@ -500,6 +507,14 @@ void APITest::RunTest(char thread) {
case 4:
TestRegisteration('A');
break;
case 5:
TestReceiverVAD('A');
break;
case 6:
#ifdef WEBRTC_DTMF_DETECTION
LookForDTMF('A');
#endif
break;
default:
fprintf(stderr, "Wrong Test Number\n");
getchar();
@ -528,6 +543,10 @@ bool APITest::APIRunA() {
// VAD TEST
TestSendVAD('A');
TestRegisteration('A');
TestReceiverVAD('A');
#ifdef WEBRTC_DTMF_DETECTION
LookForDTMF('A');
#endif
}
return true;
}
@ -962,15 +981,18 @@ void APITest::TestRegisteration(char sendSide) {
void APITest::TestPlayout(char receiveSide) {
AudioCodingModule* receiveACM;
AudioPlayoutMode* playoutMode = NULL;
ACMBackgroundNoiseMode* bgnMode = NULL;
switch (receiveSide) {
case 'A': {
receiveACM = _acmA;
playoutMode = &_playoutModeA;
bgnMode = &_bgnModeA;
break;
}
case 'B': {
receiveACM = _acmB;
playoutMode = &_playoutModeB;
bgnMode = &_bgnModeB;
break;
}
default:
@ -983,6 +1005,29 @@ void APITest::TestPlayout(char receiveSide) {
CHECK_ERROR_MT(receiveFreqHz);
CHECK_ERROR_MT(playoutFreqHz);
char bgnString[25];
switch (*bgnMode) {
case On: {
*bgnMode = Fade;
strncpy(bgnString, "Fade", 25);
break;
}
case Fade: {
*bgnMode = Off;
strncpy(bgnString, "OFF", 25);
break;
}
case Off: {
*bgnMode = On;
strncpy(bgnString, "ON", 25);
break;
}
default:
*bgnMode = On;
strncpy(bgnString, "ON", 25);
}
CHECK_ERROR_MT(receiveACM->SetBackgroundNoiseMode(*bgnMode));
bgnString[24] = '\0';
char playoutString[25];
switch (*playoutMode) {
@ -1015,10 +1060,63 @@ void APITest::TestPlayout(char receiveSide) {
fprintf(stdout, "Receive Frequency....... %d Hz\n", receiveFreqHz);
fprintf(stdout, "Playout Frequency....... %d Hz\n", playoutFreqHz);
fprintf(stdout, "Audio Playout Mode...... %s\n", playoutString);
fprintf(stdout, "Background Noise Mode... %s\n", bgnString);
}
}
// set/get receiver VAD status & mode.
void APITest::TestReceiverVAD(char side) {
AudioCodingModule* myACM;
int* myReceiveVADActivity;
if (side == 'A') {
myACM = _acmA;
myReceiveVADActivity = _receiveVADActivityA;
} else {
myACM = _acmB;
myReceiveVADActivity = _receiveVADActivityB;
}
ACMVADMode mode = myACM->ReceiveVADMode();
CHECK_ERROR_MT(mode);
if (!_randomTest) {
fprintf(stdout, "\n\nCurrent Receive VAD at side %c\n", side);
fprintf(stdout, "----------------------------------\n");
fprintf(stdout, "mode.......... %d\n", (int) mode);
fprintf(stdout, "VAD Active.... %d\n", myReceiveVADActivity[0]);
fprintf(stdout, "VAD Passive... %d\n", myReceiveVADActivity[1]);
fprintf(stdout, "VAD Unknown... %d\n", myReceiveVADActivity[2]);
}
if (!_randomTest) {
fprintf(stdout, "\nChange Receive VAD at side %c\n\n", side);
}
switch (mode) {
case VADNormal:
mode = VADAggr;
break;
case VADLowBitrate:
mode = VADVeryAggr;
break;
case VADAggr:
mode = VADLowBitrate;
break;
case VADVeryAggr:
mode = VADNormal;
break;
default:
mode = VADNormal;
CHECK_ERROR_MT(myACM->SetReceiveVADMode(mode));
}
for (int n = 0; n < 3; n++) {
myReceiveVADActivity[n] = 0;
}
}
void APITest::TestSendVAD(char side) {
if (_randomTest) {
return;
@ -1219,4 +1317,23 @@ void APITest::ChangeCodec(char side) {
Wait(500);
}
void APITest::LookForDTMF(char side) {
if (!_randomTest) {
fprintf(stdout, "\n\nLooking for DTMF Signal in Side %c\n", side);
fprintf(stdout, "----------------------------------------\n");
}
if (side == 'A') {
_acmB->RegisterIncomingMessagesCallback(NULL);
_acmA->RegisterIncomingMessagesCallback(_dtmfCallback);
Wait(1000);
_acmA->RegisterIncomingMessagesCallback(NULL);
} else {
_acmA->RegisterIncomingMessagesCallback(NULL);
_acmB->RegisterIncomingMessagesCallback(_dtmfCallback);
Wait(1000);
_acmB->RegisterIncomingMessagesCallback(NULL);
}
}
} // namespace webrtc

View File

@ -56,6 +56,9 @@ class APITest : public ACMTest {
// Receiver Frequency, playout frequency.
void TestPlayout(char receiveSide);
// set/get receiver VAD status & mode.
void TestReceiverVAD(char side);
//
void TestSendVAD(char side);
@ -65,6 +68,8 @@ class APITest : public ACMTest {
void Wait(uint32_t waitLengthMs);
void LookForDTMF(char side);
void RunTest(char thread);
bool PushAudioRunA();
@ -140,6 +145,11 @@ class APITest : public ACMTest {
AudioPlayoutMode _playoutModeA;
AudioPlayoutMode _playoutModeB;
ACMBackgroundNoiseMode _bgnModeA;
ACMBackgroundNoiseMode _bgnModeB;
int _receiveVADActivityA[3];
int _receiveVADActivityB[3];
bool _verbose;
int _dotPositionA;

View File

@ -20,7 +20,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/test/utility.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/system_wrappers/interface/trace.h"

View File

@ -16,7 +16,7 @@
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/main/test/utility.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/system_wrappers/interface/trace.h"

View File

@ -20,7 +20,7 @@
#include "webrtc/common_types.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/test/Channel.h"
#include "webrtc/modules/audio_coding/main/test/PCMFile.h"
#include "webrtc/modules/audio_coding/main/test/utility.h"

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "../acm2/acm_common_defs.h"
#include "../source/acm_common_defs.h"
#include "gtest/gtest.h"
#include "audio_coding_module.h"
#include "PCMFile.h"

View File

@ -23,7 +23,7 @@
#include <time.h>
#endif
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/test/utility.h"
#include "webrtc/system_wrappers/interface/event_wrapper.h"
#include "webrtc/system_wrappers/interface/tick_util.h"

View File

@ -17,7 +17,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#define NUM_CODECS_WITH_FIXED_PAYLOAD_TYPE 13