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:
pbos@webrtc.org
2013-04-02 15:54:38 +00:00
parent cfc07c943f
commit 7b859cc1e9
67 changed files with 1130 additions and 1130 deletions

View File

@ -25,9 +25,9 @@ _history()
Reset();
}
WebRtc_Word32 VCMCodecTimer::StopTimer(WebRtc_Word64 startTimeMs, WebRtc_Word64 nowMs)
int32_t VCMCodecTimer::StopTimer(int64_t startTimeMs, int64_t nowMs)
{
const WebRtc_Word32 timeDiff = static_cast<WebRtc_Word32>(nowMs - startTimeMs);
const int32_t timeDiff = static_cast<int32_t>(nowMs - startTimeMs);
MaxFilter(timeDiff, nowMs);
return timeDiff;
}
@ -45,7 +45,7 @@ void VCMCodecTimer::Reset()
}
// Update the max-value filter
void VCMCodecTimer::MaxFilter(WebRtc_Word32 decodeTime, WebRtc_Word64 nowMs)
void VCMCodecTimer::MaxFilter(int32_t decodeTime, int64_t nowMs)
{
if (!_firstDecodeTime)
{
@ -59,7 +59,7 @@ void VCMCodecTimer::MaxFilter(WebRtc_Word32 decodeTime, WebRtc_Word64 nowMs)
}
void
VCMCodecTimer::UpdateMaxHistory(WebRtc_Word32 decodeTime, WebRtc_Word64 now)
VCMCodecTimer::UpdateMaxHistory(int32_t decodeTime, int64_t now)
{
if (_history[0].timeMs >= 0 &&
now - _history[0].timeMs < SHORT_FILTER_MS)
@ -98,7 +98,7 @@ VCMCodecTimer::UpdateMaxHistory(WebRtc_Word32 decodeTime, WebRtc_Word64 now)
}
void
VCMCodecTimer::ProcessHistory(WebRtc_Word64 nowMs)
VCMCodecTimer::ProcessHistory(int64_t nowMs)
{
_filteredMax = _shortMax;
if (_history[0].timeMs == -1)
@ -125,7 +125,7 @@ VCMCodecTimer::ProcessHistory(WebRtc_Word64 nowMs)
}
// Get the maximum observed time within a time window
WebRtc_Word32 VCMCodecTimer::RequiredDecodeTimeMs(FrameType /*frameType*/) const
int32_t VCMCodecTimer::RequiredDecodeTimeMs(FrameType /*frameType*/) const
{
return _filteredMax;
}

View File

@ -26,8 +26,8 @@ class VCMShortMaxSample
public:
VCMShortMaxSample() : shortMax(0), timeMs(-1) {};
WebRtc_Word32 shortMax;
WebRtc_Word64 timeMs;
int32_t shortMax;
int64_t timeMs;
};
class VCMCodecTimer
@ -36,22 +36,22 @@ public:
VCMCodecTimer();
// Updates and returns the max filtered decode time.
WebRtc_Word32 StopTimer(WebRtc_Word64 startTimeMs, WebRtc_Word64 nowMs);
int32_t StopTimer(int64_t startTimeMs, int64_t nowMs);
// Empty the list of timers.
void Reset();
// Get the required decode time in ms.
WebRtc_Word32 RequiredDecodeTimeMs(FrameType frameType) const;
int32_t RequiredDecodeTimeMs(FrameType frameType) const;
private:
void UpdateMaxHistory(WebRtc_Word32 decodeTime, WebRtc_Word64 now);
void MaxFilter(WebRtc_Word32 newTime, WebRtc_Word64 nowMs);
void ProcessHistory(WebRtc_Word64 nowMs);
void UpdateMaxHistory(int32_t decodeTime, int64_t now);
void MaxFilter(int32_t newTime, int64_t nowMs);
void ProcessHistory(int64_t nowMs);
WebRtc_Word32 _filteredMax;
int32_t _filteredMax;
bool _firstDecodeTime;
WebRtc_Word32 _shortMax;
int32_t _shortMax;
VCMShortMaxSample _history[MAX_HISTORY_SIZE];
};

View File

