Webrtc_Word32 => int32_t in video_coding/main/
BUG= Review URL: https://webrtc-codereview.appspot.com/1279004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3753 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -89,7 +89,7 @@ CodecDataBaseTest::Setup(CmdArgs& args)
|
||||
|
||||
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
{
|
||||
#ifndef VIDEOCODEC_VP8
|
||||
@ -113,7 +113,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
// registering the callback - encode and decode with the same vcm (could be later changed)
|
||||
_encodeCompleteCallback->RegisterReceiverVCM(_vcm);
|
||||
// preparing a frame to be encoded
|
||||
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame];
|
||||
uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
|
||||
I420VideoFrame sourceFrame;
|
||||
int half_width = (_width + 1) / 2;
|
||||
@ -125,7 +125,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
// Encoder registration
|
||||
TEST (VideoCodingModule::NumberOfCodecs() > 0);
|
||||
@ -202,7 +202,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
TEST(_vcm->Decode() == VCM_OK);
|
||||
waitEvent->Wait(33);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
TEST(_vcm->Decode() == VCM_OK);
|
||||
@ -237,14 +237,14 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
TEST(_vcm->Decode() == VCM_OK);
|
||||
TEST(_vcm->ResetDecoder() == VCM_OK);
|
||||
waitEvent->Wait(33);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
// Try to decode a delta frame. Should get a warning since we have enabled the "require key frame" setting
|
||||
// and because no frame type request callback has been registered.
|
||||
TEST(_vcm->Decode() == VCM_MISSING_CALLBACK);
|
||||
TEST(_vcm->IntraFrameRequest(0) == VCM_OK);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
TEST(_vcm->Decode() == VCM_OK);
|
||||
@ -257,13 +257,13 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK);
|
||||
TEST(_vcm->IntraFrameRequest(0) == VCM_OK);
|
||||
waitEvent->Wait(33);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
TEST(_vcm->Decode() == VCM_OK);
|
||||
TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK);
|
||||
waitEvent->Wait(33);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
TEST(_vcm->IntraFrameRequest(0) == VCM_OK);
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
@ -339,7 +339,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
// send frame to the encoder
|
||||
TEST (_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
|
||||
@ -29,7 +29,7 @@ public:
|
||||
CodecDataBaseTest(webrtc::VideoCodingModule* vcm);
|
||||
~CodecDataBaseTest();
|
||||
static int RunTest(CmdArgs& args);
|
||||
WebRtc_Word32 Perform(CmdArgs& args);
|
||||
int32_t Perform(CmdArgs& args);
|
||||
private:
|
||||
void TearDown();
|
||||
void Setup(CmdArgs& args);
|
||||
@ -41,10 +41,10 @@ private:
|
||||
FILE* _sourceFile;
|
||||
FILE* _decodedFile;
|
||||
FILE* _encodedFile;
|
||||
WebRtc_UWord16 _width;
|
||||
WebRtc_UWord16 _height;
|
||||
WebRtc_UWord32 _lengthSourceFrame;
|
||||
WebRtc_UWord32 _timeStamp;
|
||||
uint16_t _width;
|
||||
uint16_t _height;
|
||||
uint32_t _lengthSourceFrame;
|
||||
uint32_t _timeStamp;
|
||||
float _frameRate;
|
||||
}; // end of codecDBTest class definition
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ class FrameStorageCallback : public VCMFrameStorageCallback
|
||||
public:
|
||||
FrameStorageCallback(VideoCodingModule* vcm) : _vcm(vcm) {}
|
||||
|
||||
WebRtc_Word32 StoreReceivedFrame(const EncodedVideoData& frameToStore)
|
||||
int32_t StoreReceivedFrame(const EncodedVideoData& frameToStore)
|
||||
{
|
||||
_vcm->DecodeFromStorage(frameToStore);
|
||||
return VCM_OK;
|
||||
@ -37,12 +37,12 @@ int DecodeFromStorageTest(CmdArgs& args)
|
||||
// BEGIN Settings
|
||||
bool protectionEnabled = false;
|
||||
VCMVideoProtection protectionMethod = kProtectionNack;
|
||||
WebRtc_UWord32 rttMS = 100;
|
||||
uint32_t rttMS = 100;
|
||||
float lossRate = 0.00f;
|
||||
bool reordering = false;
|
||||
WebRtc_UWord32 renderDelayMs = 0;
|
||||
WebRtc_UWord32 minPlayoutDelayMs = 0;
|
||||
const WebRtc_Word64 MAX_RUNTIME_MS = -1;
|
||||
uint32_t renderDelayMs = 0;
|
||||
uint32_t minPlayoutDelayMs = 0;
|
||||
const int64_t MAX_RUNTIME_MS = -1;
|
||||
std::string rtpFilename = args.inputFile;
|
||||
std::string outFilename = args.outputFile;
|
||||
if (outFilename == "")
|
||||
@ -67,7 +67,7 @@ int DecodeFromStorageTest(CmdArgs& args)
|
||||
&event_factory);
|
||||
FrameStorageCallback storageCallback(vcmPlayback);
|
||||
RtpDataCallback dataCallback(vcm);
|
||||
WebRtc_Word32 ret = vcm->InitializeReceiver();
|
||||
int32_t ret = vcm->InitializeReceiver();
|
||||
if (ret < 0)
|
||||
{
|
||||
return -1;
|
||||
|
||||
@ -95,10 +95,10 @@ GenericCodecTest::Setup(CmdArgs& args)
|
||||
|
||||
return;
|
||||
}
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
GenericCodecTest::Perform(CmdArgs& args)
|
||||
{
|
||||
WebRtc_Word32 ret;
|
||||
int32_t ret;
|
||||
Setup(args);
|
||||
/*
|
||||
1. sanity checks
|
||||
@ -117,7 +117,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
TEST(_vcm->Codec(0, &sendCodec) == VCM_OK);
|
||||
_vcm->InitializeSender();
|
||||
_vcm->InitializeReceiver();
|
||||
WebRtc_Word32 NumberOfCodecs = _vcm->NumberOfCodecs();
|
||||
int32_t NumberOfCodecs = _vcm->NumberOfCodecs();
|
||||
// registration of first codec in the list
|
||||
int i = 0;
|
||||
_vcm->Codec(0, &_sendCodec);
|
||||
@ -146,7 +146,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
_vcm->Codec(i, &receiveCodec);
|
||||
_vcm->RegisterReceiveCodec(&receiveCodec, 1);
|
||||
}
|
||||
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame];
|
||||
uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
|
||||
int half_width = (_width + 1) / 2;
|
||||
int half_height = (_height + 1) / 2;
|
||||
@ -179,7 +179,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
|
||||
// Set target frame rate to half of the incoming frame rate
|
||||
// to test the frame rate control in the VCM
|
||||
sendCodec.maxFramerate = (WebRtc_UWord8)(_frameRate / 2);
|
||||
sendCodec.maxFramerate = (uint8_t)(_frameRate / 2);
|
||||
sendCodec.width = _width;
|
||||
sendCodec.height = _height;
|
||||
TEST(strncmp(_sendCodec.plName, "VP8", 3) == 0); // was VP8
|
||||
@ -205,13 +205,13 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate));
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
IncrementDebugClock(_frameRate);
|
||||
_vcm->Process();
|
||||
}
|
||||
sendCodec.maxFramerate = (WebRtc_UWord8)_frameRate;
|
||||
sendCodec.maxFramerate = (uint8_t)_frameRate;
|
||||
_vcm->InitializeSender();
|
||||
TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); // same codec for encode and decode
|
||||
ret = 0;
|
||||
@ -251,7 +251,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
TEST(_vcm->RegisterFrameTypeCallback(&frameTypeCallback) == VCM_OK);
|
||||
TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK);
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate));
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
// First packet of a subsequent frame required before the jitter buffer
|
||||
// will allow decoding an incomplete frame.
|
||||
@ -317,7 +317,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
_frameCnt = 0;
|
||||
totalBytes = 0;
|
||||
_encodeCompleteCallback->Initialize();
|
||||
sendStats.set_framerate(static_cast<WebRtc_UWord32>(_frameRate));
|
||||
sendStats.set_framerate(static_cast<uint32_t>(_frameRate));
|
||||
sendStats.set_bitrate(1000 * _bitRate);
|
||||
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
||||
while (fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) ==
|
||||
@ -330,7 +330,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
_width, _height,
|
||||
_width, (_width + 1) / 2,
|
||||
(_width + 1) / 2);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate));
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
|
||||
ret = _vcm->AddVideoFrame(sourceFrame);
|
||||
@ -394,7 +394,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate));
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
_vcm->AddVideoFrame(sourceFrame);
|
||||
encodeComplete = _encodeCompleteCallback->EncodeComplete();
|
||||
@ -430,14 +430,14 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
}
|
||||
TEST(strncmp(_sendCodec.plName, "I420", 4) == 0);
|
||||
_vcm->InitializeSender();
|
||||
_sendCodec.maxFramerate = static_cast<WebRtc_UWord8>(_frameRate / 2.0 + 0.5f);
|
||||
_sendCodec.maxFramerate = static_cast<uint8_t>(_frameRate / 2.0 + 0.5f);
|
||||
_vcm->RegisterSendCodec(&_sendCodec, 4, 1440);
|
||||
_vcm->SetChannelParameters(2000000, 0, 0);
|
||||
_vcm->RegisterTransportCallback(_encodeCompleteCallback);
|
||||
// up to here
|
||||
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 20);
|
||||
_encodeCompleteCallback->Initialize();
|
||||
sendStats.set_framerate(static_cast<WebRtc_UWord32>(_frameRate));
|
||||
sendStats.set_framerate(static_cast<uint32_t>(_frameRate));
|
||||
sendStats.set_bitrate(1000 * _bitRate);
|
||||
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
||||
rewind(_sourceFile);
|
||||
@ -448,7 +448,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate));
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
ret = _vcm->AddVideoFrame(sourceFrame);
|
||||
if (_vcm->TimeUntilNextProcess() <= 0)
|
||||
@ -484,7 +484,7 @@ GenericCodecTest::Print()
|
||||
float
|
||||
GenericCodecTest::WaitForEncodedFrame() const
|
||||
{
|
||||
WebRtc_Word64 startTime = _clock->TimeInMilliseconds();
|
||||
int64_t startTime = _clock->TimeInMilliseconds();
|
||||
while (_clock->TimeInMilliseconds() - startTime < kMaxWaitEncTimeMs*10)
|
||||
{
|
||||
if (_encodeCompleteCallback->EncodeComplete())
|
||||
@ -507,12 +507,12 @@ RTPSendCallback_SizeTest::SendPacket(int channel, const void *data, int len)
|
||||
_nPackets++;
|
||||
_payloadSizeSum += len;
|
||||
// Make sure no payloads (len - header size) are larger than maxPayloadSize
|
||||
TEST(len > 0 && static_cast<WebRtc_UWord32>(len - 12) <= _maxPayloadSize);
|
||||
TEST(len > 0 && static_cast<uint32_t>(len - 12) <= _maxPayloadSize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
RTPSendCallback_SizeTest::SetMaxPayloadSize(WebRtc_UWord32 maxPayloadSize)
|
||||
RTPSendCallback_SizeTest::SetMaxPayloadSize(uint32_t maxPayloadSize)
|
||||
{
|
||||
_maxPayloadSize = maxPayloadSize;
|
||||
}
|
||||
@ -534,14 +534,14 @@ RTPSendCallback_SizeTest::AveragePayloadSize() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMEncComplete_KeyReqTest::SendData(
|
||||
const FrameType frameType,
|
||||
const WebRtc_UWord8 payloadType,
|
||||
const WebRtc_UWord32 timeStamp,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord32 payloadSize,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const RTPFragmentationHeader& /*fragmentationHeader*/,
|
||||
const webrtc::RTPVideoHeader* /*videoHdr*/)
|
||||
{
|
||||
|
||||
@ -40,13 +40,13 @@ public:
|
||||
webrtc::SimulatedClock* clock);
|
||||
~GenericCodecTest();
|
||||
static int RunTest(CmdArgs& args);
|
||||
WebRtc_Word32 Perform(CmdArgs& args);
|
||||
int32_t Perform(CmdArgs& args);
|
||||
float WaitForEncodedFrame() const;
|
||||
|
||||
private:
|
||||
void Setup(CmdArgs& args);
|
||||
void Print();
|
||||
WebRtc_Word32 TearDown();
|
||||
int32_t TearDown();
|
||||
void IncrementDebugClock(float frameRate);
|
||||
|
||||
webrtc::SimulatedClock* _clock;
|
||||
@ -56,15 +56,15 @@ private:
|
||||
std::string _inname;
|
||||
std::string _outname;
|
||||
std::string _encodedName;
|
||||
WebRtc_Word32 _sumEncBytes;
|
||||
int32_t _sumEncBytes;
|
||||
FILE* _sourceFile;
|
||||
FILE* _decodedFile;
|
||||
FILE* _encodedFile;
|
||||
WebRtc_UWord16 _width;
|
||||
WebRtc_UWord16 _height;
|
||||
uint16_t _width;
|
||||
uint16_t _height;
|
||||
float _frameRate;
|
||||
WebRtc_UWord32 _lengthSourceFrame;
|
||||
WebRtc_UWord32 _timeStamp;
|
||||
uint32_t _lengthSourceFrame;
|
||||
uint32_t _timeStamp;
|
||||
VCMDecodeCompleteCallback* _decodeCallback;
|
||||
VCMEncodeCompleteCallback* _encodeCompleteCallback;
|
||||
|
||||
@ -77,32 +77,32 @@ public:
|
||||
RTPSendCallback_SizeTest() : _maxPayloadSize(0), _payloadSizeSum(0), _nPackets(0) {}
|
||||
virtual int SendPacket(int channel, const void *data, int len);
|
||||
virtual int SendRTCPPacket(int channel, const void *data, int len) {return 0;}
|
||||
void SetMaxPayloadSize(WebRtc_UWord32 maxPayloadSize);
|
||||
void SetMaxPayloadSize(uint32_t maxPayloadSize);
|
||||
void Reset();
|
||||
float AveragePayloadSize() const;
|
||||
private:
|
||||
WebRtc_UWord32 _maxPayloadSize;
|
||||
WebRtc_UWord32 _payloadSizeSum;
|
||||
WebRtc_UWord32 _nPackets;
|
||||
uint32_t _maxPayloadSize;
|
||||
uint32_t _payloadSizeSum;
|
||||
uint32_t _nPackets;
|
||||
};
|
||||
|
||||
class VCMEncComplete_KeyReqTest : public webrtc::VCMPacketizationCallback
|
||||
{
|
||||
public:
|
||||
VCMEncComplete_KeyReqTest(webrtc::VideoCodingModule &vcm) : _vcm(vcm), _seqNo(0), _timeStamp(0) {}
|
||||
WebRtc_Word32 SendData(
|
||||
int32_t SendData(
|
||||
const webrtc::FrameType frameType,
|
||||
const WebRtc_UWord8 payloadType,
|
||||
WebRtc_UWord32 timeStamp,
|
||||
const uint8_t payloadType,
|
||||
uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord32 payloadSize,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const webrtc::RTPFragmentationHeader& fragmentationHeader,
|
||||
const webrtc::RTPVideoHeader* videoHdr);
|
||||
private:
|
||||
webrtc::VideoCodingModule& _vcm;
|
||||
WebRtc_UWord16 _seqNo;
|
||||
WebRtc_UWord32 _timeStamp;
|
||||
uint16_t _seqNo;
|
||||
uint32_t _timeStamp;
|
||||
}; // end of VCMEncodeCompleteCallback
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -36,7 +36,7 @@ int CheckOutFrame(VCMEncodedFrame* frameOut, unsigned int size, bool startCode)
|
||||
return -1;
|
||||
}
|
||||
|
||||
const WebRtc_UWord8* outData = frameOut->Buffer();
|
||||
const uint8_t* outData = frameOut->Buffer();
|
||||
|
||||
unsigned int i = 0;
|
||||
|
||||
@ -96,10 +96,10 @@ int JitterBufferTest(CmdArgs& args)
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
|
||||
// Start test
|
||||
WebRtc_UWord16 seqNum = 1234;
|
||||
WebRtc_UWord32 timeStamp = 0;
|
||||
uint16_t seqNum = 1234;
|
||||
uint32_t timeStamp = 0;
|
||||
int size = 1400;
|
||||
WebRtc_UWord8 data[1500];
|
||||
uint8_t data[1500];
|
||||
VCMPacket packet(data, size, seqNum, timeStamp, true);
|
||||
|
||||
NullEventFactory event_factory;
|
||||
@ -109,7 +109,7 @@ int JitterBufferTest(CmdArgs& args)
|
||||
timeStamp = 123*90;
|
||||
FrameType incomingFrameType(kVideoFrameKey);
|
||||
VCMEncodedFrame* frameOut=NULL;
|
||||
WebRtc_Word64 renderTimeMs = 0;
|
||||
int64_t renderTimeMs = 0;
|
||||
packet.timestamp = timeStamp;
|
||||
packet.seqNum = seqNum;
|
||||
|
||||
@ -1568,8 +1568,8 @@ int JitterBufferTest(CmdArgs& args)
|
||||
|
||||
loop = 0;
|
||||
seqNum = 65485;
|
||||
WebRtc_UWord32 timeStampStart = timeStamp + 33*90;
|
||||
WebRtc_UWord32 timeStampFirstKey = 0;
|
||||
uint32_t timeStampStart = timeStamp + 33*90;
|
||||
uint32_t timeStampFirstKey = 0;
|
||||
VCMEncodedFrame* ptrLastDeltaFrame = NULL;
|
||||
VCMEncodedFrame* ptrFirstKeyFrame = NULL;
|
||||
// insert MAX_NUMBER_OF_FRAMES frames
|
||||
|
||||
@ -64,8 +64,8 @@ JitterEstimateTest::GenerateFrameSample()
|
||||
else
|
||||
_counter++;
|
||||
}
|
||||
WebRtc_Word64 jitter = static_cast<WebRtc_Word64>(_jitter.RandValue() + 1.0/_capacity * frameSize + 0.5);
|
||||
_prevWallClock += static_cast<WebRtc_Word64>(1000*increment + 0.5);
|
||||
int64_t jitter = static_cast<int64_t>(_jitter.RandValue() + 1.0/_capacity * frameSize + 0.5);
|
||||
_prevWallClock += static_cast<int64_t>(1000*increment + 0.5);
|
||||
double rndValue = RandUniform();
|
||||
resent = (rndValue < _lossrate);
|
||||
//printf("rndValue = %f\n", rndValue);
|
||||
|
||||
@ -63,11 +63,11 @@ class FrameSample
|
||||
{
|
||||
public:
|
||||
FrameSample() {FrameSample(0, 0, 0, false, false);}
|
||||
FrameSample(unsigned int ts, WebRtc_Word64 wallClk, unsigned int fs, bool _keyFrame, bool _resent):
|
||||
FrameSample(unsigned int ts, int64_t wallClk, unsigned int fs, bool _keyFrame, bool _resent):
|
||||
timestamp90Khz(ts), wallClockMs(wallClk), frameSize(fs), keyFrame(_keyFrame), resent(_resent) {}
|
||||
|
||||
unsigned int timestamp90Khz;
|
||||
WebRtc_Word64 wallClockMs;
|
||||
int64_t wallClockMs;
|
||||
unsigned int frameSize;
|
||||
bool keyFrame;
|
||||
bool resent;
|
||||
@ -94,7 +94,7 @@ private:
|
||||
//GaussDist _noResend;
|
||||
GaussDist _deltaFrameSize;
|
||||
unsigned int _prevTimestamp;
|
||||
WebRtc_Word64 _prevWallClock;
|
||||
int64_t _prevWallClock;
|
||||
unsigned int _nextDelay;
|
||||
double _keyFrameRate;
|
||||
unsigned int _counter;
|
||||
|
||||
@ -168,7 +168,7 @@ void MediaOptTest::Setup(int testType, CmdArgs& args) {
|
||||
void
|
||||
MediaOptTest::GeneralSetup()
|
||||
{
|
||||
WebRtc_UWord32 minPlayoutDelayMs = 0;
|
||||
uint32_t minPlayoutDelayMs = 0;
|
||||
|
||||
if ((_sourceFile = fopen(_inname.c_str(), "rb")) == NULL)
|
||||
{
|
||||
@ -237,7 +237,7 @@ MediaOptTest::GeneralSetup()
|
||||
VideoCodec sendCodec;
|
||||
_vcm->InitializeSender();
|
||||
_vcm->InitializeReceiver();
|
||||
WebRtc_Word32 numberOfCodecs = _vcm->NumberOfCodecs();
|
||||
int32_t numberOfCodecs = _vcm->NumberOfCodecs();
|
||||
if (numberOfCodecs < 1)
|
||||
{
|
||||
exit(1);
|
||||
@ -252,7 +252,7 @@ MediaOptTest::GeneralSetup()
|
||||
sendCodec.startBitrate = (int) _bitRate;
|
||||
sendCodec.height = _height;
|
||||
sendCodec.width = _width;
|
||||
sendCodec.maxFramerate = (WebRtc_UWord8)_frameRate;
|
||||
sendCodec.maxFramerate = (uint8_t)_frameRate;
|
||||
_vcm->RegisterSendCodec(&sendCodec, _numberOfCores, 1440);
|
||||
_vcm->RegisterReceiveCodec(&sendCodec, _numberOfCores); // same settings for encode and decode
|
||||
|
||||
@ -263,7 +263,7 @@ MediaOptTest::GeneralSetup()
|
||||
|
||||
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
MediaOptTest::Perform()
|
||||
{
|
||||
VCMDecodeCompleteCallback receiveCallback(_decodedFile);
|
||||
@ -289,9 +289,9 @@ MediaOptTest::Perform()
|
||||
|
||||
// START TEST
|
||||
I420VideoFrame sourceFrame;
|
||||
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame];
|
||||
uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
|
||||
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate),
|
||||
(WebRtc_UWord8)_lossRate, _rttMS);
|
||||
(uint8_t)_lossRate, _rttMS);
|
||||
_vcm->RegisterReceiveCallback(&receiveCallback);
|
||||
|
||||
_frameCnt = 0;
|
||||
@ -311,14 +311,14 @@ MediaOptTest::Perform()
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate));
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
|
||||
// inform RTP Module of error resilience features
|
||||
//_rtp->SetFECCodeRate(protectionCallback.FECKeyRate(),protectionCallback.FECDeltaRate());
|
||||
//_rtp->SetNACKStatus(protectionCallback.NACKMethod());
|
||||
|
||||
WebRtc_Word32 ret = _vcm->Decode();
|
||||
int32_t ret = _vcm->Decode();
|
||||
if (ret < 0 )
|
||||
{
|
||||
TEST(ret == 0);
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
|
||||
static int RunTest(int testNum, CmdArgs& args);
|
||||
// perform encode-decode of an entire sequence
|
||||
WebRtc_Word32 Perform();
|
||||
int32_t Perform();
|
||||
// Set up for a single mode test
|
||||
void Setup(int testType, CmdArgs& args);
|
||||
// General set up - applicable for both modes
|
||||
@ -66,24 +66,24 @@ private:
|
||||
FILE* _decodedFile;
|
||||
FILE* _actualSourceFile;
|
||||
FILE* _outputRes;
|
||||
WebRtc_UWord16 _width;
|
||||
WebRtc_UWord16 _height;
|
||||
WebRtc_UWord32 _lengthSourceFrame;
|
||||
WebRtc_UWord32 _timeStamp;
|
||||
uint16_t _width;
|
||||
uint16_t _height;
|
||||
uint32_t _lengthSourceFrame;
|
||||
uint32_t _timeStamp;
|
||||
float _frameRate;
|
||||
bool _nackEnabled;
|
||||
bool _fecEnabled;
|
||||
bool _nackFecEnabled;
|
||||
WebRtc_UWord8 _rttMS;
|
||||
uint8_t _rttMS;
|
||||
float _bitRate;
|
||||
double _lossRate;
|
||||
WebRtc_UWord32 _renderDelayMs;
|
||||
WebRtc_Word32 _frameCnt;
|
||||
uint32_t _renderDelayMs;
|
||||
int32_t _frameCnt;
|
||||
float _sumEncBytes;
|
||||
WebRtc_Word32 _numFramesDropped;
|
||||
int32_t _numFramesDropped;
|
||||
std::string _codecName;
|
||||
webrtc::VideoCodecType _sendCodecType;
|
||||
WebRtc_Word32 _numberOfCores;
|
||||
int32_t _numberOfCores;
|
||||
|
||||
//for release test#2
|
||||
FILE* _fpinp;
|
||||
|
||||
@ -34,11 +34,11 @@ MainSenderThread(void* obj)
|
||||
EventWrapper& waitEvent = *EventWrapper::Create();
|
||||
// preparing a frame for encoding
|
||||
I420VideoFrame sourceFrame;
|
||||
WebRtc_Word32 width = state->_args.width;
|
||||
WebRtc_Word32 height = state->_args.height;
|
||||
int32_t width = state->_args.width;
|
||||
int32_t height = state->_args.height;
|
||||
float frameRate = state->_args.frameRate;
|
||||
WebRtc_Word32 lengthSourceFrame = 3*width*height/2;
|
||||
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[lengthSourceFrame];
|
||||
int32_t lengthSourceFrame = 3*width*height/2;
|
||||
uint8_t* tmpBuffer = new uint8_t[lengthSourceFrame];
|
||||
|
||||
if (state->_sourceFile == NULL)
|
||||
{
|
||||
@ -65,10 +65,10 @@ MainSenderThread(void* obj)
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
width, height,
|
||||
width, half_width, half_width);
|
||||
state->_timestamp += (WebRtc_UWord32)(9e4 / frameRate);
|
||||
state->_timestamp += (uint32_t)(9e4 / frameRate);
|
||||
sourceFrame.set_timestamp(state->_timestamp);
|
||||
|
||||
WebRtc_Word32 ret = state->_vcm.AddVideoFrame(sourceFrame);
|
||||
int32_t ret = state->_vcm.AddVideoFrame(sourceFrame);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("Add Frame error: %d\n", ret);
|
||||
@ -105,21 +105,21 @@ int MTRxTxTest(CmdArgs& args)
|
||||
else
|
||||
outname = args.outputFile;
|
||||
|
||||
WebRtc_UWord16 width = args.width;
|
||||
WebRtc_UWord16 height = args.height;
|
||||
uint16_t width = args.width;
|
||||
uint16_t height = args.height;
|
||||
|
||||
float frameRate = args.frameRate;
|
||||
float bitRate = args.bitRate;
|
||||
WebRtc_Word32 numberOfCores = 1;
|
||||
int32_t numberOfCores = 1;
|
||||
|
||||
// error resilience/network
|
||||
// Nack support is currently not implemented in this test.
|
||||
bool nackEnabled = false;
|
||||
bool fecEnabled = false;
|
||||
WebRtc_UWord8 rttMS = 20;
|
||||
uint8_t rttMS = 20;
|
||||
float lossRate = 0.0*255; // no packet loss
|
||||
WebRtc_UWord32 renderDelayMs = 0;
|
||||
WebRtc_UWord32 minPlayoutDelayMs = 0;
|
||||
uint32_t renderDelayMs = 0;
|
||||
uint32_t minPlayoutDelayMs = 0;
|
||||
|
||||
/* TEST SET-UP */
|
||||
|
||||
@ -187,7 +187,7 @@ int MTRxTxTest(CmdArgs& args)
|
||||
// registering codecs for the VCM module
|
||||
VideoCodec sendCodec;
|
||||
vcm->InitializeSender();
|
||||
WebRtc_Word32 numberOfCodecs = vcm->NumberOfCodecs();
|
||||
int32_t numberOfCodecs = vcm->NumberOfCodecs();
|
||||
if (numberOfCodecs < 1)
|
||||
{
|
||||
return -1;
|
||||
@ -203,7 +203,7 @@ int MTRxTxTest(CmdArgs& args)
|
||||
sendCodec.startBitrate = (int) bitRate;
|
||||
sendCodec.height = height;
|
||||
sendCodec.width = width;
|
||||
sendCodec.maxFramerate = (WebRtc_UWord8)frameRate;
|
||||
sendCodec.maxFramerate = (uint8_t)frameRate;
|
||||
vcm->RegisterSendCodec(&sendCodec, numberOfCores, 1440);
|
||||
vcm->RegisterReceiveCodec(&sendCodec, numberOfCores); // same settings for encode and decode
|
||||
|
||||
@ -240,7 +240,7 @@ int MTRxTxTest(CmdArgs& args)
|
||||
rtp->SetNACKStatus(nackEnabled ? kNackRtcp : kNackOff, kMaxPacketAgeToNack);
|
||||
|
||||
vcm->SetChannelParameters(static_cast<uint32_t>(1000 * bitRate),
|
||||
(WebRtc_UWord8) lossRate, rttMS);
|
||||
(uint8_t) lossRate, rttMS);
|
||||
|
||||
SharedRTPState mtState(*vcm, *rtp); // receive side
|
||||
SendSharedState mtSendState(*vcm, *rtp, args); // send side
|
||||
|
||||
@ -34,7 +34,7 @@ TransportCallback::SendPacket(int channel, const void *data, int len)
|
||||
|
||||
if (_rtpDump != NULL)
|
||||
{
|
||||
if (_rtpDump->DumpPacket((const WebRtc_UWord8*)data, len) != 0)
|
||||
if (_rtpDump->DumpPacket((const uint8_t*)data, len) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -58,8 +58,8 @@ TransportCallback::SendPacket(int channel, const void *data, int len)
|
||||
// Simulate receive time = network delay + packet jitter
|
||||
// simulated as a Normal distribution random variable with
|
||||
// mean = networkDelay and variance = jitterVar
|
||||
WebRtc_Word32
|
||||
simulatedDelay = (WebRtc_Word32)NormalDist(_networkDelayMs,
|
||||
int32_t
|
||||
simulatedDelay = (int32_t)NormalDist(_networkDelayMs,
|
||||
sqrt(_jitterVar));
|
||||
newPacket->receiveTime = now + simulatedDelay;
|
||||
_rtpPackets.push_back(newPacket);
|
||||
@ -79,7 +79,7 @@ TransportCallback::TransportPackets()
|
||||
{
|
||||
// Take first packet in list
|
||||
packet = _rtpPackets.front();
|
||||
WebRtc_Word64 timeToReceive = packet->receiveTime - now;
|
||||
int64_t timeToReceive = packet->receiveTime - now;
|
||||
if (timeToReceive > 0)
|
||||
{
|
||||
// No available packets to send
|
||||
@ -88,7 +88,7 @@ TransportCallback::TransportPackets()
|
||||
|
||||
_rtpPackets.pop_front();
|
||||
// Send to receive side
|
||||
if (_rtp->IncomingPacket((const WebRtc_UWord8*)packet->data,
|
||||
if (_rtp->IncomingPacket((const uint8_t*)packet->data,
|
||||
packet->length) < 0)
|
||||
{
|
||||
delete packet;
|
||||
|
||||
@ -38,8 +38,8 @@ public:
|
||||
webrtc::RtpRtcp& _rtp;
|
||||
CmdArgs _args;
|
||||
FILE* _sourceFile;
|
||||
WebRtc_Word32 _frameCnt;
|
||||
WebRtc_Word32 _timestamp;
|
||||
int32_t _frameCnt;
|
||||
int32_t _timestamp;
|
||||
};
|
||||
|
||||
// MT implementation of the RTPSendCompleteCallback (Transport)
|
||||
|
||||
@ -69,14 +69,14 @@ void VCMNTEncodeCompleteCallback::RegisterTransportCallback(
|
||||
{
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMNTEncodeCompleteCallback::SendData(
|
||||
const FrameType frameType,
|
||||
const WebRtc_UWord8 payloadType,
|
||||
const WebRtc_UWord32 timeStamp,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord32 payloadSize,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const RTPFragmentationHeader& /*fragmentationHeader*/,
|
||||
const webrtc::RTPVideoHeader* videoHdr)
|
||||
|
||||
@ -131,13 +131,13 @@ VCMNTEncodeCompleteCallback::RegisterReceiverVCM(VideoCodingModule *vcm)
|
||||
_VCMReceiver = vcm;
|
||||
return;
|
||||
}
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMNTEncodeCompleteCallback::EncodedBytes()
|
||||
{
|
||||
return _encodedBytes;
|
||||
}
|
||||
|
||||
WebRtc_UWord32
|
||||
uint32_t
|
||||
VCMNTEncodeCompleteCallback::SkipCnt()
|
||||
{
|
||||
return _skipCnt;
|
||||
@ -149,7 +149,7 @@ VCMNTDecodeCompleCallback::~VCMNTDecodeCompleCallback()
|
||||
if (_decodedFile)
|
||||
fclose(_decodedFile);
|
||||
}
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
|
||||
{
|
||||
if (videoFrame.width() != _currentWidth ||
|
||||
@ -172,7 +172,7 @@ VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMNTDecodeCompleCallback::DecodedBytes()
|
||||
{
|
||||
return _decodedBytes;
|
||||
@ -241,7 +241,7 @@ NormalTest::Setup(const CmdArgs& args)
|
||||
std::fstream::out | std::fstream::app);
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
NormalTest::Perform(const CmdArgs& args)
|
||||
{
|
||||
Setup(args);
|
||||
@ -252,8 +252,8 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
TEST(VideoCodingModule::Codec(_videoType, &_sendCodec) == VCM_OK);
|
||||
// should be later on changed via the API
|
||||
_sendCodec.startBitrate = (int)_bitRate;
|
||||
_sendCodec.width = static_cast<WebRtc_UWord16>(_width);
|
||||
_sendCodec.height = static_cast<WebRtc_UWord16>(_height);
|
||||
_sendCodec.width = static_cast<uint16_t>(_width);
|
||||
_sendCodec.height = static_cast<uint16_t>(_height);
|
||||
_sendCodec.maxFramerate = _frameRate;
|
||||
// will also set and init the desired codec
|
||||
TEST(_vcm->RegisterSendCodec(&_sendCodec, 4, 1400) == VCM_OK);
|
||||
@ -276,12 +276,12 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
int size_uv = half_width * half_height;
|
||||
sourceFrame.CreateEmptyFrame(_width, _height,
|
||||
_width, half_width, half_width);
|
||||
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame];
|
||||
uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
|
||||
double startTime = clock()/(double)CLOCKS_PER_SEC;
|
||||
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 0);
|
||||
|
||||
SendStatsTest sendStats;
|
||||
sendStats.set_framerate(static_cast<WebRtc_UWord32>(_frameRate));
|
||||
sendStats.set_framerate(static_cast<uint32_t>(_frameRate));
|
||||
sendStats.set_bitrate(1000 * _bitRate);
|
||||
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
||||
|
||||
@ -295,11 +295,11 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp +=
|
||||
(WebRtc_UWord32)(9e4 / static_cast<float>(_sendCodec.maxFramerate));
|
||||
(uint32_t)(9e4 / static_cast<float>(_sendCodec.maxFramerate));
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
_encodeTimes[int(sourceFrame.timestamp())] =
|
||||
clock()/(double)CLOCKS_PER_SEC;
|
||||
WebRtc_Word32 ret = _vcm->AddVideoFrame(sourceFrame);
|
||||
int32_t ret = _vcm->AddVideoFrame(sourceFrame);
|
||||
double encodeTime = clock()/(double)CLOCKS_PER_SEC -
|
||||
_encodeTimes[int(sourceFrame.timestamp())];
|
||||
_totalEncodeTime += encodeTime;
|
||||
@ -322,8 +322,8 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
{
|
||||
_vcm->Process();
|
||||
}
|
||||
WebRtc_UWord32 framePeriod =
|
||||
static_cast<WebRtc_UWord32>(
|
||||
uint32_t framePeriod =
|
||||
static_cast<uint32_t>(
|
||||
1000.0f / static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
|
||||
static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(framePeriod);
|
||||
}
|
||||
@ -339,7 +339,7 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
}
|
||||
|
||||
void
|
||||
NormalTest::FrameEncoded(WebRtc_UWord32 timeStamp)
|
||||
NormalTest::FrameEncoded(uint32_t timeStamp)
|
||||
{
|
||||
_encodeCompleteTime = clock()/(double)CLOCKS_PER_SEC;
|
||||
_encFrameCnt++;
|
||||
@ -348,7 +348,7 @@ NormalTest::FrameEncoded(WebRtc_UWord32 timeStamp)
|
||||
}
|
||||
|
||||
void
|
||||
NormalTest::FrameDecoded(WebRtc_UWord32 timeStamp)
|
||||
NormalTest::FrameDecoded(uint32_t timeStamp)
|
||||
{
|
||||
_decodeCompleteTime = clock()/(double)CLOCKS_PER_SEC;
|
||||
_decFrameCnt++;
|
||||
|
||||
@ -30,13 +30,13 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback
|
||||
void RegisterTransportCallback(webrtc::VCMPacketizationCallback* transport);
|
||||
// process encoded data received from the encoder,
|
||||
// pass stream to the VCMReceiver module
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
SendData(const webrtc::FrameType frameType,
|
||||
const WebRtc_UWord8 payloadType,
|
||||
const WebRtc_UWord32 timeStamp,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord32 payloadSize,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const webrtc::RTPFragmentationHeader& fragmentationHeader,
|
||||
const webrtc::RTPVideoHeader* videoHdr);
|
||||
|
||||
@ -44,19 +44,19 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback
|
||||
// Currently - encode and decode with the same vcm module.
|
||||
void RegisterReceiverVCM(webrtc::VideoCodingModule *vcm);
|
||||
// Return sum of encoded data (all frames in the sequence)
|
||||
WebRtc_Word32 EncodedBytes();
|
||||
int32_t EncodedBytes();
|
||||
// return number of encoder-skipped frames
|
||||
WebRtc_UWord32 SkipCnt();;
|
||||
uint32_t SkipCnt();;
|
||||
// conversion function for payload type (needed for the callback function)
|
||||
// RTPVideoVideoCodecTypes ConvertPayloadType(WebRtc_UWord8 payloadType);
|
||||
// RTPVideoVideoCodecTypes ConvertPayloadType(uint8_t payloadType);
|
||||
|
||||
private:
|
||||
FILE* _encodedFile;
|
||||
WebRtc_UWord32 _encodedBytes;
|
||||
WebRtc_UWord32 _skipCnt;
|
||||
uint32_t _encodedBytes;
|
||||
uint32_t _skipCnt;
|
||||
webrtc::VideoCodingModule* _VCMReceiver;
|
||||
webrtc::FrameType _frameType;
|
||||
WebRtc_UWord16 _seqNo;
|
||||
uint16_t _seqNo;
|
||||
NormalTest& _test;
|
||||
}; // end of VCMEncodeCompleteCallback
|
||||
|
||||
@ -72,8 +72,8 @@ public:
|
||||
virtual ~VCMNTDecodeCompleCallback();
|
||||
void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback);
|
||||
// will write decoded frame into file
|
||||
WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
WebRtc_Word32 DecodedBytes();
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
int32_t DecodedBytes();
|
||||
private:
|
||||
FILE* _decodedFile;
|
||||
std::string _outname;
|
||||
@ -89,7 +89,7 @@ public:
|
||||
webrtc::Clock* clock);
|
||||
~NormalTest();
|
||||
static int RunTest(const CmdArgs& args);
|
||||
WebRtc_Word32 Perform(const CmdArgs& args);
|
||||
int32_t Perform(const CmdArgs& args);
|
||||
// option:: turn into private and call from perform
|
||||
int Width() const { return _width; };
|
||||
int Height() const { return _height; };
|
||||
@ -104,9 +104,9 @@ protected:
|
||||
// print results to std output and to log file
|
||||
void Print();
|
||||
// calculating pipeline delay, and encoding time
|
||||
void FrameEncoded(WebRtc_UWord32 timeStamp);
|
||||
void FrameEncoded(uint32_t timeStamp);
|
||||
// calculating pipeline delay, and decoding time
|
||||
void FrameDecoded(WebRtc_UWord32 timeStamp);
|
||||
void FrameDecoded(uint32_t timeStamp);
|
||||
|
||||
webrtc::Clock* _clock;
|
||||
webrtc::VideoCodingModule* _vcm;
|
||||
@ -115,7 +115,7 @@ protected:
|
||||
std::string _inname;
|
||||
std::string _outname;
|
||||
std::string _encodedName;
|
||||
WebRtc_Word32 _sumEncBytes;
|
||||
int32_t _sumEncBytes;
|
||||
FILE* _sourceFile;
|
||||
FILE* _decodedFile;
|
||||
FILE* _encodedFile;
|
||||
@ -124,8 +124,8 @@ protected:
|
||||
int _height;
|
||||
float _frameRate;
|
||||
float _bitRate;
|
||||
WebRtc_UWord32 _lengthSourceFrame;
|
||||
WebRtc_UWord32 _timeStamp;
|
||||
uint32_t _lengthSourceFrame;
|
||||
uint32_t _timeStamp;
|
||||
webrtc::VideoCodecType _videoType;
|
||||
double _totalEncodeTime;
|
||||
double _totalDecodeTime;
|
||||
@ -136,9 +136,9 @@ protected:
|
||||
double _testTotalTime;
|
||||
std::map<int, double> _encodeTimes;
|
||||
std::map<int, double> _decodeTimes;
|
||||
WebRtc_Word32 _frameCnt;
|
||||
WebRtc_Word32 _encFrameCnt;
|
||||
WebRtc_Word32 _decFrameCnt;
|
||||
int32_t _frameCnt;
|
||||
int32_t _encFrameCnt;
|
||||
int32_t _decFrameCnt;
|
||||
|
||||
}; // end of VCMNormalTestClass
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@ QualityModesTest::Teardown()
|
||||
return;
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
QualityModesTest::Perform(const CmdArgs& args)
|
||||
{
|
||||
Setup(args);
|
||||
@ -182,24 +182,24 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
// frame num at which an update will occur
|
||||
const int updateFrameNum[] = {10000};
|
||||
|
||||
WebRtc_UWord32 numChanges = sizeof(updateFrameNum)/sizeof(*updateFrameNum);
|
||||
WebRtc_UWord8 change = 0;// change counter
|
||||
uint32_t numChanges = sizeof(updateFrameNum)/sizeof(*updateFrameNum);
|
||||
uint8_t change = 0;// change counter
|
||||
|
||||
_vpm = VideoProcessingModule::Create(1);
|
||||
EventWrapper* waitEvent = EventWrapper::Create();
|
||||
VideoCodec codec;//both send and receive
|
||||
_vcm->InitializeReceiver();
|
||||
_vcm->InitializeSender();
|
||||
WebRtc_Word32 NumberOfCodecs = _vcm->NumberOfCodecs();
|
||||
int32_t NumberOfCodecs = _vcm->NumberOfCodecs();
|
||||
for (int i = 0; i < NumberOfCodecs; i++)
|
||||
{
|
||||
_vcm->Codec(i, &codec);
|
||||
if(strncmp(codec.plName,"VP8" , 5) == 0)
|
||||
{
|
||||
codec.startBitrate = (int)_bitRate;
|
||||
codec.maxFramerate = (WebRtc_UWord8) _frameRate;
|
||||
codec.width = (WebRtc_UWord16)_width;
|
||||
codec.height = (WebRtc_UWord16)_height;
|
||||
codec.maxFramerate = (uint8_t) _frameRate;
|
||||
codec.width = (uint16_t)_width;
|
||||
codec.height = (uint16_t)_height;
|
||||
codec.codecSpecific.VP8.frameDroppingOn = false;
|
||||
|
||||
// Will also set and init the desired codec
|
||||
@ -237,27 +237,27 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
|
||||
I420VideoFrame sourceFrame;
|
||||
I420VideoFrame *decimatedFrame = NULL;
|
||||
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame];
|
||||
uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
|
||||
double startTime = clock()/(double)CLOCKS_PER_SEC;
|
||||
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 0);
|
||||
|
||||
SendStatsTest sendStats;
|
||||
sendStats.set_framerate(static_cast<WebRtc_UWord32>(_frameRate));
|
||||
sendStats.set_framerate(static_cast<uint32_t>(_frameRate));
|
||||
sendStats.set_bitrate(1000 * _bitRate);
|
||||
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
||||
|
||||
VideoContentMetrics* contentMetrics = NULL;
|
||||
// setting user frame rate
|
||||
_vpm->SetMaxFrameRate((WebRtc_UWord32)(_nativeFrameRate+ 0.5f));
|
||||
_vpm->SetMaxFrameRate((uint32_t)(_nativeFrameRate+ 0.5f));
|
||||
// for starters: keeping native values:
|
||||
_vpm->SetTargetResolution(_width, _height,
|
||||
(WebRtc_UWord32)(_frameRate+ 0.5f));
|
||||
(uint32_t)(_frameRate+ 0.5f));
|
||||
_decodeCallback.SetOriginalFrameDimensions(_nativeWidth, _nativeHeight);
|
||||
|
||||
//tmp - disabling VPM frame dropping
|
||||
_vpm->EnableTemporalDecimation(false);
|
||||
|
||||
WebRtc_Word32 ret = 0;
|
||||
int32_t ret = 0;
|
||||
_numFramesDroppedVPM = 0;
|
||||
|
||||
do {
|
||||
@ -273,7 +273,7 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
(_nativeWidth + 1) / 2);
|
||||
|
||||
_timeStamp +=
|
||||
(WebRtc_UWord32)(9e4 / static_cast<float>(codec.maxFramerate));
|
||||
(uint32_t)(9e4 / static_cast<float>(codec.maxFramerate));
|
||||
sourceFrame.set_timestamp(_timeStamp);
|
||||
|
||||
ret = _vpm->PreprocessFrame(sourceFrame, &decimatedFrame);
|
||||
@ -303,7 +303,7 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
_encodeTimes[int(sourceFrame.timestamp())] =
|
||||
clock()/(double)CLOCKS_PER_SEC;
|
||||
|
||||
WebRtc_Word32 ret = _vcm->AddVideoFrame(*decimatedFrame, contentMetrics);
|
||||
int32_t ret = _vcm->AddVideoFrame(*decimatedFrame, contentMetrics);
|
||||
|
||||
_totalEncodeTime += clock()/(double)CLOCKS_PER_SEC -
|
||||
_encodeTimes[int(sourceFrame.timestamp())];
|
||||
@ -345,7 +345,7 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
_bitRate = bitRateUpdate[change];
|
||||
_frameRate = frameRateUpdate[change];
|
||||
codec.startBitrate = (int)_bitRate;
|
||||
codec.maxFramerate = (WebRtc_UWord8) _frameRate;
|
||||
codec.maxFramerate = (uint8_t) _frameRate;
|
||||
// Will also set and init the desired codec
|
||||
TEST(_vcm->RegisterSendCodec(&codec, 2, 1440) == VCM_OK);
|
||||
change++;
|
||||
@ -421,12 +421,12 @@ QMTestVideoSettingsCallback::Updated()
|
||||
return false;
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
QMTestVideoSettingsCallback::SetVideoQMSettings(const WebRtc_UWord32 frameRate,
|
||||
const WebRtc_UWord32 width,
|
||||
const WebRtc_UWord32 height)
|
||||
int32_t
|
||||
QMTestVideoSettingsCallback::SetVideoQMSettings(const uint32_t frameRate,
|
||||
const uint32_t width,
|
||||
const uint32_t height)
|
||||
{
|
||||
WebRtc_Word32 retVal = 0;
|
||||
int32_t retVal = 0;
|
||||
printf("QM updates: W = %d, H = %d, FR = %d, \n", width, height, frameRate);
|
||||
retVal = _vpm->SetTargetResolution(width, height, frameRate);
|
||||
//Initialize codec with new values - is this the best place to do it?
|
||||
@ -436,9 +436,9 @@ QMTestVideoSettingsCallback::SetVideoQMSettings(const WebRtc_UWord32 frameRate,
|
||||
VideoCodec currentCodec;
|
||||
_vcm->SendCodec(¤tCodec);
|
||||
// now set new values:
|
||||
currentCodec.height = (WebRtc_UWord16)height;
|
||||
currentCodec.width = (WebRtc_UWord16)width;
|
||||
currentCodec.maxFramerate = (WebRtc_UWord8)frameRate;
|
||||
currentCodec.height = (uint16_t)height;
|
||||
currentCodec.width = (uint16_t)width;
|
||||
currentCodec.maxFramerate = (uint8_t)frameRate;
|
||||
|
||||
// re-register encoder
|
||||
retVal = _vcm->RegisterSendCodec(¤tCodec, 2, 1440);
|
||||
@ -482,7 +482,7 @@ VCMQMDecodeCompleCallback::~VCMQMDecodeCompleCallback()
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
{
|
||||
++frames_cnt_since_drop_;
|
||||
@ -537,26 +537,26 @@ VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
WebRtc_Word32 VCMQMDecodeCompleCallback::DecodedBytes()
|
||||
int32_t VCMQMDecodeCompleCallback::DecodedBytes()
|
||||
{
|
||||
return _decodedBytes;
|
||||
}
|
||||
|
||||
void VCMQMDecodeCompleCallback::SetOriginalFrameDimensions(WebRtc_Word32 width,
|
||||
WebRtc_Word32 height)
|
||||
void VCMQMDecodeCompleCallback::SetOriginalFrameDimensions(int32_t width,
|
||||
int32_t height)
|
||||
{
|
||||
_origWidth = width;
|
||||
_origHeight = height;
|
||||
}
|
||||
|
||||
WebRtc_Word32 VCMQMDecodeCompleCallback::buildInterpolator()
|
||||
int32_t VCMQMDecodeCompleCallback::buildInterpolator()
|
||||
{
|
||||
WebRtc_UWord32 decFrameLength = _origWidth*_origHeight*3 >> 1;
|
||||
uint32_t decFrameLength = _origWidth*_origHeight*3 >> 1;
|
||||
if (_decBuffer != NULL)
|
||||
{
|
||||
delete [] _decBuffer;
|
||||
}
|
||||
_decBuffer = new WebRtc_UWord8[decFrameLength];
|
||||
_decBuffer = new uint8_t[decFrameLength];
|
||||
if (_decBuffer == NULL)
|
||||
{
|
||||
return -1;
|
||||
|
||||
@ -24,7 +24,7 @@ public:
|
||||
QualityModesTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::Clock* clock);
|
||||
virtual ~QualityModesTest();
|
||||
WebRtc_Word32 Perform(const CmdArgs& args);
|
||||
int32_t Perform(const CmdArgs& args);
|
||||
|
||||
private:
|
||||
|
||||
@ -42,7 +42,7 @@ private:
|
||||
int _nativeHeight;
|
||||
float _nativeFrameRate;
|
||||
|
||||
WebRtc_UWord32 _numFramesDroppedVPM;
|
||||
uint32_t _numFramesDroppedVPM;
|
||||
bool _flagSSIM;
|
||||
std::string filename_testvideo_;
|
||||
std::string fv_outfilename_;
|
||||
@ -61,24 +61,24 @@ public:
|
||||
virtual ~VCMQMDecodeCompleCallback();
|
||||
void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback);
|
||||
// will write decoded frame into file
|
||||
WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
WebRtc_Word32 DecodedBytes();
|
||||
void SetOriginalFrameDimensions(WebRtc_Word32 width, WebRtc_Word32 height);
|
||||
WebRtc_Word32 buildInterpolator();
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
int32_t DecodedBytes();
|
||||
void SetOriginalFrameDimensions(int32_t width, int32_t height);
|
||||
int32_t buildInterpolator();
|
||||
// Check if last frame is dropped, if so, repeat the last rendered frame.
|
||||
void WriteEnd(int input_tot_frame_count);
|
||||
|
||||
private:
|
||||
FILE* _decodedFile;
|
||||
WebRtc_UWord32 _decodedBytes;
|
||||
uint32_t _decodedBytes;
|
||||
// QualityModesTest& _test;
|
||||
int _origWidth;
|
||||
int _origHeight;
|
||||
int _decWidth;
|
||||
int _decHeight;
|
||||
// VideoInterpolator* _interpolator;
|
||||
WebRtc_UWord8* _decBuffer;
|
||||
WebRtc_UWord32 _frameCnt; // debug
|
||||
uint8_t* _decBuffer;
|
||||
uint32_t _frameCnt; // debug
|
||||
webrtc::I420VideoFrame last_frame_;
|
||||
int frame_rate_;
|
||||
int frames_cnt_since_drop_;
|
||||
@ -93,9 +93,9 @@ class QMTestVideoSettingsCallback : public webrtc::VCMQMSettingsCallback
|
||||
public:
|
||||
QMTestVideoSettingsCallback();
|
||||
// update VPM with QM settings
|
||||
WebRtc_Word32 SetVideoQMSettings(const WebRtc_UWord32 frameRate,
|
||||
const WebRtc_UWord32 width,
|
||||
const WebRtc_UWord32 height);
|
||||
int32_t SetVideoQMSettings(const uint32_t frameRate,
|
||||
const uint32_t width,
|
||||
const uint32_t height);
|
||||
// register VPM used by test
|
||||
void RegisterVPM(webrtc::VideoProcessingModule* vpm);
|
||||
void RegisterVCM(webrtc::VideoCodingModule* vcm);
|
||||
|
||||
@ -28,8 +28,8 @@ public:
|
||||
RtpDataCallback(webrtc::VideoCodingModule* vcm)
|
||||
: _vcm(vcm) {};
|
||||
|
||||
virtual WebRtc_Word32 OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord16 payloadSize,
|
||||
virtual int32_t OnReceivedPayloadData(const uint8_t* payloadData,
|
||||
const uint16_t payloadSize,
|
||||
const webrtc::WebRtcRTPHeader* rtpHeader);
|
||||
private:
|
||||
webrtc::VideoCodingModule* _vcm;
|
||||
@ -48,7 +48,7 @@ public:
|
||||
|
||||
virtual ~FrameReceiveCallback();
|
||||
|
||||
WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
|
||||
private:
|
||||
static void SplitFilename(std::string filename, std::string* basename,
|
||||
|
||||
@ -58,23 +58,23 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VCMTiming timing(clock);
|
||||
float clockInMs = 0.0;
|
||||
WebRtc_UWord32 waitTime = 0;
|
||||
WebRtc_UWord32 jitterDelayMs = 0;
|
||||
WebRtc_UWord32 maxDecodeTimeMs = 0;
|
||||
WebRtc_UWord32 timeStamp = 0;
|
||||
uint32_t waitTime = 0;
|
||||
uint32_t jitterDelayMs = 0;
|
||||
uint32_t maxDecodeTimeMs = 0;
|
||||
uint32_t timeStamp = 0;
|
||||
|
||||
timing.Reset(static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
timing.Reset(static_cast<int64_t>(clockInMs + 0.5));
|
||||
|
||||
timing.UpdateCurrentDelay(timeStamp);
|
||||
|
||||
timing.Reset(static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
timing.Reset(static_cast<int64_t>(clockInMs + 0.5));
|
||||
|
||||
timing.IncomingTimestamp(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
timing.IncomingTimestamp(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
|
||||
jitterDelayMs = 20;
|
||||
timing.SetRequiredDelay(jitterDelayMs);
|
||||
timing.UpdateCurrentDelay(timeStamp);
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)),
|
||||
static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
|
||||
static_cast<int64_t>(clockInMs + 0.5));
|
||||
// First update initializes the render time. Since we have no decode delay
|
||||
// we get waitTime = renderTime - now - renderDelay = jitter
|
||||
TEST(waitTime == jitterDelayMs);
|
||||
@ -84,8 +84,8 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
clockInMs += 1000.0f;
|
||||
timing.SetRequiredDelay(jitterDelayMs);
|
||||
timing.UpdateCurrentDelay(timeStamp);
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)),
|
||||
static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
|
||||
static_cast<int64_t>(clockInMs + 0.5));
|
||||
// Since we gradually increase the delay we only get
|
||||
// 100 ms every second.
|
||||
TEST(waitTime == jitterDelayMs - 10);
|
||||
@ -93,8 +93,8 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
timeStamp += 90000;
|
||||
clockInMs += 1000.0;
|
||||
timing.UpdateCurrentDelay(timeStamp);
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)),
|
||||
static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
|
||||
static_cast<int64_t>(clockInMs + 0.5));
|
||||
TEST(waitTime == jitterDelayMs);
|
||||
|
||||
// 300 incoming frames without jitter, verify that this gives the exact wait time
|
||||
@ -102,41 +102,41 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
{
|
||||
clockInMs += 1000.0f/30.0f;
|
||||
timeStamp += 3000;
|
||||
timing.IncomingTimestamp(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
timing.IncomingTimestamp(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
|
||||
}
|
||||
timing.UpdateCurrentDelay(timeStamp);
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)),
|
||||
static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
|
||||
static_cast<int64_t>(clockInMs + 0.5));
|
||||
TEST(waitTime == jitterDelayMs);
|
||||
|
||||
// Add decode time estimates
|
||||
for (int i=0; i < 10; i++)
|
||||
{
|
||||
WebRtc_Word64 startTimeMs = static_cast<WebRtc_Word64>(clockInMs + 0.5);
|
||||
int64_t startTimeMs = static_cast<int64_t>(clockInMs + 0.5);
|
||||
clockInMs += 10.0f;
|
||||
timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast<int64_t>(clockInMs + 0.5));
|
||||
timeStamp += 3000;
|
||||
clockInMs += 1000.0f/30.0f - 10.0f;
|
||||
timing.IncomingTimestamp(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
timing.IncomingTimestamp(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
|
||||
}
|
||||
maxDecodeTimeMs = 10;
|
||||
timing.SetRequiredDelay(jitterDelayMs);
|
||||
clockInMs += 1000.0f;
|
||||
timeStamp += 90000;
|
||||
timing.UpdateCurrentDelay(timeStamp);
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)),
|
||||
static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
|
||||
static_cast<int64_t>(clockInMs + 0.5));
|
||||
TEST(waitTime == jitterDelayMs);
|
||||
|
||||
WebRtc_UWord32 totalDelay1 = timing.TargetVideoDelay();
|
||||
WebRtc_UWord32 minTotalDelayMs = 200;
|
||||
uint32_t totalDelay1 = timing.TargetVideoDelay();
|
||||
uint32_t minTotalDelayMs = 200;
|
||||
timing.SetMinimumTotalDelay(minTotalDelayMs);
|
||||
clockInMs += 5000.0f;
|
||||
timeStamp += 5*90000;
|
||||
timing.UpdateCurrentDelay(timeStamp);
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)),
|
||||
static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
WebRtc_UWord32 totalDelay2 = timing.TargetVideoDelay();
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
|
||||
static_cast<int64_t>(clockInMs + 0.5));
|
||||
uint32_t totalDelay2 = timing.TargetVideoDelay();
|
||||
// We should at least have minTotalDelayMs - decodeTime (10) - renderTime (10) to wait
|
||||
TEST(waitTime == minTotalDelayMs - maxDecodeTimeMs - 10);
|
||||
// The total video delay should not increase with the extra delay,
|
||||
@ -151,8 +151,8 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
|
||||
// A sudden increase in timestamp of 2.1 seconds
|
||||
clockInMs += 1000.0f/30.0f;
|
||||
timeStamp += static_cast<WebRtc_UWord32>(2.1*90000 + 0.5);
|
||||
WebRtc_Word64 ret = timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
timeStamp += static_cast<uint32_t>(2.1*90000 + 0.5);
|
||||
int64_t ret = timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
|
||||
TEST(ret == -1);
|
||||
timing.Reset();
|
||||
|
||||
@ -164,9 +164,9 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
jitterDelayMs = 60;
|
||||
maxDecodeTimeMs = 10;
|
||||
|
||||
timeStamp = static_cast<WebRtc_UWord32>(-10000); // To produce a wrap
|
||||
timeStamp = static_cast<uint32_t>(-10000); // To produce a wrap
|
||||
clockInMs = 10000.0f;
|
||||
timing.Reset(static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
timing.Reset(static_cast<int64_t>(clockInMs + 0.5));
|
||||
|
||||
float noise = 0.0f;
|
||||
for (int i=0; i < 1400; i++)
|
||||
@ -189,23 +189,23 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
minTotalDelayMs = 0;
|
||||
timing.SetMinimumTotalDelay(minTotalDelayMs);
|
||||
}
|
||||
WebRtc_Word64 startTimeMs = static_cast<WebRtc_Word64>(clockInMs + 0.5);
|
||||
int64_t startTimeMs = static_cast<int64_t>(clockInMs + 0.5);
|
||||
noise = vcmFloatMin(vcmFloatMax(GaussDist::RandValue(0, 2), -10.0f), 30.0f);
|
||||
clockInMs += 10.0f;
|
||||
timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast<WebRtc_Word64>(clockInMs + noise + 0.5));
|
||||
timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast<int64_t>(clockInMs + noise + 0.5));
|
||||
timeStamp += 3000;
|
||||
clockInMs += 1000.0f/30.0f - 10.0f;
|
||||
noise = vcmFloatMin(vcmFloatMax(GaussDist::RandValue(0, 8), -15.0f), 15.0f);
|
||||
timing.IncomingTimestamp(timeStamp, static_cast<WebRtc_Word64>(clockInMs + noise + 0.5));
|
||||
timing.IncomingTimestamp(timeStamp, static_cast<int64_t>(clockInMs + noise + 0.5));
|
||||
timing.SetRequiredDelay(jitterDelayMs);
|
||||
timing.UpdateCurrentDelay(timeStamp);
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)),
|
||||
static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
|
||||
static_cast<int64_t>(clockInMs + 0.5));
|
||||
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, -1, "timeStamp=%u clock=%u maxWaitTime=%u", timeStamp,
|
||||
static_cast<WebRtc_UWord32>(clockInMs + 0.5), waitTime);
|
||||
static_cast<uint32_t>(clockInMs + 0.5), waitTime);
|
||||
|
||||
WebRtc_Word64 renderTimeMs = timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
int64_t renderTimeMs = timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
|
||||
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, -1,
|
||||
"timeStamp=%u renderTime=%u",
|
||||
|
||||
@ -178,7 +178,7 @@ RTPPlayer::~RTPPlayer()
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList)
|
||||
int32_t RTPPlayer::Initialize(const PayloadTypeList* payloadList)
|
||||
{
|
||||
RtpRtcp::Configuration configuration;
|
||||
configuration.id = 1;
|
||||
@ -192,7 +192,7 @@ WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList)
|
||||
_randVec[i] = rand();
|
||||
}
|
||||
_randVecPos = 0;
|
||||
WebRtc_Word32 ret = _rtpModule->SetNACKStatus(kNackOff,
|
||||
int32_t ret = _rtpModule->SetNACKStatus(kNackOff,
|
||||
kMaxPacketAgeToNack);
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -229,7 +229,7 @@ WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList)
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPPlayer::ReadHeader()
|
||||
int32_t RTPPlayer::ReadHeader()
|
||||
{
|
||||
char firstline[FIRSTLINELEN];
|
||||
if (_rtpFile == NULL)
|
||||
@ -254,11 +254,11 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebRtc_UWord32 start_sec;
|
||||
WebRtc_UWord32 start_usec;
|
||||
WebRtc_UWord32 source;
|
||||
WebRtc_UWord16 port;
|
||||
WebRtc_UWord16 padding;
|
||||
uint32_t start_sec;
|
||||
uint32_t start_usec;
|
||||
uint32_t source;
|
||||
uint16_t port;
|
||||
uint16_t padding;
|
||||
|
||||
EXPECT_GT(fread(&start_sec, 4, 1, _rtpFile), 0u);
|
||||
start_sec=ntohl(start_sec);
|
||||
@ -273,18 +273,18 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_UWord32 RTPPlayer::TimeUntilNextPacket() const
|
||||
uint32_t RTPPlayer::TimeUntilNextPacket() const
|
||||
{
|
||||
WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) -
|
||||
int64_t timeLeft = (_nextRtpTime - _firstPacketRtpTime) -
|
||||
(_clock->TimeInMilliseconds() - _firstPacketTimeMs);
|
||||
if (timeLeft < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return static_cast<WebRtc_UWord32>(timeLeft);
|
||||
return static_cast<uint32_t>(timeLeft);
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
||||
int32_t RTPPlayer::NextPacket(const int64_t timeNow)
|
||||
{
|
||||
// Send any packets ready to be resent,
|
||||
RawRtpPacket* resend_packet = _lostPackets.NextPacketToResend(timeNow);
|
||||
@ -309,15 +309,15 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
||||
_rtpModule->Process();
|
||||
if (_firstPacket)
|
||||
{
|
||||
_firstPacketRtpTime = static_cast<WebRtc_Word64>(_nextRtpTime);
|
||||
_firstPacketRtpTime = static_cast<int64_t>(_nextRtpTime);
|
||||
_firstPacketTimeMs = _clock->TimeInMilliseconds();
|
||||
}
|
||||
if (_reordering && _reorderBuffer == NULL)
|
||||
{
|
||||
_reorderBuffer = new RawRtpPacket(reinterpret_cast<WebRtc_UWord8*>(_nextPacket), static_cast<WebRtc_UWord16>(_nextPacketLength));
|
||||
_reorderBuffer = new RawRtpPacket(reinterpret_cast<uint8_t*>(_nextPacket), static_cast<uint16_t>(_nextPacketLength));
|
||||
return 0;
|
||||
}
|
||||
WebRtc_Word32 ret = SendPacket(reinterpret_cast<WebRtc_UWord8*>(_nextPacket), static_cast<WebRtc_UWord16>(_nextPacketLength));
|
||||
int32_t ret = SendPacket(reinterpret_cast<uint8_t*>(_nextPacket), static_cast<uint16_t>(_nextPacketLength));
|
||||
if (_reordering && _reorderBuffer != NULL)
|
||||
{
|
||||
RawRtpPacket* rtpPacket = _reorderBuffer;
|
||||
@ -348,14 +348,14 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen)
|
||||
int32_t RTPPlayer::SendPacket(uint8_t* rtpData, uint16_t rtpLen)
|
||||
{
|
||||
if ((_randVec[(_randVecPos++) % RAND_VEC_LENGTH] + 1.0)/(RAND_MAX + 1.0) < _lossRate &&
|
||||
_noLossStartup < 0)
|
||||
{
|
||||
if (_nackEnabled)
|
||||
{
|
||||
const WebRtc_UWord16 seqNo = (rtpData[2] << 8) + rtpData[3];
|
||||
const uint16_t seqNo = (rtpData[2] << 8) + rtpData[3];
|
||||
printf("Throw: %u\n", seqNo);
|
||||
_lostPackets.AddPacket(new RawRtpPacket(rtpData, rtpLen));
|
||||
return 0;
|
||||
@ -363,7 +363,7 @@ WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLe
|
||||
}
|
||||
else if (rtpLen > 0)
|
||||
{
|
||||
WebRtc_Word32 ret = _rtpModule->IncomingPacket(rtpData, rtpLen);
|
||||
int32_t ret = _rtpModule->IncomingPacket(rtpData, rtpLen);
|
||||
if (ret < 0)
|
||||
{
|
||||
return -1;
|
||||
@ -376,9 +376,9 @@ WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLe
|
||||
return 1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset)
|
||||
int32_t RTPPlayer::ReadPacket(int16_t* rtpdata, uint32_t* offset)
|
||||
{
|
||||
WebRtc_UWord16 length, plen;
|
||||
uint16_t length, plen;
|
||||
|
||||
if (fread(&length,2,1,_rtpFile)==0)
|
||||
return(-1);
|
||||
@ -393,7 +393,7 @@ WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offs
|
||||
*offset=ntohl(*offset);
|
||||
|
||||
// Use length here because a plen of 0 specifies rtcp
|
||||
length = (WebRtc_UWord16) (length - HDR_SIZE);
|
||||
length = (uint16_t) (length - HDR_SIZE);
|
||||
if (fread((unsigned short *) rtpdata,1,length,_rtpFile) != length)
|
||||
return(-1);
|
||||
|
||||
@ -408,7 +408,7 @@ WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offs
|
||||
return plen;
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, WebRtc_UWord32 rttMs)
|
||||
int32_t RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, uint32_t rttMs)
|
||||
{
|
||||
_nackEnabled = enableNack;
|
||||
_lossRate = lossRate;
|
||||
@ -416,13 +416,13 @@ WebRtc_Word32 RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, Web
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPPlayer::SetReordering(bool enabled)
|
||||
int32_t RTPPlayer::SetReordering(bool enabled)
|
||||
{
|
||||
_reordering = enabled;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPPlayer::ResendPackets(const WebRtc_UWord16* sequenceNumbers, WebRtc_UWord16 length)
|
||||
int32_t RTPPlayer::ResendPackets(const uint16_t* sequenceNumbers, uint16_t length)
|
||||
{
|
||||
if (sequenceNumbers == NULL)
|
||||
{
|
||||
|
||||
@ -30,7 +30,7 @@ struct PayloadCodecTuple;
|
||||
struct RawRtpPacket
|
||||
{
|
||||
public:
|
||||
RawRtpPacket(WebRtc_UWord8* rtp_data, WebRtc_UWord16 rtp_length);
|
||||
RawRtpPacket(uint8_t* rtp_data, uint16_t rtp_length);
|
||||
~RawRtpPacket();
|
||||
|
||||
uint8_t* data;
|
||||
@ -66,10 +66,10 @@ class LostPackets {
|
||||
|
||||
struct PayloadCodecTuple
|
||||
{
|
||||
PayloadCodecTuple(WebRtc_UWord8 plType, std::string codecName, webrtc::VideoCodecType type) :
|
||||
PayloadCodecTuple(uint8_t plType, std::string codecName, webrtc::VideoCodecType type) :
|
||||
name(codecName), payloadType(plType), codecType(type) {};
|
||||
const std::string name;
|
||||
const WebRtc_UWord8 payloadType;
|
||||
const uint8_t payloadType;
|
||||
const webrtc::VideoCodecType codecType;
|
||||
};
|
||||
|
||||
@ -81,37 +81,37 @@ public:
|
||||
webrtc::Clock* clock);
|
||||
virtual ~RTPPlayer();
|
||||
|
||||
WebRtc_Word32 Initialize(const PayloadTypeList* payloadList);
|
||||
WebRtc_Word32 NextPacket(const WebRtc_Word64 timeNow);
|
||||
WebRtc_UWord32 TimeUntilNextPacket() const;
|
||||
WebRtc_Word32 SimulatePacketLoss(float lossRate, bool enableNack = false, WebRtc_UWord32 rttMs = 0);
|
||||
WebRtc_Word32 SetReordering(bool enabled);
|
||||
WebRtc_Word32 ResendPackets(const WebRtc_UWord16* sequenceNumbers, WebRtc_UWord16 length);
|
||||
int32_t Initialize(const PayloadTypeList* payloadList);
|
||||
int32_t NextPacket(const int64_t timeNow);
|
||||
uint32_t TimeUntilNextPacket() const;
|
||||
int32_t SimulatePacketLoss(float lossRate, bool enableNack = false, uint32_t rttMs = 0);
|
||||
int32_t SetReordering(bool enabled);
|
||||
int32_t ResendPackets(const uint16_t* sequenceNumbers, uint16_t length);
|
||||
void Print() const;
|
||||
|
||||
private:
|
||||
WebRtc_Word32 SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen);
|
||||
WebRtc_Word32 ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset);
|
||||
WebRtc_Word32 ReadHeader();
|
||||
int32_t SendPacket(uint8_t* rtpData, uint16_t rtpLen);
|
||||
int32_t ReadPacket(int16_t* rtpdata, uint32_t* offset);
|
||||
int32_t ReadHeader();
|
||||
webrtc::Clock* _clock;
|
||||
FILE* _rtpFile;
|
||||
webrtc::RtpRtcp* _rtpModule;
|
||||
WebRtc_UWord32 _nextRtpTime;
|
||||
uint32_t _nextRtpTime;
|
||||
webrtc::RtpData* _dataCallback;
|
||||
bool _firstPacket;
|
||||
float _lossRate;
|
||||
bool _nackEnabled;
|
||||
LostPackets _lostPackets;
|
||||
WebRtc_UWord32 _resendPacketCount;
|
||||
WebRtc_Word32 _noLossStartup;
|
||||
uint32_t _resendPacketCount;
|
||||
int32_t _noLossStartup;
|
||||
bool _endOfFile;
|
||||
WebRtc_UWord32 _rttMs;
|
||||
WebRtc_Word64 _firstPacketRtpTime;
|
||||
WebRtc_Word64 _firstPacketTimeMs;
|
||||
uint32_t _rttMs;
|
||||
int64_t _firstPacketRtpTime;
|
||||
int64_t _firstPacketTimeMs;
|
||||
RawRtpPacket* _reorderBuffer;
|
||||
bool _reordering;
|
||||
WebRtc_Word16 _nextPacket[8000];
|
||||
WebRtc_Word32 _nextPacketLength;
|
||||
int16_t _nextPacket[8000];
|
||||
int32_t _nextPacketLength;
|
||||
int _randVec[RAND_VEC_LENGTH];
|
||||
int _randVecPos;
|
||||
};
|
||||
|
||||
@ -47,14 +47,14 @@ VCMEncodeCompleteCallback::RegisterTransportCallback(
|
||||
{
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMEncodeCompleteCallback::SendData(
|
||||
const FrameType frameType,
|
||||
const WebRtc_UWord8 payloadType,
|
||||
const WebRtc_UWord32 timeStamp,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord32 payloadSize,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const RTPFragmentationHeader& fragmentationHeader,
|
||||
const RTPVideoHeader* videoHdr)
|
||||
{
|
||||
@ -68,8 +68,8 @@ VCMEncodeCompleteCallback::SendData(
|
||||
rtpInfo.header.markerBit = true; // end of frame
|
||||
rtpInfo.type.Video.isFirstPacket = true;
|
||||
rtpInfo.type.Video.codec = _codecType;
|
||||
rtpInfo.type.Video.height = (WebRtc_UWord16)_height;
|
||||
rtpInfo.type.Video.width = (WebRtc_UWord16)_width;
|
||||
rtpInfo.type.Video.height = (uint16_t)_height;
|
||||
rtpInfo.type.Video.width = (uint16_t)_width;
|
||||
switch (_codecType)
|
||||
{
|
||||
case webrtc::kRTPVideoVP8:
|
||||
@ -141,14 +141,14 @@ VCMEncodeCompleteCallback::ResetByteCount()
|
||||
// passes the encoded frame via the RTP module to the decoder
|
||||
// Packetization callback implementation
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMRTPEncodeCompleteCallback::SendData(
|
||||
const FrameType frameType,
|
||||
const WebRtc_UWord8 payloadType,
|
||||
const WebRtc_UWord32 timeStamp,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord32 payloadSize,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const RTPFragmentationHeader& fragmentationHeader,
|
||||
const RTPVideoHeader* videoHdr)
|
||||
{
|
||||
@ -187,7 +187,7 @@ VCMRTPEncodeCompleteCallback::EncodeComplete()
|
||||
|
||||
// Decoded Frame Callback Implementation
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
{
|
||||
if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) {
|
||||
@ -198,7 +198,7 @@ VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VCMDecodeCompleteCallback::DecodedBytes()
|
||||
{
|
||||
return _decodedBytes;
|
||||
@ -249,7 +249,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||
|
||||
if (_rtpDump != NULL)
|
||||
{
|
||||
if (_rtpDump->DumpPacket((const WebRtc_UWord8*)data, len) != 0)
|
||||
if (_rtpDump->DumpPacket((const uint8_t*)data, len) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -268,8 +268,8 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||
// Simulate receive time = network delay + packet jitter
|
||||
// simulated as a Normal distribution random variable with
|
||||
// mean = networkDelay and variance = jitterVar
|
||||
WebRtc_Word32
|
||||
simulatedDelay = (WebRtc_Word32)NormalDist(_networkDelayMs,
|
||||
int32_t
|
||||
simulatedDelay = (int32_t)NormalDist(_networkDelayMs,
|
||||
sqrt(_jitterVar));
|
||||
newPacket->receiveTime = now + simulatedDelay;
|
||||
_rtpPackets.push_back(newPacket);
|
||||
@ -282,7 +282,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||
{
|
||||
// Take first packet in list
|
||||
packet = _rtpPackets.front();
|
||||
WebRtc_Word64 timeToReceive = packet->receiveTime - now;
|
||||
int64_t timeToReceive = packet->receiveTime - now;
|
||||
if (timeToReceive > 0)
|
||||
{
|
||||
// No available packets to send
|
||||
@ -292,7 +292,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||
_rtpPackets.pop_front();
|
||||
assert(_rtp); // We must have a configured RTP module for this test.
|
||||
// Send to receive side
|
||||
if (_rtp->IncomingPacket((const WebRtc_UWord8*)packet->data,
|
||||
if (_rtp->IncomingPacket((const uint8_t*)packet->data,
|
||||
packet->length) < 0)
|
||||
{
|
||||
delete packet;
|
||||
@ -397,16 +397,16 @@ RTPSendCompleteCallback::UnifomLoss(double lossPct)
|
||||
return randVal < lossPct/100;
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
PacketRequester::ResendPackets(const WebRtc_UWord16* sequenceNumbers,
|
||||
WebRtc_UWord16 length)
|
||||
int32_t
|
||||
PacketRequester::ResendPackets(const uint16_t* sequenceNumbers,
|
||||
uint16_t length)
|
||||
{
|
||||
return _rtp.SendNACK(sequenceNumbers, length);
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
SendStatsTest::SendStatistics(const WebRtc_UWord32 bitRate,
|
||||
const WebRtc_UWord32 frameRate)
|
||||
int32_t
|
||||
SendStatsTest::SendStatistics(const uint32_t bitRate,
|
||||
const uint32_t frameRate)
|
||||
{
|
||||
TEST(frameRate <= _framerate);
|
||||
TEST(bitRate > _bitrate / 2 && bitRate < 3 * _bitrate / 2);
|
||||
@ -414,7 +414,7 @@ SendStatsTest::SendStatistics(const WebRtc_UWord32 bitRate,
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 KeyFrameReqTest::RequestKeyFrame() {
|
||||
int32_t KeyFrameReqTest::RequestKeyFrame() {
|
||||
printf("Key frame requested\n");
|
||||
return 0;
|
||||
}
|
||||
@ -433,13 +433,13 @@ VideoProtectionCallback::~VideoProtectionCallback()
|
||||
//
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VideoProtectionCallback::ProtectionRequest(
|
||||
const FecProtectionParams* delta_fec_params,
|
||||
const FecProtectionParams* key_fec_params,
|
||||
WebRtc_UWord32* sent_video_rate_bps,
|
||||
WebRtc_UWord32* sent_nack_rate_bps,
|
||||
WebRtc_UWord32* sent_fec_rate_bps)
|
||||
uint32_t* sent_video_rate_bps,
|
||||
uint32_t* sent_nack_rate_bps,
|
||||
uint32_t* sent_fec_rate_bps)
|
||||
{
|
||||
key_fec_params_ = *key_fec_params;
|
||||
delta_fec_params_ = *delta_fec_params;
|
||||
|
||||
@ -42,12 +42,12 @@ public:
|
||||
void RegisterTransportCallback(VCMPacketizationCallback* transport);
|
||||
// Process encoded data received from the encoder, pass stream to the
|
||||
// VCMReceiver module
|
||||
WebRtc_Word32 SendData(const FrameType frameType,
|
||||
const WebRtc_UWord8 payloadType,
|
||||
const WebRtc_UWord32 timeStamp,
|
||||
int32_t SendData(const FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord32 payloadSize,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const RTPFragmentationHeader& fragmentationHeader,
|
||||
const RTPVideoHeader* videoHdr);
|
||||
// Register exisitng VCM. Currently - encode and decode under same module.
|
||||
@ -62,7 +62,7 @@ public:
|
||||
void SetCodecType(RTPVideoCodecTypes codecType)
|
||||
{_codecType = codecType;}
|
||||
// Inform callback of frame dimensions
|
||||
void SetFrameDimensions(WebRtc_Word32 width, WebRtc_Word32 height)
|
||||
void SetFrameDimensions(int32_t width, int32_t height)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
@ -78,10 +78,10 @@ private:
|
||||
float _encodedBytes;
|
||||
VideoCodingModule* _VCMReceiver;
|
||||
FrameType _frameType;
|
||||
WebRtc_UWord16 _seqNo;
|
||||
uint16_t _seqNo;
|
||||
bool _encodeComplete;
|
||||
WebRtc_Word32 _width;
|
||||
WebRtc_Word32 _height;
|
||||
int32_t _width;
|
||||
int32_t _height;
|
||||
RTPVideoCodecTypes _codecType;
|
||||
|
||||
}; // end of VCMEncodeCompleteCallback
|
||||
@ -99,12 +99,12 @@ public:
|
||||
virtual ~VCMRTPEncodeCompleteCallback() {}
|
||||
// Process encoded data received from the encoder, pass stream to the
|
||||
// RTP module
|
||||
WebRtc_Word32 SendData(const FrameType frameType,
|
||||
const WebRtc_UWord8 payloadType,
|
||||
const WebRtc_UWord32 timeStamp,
|
||||
int32_t SendData(const FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord32 payloadSize,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const RTPFragmentationHeader& fragmentationHeader,
|
||||
const RTPVideoHeader* videoHdr);
|
||||
// Return size of last encoded frame. Value good for one call
|
||||
@ -117,7 +117,7 @@ public:
|
||||
{_codecType = codecType;}
|
||||
|
||||
// Inform callback of frame dimensions
|
||||
void SetFrameDimensions(WebRtc_Word16 width, WebRtc_Word16 height)
|
||||
void SetFrameDimensions(int16_t width, int16_t height)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
@ -128,8 +128,8 @@ private:
|
||||
FrameType _frameType;
|
||||
bool _encodeComplete;
|
||||
RtpRtcp* _RTPModule;
|
||||
WebRtc_Word16 _width;
|
||||
WebRtc_Word16 _height;
|
||||
int16_t _width;
|
||||
int16_t _height;
|
||||
RTPVideoCodecTypes _codecType;
|
||||
}; // end of VCMEncodeCompleteCallback
|
||||
|
||||
@ -142,11 +142,11 @@ public:
|
||||
_decodedFile(decodedFile), _decodedBytes(0) {}
|
||||
virtual ~VCMDecodeCompleteCallback() {}
|
||||
// Write decoded frame into file
|
||||
WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
WebRtc_Word32 DecodedBytes();
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
int32_t DecodedBytes();
|
||||
private:
|
||||
FILE* _decodedFile;
|
||||
WebRtc_UWord32 _decodedBytes;
|
||||
uint32_t _decodedBytes;
|
||||
}; // end of VCMDecodeCompleCallback class
|
||||
|
||||
// Transport callback
|
||||
@ -171,15 +171,15 @@ public:
|
||||
// Set average size of burst loss
|
||||
void SetBurstLength(double burstLength);
|
||||
// Set network delay in the network
|
||||
void SetNetworkDelay(WebRtc_UWord32 networkDelayMs)
|
||||
void SetNetworkDelay(uint32_t networkDelayMs)
|
||||
{_networkDelayMs = networkDelayMs;};
|
||||
// Set Packet jitter delay
|
||||
void SetJitterVar(WebRtc_UWord32 jitterVar)
|
||||
void SetJitterVar(uint32_t jitterVar)
|
||||
{_jitterVar = jitterVar;};
|
||||
// Return send count
|
||||
int SendCount() {return _sendCount; }
|
||||
// Return accumulated length in bytes of transmitted packets
|
||||
WebRtc_UWord32 TotalSentLength() {return _totalSentLength;}
|
||||
uint32_t TotalSentLength() {return _totalSentLength;}
|
||||
protected:
|
||||
// Randomly decide whether to drop packets, based on the channel model
|
||||
bool PacketLoss();
|
||||
@ -187,14 +187,14 @@ protected:
|
||||
bool UnifomLoss(double lossPct);
|
||||
|
||||
Clock* _clock;
|
||||
WebRtc_UWord32 _sendCount;
|
||||
uint32_t _sendCount;
|
||||
RtpRtcp* _rtp;
|
||||
double _lossPct;
|
||||
double _burstLength;
|
||||
WebRtc_UWord32 _networkDelayMs;
|
||||
uint32_t _networkDelayMs;
|
||||
double _jitterVar;
|
||||
bool _prevLossState;
|
||||
WebRtc_UWord32 _totalSentLength;
|
||||
uint32_t _totalSentLength;
|
||||
std::list<RtpPacket*> _rtpPackets;
|
||||
RtpDump* _rtpDump;
|
||||
};
|
||||
@ -205,8 +205,8 @@ class PacketRequester: public VCMPacketRequestCallback
|
||||
public:
|
||||
PacketRequester(RtpRtcp& rtp) :
|
||||
_rtp(rtp) {}
|
||||
WebRtc_Word32 ResendPackets(const WebRtc_UWord16* sequenceNumbers,
|
||||
WebRtc_UWord16 length);
|
||||
int32_t ResendPackets(const uint16_t* sequenceNumbers,
|
||||
uint16_t length);
|
||||
private:
|
||||
webrtc::RtpRtcp& _rtp;
|
||||
};
|
||||
@ -215,7 +215,7 @@ private:
|
||||
class KeyFrameReqTest: public VCMFrameTypeCallback
|
||||
{
|
||||
public:
|
||||
WebRtc_Word32 RequestKeyFrame();
|
||||
int32_t RequestKeyFrame();
|
||||
};
|
||||
|
||||
|
||||
@ -224,12 +224,12 @@ class SendStatsTest: public webrtc::VCMSendStatisticsCallback
|
||||
{
|
||||
public:
|
||||
SendStatsTest() : _framerate(15), _bitrate(500) {}
|
||||
WebRtc_Word32 SendStatistics(const WebRtc_UWord32 bitRate,
|
||||
const WebRtc_UWord32 frameRate);
|
||||
void set_framerate(WebRtc_UWord32 frameRate) {_framerate = frameRate;}
|
||||
int32_t SendStatistics(const uint32_t bitRate,
|
||||
const uint32_t frameRate);
|
||||
void set_framerate(uint32_t frameRate) {_framerate = frameRate;}
|
||||
void set_bitrate(uint32_t bitrate) {_bitrate = bitrate;}
|
||||
private:
|
||||
WebRtc_UWord32 _framerate;
|
||||
uint32_t _framerate;
|
||||
uint32_t _bitrate;
|
||||
};
|
||||
|
||||
@ -241,12 +241,12 @@ public:
|
||||
VideoProtectionCallback();
|
||||
virtual ~VideoProtectionCallback();
|
||||
void RegisterRtpModule(RtpRtcp* rtp) {_rtp = rtp;}
|
||||
WebRtc_Word32 ProtectionRequest(
|
||||
int32_t ProtectionRequest(
|
||||
const FecProtectionParams* delta_fec_params,
|
||||
const FecProtectionParams* key_fec_params,
|
||||
WebRtc_UWord32* sent_video_rate_bps,
|
||||
WebRtc_UWord32* sent_nack_rate_bps,
|
||||
WebRtc_UWord32* sent_fec_rate_bps);
|
||||
uint32_t* sent_video_rate_bps,
|
||||
uint32_t* sent_nack_rate_bps,
|
||||
uint32_t* sent_fec_rate_bps);
|
||||
FecProtectionParams DeltaFecParameters() const;
|
||||
FecProtectionParams KeyFecParameters() const;
|
||||
private:
|
||||
|
||||
@ -69,9 +69,9 @@ int MTRxTxTest(CmdArgs& args);
|
||||
double NormalDist(double mean, double stdDev);
|
||||
|
||||
struct RtpPacket {
|
||||
WebRtc_Word8 data[1650]; // max packet size
|
||||
WebRtc_Word32 length;
|
||||
WebRtc_Word64 receiveTime;
|
||||
int8_t data[1650]; // max packet size
|
||||
int32_t length;
|
||||
int64_t receiveTime;
|
||||
};
|
||||
|
||||
class NullEvent : public webrtc::EventWrapper {
|
||||
|
||||
@ -24,9 +24,9 @@
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
WebRtc_Word32
|
||||
RtpDataCallback::OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
|
||||
const WebRtc_UWord16 payloadSize,
|
||||
int32_t
|
||||
RtpDataCallback::OnReceivedPayloadData(const uint8_t* payloadData,
|
||||
const uint16_t payloadSize,
|
||||
const WebRtcRTPHeader* rtpHeader)
|
||||
{
|
||||
return _vcm->IncomingPacket(payloadData, payloadSize, *rtpHeader);
|
||||
@ -44,7 +44,7 @@ FrameReceiveCallback::~FrameReceiveCallback()
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
FrameReceiveCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
{
|
||||
if (_timingFile == NULL)
|
||||
@ -114,12 +114,12 @@ int RtpPlay(CmdArgs& args)
|
||||
// BEGIN Settings
|
||||
bool protectionEnabled = true;
|
||||
VCMVideoProtection protectionMethod = kProtectionNack;
|
||||
WebRtc_UWord32 rttMS = 0;
|
||||
uint32_t rttMS = 0;
|
||||
float lossRate = 0.0f;
|
||||
bool reordering = false;
|
||||
WebRtc_UWord32 renderDelayMs = 0;
|
||||
WebRtc_UWord32 minPlayoutDelayMs = 0;
|
||||
const WebRtc_Word64 MAX_RUNTIME_MS = -1;
|
||||
uint32_t renderDelayMs = 0;
|
||||
uint32_t minPlayoutDelayMs = 0;
|
||||
const int64_t MAX_RUNTIME_MS = -1;
|
||||
std::string outFile = args.outputFile;
|
||||
if (outFile == "")
|
||||
outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
|
||||
@ -147,7 +147,7 @@ int RtpPlay(CmdArgs& args)
|
||||
|
||||
// Set up
|
||||
|
||||
WebRtc_Word32 ret = vcm->InitializeReceiver();
|
||||
int32_t ret = vcm->InitializeReceiver();
|
||||
if (ret < 0)
|
||||
{
|
||||
return -1;
|
||||
|
||||
@ -64,11 +64,11 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
||||
// BEGIN Settings
|
||||
bool protectionEnabled = true;
|
||||
VCMVideoProtection protection = kProtectionDualDecoder;
|
||||
WebRtc_UWord8 rttMS = 50;
|
||||
uint8_t rttMS = 50;
|
||||
float lossRate = 0.05f;
|
||||
WebRtc_UWord32 renderDelayMs = 0;
|
||||
WebRtc_UWord32 minPlayoutDelayMs = 0;
|
||||
const WebRtc_Word64 MAX_RUNTIME_MS = 10000;
|
||||
uint32_t renderDelayMs = 0;
|
||||
uint32_t minPlayoutDelayMs = 0;
|
||||
const int64_t MAX_RUNTIME_MS = 10000;
|
||||
std::string outFilename = args.outputFile;
|
||||
if (outFilename == "")
|
||||
outFilename = test::OutputPath() + "RtpPlayMT_decoded.yuv";
|
||||
@ -151,7 +151,7 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
||||
}
|
||||
rtpStream.SimulatePacketLoss(lossRate, nackEnabled, rttMS);
|
||||
|
||||
WebRtc_Word32 ret = vcm->InitializeReceiver();
|
||||
int32_t ret = vcm->InitializeReceiver();
|
||||
if (ret < 0)
|
||||
{
|
||||
return -1;
|
||||
|
||||
@ -40,7 +40,7 @@ _frameRate(frameRate)
|
||||
GetWidthHeight(size);
|
||||
}
|
||||
|
||||
VideoSource::VideoSource(std::string fileName, WebRtc_UWord16 width, WebRtc_UWord16 height,
|
||||
VideoSource::VideoSource(std::string fileName, uint16_t width, uint16_t height,
|
||||
float frameRate /*= 30*/, webrtc::VideoType type /*= webrtc::kI420*/)
|
||||
:
|
||||
_fileName(fileName),
|
||||
@ -55,7 +55,7 @@ _frameRate(frameRate)
|
||||
assert(frameRate > 0);
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
VideoSource::GetFrameLength() const
|
||||
{
|
||||
return webrtc::CalcBufferSize(_type, _width, _height);
|
||||
|
||||
@ -56,12 +56,12 @@ class VideoSource
|
||||
public:
|
||||
VideoSource();
|
||||
VideoSource(std::string fileName, VideoSize size, float frameRate, webrtc::VideoType type = webrtc::kI420);
|
||||
VideoSource(std::string fileName, WebRtc_UWord16 width, WebRtc_UWord16 height,
|
||||
VideoSource(std::string fileName, uint16_t width, uint16_t height,
|
||||
float frameRate = 30, webrtc::VideoType type = webrtc::kI420);
|
||||
|
||||
std::string GetFileName() const { return _fileName; }
|
||||
WebRtc_UWord16 GetWidth() const { return _width; }
|
||||
WebRtc_UWord16 GetHeight() const { return _height; }
|
||||
uint16_t GetWidth() const { return _width; }
|
||||
uint16_t GetHeight() const { return _height; }
|
||||
webrtc::VideoType GetType() const { return _type; }
|
||||
float GetFrameRate() const { return _frameRate; }
|
||||
int GetWidthHeight( VideoSize size);
|
||||
@ -69,12 +69,12 @@ public:
|
||||
// Returns the filename with the path (including the leading slash) removed.
|
||||
std::string GetName() const;
|
||||
|
||||
WebRtc_Word32 GetFrameLength() const;
|
||||
int32_t GetFrameLength() const;
|
||||
|
||||
private:
|
||||
std::string _fileName;
|
||||
WebRtc_UWord16 _width;
|
||||
WebRtc_UWord16 _height;
|
||||
uint16_t _width;
|
||||
uint16_t _height;
|
||||
webrtc::VideoType _type;
|
||||
float _frameRate;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user