Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information. This CL was reviewed and approved in pieces in the following CLs: https://webrtc-codereview.appspot.com/24209004/ https://webrtc-codereview.appspot.com/24229004/ https://webrtc-codereview.appspot.com/24259004/ https://webrtc-codereview.appspot.com/25109004/ https://webrtc-codereview.appspot.com/26099004/ https://webrtc-codereview.appspot.com/27069004/ https://webrtc-codereview.appspot.com/27969004/ https://webrtc-codereview.appspot.com/27989004/ https://webrtc-codereview.appspot.com/29009004/ https://webrtc-codereview.appspot.com/30929004/ https://webrtc-codereview.appspot.com/30939004/ https://webrtc-codereview.appspot.com/31999004/ Committing as TBR to the original reviewers. BUG=chromium:81439 TEST=none TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom Review URL: https://webrtc-codereview.appspot.com/23129004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -279,8 +279,9 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
const float nBitrates = sizeof(bitRate)/sizeof(*bitRate);
|
||||
float _bitRate = 0;
|
||||
int _frameCnt = 0;
|
||||
float totalBytesOneSec = 0;//, totalBytesTenSec;
|
||||
float totalBytes, actualBitrate;
|
||||
size_t totalBytesOneSec = 0;//, totalBytesTenSec;
|
||||
size_t totalBytes;
|
||||
float actualBitrate;
|
||||
VCMFrameCount frameCount; // testing frame type counters
|
||||
// start test
|
||||
NumberOfCodecs = _vcm->NumberOfCodecs();
|
||||
@ -478,7 +479,7 @@ GenericCodecTest::Print()
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
size_t
|
||||
GenericCodecTest::WaitForEncodedFrame() const
|
||||
{
|
||||
int64_t startTime = _clock->TimeInMilliseconds();
|
||||
@ -499,17 +500,17 @@ GenericCodecTest::IncrementDebugClock(float frameRate)
|
||||
}
|
||||
|
||||
int
|
||||
RTPSendCallback_SizeTest::SendPacket(int channel, const void *data, int len)
|
||||
RTPSendCallback_SizeTest::SendPacket(int channel, const void *data, size_t len)
|
||||
{
|
||||
_nPackets++;
|
||||
_payloadSizeSum += len;
|
||||
// Make sure no payloads (len - header size) are larger than maxPayloadSize
|
||||
TEST(len > 0 && static_cast<uint32_t>(len - 12) <= _maxPayloadSize);
|
||||
TEST(len > 0 && len - 12 <= _maxPayloadSize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
RTPSendCallback_SizeTest::SetMaxPayloadSize(uint32_t maxPayloadSize)
|
||||
RTPSendCallback_SizeTest::SetMaxPayloadSize(size_t maxPayloadSize)
|
||||
{
|
||||
_maxPayloadSize = maxPayloadSize;
|
||||
}
|
||||
@ -533,12 +534,12 @@ RTPSendCallback_SizeTest::AveragePayloadSize() const
|
||||
|
||||
int32_t
|
||||
VCMEncComplete_KeyReqTest::SendData(
|
||||
const FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
FrameType frameType,
|
||||
uint8_t payloadType,
|
||||
uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
size_t payloadSize,
|
||||
const RTPFragmentationHeader& /*fragmentationHeader*/,
|
||||
const webrtc::RTPVideoHeader* /*videoHdr*/)
|
||||
{
|
||||
|
||||
@ -41,7 +41,7 @@ public:
|
||||
~GenericCodecTest();
|
||||
static int RunTest(CmdArgs& args);
|
||||
int32_t Perform(CmdArgs& args);
|
||||
float WaitForEncodedFrame() const;
|
||||
size_t WaitForEncodedFrame() const;
|
||||
|
||||
private:
|
||||
void Setup(CmdArgs& args);
|
||||
@ -75,14 +75,18 @@ class RTPSendCallback_SizeTest : public webrtc::Transport
|
||||
public:
|
||||
// constructor input: (receive side) rtp module to send encoded data to
|
||||
RTPSendCallback_SizeTest() : _maxPayloadSize(0), _payloadSizeSum(0), _nPackets(0) {}
|
||||
virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
|
||||
virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE {return 0;}
|
||||
void SetMaxPayloadSize(uint32_t maxPayloadSize);
|
||||
virtual int SendPacket(int channel, const void *data, size_t len) OVERRIDE;
|
||||
virtual int SendRTCPPacket(int channel,
|
||||
const void *data,
|
||||
size_t len) OVERRIDE {
|
||||
return 0;
|
||||
}
|
||||
void SetMaxPayloadSize(size_t maxPayloadSize);
|
||||
void Reset();
|
||||
float AveragePayloadSize() const;
|
||||
private:
|
||||
uint32_t _maxPayloadSize;
|
||||
uint32_t _payloadSizeSum;
|
||||
size_t _maxPayloadSize;
|
||||
size_t _payloadSizeSum;
|
||||
uint32_t _nPackets;
|
||||
};
|
||||
|
||||
@ -91,12 +95,12 @@ class VCMEncComplete_KeyReqTest : public webrtc::VCMPacketizationCallback
|
||||
public:
|
||||
VCMEncComplete_KeyReqTest(webrtc::VideoCodingModule &vcm) : _vcm(vcm), _seqNo(0), _timeStamp(0) {}
|
||||
virtual int32_t SendData(
|
||||
const webrtc::FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
webrtc::FrameType frameType,
|
||||
uint8_t payloadType,
|
||||
uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
size_t payloadSize,
|
||||
const webrtc::RTPFragmentationHeader& fragmentationHeader,
|
||||
const webrtc::RTPVideoHeader* videoHdr) OVERRIDE;
|
||||
private:
|
||||
|
||||
@ -308,7 +308,7 @@ MediaOptTest::Perform()
|
||||
_vcm->RegisterReceiveCallback(&receiveCallback);
|
||||
|
||||
_frameCnt = 0;
|
||||
_sumEncBytes = 0.0;
|
||||
_sumEncBytes = 0;
|
||||
_numFramesDropped = 0;
|
||||
int half_width = (_width + 1) / 2;
|
||||
int half_height = (_height + 1) / 2;
|
||||
@ -338,7 +338,7 @@ MediaOptTest::Perform()
|
||||
printf ("Decode error in frame # %d",_frameCnt);
|
||||
}
|
||||
|
||||
float encBytes = encodeCompleteCallback->EncodedBytes();
|
||||
size_t encBytes = encodeCompleteCallback->EncodedBytes();
|
||||
if (encBytes == 0)
|
||||
{
|
||||
_numFramesDropped += 1;
|
||||
|
||||
@ -80,7 +80,7 @@ private:
|
||||
double _lossRate;
|
||||
uint32_t _renderDelayMs;
|
||||
int32_t _frameCnt;
|
||||
float _sumEncBytes;
|
||||
size_t _sumEncBytes;
|
||||
int32_t _numFramesDropped;
|
||||
std::string _codecName;
|
||||
webrtc::VideoCodecType _sendCodecType;
|
||||
|
||||
@ -30,7 +30,7 @@ TransportCallback::~TransportCallback()
|
||||
}
|
||||
|
||||
int
|
||||
TransportCallback::SendPacket(int channel, const void *data, int len)
|
||||
TransportCallback::SendPacket(int channel, const void *data, size_t len)
|
||||
{
|
||||
_sendCount++;
|
||||
_totalSentLength += len;
|
||||
|
||||
@ -52,7 +52,7 @@ class TransportCallback:public RTPSendCompleteCallback
|
||||
// Add packets to list
|
||||
// Incorporate network conditions - delay and packet loss
|
||||
// Actual transmission will occur on a separate thread
|
||||
virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
|
||||
virtual int SendPacket(int channel, const void *data, size_t len) OVERRIDE;
|
||||
// Send to the receiver packets which are ready to be submitted
|
||||
int TransportPackets();
|
||||
};
|
||||
|
||||
@ -71,12 +71,12 @@ void VCMNTEncodeCompleteCallback::RegisterTransportCallback(
|
||||
|
||||
int32_t
|
||||
VCMNTEncodeCompleteCallback::SendData(
|
||||
const FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
FrameType frameType,
|
||||
uint8_t payloadType,
|
||||
uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
size_t payloadSize,
|
||||
const RTPFragmentationHeader& /*fragmentationHeader*/,
|
||||
const webrtc::RTPVideoHeader* videoHdr)
|
||||
|
||||
@ -131,7 +131,7 @@ VCMNTEncodeCompleteCallback::RegisterReceiverVCM(VideoCodingModule *vcm)
|
||||
_VCMReceiver = vcm;
|
||||
return;
|
||||
}
|
||||
int32_t
|
||||
size_t
|
||||
VCMNTEncodeCompleteCallback::EncodedBytes()
|
||||
{
|
||||
return _encodedBytes;
|
||||
@ -144,13 +144,13 @@ VCMNTEncodeCompleteCallback::SkipCnt()
|
||||
}
|
||||
|
||||
// Decoded Frame Callback Implementation
|
||||
VCMNTDecodeCompleCallback::~VCMNTDecodeCompleCallback()
|
||||
VCMNTDecodeCompleteCallback::~VCMNTDecodeCompleteCallback()
|
||||
{
|
||||
if (_decodedFile)
|
||||
fclose(_decodedFile);
|
||||
}
|
||||
int32_t
|
||||
VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
|
||||
VCMNTDecodeCompleteCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
|
||||
{
|
||||
if (videoFrame.width() != _currentWidth ||
|
||||
videoFrame.height() != _currentHeight)
|
||||
@ -167,13 +167,13 @@ VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
|
||||
if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) {
|
||||
return -1;
|
||||
}
|
||||
_decodedBytes+= webrtc::CalcBufferSize(webrtc::kI420,
|
||||
videoFrame.width(), videoFrame.height());
|
||||
_decodedBytes += webrtc::CalcBufferSize(webrtc::kI420, videoFrame.width(),
|
||||
videoFrame.height());
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
int32_t
|
||||
VCMNTDecodeCompleCallback::DecodedBytes()
|
||||
size_t
|
||||
VCMNTDecodeCompleteCallback::DecodedBytes()
|
||||
{
|
||||
return _decodedBytes;
|
||||
}
|
||||
@ -260,7 +260,7 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
// register a decoder (same codec for decoder and encoder )
|
||||
TEST(_vcm->RegisterReceiveCodec(&_sendCodec, 1) == VCM_OK);
|
||||
/* Callback Settings */
|
||||
VCMNTDecodeCompleCallback _decodeCallback(_outname);
|
||||
VCMNTDecodeCompleteCallback _decodeCallback(_outname);
|
||||
_vcm->RegisterReceiveCallback(&_decodeCallback);
|
||||
VCMNTEncodeCompleteCallback _encodeCompleteCallback(_encodedFile, *this);
|
||||
_vcm->RegisterTransportCallback(&_encodeCompleteCallback);
|
||||
|
||||
@ -33,12 +33,12 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback
|
||||
// process encoded data received from the encoder,
|
||||
// pass stream to the VCMReceiver module
|
||||
virtual int32_t SendData(
|
||||
const webrtc::FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
webrtc::FrameType frameType,
|
||||
uint8_t payloadType,
|
||||
uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
size_t payloadSize,
|
||||
const webrtc::RTPFragmentationHeader& fragmentationHeader,
|
||||
const webrtc::RTPVideoHeader* videoHdr) OVERRIDE;
|
||||
|
||||
@ -46,15 +46,15 @@ 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)
|
||||
int32_t EncodedBytes();
|
||||
size_t EncodedBytes();
|
||||
// return number of encoder-skipped frames
|
||||
uint32_t SkipCnt();;
|
||||
uint32_t SkipCnt();
|
||||
// conversion function for payload type (needed for the callback function)
|
||||
// RTPVideoVideoCodecTypes ConvertPayloadType(uint8_t payloadType);
|
||||
|
||||
private:
|
||||
FILE* _encodedFile;
|
||||
uint32_t _encodedBytes;
|
||||
size_t _encodedBytes;
|
||||
uint32_t _skipCnt;
|
||||
webrtc::VideoCodingModule* _VCMReceiver;
|
||||
webrtc::FrameType _frameType;
|
||||
@ -62,29 +62,29 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback
|
||||
NormalTest& _test;
|
||||
}; // end of VCMEncodeCompleteCallback
|
||||
|
||||
class VCMNTDecodeCompleCallback: public webrtc::VCMReceiveCallback
|
||||
class VCMNTDecodeCompleteCallback: public webrtc::VCMReceiveCallback
|
||||
{
|
||||
public:
|
||||
VCMNTDecodeCompleCallback(std::string outname): // or should it get a name?
|
||||
_decodedFile(NULL),
|
||||
_outname(outname),
|
||||
_decodedBytes(0),
|
||||
_currentWidth(0),
|
||||
_currentHeight(0) {}
|
||||
virtual ~VCMNTDecodeCompleCallback();
|
||||
VCMNTDecodeCompleteCallback(std::string outname) // or should it get a name?
|
||||
: _decodedFile(NULL),
|
||||
_outname(outname),
|
||||
_decodedBytes(0),
|
||||
_currentWidth(0),
|
||||
_currentHeight(0) {}
|
||||
virtual ~VCMNTDecodeCompleteCallback();
|
||||
void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback);
|
||||
|
||||
// will write decoded frame into file
|
||||
virtual int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame) OVERRIDE;
|
||||
|
||||
int32_t DecodedBytes();
|
||||
size_t DecodedBytes();
|
||||
private:
|
||||
FILE* _decodedFile;
|
||||
std::string _outname;
|
||||
int _decodedBytes;
|
||||
size_t _decodedBytes;
|
||||
int _currentWidth;
|
||||
int _currentHeight;
|
||||
}; // end of VCMDecodeCompleCallback class
|
||||
}; // end of VCMNTDecodeCompleteCallback class
|
||||
|
||||
class NormalTest
|
||||
{
|
||||
@ -119,7 +119,7 @@ protected:
|
||||
std::string _inname;
|
||||
std::string _outname;
|
||||
std::string _encodedName;
|
||||
int32_t _sumEncBytes;
|
||||
size_t _sumEncBytes;
|
||||
FILE* _sourceFile;
|
||||
FILE* _decodedFile;
|
||||
FILE* _encodedFile;
|
||||
|
||||
@ -212,7 +212,7 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
// register a decoder (same codec for decoder and encoder )
|
||||
TEST(_vcm->RegisterReceiveCodec(&codec, 2) == VCM_OK);
|
||||
/* Callback Settings */
|
||||
VCMQMDecodeCompleCallback _decodeCallback(
|
||||
VCMQMDecodeCompleteCallback _decodeCallback(
|
||||
_decodedFile, _nativeFrameRate, feature_table_name_);
|
||||
_vcm->RegisterReceiveCallback(&_decodeCallback);
|
||||
VCMNTEncodeCompleteCallback _encodeCompleteCallback(_encodedFile, *this);
|
||||
@ -449,7 +449,7 @@ QMTestVideoSettingsCallback::SetVideoQMSettings(const uint32_t frameRate,
|
||||
}
|
||||
|
||||
// Decoded Frame Callback Implementation
|
||||
VCMQMDecodeCompleCallback::VCMQMDecodeCompleCallback(
|
||||
VCMQMDecodeCompleteCallback::VCMQMDecodeCompleteCallback(
|
||||
FILE* decodedFile, int frame_rate, std::string feature_table_name):
|
||||
_decodedFile(decodedFile),
|
||||
_decodedBytes(0),
|
||||
@ -468,7 +468,7 @@ feature_table_name_(feature_table_name)
|
||||
//
|
||||
}
|
||||
|
||||
VCMQMDecodeCompleCallback::~VCMQMDecodeCompleCallback()
|
||||
VCMQMDecodeCompleteCallback::~VCMQMDecodeCompleteCallback()
|
||||
{
|
||||
// if (_interpolator != NULL)
|
||||
// {
|
||||
@ -483,7 +483,7 @@ VCMQMDecodeCompleCallback::~VCMQMDecodeCompleCallback()
|
||||
}
|
||||
|
||||
int32_t
|
||||
VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
VCMQMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
{
|
||||
++frames_cnt_since_drop_;
|
||||
|
||||
@ -537,19 +537,19 @@ VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
int32_t VCMQMDecodeCompleCallback::DecodedBytes()
|
||||
size_t VCMQMDecodeCompleteCallback::DecodedBytes()
|
||||
{
|
||||
return _decodedBytes;
|
||||
}
|
||||
|
||||
void VCMQMDecodeCompleCallback::SetOriginalFrameDimensions(int32_t width,
|
||||
int32_t height)
|
||||
void VCMQMDecodeCompleteCallback::SetOriginalFrameDimensions(int32_t width,
|
||||
int32_t height)
|
||||
{
|
||||
_origWidth = width;
|
||||
_origHeight = height;
|
||||
}
|
||||
|
||||
int32_t VCMQMDecodeCompleCallback::buildInterpolator()
|
||||
int32_t VCMQMDecodeCompleteCallback::buildInterpolator()
|
||||
{
|
||||
uint32_t decFrameLength = _origWidth*_origHeight*3 >> 1;
|
||||
if (_decBuffer != NULL)
|
||||
@ -569,7 +569,7 @@ int32_t VCMQMDecodeCompleCallback::buildInterpolator()
|
||||
// frame (or several consecutive frames from the end) must have been dropped. If
|
||||
// this is the case, the last frame is repeated so that there are as many
|
||||
// frames rendered as there are number of frames encoded.
|
||||
void VCMQMDecodeCompleCallback::WriteEnd(int input_frame_count)
|
||||
void VCMQMDecodeCompleteCallback::WriteEnd(int input_frame_count)
|
||||
{
|
||||
int num_missing_frames = input_frame_count - _frameCnt;
|
||||
|
||||
|
||||
@ -51,18 +51,18 @@ private:
|
||||
|
||||
}; // end of QualityModesTest class
|
||||
|
||||
class VCMQMDecodeCompleCallback: public webrtc::VCMReceiveCallback
|
||||
class VCMQMDecodeCompleteCallback: public webrtc::VCMReceiveCallback
|
||||
{
|
||||
public:
|
||||
VCMQMDecodeCompleCallback(
|
||||
VCMQMDecodeCompleteCallback(
|
||||
FILE* decodedFile,
|
||||
int frame_rate,
|
||||
std::string feature_table_name);
|
||||
virtual ~VCMQMDecodeCompleCallback();
|
||||
virtual ~VCMQMDecodeCompleteCallback();
|
||||
void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback);
|
||||
// will write decoded frame into file
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
int32_t DecodedBytes();
|
||||
size_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.
|
||||
@ -70,7 +70,7 @@ public:
|
||||
|
||||
private:
|
||||
FILE* _decodedFile;
|
||||
uint32_t _decodedBytes;
|
||||
size_t _decodedBytes;
|
||||
// QualityModesTest& _test;
|
||||
int _origWidth;
|
||||
int _origHeight;
|
||||
@ -86,7 +86,7 @@ private:
|
||||
|
||||
|
||||
|
||||
}; // end of VCMQMDecodeCompleCallback class
|
||||
}; // end of VCMQMDecodeCompleteCallback class
|
||||
|
||||
class QMTestVideoSettingsCallback : public webrtc::VCMQMSettingsCallback
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@ class RtpDataCallback : public webrtc::NullRtpData {
|
||||
|
||||
virtual int32_t OnReceivedPayloadData(
|
||||
const uint8_t* payload_data,
|
||||
const uint16_t payload_size,
|
||||
const size_t payload_size,
|
||||
const webrtc::WebRtcRTPHeader* rtp_header) OVERRIDE {
|
||||
return vcm_->IncomingPacket(payload_data, payload_size, *rtp_header);
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ enum {
|
||||
|
||||
class RawRtpPacket {
|
||||
public:
|
||||
RawRtpPacket(const uint8_t* data, uint32_t length, uint32_t ssrc,
|
||||
RawRtpPacket(const uint8_t* data, size_t length, uint32_t ssrc,
|
||||
uint16_t seq_num)
|
||||
: data_(new uint8_t[length]),
|
||||
length_(length),
|
||||
@ -53,7 +53,7 @@ class RawRtpPacket {
|
||||
}
|
||||
|
||||
const uint8_t* data() const { return data_.get(); }
|
||||
uint32_t length() const { return length_; }
|
||||
size_t length() const { return length_; }
|
||||
int64_t resend_time_ms() const { return resend_time_ms_; }
|
||||
void set_resend_time_ms(int64_t timeMs) { resend_time_ms_ = timeMs; }
|
||||
uint32_t ssrc() const { return ssrc_; }
|
||||
@ -61,7 +61,7 @@ class RawRtpPacket {
|
||||
|
||||
private:
|
||||
scoped_ptr<uint8_t[]> data_;
|
||||
uint32_t length_;
|
||||
size_t length_;
|
||||
int64_t resend_time_ms_;
|
||||
uint32_t ssrc_;
|
||||
uint16_t seq_num_;
|
||||
@ -251,7 +251,7 @@ class SsrcHandlers {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IncomingPacket(const uint8_t* data, uint32_t length) {
|
||||
void IncomingPacket(const uint8_t* data, size_t length) {
|
||||
for (HandlerMapIt it = handlers_.begin(); it != handlers_.end(); ++it) {
|
||||
if (!it->second->rtp_header_parser_->IsRtcp(data, length)) {
|
||||
RTPHeader header;
|
||||
@ -375,14 +375,10 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
|
||||
if (reordering_ && reorder_buffer_.get() == NULL) {
|
||||
reorder_buffer_.reset(
|
||||
new RawRtpPacket(next_packet_.data,
|
||||
static_cast<uint32_t>(next_packet_.length),
|
||||
0,
|
||||
0));
|
||||
new RawRtpPacket(next_packet_.data, next_packet_.length, 0, 0));
|
||||
return 0;
|
||||
}
|
||||
int ret = SendPacket(next_packet_.data,
|
||||
static_cast<uint32_t>(next_packet_.length));
|
||||
int ret = SendPacket(next_packet_.data, next_packet_.length);
|
||||
if (reorder_buffer_.get()) {
|
||||
SendPacket(reorder_buffer_->data(), reorder_buffer_->length());
|
||||
reorder_buffer_.reset(NULL);
|
||||
@ -421,7 +417,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
}
|
||||
|
||||
private:
|
||||
int SendPacket(const uint8_t* data, uint32_t length) {
|
||||
int SendPacket(const uint8_t* data, size_t length) {
|
||||
assert(data);
|
||||
assert(length > 0);
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ VCMEncodeCompleteCallback::SendData(
|
||||
const uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
const size_t payloadSize,
|
||||
const RTPFragmentationHeader& fragmentationHeader,
|
||||
const RTPVideoHeader* videoHdr)
|
||||
{
|
||||
@ -106,7 +106,7 @@ VCMEncodeCompleteCallback::SendData(
|
||||
return ret;
|
||||
}
|
||||
|
||||
float
|
||||
size_t
|
||||
VCMEncodeCompleteCallback::EncodedBytes()
|
||||
{
|
||||
return _encodedBytes;
|
||||
@ -147,12 +147,12 @@ VCMEncodeCompleteCallback::ResetByteCount()
|
||||
|
||||
int32_t
|
||||
VCMRTPEncodeCompleteCallback::SendData(
|
||||
const FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
FrameType frameType,
|
||||
uint8_t payloadType,
|
||||
uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
size_t payloadSize,
|
||||
const RTPFragmentationHeader& fragmentationHeader,
|
||||
const RTPVideoHeader* videoHdr)
|
||||
{
|
||||
@ -169,11 +169,11 @@ VCMRTPEncodeCompleteCallback::SendData(
|
||||
videoHdr);
|
||||
}
|
||||
|
||||
float
|
||||
size_t
|
||||
VCMRTPEncodeCompleteCallback::EncodedBytes()
|
||||
{
|
||||
// only good for one call - after which will reset value;
|
||||
float tmp = _encodedBytes;
|
||||
size_t tmp = _encodedBytes;
|
||||
_encodedBytes = 0;
|
||||
return tmp;
|
||||
}
|
||||
@ -197,12 +197,12 @@ VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) {
|
||||
return -1;
|
||||
}
|
||||
_decodedBytes+= CalcBufferSize(kI420, videoFrame.width(),
|
||||
videoFrame.height());
|
||||
_decodedBytes += CalcBufferSize(kI420, videoFrame.width(),
|
||||
videoFrame.height());
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
int32_t
|
||||
size_t
|
||||
VCMDecodeCompleteCallback::DecodedBytes()
|
||||
{
|
||||
return _decodedBytes;
|
||||
@ -248,7 +248,7 @@ RTPSendCompleteCallback::~RTPSendCompleteCallback()
|
||||
}
|
||||
|
||||
int
|
||||
RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||
RTPSendCompleteCallback::SendPacket(int channel, const void *data, size_t len)
|
||||
{
|
||||
_sendCount++;
|
||||
_totalSentLength += len;
|
||||
@ -319,11 +319,13 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||
delete packet;
|
||||
packet = NULL;
|
||||
}
|
||||
return len; // OK
|
||||
return static_cast<int>(len); // OK
|
||||
}
|
||||
|
||||
int
|
||||
RTPSendCompleteCallback::SendRTCPPacket(int channel, const void *data, int len)
|
||||
RTPSendCompleteCallback::SendRTCPPacket(int channel,
|
||||
const void *data,
|
||||
size_t len)
|
||||
{
|
||||
// Incorporate network conditions
|
||||
return SendPacket(channel, data, len);
|
||||
|
||||
@ -44,12 +44,12 @@ public:
|
||||
void RegisterTransportCallback(VCMPacketizationCallback* transport);
|
||||
// Process encoded data received from the encoder, pass stream to the
|
||||
// VCMReceiver module
|
||||
virtual int32_t SendData(const FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
virtual int32_t SendData(FrameType frameType,
|
||||
uint8_t payloadType,
|
||||
uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
size_t payloadSize,
|
||||
const RTPFragmentationHeader& fragmentationHeader,
|
||||
const RTPVideoHeader* videoHdr) OVERRIDE;
|
||||
// Register exisitng VCM. Currently - encode and decode under same module.
|
||||
@ -57,7 +57,7 @@ public:
|
||||
// Return size of last encoded frame data (all frames in the sequence)
|
||||
// Good for only one call - after which will reset value
|
||||
// (to allow detection of frame drop)
|
||||
float EncodedBytes();
|
||||
size_t EncodedBytes();
|
||||
// Return encode complete (true/false)
|
||||
bool EncodeComplete();
|
||||
// Inform callback of codec used
|
||||
@ -77,7 +77,7 @@ public:
|
||||
|
||||
private:
|
||||
FILE* _encodedFile;
|
||||
float _encodedBytes;
|
||||
size_t _encodedBytes;
|
||||
VideoCodingModule* _VCMReceiver;
|
||||
FrameType _frameType;
|
||||
uint16_t _seqNo;
|
||||
@ -101,17 +101,17 @@ public:
|
||||
virtual ~VCMRTPEncodeCompleteCallback() {}
|
||||
// Process encoded data received from the encoder, pass stream to the
|
||||
// RTP module
|
||||
virtual int32_t SendData(const FrameType frameType,
|
||||
const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
virtual int32_t SendData(FrameType frameType,
|
||||
uint8_t payloadType,
|
||||
uint32_t timeStamp,
|
||||
int64_t capture_time_ms,
|
||||
const uint8_t* payloadData,
|
||||
const uint32_t payloadSize,
|
||||
size_t payloadSize,
|
||||
const RTPFragmentationHeader& fragmentationHeader,
|
||||
const RTPVideoHeader* videoHdr) OVERRIDE;
|
||||
// Return size of last encoded frame. Value good for one call
|
||||
// (resets to zero after call to inform test of frame drop)
|
||||
float EncodedBytes();
|
||||
size_t EncodedBytes();
|
||||
// Return encode complete (true/false)
|
||||
bool EncodeComplete();
|
||||
// Inform callback of codec used
|
||||
@ -126,7 +126,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
float _encodedBytes;
|
||||
size_t _encodedBytes;
|
||||
FrameType _frameType;
|
||||
bool _encodeComplete;
|
||||
RtpRtcp* _RTPModule;
|
||||
@ -145,10 +145,10 @@ public:
|
||||
virtual ~VCMDecodeCompleteCallback() {}
|
||||
// Write decoded frame into file
|
||||
virtual int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame) OVERRIDE;
|
||||
int32_t DecodedBytes();
|
||||
size_t DecodedBytes();
|
||||
private:
|
||||
FILE* _decodedFile;
|
||||
uint32_t _decodedBytes;
|
||||
FILE* _decodedFile;
|
||||
size_t _decodedBytes;
|
||||
}; // end of VCMDecodeCompleCallback class
|
||||
|
||||
// Transport callback
|
||||
@ -165,9 +165,11 @@ public:
|
||||
|
||||
void SetRtpModule(RtpRtcp* rtp_module) { _rtp = rtp_module; }
|
||||
// Send Packet to receive side RTP module
|
||||
virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
|
||||
virtual int SendPacket(int channel, const void *data, size_t len) OVERRIDE;
|
||||
// Send RTCP Packet to receive side RTP module
|
||||
virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE;
|
||||
virtual int SendRTCPPacket(int channel,
|
||||
const void *data,
|
||||
size_t len) OVERRIDE;
|
||||
// Set percentage of channel loss in the network
|
||||
void SetLossPct(double lossPct);
|
||||
// Set average size of burst loss
|
||||
@ -181,7 +183,7 @@ public:
|
||||
// Return send count
|
||||
int SendCount() {return _sendCount; }
|
||||
// Return accumulated length in bytes of transmitted packets
|
||||
uint32_t TotalSentLength() {return _totalSentLength;}
|
||||
size_t TotalSentLength() {return _totalSentLength;}
|
||||
protected:
|
||||
// Randomly decide whether to drop packets, based on the channel model
|
||||
bool PacketLoss();
|
||||
@ -198,7 +200,7 @@ protected:
|
||||
uint32_t _networkDelayMs;
|
||||
double _jitterVar;
|
||||
bool _prevLossState;
|
||||
uint32_t _totalSentLength;
|
||||
size_t _totalSentLength;
|
||||
std::list<RtpPacket*> _rtpPackets;
|
||||
RtpDump* _rtpDump;
|
||||
};
|
||||
|
||||
@ -51,7 +51,7 @@ double NormalDist(double mean, double stdDev);
|
||||
|
||||
struct RtpPacket {
|
||||
uint8_t data[1650]; // max packet size
|
||||
int32_t length;
|
||||
size_t length;
|
||||
int64_t receiveTime;
|
||||
};
|
||||
|
||||
|
||||
@ -53,13 +53,13 @@ class VcmPayloadSinkFactory::VcmPayloadSink
|
||||
// PayloadSinkInterface
|
||||
virtual int32_t OnReceivedPayloadData(
|
||||
const uint8_t* payload_data,
|
||||
const uint16_t payload_size,
|
||||
const size_t payload_size,
|
||||
const WebRtcRTPHeader* rtp_header) OVERRIDE {
|
||||
return vcm_->IncomingPacket(payload_data, payload_size, *rtp_header);
|
||||
}
|
||||
|
||||
virtual bool OnRecoveredPacket(const uint8_t* packet,
|
||||
int packet_length) OVERRIDE {
|
||||
size_t packet_length) OVERRIDE {
|
||||
// We currently don't handle FEC.
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ _frameRate(frameRate)
|
||||
assert(frameRate > 0);
|
||||
}
|
||||
|
||||
int32_t
|
||||
size_t
|
||||
VideoSource::GetFrameLength() const
|
||||
{
|
||||
return webrtc::CalcBufferSize(_type, _width, _height);
|
||||
|
||||
@ -69,7 +69,7 @@ public:
|
||||
// Returns the filename with the path (including the leading slash) removed.
|
||||
std::string GetName() const;
|
||||
|
||||
int32_t GetFrameLength() const;
|
||||
size_t GetFrameLength() const;
|
||||
|
||||
private:
|
||||
std::string _fileName;
|
||||
|
||||
Reference in New Issue
Block a user