Fix parallelizability in modules_tests.

R=henrik.lundin@webrtc.org
BUG=3873
TEST=third_party/gtest-parallel/gtest-parallel -r 10 -w 64 out/Debug/modules_tests

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7354 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-10-01 10:05:40 +00:00
parent 4cebd84c79
commit c86e45d7c4
3 changed files with 15 additions and 7 deletions

View File

@ -307,10 +307,9 @@ void EncodeDecodeTest::Perform() {
// Only encode using real mono encoders, not telephone-event and cng.
for (int loopPars = 1; loopPars <= numPars[codeId]; loopPars++) {
// Encode all data to file.
EncodeToFile(1, codeId, codePars, _testMode);
std::string fileName = EncodeToFile(1, codeId, codePars, _testMode);
RTPFile rtpFile;
std::string fileName = webrtc::test::OutputPath() + "outFile.rtp";
rtpFile.Open(fileName.c_str(), "rb");
_receiver.codeId = codeId;
@ -329,11 +328,14 @@ void EncodeDecodeTest::Perform() {
}
}
void EncodeDecodeTest::EncodeToFile(int fileType, int codeId, int* codePars,
int testMode) {
std::string EncodeDecodeTest::EncodeToFile(int fileType,
int codeId,
int* codePars,
int testMode) {
scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(1));
RTPFile rtpFile;
std::string fileName = webrtc::test::OutputPath() + "outFile.rtp";
std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(),
"encode_decode_rtp");
rtpFile.Open(fileName.c_str(), "wb+");
rtpFile.WriteHeader();
@ -348,6 +350,8 @@ void EncodeDecodeTest::EncodeToFile(int fileType, int codeId, int* codePars,
}
_sender.Teardown();
rtpFile.Close();
return fileName;
}
} // namespace webrtc

View File

@ -107,7 +107,10 @@ class EncodeDecodeTest : public ACMTest {
uint8_t _testMode;
private:
void EncodeToFile(int fileType, int codeId, int* codePars, int testMode);
std::string EncodeToFile(int fileType,
int codeId,
int* codePars,
int testMode);
protected:
Sender _sender;

View File

@ -131,7 +131,8 @@ void PacketLossTest::Perform() {
int codec_id = acm->Codec("opus", 48000, channels_);
RTPFile rtpFile;
std::string fileName = webrtc::test::OutputPath() + "outFile.rtp";
std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(),
"packet_loss_test");
// Encode to file
rtpFile.Open(fileName.c_str(), "wb+");