@ -149,7 +149,7 @@ const RTPFragmentationHeader* VCMEncodedFrame::FragmentationHeader() const {
return &_fragmentation;
}
WebRtc_Word32
int32_t
VCMEncodedFrame::Store(VCMFrameStorageCallback& storeCallback) const
{
EncodedVideoData frameToStore;
@ -172,13 +172,13 @@ VCMEncodedFrame::Store(VCMFrameStorageCallback& storeCallback) const
return VCM_OK;
}
WebRtc_Word32
VCMEncodedFrame::VerifyAndAllocate(const WebRtc_UWord32 minimumSize)
int32_t
VCMEncodedFrame::VerifyAndAllocate(const uint32_t minimumSize)
{
if(minimumSize > _size)
{
// create buffer of sufficient size
WebRtc_UWord8* newBuffer = new WebRtc_UWord8[minimumSize];
uint8_t* newBuffer = new uint8_t[minimumSize];
if (newBuffer == NULL)
{
return -1;

View File

@ -37,12 +37,12 @@ public:
/**
* Set render time in milliseconds
*/
void SetRenderTime(const WebRtc_Word64 renderTimeMs) {_renderTimeMs = renderTimeMs;}
void SetRenderTime(const int64_t renderTimeMs) {_renderTimeMs = renderTimeMs;}
/**
* Set the encoded frame size
*/
void SetEncodedSize(WebRtc_UWord32 width, WebRtc_UWord32 height)
void SetEncodedSize(uint32_t width, uint32_t height)
{ _encodedWidth = width; _encodedHeight = height; }
/**
* Get the encoded image
@ -52,19 +52,19 @@ public:
/**
* Get pointer to frame buffer
*/
const WebRtc_UWord8* Buffer() const {return _buffer;}
const uint8_t* Buffer() const {return _buffer;}
/**
* Get frame length
*/
WebRtc_UWord32 Length() const {return _length;}
uint32_t Length() const {return _length;}
/**
* Get frame timestamp (90kHz)
*/
WebRtc_UWord32 TimeStamp() const {return _timeStamp;}
uint32_t TimeStamp() const {return _timeStamp;}
/**
* Get render time in milliseconds
*/
WebRtc_Word64 RenderTimeMs() const {return _renderTimeMs;}
int64_t RenderTimeMs() const {return _renderTimeMs;}
/**
* Get frame type
*/
@ -80,7 +80,7 @@ public:
/**
* Payload type of the encoded payload
*/
WebRtc_UWord8 PayloadType() const { return _payloadType; }
uint8_t PayloadType() const { return _payloadType; }
/**
* Get codec specific info.
* The returned pointer is only valid as long as the VCMEncodedFrame
@ -91,7 +91,7 @@ public:
const RTPFragmentationHeader* FragmentationHeader() const;
WebRtc_Word32 Store(VCMFrameStorageCallback& storeCallback) const;
int32_t Store(VCMFrameStorageCallback& storeCallback) const;
static webrtc::FrameType ConvertFrameType(VideoFrameType frameType);
static VideoFrameType ConvertFrameType(webrtc::FrameType frameType);
@ -106,14 +106,14 @@ protected:
* is copied to the new buffer.
* Buffer size is updated to minimumSize.
*/
WebRtc_Word32 VerifyAndAllocate(const WebRtc_UWord32 minimumSize);
int32_t VerifyAndAllocate(const uint32_t minimumSize);
void Reset();
void CopyCodecSpecific(const RTPVideoHeader* header);
WebRtc_Word64 _renderTimeMs;
WebRtc_UWord8 _payloadType;
int64_t _renderTimeMs;
uint8_t _payloadType;
bool _missingFrame;
CodecSpecificInfo _codecSpecificInfo;
webrtc::VideoCodecType _codec;

View File

@ -52,13 +52,13 @@ VCMFrameBuffer::SetPreviousFrameLoss()
_sessionInfo.SetPreviousFrameLoss();
}
WebRtc_Word32
int32_t
VCMFrameBuffer::GetLowSeqNum() const
{
return _sessionInfo.LowSequenceNumber();
}
WebRtc_Word32
int32_t
VCMFrameBuffer::GetHighSeqNum() const
{
return _sessionInfo.HighSequenceNumber();
@ -92,8 +92,8 @@ VCMFrameBuffer::IsSessionComplete() const
// Insert packet
VCMFrameBufferEnum
VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs,
bool enableDecodableState, WebRtc_UWord32 rttMS)
VCMFrameBuffer::InsertPacket(const VCMPacket& packet, int64_t timeInMs,
bool enableDecodableState, uint32_t rttMS)
{
if (_state == kStateDecoding)
{
@ -142,16 +142,16 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs,
}
}
WebRtc_UWord32 requiredSizeBytes = Length() + packet.sizeBytes +
uint32_t requiredSizeBytes = Length() + packet.sizeBytes +
(packet.insertStartCode ? kH264StartCodeLengthBytes : 0);
if (requiredSizeBytes >= _size)
{
const WebRtc_UWord8* prevBuffer = _buffer;
const WebRtc_UWord32 increments = requiredSizeBytes /
const uint8_t* prevBuffer = _buffer;
const uint32_t increments = requiredSizeBytes /
kBufferIncStepSizeBytes +
(requiredSizeBytes %
kBufferIncStepSizeBytes > 0);
const WebRtc_UWord32 newSize = _size +
const uint32_t newSize = _size +
increments * kBufferIncStepSizeBytes;
if (newSize > kMaxJBFrameSizeBytes)
{
@ -178,7 +178,7 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs,
return kDuplicatePacket;
}
// update length
_length = Length() + static_cast<WebRtc_UWord32>(retVal);
_length = Length() + static_cast<uint32_t>(retVal);
_latestPacketTimeMs = timeInMs;
@ -198,7 +198,7 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs,
return kIncomplete;
}
WebRtc_Word64
int64_t
VCMFrameBuffer::LatestPacketTimeMs() const
{
return _latestPacketTimeMs;
@ -210,7 +210,7 @@ VCMFrameBuffer::IncrementNackCount()
_nackCount++;
}
WebRtc_Word16
int16_t
VCMFrameBuffer::GetNackCount() const
{
return _nackCount;
@ -240,7 +240,7 @@ VCMFrameBuffer::Reset()
void
VCMFrameBuffer::MakeSessionDecodable()
{
WebRtc_UWord32 retVal;
uint32_t retVal;
#ifdef INDEPENDENT_PARTITIONS
if (_codec != kVideoCodecVP8) {
retVal = _sessionInfo.MakeDecodable();
@ -320,7 +320,7 @@ VCMFrameBuffer::RestructureFrameInformation()
_missingFrame = _sessionInfo.PreviousFrameLoss();
}
WebRtc_Word32
int32_t
VCMFrameBuffer::ExtractFromStorage(const EncodedVideoData& frameFromStorage)
{
_frameType = ConvertFrameType(frameFromStorage.frameType);
@ -332,7 +332,7 @@ VCMFrameBuffer::ExtractFromStorage(const EncodedVideoData& frameFromStorage)
_completeFrame = frameFromStorage.completeFrame;
_renderTimeMs = frameFromStorage.renderTimeMs;
_codec = frameFromStorage.codec;
const WebRtc_UWord8 *prevBuffer = _buffer;
const uint8_t *prevBuffer = _buffer;
if (VerifyAndAllocate(frameFromStorage.payloadSize) < 0)
{
return VCM_MEMORY;
@ -367,7 +367,7 @@ VCMFrameBuffer::GetState() const
// Get current state of frame
VCMFrameBufferStateEnum
VCMFrameBuffer::GetState(WebRtc_UWord32& timeStamp) const
VCMFrameBuffer::GetState(uint32_t& timeStamp) const
{
timeStamp = TimeStamp();
return GetState();

View File

@ -31,15 +31,15 @@ public:
virtual void Reset();
VCMFrameBufferEnum InsertPacket(const VCMPacket& packet,
WebRtc_Word64 timeInMs,
int64_t timeInMs,
bool enableDecodableState,
WebRtc_UWord32 rttMs);
uint32_t rttMs);
// State
// Get current state of frame
VCMFrameBufferStateEnum GetState() const;
// Get current state and timestamp of frame
VCMFrameBufferStateEnum GetState(WebRtc_UWord32& timeStamp) const;
VCMFrameBufferStateEnum GetState(uint32_t& timeStamp) const;
void SetState(VCMFrameBufferStateEnum state); // Set state of frame
bool IsRetransmitted() const;
@ -50,9 +50,9 @@ public:
// Sequence numbers
// Get lowest packet sequence number in frame
WebRtc_Word32 GetLowSeqNum() const;
int32_t GetLowSeqNum() const;
// Get highest packet sequence number in frame
WebRtc_Word32 GetHighSeqNum() const;
int32_t GetHighSeqNum() const;
int PictureId() const;
int TemporalId() const;
@ -69,14 +69,14 @@ public:
void IncrementNackCount();
// Returns the number of packets of this frame which were NACKed before they
// arrived.
WebRtc_Word16 GetNackCount() const;
int16_t GetNackCount() const;
WebRtc_Word64 LatestPacketTimeMs() const;
int64_t LatestPacketTimeMs() const;
webrtc::FrameType FrameType() const;
void SetPreviousFrameLoss();
WebRtc_Word32 ExtractFromStorage(const EncodedVideoData& frameFromStorage);
int32_t ExtractFromStorage(const EncodedVideoData& frameFromStorage);
// The number of packets discarded because the decoder can't make use of
// them.
@ -90,8 +90,8 @@ private:
VCMFrameBufferStateEnum _state; // Current state of the frame
bool _frameCounted; // Was this frame counted by JB?
VCMSessionInfo _sessionInfo;
WebRtc_UWord16 _nackCount;
WebRtc_Word64 _latestPacketTimeMs;
uint16_t _nackCount;
int64_t _latestPacketTimeMs;
};
} // namespace webrtc

View File

@ -40,7 +40,7 @@ void VCMDecodedFrameCallback::SetUserReceiveCallback(
_receiveCallback = receiveCallback;
}
WebRtc_Word32 VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
int32_t VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
{
// TODO(holmer): We should improve this so that we can handle multiple
// callbacks from one call to Decode().
@ -62,7 +62,7 @@ WebRtc_Word32 VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
{
_frame.SwapFrame(&decodedImage);
_frame.set_render_time_ms(frameInfo->renderTimeMs);
WebRtc_Word32 callbackReturn = _receiveCallback->FrameToRender(_frame);
int32_t callbackReturn = _receiveCallback->FrameToRender(_frame);
if (callbackReturn < 0)
{
WEBRTC_TRACE(webrtc::kTraceDebug,
@ -74,9 +74,9 @@ WebRtc_Word32 VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32
int32_t
VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame(
const WebRtc_UWord64 pictureId)
const uint64_t pictureId)
{
CriticalSectionScoped cs(_critSect);
if (_receiveCallback != NULL)
@ -86,25 +86,25 @@ VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame(
return -1;
}
WebRtc_Word32
VCMDecodedFrameCallback::ReceivedDecodedFrame(const WebRtc_UWord64 pictureId)
int32_t
VCMDecodedFrameCallback::ReceivedDecodedFrame(const uint64_t pictureId)
{
_lastReceivedPictureID = pictureId;
return 0;
}
WebRtc_UWord64 VCMDecodedFrameCallback::LastReceivedPictureID() const
uint64_t VCMDecodedFrameCallback::LastReceivedPictureID() const
{
return _lastReceivedPictureID;
}
WebRtc_Word32 VCMDecodedFrameCallback::Map(WebRtc_UWord32 timestamp, VCMFrameInformation* frameInfo)
int32_t VCMDecodedFrameCallback::Map(uint32_t timestamp, VCMFrameInformation* frameInfo)
{
CriticalSectionScoped cs(_critSect);
return _timestampMap.Add(timestamp, frameInfo);
}
WebRtc_Word32 VCMDecodedFrameCallback::Pop(WebRtc_UWord32 timestamp)
int32_t VCMDecodedFrameCallback::Pop(uint32_t timestamp)
{
CriticalSectionScoped cs(_critSect);
if (_timestampMap.Pop(timestamp) == NULL)
@ -114,7 +114,7 @@ WebRtc_Word32 VCMDecodedFrameCallback::Pop(WebRtc_UWord32 timestamp)
return VCM_OK;
}
VCMGenericDecoder::VCMGenericDecoder(VideoDecoder& decoder, WebRtc_Word32 id, bool isExternal)
VCMGenericDecoder::VCMGenericDecoder(VideoDecoder& decoder, int32_t id, bool isExternal)
:
_id(id),
_callback(NULL),
@ -132,8 +132,8 @@ VCMGenericDecoder::~VCMGenericDecoder()
{
}
WebRtc_Word32 VCMGenericDecoder::InitDecode(const VideoCodec* settings,
WebRtc_Word32 numberOfCores,
int32_t VCMGenericDecoder::InitDecode(const VideoCodec* settings,
int32_t numberOfCores,
bool requireKeyFrame)
{
_requireKeyFrame = requireKeyFrame;
@ -143,7 +143,7 @@ WebRtc_Word32 VCMGenericDecoder::InitDecode(const VideoCodec* settings,
return _decoder.InitDecode(settings, numberOfCores);
}
WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame,
int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame,
int64_t nowMs)
{
if (_requireKeyFrame &&
@ -166,7 +166,7 @@ WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame,
_nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
WebRtc_Word32 ret = _decoder.Decode(frame.EncodedImage(),
int32_t ret = _decoder.Decode(frame.EncodedImage(),
frame.MissingFrame(),
frame.FragmentationHeader(),
frame.CodecSpecific(),
@ -190,25 +190,25 @@ WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame,
return ret;
}
WebRtc_Word32
int32_t
VCMGenericDecoder::Release()
{
_keyFrameDecoded = false;
return _decoder.Release();
}
WebRtc_Word32 VCMGenericDecoder::Reset()
int32_t VCMGenericDecoder::Reset()
{
_keyFrameDecoded = false;
return _decoder.Reset();
}
WebRtc_Word32 VCMGenericDecoder::SetCodecConfigParameters(const WebRtc_UWord8* buffer, WebRtc_Word32 size)
int32_t VCMGenericDecoder::SetCodecConfigParameters(const uint8_t* buffer, int32_t size)
{
return _decoder.SetCodecConfigParameters(buffer, size);
}
WebRtc_Word32 VCMGenericDecoder::RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback)
int32_t VCMGenericDecoder::RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback)
{
_callback = callback;
return _decoder.RegisterDecodeCompleteCallback(callback);

View File

@ -26,8 +26,8 @@ enum { kDecoderFrameMemoryLength = 10 };
struct VCMFrameInformation
{
WebRtc_Word64 renderTimeMs;
WebRtc_Word64 decodeStartTimeMs;
int64_t renderTimeMs;
int64_t decodeStartTimeMs;
void* userData;
};
@ -38,14 +38,14 @@ public:
virtual ~VCMDecodedFrameCallback();
void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
virtual WebRtc_Word32 Decoded(I420VideoFrame& decodedImage);
virtual WebRtc_Word32 ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId);
virtual WebRtc_Word32 ReceivedDecodedFrame(const WebRtc_UWord64 pictureId);
virtual int32_t Decoded(I420VideoFrame& decodedImage);
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId);
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId);
WebRtc_UWord64 LastReceivedPictureID() const;
uint64_t LastReceivedPictureID() const;
WebRtc_Word32 Map(WebRtc_UWord32 timestamp, VCMFrameInformation* frameInfo);
WebRtc_Word32 Pop(WebRtc_UWord32 timestamp);
int32_t Map(uint32_t timestamp, VCMFrameInformation* frameInfo);
int32_t Pop(uint32_t timestamp);
private:
CriticalSectionWrapper* _critSect;
@ -54,7 +54,7 @@ private:
VCMReceiveCallback* _receiveCallback;
VCMTiming& _timing;
VCMTimestampMap _timestampMap;
WebRtc_UWord64 _lastReceivedPictureID;
uint64_t _lastReceivedPictureID;
};
@ -62,14 +62,14 @@ class VCMGenericDecoder
{
friend class VCMCodecDataBase;
public:
VCMGenericDecoder(VideoDecoder& decoder, WebRtc_Word32 id = 0, bool isExternal = false);
VCMGenericDecoder(VideoDecoder& decoder, int32_t id = 0, bool isExternal = false);
~VCMGenericDecoder();
/**
* Initialize the decoder with the information from the VideoCodec
*/
WebRtc_Word32 InitDecode(const VideoCodec* settings,
WebRtc_Word32 numberOfCores,
int32_t InitDecode(const VideoCodec* settings,
int32_t numberOfCores,
bool requireKeyFrame);
/**
@ -77,17 +77,17 @@ public:
*
* inputVideoBuffer reference to encoded video frame
*/
WebRtc_Word32 Decode(const VCMEncodedFrame& inputFrame, int64_t nowMs);
int32_t Decode(const VCMEncodedFrame& inputFrame, int64_t nowMs);
/**
* Free the decoder memory
*/
WebRtc_Word32 Release();
int32_t Release();
/**
* Reset the decoder state, prepare for a new call
*/
WebRtc_Word32 Reset();
int32_t Reset();
/**
* Codec configuration data sent out-of-band, i.e. in SIP call setup
@ -95,19 +95,19 @@ public:
* buffer pointer to the configuration data
* size the size of the configuration data in bytes
*/
WebRtc_Word32 SetCodecConfigParameters(const WebRtc_UWord8* /*buffer*/,
WebRtc_Word32 /*size*/);
int32_t SetCodecConfigParameters(const uint8_t* /*buffer*/,
int32_t /*size*/);
WebRtc_Word32 RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback);
int32_t RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback);
bool External() const;
protected:
WebRtc_Word32 _id;
int32_t _id;
VCMDecodedFrameCallback* _callback;
VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength];
WebRtc_UWord32 _nextFrameInfoIdx;
uint32_t _nextFrameInfoIdx;
VideoDecoder& _decoder;
VideoCodecType _codecType;
bool _isExternal;

View File

@ -33,7 +33,7 @@ VCMGenericEncoder::~VCMGenericEncoder()
{
}
WebRtc_Word32 VCMGenericEncoder::Release()
int32_t VCMGenericEncoder::Release()
{
_bitRate = 0;
_frameRate = 0;
@ -41,10 +41,10 @@ WebRtc_Word32 VCMGenericEncoder::Release()
return _encoder.Release();
}
WebRtc_Word32
int32_t
VCMGenericEncoder::InitEncode(const VideoCodec* settings,
WebRtc_Word32 numberOfCores,
WebRtc_UWord32 maxPayloadSize)
int32_t numberOfCores,
uint32_t maxPayloadSize)
{
_bitRate = settings->startBitrate;
_frameRate = settings->maxFramerate;
@ -56,7 +56,7 @@ VCMGenericEncoder::InitEncode(const VideoCodec* settings,
return _encoder.InitEncode(settings, numberOfCores, maxPayloadSize);
}
WebRtc_Word32
int32_t
VCMGenericEncoder::Encode(const I420VideoFrame& inputFrame,
const CodecSpecificInfo* codecSpecificInfo,
const std::vector<FrameType>& frameTypes) {
@ -66,17 +66,17 @@ VCMGenericEncoder::Encode(const I420VideoFrame& inputFrame,
return _encoder.Encode(inputFrame, codecSpecificInfo, &video_frame_types);
}
WebRtc_Word32
VCMGenericEncoder::SetChannelParameters(WebRtc_Word32 packetLoss, int rtt)
int32_t
VCMGenericEncoder::SetChannelParameters(int32_t packetLoss, int rtt)
{
return _encoder.SetChannelParameters(packetLoss, rtt);
}
WebRtc_Word32
VCMGenericEncoder::SetRates(WebRtc_UWord32 newBitRate, WebRtc_UWord32 frameRate)
int32_t
VCMGenericEncoder::SetRates(uint32_t newBitRate, uint32_t frameRate)
{
uint32_t target_bitrate_kbps = (newBitRate + 500) / 1000;
WebRtc_Word32 ret = _encoder.SetRates(target_bitrate_kbps, frameRate);
int32_t ret = _encoder.SetRates(target_bitrate_kbps, frameRate);
if (ret < 0)
{
return ret;
@ -86,10 +86,10 @@ VCMGenericEncoder::SetRates(WebRtc_UWord32 newBitRate, WebRtc_UWord32 frameRate)
return VCM_OK;
}
WebRtc_Word32
VCMGenericEncoder::CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 size)
int32_t
VCMGenericEncoder::CodecConfigParameters(uint8_t* buffer, int32_t size)
{
WebRtc_Word32 ret = _encoder.CodecConfigParameters(buffer, size);
int32_t ret = _encoder.CodecConfigParameters(buffer, size);
if (ret < 0)
{
return ret;
@ -97,23 +97,23 @@ VCMGenericEncoder::CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 si
return ret;
}
WebRtc_UWord32 VCMGenericEncoder::BitRate() const
uint32_t VCMGenericEncoder::BitRate() const
{
return _bitRate;
}
WebRtc_UWord32 VCMGenericEncoder::FrameRate() const
uint32_t VCMGenericEncoder::FrameRate() const
{
return _frameRate;
}
WebRtc_Word32
int32_t
VCMGenericEncoder::SetPeriodicKeyFrames(bool enable)
{
return _encoder.SetPeriodicKeyFrames(enable);
}
WebRtc_Word32 VCMGenericEncoder::RequestFrame(
int32_t VCMGenericEncoder::RequestFrame(
const std::vector<FrameType>& frame_types) {
I420VideoFrame image;
std::vector<VideoFrameType> video_frame_types(frame_types.size(),
@ -122,7 +122,7 @@ WebRtc_Word32 VCMGenericEncoder::RequestFrame(
return _encoder.Encode(image, NULL, &video_frame_types);
}
WebRtc_Word32
int32_t
VCMGenericEncoder::RegisterEncodeCallback(VCMEncodedFrameCallback* VCMencodedFrameCallback)
{
_VCMencodedFrameCallback = VCMencodedFrameCallback;
@ -164,14 +164,14 @@ VCMEncodedFrameCallback::~VCMEncodedFrameCallback()
#endif
}
WebRtc_Word32
int32_t
VCMEncodedFrameCallback::SetTransportCallback(VCMPacketizationCallback* transport)
{
_sendCallback = transport;
return VCM_OK;
}
WebRtc_Word32
int32_t
VCMEncodedFrameCallback::Encoded(
EncodedImage &encodedImage,
const CodecSpecificInfo* codecSpecificInfo,
@ -179,7 +179,7 @@ VCMEncodedFrameCallback::Encoded(
{
FrameType frameType = VCMEncodedFrame::ConvertFrameType(encodedImage._frameType);
WebRtc_UWord32 encodedBytes = 0;
uint32_t encodedBytes = 0;
if (_sendCallback != NULL)
{
encodedBytes = encodedImage._length;
@ -202,7 +202,7 @@ VCMEncodedFrameCallback::Encoded(
rtpVideoHeaderPtr = NULL;
}
WebRtc_Word32 callbackReturn = _sendCallback->SendData(
int32_t callbackReturn = _sendCallback->SendData(
frameType,
_payloadType,
encodedImage._timeStamp,
@ -232,7 +232,7 @@ VCMEncodedFrameCallback::Encoded(
return VCM_OK;
}
WebRtc_UWord32
uint32_t
VCMEncodedFrameCallback::EncodedBytes()
{
return _encodedBytes;

View File

@ -34,24 +34,24 @@ public:
/*
* Callback implementation - codec encode complete
*/
WebRtc_Word32 Encoded(
int32_t Encoded(
EncodedImage& encodedImage,
const CodecSpecificInfo* codecSpecificInfo = NULL,
const RTPFragmentationHeader* fragmentationHeader = NULL);
/*
* Get number of encoded bytes
*/
WebRtc_UWord32 EncodedBytes();
uint32_t EncodedBytes();
/*
* Callback implementation - generic encoder encode complete
*/
WebRtc_Word32 SetTransportCallback(VCMPacketizationCallback* transport);
int32_t SetTransportCallback(VCMPacketizationCallback* transport);
/**
* Set media Optimization
*/
void SetMediaOpt (media_optimization::VCMMediaOptimization* mediaOpt);
void SetPayloadType(WebRtc_UWord8 payloadType) { _payloadType = payloadType; };
void SetPayloadType(uint8_t payloadType) { _payloadType = payloadType; };
void SetCodecType(VideoCodecType codecType) {_codecType = codecType;};
void SetInternalSource(bool internalSource) { _internalSource = internalSource; };
@ -65,8 +65,8 @@ private:
VCMPacketizationCallback* _sendCallback;
media_optimization::VCMMediaOptimization* _mediaOpt;
WebRtc_UWord32 _encodedBytes;
WebRtc_UWord8 _payloadType;
uint32_t _encodedBytes;
uint8_t _payloadType;
VideoCodecType _codecType;
bool _internalSource;
#ifdef DEBUG_ENCODER_BIT_STREAM
@ -87,13 +87,13 @@ public:
/**
* Free encoder memory
*/
WebRtc_Word32 Release();
int32_t Release();
/**
* Initialize the encoder with the information from the VideoCodec
*/
WebRtc_Word32 InitEncode(const VideoCodec* settings,
WebRtc_Word32 numberOfCores,
WebRtc_UWord32 maxPayloadSize);
int32_t InitEncode(const VideoCodec* settings,
int32_t numberOfCores,
uint32_t maxPayloadSize);
/**
* Encode raw image
* inputFrame : Frame containing raw image
@ -101,36 +101,36 @@ public:
* cameraFrameRate : request or information from the remote side
* frameType : The requested frame type to encode
*/
WebRtc_Word32 Encode(const I420VideoFrame& inputFrame,
int32_t Encode(const I420VideoFrame& inputFrame,
const CodecSpecificInfo* codecSpecificInfo,
const std::vector<FrameType>& frameTypes);
/**
* Set new target bitrate (bits/s) and framerate.
* Return Value: new bit rate if OK, otherwise <0s.
*/
WebRtc_Word32 SetRates(WebRtc_UWord32 target_bitrate,
WebRtc_UWord32 frameRate);
int32_t SetRates(uint32_t target_bitrate,
uint32_t frameRate);
/**
* Set a new packet loss rate and a new round-trip time in milliseconds.
*/
WebRtc_Word32 SetChannelParameters(WebRtc_Word32 packetLoss, int rtt);
WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 size);
int32_t SetChannelParameters(int32_t packetLoss, int rtt);
int32_t CodecConfigParameters(uint8_t* buffer, int32_t size);
/**
* Register a transport callback which will be called to deliver the encoded buffers
*/
WebRtc_Word32 RegisterEncodeCallback(VCMEncodedFrameCallback* VCMencodedFrameCallback);
int32_t RegisterEncodeCallback(VCMEncodedFrameCallback* VCMencodedFrameCallback);
/**
* Get encoder bit rate
*/
WebRtc_UWord32 BitRate() const;
uint32_t BitRate() const;
/**
* Get encoder frame rate
*/
WebRtc_UWord32 FrameRate() const;
uint32_t FrameRate() const;
WebRtc_Word32 SetPeriodicKeyFrames(bool enable);
int32_t SetPeriodicKeyFrames(bool enable);
WebRtc_Word32 RequestFrame(const std::vector<FrameType>& frame_types);
int32_t RequestFrame(const std::vector<FrameType>& frame_types);
bool InternalSource() const;
@ -138,8 +138,8 @@ private:
VideoEncoder& _encoder;
VideoCodecType _codecType;
VCMEncodedFrameCallback* _VCMencodedFrameCallback;
WebRtc_UWord32 _bitRate;
WebRtc_UWord32 _frameRate;
uint32_t _bitRate;
uint32_t _frameRate;
bool _internalSource;
}; // end of VCMGenericEncoder class

View File

@ -31,8 +31,8 @@ VCMInterFrameDelay::Reset(int64_t currentWallClock)
// Calculates the delay of a frame with the given timestamp.
// This method is called when the frame is complete.
bool
VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp,
WebRtc_Word64 *delay,
VCMInterFrameDelay::CalculateDelay(uint32_t timestamp,
int64_t *delay,
int64_t currentWallClock)
{
if (_prevWallClock == 0)
@ -44,11 +44,11 @@ VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp,
return true;
}
WebRtc_Word32 prevWrapArounds = _wrapArounds;
int32_t prevWrapArounds = _wrapArounds;
CheckForWrapArounds(timestamp);
// This will be -1 for backward wrap arounds and +1 for forward wrap arounds
WebRtc_Word32 wrapAroundsSincePrev = _wrapArounds - prevWrapArounds;
int32_t wrapAroundsSincePrev = _wrapArounds - prevWrapArounds;
// Account for reordering in jitter variance estimate in the future?
// Note that this also captures incomplete frames which are grabbed
@ -62,13 +62,13 @@ VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp,
// Compute the compensated timestamp difference and convert it to ms and
// round it to closest integer.
_dTS = static_cast<WebRtc_Word64>((timestamp + wrapAroundsSincePrev *
(static_cast<WebRtc_Word64>(1)<<32) - _prevTimestamp) / 90.0 + 0.5);
_dTS = static_cast<int64_t>((timestamp + wrapAroundsSincePrev *
(static_cast<int64_t>(1)<<32) - _prevTimestamp) / 90.0 + 0.5);
// frameDelay is the difference of dT and dTS -- i.e. the difference of
// the wall clock time difference and the timestamp difference between
// two following frames.
*delay = static_cast<WebRtc_Word64>(currentWallClock - _prevWallClock - _dTS);
*delay = static_cast<int64_t>(currentWallClock - _prevWallClock - _dTS);
_prevTimestamp = timestamp;
_prevWallClock = currentWallClock;
@ -77,26 +77,26 @@ VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp,
}
// Returns the current difference between incoming timestamps
WebRtc_UWord32 VCMInterFrameDelay::CurrentTimeStampDiffMs() const
uint32_t VCMInterFrameDelay::CurrentTimeStampDiffMs() const
{
if (_dTS < 0)
{
return 0;
}
return static_cast<WebRtc_UWord32>(_dTS);
return static_cast<uint32_t>(_dTS);
}
// Investigates if the timestamp clock has overflowed since the last timestamp and
// keeps track of the number of wrap arounds since reset.
void
VCMInterFrameDelay::CheckForWrapArounds(WebRtc_UWord32 timestamp)
VCMInterFrameDelay::CheckForWrapArounds(uint32_t timestamp)
{
if (timestamp < _prevTimestamp)
{
// This difference will probably be less than -2^31 if we have had a wrap around
// (e.g. timestamp = 1, _previousTimestamp = 2^32 - 1). Since it is cast to a Word32,
// it should be positive.
if (static_cast<WebRtc_Word32>(timestamp - _prevTimestamp) > 0)
if (static_cast<int32_t>(timestamp - _prevTimestamp) > 0)
{
// Forward wrap around
_wrapArounds++;
@ -104,7 +104,7 @@ VCMInterFrameDelay::CheckForWrapArounds(WebRtc_UWord32 timestamp)
}
// This difference will probably be less than -2^31 if we have had a backward wrap around.
// Since it is cast to a Word32, it should be positive.
else if (static_cast<WebRtc_Word32>(_prevTimestamp - timestamp) > 0)
else if (static_cast<int32_t>(_prevTimestamp - timestamp) > 0)
{
// Backward wrap around
_wrapArounds--;

View File

@ -33,15 +33,15 @@ public:
// - currentWallClock : The current time in milliseconds.
// Should be -1 for normal operation, only used for testing.
// Return value : true if OK, false when reordered timestamps
bool CalculateDelay(WebRtc_UWord32 timestamp,
WebRtc_Word64 *delay,
bool CalculateDelay(uint32_t timestamp,
int64_t *delay,
int64_t currentWallClock);
// Returns the current difference between incoming timestamps
//
// Return value : Wrap-around compensated difference between incoming
// timestamps.
WebRtc_UWord32 CurrentTimeStampDiffMs() const;
uint32_t CurrentTimeStampDiffMs() const;
private:
// Controls if the RTP timestamp counter has had a wrap around
@ -49,16 +49,16 @@ private:
//
// Input:
// - timestmap : RTP timestamp of the current frame.
void CheckForWrapArounds(WebRtc_UWord32 timestamp);
void CheckForWrapArounds(uint32_t timestamp);
WebRtc_Word64 _zeroWallClock; // Local timestamp of the first video packet received
WebRtc_Word32 _wrapArounds; // Number of wrapArounds detected
int64_t _zeroWallClock; // Local timestamp of the first video packet received
int32_t _wrapArounds; // Number of wrapArounds detected
// The previous timestamp passed to the delay estimate
WebRtc_UWord32 _prevTimestamp;
uint32_t _prevTimestamp;
// The previous wall clock timestamp used by the delay estimate
WebRtc_Word64 _prevWallClock;
int64_t _prevWallClock;
// Wrap-around compensated difference between incoming timestamps
WebRtc_Word64 _dTS;
int64_t _dTS;
};
} // namespace webrtc

View File

@ -18,9 +18,9 @@ namespace webrtc
#define MASK_32_BITS(x) (0xFFFFFFFF & (x))
inline WebRtc_UWord32 MaskWord64ToUWord32(WebRtc_Word64 w64)
inline uint32_t MaskWord64ToUWord32(int64_t w64)
{
return static_cast<WebRtc_UWord32>(MASK_32_BITS(w64));
return static_cast<uint32_t>(MASK_32_BITS(w64));
}
#define VCM_MAX(a, b) (((a) > (b)) ? (a) : (b))
@ -48,9 +48,9 @@ inline WebRtc_UWord32 MaskWord64ToUWord32(WebRtc_Word64 w64)
#define VCM_NO_RECEIVER_ID 0
inline WebRtc_Word32 VCMId(const WebRtc_Word32 vcmId, const WebRtc_Word32 receiverId = 0)
inline int32_t VCMId(const int32_t vcmId, const int32_t receiverId = 0)
{
return static_cast<WebRtc_Word32>((vcmId << 16) + receiverId);
return static_cast<int32_t>((vcmId << 16) + receiverId);
}
} // namespace webrtc

View File

@ -285,7 +285,7 @@ class VCMJitterBuffer {
// Calculates network delays used for jitter calculations.
VCMInterFrameDelay inter_frame_delay_;
VCMJitterSample waiting_for_completion_;
WebRtc_UWord32 rtt_ms_;
uint32_t rtt_ms_;
// NACK and retransmissions.
VCMNackMode nack_mode_;

View File

@ -14,8 +14,8 @@
namespace webrtc {
WebRtc_UWord32 LatestTimestamp(WebRtc_UWord32 timestamp1,
WebRtc_UWord32 timestamp2,
uint32_t LatestTimestamp(uint32_t timestamp1,
uint32_t timestamp2,
bool* has_wrapped) {
bool wrap = (timestamp2 < 0x0000ffff && timestamp1 > 0xffff0000) ||
(timestamp2 > 0xffff0000 && timestamp1 < 0x0000ffff);
@ -31,8 +31,8 @@ WebRtc_UWord32 LatestTimestamp(WebRtc_UWord32 timestamp1,
return timestamp2;
}
WebRtc_Word32 LatestSequenceNumber(WebRtc_Word32 seq_num1,
WebRtc_Word32 seq_num2,
int32_t LatestSequenceNumber(int32_t seq_num1,
int32_t seq_num2,
bool* has_wrapped) {
if (seq_num1 < 0 && seq_num2 < 0)
return -1;

View File

@ -62,15 +62,15 @@ enum VCMNaluCompleteness {
// Returns the latest of the two timestamps, compensating for wrap arounds.
// This function assumes that the two timestamps are close in time.
WebRtc_UWord32 LatestTimestamp(WebRtc_UWord32 timestamp1,
WebRtc_UWord32 timestamp2,
uint32_t LatestTimestamp(uint32_t timestamp1,
uint32_t timestamp2,
bool* has_wrapped);
// Returns the latest of the two sequence numbers, compensating for wrap
// arounds. This function assumes that the two sequence numbers are close in
// time.
WebRtc_Word32 LatestSequenceNumber(WebRtc_Word32 seq_num1,
WebRtc_Word32 seq_num2,
int32_t LatestSequenceNumber(int32_t seq_num1,
int32_t seq_num2,
bool* has_wrapped);
} // namespace webrtc

View File

@ -22,7 +22,7 @@ namespace webrtc {
enum { kInitialMaxJitterEstimate = 0 };
VCMJitterEstimator::VCMJitterEstimator(WebRtc_Word32 vcmId, WebRtc_Word32 receiverId) :
VCMJitterEstimator::VCMJitterEstimator(int32_t vcmId, int32_t receiverId) :
_vcmId(vcmId),
_receiverId(receiverId),
_phi(0.97),
@ -114,7 +114,7 @@ VCMJitterEstimator::ResetNackCount()
// Updates the estimates with the new measurements
void
VCMJitterEstimator::UpdateEstimate(WebRtc_Word64 frameDelayMS, WebRtc_UWord32 frameSizeBytes,
VCMJitterEstimator::UpdateEstimate(int64_t frameDelayMS, uint32_t frameSizeBytes,
bool incompleteFrame /* = false */)
{
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
@ -235,8 +235,8 @@ VCMJitterEstimator::FrameNacked()
// Updates Kalman estimate of the channel
// The caller is expected to sanity check the inputs.
void
VCMJitterEstimator::KalmanEstimateChannel(WebRtc_Word64 frameDelayMS,
WebRtc_Word32 deltaFSBytes)
VCMJitterEstimator::KalmanEstimateChannel(int64_t frameDelayMS,
int32_t deltaFSBytes)
{
double Mh[2];
double hMh_sigma;
@ -313,8 +313,8 @@ VCMJitterEstimator::KalmanEstimateChannel(WebRtc_Word64 frameDelayMS,
// Calculate difference in delay between a sample and the
// expected delay estimated by the Kalman filter
double
VCMJitterEstimator::DeviationFromExpectedDelay(WebRtc_Word64 frameDelayMS,
WebRtc_Word32 deltaFSBytes) const
VCMJitterEstimator::DeviationFromExpectedDelay(int64_t frameDelayMS,
int32_t deltaFSBytes) const
{
return frameDelayMS - (_theta[0] * deltaFSBytes + _theta[1]);
}
@ -395,13 +395,13 @@ VCMJitterEstimator::PostProcessEstimate()
}
void
VCMJitterEstimator::UpdateRtt(WebRtc_UWord32 rttMs)
VCMJitterEstimator::UpdateRtt(uint32_t rttMs)
{
_rttFilter.Update(rttMs);
}
void
VCMJitterEstimator::UpdateMaxFrameSize(WebRtc_UWord32 frameSizeBytes)
VCMJitterEstimator::UpdateMaxFrameSize(uint32_t frameSizeBytes)
{
if (_maxFrameSize < frameSizeBytes)
{

View File

@ -26,7 +26,7 @@ enum VCMJitterEstimateMode
class VCMJitterEstimator
{
public:
VCMJitterEstimator(WebRtc_Word32 vcmId = 0, WebRtc_Word32 receiverId = 0);
VCMJitterEstimator(int32_t vcmId = 0, int32_t receiverId = 0);
VCMJitterEstimator& operator=(const VCMJitterEstimator& rhs);
@ -41,8 +41,8 @@ public:
// - frameSize : Frame size of the current frame.
// - incompleteFrame : Flags if the frame is used to update the estimate before it
// was complete. Default is false.
void UpdateEstimate(WebRtc_Word64 frameDelayMS,
WebRtc_UWord32 frameSizeBytes,
void UpdateEstimate(int64_t frameDelayMS,
uint32_t frameSizeBytes,
bool incompleteFrame = false);
// Returns the current jitter estimate in milliseconds and adds
@ -60,9 +60,9 @@ public:
//
// Input:
// - rttMs : RTT in ms
void UpdateRtt(WebRtc_UWord32 rttMs);
void UpdateRtt(uint32_t rttMs);
void UpdateMaxFrameSize(WebRtc_UWord32 frameSizeBytes);
void UpdateMaxFrameSize(uint32_t frameSizeBytes);
// Set a max filter on the jitter estimate by setting an initial
// non-zero delay. When set to zero (default), the last jitter
@ -72,7 +72,7 @@ public:
// A constant describing the delay from the jitter buffer
// to the delay on the receiving side which is not accounted
// for by the jitter buffer nor the decoding delay estimate.
static const WebRtc_UWord32 OPERATING_SYSTEM_JITTER = 10;
static const uint32_t OPERATING_SYSTEM_JITTER = 10;
protected:
// These are protected for better testing possibilities
@ -87,7 +87,7 @@ private:
// - frameDelayMS : Delay-delta calculated by UTILDelayEstimate in milliseconds
// - deltaFSBytes : Frame size delta, i.e.
// : frame size at time T minus frame size at time T-1
void KalmanEstimateChannel(WebRtc_Word64 frameDelayMS, WebRtc_Word32 deltaFSBytes);
void KalmanEstimateChannel(int64_t frameDelayMS, int32_t deltaFSBytes);
// Updates the random jitter estimate, i.e. the variance
// of the time deviations from the line given by the Kalman filter.
@ -117,19 +117,19 @@ private:
// T minus frame size at time T-1
//
// Return value : The difference in milliseconds
double DeviationFromExpectedDelay(WebRtc_Word64 frameDelayMS,
WebRtc_Word32 deltaFSBytes) const;
double DeviationFromExpectedDelay(int64_t frameDelayMS,
int32_t deltaFSBytes) const;
// Constants, filter parameters
WebRtc_Word32 _vcmId;
WebRtc_Word32 _receiverId;
int32_t _vcmId;
int32_t _receiverId;
const double _phi;
const double _psi;
const WebRtc_UWord32 _alphaCountMax;
const uint32_t _alphaCountMax;
const double _thetaLow;
const WebRtc_UWord32 _nackLimit;
const WebRtc_Word32 _numStdDevDelayOutlier;
const WebRtc_Word32 _numStdDevFrameSizeOutlier;
const uint32_t _nackLimit;
const int32_t _numStdDevDelayOutlier;
const int32_t _numStdDevFrameSizeOutlier;
const double _noiseStdDevs;
const double _noiseStdDevOffset;
@ -139,20 +139,20 @@ private:
double _varFrameSize; // Frame size variance
double _maxFrameSize; // Largest frame size received (descending
// with a factor _psi)
WebRtc_UWord32 _fsSum;
WebRtc_UWord32 _fsCount;
uint32_t _fsSum;
uint32_t _fsCount;
WebRtc_Word64 _lastUpdateT;
int64_t _lastUpdateT;
double _prevEstimate; // The previously returned jitter estimate
WebRtc_UWord32 _prevFrameSize; // Frame size of the previous frame
uint32_t _prevFrameSize; // Frame size of the previous frame
double _avgNoise; // Average of the random jitter
WebRtc_UWord32 _alphaCount;
uint32_t _alphaCount;
double _filterJitterEstimate; // The filtered sum of jitter estimates
WebRtc_UWord32 _startupCount;
uint32_t _startupCount;
WebRtc_Word64 _latestNackTimestamp; // Timestamp in ms when the latest nack was seen
WebRtc_UWord32 _nackCount; // Keeps track of the number of nacks received,
int64_t _latestNackTimestamp; // Timestamp in ms when the latest nack was seen
uint32_t _nackCount; // Keeps track of the number of nacks received,
// but never goes above _nackLimit
VCMRttFilter _rttFilter;
VCMJitterEstimateMode _jitterEstimateMode;

View File

@ -98,12 +98,12 @@ VCMNackFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
else if (_highRttNackMs == -1 || parameters->rtt < _highRttNackMs)
{
// TODO(mikhal): Disabling adjustment temporarily.
// WebRtc_UWord16 rttIndex = (WebRtc_UWord16) parameters->rtt;
// uint16_t rttIndex = (uint16_t) parameters->rtt;
float adjustRtt = 1.0f;// (float)VCMNackFecTable[rttIndex] / 100.0f;
// Adjust FEC with NACK on (for delta frame only)
// table depends on RTT relative to rttMax (NACK Threshold)
_protectionFactorD = static_cast<WebRtc_UWord8>
_protectionFactorD = static_cast<uint8_t>
(adjustRtt *
static_cast<float>(_protectionFactorD));
// update FEC rates after applying adjustment
@ -253,40 +253,40 @@ VCMFecMethod::~VCMFecMethod()
//
}
WebRtc_UWord8
VCMFecMethod::BoostCodeRateKey(WebRtc_UWord8 packetFrameDelta,
WebRtc_UWord8 packetFrameKey) const
uint8_t
VCMFecMethod::BoostCodeRateKey(uint8_t packetFrameDelta,
uint8_t packetFrameKey) const
{
WebRtc_UWord8 boostRateKey = 2;
uint8_t boostRateKey = 2;
// Default: ratio scales the FEC protection up for I frames
WebRtc_UWord8 ratio = 1;
uint8_t ratio = 1;
if (packetFrameDelta > 0)
{
ratio = (WebRtc_Word8) (packetFrameKey / packetFrameDelta);
ratio = (int8_t) (packetFrameKey / packetFrameDelta);
}
ratio = VCM_MAX(boostRateKey, ratio);
return ratio;
}
WebRtc_UWord8
VCMFecMethod::ConvertFECRate(WebRtc_UWord8 codeRateRTP) const
uint8_t
VCMFecMethod::ConvertFECRate(uint8_t codeRateRTP) const
{
return static_cast<WebRtc_UWord8> (VCM_MIN(255,(0.5 + 255.0 * codeRateRTP /
return static_cast<uint8_t> (VCM_MIN(255,(0.5 + 255.0 * codeRateRTP /
(float)(255 - codeRateRTP))));
}
// Update FEC with protectionFactorD
void
VCMFecMethod::UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD)
VCMFecMethod::UpdateProtectionFactorD(uint8_t protectionFactorD)
{
_protectionFactorD = protectionFactorD;
}
// Update FEC with protectionFactorK
void
VCMFecMethod::UpdateProtectionFactorK(WebRtc_UWord8 protectionFactorK)
VCMFecMethod::UpdateProtectionFactorK(uint8_t protectionFactorK)
{
_protectionFactorK = protectionFactorK;
}
@ -299,11 +299,11 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const
{
// Total (avg) bits available per frame: total rate over actual/sent frame
// rate units are kbits/frame
const WebRtc_UWord16 bitRatePerFrame = static_cast<WebRtc_UWord16>
const uint16_t bitRatePerFrame = static_cast<uint16_t>
(parameters->bitRate / (parameters->frameRate));
// Total (average) number of packets per frame (source and fec):
const WebRtc_UWord8 avgTotPackets = 1 + static_cast<WebRtc_UWord8>
const uint8_t avgTotPackets = 1 + static_cast<uint8_t>
(static_cast<float> (bitRatePerFrame * 1000.0) /
static_cast<float> (8.0 * _maxPayloadSize) + 0.5);
@ -312,10 +312,10 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const
// Round down for estimated #FEC packets/frame, to keep
// |fecPacketsPerFrame| <= |sourcePacketsPerFrame|.
WebRtc_UWord8 fecPacketsPerFrame = static_cast<WebRtc_UWord8>
uint8_t fecPacketsPerFrame = static_cast<uint8_t>
(protectionFactor * avgTotPackets);
WebRtc_UWord8 sourcePacketsPerFrame = avgTotPackets - fecPacketsPerFrame;
uint8_t sourcePacketsPerFrame = avgTotPackets - fecPacketsPerFrame;
if ( (fecPacketsPerFrame == 0) || (sourcePacketsPerFrame == 0) )
{
@ -336,18 +336,18 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const
}
// Code index for tables: up to (kMaxNumPackets * kMaxNumPackets)
WebRtc_UWord16 codeIndexTable[kMaxNumPackets * kMaxNumPackets];
WebRtc_UWord16 k = 0;
for (WebRtc_UWord8 i = 1; i <= kMaxNumPackets; i++)
uint16_t codeIndexTable[kMaxNumPackets * kMaxNumPackets];
uint16_t k = 0;
for (uint8_t i = 1; i <= kMaxNumPackets; i++)
{
for (WebRtc_UWord8 j = 1; j <= i; j++)
for (uint8_t j = 1; j <= i; j++)
{
codeIndexTable[(j - 1) * kMaxNumPackets + i - 1] = k;
k += 1;
}
}
WebRtc_UWord8 lossRate = static_cast<WebRtc_UWord8> (255.0 *
uint8_t lossRate = static_cast<uint8_t> (255.0 *
parameters->lossPr + 0.5f);
// Constrain lossRate to 50%: tables defined up to 50%
@ -356,10 +356,10 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const
lossRate = kPacketLossMax - 1;
}
const WebRtc_UWord16 codeIndex = (fecPacketsPerFrame - 1) * kMaxNumPackets +
const uint16_t codeIndex = (fecPacketsPerFrame - 1) * kMaxNumPackets +
(sourcePacketsPerFrame - 1);
const WebRtc_UWord16 indexTable = codeIndexTable[codeIndex] * kPacketLossMax +
const uint16_t indexTable = codeIndexTable[codeIndex] * kPacketLossMax +
lossRate;
// Check on table index
@ -375,7 +375,7 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
// FEC PROTECTION SETTINGS: varies with packet loss and bitrate
// No protection if (filtered) packetLoss is 0
WebRtc_UWord8 packetLoss = (WebRtc_UWord8) (255 * parameters->lossPr);
uint8_t packetLoss = (uint8_t) (255 * parameters->lossPr);
if (packetLoss == 0)
{
_protectionFactorK = 0;
@ -387,20 +387,20 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
// first partition size, thresholds, table pars, spatial resoln fac.
// First partition protection: ~ 20%
WebRtc_UWord8 firstPartitionProt = (WebRtc_UWord8) (255 * 0.20);
uint8_t firstPartitionProt = (uint8_t) (255 * 0.20);
// Minimum protection level needed to generate one FEC packet for one
// source packet/frame (in RTP sender)
WebRtc_UWord8 minProtLevelFec = 85;
uint8_t minProtLevelFec = 85;
// Threshold on packetLoss and bitRrate/frameRate (=average #packets),
// above which we allocate protection to cover at least first partition.
WebRtc_UWord8 lossThr = 0;
WebRtc_UWord8 packetNumThr = 1;
uint8_t lossThr = 0;
uint8_t packetNumThr = 1;
// Parameters for range of rate index of table.
const WebRtc_UWord8 ratePar1 = 5;
const WebRtc_UWord8 ratePar2 = 49;
const uint8_t ratePar1 = 5;
const uint8_t ratePar2 = 49;
// Spatial resolution size, relative to a reference size.
float spatialSizeToRef = static_cast<float>
@ -415,21 +415,21 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
// Average number of packets per frame (source and fec):
const WebRtc_UWord8 avgTotPackets = 1 + (WebRtc_UWord8)
const uint8_t avgTotPackets = 1 + (uint8_t)
((float) bitRatePerFrame * 1000.0
/ (float) (8.0 * _maxPayloadSize) + 0.5);
// FEC rate parameters: for P and I frame
WebRtc_UWord8 codeRateDelta = 0;
WebRtc_UWord8 codeRateKey = 0;
uint8_t codeRateDelta = 0;
uint8_t codeRateKey = 0;
// Get index for table: the FEC protection depends on an effective rate.
// The range on the rate index corresponds to rates (bps)
// from ~200k to ~8000k, for 30fps
const WebRtc_UWord16 effRateFecTable = static_cast<WebRtc_UWord16>
const uint16_t effRateFecTable = static_cast<uint16_t>
(resolnFac * bitRatePerFrame);
WebRtc_UWord8 rateIndexTable =
(WebRtc_UWord8) VCM_MAX(VCM_MIN((effRateFecTable - ratePar1) /
uint8_t rateIndexTable =
(uint8_t) VCM_MAX(VCM_MIN((effRateFecTable - ratePar1) /
ratePar1, ratePar2), 0);
// Restrict packet loss range to 50:
@ -438,7 +438,7 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
{
packetLoss = kPacketLossMax - 1;
}
WebRtc_UWord16 indexTable = rateIndexTable * kPacketLossMax + packetLoss;
uint16_t indexTable = rateIndexTable * kPacketLossMax + packetLoss;
// Check on table index
assert(indexTable < kSizeCodeRateXORTable);
@ -473,23 +473,23 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
packetLoss);
}
codeRateDelta = static_cast<WebRtc_UWord8>(codeRateDelta * adjustFec);
codeRateDelta = static_cast<uint8_t>(codeRateDelta * adjustFec);
// For Key frame:
// Effectively at a higher rate, so we scale/boost the rate
// The boost factor may depend on several factors: ratio of packet
// number of I to P frames, how much protection placed on P frames, etc.
const WebRtc_UWord8 packetFrameDelta = (WebRtc_UWord8)
const uint8_t packetFrameDelta = (uint8_t)
(0.5 + parameters->packetsPerFrame);
const WebRtc_UWord8 packetFrameKey = (WebRtc_UWord8)
const uint8_t packetFrameKey = (uint8_t)
(0.5 + parameters->packetsPerFrameKey);
const WebRtc_UWord8 boostKey = BoostCodeRateKey(packetFrameDelta,
const uint8_t boostKey = BoostCodeRateKey(packetFrameDelta,
packetFrameKey);
rateIndexTable = (WebRtc_UWord8) VCM_MAX(VCM_MIN(
rateIndexTable = (uint8_t) VCM_MAX(VCM_MIN(
1 + (boostKey * effRateFecTable - ratePar1) /
ratePar1,ratePar2),0);
WebRtc_UWord16 indexTableKey = rateIndexTable * kPacketLossMax + packetLoss;
uint16_t indexTableKey = rateIndexTable * kPacketLossMax + packetLoss;
indexTableKey = VCM_MIN(indexTableKey, kSizeCodeRateXORTable);
@ -508,7 +508,7 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
// Make sure I frame protection is at least larger than P frame protection,
// and at least as high as filtered packet loss.
codeRateKey = static_cast<WebRtc_UWord8> (VCM_MAX(packetLoss,
codeRateKey = static_cast<uint8_t> (VCM_MAX(packetLoss,
VCM_MAX(boostKeyProt, codeRateKey)));
// Check limit on amount of protection for I frame: 50% is max.
@ -588,7 +588,7 @@ VCMFecMethod::EffectivePacketLoss(const VCMProtectionParameters* parameters)
// note: received/input packet loss may be filtered based on FilteredLoss
// The packet loss:
WebRtc_UWord8 packetLoss = (WebRtc_UWord8) (255 * parameters->lossPr);
uint8_t packetLoss = (uint8_t) (255 * parameters->lossPr);
float avgFecRecov = AvgRecoveryFEC(parameters);
@ -737,7 +737,7 @@ VCMLossProtectionLogic::RequiredBitRate() const
}
void
VCMLossProtectionLogic::UpdateRtt(WebRtc_UWord32 rtt)
VCMLossProtectionLogic::UpdateRtt(uint32_t rtt)
{
_rtt = rtt;
}
@ -749,8 +749,8 @@ VCMLossProtectionLogic::UpdateResidualPacketLoss(float residualPacketLoss)
}
void
VCMLossProtectionLogic::UpdateMaxLossHistory(WebRtc_UWord8 lossPr255,
WebRtc_Word64 now)
VCMLossProtectionLogic::UpdateMaxLossHistory(uint8_t lossPr255,
int64_t now)
{
if (_lossPrHistory[0].timeMs >= 0 &&
now - _lossPrHistory[0].timeMs < kLossPrShortFilterWinMs)
@ -771,7 +771,7 @@ VCMLossProtectionLogic::UpdateMaxLossHistory(WebRtc_UWord8 lossPr255,
else
{
// Shift
for (WebRtc_Word32 i = (kLossPrHistorySize - 2); i >= 0; i--)
for (int32_t i = (kLossPrHistorySize - 2); i >= 0; i--)
{
_lossPrHistory[i + 1].lossPr255 = _lossPrHistory[i].lossPr255;
_lossPrHistory[i + 1].timeMs = _lossPrHistory[i].timeMs;
@ -788,15 +788,15 @@ VCMLossProtectionLogic::UpdateMaxLossHistory(WebRtc_UWord8 lossPr255,
}
}
WebRtc_UWord8
VCMLossProtectionLogic::MaxFilteredLossPr(WebRtc_Word64 nowMs) const
uint8_t
VCMLossProtectionLogic::MaxFilteredLossPr(int64_t nowMs) const
{
WebRtc_UWord8 maxFound = _shortMaxLossPr255;
uint8_t maxFound = _shortMaxLossPr255;
if (_lossPrHistory[0].timeMs == -1)
{
return maxFound;
}
for (WebRtc_Word32 i = 0; i < kLossPrHistorySize; i++)
for (int32_t i = 0; i < kLossPrHistorySize; i++)
{
if (_lossPrHistory[i].timeMs == -1)
{
@ -817,10 +817,10 @@ VCMLossProtectionLogic::MaxFilteredLossPr(WebRtc_Word64 nowMs) const
return maxFound;
}
WebRtc_UWord8 VCMLossProtectionLogic::FilteredLoss(
uint8_t VCMLossProtectionLogic::FilteredLoss(
int64_t nowMs,
FilterPacketLossMode filter_mode,
WebRtc_UWord8 lossPr255) {
uint8_t lossPr255) {
// Update the max window filter.
UpdateMaxLossHistory(lossPr255, nowMs);
@ -831,13 +831,13 @@ WebRtc_UWord8 VCMLossProtectionLogic::FilteredLoss(
_lastPrUpdateT = nowMs;
// Filtered loss: default is received loss (no filtering).
WebRtc_UWord8 filtered_loss = lossPr255;
uint8_t filtered_loss = lossPr255;
switch (filter_mode) {
case kNoFilter:
break;
case kAvgFilter:
filtered_loss = static_cast<WebRtc_UWord8> (_lossPr255.Value() + 0.5);
filtered_loss = static_cast<uint8_t> (_lossPr255.Value() + 0.5);
break;
case kMaxFilter:
filtered_loss = MaxFilteredLossPr(nowMs);
@ -848,7 +848,7 @@ WebRtc_UWord8 VCMLossProtectionLogic::FilteredLoss(
}
void
VCMLossProtectionLogic::UpdateFilteredLossPr(WebRtc_UWord8 packetLossEnc)
VCMLossProtectionLogic::UpdateFilteredLossPr(uint8_t packetLossEnc)
{
_lossPr = (float) packetLossEnc / (float) 255.0;
}
@ -882,8 +882,8 @@ VCMLossProtectionLogic::UpdateKeyFrameSize(float keyFrameSize)
}
void
VCMLossProtectionLogic::UpdateFrameSize(WebRtc_UWord16 width,
WebRtc_UWord16 height)
VCMLossProtectionLogic::UpdateFrameSize(uint16_t width,
uint16_t height)
{
_codecWidth = width;
_codecHeight = height;
@ -937,7 +937,7 @@ VCMLossProtectionLogic::Reset(int64_t nowMs)
_lossPr255.Reset(0.9999f);
_packetsPerFrame.Reset(0.9999f);
_fecRateDelta = _fecRateKey = 0;
for (WebRtc_Word32 i = 0; i < kLossPrHistorySize; i++)
for (int32_t i = 0; i < kLossPrHistorySize; i++)
{
_lossPrHistory[i].lossPr255 = 0;
_lossPrHistory[i].timeMs = -1;

View File

@ -62,11 +62,11 @@ struct VCMProtectionParameters
float packetsPerFrameKey;
float frameRate;
float keyFrameSize;
WebRtc_UWord8 fecRateDelta;
WebRtc_UWord8 fecRateKey;
uint8_t fecRateDelta;
uint8_t fecRateKey;
float residualPacketLossFec;
WebRtc_UWord16 codecWidth;
WebRtc_UWord16 codecHeight;
uint16_t codecWidth;
uint16_t codecHeight;
int numLayers;
};
@ -88,8 +88,8 @@ class VCMLossProbabilitySample
public:
VCMLossProbabilitySample() : lossPr255(0), timeMs(-1) {};
WebRtc_UWord8 lossPr255;
WebRtc_Word64 timeMs;
uint8_t lossPr255;
int64_t timeMs;
};
@ -122,17 +122,17 @@ public:
// Returns the effective packet loss for ER, required by this protection method
//
// Return value : Required effective packet loss
virtual WebRtc_UWord8 RequiredPacketLossER() { return _effectivePacketLoss; }
virtual uint8_t RequiredPacketLossER() { return _effectivePacketLoss; }
// Extracts the FEC protection factor for Key frame, required by this protection method
//
// Return value : Required protectionFactor for Key frame
virtual WebRtc_UWord8 RequiredProtectionFactorK() { return _protectionFactorK; }
virtual uint8_t RequiredProtectionFactorK() { return _protectionFactorK; }
// Extracts the FEC protection factor for Delta frame, required by this protection method
//
// Return value : Required protectionFactor for delta frame
virtual WebRtc_UWord8 RequiredProtectionFactorD() { return _protectionFactorD; }
virtual uint8_t RequiredProtectionFactorD() { return _protectionFactorD; }
// Extracts whether the FEC Unequal protection (UEP) is used for Key frame.
//
@ -151,13 +151,13 @@ public:
protected:
WebRtc_UWord8 _effectivePacketLoss;
WebRtc_UWord8 _protectionFactorK;
WebRtc_UWord8 _protectionFactorD;
uint8_t _effectivePacketLoss;
uint8_t _protectionFactorK;
uint8_t _protectionFactorD;
// Estimation of residual loss after the FEC
float _residualPacketLossFec;
float _scaleProtKey;
WebRtc_Word32 _maxPayloadSize;
int32_t _maxPayloadSize;
VCMQmRobustness* _qmRobustness;
bool _useUepProtectionK;
@ -188,16 +188,16 @@ public:
// Get the FEC protection factors
bool ProtectionFactor(const VCMProtectionParameters* parameters);
// Get the boost for key frame protection
WebRtc_UWord8 BoostCodeRateKey(WebRtc_UWord8 packetFrameDelta,
WebRtc_UWord8 packetFrameKey) const;
uint8_t BoostCodeRateKey(uint8_t packetFrameDelta,
uint8_t packetFrameKey) const;
// Convert the rates: defined relative to total# packets or source# packets
WebRtc_UWord8 ConvertFECRate(WebRtc_UWord8 codeRate) const;
uint8_t ConvertFECRate(uint8_t codeRate) const;
// Get the average effective recovery from FEC: for random loss model
float AvgRecoveryFEC(const VCMProtectionParameters* parameters) const;
// Update FEC with protectionFactorD
void UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD);
void UpdateProtectionFactorD(uint8_t protectionFactorD);
// Update FEC with protectionFactorK
void UpdateProtectionFactorK(WebRtc_UWord8 protectionFactorK);
void UpdateProtectionFactorK(uint8_t protectionFactorK);
// Compute the bits per frame. Account for temporal layers when applicable.
int BitsPerFrame(const VCMProtectionParameters* parameters);
@ -267,7 +267,7 @@ public:
//
// Input:
// - rtt : Round-trip time in seconds.
void UpdateRtt(WebRtc_UWord32 rtt);
void UpdateRtt(uint32_t rtt);
// Update residual packet loss
//
@ -281,7 +281,7 @@ public:
// Input:
// - packetLossEnc : The reported packet loss filtered
// (max window or average)
void UpdateFilteredLossPr(WebRtc_UWord8 packetLossEnc);
void UpdateFilteredLossPr(uint8_t packetLossEnc);
// Update the current target bit rate.
//
@ -318,7 +318,7 @@ public:
// Input:
// - width : The codec frame width.
// - height : The codec frame height.
void UpdateFrameSize(WebRtc_UWord16 width, WebRtc_UWord16 height);
void UpdateFrameSize(uint16_t width, uint16_t height);
// Update the number of active layers
//
@ -333,7 +333,7 @@ public:
// sending key frames.
// - fecRateDelta : Packet loss to cover for with FEC when
// sending delta frames.
void UpdateFECRates(WebRtc_UWord8 fecRateKey, WebRtc_UWord8 fecRateDelta)
void UpdateFECRates(uint8_t fecRateKey, uint8_t fecRateDelta)
{ _fecRateKey = fecRateKey;
_fecRateDelta = fecRateDelta; }
@ -356,8 +356,8 @@ public:
// The input parameter |lossPr255| is the received packet loss.
// Return value : The filtered loss probability
WebRtc_UWord8 FilteredLoss(int64_t nowMs, FilterPacketLossMode filter_mode,
WebRtc_UWord8 lossPr255);
uint8_t FilteredLoss(int64_t nowMs, FilterPacketLossMode filter_mode,
uint8_t lossPr255);
void Reset(int64_t nowMs);
@ -365,28 +365,28 @@ public:
private:
// Sets the available loss protection methods.
void UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, WebRtc_Word64 now);
WebRtc_UWord8 MaxFilteredLossPr(WebRtc_Word64 nowMs) const;
void UpdateMaxLossHistory(uint8_t lossPr255, int64_t now);
uint8_t MaxFilteredLossPr(int64_t nowMs) const;
VCMProtectionMethod* _selectedMethod;
VCMProtectionParameters _currentParameters;
WebRtc_UWord32 _rtt;
uint32_t _rtt;
float _lossPr;
float _bitRate;
float _frameRate;
float _keyFrameSize;
WebRtc_UWord8 _fecRateKey;
WebRtc_UWord8 _fecRateDelta;
WebRtc_Word64 _lastPrUpdateT;
WebRtc_Word64 _lastPacketPerFrameUpdateT;
WebRtc_Word64 _lastPacketPerFrameUpdateTKey;
uint8_t _fecRateKey;
uint8_t _fecRateDelta;
int64_t _lastPrUpdateT;
int64_t _lastPacketPerFrameUpdateT;
int64_t _lastPacketPerFrameUpdateTKey;
VCMExpFilter _lossPr255;
VCMLossProbabilitySample _lossPrHistory[kLossPrHistorySize];
WebRtc_UWord8 _shortMaxLossPr255;
uint8_t _shortMaxLossPr255;
VCMExpFilter _packetsPerFrame;
VCMExpFilter _packetsPerFrameKey;
float _residualPacketLossFec;
WebRtc_UWord16 _codecWidth;
WebRtc_UWord16 _codecHeight;
uint16_t _codecWidth;
uint16_t _codecHeight;
int _numLayers;
};

View File

@ -18,7 +18,7 @@
namespace webrtc {
namespace media_optimization {
VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id,
VCMMediaOptimization::VCMMediaOptimization(int32_t id,
Clock* clock):
_id(id),
_clock(clock),
@ -62,7 +62,7 @@ VCMMediaOptimization::~VCMMediaOptimization(void)
delete _qmResolution;
}
WebRtc_Word32
int32_t
VCMMediaOptimization::Reset()
{
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
@ -89,10 +89,10 @@ VCMMediaOptimization::Reset()
return VCM_OK;
}
WebRtc_UWord32
VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 target_bitrate,
WebRtc_UWord8 &fractionLost,
WebRtc_UWord32 roundTripTimeMs)
uint32_t
VCMMediaOptimization::SetTargetRates(uint32_t target_bitrate,
uint8_t &fractionLost,
uint32_t roundTripTimeMs)
{
// TODO(holmer): Consider putting this threshold only on the video bitrate,
// and not on protection.
@ -126,7 +126,7 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 target_bitrate,
// filtered value (average or max window filter).
// Use max window filter for now.
FilterPacketLossMode filter_mode = kMaxFilter;
WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss(
uint8_t packetLossEnc = _lossProtLogic->FilteredLoss(
_clock->TimeInMilliseconds(), filter_mode, fractionLost);
// For now use the filtered loss for computing the robustness settings
@ -256,12 +256,12 @@ bool
VCMMediaOptimization::DropFrame()
{
// leak appropriate number of bytes
_frameDropper->Leak((WebRtc_UWord32)(InputFrameRate() + 0.5f));
_frameDropper->Leak((uint32_t)(InputFrameRate() + 0.5f));
return _frameDropper->DropFrame();
}
WebRtc_Word32
int32_t
VCMMediaOptimization::SentFrameCount(VCMFrameCount &frameCount) const
{
frameCount.numDeltaFrames = _deltaFrameCnt;
@ -269,13 +269,13 @@ VCMMediaOptimization::SentFrameCount(VCMFrameCount &frameCount) const
return VCM_OK;
}
WebRtc_Word32
int32_t
VCMMediaOptimization::SetEncodingData(VideoCodecType sendCodecType,
WebRtc_Word32 maxBitRate,
WebRtc_UWord32 frameRate,
WebRtc_UWord32 target_bitrate,
WebRtc_UWord16 width,
WebRtc_UWord16 height,
int32_t maxBitRate,
uint32_t frameRate,
uint32_t target_bitrate,
uint16_t width,
uint16_t height,
int numLayers)
{
// Everything codec specific should be reset here since this means the codec
@ -300,13 +300,13 @@ VCMMediaOptimization::SetEncodingData(VideoCodecType sendCodecType,
_codecWidth = width;
_codecHeight = height;
_numLayers = (numLayers <= 1) ? 1 : numLayers; // Can also be zero.
WebRtc_Word32 ret = VCM_OK;
int32_t ret = VCM_OK;
ret = _qmResolution->Initialize(target_bitrate_kbps, _userFrameRate,
_codecWidth, _codecHeight, _numLayers);
return ret;
}
WebRtc_Word32
int32_t
VCMMediaOptimization::RegisterProtectionCallback(VCMProtectionCallback*
protectionCallback)
{
@ -347,7 +347,7 @@ VCMMediaOptimization::IsProtectionMethodEnabled(VCMProtectionMethodEnum method)
}
void
VCMMediaOptimization::SetMtu(WebRtc_Word32 mtu)
VCMMediaOptimization::SetMtu(int32_t mtu)
{
_maxPayloadSize = mtu;
}
@ -369,13 +369,13 @@ VCMMediaOptimization::SentBitRate()
return _avgSentBitRateBps;
}
WebRtc_Word32
int32_t
VCMMediaOptimization::MaxBitRate()
{
return _maxBitRate;
}
WebRtc_Word32
int32_t
VCMMediaOptimization::UpdateWithEncodedData(int encodedLength,
uint32_t timestamp,
FrameType encodedFrameType)
@ -481,7 +481,7 @@ void VCMMediaOptimization::UpdateSentFramerate() {
}
}
WebRtc_Word32
int32_t
VCMMediaOptimization::RegisterVideoQMCallback(VCMQMSettingsCallback*
videoQMSettings)
{
@ -515,7 +515,7 @@ VCMMediaOptimization::UpdateContentData(const VideoContentMetrics*
}
}
WebRtc_Word32
int32_t
VCMMediaOptimization::SelectQuality()
{
// Reset quantities for QM select
@ -526,7 +526,7 @@ VCMMediaOptimization::SelectQuality()
// Select quality mode
VCMResolutionScale* qm = NULL;
WebRtc_Word32 ret = _qmResolution->SelectResolution(&qm);
int32_t ret = _qmResolution->SelectResolution(&qm);
if (ret < 0)
{
return ret;
@ -562,7 +562,7 @@ VCMMediaOptimization::CheckStatusForQMchange()
// (to sample the metrics) from the event lastChangeTime
// lastChangeTime is the time where user changed the size/rate/frame rate
// (via SetEncodingData)
WebRtc_Word64 now = _clock->TimeInMilliseconds();
int64_t now = _clock->TimeInMilliseconds();
if ((now - _lastQMUpdateTime) < kQmMinIntervalMs ||
(now - _lastChangeTime) < kQmMinIntervalMs)
{
@ -614,14 +614,14 @@ bool VCMMediaOptimization::QMUpdate(VCMResolutionScale* qm) {
void
VCMMediaOptimization::UpdateIncomingFrameRate()
{
WebRtc_Word64 now = _clock->TimeInMilliseconds();
int64_t now = _clock->TimeInMilliseconds();
if (_incomingFrameTimes[0] == 0)
{
// first no shift
} else
{
// shift
for(WebRtc_Word32 i = (kFrameCountHistorySize - 2); i >= 0 ; i--)
for(int32_t i = (kFrameCountHistorySize - 2); i >= 0 ; i--)
{
_incomingFrameTimes[i+1] = _incomingFrameTimes[i];
}
@ -632,10 +632,10 @@ VCMMediaOptimization::UpdateIncomingFrameRate()
// allowing VCM to keep track of incoming frame rate
void
VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now)
VCMMediaOptimization::ProcessIncomingFrameRate(int64_t now)
{
WebRtc_Word32 num = 0;
WebRtc_Word32 nrOfFrames = 0;
int32_t num = 0;
int32_t nrOfFrames = 0;
for (num = 1; num < (kFrameCountHistorySize - 1); num++)
{
if (_incomingFrameTimes[num] <= 0 ||
@ -650,7 +650,7 @@ VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now)
}
if (num > 1)
{
const WebRtc_Word64 diff = now - _incomingFrameTimes[num-1];
const int64_t diff = now - _incomingFrameTimes[num-1];
_incomingFrameRate = 1.0;
if(diff >0)
{
@ -659,11 +659,11 @@ VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now)
}
}
WebRtc_UWord32
uint32_t
VCMMediaOptimization::InputFrameRate()
{
ProcessIncomingFrameRate(_clock->TimeInMilliseconds());
return WebRtc_UWord32 (_incomingFrameRate + 0.5f);
return uint32_t (_incomingFrameRate + 0.5f);
}
} // namespace media_optimization

View File

@ -45,12 +45,12 @@ struct VCMEncodedFrameSample {
class VCMMediaOptimization
{
public:
VCMMediaOptimization(WebRtc_Word32 id, Clock* clock);
VCMMediaOptimization(int32_t id, Clock* clock);
~VCMMediaOptimization(void);
/*
* Reset the Media Optimization module
*/
WebRtc_Word32 Reset();
int32_t Reset();
/**
* Set target Rates for the encoder given the channel parameters
* Inputs: target bitrate - the encoder target bitrate in bits/s.
@ -59,19 +59,19 @@ public:
* minBitRate - the bit rate of the end-point with lowest rate
* maxBitRate - the bit rate of the end-point with highest rate
*/
WebRtc_UWord32 SetTargetRates(WebRtc_UWord32 target_bitrate,
WebRtc_UWord8 &fractionLost,
WebRtc_UWord32 roundTripTimeMs);
uint32_t SetTargetRates(uint32_t target_bitrate,
uint8_t &fractionLost,
uint32_t roundTripTimeMs);
/**
* Inform media optimization of initial encoding state
*/
WebRtc_Word32 SetEncodingData(VideoCodecType sendCodecType,
WebRtc_Word32 maxBitRate,
WebRtc_UWord32 frameRate,
WebRtc_UWord32 bitRate,
WebRtc_UWord16 width,
WebRtc_UWord16 height,
int32_t SetEncodingData(VideoCodecType sendCodecType,
int32_t maxBitRate,
uint32_t frameRate,
uint32_t bitRate,
uint16_t width,
uint16_t height,
int numTemporalLayers);
/**
* Enable protection method
@ -84,11 +84,11 @@ public:
/**
* Updates the max pay load size
*/
void SetMtu(WebRtc_Word32 mtu);
void SetMtu(int32_t mtu);
/*
* Get actual input frame rate
*/
WebRtc_UWord32 InputFrameRate();
uint32_t InputFrameRate();
/*
* Get actual sent frame rate
@ -101,23 +101,23 @@ public:
/*
* Get maximum allowed bit rate
*/
WebRtc_Word32 MaxBitRate();
int32_t MaxBitRate();
/*
* Inform Media Optimization of encoding output: Length and frame type
*/
WebRtc_Word32 UpdateWithEncodedData(int encodedLength,
int32_t UpdateWithEncodedData(int encodedLength,
uint32_t timestamp,
FrameType encodedFrameType);
/*
* Register a protection callback to be used to inform the user about the
* protection methods used
*/
WebRtc_Word32 RegisterProtectionCallback(VCMProtectionCallback*
int32_t RegisterProtectionCallback(VCMProtectionCallback*
protectionCallback);
/*
* Register a quality settings callback to be used to inform VPM/user about
*/
WebRtc_Word32 RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings);
int32_t RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings);
void EnableFrameDropper(bool enable);
bool DropFrame();
@ -125,7 +125,7 @@ public:
/*
* Get number of key/delta frames encoded
*/
WebRtc_Word32 SentFrameCount(VCMFrameCount &frameCount) const;
int32_t SentFrameCount(VCMFrameCount &frameCount) const;
/*
* update incoming frame rate value
@ -140,7 +140,7 @@ public:
/**
* Compute new Quality Mode
*/
WebRtc_Word32 SelectQuality();
int32_t SelectQuality();
private:
typedef std::list<VCMEncodedFrameSample> FrameSampleList;
@ -168,31 +168,31 @@ private:
*/
bool CheckStatusForQMchange();
void ProcessIncomingFrameRate(WebRtc_Word64 now);
void ProcessIncomingFrameRate(int64_t now);
enum { kFrameCountHistorySize = 90};
enum { kFrameHistoryWinMs = 2000};
WebRtc_Word32 _id;
int32_t _id;
Clock* _clock;
WebRtc_Word32 _maxBitRate;
int32_t _maxBitRate;
VideoCodecType _sendCodecType;
WebRtc_UWord16 _codecWidth;
WebRtc_UWord16 _codecHeight;
uint16_t _codecWidth;
uint16_t _codecHeight;
float _userFrameRate;
FrameDropper* _frameDropper;
VCMLossProtectionLogic* _lossProtLogic;
WebRtc_UWord8 _fractionLost;
uint8_t _fractionLost;
WebRtc_UWord32 _sendStatistics[4];
WebRtc_UWord32 _sendStatisticsZeroEncode;
WebRtc_Word32 _maxPayloadSize;
WebRtc_UWord32 _targetBitRate;
uint32_t _sendStatistics[4];
uint32_t _sendStatisticsZeroEncode;
int32_t _maxPayloadSize;
uint32_t _targetBitRate;
float _incomingFrameRate;
WebRtc_Word64 _incomingFrameTimes[kFrameCountHistorySize];
int64_t _incomingFrameTimes[kFrameCountHistorySize];
bool _enableQm;
@ -203,14 +203,14 @@ private:
uint32_t _avgSentBitRateBps;
uint32_t _avgSentFramerate;
WebRtc_UWord32 _keyFrameCnt;
WebRtc_UWord32 _deltaFrameCnt;
uint32_t _keyFrameCnt;
uint32_t _deltaFrameCnt;
VCMContentMetricsProcessing* _content;
VCMQmResolution* _qmResolution;
WebRtc_Word64 _lastQMUpdateTime;
WebRtc_Word64 _lastChangeTime; // content/user triggered
int64_t _lastQMUpdateTime;
int64_t _lastChangeTime; // content/user triggered
int _numLayers;

View File

@ -18,7 +18,7 @@ namespace webrtc
// Table values are built as a sigmoid function, ranging from 0 to
// kHighRttNackMs (100), based on the HybridNackTH values defined in
// media_opt_util.h.
const WebRtc_UWord16 VCMNackFecTable[100] = {
const uint16_t VCMNackFecTable[100] = {
0,
0,
0,

View File

@ -31,8 +31,8 @@ VCMPacket::VCMPacket()
codecSpecificHeader() {
}
VCMPacket::VCMPacket(const WebRtc_UWord8* ptr,
const WebRtc_UWord32 size,
VCMPacket::VCMPacket(const uint8_t* ptr,
const uint32_t size,
const WebRtcRTPHeader& rtpHeader) :
payloadType(rtpHeader.header.payloadType),
timestamp(rtpHeader.header.timestamp),
@ -51,7 +51,7 @@ VCMPacket::VCMPacket(const WebRtc_UWord8* ptr,
CopyCodecSpecifics(rtpHeader.type.Video);
}
VCMPacket::VCMPacket(const WebRtc_UWord8* ptr, WebRtc_UWord32 size, WebRtc_UWord16 seq, WebRtc_UWord32 ts, bool mBit) :
VCMPacket::VCMPacket(const uint8_t* ptr, uint32_t size, uint16_t seq, uint32_t ts, bool mBit) :
payloadType(0),
timestamp(ts),
seqNum(seq),

View File

@ -22,22 +22,22 @@ class VCMPacket
{
public:
VCMPacket();
VCMPacket(const WebRtc_UWord8* ptr,
const WebRtc_UWord32 size,
VCMPacket(const uint8_t* ptr,
const uint32_t size,
const WebRtcRTPHeader& rtpHeader);
VCMPacket(const WebRtc_UWord8* ptr,
WebRtc_UWord32 size,
WebRtc_UWord16 seqNum,
WebRtc_UWord32 timestamp,
VCMPacket(const uint8_t* ptr,
uint32_t size,
uint16_t seqNum,
uint32_t timestamp,
bool markerBit);
void Reset();
WebRtc_UWord8 payloadType;
WebRtc_UWord32 timestamp;
WebRtc_UWord16 seqNum;
const WebRtc_UWord8* dataPtr;
WebRtc_UWord32 sizeBytes;
uint8_t payloadType;
uint32_t timestamp;
uint16_t seqNum;
const uint8_t* dataPtr;
uint32_t sizeBytes;
bool markerBit;
FrameType frameType;

View File

@ -18,7 +18,7 @@
namespace webrtc {
VCMRttFilter::VCMRttFilter(WebRtc_Word32 vcmId, WebRtc_Word32 receiverId)
VCMRttFilter::VCMRttFilter(int32_t vcmId, int32_t receiverId)
:
_vcmId(vcmId),
_receiverId(receiverId),
@ -63,7 +63,7 @@ VCMRttFilter::Reset()
}
void
VCMRttFilter::Update(WebRtc_UWord32 rttMs)
VCMRttFilter::Update(uint32_t rttMs)
{
if (!_gotNonZeroUpdate)
{
@ -111,7 +111,7 @@ VCMRttFilter::Update(WebRtc_UWord32 rttMs)
}
bool
VCMRttFilter::JumpDetection(WebRtc_UWord32 rttMs)
VCMRttFilter::JumpDetection(uint32_t rttMs)
{
double diffFromAvg = _avgRtt - rttMs;
if (abs(diffFromAvg) > _jumpStdDevs * sqrt(_varRtt))
@ -157,7 +157,7 @@ VCMRttFilter::JumpDetection(WebRtc_UWord32 rttMs)
}
bool
VCMRttFilter::DriftDetection(WebRtc_UWord32 rttMs)
VCMRttFilter::DriftDetection(uint32_t rttMs)
{
if (_maxRtt - _avgRtt > _driftStdDevs * sqrt(_varRtt))
{
@ -186,7 +186,7 @@ VCMRttFilter::DriftDetection(WebRtc_UWord32 rttMs)
}
void
VCMRttFilter::ShortRttFilter(WebRtc_UWord32* buf, WebRtc_UWord32 length)
VCMRttFilter::ShortRttFilter(uint32_t* buf, uint32_t length)
{
if (length == 0)
{
@ -194,7 +194,7 @@ VCMRttFilter::ShortRttFilter(WebRtc_UWord32* buf, WebRtc_UWord32 length)
}
_maxRtt = 0;
_avgRtt = 0;
for (WebRtc_UWord32 i=0; i < length; i++)
for (uint32_t i=0; i < length; i++)
{
if (buf[i] > _maxRtt)
{
@ -205,10 +205,10 @@ VCMRttFilter::ShortRttFilter(WebRtc_UWord32* buf, WebRtc_UWord32 length)
_avgRtt = _avgRtt / static_cast<double>(length);
}
WebRtc_UWord32
uint32_t
VCMRttFilter::RttMs() const
{
return static_cast<WebRtc_UWord32>(_maxRtt + 0.5);
return static_cast<uint32_t>(_maxRtt + 0.5);
}
}

View File

@ -19,16 +19,16 @@ namespace webrtc
class VCMRttFilter
{
public:
VCMRttFilter(WebRtc_Word32 vcmId = 0, WebRtc_Word32 receiverId = 0);
VCMRttFilter(int32_t vcmId = 0, int32_t receiverId = 0);
VCMRttFilter& operator=(const VCMRttFilter& rhs);
// Resets the filter.
void Reset();
// Updates the filter with a new sample.
void Update(WebRtc_UWord32 rttMs);
void Update(uint32_t rttMs);
// A getter function for the current RTT level in ms.
WebRtc_UWord32 RttMs() const;
uint32_t RttMs() const;
private:
// The size of the drift and jump memory buffers
@ -39,30 +39,30 @@ private:
// samples and average to the standard deviation.
// Returns true if the long time statistics should be updated
// and false otherwise
bool JumpDetection(WebRtc_UWord32 rttMs);
bool JumpDetection(uint32_t rttMs);
// Detects RTT drifts by comparing the difference between
// max and average to the standard deviation.
// Returns true if the long time statistics should be updated
// and false otherwise
bool DriftDetection(WebRtc_UWord32 rttMs);
bool DriftDetection(uint32_t rttMs);
// Computes the short time average and maximum of the vector buf.
void ShortRttFilter(WebRtc_UWord32* buf, WebRtc_UWord32 length);
void ShortRttFilter(uint32_t* buf, uint32_t length);
WebRtc_Word32 _vcmId;
WebRtc_Word32 _receiverId;
int32_t _vcmId;
int32_t _receiverId;
bool _gotNonZeroUpdate;
double _avgRtt;
double _varRtt;
WebRtc_UWord32 _maxRtt;
WebRtc_UWord32 _filtFactCount;
const WebRtc_UWord32 _filtFactMax;
uint32_t _maxRtt;
uint32_t _filtFactCount;
const uint32_t _filtFactMax;
const double _jumpStdDevs;
const double _driftStdDevs;
WebRtc_Word32 _jumpCount;
WebRtc_Word32 _driftCount;
const WebRtc_Word32 _detectThreshold;
WebRtc_UWord32 _jumpBuf[kMaxDriftJumpCount];
WebRtc_UWord32 _driftBuf[kMaxDriftJumpCount];
int32_t _jumpCount;
int32_t _driftCount;
const int32_t _detectThreshold;
uint32_t _jumpBuf[kMaxDriftJumpCount];
uint32_t _driftBuf[kMaxDriftJumpCount];
};
} // namespace webrtc

View File

@ -141,7 +141,7 @@ void VCMSessionInfo::ShiftSubsequentPackets(PacketIterator it,
++it;
if (it == packets_.end())
return;
uint8_t* first_packet_ptr = const_cast<WebRtc_UWord8*>((*it).dataPtr);
uint8_t* first_packet_ptr = const_cast<uint8_t*>((*it).dataPtr);
int shift_length = 0;
// Calculate the total move length and move the data pointers in advance.
for (; it != packets_.end(); ++it) {
@ -236,7 +236,7 @@ int VCMSessionInfo::BuildVP8FragmentationHeader(
fragmentation->VerifyAndAllocateFragmentationHeader(kMaxVP8Partitions);
fragmentation->fragmentationVectorSize = 0;
memset(fragmentation->fragmentationLength, 0,
kMaxVP8Partitions * sizeof(WebRtc_UWord32));
kMaxVP8Partitions * sizeof(uint32_t));
if (packets_.empty())
return new_length;
PacketIterator it = FindNextPartitionBeginning(packets_.begin(),
@ -248,11 +248,11 @@ int VCMSessionInfo::BuildVP8FragmentationHeader(
fragmentation->fragmentationOffset[partition_id] =
(*it).dataPtr - frame_buffer;
assert(fragmentation->fragmentationOffset[partition_id] <
static_cast<WebRtc_UWord32>(frame_buffer_length));
static_cast<uint32_t>(frame_buffer_length));
fragmentation->fragmentationLength[partition_id] =
(*partition_end).dataPtr + (*partition_end).sizeBytes - (*it).dataPtr;
assert(fragmentation->fragmentationLength[partition_id] <=
static_cast<WebRtc_UWord32>(frame_buffer_length));
static_cast<uint32_t>(frame_buffer_length));
new_length += fragmentation->fragmentationLength[partition_id];
++partition_end;
it = FindNextPartitionBeginning(partition_end, &packets_not_decodable_);
@ -319,7 +319,7 @@ bool VCMSessionInfo::InSequence(const PacketIterator& packet_it,
// If the two iterators are pointing to the same packet they are considered
// to be in sequence.
return (packet_it == prev_packet_it ||
(static_cast<WebRtc_UWord16>((*prev_packet_it).seqNum + 1) ==
(static_cast<uint16_t>((*prev_packet_it).seqNum + 1) ==
(*packet_it).seqNum));
}

View File

@ -16,8 +16,8 @@
namespace webrtc {
VCMTimestampExtrapolator::VCMTimestampExtrapolator(Clock* clock,
WebRtc_Word32 vcmId,
WebRtc_Word32 id)
int32_t vcmId,
int32_t id)
:
_rwLock(RWLockWrapper::CreateRWLock()),
_vcmId(vcmId),
@ -47,7 +47,7 @@ VCMTimestampExtrapolator::~VCMTimestampExtrapolator()
}
void
VCMTimestampExtrapolator::Reset(const WebRtc_Word64 nowMs /* = -1 */)
VCMTimestampExtrapolator::Reset(const int64_t nowMs /* = -1 */)
{
WriteLockScoped wl(*_rwLock);
if (nowMs > -1)
@ -74,7 +74,7 @@ VCMTimestampExtrapolator::Reset(const WebRtc_Word64 nowMs /* = -1 */)
}
void
VCMTimestampExtrapolator::Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool trace)
VCMTimestampExtrapolator::Update(int64_t tMs, uint32_t ts90khz, bool trace)
{
_rwLock->AcquireLockExclusive();
@ -94,9 +94,9 @@ VCMTimestampExtrapolator::Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool
// Remove offset to prevent badly scaled matrices
tMs -= _startMs;
WebRtc_Word32 prevWrapArounds = _wrapArounds;
int32_t prevWrapArounds = _wrapArounds;
CheckForWrapArounds(ts90khz);
WebRtc_Word32 wrapAroundsSincePrev = _wrapArounds - prevWrapArounds;
int32_t wrapAroundsSincePrev = _wrapArounds - prevWrapArounds;
if (wrapAroundsSincePrev == 0 && ts90khz < _prevTs90khz)
{
@ -115,7 +115,7 @@ VCMTimestampExtrapolator::Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool
}
// Compensate for wraparounds by changing the line offset
_w[1] = _w[1] - wrapAroundsSincePrev * ((static_cast<WebRtc_Word64>(1)<<32) - 1);
_w[1] = _w[1] - wrapAroundsSincePrev * ((static_cast<int64_t>(1)<<32) - 1);
double residual = (static_cast<double>(ts90khz) - _firstTimestamp) - static_cast<double>(tMs) * _w[0] - _w[1];
if (DelayChangeDetection(residual, trace) &&
@ -156,38 +156,38 @@ VCMTimestampExtrapolator::Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool
_rwLock->ReleaseLockExclusive();
}
WebRtc_UWord32
VCMTimestampExtrapolator::ExtrapolateTimestamp(WebRtc_Word64 tMs) const
uint32_t
VCMTimestampExtrapolator::ExtrapolateTimestamp(int64_t tMs) const
{
ReadLockScoped rl(*_rwLock);
WebRtc_UWord32 timestamp = 0;
uint32_t timestamp = 0;
if (_packetCount == 0)
{
timestamp = 0;
}
else if (_packetCount < _startUpFilterDelayInPackets)
{
timestamp = static_cast<WebRtc_UWord32>(90.0 * (tMs - _prevMs) + _prevTs90khz + 0.5);
timestamp = static_cast<uint32_t>(90.0 * (tMs - _prevMs) + _prevTs90khz + 0.5);
}
else
{
timestamp = static_cast<WebRtc_UWord32>(_w[0] * (tMs - _startMs) + _w[1] + _firstTimestamp + 0.5);
timestamp = static_cast<uint32_t>(_w[0] * (tMs - _startMs) + _w[1] + _firstTimestamp + 0.5);
}
return timestamp;
}
WebRtc_Word64
VCMTimestampExtrapolator::ExtrapolateLocalTime(WebRtc_UWord32 timestamp90khz) const
int64_t
VCMTimestampExtrapolator::ExtrapolateLocalTime(uint32_t timestamp90khz) const
{
ReadLockScoped rl(*_rwLock);
WebRtc_Word64 localTimeMs = 0;
int64_t localTimeMs = 0;
if (_packetCount == 0)
{
localTimeMs = -1;
}
else if (_packetCount < _startUpFilterDelayInPackets)
{
localTimeMs = _prevMs + static_cast<WebRtc_Word64>(static_cast<double>(timestamp90khz - _prevTs90khz) / 90.0 + 0.5);
localTimeMs = _prevMs + static_cast<int64_t>(static_cast<double>(timestamp90khz - _prevTs90khz) / 90.0 + 0.5);
}
else
{
@ -198,7 +198,7 @@ VCMTimestampExtrapolator::ExtrapolateLocalTime(WebRtc_UWord32 timestamp90khz) co
else
{
double timestampDiff = static_cast<double>(timestamp90khz) - static_cast<double>(_firstTimestamp);
localTimeMs = static_cast<WebRtc_Word64>(static_cast<double>(_startMs) + (timestampDiff - _w[1]) / _w[0] + 0.5);
localTimeMs = static_cast<int64_t>(static_cast<double>(_startMs) + (timestampDiff - _w[1]) / _w[0] + 0.5);
}
}
return localTimeMs;
@ -207,7 +207,7 @@ VCMTimestampExtrapolator::ExtrapolateLocalTime(WebRtc_UWord32 timestamp90khz) co
// Investigates if the timestamp clock has overflowed since the last timestamp and
// keeps track of the number of wrap arounds since reset.
void
VCMTimestampExtrapolator::CheckForWrapArounds(WebRtc_UWord32 ts90khz)
VCMTimestampExtrapolator::CheckForWrapArounds(uint32_t ts90khz)
{
if (_prevTs90khz == 0)
{
@ -219,7 +219,7 @@ VCMTimestampExtrapolator::CheckForWrapArounds(WebRtc_UWord32 ts90khz)
// This difference will probably be less than -2^31 if we have had a wrap around
// (e.g. timestamp = 1, _previousTimestamp = 2^32 - 1). Since it is casted to a Word32,
// it should be positive.
if (static_cast<WebRtc_Word32>(ts90khz - _prevTs90khz) > 0)
if (static_cast<int32_t>(ts90khz - _prevTs90khz) > 0)
{
// Forward wrap around
_wrapArounds++;
@ -227,7 +227,7 @@ VCMTimestampExtrapolator::CheckForWrapArounds(WebRtc_UWord32 ts90khz)
}
// This difference will probably be less than -2^31 if we have had a backward wrap around.
// Since it is casted to a Word32, it should be positive.
else if (static_cast<WebRtc_Word32>(_prevTs90khz - ts90khz) > 0)
else if (static_cast<int32_t>(_prevTs90khz - ts90khz) > 0)
{
// Backward wrap around
_wrapArounds--;

View File

@ -23,32 +23,32 @@ class VCMTimestampExtrapolator
{
public:
VCMTimestampExtrapolator(Clock* clock,
WebRtc_Word32 vcmId = 0,
WebRtc_Word32 receiverId = 0);
int32_t vcmId = 0,
int32_t receiverId = 0);
~VCMTimestampExtrapolator();
void Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool trace = true);
WebRtc_UWord32 ExtrapolateTimestamp(WebRtc_Word64 tMs) const;
WebRtc_Word64 ExtrapolateLocalTime(WebRtc_UWord32 timestamp90khz) const;
void Reset(WebRtc_Word64 nowMs = -1);
void Update(int64_t tMs, uint32_t ts90khz, bool trace = true);
uint32_t ExtrapolateTimestamp(int64_t tMs) const;
int64_t ExtrapolateLocalTime(uint32_t timestamp90khz) const;
void Reset(int64_t nowMs = -1);
private:
void CheckForWrapArounds(WebRtc_UWord32 ts90khz);
void CheckForWrapArounds(uint32_t ts90khz);
bool DelayChangeDetection(double error, bool trace = true);
RWLockWrapper* _rwLock;
WebRtc_Word32 _vcmId;
WebRtc_Word32 _id;
int32_t _vcmId;
int32_t _id;
Clock* _clock;
double _w[2];
double _P[2][2];
WebRtc_Word64 _startMs;
WebRtc_Word64 _prevMs;
WebRtc_UWord32 _firstTimestamp;
WebRtc_Word32 _wrapArounds;
WebRtc_UWord32 _prevTs90khz;
int64_t _startMs;
int64_t _prevMs;
uint32_t _firstTimestamp;
int32_t _wrapArounds;
uint32_t _prevTs90khz;
const double _lambda;
bool _firstAfterReset;
WebRtc_UWord32 _packetCount;
const WebRtc_UWord32 _startUpFilterDelayInPackets;
uint32_t _packetCount;
const uint32_t _startUpFilterDelayInPackets;
double _detectorAccumulatorPos;
double _detectorAccumulatorNeg;

View File

@ -16,7 +16,7 @@ namespace webrtc {
// Constructor. Optional parameter specifies maximum number of
// coexisting timers.
VCMTimestampMap::VCMTimestampMap(WebRtc_Word32 length):
VCMTimestampMap::VCMTimestampMap(int32_t length):
_nextAddIx(0),
_nextPopIx(0)
{
@ -44,8 +44,8 @@ VCMTimestampMap::Reset()
_nextPopIx = 0;
}
WebRtc_Word32
VCMTimestampMap::Add(WebRtc_UWord32 timestamp, void* data)
int32_t
VCMTimestampMap::Add(uint32_t timestamp, void* data)
{
_map[_nextAddIx].timestamp = timestamp;
_map[_nextAddIx].data = data;
@ -61,7 +61,7 @@ VCMTimestampMap::Add(WebRtc_UWord32 timestamp, void* data)
}
void*
VCMTimestampMap::Pop(WebRtc_UWord32 timestamp)
VCMTimestampMap::Pop(uint32_t timestamp)
{
while (!IsEmpty())
{

View File

@ -18,7 +18,7 @@ namespace webrtc
struct VCMTimestampDataTuple
{
WebRtc_UWord32 timestamp;
uint32_t timestamp;
void* data;
};
@ -27,7 +27,7 @@ class VCMTimestampMap
public:
// Constructor. Optional parameter specifies maximum number of
// timestamps in map.
VCMTimestampMap(const WebRtc_Word32 length = 10);
VCMTimestampMap(const int32_t length = 10);
// Destructor.
~VCMTimestampMap();
@ -35,16 +35,16 @@ public:
// Empty the map
void Reset();
WebRtc_Word32 Add(WebRtc_UWord32 timestamp, void* data);
void* Pop(WebRtc_UWord32 timestamp);
int32_t Add(uint32_t timestamp, void* data);
void* Pop(uint32_t timestamp);
private:
bool IsEmpty() const;
VCMTimestampDataTuple* _map;
WebRtc_Word32 _nextAddIx;
WebRtc_Word32 _nextPopIx;
WebRtc_Word32 _length;
int32_t _nextAddIx;
int32_t _nextPopIx;
int32_t _length;
};
} // namespace webrtc

View File

@ -19,8 +19,8 @@
namespace webrtc {
VCMTiming::VCMTiming(Clock* clock,
WebRtc_Word32 vcmId,
WebRtc_Word32 timingId,
int32_t vcmId,
int32_t timingId,
VCMTiming* masterTiming)
:
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
@ -58,7 +58,7 @@ VCMTiming::~VCMTiming()
}
void
VCMTiming::Reset(WebRtc_Word64 nowMs /* = -1 */)
VCMTiming::Reset(int64_t nowMs /* = -1 */)
{
CriticalSectionScoped cs(_critSect);
if (nowMs > -1)
@ -83,21 +83,21 @@ void VCMTiming::ResetDecodeTime()
}
void
VCMTiming::SetRenderDelay(WebRtc_UWord32 renderDelayMs)
VCMTiming::SetRenderDelay(uint32_t renderDelayMs)
{
CriticalSectionScoped cs(_critSect);
_renderDelayMs = renderDelayMs;
}
void
VCMTiming::SetMinimumTotalDelay(WebRtc_UWord32 minTotalDelayMs)
VCMTiming::SetMinimumTotalDelay(uint32_t minTotalDelayMs)
{
CriticalSectionScoped cs(_critSect);
_minTotalDelayMs = minTotalDelayMs;
}
void
VCMTiming::SetRequiredDelay(WebRtc_UWord32 requiredDelayMs)
VCMTiming::SetRequiredDelay(uint32_t requiredDelayMs)
{
CriticalSectionScoped cs(_critSect);
if (requiredDelayMs != _requiredDelayMs)
@ -111,10 +111,10 @@ VCMTiming::SetRequiredDelay(WebRtc_UWord32 requiredDelayMs)
}
}
void VCMTiming::UpdateCurrentDelay(WebRtc_UWord32 frameTimestamp)
void VCMTiming::UpdateCurrentDelay(uint32_t frameTimestamp)
{
CriticalSectionScoped cs(_critSect);
WebRtc_UWord32 targetDelayMs = TargetDelayInternal();
uint32_t targetDelayMs = TargetDelayInternal();
// Make sure we try to sync with audio
if (targetDelayMs < _minTotalDelayMs)
@ -129,19 +129,19 @@ void VCMTiming::UpdateCurrentDelay(WebRtc_UWord32 frameTimestamp)
}
else if (targetDelayMs != _currentDelayMs)
{
WebRtc_Word64 delayDiffMs = static_cast<WebRtc_Word64>(targetDelayMs) -
int64_t delayDiffMs = static_cast<int64_t>(targetDelayMs) -
_currentDelayMs;
// Never change the delay with more than 100 ms every second. If we're changing the
// delay in too large steps we will get noticeable freezes. By limiting the change we
// can increase the delay in smaller steps, which will be experienced as the video is
// played in slow motion. When lowering the delay the video will be played at a faster
// pace.
WebRtc_Word64 maxChangeMs = 0;
int64_t maxChangeMs = 0;
if (frameTimestamp < 0x0000ffff && _prevFrameTimestamp > 0xffff0000)
{
// wrap
maxChangeMs = kDelayMaxChangeMsPerS * (frameTimestamp +
(static_cast<WebRtc_Word64>(1)<<32) - _prevFrameTimestamp) / 90000;
(static_cast<int64_t>(1)<<32) - _prevFrameTimestamp) / 90000;
}
else
{
@ -163,22 +163,22 @@ void VCMTiming::UpdateCurrentDelay(WebRtc_UWord32 frameTimestamp)
{
delayDiffMs = maxChangeMs;
}
_currentDelayMs = _currentDelayMs + static_cast<WebRtc_Word32>(delayDiffMs);
_currentDelayMs = _currentDelayMs + static_cast<int32_t>(delayDiffMs);
}
_prevFrameTimestamp = frameTimestamp;
}
void VCMTiming::UpdateCurrentDelay(WebRtc_Word64 renderTimeMs,
WebRtc_Word64 actualDecodeTimeMs)
void VCMTiming::UpdateCurrentDelay(int64_t renderTimeMs,
int64_t actualDecodeTimeMs)
{
CriticalSectionScoped cs(_critSect);
WebRtc_UWord32 targetDelayMs = TargetDelayInternal();
uint32_t targetDelayMs = TargetDelayInternal();
// Make sure we try to sync with audio
if (targetDelayMs < _minTotalDelayMs)
{
targetDelayMs = _minTotalDelayMs;
}
WebRtc_Word64 delayedMs = actualDecodeTimeMs -
int64_t delayedMs = actualDecodeTimeMs -
(renderTimeMs - MaxDecodeTimeMs() - _renderDelayMs);
if (delayedMs < 0)
{
@ -186,7 +186,7 @@ void VCMTiming::UpdateCurrentDelay(WebRtc_Word64 renderTimeMs,
}
else if (_currentDelayMs + delayedMs <= targetDelayMs)
{
_currentDelayMs += static_cast<WebRtc_UWord32>(delayedMs);
_currentDelayMs += static_cast<uint32_t>(delayedMs);
}
else
{
@ -194,14 +194,14 @@ void VCMTiming::UpdateCurrentDelay(WebRtc_Word64 renderTimeMs,
}
}
WebRtc_Word32
VCMTiming::StopDecodeTimer(WebRtc_UWord32 timeStamp,
WebRtc_Word64 startTimeMs,
WebRtc_Word64 nowMs)
int32_t
VCMTiming::StopDecodeTimer(uint32_t timeStamp,
int64_t startTimeMs,
int64_t nowMs)
{
CriticalSectionScoped cs(_critSect);
const WebRtc_Word32 maxDecTime = MaxDecodeTimeMs();
WebRtc_Word32 timeDiffMs = _codecTimer.StopTimer(startTimeMs, nowMs);
const int32_t maxDecTime = MaxDecodeTimeMs();
int32_t timeDiffMs = _codecTimer.StopTimer(startTimeMs, nowMs);
if (timeDiffMs < 0)
{
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding, VCMId(_vcmId, _timingId),
@ -219,17 +219,17 @@ VCMTiming::StopDecodeTimer(WebRtc_UWord32 timeStamp,
}
void
VCMTiming::IncomingTimestamp(WebRtc_UWord32 timeStamp, WebRtc_Word64 nowMs)
VCMTiming::IncomingTimestamp(uint32_t timeStamp, int64_t nowMs)
{
CriticalSectionScoped cs(_critSect);
_tsExtrapolator->Update(nowMs, timeStamp, _master);
}
WebRtc_Word64
VCMTiming::RenderTimeMs(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 nowMs) const
int64_t
VCMTiming::RenderTimeMs(uint32_t frameTimestamp, int64_t nowMs) const
{
CriticalSectionScoped cs(_critSect);
const WebRtc_Word64 renderTimeMs = RenderTimeMsInternal(frameTimestamp, nowMs);
const int64_t renderTimeMs = RenderTimeMsInternal(frameTimestamp, nowMs);
if (renderTimeMs < 0)
{
return renderTimeMs;
@ -245,10 +245,10 @@ VCMTiming::RenderTimeMs(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 nowMs) cons
return renderTimeMs;
}
WebRtc_Word64
VCMTiming::RenderTimeMsInternal(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 nowMs) const
int64_t
VCMTiming::RenderTimeMsInternal(uint32_t frameTimestamp, int64_t nowMs) const
{
WebRtc_Word64 estimatedCompleteTimeMs =
int64_t estimatedCompleteTimeMs =
_tsExtrapolator->ExtrapolateLocalTime(frameTimestamp);
if (estimatedCompleteTimeMs - nowMs > _maxVideoDelayMs)
{
@ -275,10 +275,10 @@ VCMTiming::RenderTimeMsInternal(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 now
}
// Must be called from inside a critical section
WebRtc_Word32
int32_t
VCMTiming::MaxDecodeTimeMs(FrameType frameType /*= kVideoFrameDelta*/) const
{
const WebRtc_Word32 decodeTimeMs = _codecTimer.RequiredDecodeTimeMs(frameType);
const int32_t decodeTimeMs = _codecTimer.RequiredDecodeTimeMs(frameType);
if (decodeTimeMs < 0)
{
@ -289,26 +289,26 @@ VCMTiming::MaxDecodeTimeMs(FrameType frameType /*= kVideoFrameDelta*/) const
return decodeTimeMs;
}
WebRtc_UWord32
VCMTiming::MaxWaitingTime(WebRtc_Word64 renderTimeMs, WebRtc_Word64 nowMs) const
uint32_t
VCMTiming::MaxWaitingTime(int64_t renderTimeMs, int64_t nowMs) const
{
CriticalSectionScoped cs(_critSect);
const WebRtc_Word64 maxWaitTimeMs = renderTimeMs - nowMs -
const int64_t maxWaitTimeMs = renderTimeMs - nowMs -
MaxDecodeTimeMs() - _renderDelayMs;
if (maxWaitTimeMs < 0)
{
return 0;
}
return static_cast<WebRtc_UWord32>(maxWaitTimeMs);
return static_cast<uint32_t>(maxWaitTimeMs);
}
bool
VCMTiming::EnoughTimeToDecode(WebRtc_UWord32 availableProcessingTimeMs) const
VCMTiming::EnoughTimeToDecode(uint32_t availableProcessingTimeMs) const
{
CriticalSectionScoped cs(_critSect);
WebRtc_Word32 maxDecodeTimeMs = MaxDecodeTimeMs();
int32_t maxDecodeTimeMs = MaxDecodeTimeMs();
if (maxDecodeTimeMs < 0)
{
// Haven't decoded any frames yet, try decoding one to get an estimate
@ -321,7 +321,7 @@ VCMTiming::EnoughTimeToDecode(WebRtc_UWord32 availableProcessingTimeMs) const
// we don't have any better precision. Count ticks later?
maxDecodeTimeMs = 1;
}
return static_cast<WebRtc_Word32>(availableProcessingTimeMs) - maxDecodeTimeMs > 0;
return static_cast<int32_t>(availableProcessingTimeMs) - maxDecodeTimeMs > 0;
}
void VCMTiming::SetMaxVideoDelay(int maxVideoDelayMs)
@ -330,14 +330,14 @@ void VCMTiming::SetMaxVideoDelay(int maxVideoDelayMs)
_maxVideoDelayMs = maxVideoDelayMs;
}
WebRtc_UWord32
uint32_t
VCMTiming::TargetVideoDelay() const
{
CriticalSectionScoped cs(_critSect);
return TargetDelayInternal();
}
WebRtc_UWord32
uint32_t
VCMTiming::TargetDelayInternal() const
{
return _requiredDelayMs + MaxDecodeTimeMs() + _renderDelayMs;

View File

@ -27,60 +27,60 @@ public:
// The primary timing component should be passed
// if this is the dual timing component.
VCMTiming(Clock* clock,
WebRtc_Word32 vcmId = 0,
WebRtc_Word32 timingId = 0,
int32_t vcmId = 0,
int32_t timingId = 0,
VCMTiming* masterTiming = NULL);
~VCMTiming();
// Resets the timing to the initial state.
void Reset(WebRtc_Word64 nowMs = -1);
void Reset(int64_t nowMs = -1);
void ResetDecodeTime();
// The amount of time needed to render an image. Defaults to 10 ms.
void SetRenderDelay(WebRtc_UWord32 renderDelayMs);
void SetRenderDelay(uint32_t renderDelayMs);
// The minimum time the video must be delayed on the receiver to
// get the desired jitter buffer level.
void SetRequiredDelay(WebRtc_UWord32 requiredDelayMs);
void SetRequiredDelay(uint32_t requiredDelayMs);
// Minimum total delay required to sync video with audio.
void SetMinimumTotalDelay(WebRtc_UWord32 minTotalDelayMs);
void SetMinimumTotalDelay(uint32_t minTotalDelayMs);
// Increases or decreases the current delay to get closer to the target delay.
// Calculates how long it has been since the previous call to this function,
// and increases/decreases the delay in proportion to the time difference.
void UpdateCurrentDelay(WebRtc_UWord32 frameTimestamp);
void UpdateCurrentDelay(uint32_t frameTimestamp);
// Increases or decreases the current delay to get closer to the target delay.
// Given the actual decode time in ms and the render time in ms for a frame, this
// function calculates how late the frame is and increases the delay accordingly.
void UpdateCurrentDelay(WebRtc_Word64 renderTimeMs, WebRtc_Word64 actualDecodeTimeMs);
void UpdateCurrentDelay(int64_t renderTimeMs, int64_t actualDecodeTimeMs);
// Stops the decoder timer, should be called when the decoder returns a frame
// or when the decoded frame callback is called.
WebRtc_Word32 StopDecodeTimer(WebRtc_UWord32 timeStamp,
WebRtc_Word64 startTimeMs,
WebRtc_Word64 nowMs);
int32_t StopDecodeTimer(uint32_t timeStamp,
int64_t startTimeMs,
int64_t nowMs);
// Used to report that a frame is passed to decoding. Updates the timestamp filter
// which is used to map between timestamps and receiver system time.
void IncomingTimestamp(WebRtc_UWord32 timeStamp, WebRtc_Word64 lastPacketTimeMs);
void IncomingTimestamp(uint32_t timeStamp, int64_t lastPacketTimeMs);
// Returns the receiver system time when the frame with timestamp frameTimestamp
// should be rendered, assuming that the system time currently is nowMs.
WebRtc_Word64 RenderTimeMs(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 nowMs) const;
int64_t RenderTimeMs(uint32_t frameTimestamp, int64_t nowMs) const;
// Returns the maximum time in ms that we can wait for a frame to become complete
// before we must pass it to the decoder.
WebRtc_UWord32 MaxWaitingTime(WebRtc_Word64 renderTimeMs, WebRtc_Word64 nowMs) const;
uint32_t MaxWaitingTime(int64_t renderTimeMs, int64_t nowMs) const;
// Returns the current target delay which is required delay + decode time + render
// delay.
WebRtc_UWord32 TargetVideoDelay() const;
uint32_t TargetVideoDelay() const;
// Calculates whether or not there is enough time to decode a frame given a
// certain amount of processing time.
bool EnoughTimeToDecode(WebRtc_UWord32 availableProcessingTimeMs) const;
bool EnoughTimeToDecode(uint32_t availableProcessingTimeMs) const;
// Set the max allowed video delay.
void SetMaxVideoDelay(int maxVideoDelayMs);
@ -89,24 +89,24 @@ public:
enum { kDelayMaxChangeMsPerS = 100 };
protected:
WebRtc_Word32 MaxDecodeTimeMs(FrameType frameType = kVideoFrameDelta) const;
WebRtc_Word64 RenderTimeMsInternal(WebRtc_UWord32 frameTimestamp,
WebRtc_Word64 nowMs) const;
WebRtc_UWord32 TargetDelayInternal() const;
int32_t MaxDecodeTimeMs(FrameType frameType = kVideoFrameDelta) const;
int64_t RenderTimeMsInternal(uint32_t frameTimestamp,
int64_t nowMs) const;
uint32_t TargetDelayInternal() const;
private:
CriticalSectionWrapper* _critSect;
WebRtc_Word32 _vcmId;
int32_t _vcmId;
Clock* _clock;
WebRtc_Word32 _timingId;
int32_t _timingId;
bool _master;
VCMTimestampExtrapolator* _tsExtrapolator;
VCMCodecTimer _codecTimer;
WebRtc_UWord32 _renderDelayMs;
WebRtc_UWord32 _minTotalDelayMs;
WebRtc_UWord32 _requiredDelayMs;
WebRtc_UWord32 _currentDelayMs;
WebRtc_UWord32 _prevFrameTimestamp;
uint32_t _renderDelayMs;
uint32_t _minTotalDelayMs;
uint32_t _requiredDelayMs;
uint32_t _currentDelayMs;
uint32_t _prevFrameTimestamp;
int _maxVideoDelayMs;
};

View File

@ -23,17 +23,17 @@ namespace webrtc
//#define DEBUG_DECODER_BIT_STREAM
WebRtc_UWord32
uint32_t
VCMProcessTimer::Period() const
{
return _periodMs;
}
WebRtc_UWord32
uint32_t
VCMProcessTimer::TimeUntilProcess() const
{
return static_cast<WebRtc_UWord32>(
VCM_MAX(static_cast<WebRtc_Word64>(_periodMs) -
return static_cast<uint32_t>(
VCM_MAX(static_cast<int64_t>(_periodMs) -
(_clock->TimeInMilliseconds() - _latestMs), 0));
}
@ -43,7 +43,7 @@ VCMProcessTimer::Processed()
_latestMs = _clock->TimeInMilliseconds();
}
VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id,
VideoCodingModuleImpl::VideoCodingModuleImpl(const int32_t id,
Clock* clock,
EventFactory* event_factory,
bool owns_event_factory)
@ -113,14 +113,14 @@ VideoCodingModuleImpl::~VideoCodingModuleImpl()
}
VideoCodingModule*
VideoCodingModule::Create(const WebRtc_Word32 id)
VideoCodingModule::Create(const int32_t id)
{
return new VideoCodingModuleImpl(id, Clock::GetRealTimeClock(),
new EventFactoryImpl, true);
}
VideoCodingModule*
VideoCodingModule::Create(const WebRtc_Word32 id, Clock* clock,
VideoCodingModule::Create(const int32_t id, Clock* clock,
EventFactory* event_factory)
{
assert(clock);
@ -137,10 +137,10 @@ VideoCodingModule::Destroy(VideoCodingModule* module)
}
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::Process()
{
WebRtc_Word32 returnValue = VCM_OK;
int32_t returnValue = VCM_OK;
// Receive-side statistics
if (_receiveStatsTimer.TimeUntilProcess() == 0)
@ -148,8 +148,8 @@ VideoCodingModuleImpl::Process()
_receiveStatsTimer.Processed();
if (_receiveStatsCallback != NULL)
{
WebRtc_UWord32 bitRate;
WebRtc_UWord32 frameRate;
uint32_t bitRate;
uint32_t frameRate;
_receiver.ReceiveStatistics(&bitRate, &frameRate);
_receiveStatsCallback->ReceiveStatistics(bitRate, frameRate);
}
@ -161,8 +161,8 @@ VideoCodingModuleImpl::Process()
_sendStatsTimer.Processed();
if (_sendStatsCallback != NULL)
{
WebRtc_UWord32 bitRate;
WebRtc_UWord32 frameRate;
uint32_t bitRate;
uint32_t frameRate;
{
CriticalSectionScoped cs(_sendCritSect);
bitRate = _mediaOpt.SentBitRate();
@ -180,13 +180,13 @@ VideoCodingModuleImpl::Process()
_retransmissionTimer.Processed();
if (_packetRequestCallback != NULL)
{
WebRtc_UWord16 length;
uint16_t length;
{
CriticalSectionScoped cs(_receiveCritSect);
length = max_nack_list_size_;
}
std::vector<uint16_t> nackList(length);
const WebRtc_Word32 ret = NackList(&nackList[0], length);
const int32_t ret = NackList(&nackList[0], length);
if (ret != VCM_OK && returnValue == VCM_OK)
{
returnValue = ret;
@ -204,7 +204,7 @@ VideoCodingModuleImpl::Process()
_keyRequestTimer.Processed();
if (_scheduleKeyRequest && _frameTypeCallback != NULL)
{
const WebRtc_Word32 ret = RequestKeyFrame();
const int32_t ret = RequestKeyFrame();
if (ret != VCM_OK && returnValue == VCM_OK)
{
returnValue = ret;
@ -215,7 +215,7 @@ VideoCodingModuleImpl::Process()
return returnValue;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::Id() const
{
CriticalSectionScoped receiveCs(_receiveCritSect);
@ -226,8 +226,8 @@ VideoCodingModuleImpl::Id() const
}
// Change the unique identifier of this object
WebRtc_Word32
VideoCodingModuleImpl::ChangeUniqueId(const WebRtc_Word32 id)
int32_t
VideoCodingModuleImpl::ChangeUniqueId(const int32_t id)
{
CriticalSectionScoped receiveCs(_receiveCritSect);
{
@ -239,10 +239,10 @@ VideoCodingModuleImpl::ChangeUniqueId(const WebRtc_Word32 id)
// Returns the number of milliseconds until the module wants a worker thread to
// call Process
WebRtc_Word32
int32_t
VideoCodingModuleImpl::TimeUntilNextProcess()
{
WebRtc_UWord32 timeUntilNextProcess = VCM_MIN(
uint32_t timeUntilNextProcess = VCM_MIN(
_receiveStatsTimer.TimeUntilProcess(),
_sendStatsTimer.TimeUntilProcess());
if ((_receiver.NackMode() != kNoNack) ||
@ -260,15 +260,15 @@ VideoCodingModuleImpl::TimeUntilNextProcess()
}
// Get number of supported codecs
WebRtc_UWord8
uint8_t
VideoCodingModule::NumberOfCodecs()
{
return VCMCodecDataBase::NumberOfCodecs();
}
// Get supported codec with id
WebRtc_Word32
VideoCodingModule::Codec(WebRtc_UWord8 listId, VideoCodec* codec)
int32_t
VideoCodingModule::Codec(uint8_t listId, VideoCodec* codec)
{
if (codec == NULL)
{
@ -278,7 +278,7 @@ VideoCodingModule::Codec(WebRtc_UWord8 listId, VideoCodec* codec)
}
// Get supported codec with type
WebRtc_Word32
int32_t
VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec)
{
if (codec == NULL)
@ -293,7 +293,7 @@ VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec)
*/
// Reset send side to initial state - all components
WebRtc_Word32
int32_t
VideoCodingModuleImpl::InitializeSender()
{
CriticalSectionScoped cs(_sendCritSect);
@ -307,10 +307,10 @@ VideoCodingModuleImpl::InitializeSender()
}
// Register the send codec to be used.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterSendCodec(const VideoCodec* sendCodec,
WebRtc_UWord32 numberOfCores,
WebRtc_UWord32 maxPayloadSize)
uint32_t numberOfCores,
uint32_t maxPayloadSize)
{
CriticalSectionScoped cs(_sendCritSect);
if (sendCodec == NULL)
@ -361,7 +361,7 @@ VideoCodingModuleImpl::RegisterSendCodec(const VideoCodec* sendCodec,
}
// Get current send codec
WebRtc_Word32
int32_t
VideoCodingModuleImpl::SendCodec(VideoCodec* currentSendCodec) const
{
CriticalSectionScoped cs(_sendCritSect);
@ -384,9 +384,9 @@ VideoCodingModuleImpl::SendCodec() const
// Register an external decoder object.
// This can not be used together with external decoder callbacks.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterExternalEncoder(VideoEncoder* externalEncoder,
WebRtc_UWord8 payloadType,
uint8_t payloadType,
bool internalSource /*= false*/)
{
CriticalSectionScoped cs(_sendCritSect);
@ -409,9 +409,9 @@ VideoCodingModuleImpl::RegisterExternalEncoder(VideoEncoder* externalEncoder,
}
// Get codec config parameters
WebRtc_Word32
VideoCodingModuleImpl::CodecConfigParameters(WebRtc_UWord8* buffer,
WebRtc_Word32 size)
int32_t
VideoCodingModuleImpl::CodecConfigParameters(uint8_t* buffer,
int32_t size)
{
CriticalSectionScoped cs(_sendCritSect);
if (_encoder != NULL)
@ -446,15 +446,15 @@ int VideoCodingModuleImpl::FrameRate(unsigned int* framerate) const
}
// Set channel parameters
WebRtc_Word32
VideoCodingModuleImpl::SetChannelParameters(WebRtc_UWord32 target_bitrate,
WebRtc_UWord8 lossRate,
WebRtc_UWord32 rtt)
int32_t
VideoCodingModuleImpl::SetChannelParameters(uint32_t target_bitrate,
uint8_t lossRate,
uint32_t rtt)
{
WebRtc_Word32 ret = 0;
int32_t ret = 0;
{
CriticalSectionScoped sendCs(_sendCritSect);
WebRtc_UWord32 targetRate = _mediaOpt.SetTargetRates(target_bitrate,
uint32_t targetRate = _mediaOpt.SetTargetRates(target_bitrate,
lossRate,
rtt);
if (_encoder != NULL)
@ -464,7 +464,7 @@ VideoCodingModuleImpl::SetChannelParameters(WebRtc_UWord32 target_bitrate,
{
return ret;
}
ret = (WebRtc_Word32)_encoder->SetRates(targetRate,
ret = (int32_t)_encoder->SetRates(targetRate,
_mediaOpt.InputFrameRate());
if (ret < 0)
{
@ -479,8 +479,8 @@ VideoCodingModuleImpl::SetChannelParameters(WebRtc_UWord32 target_bitrate,
return VCM_OK;
}
WebRtc_Word32
VideoCodingModuleImpl::SetReceiveChannelParameters(WebRtc_UWord32 rtt)
int32_t
VideoCodingModuleImpl::SetReceiveChannelParameters(uint32_t rtt)
{
CriticalSectionScoped receiveCs(_receiveCritSect);
_receiver.UpdateRtt(rtt);
@ -489,7 +489,7 @@ VideoCodingModuleImpl::SetReceiveChannelParameters(WebRtc_UWord32 rtt)
// Register a transport callback which will be called to deliver the encoded
// buffers
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterTransportCallback(
VCMPacketizationCallback* transport)
{
@ -502,7 +502,7 @@ VideoCodingModuleImpl::RegisterTransportCallback(
// Register video output information callback which will be called to deliver
// information about the video stream produced by the encoder, for instance the
// average frame rate and bit rate.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterSendStatisticsCallback(
VCMSendStatisticsCallback* sendStats)
{
@ -513,7 +513,7 @@ VideoCodingModuleImpl::RegisterSendStatisticsCallback(
// Register a video quality settings callback which will be called when frame
// rate/dimensions need to be updated for video quality optimization
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterVideoQMCallback(
VCMQMSettingsCallback* videoQMSettings)
{
@ -524,7 +524,7 @@ VideoCodingModuleImpl::RegisterVideoQMCallback(
// Register a video protection callback which will be called to deliver the
// requested FEC rate and NACK status (on/off).
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterProtectionCallback(
VCMProtectionCallback* protection)
{
@ -534,7 +534,7 @@ VideoCodingModuleImpl::RegisterProtectionCallback(
}
// Enable or disable a video protection method.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection,
bool enable)
{
@ -672,7 +672,7 @@ VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection,
}
// Add one raw video frame to the encoder, blocking.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::AddVideoFrame(const I420VideoFrame& videoFrame,
const VideoContentMetrics* contentMetrics,
const CodecSpecificInfo* codecSpecificInfo)
@ -700,7 +700,7 @@ VideoCodingModuleImpl::AddVideoFrame(const I420VideoFrame& videoFrame,
else
{
_mediaOpt.UpdateContentData(contentMetrics);
WebRtc_Word32 ret = _encoder->Encode(videoFrame,
int32_t ret = _encoder->Encode(videoFrame,
codecSpecificInfo,
_nextFrameTypes);
if (_encoderInputFile != NULL)
@ -725,7 +725,7 @@ VideoCodingModuleImpl::AddVideoFrame(const I420VideoFrame& videoFrame,
return VCM_OK;
}
WebRtc_Word32 VideoCodingModuleImpl::IntraFrameRequest(int stream_index) {
int32_t VideoCodingModuleImpl::IntraFrameRequest(int stream_index) {
CriticalSectionScoped cs(_sendCritSect);
if (stream_index < 0 ||
static_cast<unsigned int>(stream_index) >= _nextFrameTypes.size()) {
@ -743,7 +743,7 @@ WebRtc_Word32 VideoCodingModuleImpl::IntraFrameRequest(int stream_index) {
return VCM_OK;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::EnableFrameDropper(bool enable)
{
CriticalSectionScoped cs(_sendCritSect);
@ -753,7 +753,7 @@ VideoCodingModuleImpl::EnableFrameDropper(bool enable)
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::SentFrameCount(VCMFrameCount &frameCount) const
{
CriticalSectionScoped cs(_sendCritSect);
@ -761,11 +761,11 @@ VideoCodingModuleImpl::SentFrameCount(VCMFrameCount &frameCount) const
}
// Initialize receiver, resets codec database etc
WebRtc_Word32
int32_t
VideoCodingModuleImpl::InitializeReceiver()
{
CriticalSectionScoped cs(_receiveCritSect);
WebRtc_Word32 ret = _receiver.Initialize();
int32_t ret = _receiver.Initialize();
if (ret < 0)
{
return ret;
@ -794,7 +794,7 @@ VideoCodingModuleImpl::InitializeReceiver()
// Register a receive callback. Will be called whenever there is a new frame
// ready for rendering.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterReceiveCallback(
VCMReceiveCallback* receiveCallback)
{
@ -803,7 +803,7 @@ VideoCodingModuleImpl::RegisterReceiveCallback(
return VCM_OK;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterReceiveStatisticsCallback(
VCMReceiveStatisticsCallback* receiveStats)
{
@ -814,9 +814,9 @@ VideoCodingModuleImpl::RegisterReceiveStatisticsCallback(
// Register an externally defined decoder/render object.
// Can be a decoder only or a decoder coupled with a renderer.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterExternalDecoder(VideoDecoder* externalDecoder,
WebRtc_UWord8 payloadType,
uint8_t payloadType,
bool internalRenderTiming)
{
CriticalSectionScoped cs(_receiveCritSect);
@ -831,7 +831,7 @@ VideoCodingModuleImpl::RegisterExternalDecoder(VideoDecoder* externalDecoder,
}
// Register a frame type request callback.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterFrameTypeCallback(
VCMFrameTypeCallback* frameTypeCallback)
{
@ -840,7 +840,7 @@ VideoCodingModuleImpl::RegisterFrameTypeCallback(
return VCM_OK;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterFrameStorageCallback(
VCMFrameStorageCallback* frameStorageCallback)
{
@ -849,7 +849,7 @@ VideoCodingModuleImpl::RegisterFrameStorageCallback(
return VCM_OK;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterPacketRequestCallback(
VCMPacketRequestCallback* callback)
{
@ -860,10 +860,10 @@ VideoCodingModuleImpl::RegisterPacketRequestCallback(
// Decode next frame, blocking.
// Should be called as often as possible to get the most out of the decoder.
WebRtc_Word32
VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs)
int32_t
VideoCodingModuleImpl::Decode(uint16_t maxWaitTimeMs)
{
WebRtc_Word64 nextRenderTimeMs;
int64_t nextRenderTimeMs;
{
CriticalSectionScoped cs(_receiveCritSect);
if (!_receiverInited)
@ -932,14 +932,14 @@ VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs)
#endif
if (_frameStorageCallback != NULL)
{
WebRtc_Word32 ret = frame->Store(*_frameStorageCallback);
int32_t ret = frame->Store(*_frameStorageCallback);
if (ret < 0)
{
return ret;
}
}
const WebRtc_Word32 ret = Decode(*frame);
const int32_t ret = Decode(*frame);
_receiver.ReleaseFrame(frame);
frame = NULL;
if (ret != VCM_OK)
@ -950,13 +950,13 @@ VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs)
return VCM_OK;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RequestSliceLossIndication(
const WebRtc_UWord64 pictureID) const
const uint64_t pictureID) const
{
if (_frameTypeCallback != NULL)
{
const WebRtc_Word32 ret =
const int32_t ret =
_frameTypeCallback->SliceLossIndicationRequest(pictureID);
if (ret < 0)
{
@ -977,12 +977,12 @@ VideoCodingModuleImpl::RequestSliceLossIndication(
return VCM_OK;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RequestKeyFrame()
{
if (_frameTypeCallback != NULL)
{
const WebRtc_Word32 ret = _frameTypeCallback->RequestKeyFrame();
const int32_t ret = _frameTypeCallback->RequestKeyFrame();
if (ret < 0)
{
WEBRTC_TRACE(webrtc::kTraceError,
@ -1004,8 +1004,8 @@ VideoCodingModuleImpl::RequestKeyFrame()
return VCM_OK;
}
WebRtc_Word32
VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs)
int32_t
VideoCodingModuleImpl::DecodeDualFrame(uint16_t maxWaitTimeMs)
{
CriticalSectionScoped cs(_receiveCritSect);
if (_dualReceiver.State() != kReceiving ||
@ -1015,8 +1015,8 @@ VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs)
// dual decoder mode is disabled.
return VCM_OK;
}
WebRtc_Word64 dummyRenderTime;
WebRtc_Word32 decodeCount = 0;
int64_t dummyRenderTime;
int32_t decodeCount = 0;
VCMEncodedFrame* dualFrame = _dualReceiver.FrameForDecoding(
maxWaitTimeMs,
dummyRenderTime);
@ -1028,7 +1028,7 @@ VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs)
"Decoding frame %u with dual decoder",
dualFrame->TimeStamp());
// Decode dualFrame and try to catch up
WebRtc_Word32 ret = _dualDecoder->Decode(*dualFrame,
int32_t ret = _dualDecoder->Decode(*dualFrame,
clock_->TimeInMilliseconds());
if (ret != WEBRTC_VIDEO_CODEC_OK)
{
@ -1059,7 +1059,7 @@ VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs)
// Must be called from inside the receive side critical section.
WebRtc_Word32
int32_t
VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame)
{
// Change decoder if payload type has changed
@ -1077,7 +1077,7 @@ VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame)
return VCM_NO_CODEC_REGISTERED;
}
// Decode a frame
WebRtc_Word32 ret = _decoder->Decode(frame, clock_->TimeInMilliseconds());
int32_t ret = _decoder->Decode(frame, clock_->TimeInMilliseconds());
// Check for failed decoding, run frame type request callback if needed.
if (ret < 0)
@ -1127,12 +1127,12 @@ VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame)
return ret;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::DecodeFromStorage(
const EncodedVideoData& frameFromStorage)
{
CriticalSectionScoped cs(_receiveCritSect);
WebRtc_Word32 ret = _frameFromFile.ExtractFromStorage(frameFromStorage);
int32_t ret = _frameFromFile.ExtractFromStorage(frameFromStorage);
if (ret < 0)
{
return ret;
@ -1141,7 +1141,7 @@ VideoCodingModuleImpl::DecodeFromStorage(
}
// Reset the decoder state
WebRtc_Word32
int32_t
VideoCodingModuleImpl::ResetDecoder()
{
CriticalSectionScoped cs(_receiveCritSect);
@ -1165,9 +1165,9 @@ VideoCodingModuleImpl::ResetDecoder()
}
// Register possible receive codecs, can be called multiple times
WebRtc_Word32
int32_t
VideoCodingModuleImpl::RegisterReceiveCodec(const VideoCodec* receiveCodec,
WebRtc_Word32 numberOfCores,
int32_t numberOfCores,
bool requireKeyFrame)
{
CriticalSectionScoped cs(_receiveCritSect);
@ -1183,7 +1183,7 @@ VideoCodingModuleImpl::RegisterReceiveCodec(const VideoCodec* receiveCodec,
}
// Get current received codec
WebRtc_Word32
int32_t
VideoCodingModuleImpl::ReceiveCodec(VideoCodec* currentReceiveCodec) const
{
CriticalSectionScoped cs(_receiveCritSect);
@ -1203,9 +1203,9 @@ VideoCodingModuleImpl::ReceiveCodec() const
}
// Incoming packet from network parsed and ready for decode, non blocking.
WebRtc_Word32
VideoCodingModuleImpl::IncomingPacket(const WebRtc_UWord8* incomingPayload,
WebRtc_UWord32 payloadLength,
int32_t
VideoCodingModuleImpl::IncomingPacket(const uint8_t* incomingPayload,
uint32_t payloadLength,
const WebRtcRTPHeader& rtpInfo)
{
if (incomingPayload == NULL) {
@ -1215,7 +1215,7 @@ VideoCodingModuleImpl::IncomingPacket(const WebRtc_UWord8* incomingPayload,
payloadLength = 0;
}
const VCMPacket packet(incomingPayload, payloadLength, rtpInfo);
WebRtc_Word32 ret;
int32_t ret;
if (_dualReceiver.State() != kPassive)
{
ret = _dualReceiver.InsertPacket(packet,
@ -1245,8 +1245,8 @@ VideoCodingModuleImpl::IncomingPacket(const WebRtc_UWord8* incomingPayload,
// Minimum playout delay (used for lip-sync). This is the minimum delay required
// to sync with audio. Not included in VideoCodingModule::Delay()
// Defaults to 0 ms.
WebRtc_Word32
VideoCodingModuleImpl::SetMinimumPlayoutDelay(WebRtc_UWord32 minPlayoutDelayMs)
int32_t
VideoCodingModuleImpl::SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs)
{
_timing.SetMinimumTotalDelay(minPlayoutDelayMs);
return VCM_OK;
@ -1254,23 +1254,23 @@ VideoCodingModuleImpl::SetMinimumPlayoutDelay(WebRtc_UWord32 minPlayoutDelayMs)
// The estimated delay caused by rendering, defaults to
// kDefaultRenderDelayMs = 10 ms
WebRtc_Word32
VideoCodingModuleImpl::SetRenderDelay(WebRtc_UWord32 timeMS)
int32_t
VideoCodingModuleImpl::SetRenderDelay(uint32_t timeMS)
{
_timing.SetRenderDelay(timeMS);
return VCM_OK;
}
// Current video delay
WebRtc_Word32
int32_t
VideoCodingModuleImpl::Delay() const
{
return _timing.TargetVideoDelay();
}
// Nack list
WebRtc_Word32
VideoCodingModuleImpl::NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size)
int32_t
VideoCodingModuleImpl::NackList(uint16_t* nackList, uint16_t& size)
{
VCMNackStatus nackStatus = kNackOk;
uint16_t nack_list_length = 0;
@ -1312,14 +1312,14 @@ VideoCodingModuleImpl::NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size)
return VCM_OK;
}
WebRtc_Word32
int32_t
VideoCodingModuleImpl::ReceivedFrameCount(VCMFrameCount& frameCount) const
{
_receiver.ReceivedFrameCount(&frameCount);
return VCM_OK;
}
WebRtc_UWord32 VideoCodingModuleImpl::DiscardedPackets() const {
uint32_t VideoCodingModuleImpl::DiscardedPackets() const {
return _receiver.DiscardedPackets();
}

View File

@ -32,18 +32,18 @@ namespace webrtc
class VCMProcessTimer
{
public:
VCMProcessTimer(WebRtc_UWord32 periodMs, Clock* clock)
VCMProcessTimer(uint32_t periodMs, Clock* clock)
: _clock(clock),
_periodMs(periodMs),
_latestMs(_clock->TimeInMilliseconds()) {}
WebRtc_UWord32 Period() const;
WebRtc_UWord32 TimeUntilProcess() const;
uint32_t Period() const;
uint32_t TimeUntilProcess() const;
void Processed();
private:
Clock* _clock;
WebRtc_UWord32 _periodMs;
WebRtc_Word64 _latestMs;
uint32_t _periodMs;
int64_t _latestMs;
};
enum VCMKeyRequestMode
@ -58,48 +58,48 @@ enum VCMKeyRequestMode
class VideoCodingModuleImpl : public VideoCodingModule
{
public:
VideoCodingModuleImpl(const WebRtc_Word32 id, Clock* clock,
VideoCodingModuleImpl(const int32_t id, Clock* clock,
EventFactory* event_factory, bool owns_event_factory);
virtual ~VideoCodingModuleImpl();
WebRtc_Word32 Id() const;
int32_t Id() const;
// Change the unique identifier of this object
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
virtual int32_t ChangeUniqueId(const int32_t id);
// Returns the number of milliseconds until the module want a worker thread
// to call Process
virtual WebRtc_Word32 TimeUntilNextProcess();
virtual int32_t TimeUntilNextProcess();
virtual WebRtc_Word32 Process();
virtual int32_t Process();
/*
* Sender
*/
// Initialize send codec
virtual WebRtc_Word32 InitializeSender();
virtual int32_t InitializeSender();
// Register the send codec to be used.
virtual WebRtc_Word32 RegisterSendCodec(const VideoCodec* sendCodec,
WebRtc_UWord32 numberOfCores,
WebRtc_UWord32 maxPayloadSize);
virtual int32_t RegisterSendCodec(const VideoCodec* sendCodec,
uint32_t numberOfCores,
uint32_t maxPayloadSize);
// Get current send codec
virtual WebRtc_Word32 SendCodec(VideoCodec* currentSendCodec) const;
virtual int32_t SendCodec(VideoCodec* currentSendCodec) const;
// Get current send codec type
virtual VideoCodecType SendCodec() const;
// Register an external encoder object.
virtual WebRtc_Word32 RegisterExternalEncoder(VideoEncoder* externalEncoder,
WebRtc_UWord8 payloadType,
virtual int32_t RegisterExternalEncoder(VideoEncoder* externalEncoder,
uint8_t payloadType,
bool internalSource = false);
// Get codec config parameters
virtual WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* buffer,
WebRtc_Word32 size);
virtual int32_t CodecConfigParameters(uint8_t* buffer,
int32_t size);
// Get encode bitrate
virtual int Bitrate(unsigned int* bitrate) const;
@ -108,138 +108,138 @@ public:
virtual int FrameRate(unsigned int* framerate) const;
// Set channel parameters
virtual WebRtc_Word32 SetChannelParameters(
WebRtc_UWord32 target_bitrate, // bits/s.
WebRtc_UWord8 lossRate,
WebRtc_UWord32 rtt);
virtual int32_t SetChannelParameters(
uint32_t target_bitrate, // bits/s.
uint8_t lossRate,
uint32_t rtt);
// Set recieve channel parameters
virtual WebRtc_Word32 SetReceiveChannelParameters(WebRtc_UWord32 rtt);
virtual int32_t SetReceiveChannelParameters(uint32_t rtt);
// Register a transport callback which will be called to deliver the
// encoded buffers
virtual WebRtc_Word32 RegisterTransportCallback(
virtual int32_t RegisterTransportCallback(
VCMPacketizationCallback* transport);
// Register a send statistics callback which will be called to deliver
// information about the video stream produced by the encoder,
// for instance the average frame rate and bit rate.
virtual WebRtc_Word32 RegisterSendStatisticsCallback(
virtual int32_t RegisterSendStatisticsCallback(
VCMSendStatisticsCallback* sendStats);
// Register a video quality settings callback which will be called when
// frame rate/dimensions need to be updated for video quality optimization
virtual WebRtc_Word32 RegisterVideoQMCallback(
virtual int32_t RegisterVideoQMCallback(
VCMQMSettingsCallback* videoQMSettings);
// Register a video protection callback which will be called to deliver
// the requested FEC rate and NACK status (on/off).
virtual WebRtc_Word32 RegisterProtectionCallback(
virtual int32_t RegisterProtectionCallback(
VCMProtectionCallback* protection);
// Enable or disable a video protection method.
virtual WebRtc_Word32 SetVideoProtection(VCMVideoProtection videoProtection,
virtual int32_t SetVideoProtection(VCMVideoProtection videoProtection,
bool enable);
// Add one raw video frame to the encoder, blocking.
virtual WebRtc_Word32 AddVideoFrame(
virtual int32_t AddVideoFrame(
const I420VideoFrame& videoFrame,
const VideoContentMetrics* _contentMetrics = NULL,
const CodecSpecificInfo* codecSpecificInfo = NULL);
virtual WebRtc_Word32 IntraFrameRequest(int stream_index);
virtual int32_t IntraFrameRequest(int stream_index);
//Enable frame dropper
virtual WebRtc_Word32 EnableFrameDropper(bool enable);
virtual int32_t EnableFrameDropper(bool enable);
// Sent frame counters
virtual WebRtc_Word32 SentFrameCount(VCMFrameCount& frameCount) const;
virtual int32_t SentFrameCount(VCMFrameCount& frameCount) const;
/*
* Receiver
*/
// Initialize receiver, resets codec database etc
virtual WebRtc_Word32 InitializeReceiver();
virtual int32_t InitializeReceiver();
// Register possible reveive codecs, can be called multiple times
virtual WebRtc_Word32 RegisterReceiveCodec(const VideoCodec* receiveCodec,
WebRtc_Word32 numberOfCores,
virtual int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec,
int32_t numberOfCores,
bool requireKeyFrame = false);
// Register an externally defined decoder/render object.
// Can be a decoder only or a decoder coupled with a renderer.
virtual WebRtc_Word32 RegisterExternalDecoder(VideoDecoder* externalDecoder,
WebRtc_UWord8 payloadType,
virtual int32_t RegisterExternalDecoder(VideoDecoder* externalDecoder,
uint8_t payloadType,
bool internalRenderTiming);
// Register a receive callback. Will be called whenever there are a new
// frame ready for rendering.
virtual WebRtc_Word32 RegisterReceiveCallback(
virtual int32_t RegisterReceiveCallback(
VCMReceiveCallback* receiveCallback);
// Register a receive statistics callback which will be called to deliver
// information about the video stream received by the receiving side of the
// VCM, for instance the average frame rate and bit rate.
virtual WebRtc_Word32 RegisterReceiveStatisticsCallback(
virtual int32_t RegisterReceiveStatisticsCallback(
VCMReceiveStatisticsCallback* receiveStats);
// Register a frame type request callback.
virtual WebRtc_Word32 RegisterFrameTypeCallback(
virtual int32_t RegisterFrameTypeCallback(
VCMFrameTypeCallback* frameTypeCallback);
// Register a frame storage callback.
virtual WebRtc_Word32 RegisterFrameStorageCallback(
virtual int32_t RegisterFrameStorageCallback(
VCMFrameStorageCallback* frameStorageCallback);
// Nack callback
virtual WebRtc_Word32 RegisterPacketRequestCallback(
virtual int32_t RegisterPacketRequestCallback(
VCMPacketRequestCallback* callback);
// Decode next frame, blocks for a maximum of maxWaitTimeMs milliseconds.
// Should be called as often as possible to get the most out of the decoder.
virtual WebRtc_Word32 Decode(WebRtc_UWord16 maxWaitTimeMs = 200);
virtual int32_t Decode(uint16_t maxWaitTimeMs = 200);
// Decode next dual frame, blocks for a maximum of maxWaitTimeMs
// milliseconds.
virtual WebRtc_Word32 DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs = 200);
virtual int32_t DecodeDualFrame(uint16_t maxWaitTimeMs = 200);
// Reset the decoder state
virtual WebRtc_Word32 ResetDecoder();
virtual int32_t ResetDecoder();
// Get current received codec
virtual WebRtc_Word32 ReceiveCodec(VideoCodec* currentReceiveCodec) const;
virtual int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const;
// Get current received codec type
virtual VideoCodecType ReceiveCodec() const;
// Incoming packet from network parsed and ready for decode, non blocking.
virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPayload,
WebRtc_UWord32 payloadLength,
virtual int32_t IncomingPacket(const uint8_t* incomingPayload,
uint32_t payloadLength,
const WebRtcRTPHeader& rtpInfo);
// A part of an encoded frame to be decoded.
// Used in conjunction with VCMFrameStorageCallback.
virtual WebRtc_Word32 DecodeFromStorage(
virtual int32_t DecodeFromStorage(
const EncodedVideoData& frameFromStorage);
// Minimum playout delay (Used for lip-sync). This is the minimum delay
// required to sync with audio. Not included in VideoCodingModule::Delay()
// Defaults to 0 ms.
virtual WebRtc_Word32 SetMinimumPlayoutDelay(
WebRtc_UWord32 minPlayoutDelayMs);
virtual int32_t SetMinimumPlayoutDelay(
uint32_t minPlayoutDelayMs);
// The estimated delay caused by rendering
virtual WebRtc_Word32 SetRenderDelay(WebRtc_UWord32 timeMS);
virtual int32_t SetRenderDelay(uint32_t timeMS);
// Current delay
virtual WebRtc_Word32 Delay() const;
virtual int32_t Delay() const;
// Received frame counters
virtual WebRtc_Word32 ReceivedFrameCount(VCMFrameCount& frameCount) const;
virtual int32_t ReceivedFrameCount(VCMFrameCount& frameCount) const;
// Returns the number of packets discarded by the jitter buffer.
virtual WebRtc_UWord32 DiscardedPackets() const;
virtual uint32_t DiscardedPackets() const;
// Robustness APIs
@ -273,14 +273,14 @@ public:
virtual int StopDebugRecording();
protected:
WebRtc_Word32 Decode(const webrtc::VCMEncodedFrame& frame);
WebRtc_Word32 RequestKeyFrame();
WebRtc_Word32 RequestSliceLossIndication(
const WebRtc_UWord64 pictureID) const;
WebRtc_Word32 NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size);
int32_t Decode(const webrtc::VCMEncodedFrame& frame);
int32_t RequestKeyFrame();
int32_t RequestSliceLossIndication(
const uint64_t pictureID) const;
int32_t NackList(uint16_t* nackList, uint16_t& size);
private:
WebRtc_Word32 _id;
int32_t _id;
Clock* clock_;
CriticalSectionWrapper* _receiveCritSect;
bool _receiverInited;