Fixing Release compilation errors

Review URL: http://webrtc-codereview.appspot.com/267026

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1000 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org
2011-11-23 12:20:35 +00:00
parent 89ab652250
commit 543c3eaa46
38 changed files with 221 additions and 171 deletions

View File

@@ -42,7 +42,7 @@ int readframe(WebRtc_Word16 *data, FILE *inp, int length) {
int main(int argc, char* argv[])
{
char inname[80], outname[40], bitname[40];
FILE *inp, *outp, *bitp;
FILE *inp, *outp, *bitp = NULL;
int framecnt, endfile;
WebRtc_Word16 framelength = 80;

View File

@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
/* Runtime statistics */
double starttime;
double runtime;
double runtime = 0;
double length_file;
WebRtc_Word16 stream_len = 0;

View File

@@ -101,13 +101,13 @@ int main(int argc, char* argv[])
WebRtc_Word16 CodingMode;
WebRtc_Word16 bottleneck;
WebRtc_Word16 framesize = 30; /* ms */
int cur_framesmpls, err, lostPackets = 0;
int cur_framesmpls, err = 0, lostPackets = 0;
/* Runtime statistics */
double starttime, runtime, length_file;
WebRtc_Word16 stream_len = 0;
WebRtc_Word16 framecnt, declen;
WebRtc_Word16 framecnt, declen = 0;
WebRtc_Word16 shortdata[FRAMESAMPLES_10ms];
WebRtc_Word16 decoded[MAX_FRAMESAMPLES];
WebRtc_UWord16 streamdata[500];
@@ -119,7 +119,7 @@ int main(int argc, char* argv[])
WebRtc_Word32 payloadRate = 0;
int setControlBWE = 0;
int readLoss;
FILE *plFile;
FILE *plFile = NULL;
char version_number[20];
char tmpBit[5] = ".bit";
@@ -396,7 +396,9 @@ int main(int argc, char* argv[])
if (fscanf(f_bn, "%d", &aux_var) == EOF) {
/* Set pointer to beginning of file */
fseek(f_bn, 0L, SEEK_SET);
fscanf(f_bn, "%d", &aux_var);
if (fscanf(f_bn, "%d", &aux_var) == EOF) {
exit(0);
}
}
bottleneck = (WebRtc_Word16)aux_var;
/* Bottleneck is a cosine function
@@ -640,7 +642,9 @@ int main(int argc, char* argv[])
if (fscanf(f_bn, "%d", &aux_var) == EOF) {
/* Set pointer to beginning of file */
fseek(f_bn, 0L, SEEK_SET);
fscanf(f_bn, "%d", &aux_var);
if (fscanf(f_bn, "%d", &aux_var) == EOF) {
exit(0);
}
}
bottleneck = (WebRtc_Word16)aux_var;
if (CodingMode == 1) {
@@ -675,10 +679,11 @@ int main(int argc, char* argv[])
if (fp_gns != NULL) {
if (fscanf(fp_gns, "%d", &cur_delay) == EOF) {
fseek(fp_gns, 0L, SEEK_SET);
fscanf(fp_gns, "%d", &cur_delay);
if (fscanf(fp_gns, "%d", &cur_delay) == EOF) {
exit(0);
}
}
}
/* simulate packet handling through NetEq and the modem */
if (!(testNum == 3 && framecnt == 0)) {

View File

@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
double starttime, runtime, length_file;
WebRtc_Word16 stream_len = 0;
WebRtc_Word16 declen, lostFrame = 0, declenTC;
WebRtc_Word16 declen, lostFrame = 0, declenTC = 0;
WebRtc_Word16 shortdata[SWBFRAMESAMPLES_10ms];
WebRtc_Word16 vaddata[SWBFRAMESAMPLES_10ms*3];
@@ -97,9 +97,9 @@ int main(int argc, char* argv[])
bool doTransCoding = false;
WebRtc_Word32 rateTransCoding = 0;
WebRtc_UWord16 streamDataTransCoding[600];
WebRtc_Word16 streamLenTransCoding;
FILE* transCodingFile;
FILE* transcodingBitstream;
WebRtc_Word16 streamLenTransCoding = 0;
FILE* transCodingFile = NULL;
FILE* transcodingBitstream = NULL;
WebRtc_UWord32 numTransCodingBytes = 0;
/* only one structure used for ISAC encoder */
@@ -368,7 +368,9 @@ int main(int argc, char* argv[])
{
/* Set pointer to beginning of file */
fseek(f_bn, 0L, SEEK_SET);
fscanf(f_bn, "%d", &bottleneck);
if (fscanf(f_bn, "%d", &bottleneck) == EOF) {
exit(0);
}
}
/* Bottleneck is a cosine function
@@ -744,7 +746,9 @@ int main(int argc, char* argv[])
{
/* Set pointer to beginning of file */
fseek(f_bn, 0L, SEEK_SET);
fscanf(f_bn, "%d", &bottleneck);
if (fscanf(f_bn, "%d", &bottleneck) == EOF) {
exit(0);
}
}
if(CodingMode == 1)
{

View File

@@ -108,7 +108,7 @@ int main(int argc, char* argv[])
WebRtc_UWord16 payload[600];
WebRtc_UWord16 payloadRCU[600];
WebRtc_UWord16 packetLossPercent = 0;
WebRtc_Word16 rcuStreamLen;
WebRtc_Word16 rcuStreamLen = 0;
int onlyEncode;
int onlyDecode;

View File

@@ -100,6 +100,7 @@
'type': 'executable',
'dependencies': [
'audio_coding_module',
'<(webrtc_root)/../testing/gtest.gyp:gtest',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
],
'sources': [

View File

@@ -9,20 +9,21 @@
*/
#include <cctype>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <ostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "APITest.h"
#include "thread_wrapper.h"
#include "common_types.h"
#include "engine_configurations.h"
#include "event_wrapper.h"
#include "gtest/gtest.h"
#include "thread_wrapper.h"
#include "tick_util.h"
#include "trace.h"
#include "utility.h"
#include "common_types.h"
#include "engine_configurations.h"
#define TEST_DURATION_SEC 600
@@ -310,7 +311,7 @@ APITest::SetUp()
char print[11];
printf("\nRandom Test (y/n)?");
fgets(print, 10, stdin);
EXPECT_TRUE(fgets(print, 10, stdin) != NULL);
print[10] = '\0';
if(strstr(print, "y") != NULL)
{
@@ -327,11 +328,11 @@ APITest::SetUp()
Trace::SetTraceFile("ACMAPITest.txt", true);
_randomTest = false;
printf("\nPrint Tests (y/n)? ");
fgets(print, 10, stdin);
EXPECT_TRUE(fgets(print, 10, stdin) != NULL);
print[10] = '\0';
if(strstr(print, "y") == NULL)
{
freopen("APITest_log.txt", "w", stdout);
EXPECT_TRUE(freopen("APITest_log.txt", "w", stdout) != 0);
_verbose = false;
}
}
@@ -1139,8 +1140,8 @@ void
APITest::TestPlayout(char receiveSide)
{
AudioCodingModule* receiveACM;
AudioPlayoutMode* playoutMode;
ACMBackgroundNoiseMode* bgnMode;
AudioPlayoutMode* playoutMode = NULL;
ACMBackgroundNoiseMode* bgnMode = NULL;
switch(receiveSide)
{
case 'A':

View File

@@ -9,10 +9,12 @@
*/
#include "EncodeDecodeTest.h"
#include "common_types.h"
#include <stdlib.h>
#include <string.h>
#include "common_types.h"
#include "gtest/gtest.h"
#include "trace.h"
#include "utility.h"
@@ -63,7 +65,7 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream)
printf("\nValid output frequencies:\n");
printf("8000\n16000\n32000\n-1, which means output freq equal to received signal freq");
printf("\n\nChoose output sampling frequency: ");
scanf("%d", &playSampFreq);
ASSERT_GT(scanf("%d", &playSampFreq), 0);
char fileName[] = "./src/modules/audio_coding/main/test/outFile.pcm";
_pcmFile.Open(fileName, 32000, "wb+");
}

View File

@@ -9,8 +9,6 @@
*/
#include "EncodeToFileTest.h"
#include "audio_coding_module.h"
#include "common_types.h"
#ifdef WIN32
# include <Winsock2.h>
@@ -18,11 +16,14 @@
# include <arpa/inet.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "audio_coding_module.h"
#include "common_types.h"
#include "gtest/gtest.h"
TestPacketization::TestPacketization(RTPStream *rtpStream, WebRtc_UWord16 frequency)
:
_frequency(frequency),
@@ -90,8 +91,7 @@ void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream)
printf("%d %s\n", n, sendCodec.plname);
}
printf("Choose your codec:");
scanf("%d", &codecNo);
ASSERT_GT(scanf("%d", &codecNo), 0);
char fileName[] = "./test/data/audio_coding/testfile32kHz.pcm";
_pcmFile.Open(fileName, 32000, "rb");
}

View File

@@ -1,3 +1,4 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
@@ -8,12 +9,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "PCMFile.h"
#include <cctype>
#include <stdio.h>
#include <string.h>
#include "PCMFile.h"
#include "gtest/gtest.h"
#include "module_common_types.h"
#define MAX_FILE_NAME_LENGTH_BYTE 500
@@ -54,7 +56,7 @@ PCMFile::ChooseFile(
WebRtc_Word8 tmpName[MAX_FILE_NAME_LENGTH_BYTE];
//strcpy(_fileName, "in.pcm");
//printf("\n\nPlease enter the input file: ");
fgets(tmpName, MAX_FILE_NAME_LENGTH_BYTE, stdin);
EXPECT_TRUE(fgets(tmpName, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL);
tmpName[MAX_FILE_NAME_LENGTH_BYTE-1] = '\0';
WebRtc_Word16 n = 0;
@@ -106,7 +108,7 @@ PCMFile::ChooseFile(
WebRtc_Word8 tmpName[MAX_FILE_NAME_LENGTH_BYTE];
//strcpy(_fileName, "in.pcm");
//printf("\n\nPlease enter the input file: ");
fgets(tmpName, MAX_FILE_NAME_LENGTH_BYTE, stdin);
EXPECT_TRUE(fgets(tmpName, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL);
tmpName[MAX_FILE_NAME_LENGTH_BYTE-1] = '\0';
WebRtc_Word16 n = 0;
@@ -147,7 +149,7 @@ PCMFile::ChooseFile(
strncpy(fileName, tmpName, len+1);
}
printf("Enter the sampling frequency (in Hz) of the above file [%u]: ", *frequencyHz);
fgets(tmpName, 10, stdin);
EXPECT_TRUE(fgets(tmpName, 10, stdin) != NULL);
WebRtc_UWord16 tmpFreq = (WebRtc_UWord16)atoi(tmpName);
if(tmpFreq > 0)
{

View File

@@ -9,8 +9,7 @@
*/
#include "RTPFile.h"
#include "rw_lock_wrapper.h"
#include "engine_configurations.h"
#include <stdlib.h>
#ifdef WIN32
@@ -20,6 +19,9 @@
#endif
#include "audio_coding_module.h"
#include "engine_configurations.h"
#include "gtest/gtest.h"
#include "rw_lock_wrapper.h"
void RTPStream::ParseRTPHeader(WebRtcRTPHeader* rtpInfo, const WebRtc_UWord8* rtpHeader)
{
@@ -186,16 +188,16 @@ void RTPFile::ReadHeader()
WebRtc_UWord32 start_sec, start_usec, source;
WebRtc_UWord16 port, padding;
char fileHeader[40];
fgets(fileHeader, 40, _rtpFile);
fread(&start_sec, 4, 1, _rtpFile);
EXPECT_TRUE(fgets(fileHeader, 40, _rtpFile) != 0);
EXPECT_GT(fread(&start_sec, 4, 1, _rtpFile), 0u);
start_sec=ntohl(start_sec);
fread(&start_usec, 4, 1, _rtpFile);
EXPECT_GT(fread(&start_usec, 4, 1, _rtpFile), 0u);
start_usec=ntohl(start_usec);
fread(&source, 4, 1, _rtpFile);
EXPECT_GT(fread(&source, 4, 1, _rtpFile), 0u);
source=ntohl(source);
fread(&port, 2, 1, _rtpFile);
EXPECT_GT(fread(&port, 2, 1, _rtpFile), 0u);
port=ntohs(port);
fread(&padding, 2, 1, _rtpFile);
EXPECT_GT(fread(&padding, 2, 1, _rtpFile), 0u);
padding=ntohs(padding);
}
@@ -237,19 +239,19 @@ WebRtc_UWord16 RTPFile::Read(WebRtcRTPHeader* rtpInfo,
WebRtc_UWord16 lengthBytes;
WebRtc_UWord16 plen;
WebRtc_UWord8 rtpHeader[12];
fread(&lengthBytes, 2, 1, _rtpFile);
EXPECT_GT(fread(&lengthBytes, 2, 1, _rtpFile), 0u);
if (feof(_rtpFile))
{
_rtpEOF = true;
return 0;
}
fread(&plen, 2, 1, _rtpFile);
EXPECT_GT(fread(&plen, 2, 1, _rtpFile), 0u);
if (feof(_rtpFile))
{
_rtpEOF = true;
return 0;
}
fread(offset, 4, 1, _rtpFile);
EXPECT_GT(fread(offset, 4, 1, _rtpFile), 0u);
if (feof(_rtpFile))
{
_rtpEOF = true;
@@ -263,7 +265,7 @@ WebRtc_UWord16 RTPFile::Read(WebRtcRTPHeader* rtpInfo,
throw "Unable to read RTP file";
exit(1);
}
fread(rtpHeader, 12, 1, _rtpFile);
EXPECT_GT(fread(rtpHeader, 12, 1, _rtpFile), 0u);
if (feof(_rtpFile))
{
_rtpEOF = true;
@@ -287,7 +289,7 @@ WebRtc_UWord16 RTPFile::Read(WebRtcRTPHeader* rtpInfo,
exit(1);
}
lengthBytes -= 20;
fread(payloadData, 1, lengthBytes, _rtpFile);
EXPECT_GT(fread(payloadData, 1, lengthBytes, _rtpFile), 0u);
if (feof(_rtpFile))
{
_rtpEOF = true;

View File

@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "TwoWayCommunication.h"
#include <cctype>
#include <stdio.h>
#include <string.h>
@@ -16,12 +18,12 @@
#include <Windows.h>
#endif
#include "TwoWayCommunication.h"
#include "engine_configurations.h"
#include "PCMFile.h"
#include "utility.h"
#include "trace.h"
#include "common_types.h"
#include "engine_configurations.h"
#include "gtest/gtest.h"
#include "PCMFile.h"
#include "trace.h"
#include "utility.h"
using namespace webrtc;
@@ -79,11 +81,11 @@ TwoWayCommunication::ChooseCodec(WebRtc_UWord8* codecID_A, WebRtc_UWord8* codecI
}
printf("\nChoose a send codec for side A [0]: ");
char myStr[15] = "";
fgets(myStr, 10, stdin);
EXPECT_TRUE(fgets(myStr, 10, stdin) != NULL);
*codecID_A = (WebRtc_UWord8)atoi(myStr);
printf("\nChoose a send codec for side B [0]: ");
fgets(myStr, 10, stdin);
EXPECT_TRUE(fgets(myStr, 10, stdin) != NULL);
*codecID_B = (WebRtc_UWord8)atoi(myStr);
AudioCodingModule::Destroy(tmpACM);
@@ -97,7 +99,7 @@ TwoWayCommunication::ChooseFile(char* fileName, WebRtc_Word16 maxLen, WebRtc_UWo
WebRtc_Word8 tmpName[MAX_FILE_NAME_LENGTH_BYTE];
//strcpy(_fileName, "in.pcm");
//printf("\n\nPlease enter the input file: ");
fgets(tmpName, MAX_FILE_NAME_LENGTH_BYTE, stdin);
EXPECT_TRUE(fgets(tmpName, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL);
tmpName[MAX_FILE_NAME_LENGTH_BYTE-1] = '\0';
WebRtc_Word16 n = 0;
@@ -138,7 +140,7 @@ TwoWayCommunication::ChooseFile(char* fileName, WebRtc_Word16 maxLen, WebRtc_UWo
strncpy(fileName, tmpName, len+1);
}
printf("Enter the sampling frequency (in Hz) of the above file [%u]: ", *frequencyHz);
fgets(tmpName, 6, stdin);
EXPECT_TRUE(fgets(tmpName, 6, stdin) != NULL);
WebRtc_UWord16 tmpFreq = (WebRtc_UWord16)atoi(tmpName);
if(tmpFreq > 0)
{

View File

@@ -298,7 +298,7 @@ ISACTest::Perform()
testNr++;
EncodeDecode(testNr, wbISACConfig, swbISACConfig);
int dummy;
int user_input;
if((_testMode == 0) || (_testMode == 1))
{
swbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)200;
@@ -307,11 +307,11 @@ ISACTest::Perform()
else
{
printf("Enter the max payload-size for side A: ");
scanf("%d", &dummy);
swbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)dummy;
CHECK_ERROR(scanf("%d", &user_input));
swbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)user_input;
printf("Enter the max payload-size for side B: ");
scanf("%d", &dummy);
wbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)dummy;
CHECK_ERROR(scanf("%d", &user_input));
wbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)user_input;
}
testNr++;
EncodeDecode(testNr, wbISACConfig, swbISACConfig);
@@ -329,11 +329,11 @@ ISACTest::Perform()
else
{
printf("Enter the max rate for side A: ");
scanf("%d", &dummy);
swbISACConfig.maxRateBitPerSec = (WebRtc_UWord32)dummy;
CHECK_ERROR(scanf("%d", &user_input));
swbISACConfig.maxRateBitPerSec = (WebRtc_UWord32)user_input;
printf("Enter the max rate for side B: ");
scanf("%d", &dummy);
wbISACConfig.maxRateBitPerSec = (WebRtc_UWord32)dummy;
CHECK_ERROR(scanf("%d", &user_input));
wbISACConfig.maxRateBitPerSec = (WebRtc_UWord32)user_input;
}
testNr++;

View File

@@ -9,14 +9,14 @@
*/
#include "utility.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "audio_coding_module.h"
#include "common_types.h"
#include "gtest/gtest.h"
#define NUM_CODECS_WITH_FIXED_PAYLOAD_TYPE 13
@@ -128,7 +128,7 @@ ChooseCodec(
do
{
printf("\nChoose a codec [0]: ");
fgets(myStr, 10, stdin);
EXPECT_TRUE(fgets(myStr, 10, stdin) != NULL);
codecID = atoi(myStr);
if((codecID < 0) || (codecID >= noCodec))
{

View File

@@ -177,6 +177,9 @@
{
'target_name': 'RTPjitter',
'type': 'executable',
'dependencies': [
'<(webrtc_root)/../testing/gtest.gyp:gtest',
],
'sources': [
'test/RTPjitter.cc',
],
@@ -186,6 +189,7 @@
'type': 'executable',
'dependencies': [
'NetEqTestTools',
'<(webrtc_root)/../testing/gtest.gyp:gtest',
],
'sources': [
'test/RTPanalyze.cc',
@@ -196,6 +200,7 @@
'type': 'executable',
'dependencies': [
'NetEqTestTools',
'<(webrtc_root)/../testing/gtest.gyp:gtest',
],
'sources': [
'test/RTPchange.cc',
@@ -206,6 +211,7 @@
'type': 'executable',
'dependencies': [
'NetEqTestTools',
'<(webrtc_root)/../testing/gtest.gyp:gtest',
],
'sources': [
'test/RTPtimeshift.cc',
@@ -216,6 +222,7 @@
'type': 'executable',
'dependencies': [
'NetEqTestTools',
'<(webrtc_root)/../testing/gtest.gyp:gtest',
],
'sources': [
'test/RTPcat.cc',
@@ -232,6 +239,7 @@
'iLBC',
'iSAC',
'CNG',
'<(webrtc_root)/../testing/gtest.gyp:gtest',
],
'direct_dependent_settings': {
'include_dirs': [

View File

@@ -21,6 +21,8 @@
#include <cstdlib>
#include "gtest/gtest.h"
#define HDR_SIZE 8 // rtpplay packet header size in bytes
@@ -145,7 +147,9 @@ int NETEQTEST_RTPpacket::skipFileHeader(FILE *fp)
const int kFirstLineLength = 40;
char firstline[kFirstLineLength];
fgets(firstline, kFirstLineLength, fp);
if (fgets(firstline, kFirstLineLength, fp) == NULL) {
return -1;
}
if (strncmp(firstline, "#!rtpplay", 9) == 0) {
if (strncmp(firstline, "#!rtpplay1.0", 12) != 0) {
return -1;

View File

@@ -19,8 +19,6 @@
/* Misc. definitions */
/*********************/
#define FIRSTLINELEN 40
enum {kRedPayloadType = 127};
int main(int argc, char* argv[])
@@ -44,12 +42,8 @@ int main(int argc, char* argv[])
// print file header
fprintf(outFile, "SeqNo TimeStamp SendTime Size PT M\n");
// read file header
char firstline[FIRSTLINELEN];
fgets(firstline, FIRSTLINELEN, inFile);
fread(firstline, 4+4+4+2+2, 1, inFile); // start_sec + start_usec + source + port + padding
NETEQTEST_RTPpacket::skipFileHeader(inFile);
NETEQTEST_RTPpacket packet;
while (packet.readFromFile(inFile) >= 0)

View File

@@ -13,6 +13,7 @@
#include <vector>
#include "NETEQTEST_RTPpacket.h"
#include "gtest/gtest.h"
/*********************/
/* Misc. definitions */
@@ -42,16 +43,18 @@ int main(int argc, char* argv[])
// read file header and write directly to output file
char firstline[FIRSTLINELEN];
fgets(firstline, FIRSTLINELEN, inFile);
fputs(firstline, outFile);
fread(firstline, 4 + 4 + 4 + 2 + 2, 1, inFile); // start_sec + start_usec + source + port + padding
fwrite(firstline, 4 + 4 + 4 + 2 + 2, 1, outFile);
const unsigned int kRtpDumpHeaderSize = 4 + 4 + 4 + 2 + 2;
EXPECT_TRUE(fgets(firstline, FIRSTLINELEN, inFile) != NULL);
EXPECT_GT(fputs(firstline, outFile), 0);
EXPECT_EQ(kRtpDumpHeaderSize, fread(firstline, 1, kRtpDumpHeaderSize,
inFile));
EXPECT_EQ(kRtpDumpHeaderSize, fwrite(firstline, 1, kRtpDumpHeaderSize,
outFile));
// close input file and re-open it later (easier to write the loop below)
fclose(inFile);
for (int i = 1; i < argc - 1; i++) {
inFile = fopen(argv[i], "rb");
if (!inFile) {
printf("Cannot open input file %s\n", argv[i]);
@@ -60,28 +63,18 @@ int main(int argc, char* argv[])
printf("Input RTP file: %s\n", argv[i]);
// skip file header
fgets(firstline, FIRSTLINELEN, inFile);
fread(firstline, 4 + 4 + 4 + 2 + 2, 1, inFile); // start_sec + start_usec + source + port + padding
NETEQTEST_RTPpacket::skipFileHeader(inFile);
NETEQTEST_RTPpacket packet;
int packLen = packet.readFromFile(inFile);
if (packLen < 0) {
exit(1);
}
while (packLen >= 0) {
packet.writeToFile(outFile);
packLen = packet.readFromFile(inFile);
}
fclose(inFile);
}
fclose(outFile);
return 0;
}

View File

@@ -13,7 +13,7 @@
#include <vector>
#include "NETEQTEST_RTPpacket.h"
#include "gtest/gtest.h"
/*********************/
/* Misc. definitions */
@@ -56,8 +56,11 @@ int main(int argc, char* argv[])
// read all statistics and insert into map
// read first line
char tempStr[100];
fgets(tempStr, 100, statFile);
if (fgets(tempStr, 100, statFile) == NULL)
{
printf("Failed to read timing file %s\n", argv[2]);
return (-1);
}
// define map
std::map<std::pair<WebRtc_UWord16, WebRtc_UWord32>, WebRtc_UWord32>
packetStats;
@@ -77,10 +80,24 @@ int main(int argc, char* argv[])
// read file header and write directly to output file
char firstline[FIRSTLINELEN];
fgets(firstline, FIRSTLINELEN, inFile);
if (fgets(firstline, FIRSTLINELEN, inFile) == NULL)
{
printf("Failed to read first line of input file %s\n", argv[1]);
return (-1);
}
fputs(firstline, outFile);
fread(firstline, 4+4+4+2+2, 1, inFile); // start_sec + start_usec + source + port + padding
fwrite(firstline, 4+4+4+2+2, 1, outFile);
// start_sec + start_usec + source + port + padding
const unsigned int kRtpDumpHeaderSize = 4 + 4 + 4 + 2 + 2;
if (fread(firstline, 1, kRtpDumpHeaderSize, inFile) != kRtpDumpHeaderSize)
{
printf("Failed to read RTP dump header from input file %s\n", argv[1]);
return (-1);
}
if (fwrite(firstline, 1, kRtpDumpHeaderSize, outFile) != kRtpDumpHeaderSize)
{
printf("Failed to write RTP dump header to output file %s\n", argv[3]);
return (-1);
}
std::vector<NETEQTEST_RTPpacket *> packetVec;

View File

@@ -277,7 +277,7 @@ int main(int argc, char* argv[])
bool dtmfSent = false;
#endif
bool usingStereo = false;
int stereoMode;
int stereoMode = 0;
int numChannels = 1;
/* check number of parameters */
@@ -1609,7 +1609,7 @@ int NetEQTest_free_coders(enum WebRtcNetEQDecoder coder, int numChannels) {
int NetEQTest_encode(int coder, WebRtc_Word16 *indata, int frameLen, unsigned char * encoded,int sampleRate ,
int * vad, int useVAD, int bitrate, int numChannels){
short cdlen;
short cdlen = 0;
WebRtc_Word16 *tempdata;
static int first_cng=1;
WebRtc_Word16 tempLen;

View File

@@ -22,6 +22,8 @@
#include <search.h>
#include <float.h>
#include "gtest/gtest.h"
/*********************/
/* Misc. definitions */
/*********************/
@@ -68,7 +70,8 @@ int main(int argc, char* argv[])
unsigned int dat_len, rtp_len, Npack, k;
arr_time *time_vec;
char firstline[FIRSTLINELEN];
unsigned char *rtp_vec, **packet_ptr, *temp_packet;
unsigned char *rtp_vec = NULL, **packet_ptr, *temp_packet;
const unsigned int kRtpDumpHeaderSize = 4 + 4 + 4 + 2 + 2;
WebRtc_UWord16 len;
WebRtc_UWord32 *offset;
@@ -126,10 +129,12 @@ int main(int argc, char* argv[])
}
// read file header and write directly to output file
fgets(firstline, FIRSTLINELEN, in_file);
fputs(firstline, out_file);
fread(firstline, 4+4+4+2+2, 1, in_file); // start_sec + start_usec + source + port + padding
fwrite(firstline, 4+4+4+2+2, 1, out_file);
EXPECT_TRUE(fgets(firstline, FIRSTLINELEN, in_file) != NULL);
EXPECT_GT(fputs(firstline, out_file), 0);
EXPECT_EQ(kRtpDumpHeaderSize, fread(firstline, 1, kRtpDumpHeaderSize,
in_file));
EXPECT_EQ(kRtpDumpHeaderSize, fwrite(firstline, 1, kRtpDumpHeaderSize,
out_file));
// read all RTP packets into vector
rtp_len=0;

View File

@@ -13,7 +13,7 @@
#include <vector>
#include "NETEQTEST_RTPpacket.h"
#include "gtest/gtest.h"
/*********************/
/* Misc. definitions */
@@ -47,12 +47,14 @@ int main(int argc, char* argv[])
printf("Output RTP file: %s\n\n",argv[2]);
// read file header and write directly to output file
const unsigned int kRtpDumpHeaderSize = 4 + 4 + 4 + 2 + 2;
char firstline[FIRSTLINELEN];
fgets(firstline, FIRSTLINELEN, inFile);
fputs(firstline, outFile);
fread(firstline, 4+4+4+2+2, 1, inFile); // start_sec + start_usec + source + port + padding
fwrite(firstline, 4+4+4+2+2, 1, outFile);
EXPECT_TRUE(fgets(firstline, FIRSTLINELEN, inFile) != NULL);
EXPECT_GT(fputs(firstline, outFile), 0);
EXPECT_EQ(kRtpDumpHeaderSize,
fread(firstline, 1, kRtpDumpHeaderSize, inFile));
EXPECT_EQ(kRtpDumpHeaderSize,
fwrite(firstline, 1, kRtpDumpHeaderSize, outFile));
NETEQTEST_RTPpacket packet;
int packLen = packet.readFromFile(inFile);
if (packLen < 0)

View File

@@ -776,7 +776,7 @@ WebRtc_Word32 FuncTestManager::TestAudioLayerSelection()
{
TEST_LOG("Would you like to try kWindowsCoreAudio instead "
"[requires Win Vista or Win 7] (Y/N)?\n: ");
scanf(" %c", &ch);
TEST(scanf(" %c", &ch) > 0);
ch = toupper(ch);
if (ch == 'Y')
{
@@ -785,7 +785,7 @@ WebRtc_Word32 FuncTestManager::TestAudioLayerSelection()
} else if (audioLayer == AudioDeviceModule::kWindowsCoreAudio)
{
TEST_LOG("Would you like to try kWindowsWaveAudio instead (Y/N)?\n: ");
scanf(" %c", &ch);
TEST(scanf(" %c", &ch) > 0);
ch = toupper(ch);
if (ch == 'Y')
{
@@ -1695,7 +1695,7 @@ WebRtc_Word32 FuncTestManager::TestMicrophoneVolume()
RecordedMicrophoneVolumeFile);
char ch;
bool fileRecording(false);
scanf(" %c", &ch);
TEST(scanf(" %c", &ch) > 0);
ch = toupper(ch);
if (ch == 'Y')
{
@@ -1834,7 +1834,7 @@ WebRtc_Word32 FuncTestManager::TestMicrophoneMute()
RecordedMicrophoneMuteFile);
char ch;
bool fileRecording(false);
scanf(" %c", &ch);
TEST(scanf(" %c", &ch) > 0);
ch = toupper(ch);
if (ch == 'Y')
{
@@ -1970,7 +1970,7 @@ WebRtc_Word32 FuncTestManager::TestMicrophoneBoost()
RecordedMicrophoneBoostFile);
char ch;
bool fileRecording(false);
scanf(" %c", &ch);
TEST(scanf(" %c", &ch) > 0);
ch = toupper(ch);
if (ch == 'Y')
{
@@ -2107,7 +2107,7 @@ WebRtc_Word32 FuncTestManager::TestMicrophoneAGC()
RecordedMicrophoneAGCFile);
char ch;
bool fileRecording(false);
scanf(" %c", &ch);
TEST(scanf(" %c", &ch) > 0);
ch = toupper(ch);
if (ch == 'Y')
{
@@ -2567,11 +2567,8 @@ WebRtc_Word32 FuncTestManager::SelectRecordingDevice()
TEST_LOG(" (%d) Device %d (%s)\n", i, i, name);
}
TEST_LOG("\n: ");
int sel(0);
scanf("%u", &sel);
TEST(scanf("%u", &sel) > 0);
if (sel < (nDevices))
{
TEST((ret = _audioDevice->SetRecordingDevice(sel)) == 0);
@@ -2634,13 +2631,9 @@ WebRtc_Word32 FuncTestManager::SelectPlayoutDevice()
TEST_LOG(" (%d) Device %d (%s)\n", i, i, name);
}
TEST_LOG("\n: ");
int sel(0);
scanf("%u", &sel);
TEST(scanf("%u", &sel) > 0);
WebRtc_Word32 ret(0);
if (sel < (nDevices))
{
TEST((ret = _audioDevice->SetPlayoutDevice(sel)) == 0);

View File

@@ -9,12 +9,15 @@
*/
#include "normal_async_test.h"
#include "typedefs.h"
#include <sstream>
#include <assert.h>
#include <queue>
#include <string.h>
#include "gtest/gtest.h"
#include "tick_util.h"
#include "typedefs.h"
using namespace webrtc;
@@ -391,7 +394,7 @@ bool
NormalAsyncTest::Encode()
{
_lengthEncFrame = 0;
fread(_sourceBuffer, 1, _lengthSourceFrame, _sourceFile);
EXPECT_GT(fread(_sourceBuffer, 1, _lengthSourceFrame, _sourceFile), 0u);
_inputVideoBuffer.CopyBuffer(_lengthSourceFrame, _sourceBuffer);
_inputVideoBuffer.SetTimeStamp((unsigned int)
(_encFrameCnt * 9e4 / _inst.maxFramerate));
@@ -448,6 +451,7 @@ NormalAsyncTest::Encode()
webrtc::CodecSpecificInfo* codecSpecificInfo = CreateEncoderSpecificInfo();
int ret = _encoder->Encode(rawImage, codecSpecificInfo, &frameType);
EXPECT_EQ(ret, WEBRTC_VIDEO_CODEC_OK);
if (codecSpecificInfo != NULL)
{
delete codecSpecificInfo;

View File

@@ -9,10 +9,13 @@
*/
#include "normal_test.h"
#include <time.h>
#include <sstream>
#include <string.h>
#include "gtest/gtest.h"
NormalTest::NormalTest()
:
Test("Normal Test 1", "A test of normal execution of the codec"),
@@ -169,7 +172,7 @@ bool
NormalTest::Encode()
{
_lengthEncFrame = 0;
fread(_sourceBuffer, 1, _lengthSourceFrame, _sourceFile);
EXPECT_GT(fread(_sourceBuffer, 1, _lengthSourceFrame, _sourceFile), 0u);
if (feof(_sourceFile) != 0)
{
return true;

View File

@@ -9,9 +9,12 @@
*/
#include "performance_test.h"
#include "tick_util.h"
#include <assert.h>
#include "gtest/gtest.h"
#include "tick_util.h"
using namespace webrtc;
#define NUM_FRAMES 300
@@ -129,7 +132,8 @@ PerformanceTest::Perform()
// Read a new frame from file
WriteLockScoped imageLock(*_rawImageLock);
_lengthEncFrame = 0;
fread(_sourceBuffer, 1, _lengthSourceFrame, _sourceFile);
EXPECT_GT(fread(_sourceBuffer, 1, _lengthSourceFrame, _sourceFile),
0u);
if (feof(_sourceFile) != 0)
{
rewind(_sourceFile);
@@ -269,6 +273,7 @@ bool PerformanceTest::Encode()
}
webrtc::CodecSpecificInfo* codecSpecificInfo = CreateEncoderSpecificInfo();
int ret = _encoder->Encode(rawImage, codecSpecificInfo, &frameType);
EXPECT_EQ(ret, WEBRTC_VIDEO_CODEC_OK);
if (codecSpecificInfo != NULL)
{
delete codecSpecificInfo;

View File

@@ -16,6 +16,7 @@
'type': '<(library)',
'dependencies': [
'<(webrtc_root)/../testing/gtest.gyp:gtest',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/common_video/common_video.gyp:webrtc_vplib',
],

View File

@@ -11,6 +11,7 @@
'target_name': 'video_coding_test',
'type': 'executable',
'dependencies': [
'<(webrtc_root)/../testing/gtest.gyp:gtest',
'<(webrtc_root)/../test/test.gyp:test_support',
'webrtc_video_coding',
'rtp_rtcp',

View File

@@ -121,7 +121,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
VideoFrame sourceFrame;
sourceFrame.VerifyAndAllocate(_lengthSourceFrame);
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame];
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(_height);
sourceFrame.SetWidth(_width);
@@ -324,7 +324,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
for (j=0; j < int(300/VideoCodingModule::NumberOfCodecs()); j++)// assuming 300 frames, NumberOfCodecs <= 10
{
frameCnt++;
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
// building source frame
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(_height);

View File

@@ -143,7 +143,7 @@ GenericCodecTest::Perform(CmdArgs& args)
_vcm->RegisterReceiveCodec(&receiveCodec, 1);
}
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame];
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
// building source frame
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(_height);
@@ -191,7 +191,7 @@ GenericCodecTest::Perform(CmdArgs& args)
//encoding 1 second of video
for (i = 0; i < _frameRate; i++)
{
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(_height);
sourceFrame.SetWidth(_width);
@@ -265,7 +265,7 @@ GenericCodecTest::Perform(CmdArgs& args)
sourceFrame.VerifyAndAllocate(_lengthSourceFrame);
const float bitRate[] = {100, 400, 600, 1000, 2000, 3000};
const float nBitrates = sizeof(bitRate)/sizeof(*bitRate);
float _bitRate;
float _bitRate = 0;
int _frameCnt = 0;
WebRtc_Word64 startTime, currentTime, oneSecTime;
float totalBytesOneSec;//, totalBytesTenSec;
@@ -377,7 +377,7 @@ GenericCodecTest::Perform(CmdArgs& args)
encodeComplete = false;
while (encodeComplete == false)
{
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
_frameCnt++;
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(_height);
@@ -467,7 +467,7 @@ GenericCodecTest::Perform(CmdArgs& args)
rewind(_sourceFile);
while (!feof(_sourceFile))
{
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(_height);
sourceFrame.SetWidth(_width);

View File

@@ -102,7 +102,7 @@ int JitterBufferTest(CmdArgs& args)
packet.seqNum = seqNum;
packet.payloadType = 126;
seqNum++;
fb->InsertPacket(packet, VCMTickTime::MillisecondTimestamp());
fb->InsertPacket(packet, VCMTickTime::MillisecondTimestamp(), false, 0);
TEST(frameList.Insert(fb) == 0);
}
VCMFrameListItem* item = NULL;
@@ -1907,8 +1907,8 @@ int JitterBufferTest(CmdArgs& args)
seqNum = 65485;
timeStampStart = timeStamp + 33*90;
WebRtc_UWord32 timeStampFirstKey = 0;
VCMEncodedFrame* ptrLastDeltaFrame;
VCMEncodedFrame* ptrFirstKeyFrame;
VCMEncodedFrame* ptrLastDeltaFrame = NULL;
VCMEncodedFrame* ptrFirstKeyFrame = NULL;
// insert MAX_NUMBER_OF_FRAMES frames
do
{

View File

@@ -128,7 +128,7 @@ MediaOptTest::Setup(int testType, CmdArgs& args)
_fpinp = fopen("dat_inp","rb");
_fpout = fopen("test_runs/dat_out","ab");
_fpout2 = fopen("test_runs/dat_out2","ab");
fscanf(_fpinp,"%f %f %d \n",&rateTest,&lossTest,&numRuns);
TEST(fscanf(_fpinp,"%f %f %d \n",&rateTest,&lossTest,&numRuns) > 0);
_bitRate = rateTest;
_lossRate = lossTest;
_testNum = 0;
@@ -311,7 +311,7 @@ MediaOptTest::Perform()
while (feof(_sourceFile)== 0)
{
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
_frameCnt++;
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);

View File

@@ -55,7 +55,7 @@ MainSenderThread(void* obj)
}
if (feof(state->_sourceFile) == 0)
{
fread(tmpBuffer, 1, lengthSourceFrame,state->_sourceFile);
TEST(fread(tmpBuffer, 1, lengthSourceFrame,state->_sourceFile) > 0);
state->_frameCnt++;
sourceFrame.CopyFrame(lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(height);

View File

@@ -279,7 +279,7 @@ NormalTest::Perform(CmdArgs& args)
#if !(defined(TICK_TIME_DEBUG) || defined(EVENT_DEBUG))
WebRtc_Word64 processStartTime = VCMTickTime::MillisecondTimestamp();
#endif
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
_frameCnt++;
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(_height);

View File

@@ -236,7 +236,7 @@ QualityModesTest::Perform()
while (feof(_sourceFile)== 0)
{
fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile);
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
_frameCnt++;
sourceFrame.CopyFrame(_lengthSourceFrame, tmpBuffer);
sourceFrame.SetHeight(_nativeHeight);

View File

@@ -9,9 +9,6 @@
*/
#include "rtp_player.h"
#include "../source/internal_defines.h"
#include "rtp_rtcp.h"
#include "tick_time.h"
#include <cstdlib>
#ifdef WIN32
@@ -21,6 +18,11 @@
#include <arpa/inet.h>
#endif
#include "../source/internal_defines.h"
#include "gtest/gtest.h"
#include "rtp_rtcp.h"
#include "tick_time.h"
using namespace webrtc;
RawRtpPacket::RawRtpPacket(WebRtc_UWord8* data, WebRtc_UWord16 len)
@@ -231,7 +233,7 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
{
return -1;
}
fgets(firstline, FIRSTLINELEN, _rtpFile);
EXPECT_TRUE(fgets(firstline, FIRSTLINELEN, _rtpFile) != NULL);
if(strncmp(firstline,"#!rtpplay",9) == 0) {
if(strncmp(firstline,"#!rtpplay1.0",12) != 0){
printf("ERROR: wrong rtpplay version, must be 1.0\n");
@@ -255,15 +257,15 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
WebRtc_UWord16 port;
WebRtc_UWord16 padding;
fread(&start_sec, 4, 1, _rtpFile);
EXPECT_GT(fread(&start_sec, 4, 1, _rtpFile), 0u);
start_sec=ntohl(start_sec);
fread(&start_usec, 4, 1, _rtpFile);
EXPECT_GT(fread(&start_usec, 4, 1, _rtpFile), 0u);
start_usec=ntohl(start_usec);
fread(&source, 4, 1, _rtpFile);
EXPECT_GT(fread(&source, 4, 1, _rtpFile), 0u);
source=ntohl(source);
fread(&port, 2, 1, _rtpFile);
EXPECT_GT(fread(&port, 2, 1, _rtpFile), 0u);
port=ntohs(port);
fread(&padding, 2, 1, _rtpFile);
EXPECT_GT(fread(&padding, 2, 1, _rtpFile), 0u);
padding=ntohs(padding);
return 0;
}

View File

@@ -298,7 +298,7 @@ TEST_F(VideoProcessingModuleTest, Resampler)
// Reading test frame
VideoFrame sourceFrame;
ASSERT_EQ(0, sourceFrame.VerifyAndAllocate(lengthSourceFrame));
fread(sourceFrame.Buffer(), 1, lengthSourceFrame, _sourceFile);
EXPECT_GT(fread(sourceFrame.Buffer(), 1, lengthSourceFrame, _sourceFile), 0u);
ASSERT_EQ(0, sourceFrame.SetLength(lengthSourceFrame));
sourceFrame.SetHeight(height);
sourceFrame.SetWidth(width);

View File

@@ -17,8 +17,7 @@
'dependencies': [
'src/common_audio/common_audio.gyp:*',
'src/common_video/common_video.gyp:*',
# TODO(andrew): enable when Linux-Release errors are fixed.
#'src/modules/modules.gyp:*',
'src/modules/modules.gyp:*',
'src/system_wrappers/source/system_wrappers.gyp:*',
'src/video_engine/video_engine.gyp:*',
'src/voice_engine/voice_engine.gyp:*',