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

@ -21,7 +21,7 @@ class MockVCMFrameTypeCallback : public VCMFrameTypeCallback {
public: public:
MOCK_METHOD0(RequestKeyFrame, int32_t()); MOCK_METHOD0(RequestKeyFrame, int32_t());
MOCK_METHOD1(SliceLossIndicationRequest, MOCK_METHOD1(SliceLossIndicationRequest,
WebRtc_Word32(const WebRtc_UWord64 pictureId)); int32_t(const uint64_t pictureId));
}; };
class MockPacketRequestCallback : public VCMPacketRequestCallback { class MockPacketRequestCallback : public VCMPacketRequestCallback {

View File

@ -63,9 +63,9 @@ public:
kAllowDecodeErrors kAllowDecodeErrors
}; };
static VideoCodingModule* Create(const WebRtc_Word32 id); static VideoCodingModule* Create(const int32_t id);
static VideoCodingModule* Create(const WebRtc_Word32 id, static VideoCodingModule* Create(const int32_t id,
Clock* clock, Clock* clock,
EventFactory* event_factory); EventFactory* event_factory);
@ -74,7 +74,7 @@ public:
// Get number of supported codecs // Get number of supported codecs
// //
// Return value : Number of supported codecs // Return value : Number of supported codecs
static WebRtc_UWord8 NumberOfCodecs(); static uint8_t NumberOfCodecs();
// Get supported codec settings with using id // Get supported codec settings with using id
// //
@ -84,7 +84,7 @@ public:
// //
// Return value : VCM_OK, on success // Return value : VCM_OK, on success
// VCM_PARAMETER_ERROR if codec not supported or id too high // VCM_PARAMETER_ERROR if codec not supported or id too high
static WebRtc_Word32 Codec(const WebRtc_UWord8 listId, VideoCodec* codec); static int32_t Codec(const uint8_t listId, VideoCodec* codec);
// Get supported codec settings using codec type // Get supported codec settings using codec type
// //
@ -94,7 +94,7 @@ public:
// //
// Return value : VCM_OK, on success // Return value : VCM_OK, on success
// VCM_PARAMETER_ERROR if codec not supported // VCM_PARAMETER_ERROR if codec not supported
static WebRtc_Word32 Codec(VideoCodecType codecType, VideoCodec* codec); static int32_t Codec(VideoCodecType codecType, VideoCodec* codec);
/* /*
* Sender * Sender
@ -108,7 +108,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 InitializeSender() = 0; virtual int32_t InitializeSender() = 0;
// Registers a codec to be used for encoding. Calling this // Registers a codec to be used for encoding. Calling this
// API multiple times overwrites any previously registered codecs. // API multiple times overwrites any previously registered codecs.
@ -122,9 +122,9 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterSendCodec(const VideoCodec* sendCodec, virtual int32_t RegisterSendCodec(const VideoCodec* sendCodec,
WebRtc_UWord32 numberOfCores, uint32_t numberOfCores,
WebRtc_UWord32 maxPayloadSize) = 0; uint32_t maxPayloadSize) = 0;
// API to get the current send codec in use. // API to get the current send codec in use.
// //
@ -133,7 +133,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 SendCodec(VideoCodec* currentSendCodec) const = 0; virtual int32_t SendCodec(VideoCodec* currentSendCodec) const = 0;
// API to get the current send codec type // API to get the current send codec type
// //
@ -151,8 +151,8 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterExternalEncoder(VideoEncoder* externalEncoder, virtual int32_t RegisterExternalEncoder(VideoEncoder* externalEncoder,
WebRtc_UWord8 payloadType, uint8_t payloadType,
bool internalSource = false) = 0; bool internalSource = false) = 0;
// API to get codec config parameters to be sent out-of-band to a receiver. // API to get codec config parameters to be sent out-of-band to a receiver.
@ -163,7 +163,7 @@ public:
// //
// Return value : Number of bytes written, on success. // Return value : Number of bytes written, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 size) = 0; virtual int32_t CodecConfigParameters(uint8_t* buffer, int32_t size) = 0;
// API to get currently configured encoder target bitrate in kbit/s. // API to get currently configured encoder target bitrate in kbit/s.
// //
@ -189,9 +189,9 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 SetChannelParameters(WebRtc_UWord32 target_bitrate, virtual int32_t SetChannelParameters(uint32_t target_bitrate,
WebRtc_UWord8 lossRate, uint8_t lossRate,
WebRtc_UWord32 rtt) = 0; uint32_t rtt) = 0;
// Sets the parameters describing the receive channel. These parameters are inputs to the // Sets the parameters describing the receive channel. These parameters are inputs to the
// Media Optimization inside the VCM. // Media Optimization inside the VCM.
@ -203,7 +203,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 SetReceiveChannelParameters(WebRtc_UWord32 rtt) = 0; virtual int32_t SetReceiveChannelParameters(uint32_t rtt) = 0;
// Register a transport callback which will be called to deliver the encoded data and // Register a transport callback which will be called to deliver the encoded data and
// side information. // side information.
@ -213,7 +213,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterTransportCallback(VCMPacketizationCallback* transport) = 0; virtual int32_t RegisterTransportCallback(VCMPacketizationCallback* transport) = 0;
// Register video output information callback which will be called to deliver information // 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 // about the video stream produced by the encoder, for instance the average frame rate and
@ -224,7 +224,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterSendStatisticsCallback( virtual int32_t RegisterSendStatisticsCallback(
VCMSendStatisticsCallback* sendStats) = 0; VCMSendStatisticsCallback* sendStats) = 0;
// Register a video quality settings callback which will be called when // Register a video quality settings callback which will be called when
@ -235,7 +235,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error // < 0, on error
virtual WebRtc_Word32 RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings) = 0; virtual int32_t RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings) = 0;
// Register a video protection callback which will be called to deliver // Register a video protection callback which will be called to deliver
// the requested FEC rate and NACK status (on/off). // the requested FEC rate and NACK status (on/off).
@ -245,7 +245,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterProtectionCallback(VCMProtectionCallback* protection) = 0; virtual int32_t RegisterProtectionCallback(VCMProtectionCallback* protection) = 0;
// Enable or disable a video protection method. // Enable or disable a video protection method.
// //
@ -256,7 +256,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 SetVideoProtection(VCMVideoProtection videoProtection, virtual int32_t SetVideoProtection(VCMVideoProtection videoProtection,
bool enable) = 0; bool enable) = 0;
// Add one raw video frame to the encoder. This function does all the necessary // Add one raw video frame to the encoder. This function does all the necessary
@ -270,7 +270,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 AddVideoFrame( virtual int32_t AddVideoFrame(
const I420VideoFrame& videoFrame, const I420VideoFrame& videoFrame,
const VideoContentMetrics* contentMetrics = NULL, const VideoContentMetrics* contentMetrics = NULL,
const CodecSpecificInfo* codecSpecificInfo = NULL) = 0; const CodecSpecificInfo* codecSpecificInfo = NULL) = 0;
@ -279,7 +279,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 IntraFrameRequest(int stream_index) = 0; virtual int32_t IntraFrameRequest(int stream_index) = 0;
// Frame Dropper enable. Can be used to disable the frame dropping when the encoder // Frame Dropper enable. Can be used to disable the frame dropping when the encoder
// over-uses its bit rate. This API is designed to be used when the encoded frames // over-uses its bit rate. This API is designed to be used when the encoded frames
@ -291,10 +291,10 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 EnableFrameDropper(bool enable) = 0; virtual int32_t EnableFrameDropper(bool enable) = 0;
// Sent frame counters // Sent frame counters
virtual WebRtc_Word32 SentFrameCount(VCMFrameCount& frameCount) const = 0; virtual int32_t SentFrameCount(VCMFrameCount& frameCount) const = 0;
/* /*
* Receiver * Receiver
@ -309,7 +309,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 InitializeReceiver() = 0; virtual int32_t InitializeReceiver() = 0;
// Register possible receive codecs, can be called multiple times for different codecs. // Register possible receive codecs, can be called multiple times for different codecs.
// The module will automatically switch between registered codecs depending on the // The module will automatically switch between registered codecs depending on the
@ -323,8 +323,8 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterReceiveCodec(const VideoCodec* receiveCodec, virtual int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec,
WebRtc_Word32 numberOfCores, int32_t numberOfCores,
bool requireKeyFrame = false) = 0; bool requireKeyFrame = false) = 0;
// Register an externally defined decoder/renderer object. Can be a decoder only or a // Register an externally defined decoder/renderer object. Can be a decoder only or a
@ -340,8 +340,8 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterExternalDecoder(VideoDecoder* externalDecoder, virtual int32_t RegisterExternalDecoder(VideoDecoder* externalDecoder,
WebRtc_UWord8 payloadType, uint8_t payloadType,
bool internalRenderTiming) = 0; bool internalRenderTiming) = 0;
// Register a receive callback. Will be called whenever there is a new frame ready // Register a receive callback. Will be called whenever there is a new frame ready
@ -354,7 +354,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterReceiveCallback(VCMReceiveCallback* receiveCallback) = 0; virtual int32_t RegisterReceiveCallback(VCMReceiveCallback* receiveCallback) = 0;
// Register a receive statistics callback which will be called to deliver information // 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 // about the video stream received by the receiving side of the VCM, for instance the
@ -365,7 +365,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterReceiveStatisticsCallback( virtual int32_t RegisterReceiveStatisticsCallback(
VCMReceiveStatisticsCallback* receiveStats) = 0; VCMReceiveStatisticsCallback* receiveStats) = 0;
// Register a frame type request callback. This callback will be called when the // Register a frame type request callback. This callback will be called when the
@ -378,7 +378,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterFrameTypeCallback( virtual int32_t RegisterFrameTypeCallback(
VCMFrameTypeCallback* frameTypeCallback) = 0; VCMFrameTypeCallback* frameTypeCallback) = 0;
// Register a frame storage callback. This callback will be called right before an // Register a frame storage callback. This callback will be called right before an
@ -390,7 +390,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 RegisterFrameStorageCallback( virtual int32_t RegisterFrameStorageCallback(
VCMFrameStorageCallback* frameStorageCallback) = 0; VCMFrameStorageCallback* frameStorageCallback) = 0;
// Registers a callback which is called whenever the receive side of the VCM // Registers a callback which is called whenever the receive side of the VCM
@ -401,7 +401,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// <0, on error. // <0, on error.
virtual WebRtc_Word32 RegisterPacketRequestCallback( virtual int32_t RegisterPacketRequestCallback(
VCMPacketRequestCallback* callback) = 0; VCMPacketRequestCallback* callback) = 0;
// Waits for the next frame in the jitter buffer to become complete // Waits for the next frame in the jitter buffer to become complete
@ -410,7 +410,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 Decode(WebRtc_UWord16 maxWaitTimeMs = 200) = 0; virtual int32_t Decode(uint16_t maxWaitTimeMs = 200) = 0;
// Waits for the next frame in the dual jitter buffer to become complete // Waits for the next frame in the dual jitter buffer to become complete
// (waits no longer than maxWaitTimeMs), then passes it to the dual decoder // (waits no longer than maxWaitTimeMs), then passes it to the dual decoder
@ -421,7 +421,7 @@ public:
// Return value : 1, if a frame was decoded // Return value : 1, if a frame was decoded
// 0, if no frame was decoded // 0, if no frame was decoded
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs = 200) = 0; virtual int32_t DecodeDualFrame(uint16_t maxWaitTimeMs = 200) = 0;
// Decodes a frame and sets an appropriate render time in ms relative to the system time. // Decodes a frame and sets an appropriate render time in ms relative to the system time.
// Should be used in conjunction with VCMFrameStorageCallback. // Should be used in conjunction with VCMFrameStorageCallback.
@ -432,13 +432,13 @@ public:
// //
// Return value: : VCM_OK, on success // Return value: : VCM_OK, on success
// < 0, on error // < 0, on error
virtual WebRtc_Word32 DecodeFromStorage(const EncodedVideoData& frameFromStorage) = 0; virtual int32_t DecodeFromStorage(const EncodedVideoData& frameFromStorage) = 0;
// Reset the decoder state to the initial state. // Reset the decoder state to the initial state.
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 ResetDecoder() = 0; virtual int32_t ResetDecoder() = 0;
// API to get the codec which is currently used for decoding by the module. // API to get the codec which is currently used for decoding by the module.
// //
@ -447,7 +447,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 ReceiveCodec(VideoCodec* currentReceiveCodec) const = 0; virtual int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const = 0;
// API to get the codec type currently used for decoding by the module. // API to get the codec type currently used for decoding by the module.
// //
@ -466,8 +466,8 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPayload, virtual int32_t IncomingPacket(const uint8_t* incomingPayload,
WebRtc_UWord32 payloadLength, uint32_t payloadLength,
const WebRtcRTPHeader& rtpInfo) = 0; const WebRtcRTPHeader& rtpInfo) = 0;
// Minimum playout delay (Used for lip-sync). This is the minimum delay required // Minimum playout delay (Used for lip-sync). This is the minimum delay required
@ -479,7 +479,7 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 SetMinimumPlayoutDelay(WebRtc_UWord32 minPlayoutDelayMs) = 0; virtual int32_t SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs) = 0;
// Set the time required by the renderer to render a frame. // Set the time required by the renderer to render a frame.
// //
@ -488,14 +488,14 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 SetRenderDelay(WebRtc_UWord32 timeMS) = 0; virtual int32_t SetRenderDelay(uint32_t timeMS) = 0;
// The total delay desired by the VCM. Can be less than the minimum // The total delay desired by the VCM. Can be less than the minimum
// delay set with SetMinimumPlayoutDelay. // delay set with SetMinimumPlayoutDelay.
// //
// Return value : Total delay in ms, on success. // Return value : Total delay in ms, on success.
// < 0, on error. // < 0, on error.
virtual WebRtc_Word32 Delay() const = 0; virtual int32_t Delay() const = 0;
// Get the received frame counters. Keeps track of the number of each frame type // Get the received frame counters. Keeps track of the number of each frame type
// received since the start of the call. // received since the start of the call.
@ -505,13 +505,13 @@ public:
// //
// Return value : VCM_OK, on success. // Return value : VCM_OK, on success.
// <0, on error. // <0, on error.
virtual WebRtc_Word32 ReceivedFrameCount(VCMFrameCount& frameCount) const = 0; virtual int32_t ReceivedFrameCount(VCMFrameCount& frameCount) const = 0;
// Returns the number of packets discarded by the jitter buffer due to being // Returns the number of packets discarded by the jitter buffer due to being
// too late. This can include duplicated packets which arrived after the // too late. This can include duplicated packets which arrived after the
// frame was sent to the decoder. Therefore packets which were prematurely // frame was sent to the decoder. Therefore packets which were prematurely
// NACKed will be counted. // NACKed will be counted.
virtual WebRtc_UWord32 DiscardedPackets() const = 0; virtual uint32_t DiscardedPackets() const = 0;
// Robustness APIs // Robustness APIs

View File

@ -58,20 +58,20 @@ enum VCMTemporalDecimation {
}; };
struct VCMFrameCount { struct VCMFrameCount {
WebRtc_UWord32 numKeyFrames; uint32_t numKeyFrames;
WebRtc_UWord32 numDeltaFrames; uint32_t numDeltaFrames;
}; };
// Callback class used for sending data ready to be packetized // Callback class used for sending data ready to be packetized
class VCMPacketizationCallback { class VCMPacketizationCallback {
public: public:
virtual WebRtc_Word32 SendData( virtual int32_t SendData(
FrameType frameType, FrameType frameType,
WebRtc_UWord8 payloadType, uint8_t payloadType,
WebRtc_UWord32 timeStamp, uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
WebRtc_UWord32 payloadSize, uint32_t payloadSize,
const RTPFragmentationHeader& fragmentationHeader, const RTPFragmentationHeader& fragmentationHeader,
const RTPVideoHeader* rtpVideoHdr) = 0; const RTPVideoHeader* rtpVideoHdr) = 0;
protected: protected:
@ -82,7 +82,7 @@ class VCMPacketizationCallback {
// Callback class used for passing decoded frames which are ready to be rendered. // Callback class used for passing decoded frames which are ready to be rendered.
class VCMFrameStorageCallback { class VCMFrameStorageCallback {
public: public:
virtual WebRtc_Word32 StoreReceivedFrame( virtual int32_t StoreReceivedFrame(
const EncodedVideoData& frameToStore) = 0; const EncodedVideoData& frameToStore) = 0;
protected: protected:
@ -93,9 +93,9 @@ class VCMFrameStorageCallback {
// Callback class used for passing decoded frames which are ready to be rendered. // Callback class used for passing decoded frames which are ready to be rendered.
class VCMReceiveCallback { class VCMReceiveCallback {
public: public:
virtual WebRtc_Word32 FrameToRender(I420VideoFrame& videoFrame) = 0; virtual int32_t FrameToRender(I420VideoFrame& videoFrame) = 0;
virtual WebRtc_Word32 ReceivedDecodedReferenceFrame( virtual int32_t ReceivedDecodedReferenceFrame(
const WebRtc_UWord64 pictureId) { const uint64_t pictureId) {
return -1; return -1;
} }
@ -108,8 +108,8 @@ class VCMReceiveCallback {
// encoder. // encoder.
class VCMSendStatisticsCallback { class VCMSendStatisticsCallback {
public: public:
virtual WebRtc_Word32 SendStatistics(const WebRtc_UWord32 bitRate, virtual int32_t SendStatistics(const uint32_t bitRate,
const WebRtc_UWord32 frameRate) = 0; const uint32_t frameRate) = 0;
protected: protected:
virtual ~VCMSendStatisticsCallback() { virtual ~VCMSendStatisticsCallback() {
@ -119,8 +119,8 @@ class VCMSendStatisticsCallback {
// Callback class used for informing the user of the incoming bit rate and frame rate. // Callback class used for informing the user of the incoming bit rate and frame rate.
class VCMReceiveStatisticsCallback { class VCMReceiveStatisticsCallback {
public: public:
virtual WebRtc_Word32 ReceiveStatistics(const WebRtc_UWord32 bitRate, virtual int32_t ReceiveStatistics(const uint32_t bitRate,
const WebRtc_UWord32 frameRate) = 0; const uint32_t frameRate) = 0;
protected: protected:
virtual ~VCMReceiveStatisticsCallback() { virtual ~VCMReceiveStatisticsCallback() {
@ -146,9 +146,9 @@ class VCMProtectionCallback {
// Typically a key frame when the stream has been corrupted in some way. // Typically a key frame when the stream has been corrupted in some way.
class VCMFrameTypeCallback { class VCMFrameTypeCallback {
public: public:
virtual WebRtc_Word32 RequestKeyFrame() = 0; virtual int32_t RequestKeyFrame() = 0;
virtual WebRtc_Word32 SliceLossIndicationRequest( virtual int32_t SliceLossIndicationRequest(
const WebRtc_UWord64 pictureId) { const uint64_t pictureId) {
return -1; return -1;
} }
@ -161,8 +161,8 @@ class VCMFrameTypeCallback {
// missing and need to be resent. // missing and need to be resent.
class VCMPacketRequestCallback { class VCMPacketRequestCallback {
public: public:
virtual WebRtc_Word32 ResendPackets(const WebRtc_UWord16* sequenceNumbers, virtual int32_t ResendPackets(const uint16_t* sequenceNumbers,
WebRtc_UWord16 length) = 0; uint16_t length) = 0;
protected: protected:
virtual ~VCMPacketRequestCallback() { virtual ~VCMPacketRequestCallback() {
@ -173,9 +173,9 @@ class VCMPacketRequestCallback {
// as subscribed by Media Optimization (Quality Modes) // as subscribed by Media Optimization (Quality Modes)
class VCMQMSettingsCallback { class VCMQMSettingsCallback {
public: public:
virtual WebRtc_Word32 SetVideoQMSettings(const WebRtc_UWord32 frameRate, virtual int32_t SetVideoQMSettings(const uint32_t frameRate,
const WebRtc_UWord32 width, const uint32_t width,
const WebRtc_UWord32 height) = 0; const uint32_t height) = 0;
protected: protected:
virtual ~VCMQMSettingsCallback() { virtual ~VCMQMSettingsCallback() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,24 +34,24 @@ public:
/* /*
* Callback implementation - codec encode complete * Callback implementation - codec encode complete
*/ */
WebRtc_Word32 Encoded( int32_t Encoded(
EncodedImage& encodedImage, EncodedImage& encodedImage,
const CodecSpecificInfo* codecSpecificInfo = NULL, const CodecSpecificInfo* codecSpecificInfo = NULL,
const RTPFragmentationHeader* fragmentationHeader = NULL); const RTPFragmentationHeader* fragmentationHeader = NULL);
/* /*
* Get number of encoded bytes * Get number of encoded bytes
*/ */
WebRtc_UWord32 EncodedBytes(); uint32_t EncodedBytes();
/* /*
* Callback implementation - generic encoder encode complete * Callback implementation - generic encoder encode complete
*/ */
WebRtc_Word32 SetTransportCallback(VCMPacketizationCallback* transport); int32_t SetTransportCallback(VCMPacketizationCallback* transport);
/** /**
* Set media Optimization * Set media Optimization
*/ */
void SetMediaOpt (media_optimization::VCMMediaOptimization* mediaOpt); 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 SetCodecType(VideoCodecType codecType) {_codecType = codecType;};
void SetInternalSource(bool internalSource) { _internalSource = internalSource; }; void SetInternalSource(bool internalSource) { _internalSource = internalSource; };
@ -65,8 +65,8 @@ private:
VCMPacketizationCallback* _sendCallback; VCMPacketizationCallback* _sendCallback;
media_optimization::VCMMediaOptimization* _mediaOpt; media_optimization::VCMMediaOptimization* _mediaOpt;
WebRtc_UWord32 _encodedBytes; uint32_t _encodedBytes;
WebRtc_UWord8 _payloadType; uint8_t _payloadType;
VideoCodecType _codecType; VideoCodecType _codecType;
bool _internalSource; bool _internalSource;
#ifdef DEBUG_ENCODER_BIT_STREAM #ifdef DEBUG_ENCODER_BIT_STREAM
@ -87,13 +87,13 @@ public:
/** /**
* Free encoder memory * Free encoder memory
*/ */
WebRtc_Word32 Release(); int32_t Release();
/** /**
* Initialize the encoder with the information from the VideoCodec * Initialize the encoder with the information from the VideoCodec
*/ */
WebRtc_Word32 InitEncode(const VideoCodec* settings, int32_t InitEncode(const VideoCodec* settings,
WebRtc_Word32 numberOfCores, int32_t numberOfCores,
WebRtc_UWord32 maxPayloadSize); uint32_t maxPayloadSize);
/** /**
* Encode raw image * Encode raw image
* inputFrame : Frame containing raw image * inputFrame : Frame containing raw image
@ -101,36 +101,36 @@ public:
* cameraFrameRate : request or information from the remote side * cameraFrameRate : request or information from the remote side
* frameType : The requested frame type to encode * frameType : The requested frame type to encode
*/ */
WebRtc_Word32 Encode(const I420VideoFrame& inputFrame, int32_t Encode(const I420VideoFrame& inputFrame,
const CodecSpecificInfo* codecSpecificInfo, const CodecSpecificInfo* codecSpecificInfo,
const std::vector<FrameType>& frameTypes); const std::vector<FrameType>& frameTypes);
/** /**
* Set new target bitrate (bits/s) and framerate. * Set new target bitrate (bits/s) and framerate.
* Return Value: new bit rate if OK, otherwise <0s. * Return Value: new bit rate if OK, otherwise <0s.
*/ */
WebRtc_Word32 SetRates(WebRtc_UWord32 target_bitrate, int32_t SetRates(uint32_t target_bitrate,
WebRtc_UWord32 frameRate); uint32_t frameRate);
/** /**
* Set a new packet loss rate and a new round-trip time in milliseconds. * Set a new packet loss rate and a new round-trip time in milliseconds.
*/ */
WebRtc_Word32 SetChannelParameters(WebRtc_Word32 packetLoss, int rtt); int32_t SetChannelParameters(int32_t packetLoss, int rtt);
WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 size); int32_t CodecConfigParameters(uint8_t* buffer, int32_t size);
/** /**
* Register a transport callback which will be called to deliver the encoded buffers * 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 * Get encoder bit rate
*/ */
WebRtc_UWord32 BitRate() const; uint32_t BitRate() const;
/** /**
* Get encoder frame rate * 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; bool InternalSource() const;
@ -138,8 +138,8 @@ private:
VideoEncoder& _encoder; VideoEncoder& _encoder;
VideoCodecType _codecType; VideoCodecType _codecType;
VCMEncodedFrameCallback* _VCMencodedFrameCallback; VCMEncodedFrameCallback* _VCMencodedFrameCallback;
WebRtc_UWord32 _bitRate; uint32_t _bitRate;
WebRtc_UWord32 _frameRate; uint32_t _frameRate;
bool _internalSource; bool _internalSource;
}; // end of VCMGenericEncoder class }; // 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. // Calculates the delay of a frame with the given timestamp.
// This method is called when the frame is complete. // This method is called when the frame is complete.
bool bool
VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp, VCMInterFrameDelay::CalculateDelay(uint32_t timestamp,
WebRtc_Word64 *delay, int64_t *delay,
int64_t currentWallClock) int64_t currentWallClock)
{ {
if (_prevWallClock == 0) if (_prevWallClock == 0)
@ -44,11 +44,11 @@ VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp,
return true; return true;
} }
WebRtc_Word32 prevWrapArounds = _wrapArounds; int32_t prevWrapArounds = _wrapArounds;
CheckForWrapArounds(timestamp); CheckForWrapArounds(timestamp);
// This will be -1 for backward wrap arounds and +1 for forward wrap arounds // 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? // Account for reordering in jitter variance estimate in the future?
// Note that this also captures incomplete frames which are grabbed // 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 // Compute the compensated timestamp difference and convert it to ms and
// round it to closest integer. // round it to closest integer.
_dTS = static_cast<WebRtc_Word64>((timestamp + wrapAroundsSincePrev * _dTS = static_cast<int64_t>((timestamp + wrapAroundsSincePrev *
(static_cast<WebRtc_Word64>(1)<<32) - _prevTimestamp) / 90.0 + 0.5); (static_cast<int64_t>(1)<<32) - _prevTimestamp) / 90.0 + 0.5);
// frameDelay is the difference of dT and dTS -- i.e. the difference of // frameDelay is the difference of dT and dTS -- i.e. the difference of
// the wall clock time difference and the timestamp difference between // the wall clock time difference and the timestamp difference between
// two following frames. // two following frames.
*delay = static_cast<WebRtc_Word64>(currentWallClock - _prevWallClock - _dTS); *delay = static_cast<int64_t>(currentWallClock - _prevWallClock - _dTS);
_prevTimestamp = timestamp; _prevTimestamp = timestamp;
_prevWallClock = currentWallClock; _prevWallClock = currentWallClock;
@ -77,26 +77,26 @@ VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp,
} }
// Returns the current difference between incoming timestamps // Returns the current difference between incoming timestamps
WebRtc_UWord32 VCMInterFrameDelay::CurrentTimeStampDiffMs() const uint32_t VCMInterFrameDelay::CurrentTimeStampDiffMs() const
{ {
if (_dTS < 0) if (_dTS < 0)
{ {
return 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 // Investigates if the timestamp clock has overflowed since the last timestamp and
// keeps track of the number of wrap arounds since reset. // keeps track of the number of wrap arounds since reset.
void void
VCMInterFrameDelay::CheckForWrapArounds(WebRtc_UWord32 timestamp) VCMInterFrameDelay::CheckForWrapArounds(uint32_t timestamp)
{ {
if (timestamp < _prevTimestamp) if (timestamp < _prevTimestamp)
{ {
// This difference will probably be less than -2^31 if we have had a wrap around // 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, // (e.g. timestamp = 1, _previousTimestamp = 2^32 - 1). Since it is cast to a Word32,
// it should be positive. // it should be positive.
if (static_cast<WebRtc_Word32>(timestamp - _prevTimestamp) > 0) if (static_cast<int32_t>(timestamp - _prevTimestamp) > 0)
{ {
// Forward wrap around // Forward wrap around
_wrapArounds++; _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. // 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. // 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 // Backward wrap around
_wrapArounds--; _wrapArounds--;

View File

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

View File

@ -18,9 +18,9 @@ namespace webrtc
#define MASK_32_BITS(x) (0xFFFFFFFF & (x)) #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)) #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 #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 } // namespace webrtc

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,8 +31,8 @@ VCMPacket::VCMPacket()
codecSpecificHeader() { codecSpecificHeader() {
} }
VCMPacket::VCMPacket(const WebRtc_UWord8* ptr, VCMPacket::VCMPacket(const uint8_t* ptr,
const WebRtc_UWord32 size, const uint32_t size,
const WebRtcRTPHeader& rtpHeader) : const WebRtcRTPHeader& rtpHeader) :
payloadType(rtpHeader.header.payloadType), payloadType(rtpHeader.header.payloadType),
timestamp(rtpHeader.header.timestamp), timestamp(rtpHeader.header.timestamp),
@ -51,7 +51,7 @@ VCMPacket::VCMPacket(const WebRtc_UWord8* ptr,
CopyCodecSpecifics(rtpHeader.type.Video); 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), payloadType(0),
timestamp(ts), timestamp(ts),
seqNum(seq), seqNum(seq),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -89,7 +89,7 @@ CodecDataBaseTest::Setup(CmdArgs& args)
WebRtc_Word32 int32_t
CodecDataBaseTest::Perform(CmdArgs& args) CodecDataBaseTest::Perform(CmdArgs& args)
{ {
#ifndef VIDEOCODEC_VP8 #ifndef VIDEOCODEC_VP8
@ -113,7 +113,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
// registering the callback - encode and decode with the same vcm (could be later changed) // registering the callback - encode and decode with the same vcm (could be later changed)
_encodeCompleteCallback->RegisterReceiverVCM(_vcm); _encodeCompleteCallback->RegisterReceiverVCM(_vcm);
// preparing a frame to be encoded // preparing a frame to be encoded
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0); TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
I420VideoFrame sourceFrame; I420VideoFrame sourceFrame;
int half_width = (_width + 1) / 2; int half_width = (_width + 1) / 2;
@ -125,7 +125,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
size_uv, tmpBuffer + size_y + size_uv, size_uv, tmpBuffer + size_y + size_uv,
_width, _height, _width, _height,
_width, half_width, half_width); _width, half_width, half_width);
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); _timeStamp += (uint32_t)(9e4 / _frameRate);
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
// Encoder registration // Encoder registration
TEST (VideoCodingModule::NumberOfCodecs() > 0); TEST (VideoCodingModule::NumberOfCodecs() > 0);
@ -202,7 +202,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
TEST(_vcm->Decode() == VCM_OK); TEST(_vcm->Decode() == VCM_OK);
waitEvent->Wait(33); waitEvent->Wait(33);
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); _timeStamp += (uint32_t)(9e4 / _frameRate);
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
TEST(_vcm->Decode() == VCM_OK); TEST(_vcm->Decode() == VCM_OK);
@ -237,14 +237,14 @@ CodecDataBaseTest::Perform(CmdArgs& args)
TEST(_vcm->Decode() == VCM_OK); TEST(_vcm->Decode() == VCM_OK);
TEST(_vcm->ResetDecoder() == VCM_OK); TEST(_vcm->ResetDecoder() == VCM_OK);
waitEvent->Wait(33); waitEvent->Wait(33);
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); _timeStamp += (uint32_t)(9e4 / _frameRate);
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
// Try to decode a delta frame. Should get a warning since we have enabled the "require key frame" setting // Try to decode a delta frame. Should get a warning since we have enabled the "require key frame" setting
// and because no frame type request callback has been registered. // and because no frame type request callback has been registered.
TEST(_vcm->Decode() == VCM_MISSING_CALLBACK); TEST(_vcm->Decode() == VCM_MISSING_CALLBACK);
TEST(_vcm->IntraFrameRequest(0) == VCM_OK); TEST(_vcm->IntraFrameRequest(0) == VCM_OK);
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); _timeStamp += (uint32_t)(9e4 / _frameRate);
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
TEST(_vcm->Decode() == VCM_OK); TEST(_vcm->Decode() == VCM_OK);
@ -257,13 +257,13 @@ CodecDataBaseTest::Perform(CmdArgs& args)
TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK);
TEST(_vcm->IntraFrameRequest(0) == VCM_OK); TEST(_vcm->IntraFrameRequest(0) == VCM_OK);
waitEvent->Wait(33); waitEvent->Wait(33);
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); _timeStamp += (uint32_t)(9e4 / _frameRate);
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
TEST(_vcm->Decode() == VCM_OK); TEST(_vcm->Decode() == VCM_OK);
TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK);
waitEvent->Wait(33); waitEvent->Wait(33);
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); _timeStamp += (uint32_t)(9e4 / _frameRate);
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
TEST(_vcm->IntraFrameRequest(0) == VCM_OK); TEST(_vcm->IntraFrameRequest(0) == VCM_OK);
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
@ -339,7 +339,7 @@ CodecDataBaseTest::Perform(CmdArgs& args)
size_uv, tmpBuffer + size_y + size_uv, size_uv, tmpBuffer + size_y + size_uv,
_width, _height, _width, _height,
_width, half_width, half_width); _width, half_width, half_width);
_timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); _timeStamp += (uint32_t)(9e4 / _frameRate);
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
// send frame to the encoder // send frame to the encoder
TEST (_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST (_vcm->AddVideoFrame(sourceFrame) == VCM_OK);

View File

@ -29,7 +29,7 @@ public:
CodecDataBaseTest(webrtc::VideoCodingModule* vcm); CodecDataBaseTest(webrtc::VideoCodingModule* vcm);
~CodecDataBaseTest(); ~CodecDataBaseTest();
static int RunTest(CmdArgs& args); static int RunTest(CmdArgs& args);
WebRtc_Word32 Perform(CmdArgs& args); int32_t Perform(CmdArgs& args);
private: private:
void TearDown(); void TearDown();
void Setup(CmdArgs& args); void Setup(CmdArgs& args);
@ -41,10 +41,10 @@ private:
FILE* _sourceFile; FILE* _sourceFile;
FILE* _decodedFile; FILE* _decodedFile;
FILE* _encodedFile; FILE* _encodedFile;
WebRtc_UWord16 _width; uint16_t _width;
WebRtc_UWord16 _height; uint16_t _height;
WebRtc_UWord32 _lengthSourceFrame; uint32_t _lengthSourceFrame;
WebRtc_UWord32 _timeStamp; uint32_t _timeStamp;
float _frameRate; float _frameRate;
}; // end of codecDBTest class definition }; // end of codecDBTest class definition

View File

@ -22,7 +22,7 @@ class FrameStorageCallback : public VCMFrameStorageCallback
public: public:
FrameStorageCallback(VideoCodingModule* vcm) : _vcm(vcm) {} FrameStorageCallback(VideoCodingModule* vcm) : _vcm(vcm) {}
WebRtc_Word32 StoreReceivedFrame(const EncodedVideoData& frameToStore) int32_t StoreReceivedFrame(const EncodedVideoData& frameToStore)
{ {
_vcm->DecodeFromStorage(frameToStore); _vcm->DecodeFromStorage(frameToStore);
return VCM_OK; return VCM_OK;
@ -37,12 +37,12 @@ int DecodeFromStorageTest(CmdArgs& args)
// BEGIN Settings // BEGIN Settings
bool protectionEnabled = false; bool protectionEnabled = false;
VCMVideoProtection protectionMethod = kProtectionNack; VCMVideoProtection protectionMethod = kProtectionNack;
WebRtc_UWord32 rttMS = 100; uint32_t rttMS = 100;
float lossRate = 0.00f; float lossRate = 0.00f;
bool reordering = false; bool reordering = false;
WebRtc_UWord32 renderDelayMs = 0; uint32_t renderDelayMs = 0;
WebRtc_UWord32 minPlayoutDelayMs = 0; uint32_t minPlayoutDelayMs = 0;
const WebRtc_Word64 MAX_RUNTIME_MS = -1; const int64_t MAX_RUNTIME_MS = -1;
std::string rtpFilename = args.inputFile; std::string rtpFilename = args.inputFile;
std::string outFilename = args.outputFile; std::string outFilename = args.outputFile;
if (outFilename == "") if (outFilename == "")
@ -67,7 +67,7 @@ int DecodeFromStorageTest(CmdArgs& args)
&event_factory); &event_factory);
FrameStorageCallback storageCallback(vcmPlayback); FrameStorageCallback storageCallback(vcmPlayback);
RtpDataCallback dataCallback(vcm); RtpDataCallback dataCallback(vcm);
WebRtc_Word32 ret = vcm->InitializeReceiver(); int32_t ret = vcm->InitializeReceiver();
if (ret < 0) if (ret < 0)
{ {
return -1; return -1;

View File

@ -95,10 +95,10 @@ GenericCodecTest::Setup(CmdArgs& args)
return; return;
} }
WebRtc_Word32 int32_t
GenericCodecTest::Perform(CmdArgs& args) GenericCodecTest::Perform(CmdArgs& args)
{ {
WebRtc_Word32 ret; int32_t ret;
Setup(args); Setup(args);
/* /*
1. sanity checks 1. sanity checks
@ -117,7 +117,7 @@ GenericCodecTest::Perform(CmdArgs& args)
TEST(_vcm->Codec(0, &sendCodec) == VCM_OK); TEST(_vcm->Codec(0, &sendCodec) == VCM_OK);
_vcm->InitializeSender(); _vcm->InitializeSender();
_vcm->InitializeReceiver(); _vcm->InitializeReceiver();
WebRtc_Word32 NumberOfCodecs = _vcm->NumberOfCodecs(); int32_t NumberOfCodecs = _vcm->NumberOfCodecs();
// registration of first codec in the list // registration of first codec in the list
int i = 0; int i = 0;
_vcm->Codec(0, &_sendCodec); _vcm->Codec(0, &_sendCodec);
@ -146,7 +146,7 @@ GenericCodecTest::Perform(CmdArgs& args)
_vcm->Codec(i, &receiveCodec); _vcm->Codec(i, &receiveCodec);
_vcm->RegisterReceiveCodec(&receiveCodec, 1); _vcm->RegisterReceiveCodec(&receiveCodec, 1);
} }
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0); TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
int half_width = (_width + 1) / 2; int half_width = (_width + 1) / 2;
int half_height = (_height + 1) / 2; int half_height = (_height + 1) / 2;
@ -179,7 +179,7 @@ GenericCodecTest::Perform(CmdArgs& args)
// Set target frame rate to half of the incoming frame rate // Set target frame rate to half of the incoming frame rate
// to test the frame rate control in the VCM // to test the frame rate control in the VCM
sendCodec.maxFramerate = (WebRtc_UWord8)(_frameRate / 2); sendCodec.maxFramerate = (uint8_t)(_frameRate / 2);
sendCodec.width = _width; sendCodec.width = _width;
sendCodec.height = _height; sendCodec.height = _height;
TEST(strncmp(_sendCodec.plName, "VP8", 3) == 0); // was VP8 TEST(strncmp(_sendCodec.plName, "VP8", 3) == 0); // was VP8
@ -205,13 +205,13 @@ GenericCodecTest::Perform(CmdArgs& args)
size_uv, tmpBuffer + size_y + size_uv, size_uv, tmpBuffer + size_y + size_uv,
_width, _height, _width, _height,
_width, half_width, half_width); _width, half_width, half_width);
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate)); _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
IncrementDebugClock(_frameRate); IncrementDebugClock(_frameRate);
_vcm->Process(); _vcm->Process();
} }
sendCodec.maxFramerate = (WebRtc_UWord8)_frameRate; sendCodec.maxFramerate = (uint8_t)_frameRate;
_vcm->InitializeSender(); _vcm->InitializeSender();
TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); // same codec for encode and decode TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); // same codec for encode and decode
ret = 0; ret = 0;
@ -251,7 +251,7 @@ GenericCodecTest::Perform(CmdArgs& args)
TEST(_vcm->RegisterFrameTypeCallback(&frameTypeCallback) == VCM_OK); TEST(_vcm->RegisterFrameTypeCallback(&frameTypeCallback) == VCM_OK);
TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK);
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate)); _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
// First packet of a subsequent frame required before the jitter buffer // First packet of a subsequent frame required before the jitter buffer
// will allow decoding an incomplete frame. // will allow decoding an incomplete frame.
@ -317,7 +317,7 @@ GenericCodecTest::Perform(CmdArgs& args)
_frameCnt = 0; _frameCnt = 0;
totalBytes = 0; totalBytes = 0;
_encodeCompleteCallback->Initialize(); _encodeCompleteCallback->Initialize();
sendStats.set_framerate(static_cast<WebRtc_UWord32>(_frameRate)); sendStats.set_framerate(static_cast<uint32_t>(_frameRate));
sendStats.set_bitrate(1000 * _bitRate); sendStats.set_bitrate(1000 * _bitRate);
_vcm->RegisterSendStatisticsCallback(&sendStats); _vcm->RegisterSendStatisticsCallback(&sendStats);
while (fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) == while (fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) ==
@ -330,7 +330,7 @@ GenericCodecTest::Perform(CmdArgs& args)
_width, _height, _width, _height,
_width, (_width + 1) / 2, _width, (_width + 1) / 2,
(_width + 1) / 2); (_width + 1) / 2);
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate)); _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
ret = _vcm->AddVideoFrame(sourceFrame); ret = _vcm->AddVideoFrame(sourceFrame);
@ -394,7 +394,7 @@ GenericCodecTest::Perform(CmdArgs& args)
size_uv, tmpBuffer + size_y + size_uv, size_uv, tmpBuffer + size_y + size_uv,
_width, _height, _width, _height,
_width, half_width, half_width); _width, half_width, half_width);
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate)); _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
_vcm->AddVideoFrame(sourceFrame); _vcm->AddVideoFrame(sourceFrame);
encodeComplete = _encodeCompleteCallback->EncodeComplete(); encodeComplete = _encodeCompleteCallback->EncodeComplete();
@ -430,14 +430,14 @@ GenericCodecTest::Perform(CmdArgs& args)
} }
TEST(strncmp(_sendCodec.plName, "I420", 4) == 0); TEST(strncmp(_sendCodec.plName, "I420", 4) == 0);
_vcm->InitializeSender(); _vcm->InitializeSender();
_sendCodec.maxFramerate = static_cast<WebRtc_UWord8>(_frameRate / 2.0 + 0.5f); _sendCodec.maxFramerate = static_cast<uint8_t>(_frameRate / 2.0 + 0.5f);
_vcm->RegisterSendCodec(&_sendCodec, 4, 1440); _vcm->RegisterSendCodec(&_sendCodec, 4, 1440);
_vcm->SetChannelParameters(2000000, 0, 0); _vcm->SetChannelParameters(2000000, 0, 0);
_vcm->RegisterTransportCallback(_encodeCompleteCallback); _vcm->RegisterTransportCallback(_encodeCompleteCallback);
// up to here // up to here
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 20); _vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 20);
_encodeCompleteCallback->Initialize(); _encodeCompleteCallback->Initialize();
sendStats.set_framerate(static_cast<WebRtc_UWord32>(_frameRate)); sendStats.set_framerate(static_cast<uint32_t>(_frameRate));
sendStats.set_bitrate(1000 * _bitRate); sendStats.set_bitrate(1000 * _bitRate);
_vcm->RegisterSendStatisticsCallback(&sendStats); _vcm->RegisterSendStatisticsCallback(&sendStats);
rewind(_sourceFile); rewind(_sourceFile);
@ -448,7 +448,7 @@ GenericCodecTest::Perform(CmdArgs& args)
size_uv, tmpBuffer + size_y + size_uv, size_uv, tmpBuffer + size_y + size_uv,
_width, _height, _width, _height,
_width, half_width, half_width); _width, half_width, half_width);
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate)); _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
ret = _vcm->AddVideoFrame(sourceFrame); ret = _vcm->AddVideoFrame(sourceFrame);
if (_vcm->TimeUntilNextProcess() <= 0) if (_vcm->TimeUntilNextProcess() <= 0)
@ -484,7 +484,7 @@ GenericCodecTest::Print()
float float
GenericCodecTest::WaitForEncodedFrame() const GenericCodecTest::WaitForEncodedFrame() const
{ {
WebRtc_Word64 startTime = _clock->TimeInMilliseconds(); int64_t startTime = _clock->TimeInMilliseconds();
while (_clock->TimeInMilliseconds() - startTime < kMaxWaitEncTimeMs*10) while (_clock->TimeInMilliseconds() - startTime < kMaxWaitEncTimeMs*10)
{ {
if (_encodeCompleteCallback->EncodeComplete()) if (_encodeCompleteCallback->EncodeComplete())
@ -507,12 +507,12 @@ RTPSendCallback_SizeTest::SendPacket(int channel, const void *data, int len)
_nPackets++; _nPackets++;
_payloadSizeSum += len; _payloadSizeSum += len;
// Make sure no payloads (len - header size) are larger than maxPayloadSize // Make sure no payloads (len - header size) are larger than maxPayloadSize
TEST(len > 0 && static_cast<WebRtc_UWord32>(len - 12) <= _maxPayloadSize); TEST(len > 0 && static_cast<uint32_t>(len - 12) <= _maxPayloadSize);
return 0; return 0;
} }
void void
RTPSendCallback_SizeTest::SetMaxPayloadSize(WebRtc_UWord32 maxPayloadSize) RTPSendCallback_SizeTest::SetMaxPayloadSize(uint32_t maxPayloadSize)
{ {
_maxPayloadSize = maxPayloadSize; _maxPayloadSize = maxPayloadSize;
} }
@ -534,14 +534,14 @@ RTPSendCallback_SizeTest::AveragePayloadSize() const
return 0; return 0;
} }
WebRtc_Word32 int32_t
VCMEncComplete_KeyReqTest::SendData( VCMEncComplete_KeyReqTest::SendData(
const FrameType frameType, const FrameType frameType,
const WebRtc_UWord8 payloadType, const uint8_t payloadType,
const WebRtc_UWord32 timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const RTPFragmentationHeader& /*fragmentationHeader*/, const RTPFragmentationHeader& /*fragmentationHeader*/,
const webrtc::RTPVideoHeader* /*videoHdr*/) const webrtc::RTPVideoHeader* /*videoHdr*/)
{ {

View File

@ -40,13 +40,13 @@ public:
webrtc::SimulatedClock* clock); webrtc::SimulatedClock* clock);
~GenericCodecTest(); ~GenericCodecTest();
static int RunTest(CmdArgs& args); static int RunTest(CmdArgs& args);
WebRtc_Word32 Perform(CmdArgs& args); int32_t Perform(CmdArgs& args);
float WaitForEncodedFrame() const; float WaitForEncodedFrame() const;
private: private:
void Setup(CmdArgs& args); void Setup(CmdArgs& args);
void Print(); void Print();
WebRtc_Word32 TearDown(); int32_t TearDown();
void IncrementDebugClock(float frameRate); void IncrementDebugClock(float frameRate);
webrtc::SimulatedClock* _clock; webrtc::SimulatedClock* _clock;
@ -56,15 +56,15 @@ private:
std::string _inname; std::string _inname;
std::string _outname; std::string _outname;
std::string _encodedName; std::string _encodedName;
WebRtc_Word32 _sumEncBytes; int32_t _sumEncBytes;
FILE* _sourceFile; FILE* _sourceFile;
FILE* _decodedFile; FILE* _decodedFile;
FILE* _encodedFile; FILE* _encodedFile;
WebRtc_UWord16 _width; uint16_t _width;
WebRtc_UWord16 _height; uint16_t _height;
float _frameRate; float _frameRate;
WebRtc_UWord32 _lengthSourceFrame; uint32_t _lengthSourceFrame;
WebRtc_UWord32 _timeStamp; uint32_t _timeStamp;
VCMDecodeCompleteCallback* _decodeCallback; VCMDecodeCompleteCallback* _decodeCallback;
VCMEncodeCompleteCallback* _encodeCompleteCallback; VCMEncodeCompleteCallback* _encodeCompleteCallback;
@ -77,32 +77,32 @@ public:
RTPSendCallback_SizeTest() : _maxPayloadSize(0), _payloadSizeSum(0), _nPackets(0) {} RTPSendCallback_SizeTest() : _maxPayloadSize(0), _payloadSizeSum(0), _nPackets(0) {}
virtual int SendPacket(int channel, const void *data, int len); virtual int SendPacket(int channel, const void *data, int len);
virtual int SendRTCPPacket(int channel, const void *data, int len) {return 0;} virtual int SendRTCPPacket(int channel, const void *data, int len) {return 0;}
void SetMaxPayloadSize(WebRtc_UWord32 maxPayloadSize); void SetMaxPayloadSize(uint32_t maxPayloadSize);
void Reset(); void Reset();
float AveragePayloadSize() const; float AveragePayloadSize() const;
private: private:
WebRtc_UWord32 _maxPayloadSize; uint32_t _maxPayloadSize;
WebRtc_UWord32 _payloadSizeSum; uint32_t _payloadSizeSum;
WebRtc_UWord32 _nPackets; uint32_t _nPackets;
}; };
class VCMEncComplete_KeyReqTest : public webrtc::VCMPacketizationCallback class VCMEncComplete_KeyReqTest : public webrtc::VCMPacketizationCallback
{ {
public: public:
VCMEncComplete_KeyReqTest(webrtc::VideoCodingModule &vcm) : _vcm(vcm), _seqNo(0), _timeStamp(0) {} VCMEncComplete_KeyReqTest(webrtc::VideoCodingModule &vcm) : _vcm(vcm), _seqNo(0), _timeStamp(0) {}
WebRtc_Word32 SendData( int32_t SendData(
const webrtc::FrameType frameType, const webrtc::FrameType frameType,
const WebRtc_UWord8 payloadType, const uint8_t payloadType,
WebRtc_UWord32 timeStamp, uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const webrtc::RTPFragmentationHeader& fragmentationHeader, const webrtc::RTPFragmentationHeader& fragmentationHeader,
const webrtc::RTPVideoHeader* videoHdr); const webrtc::RTPVideoHeader* videoHdr);
private: private:
webrtc::VideoCodingModule& _vcm; webrtc::VideoCodingModule& _vcm;
WebRtc_UWord16 _seqNo; uint16_t _seqNo;
WebRtc_UWord32 _timeStamp; uint32_t _timeStamp;
}; // end of VCMEncodeCompleteCallback }; // end of VCMEncodeCompleteCallback
} // namespace webrtc } // namespace webrtc

View File

@ -36,7 +36,7 @@ int CheckOutFrame(VCMEncodedFrame* frameOut, unsigned int size, bool startCode)
return -1; return -1;
} }
const WebRtc_UWord8* outData = frameOut->Buffer(); const uint8_t* outData = frameOut->Buffer();
unsigned int i = 0; unsigned int i = 0;
@ -96,10 +96,10 @@ int JitterBufferTest(CmdArgs& args)
Clock* clock = Clock::GetRealTimeClock(); Clock* clock = Clock::GetRealTimeClock();
// Start test // Start test
WebRtc_UWord16 seqNum = 1234; uint16_t seqNum = 1234;
WebRtc_UWord32 timeStamp = 0; uint32_t timeStamp = 0;
int size = 1400; int size = 1400;
WebRtc_UWord8 data[1500]; uint8_t data[1500];
VCMPacket packet(data, size, seqNum, timeStamp, true); VCMPacket packet(data, size, seqNum, timeStamp, true);
NullEventFactory event_factory; NullEventFactory event_factory;
@ -109,7 +109,7 @@ int JitterBufferTest(CmdArgs& args)
timeStamp = 123*90; timeStamp = 123*90;
FrameType incomingFrameType(kVideoFrameKey); FrameType incomingFrameType(kVideoFrameKey);
VCMEncodedFrame* frameOut=NULL; VCMEncodedFrame* frameOut=NULL;
WebRtc_Word64 renderTimeMs = 0; int64_t renderTimeMs = 0;
packet.timestamp = timeStamp; packet.timestamp = timeStamp;
packet.seqNum = seqNum; packet.seqNum = seqNum;
@ -1568,8 +1568,8 @@ int JitterBufferTest(CmdArgs& args)
loop = 0; loop = 0;
seqNum = 65485; seqNum = 65485;
WebRtc_UWord32 timeStampStart = timeStamp + 33*90; uint32_t timeStampStart = timeStamp + 33*90;
WebRtc_UWord32 timeStampFirstKey = 0; uint32_t timeStampFirstKey = 0;
VCMEncodedFrame* ptrLastDeltaFrame = NULL; VCMEncodedFrame* ptrLastDeltaFrame = NULL;
VCMEncodedFrame* ptrFirstKeyFrame = NULL; VCMEncodedFrame* ptrFirstKeyFrame = NULL;
// insert MAX_NUMBER_OF_FRAMES frames // insert MAX_NUMBER_OF_FRAMES frames

View File

@ -64,8 +64,8 @@ JitterEstimateTest::GenerateFrameSample()
else else
_counter++; _counter++;
} }
WebRtc_Word64 jitter = static_cast<WebRtc_Word64>(_jitter.RandValue() + 1.0/_capacity * frameSize + 0.5); int64_t jitter = static_cast<int64_t>(_jitter.RandValue() + 1.0/_capacity * frameSize + 0.5);
_prevWallClock += static_cast<WebRtc_Word64>(1000*increment + 0.5); _prevWallClock += static_cast<int64_t>(1000*increment + 0.5);
double rndValue = RandUniform(); double rndValue = RandUniform();
resent = (rndValue < _lossrate); resent = (rndValue < _lossrate);
//printf("rndValue = %f\n", rndValue); //printf("rndValue = %f\n", rndValue);

View File

@ -63,11 +63,11 @@ class FrameSample
{ {
public: public:
FrameSample() {FrameSample(0, 0, 0, false, false);} FrameSample() {FrameSample(0, 0, 0, false, false);}
FrameSample(unsigned int ts, WebRtc_Word64 wallClk, unsigned int fs, bool _keyFrame, bool _resent): FrameSample(unsigned int ts, int64_t wallClk, unsigned int fs, bool _keyFrame, bool _resent):
timestamp90Khz(ts), wallClockMs(wallClk), frameSize(fs), keyFrame(_keyFrame), resent(_resent) {} timestamp90Khz(ts), wallClockMs(wallClk), frameSize(fs), keyFrame(_keyFrame), resent(_resent) {}
unsigned int timestamp90Khz; unsigned int timestamp90Khz;
WebRtc_Word64 wallClockMs; int64_t wallClockMs;
unsigned int frameSize; unsigned int frameSize;
bool keyFrame; bool keyFrame;
bool resent; bool resent;
@ -94,7 +94,7 @@ private:
//GaussDist _noResend; //GaussDist _noResend;
GaussDist _deltaFrameSize; GaussDist _deltaFrameSize;
unsigned int _prevTimestamp; unsigned int _prevTimestamp;
WebRtc_Word64 _prevWallClock; int64_t _prevWallClock;
unsigned int _nextDelay; unsigned int _nextDelay;
double _keyFrameRate; double _keyFrameRate;
unsigned int _counter; unsigned int _counter;

View File

@ -168,7 +168,7 @@ void MediaOptTest::Setup(int testType, CmdArgs& args) {
void void
MediaOptTest::GeneralSetup() MediaOptTest::GeneralSetup()
{ {
WebRtc_UWord32 minPlayoutDelayMs = 0; uint32_t minPlayoutDelayMs = 0;
if ((_sourceFile = fopen(_inname.c_str(), "rb")) == NULL) if ((_sourceFile = fopen(_inname.c_str(), "rb")) == NULL)
{ {
@ -237,7 +237,7 @@ MediaOptTest::GeneralSetup()
VideoCodec sendCodec; VideoCodec sendCodec;
_vcm->InitializeSender(); _vcm->InitializeSender();
_vcm->InitializeReceiver(); _vcm->InitializeReceiver();
WebRtc_Word32 numberOfCodecs = _vcm->NumberOfCodecs(); int32_t numberOfCodecs = _vcm->NumberOfCodecs();
if (numberOfCodecs < 1) if (numberOfCodecs < 1)
{ {
exit(1); exit(1);
@ -252,7 +252,7 @@ MediaOptTest::GeneralSetup()
sendCodec.startBitrate = (int) _bitRate; sendCodec.startBitrate = (int) _bitRate;
sendCodec.height = _height; sendCodec.height = _height;
sendCodec.width = _width; sendCodec.width = _width;
sendCodec.maxFramerate = (WebRtc_UWord8)_frameRate; sendCodec.maxFramerate = (uint8_t)_frameRate;
_vcm->RegisterSendCodec(&sendCodec, _numberOfCores, 1440); _vcm->RegisterSendCodec(&sendCodec, _numberOfCores, 1440);
_vcm->RegisterReceiveCodec(&sendCodec, _numberOfCores); // same settings for encode and decode _vcm->RegisterReceiveCodec(&sendCodec, _numberOfCores); // same settings for encode and decode
@ -263,7 +263,7 @@ MediaOptTest::GeneralSetup()
WebRtc_Word32 int32_t
MediaOptTest::Perform() MediaOptTest::Perform()
{ {
VCMDecodeCompleteCallback receiveCallback(_decodedFile); VCMDecodeCompleteCallback receiveCallback(_decodedFile);
@ -289,9 +289,9 @@ MediaOptTest::Perform()
// START TEST // START TEST
I420VideoFrame sourceFrame; I420VideoFrame sourceFrame;
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), _vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate),
(WebRtc_UWord8)_lossRate, _rttMS); (uint8_t)_lossRate, _rttMS);
_vcm->RegisterReceiveCallback(&receiveCallback); _vcm->RegisterReceiveCallback(&receiveCallback);
_frameCnt = 0; _frameCnt = 0;
@ -311,14 +311,14 @@ MediaOptTest::Perform()
size_uv, tmpBuffer + size_y + size_uv, size_uv, tmpBuffer + size_y + size_uv,
_width, _height, _width, _height,
_width, half_width, half_width); _width, half_width, half_width);
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate)); _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK);
// inform RTP Module of error resilience features // inform RTP Module of error resilience features
//_rtp->SetFECCodeRate(protectionCallback.FECKeyRate(),protectionCallback.FECDeltaRate()); //_rtp->SetFECCodeRate(protectionCallback.FECKeyRate(),protectionCallback.FECDeltaRate());
//_rtp->SetNACKStatus(protectionCallback.NACKMethod()); //_rtp->SetNACKStatus(protectionCallback.NACKMethod());
WebRtc_Word32 ret = _vcm->Decode(); int32_t ret = _vcm->Decode();
if (ret < 0 ) if (ret < 0 )
{ {
TEST(ret == 0); TEST(ret == 0);

View File

@ -39,7 +39,7 @@ public:
static int RunTest(int testNum, CmdArgs& args); static int RunTest(int testNum, CmdArgs& args);
// perform encode-decode of an entire sequence // perform encode-decode of an entire sequence
WebRtc_Word32 Perform(); int32_t Perform();
// Set up for a single mode test // Set up for a single mode test
void Setup(int testType, CmdArgs& args); void Setup(int testType, CmdArgs& args);
// General set up - applicable for both modes // General set up - applicable for both modes
@ -66,24 +66,24 @@ private:
FILE* _decodedFile; FILE* _decodedFile;
FILE* _actualSourceFile; FILE* _actualSourceFile;
FILE* _outputRes; FILE* _outputRes;
WebRtc_UWord16 _width; uint16_t _width;
WebRtc_UWord16 _height; uint16_t _height;
WebRtc_UWord32 _lengthSourceFrame; uint32_t _lengthSourceFrame;
WebRtc_UWord32 _timeStamp; uint32_t _timeStamp;
float _frameRate; float _frameRate;
bool _nackEnabled; bool _nackEnabled;
bool _fecEnabled; bool _fecEnabled;
bool _nackFecEnabled; bool _nackFecEnabled;
WebRtc_UWord8 _rttMS; uint8_t _rttMS;
float _bitRate; float _bitRate;
double _lossRate; double _lossRate;
WebRtc_UWord32 _renderDelayMs; uint32_t _renderDelayMs;
WebRtc_Word32 _frameCnt; int32_t _frameCnt;
float _sumEncBytes; float _sumEncBytes;
WebRtc_Word32 _numFramesDropped; int32_t _numFramesDropped;
std::string _codecName; std::string _codecName;
webrtc::VideoCodecType _sendCodecType; webrtc::VideoCodecType _sendCodecType;
WebRtc_Word32 _numberOfCores; int32_t _numberOfCores;
//for release test#2 //for release test#2
FILE* _fpinp; FILE* _fpinp;

View File

@ -34,11 +34,11 @@ MainSenderThread(void* obj)
EventWrapper& waitEvent = *EventWrapper::Create(); EventWrapper& waitEvent = *EventWrapper::Create();
// preparing a frame for encoding // preparing a frame for encoding
I420VideoFrame sourceFrame; I420VideoFrame sourceFrame;
WebRtc_Word32 width = state->_args.width; int32_t width = state->_args.width;
WebRtc_Word32 height = state->_args.height; int32_t height = state->_args.height;
float frameRate = state->_args.frameRate; float frameRate = state->_args.frameRate;
WebRtc_Word32 lengthSourceFrame = 3*width*height/2; int32_t lengthSourceFrame = 3*width*height/2;
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[lengthSourceFrame]; uint8_t* tmpBuffer = new uint8_t[lengthSourceFrame];
if (state->_sourceFile == NULL) if (state->_sourceFile == NULL)
{ {
@ -65,10 +65,10 @@ MainSenderThread(void* obj)
size_uv, tmpBuffer + size_y + size_uv, size_uv, tmpBuffer + size_y + size_uv,
width, height, width, height,
width, half_width, half_width); width, half_width, half_width);
state->_timestamp += (WebRtc_UWord32)(9e4 / frameRate); state->_timestamp += (uint32_t)(9e4 / frameRate);
sourceFrame.set_timestamp(state->_timestamp); sourceFrame.set_timestamp(state->_timestamp);
WebRtc_Word32 ret = state->_vcm.AddVideoFrame(sourceFrame); int32_t ret = state->_vcm.AddVideoFrame(sourceFrame);
if (ret < 0) if (ret < 0)
{ {
printf("Add Frame error: %d\n", ret); printf("Add Frame error: %d\n", ret);
@ -105,21 +105,21 @@ int MTRxTxTest(CmdArgs& args)
else else
outname = args.outputFile; outname = args.outputFile;
WebRtc_UWord16 width = args.width; uint16_t width = args.width;
WebRtc_UWord16 height = args.height; uint16_t height = args.height;
float frameRate = args.frameRate; float frameRate = args.frameRate;
float bitRate = args.bitRate; float bitRate = args.bitRate;
WebRtc_Word32 numberOfCores = 1; int32_t numberOfCores = 1;
// error resilience/network // error resilience/network
// Nack support is currently not implemented in this test. // Nack support is currently not implemented in this test.
bool nackEnabled = false; bool nackEnabled = false;
bool fecEnabled = false; bool fecEnabled = false;
WebRtc_UWord8 rttMS = 20; uint8_t rttMS = 20;
float lossRate = 0.0*255; // no packet loss float lossRate = 0.0*255; // no packet loss
WebRtc_UWord32 renderDelayMs = 0; uint32_t renderDelayMs = 0;
WebRtc_UWord32 minPlayoutDelayMs = 0; uint32_t minPlayoutDelayMs = 0;
/* TEST SET-UP */ /* TEST SET-UP */
@ -187,7 +187,7 @@ int MTRxTxTest(CmdArgs& args)
// registering codecs for the VCM module // registering codecs for the VCM module
VideoCodec sendCodec; VideoCodec sendCodec;
vcm->InitializeSender(); vcm->InitializeSender();
WebRtc_Word32 numberOfCodecs = vcm->NumberOfCodecs(); int32_t numberOfCodecs = vcm->NumberOfCodecs();
if (numberOfCodecs < 1) if (numberOfCodecs < 1)
{ {
return -1; return -1;
@ -203,7 +203,7 @@ int MTRxTxTest(CmdArgs& args)
sendCodec.startBitrate = (int) bitRate; sendCodec.startBitrate = (int) bitRate;
sendCodec.height = height; sendCodec.height = height;
sendCodec.width = width; sendCodec.width = width;
sendCodec.maxFramerate = (WebRtc_UWord8)frameRate; sendCodec.maxFramerate = (uint8_t)frameRate;
vcm->RegisterSendCodec(&sendCodec, numberOfCores, 1440); vcm->RegisterSendCodec(&sendCodec, numberOfCores, 1440);
vcm->RegisterReceiveCodec(&sendCodec, numberOfCores); // same settings for encode and decode vcm->RegisterReceiveCodec(&sendCodec, numberOfCores); // same settings for encode and decode
@ -240,7 +240,7 @@ int MTRxTxTest(CmdArgs& args)
rtp->SetNACKStatus(nackEnabled ? kNackRtcp : kNackOff, kMaxPacketAgeToNack); rtp->SetNACKStatus(nackEnabled ? kNackRtcp : kNackOff, kMaxPacketAgeToNack);
vcm->SetChannelParameters(static_cast<uint32_t>(1000 * bitRate), vcm->SetChannelParameters(static_cast<uint32_t>(1000 * bitRate),
(WebRtc_UWord8) lossRate, rttMS); (uint8_t) lossRate, rttMS);
SharedRTPState mtState(*vcm, *rtp); // receive side SharedRTPState mtState(*vcm, *rtp); // receive side
SendSharedState mtSendState(*vcm, *rtp, args); // send side SendSharedState mtSendState(*vcm, *rtp, args); // send side

View File

@ -34,7 +34,7 @@ TransportCallback::SendPacket(int channel, const void *data, int len)
if (_rtpDump != NULL) if (_rtpDump != NULL)
{ {
if (_rtpDump->DumpPacket((const WebRtc_UWord8*)data, len) != 0) if (_rtpDump->DumpPacket((const uint8_t*)data, len) != 0)
{ {
return -1; return -1;
} }
@ -58,8 +58,8 @@ TransportCallback::SendPacket(int channel, const void *data, int len)
// Simulate receive time = network delay + packet jitter // Simulate receive time = network delay + packet jitter
// simulated as a Normal distribution random variable with // simulated as a Normal distribution random variable with
// mean = networkDelay and variance = jitterVar // mean = networkDelay and variance = jitterVar
WebRtc_Word32 int32_t
simulatedDelay = (WebRtc_Word32)NormalDist(_networkDelayMs, simulatedDelay = (int32_t)NormalDist(_networkDelayMs,
sqrt(_jitterVar)); sqrt(_jitterVar));
newPacket->receiveTime = now + simulatedDelay; newPacket->receiveTime = now + simulatedDelay;
_rtpPackets.push_back(newPacket); _rtpPackets.push_back(newPacket);
@ -79,7 +79,7 @@ TransportCallback::TransportPackets()
{ {
// Take first packet in list // Take first packet in list
packet = _rtpPackets.front(); packet = _rtpPackets.front();
WebRtc_Word64 timeToReceive = packet->receiveTime - now; int64_t timeToReceive = packet->receiveTime - now;
if (timeToReceive > 0) if (timeToReceive > 0)
{ {
// No available packets to send // No available packets to send
@ -88,7 +88,7 @@ TransportCallback::TransportPackets()
_rtpPackets.pop_front(); _rtpPackets.pop_front();
// Send to receive side // Send to receive side
if (_rtp->IncomingPacket((const WebRtc_UWord8*)packet->data, if (_rtp->IncomingPacket((const uint8_t*)packet->data,
packet->length) < 0) packet->length) < 0)
{ {
delete packet; delete packet;

View File

@ -38,8 +38,8 @@ public:
webrtc::RtpRtcp& _rtp; webrtc::RtpRtcp& _rtp;
CmdArgs _args; CmdArgs _args;
FILE* _sourceFile; FILE* _sourceFile;
WebRtc_Word32 _frameCnt; int32_t _frameCnt;
WebRtc_Word32 _timestamp; int32_t _timestamp;
}; };
// MT implementation of the RTPSendCompleteCallback (Transport) // MT implementation of the RTPSendCompleteCallback (Transport)

View File

@ -69,14 +69,14 @@ void VCMNTEncodeCompleteCallback::RegisterTransportCallback(
{ {
} }
WebRtc_Word32 int32_t
VCMNTEncodeCompleteCallback::SendData( VCMNTEncodeCompleteCallback::SendData(
const FrameType frameType, const FrameType frameType,
const WebRtc_UWord8 payloadType, const uint8_t payloadType,
const WebRtc_UWord32 timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const RTPFragmentationHeader& /*fragmentationHeader*/, const RTPFragmentationHeader& /*fragmentationHeader*/,
const webrtc::RTPVideoHeader* videoHdr) const webrtc::RTPVideoHeader* videoHdr)
@ -131,13 +131,13 @@ VCMNTEncodeCompleteCallback::RegisterReceiverVCM(VideoCodingModule *vcm)
_VCMReceiver = vcm; _VCMReceiver = vcm;
return; return;
} }
WebRtc_Word32 int32_t
VCMNTEncodeCompleteCallback::EncodedBytes() VCMNTEncodeCompleteCallback::EncodedBytes()
{ {
return _encodedBytes; return _encodedBytes;
} }
WebRtc_UWord32 uint32_t
VCMNTEncodeCompleteCallback::SkipCnt() VCMNTEncodeCompleteCallback::SkipCnt()
{ {
return _skipCnt; return _skipCnt;
@ -149,7 +149,7 @@ VCMNTDecodeCompleCallback::~VCMNTDecodeCompleCallback()
if (_decodedFile) if (_decodedFile)
fclose(_decodedFile); fclose(_decodedFile);
} }
WebRtc_Word32 int32_t
VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame) VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
{ {
if (videoFrame.width() != _currentWidth || if (videoFrame.width() != _currentWidth ||
@ -172,7 +172,7 @@ VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
return VCM_OK; return VCM_OK;
} }
WebRtc_Word32 int32_t
VCMNTDecodeCompleCallback::DecodedBytes() VCMNTDecodeCompleCallback::DecodedBytes()
{ {
return _decodedBytes; return _decodedBytes;
@ -241,7 +241,7 @@ NormalTest::Setup(const CmdArgs& args)
std::fstream::out | std::fstream::app); std::fstream::out | std::fstream::app);
} }
WebRtc_Word32 int32_t
NormalTest::Perform(const CmdArgs& args) NormalTest::Perform(const CmdArgs& args)
{ {
Setup(args); Setup(args);
@ -252,8 +252,8 @@ NormalTest::Perform(const CmdArgs& args)
TEST(VideoCodingModule::Codec(_videoType, &_sendCodec) == VCM_OK); TEST(VideoCodingModule::Codec(_videoType, &_sendCodec) == VCM_OK);
// should be later on changed via the API // should be later on changed via the API
_sendCodec.startBitrate = (int)_bitRate; _sendCodec.startBitrate = (int)_bitRate;
_sendCodec.width = static_cast<WebRtc_UWord16>(_width); _sendCodec.width = static_cast<uint16_t>(_width);
_sendCodec.height = static_cast<WebRtc_UWord16>(_height); _sendCodec.height = static_cast<uint16_t>(_height);
_sendCodec.maxFramerate = _frameRate; _sendCodec.maxFramerate = _frameRate;
// will also set and init the desired codec // will also set and init the desired codec
TEST(_vcm->RegisterSendCodec(&_sendCodec, 4, 1400) == VCM_OK); TEST(_vcm->RegisterSendCodec(&_sendCodec, 4, 1400) == VCM_OK);
@ -276,12 +276,12 @@ NormalTest::Perform(const CmdArgs& args)
int size_uv = half_width * half_height; int size_uv = half_width * half_height;
sourceFrame.CreateEmptyFrame(_width, _height, sourceFrame.CreateEmptyFrame(_width, _height,
_width, half_width, half_width); _width, half_width, half_width);
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
double startTime = clock()/(double)CLOCKS_PER_SEC; double startTime = clock()/(double)CLOCKS_PER_SEC;
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 0); _vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 0);
SendStatsTest sendStats; SendStatsTest sendStats;
sendStats.set_framerate(static_cast<WebRtc_UWord32>(_frameRate)); sendStats.set_framerate(static_cast<uint32_t>(_frameRate));
sendStats.set_bitrate(1000 * _bitRate); sendStats.set_bitrate(1000 * _bitRate);
_vcm->RegisterSendStatisticsCallback(&sendStats); _vcm->RegisterSendStatisticsCallback(&sendStats);
@ -295,11 +295,11 @@ NormalTest::Perform(const CmdArgs& args)
_width, _height, _width, _height,
_width, half_width, half_width); _width, half_width, half_width);
_timeStamp += _timeStamp +=
(WebRtc_UWord32)(9e4 / static_cast<float>(_sendCodec.maxFramerate)); (uint32_t)(9e4 / static_cast<float>(_sendCodec.maxFramerate));
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
_encodeTimes[int(sourceFrame.timestamp())] = _encodeTimes[int(sourceFrame.timestamp())] =
clock()/(double)CLOCKS_PER_SEC; clock()/(double)CLOCKS_PER_SEC;
WebRtc_Word32 ret = _vcm->AddVideoFrame(sourceFrame); int32_t ret = _vcm->AddVideoFrame(sourceFrame);
double encodeTime = clock()/(double)CLOCKS_PER_SEC - double encodeTime = clock()/(double)CLOCKS_PER_SEC -
_encodeTimes[int(sourceFrame.timestamp())]; _encodeTimes[int(sourceFrame.timestamp())];
_totalEncodeTime += encodeTime; _totalEncodeTime += encodeTime;
@ -322,8 +322,8 @@ NormalTest::Perform(const CmdArgs& args)
{ {
_vcm->Process(); _vcm->Process();
} }
WebRtc_UWord32 framePeriod = uint32_t framePeriod =
static_cast<WebRtc_UWord32>( static_cast<uint32_t>(
1000.0f / static_cast<float>(_sendCodec.maxFramerate) + 0.5f); 1000.0f / static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(framePeriod); static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(framePeriod);
} }
@ -339,7 +339,7 @@ NormalTest::Perform(const CmdArgs& args)
} }
void void
NormalTest::FrameEncoded(WebRtc_UWord32 timeStamp) NormalTest::FrameEncoded(uint32_t timeStamp)
{ {
_encodeCompleteTime = clock()/(double)CLOCKS_PER_SEC; _encodeCompleteTime = clock()/(double)CLOCKS_PER_SEC;
_encFrameCnt++; _encFrameCnt++;
@ -348,7 +348,7 @@ NormalTest::FrameEncoded(WebRtc_UWord32 timeStamp)
} }
void void
NormalTest::FrameDecoded(WebRtc_UWord32 timeStamp) NormalTest::FrameDecoded(uint32_t timeStamp)
{ {
_decodeCompleteTime = clock()/(double)CLOCKS_PER_SEC; _decodeCompleteTime = clock()/(double)CLOCKS_PER_SEC;
_decFrameCnt++; _decFrameCnt++;

View File

@ -30,13 +30,13 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback
void RegisterTransportCallback(webrtc::VCMPacketizationCallback* transport); void RegisterTransportCallback(webrtc::VCMPacketizationCallback* transport);
// process encoded data received from the encoder, // process encoded data received from the encoder,
// pass stream to the VCMReceiver module // pass stream to the VCMReceiver module
WebRtc_Word32 int32_t
SendData(const webrtc::FrameType frameType, SendData(const webrtc::FrameType frameType,
const WebRtc_UWord8 payloadType, const uint8_t payloadType,
const WebRtc_UWord32 timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const webrtc::RTPFragmentationHeader& fragmentationHeader, const webrtc::RTPFragmentationHeader& fragmentationHeader,
const webrtc::RTPVideoHeader* videoHdr); const webrtc::RTPVideoHeader* videoHdr);
@ -44,19 +44,19 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback
// Currently - encode and decode with the same vcm module. // Currently - encode and decode with the same vcm module.
void RegisterReceiverVCM(webrtc::VideoCodingModule *vcm); void RegisterReceiverVCM(webrtc::VideoCodingModule *vcm);
// Return sum of encoded data (all frames in the sequence) // Return sum of encoded data (all frames in the sequence)
WebRtc_Word32 EncodedBytes(); int32_t EncodedBytes();
// return number of encoder-skipped frames // return number of encoder-skipped frames
WebRtc_UWord32 SkipCnt();; uint32_t SkipCnt();;
// conversion function for payload type (needed for the callback function) // conversion function for payload type (needed for the callback function)
// RTPVideoVideoCodecTypes ConvertPayloadType(WebRtc_UWord8 payloadType); // RTPVideoVideoCodecTypes ConvertPayloadType(uint8_t payloadType);
private: private:
FILE* _encodedFile; FILE* _encodedFile;
WebRtc_UWord32 _encodedBytes; uint32_t _encodedBytes;
WebRtc_UWord32 _skipCnt; uint32_t _skipCnt;
webrtc::VideoCodingModule* _VCMReceiver; webrtc::VideoCodingModule* _VCMReceiver;
webrtc::FrameType _frameType; webrtc::FrameType _frameType;
WebRtc_UWord16 _seqNo; uint16_t _seqNo;
NormalTest& _test; NormalTest& _test;
}; // end of VCMEncodeCompleteCallback }; // end of VCMEncodeCompleteCallback
@ -72,8 +72,8 @@ public:
virtual ~VCMNTDecodeCompleCallback(); virtual ~VCMNTDecodeCompleCallback();
void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback); void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback);
// will write decoded frame into file // will write decoded frame into file
WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame); int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
WebRtc_Word32 DecodedBytes(); int32_t DecodedBytes();
private: private:
FILE* _decodedFile; FILE* _decodedFile;
std::string _outname; std::string _outname;
@ -89,7 +89,7 @@ public:
webrtc::Clock* clock); webrtc::Clock* clock);
~NormalTest(); ~NormalTest();
static int RunTest(const CmdArgs& args); static int RunTest(const CmdArgs& args);
WebRtc_Word32 Perform(const CmdArgs& args); int32_t Perform(const CmdArgs& args);
// option:: turn into private and call from perform // option:: turn into private and call from perform
int Width() const { return _width; }; int Width() const { return _width; };
int Height() const { return _height; }; int Height() const { return _height; };
@ -104,9 +104,9 @@ protected:
// print results to std output and to log file // print results to std output and to log file
void Print(); void Print();
// calculating pipeline delay, and encoding time // calculating pipeline delay, and encoding time
void FrameEncoded(WebRtc_UWord32 timeStamp); void FrameEncoded(uint32_t timeStamp);
// calculating pipeline delay, and decoding time // calculating pipeline delay, and decoding time
void FrameDecoded(WebRtc_UWord32 timeStamp); void FrameDecoded(uint32_t timeStamp);
webrtc::Clock* _clock; webrtc::Clock* _clock;
webrtc::VideoCodingModule* _vcm; webrtc::VideoCodingModule* _vcm;
@ -115,7 +115,7 @@ protected:
std::string _inname; std::string _inname;
std::string _outname; std::string _outname;
std::string _encodedName; std::string _encodedName;
WebRtc_Word32 _sumEncBytes; int32_t _sumEncBytes;
FILE* _sourceFile; FILE* _sourceFile;
FILE* _decodedFile; FILE* _decodedFile;
FILE* _encodedFile; FILE* _encodedFile;
@ -124,8 +124,8 @@ protected:
int _height; int _height;
float _frameRate; float _frameRate;
float _bitRate; float _bitRate;
WebRtc_UWord32 _lengthSourceFrame; uint32_t _lengthSourceFrame;
WebRtc_UWord32 _timeStamp; uint32_t _timeStamp;
webrtc::VideoCodecType _videoType; webrtc::VideoCodecType _videoType;
double _totalEncodeTime; double _totalEncodeTime;
double _totalDecodeTime; double _totalDecodeTime;
@ -136,9 +136,9 @@ protected:
double _testTotalTime; double _testTotalTime;
std::map<int, double> _encodeTimes; std::map<int, double> _encodeTimes;
std::map<int, double> _decodeTimes; std::map<int, double> _decodeTimes;
WebRtc_Word32 _frameCnt; int32_t _frameCnt;
WebRtc_Word32 _encFrameCnt; int32_t _encFrameCnt;
WebRtc_Word32 _decFrameCnt; int32_t _decFrameCnt;
}; // end of VCMNormalTestClass }; // end of VCMNormalTestClass

View File

@ -172,7 +172,7 @@ QualityModesTest::Teardown()
return; return;
} }
WebRtc_Word32 int32_t
QualityModesTest::Perform(const CmdArgs& args) QualityModesTest::Perform(const CmdArgs& args)
{ {
Setup(args); Setup(args);
@ -182,24 +182,24 @@ QualityModesTest::Perform(const CmdArgs& args)
// frame num at which an update will occur // frame num at which an update will occur
const int updateFrameNum[] = {10000}; const int updateFrameNum[] = {10000};
WebRtc_UWord32 numChanges = sizeof(updateFrameNum)/sizeof(*updateFrameNum); uint32_t numChanges = sizeof(updateFrameNum)/sizeof(*updateFrameNum);
WebRtc_UWord8 change = 0;// change counter uint8_t change = 0;// change counter
_vpm = VideoProcessingModule::Create(1); _vpm = VideoProcessingModule::Create(1);
EventWrapper* waitEvent = EventWrapper::Create(); EventWrapper* waitEvent = EventWrapper::Create();
VideoCodec codec;//both send and receive VideoCodec codec;//both send and receive
_vcm->InitializeReceiver(); _vcm->InitializeReceiver();
_vcm->InitializeSender(); _vcm->InitializeSender();
WebRtc_Word32 NumberOfCodecs = _vcm->NumberOfCodecs(); int32_t NumberOfCodecs = _vcm->NumberOfCodecs();
for (int i = 0; i < NumberOfCodecs; i++) for (int i = 0; i < NumberOfCodecs; i++)
{ {
_vcm->Codec(i, &codec); _vcm->Codec(i, &codec);
if(strncmp(codec.plName,"VP8" , 5) == 0) if(strncmp(codec.plName,"VP8" , 5) == 0)
{ {
codec.startBitrate = (int)_bitRate; codec.startBitrate = (int)_bitRate;
codec.maxFramerate = (WebRtc_UWord8) _frameRate; codec.maxFramerate = (uint8_t) _frameRate;
codec.width = (WebRtc_UWord16)_width; codec.width = (uint16_t)_width;
codec.height = (WebRtc_UWord16)_height; codec.height = (uint16_t)_height;
codec.codecSpecific.VP8.frameDroppingOn = false; codec.codecSpecific.VP8.frameDroppingOn = false;
// Will also set and init the desired codec // Will also set and init the desired codec
@ -237,27 +237,27 @@ QualityModesTest::Perform(const CmdArgs& args)
I420VideoFrame sourceFrame; I420VideoFrame sourceFrame;
I420VideoFrame *decimatedFrame = NULL; I420VideoFrame *decimatedFrame = NULL;
WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
double startTime = clock()/(double)CLOCKS_PER_SEC; double startTime = clock()/(double)CLOCKS_PER_SEC;
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 0); _vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 0);
SendStatsTest sendStats; SendStatsTest sendStats;
sendStats.set_framerate(static_cast<WebRtc_UWord32>(_frameRate)); sendStats.set_framerate(static_cast<uint32_t>(_frameRate));
sendStats.set_bitrate(1000 * _bitRate); sendStats.set_bitrate(1000 * _bitRate);
_vcm->RegisterSendStatisticsCallback(&sendStats); _vcm->RegisterSendStatisticsCallback(&sendStats);
VideoContentMetrics* contentMetrics = NULL; VideoContentMetrics* contentMetrics = NULL;
// setting user frame rate // setting user frame rate
_vpm->SetMaxFrameRate((WebRtc_UWord32)(_nativeFrameRate+ 0.5f)); _vpm->SetMaxFrameRate((uint32_t)(_nativeFrameRate+ 0.5f));
// for starters: keeping native values: // for starters: keeping native values:
_vpm->SetTargetResolution(_width, _height, _vpm->SetTargetResolution(_width, _height,
(WebRtc_UWord32)(_frameRate+ 0.5f)); (uint32_t)(_frameRate+ 0.5f));
_decodeCallback.SetOriginalFrameDimensions(_nativeWidth, _nativeHeight); _decodeCallback.SetOriginalFrameDimensions(_nativeWidth, _nativeHeight);
//tmp - disabling VPM frame dropping //tmp - disabling VPM frame dropping
_vpm->EnableTemporalDecimation(false); _vpm->EnableTemporalDecimation(false);
WebRtc_Word32 ret = 0; int32_t ret = 0;
_numFramesDroppedVPM = 0; _numFramesDroppedVPM = 0;
do { do {
@ -273,7 +273,7 @@ QualityModesTest::Perform(const CmdArgs& args)
(_nativeWidth + 1) / 2); (_nativeWidth + 1) / 2);
_timeStamp += _timeStamp +=
(WebRtc_UWord32)(9e4 / static_cast<float>(codec.maxFramerate)); (uint32_t)(9e4 / static_cast<float>(codec.maxFramerate));
sourceFrame.set_timestamp(_timeStamp); sourceFrame.set_timestamp(_timeStamp);
ret = _vpm->PreprocessFrame(sourceFrame, &decimatedFrame); ret = _vpm->PreprocessFrame(sourceFrame, &decimatedFrame);
@ -303,7 +303,7 @@ QualityModesTest::Perform(const CmdArgs& args)
_encodeTimes[int(sourceFrame.timestamp())] = _encodeTimes[int(sourceFrame.timestamp())] =
clock()/(double)CLOCKS_PER_SEC; clock()/(double)CLOCKS_PER_SEC;
WebRtc_Word32 ret = _vcm->AddVideoFrame(*decimatedFrame, contentMetrics); int32_t ret = _vcm->AddVideoFrame(*decimatedFrame, contentMetrics);
_totalEncodeTime += clock()/(double)CLOCKS_PER_SEC - _totalEncodeTime += clock()/(double)CLOCKS_PER_SEC -
_encodeTimes[int(sourceFrame.timestamp())]; _encodeTimes[int(sourceFrame.timestamp())];
@ -345,7 +345,7 @@ QualityModesTest::Perform(const CmdArgs& args)
_bitRate = bitRateUpdate[change]; _bitRate = bitRateUpdate[change];
_frameRate = frameRateUpdate[change]; _frameRate = frameRateUpdate[change];
codec.startBitrate = (int)_bitRate; codec.startBitrate = (int)_bitRate;
codec.maxFramerate = (WebRtc_UWord8) _frameRate; codec.maxFramerate = (uint8_t) _frameRate;
// Will also set and init the desired codec // Will also set and init the desired codec
TEST(_vcm->RegisterSendCodec(&codec, 2, 1440) == VCM_OK); TEST(_vcm->RegisterSendCodec(&codec, 2, 1440) == VCM_OK);
change++; change++;
@ -421,12 +421,12 @@ QMTestVideoSettingsCallback::Updated()
return false; return false;
} }
WebRtc_Word32 int32_t
QMTestVideoSettingsCallback::SetVideoQMSettings(const WebRtc_UWord32 frameRate, QMTestVideoSettingsCallback::SetVideoQMSettings(const uint32_t frameRate,
const WebRtc_UWord32 width, const uint32_t width,
const WebRtc_UWord32 height) const uint32_t height)
{ {
WebRtc_Word32 retVal = 0; int32_t retVal = 0;
printf("QM updates: W = %d, H = %d, FR = %d, \n", width, height, frameRate); printf("QM updates: W = %d, H = %d, FR = %d, \n", width, height, frameRate);
retVal = _vpm->SetTargetResolution(width, height, frameRate); retVal = _vpm->SetTargetResolution(width, height, frameRate);
//Initialize codec with new values - is this the best place to do it? //Initialize codec with new values - is this the best place to do it?
@ -436,9 +436,9 @@ QMTestVideoSettingsCallback::SetVideoQMSettings(const WebRtc_UWord32 frameRate,
VideoCodec currentCodec; VideoCodec currentCodec;
_vcm->SendCodec(&currentCodec); _vcm->SendCodec(&currentCodec);
// now set new values: // now set new values:
currentCodec.height = (WebRtc_UWord16)height; currentCodec.height = (uint16_t)height;
currentCodec.width = (WebRtc_UWord16)width; currentCodec.width = (uint16_t)width;
currentCodec.maxFramerate = (WebRtc_UWord8)frameRate; currentCodec.maxFramerate = (uint8_t)frameRate;
// re-register encoder // re-register encoder
retVal = _vcm->RegisterSendCodec(&currentCodec, 2, 1440); retVal = _vcm->RegisterSendCodec(&currentCodec, 2, 1440);
@ -482,7 +482,7 @@ VCMQMDecodeCompleCallback::~VCMQMDecodeCompleCallback()
} }
} }
WebRtc_Word32 int32_t
VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame) VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame)
{ {
++frames_cnt_since_drop_; ++frames_cnt_since_drop_;
@ -537,26 +537,26 @@ VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame)
return VCM_OK; return VCM_OK;
} }
WebRtc_Word32 VCMQMDecodeCompleCallback::DecodedBytes() int32_t VCMQMDecodeCompleCallback::DecodedBytes()
{ {
return _decodedBytes; return _decodedBytes;
} }
void VCMQMDecodeCompleCallback::SetOriginalFrameDimensions(WebRtc_Word32 width, void VCMQMDecodeCompleCallback::SetOriginalFrameDimensions(int32_t width,
WebRtc_Word32 height) int32_t height)
{ {
_origWidth = width; _origWidth = width;
_origHeight = height; _origHeight = height;
} }
WebRtc_Word32 VCMQMDecodeCompleCallback::buildInterpolator() int32_t VCMQMDecodeCompleCallback::buildInterpolator()
{ {
WebRtc_UWord32 decFrameLength = _origWidth*_origHeight*3 >> 1; uint32_t decFrameLength = _origWidth*_origHeight*3 >> 1;
if (_decBuffer != NULL) if (_decBuffer != NULL)
{ {
delete [] _decBuffer; delete [] _decBuffer;
} }
_decBuffer = new WebRtc_UWord8[decFrameLength]; _decBuffer = new uint8_t[decFrameLength];
if (_decBuffer == NULL) if (_decBuffer == NULL)
{ {
return -1; return -1;

View File

@ -24,7 +24,7 @@ public:
QualityModesTest(webrtc::VideoCodingModule* vcm, QualityModesTest(webrtc::VideoCodingModule* vcm,
webrtc::Clock* clock); webrtc::Clock* clock);
virtual ~QualityModesTest(); virtual ~QualityModesTest();
WebRtc_Word32 Perform(const CmdArgs& args); int32_t Perform(const CmdArgs& args);
private: private:
@ -42,7 +42,7 @@ private:
int _nativeHeight; int _nativeHeight;
float _nativeFrameRate; float _nativeFrameRate;
WebRtc_UWord32 _numFramesDroppedVPM; uint32_t _numFramesDroppedVPM;
bool _flagSSIM; bool _flagSSIM;
std::string filename_testvideo_; std::string filename_testvideo_;
std::string fv_outfilename_; std::string fv_outfilename_;
@ -61,24 +61,24 @@ public:
virtual ~VCMQMDecodeCompleCallback(); virtual ~VCMQMDecodeCompleCallback();
void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback); void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback);
// will write decoded frame into file // will write decoded frame into file
WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame); int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
WebRtc_Word32 DecodedBytes(); int32_t DecodedBytes();
void SetOriginalFrameDimensions(WebRtc_Word32 width, WebRtc_Word32 height); void SetOriginalFrameDimensions(int32_t width, int32_t height);
WebRtc_Word32 buildInterpolator(); int32_t buildInterpolator();
// Check if last frame is dropped, if so, repeat the last rendered frame. // Check if last frame is dropped, if so, repeat the last rendered frame.
void WriteEnd(int input_tot_frame_count); void WriteEnd(int input_tot_frame_count);
private: private:
FILE* _decodedFile; FILE* _decodedFile;
WebRtc_UWord32 _decodedBytes; uint32_t _decodedBytes;
// QualityModesTest& _test; // QualityModesTest& _test;
int _origWidth; int _origWidth;
int _origHeight; int _origHeight;
int _decWidth; int _decWidth;
int _decHeight; int _decHeight;
// VideoInterpolator* _interpolator; // VideoInterpolator* _interpolator;
WebRtc_UWord8* _decBuffer; uint8_t* _decBuffer;
WebRtc_UWord32 _frameCnt; // debug uint32_t _frameCnt; // debug
webrtc::I420VideoFrame last_frame_; webrtc::I420VideoFrame last_frame_;
int frame_rate_; int frame_rate_;
int frames_cnt_since_drop_; int frames_cnt_since_drop_;
@ -93,9 +93,9 @@ class QMTestVideoSettingsCallback : public webrtc::VCMQMSettingsCallback
public: public:
QMTestVideoSettingsCallback(); QMTestVideoSettingsCallback();
// update VPM with QM settings // update VPM with QM settings
WebRtc_Word32 SetVideoQMSettings(const WebRtc_UWord32 frameRate, int32_t SetVideoQMSettings(const uint32_t frameRate,
const WebRtc_UWord32 width, const uint32_t width,
const WebRtc_UWord32 height); const uint32_t height);
// register VPM used by test // register VPM used by test
void RegisterVPM(webrtc::VideoProcessingModule* vpm); void RegisterVPM(webrtc::VideoProcessingModule* vpm);
void RegisterVCM(webrtc::VideoCodingModule* vcm); void RegisterVCM(webrtc::VideoCodingModule* vcm);

View File

@ -28,8 +28,8 @@ public:
RtpDataCallback(webrtc::VideoCodingModule* vcm) RtpDataCallback(webrtc::VideoCodingModule* vcm)
: _vcm(vcm) {}; : _vcm(vcm) {};
virtual WebRtc_Word32 OnReceivedPayloadData(const WebRtc_UWord8* payloadData, virtual int32_t OnReceivedPayloadData(const uint8_t* payloadData,
const WebRtc_UWord16 payloadSize, const uint16_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader); const webrtc::WebRtcRTPHeader* rtpHeader);
private: private:
webrtc::VideoCodingModule* _vcm; webrtc::VideoCodingModule* _vcm;
@ -48,7 +48,7 @@ public:
virtual ~FrameReceiveCallback(); virtual ~FrameReceiveCallback();
WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame); int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
private: private:
static void SplitFilename(std::string filename, std::string* basename, static void SplitFilename(std::string filename, std::string* basename,

View File

@ -58,23 +58,23 @@ int ReceiverTimingTests(CmdArgs& args)
Clock* clock = Clock::GetRealTimeClock(); Clock* clock = Clock::GetRealTimeClock();
VCMTiming timing(clock); VCMTiming timing(clock);
float clockInMs = 0.0; float clockInMs = 0.0;
WebRtc_UWord32 waitTime = 0; uint32_t waitTime = 0;
WebRtc_UWord32 jitterDelayMs = 0; uint32_t jitterDelayMs = 0;
WebRtc_UWord32 maxDecodeTimeMs = 0; uint32_t maxDecodeTimeMs = 0;
WebRtc_UWord32 timeStamp = 0; uint32_t timeStamp = 0;
timing.Reset(static_cast<WebRtc_Word64>(clockInMs + 0.5)); timing.Reset(static_cast<int64_t>(clockInMs + 0.5));
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
timing.Reset(static_cast<WebRtc_Word64>(clockInMs + 0.5)); timing.Reset(static_cast<int64_t>(clockInMs + 0.5));
timing.IncomingTimestamp(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)); timing.IncomingTimestamp(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
jitterDelayMs = 20; jitterDelayMs = 20;
timing.SetRequiredDelay(jitterDelayMs); timing.SetRequiredDelay(jitterDelayMs);
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)), waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
static_cast<WebRtc_Word64>(clockInMs + 0.5)); static_cast<int64_t>(clockInMs + 0.5));
// First update initializes the render time. Since we have no decode delay // First update initializes the render time. Since we have no decode delay
// we get waitTime = renderTime - now - renderDelay = jitter // we get waitTime = renderTime - now - renderDelay = jitter
TEST(waitTime == jitterDelayMs); TEST(waitTime == jitterDelayMs);
@ -84,8 +84,8 @@ int ReceiverTimingTests(CmdArgs& args)
clockInMs += 1000.0f; clockInMs += 1000.0f;
timing.SetRequiredDelay(jitterDelayMs); timing.SetRequiredDelay(jitterDelayMs);
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)), waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
static_cast<WebRtc_Word64>(clockInMs + 0.5)); static_cast<int64_t>(clockInMs + 0.5));
// Since we gradually increase the delay we only get // Since we gradually increase the delay we only get
// 100 ms every second. // 100 ms every second.
TEST(waitTime == jitterDelayMs - 10); TEST(waitTime == jitterDelayMs - 10);
@ -93,8 +93,8 @@ int ReceiverTimingTests(CmdArgs& args)
timeStamp += 90000; timeStamp += 90000;
clockInMs += 1000.0; clockInMs += 1000.0;
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)), waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
static_cast<WebRtc_Word64>(clockInMs + 0.5)); static_cast<int64_t>(clockInMs + 0.5));
TEST(waitTime == jitterDelayMs); TEST(waitTime == jitterDelayMs);
// 300 incoming frames without jitter, verify that this gives the exact wait time // 300 incoming frames without jitter, verify that this gives the exact wait time
@ -102,41 +102,41 @@ int ReceiverTimingTests(CmdArgs& args)
{ {
clockInMs += 1000.0f/30.0f; clockInMs += 1000.0f/30.0f;
timeStamp += 3000; timeStamp += 3000;
timing.IncomingTimestamp(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)); timing.IncomingTimestamp(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
} }
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)), waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
static_cast<WebRtc_Word64>(clockInMs + 0.5)); static_cast<int64_t>(clockInMs + 0.5));
TEST(waitTime == jitterDelayMs); TEST(waitTime == jitterDelayMs);
// Add decode time estimates // Add decode time estimates
for (int i=0; i < 10; i++) for (int i=0; i < 10; i++)
{ {
WebRtc_Word64 startTimeMs = static_cast<WebRtc_Word64>(clockInMs + 0.5); int64_t startTimeMs = static_cast<int64_t>(clockInMs + 0.5);
clockInMs += 10.0f; clockInMs += 10.0f;
timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast<WebRtc_Word64>(clockInMs + 0.5)); timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast<int64_t>(clockInMs + 0.5));
timeStamp += 3000; timeStamp += 3000;
clockInMs += 1000.0f/30.0f - 10.0f; clockInMs += 1000.0f/30.0f - 10.0f;
timing.IncomingTimestamp(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)); timing.IncomingTimestamp(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
} }
maxDecodeTimeMs = 10; maxDecodeTimeMs = 10;
timing.SetRequiredDelay(jitterDelayMs); timing.SetRequiredDelay(jitterDelayMs);
clockInMs += 1000.0f; clockInMs += 1000.0f;
timeStamp += 90000; timeStamp += 90000;
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)), waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
static_cast<WebRtc_Word64>(clockInMs + 0.5)); static_cast<int64_t>(clockInMs + 0.5));
TEST(waitTime == jitterDelayMs); TEST(waitTime == jitterDelayMs);
WebRtc_UWord32 totalDelay1 = timing.TargetVideoDelay(); uint32_t totalDelay1 = timing.TargetVideoDelay();
WebRtc_UWord32 minTotalDelayMs = 200; uint32_t minTotalDelayMs = 200;
timing.SetMinimumTotalDelay(minTotalDelayMs); timing.SetMinimumTotalDelay(minTotalDelayMs);
clockInMs += 5000.0f; clockInMs += 5000.0f;
timeStamp += 5*90000; timeStamp += 5*90000;
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)), waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
static_cast<WebRtc_Word64>(clockInMs + 0.5)); static_cast<int64_t>(clockInMs + 0.5));
WebRtc_UWord32 totalDelay2 = timing.TargetVideoDelay(); uint32_t totalDelay2 = timing.TargetVideoDelay();
// We should at least have minTotalDelayMs - decodeTime (10) - renderTime (10) to wait // We should at least have minTotalDelayMs - decodeTime (10) - renderTime (10) to wait
TEST(waitTime == minTotalDelayMs - maxDecodeTimeMs - 10); TEST(waitTime == minTotalDelayMs - maxDecodeTimeMs - 10);
// The total video delay should not increase with the extra delay, // The total video delay should not increase with the extra delay,
@ -151,8 +151,8 @@ int ReceiverTimingTests(CmdArgs& args)
// A sudden increase in timestamp of 2.1 seconds // A sudden increase in timestamp of 2.1 seconds
clockInMs += 1000.0f/30.0f; clockInMs += 1000.0f/30.0f;
timeStamp += static_cast<WebRtc_UWord32>(2.1*90000 + 0.5); timeStamp += static_cast<uint32_t>(2.1*90000 + 0.5);
WebRtc_Word64 ret = timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)); int64_t ret = timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
TEST(ret == -1); TEST(ret == -1);
timing.Reset(); timing.Reset();
@ -164,9 +164,9 @@ int ReceiverTimingTests(CmdArgs& args)
jitterDelayMs = 60; jitterDelayMs = 60;
maxDecodeTimeMs = 10; maxDecodeTimeMs = 10;
timeStamp = static_cast<WebRtc_UWord32>(-10000); // To produce a wrap timeStamp = static_cast<uint32_t>(-10000); // To produce a wrap
clockInMs = 10000.0f; clockInMs = 10000.0f;
timing.Reset(static_cast<WebRtc_Word64>(clockInMs + 0.5)); timing.Reset(static_cast<int64_t>(clockInMs + 0.5));
float noise = 0.0f; float noise = 0.0f;
for (int i=0; i < 1400; i++) for (int i=0; i < 1400; i++)
@ -189,23 +189,23 @@ int ReceiverTimingTests(CmdArgs& args)
minTotalDelayMs = 0; minTotalDelayMs = 0;
timing.SetMinimumTotalDelay(minTotalDelayMs); timing.SetMinimumTotalDelay(minTotalDelayMs);
} }
WebRtc_Word64 startTimeMs = static_cast<WebRtc_Word64>(clockInMs + 0.5); int64_t startTimeMs = static_cast<int64_t>(clockInMs + 0.5);
noise = vcmFloatMin(vcmFloatMax(GaussDist::RandValue(0, 2), -10.0f), 30.0f); noise = vcmFloatMin(vcmFloatMax(GaussDist::RandValue(0, 2), -10.0f), 30.0f);
clockInMs += 10.0f; clockInMs += 10.0f;
timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast<WebRtc_Word64>(clockInMs + noise + 0.5)); timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast<int64_t>(clockInMs + noise + 0.5));
timeStamp += 3000; timeStamp += 3000;
clockInMs += 1000.0f/30.0f - 10.0f; clockInMs += 1000.0f/30.0f - 10.0f;
noise = vcmFloatMin(vcmFloatMax(GaussDist::RandValue(0, 8), -15.0f), 15.0f); noise = vcmFloatMin(vcmFloatMax(GaussDist::RandValue(0, 8), -15.0f), 15.0f);
timing.IncomingTimestamp(timeStamp, static_cast<WebRtc_Word64>(clockInMs + noise + 0.5)); timing.IncomingTimestamp(timeStamp, static_cast<int64_t>(clockInMs + noise + 0.5));
timing.SetRequiredDelay(jitterDelayMs); timing.SetRequiredDelay(jitterDelayMs);
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)), waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5)),
static_cast<WebRtc_Word64>(clockInMs + 0.5)); static_cast<int64_t>(clockInMs + 0.5));
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, -1, "timeStamp=%u clock=%u maxWaitTime=%u", timeStamp, WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, -1, "timeStamp=%u clock=%u maxWaitTime=%u", timeStamp,
static_cast<WebRtc_UWord32>(clockInMs + 0.5), waitTime); static_cast<uint32_t>(clockInMs + 0.5), waitTime);
WebRtc_Word64 renderTimeMs = timing.RenderTimeMs(timeStamp, static_cast<WebRtc_Word64>(clockInMs + 0.5)); int64_t renderTimeMs = timing.RenderTimeMs(timeStamp, static_cast<int64_t>(clockInMs + 0.5));
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, -1, WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, -1,
"timeStamp=%u renderTime=%u", "timeStamp=%u renderTime=%u",

View File

@ -178,7 +178,7 @@ RTPPlayer::~RTPPlayer()
} }
} }
WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList) int32_t RTPPlayer::Initialize(const PayloadTypeList* payloadList)
{ {
RtpRtcp::Configuration configuration; RtpRtcp::Configuration configuration;
configuration.id = 1; configuration.id = 1;
@ -192,7 +192,7 @@ WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList)
_randVec[i] = rand(); _randVec[i] = rand();
} }
_randVecPos = 0; _randVecPos = 0;
WebRtc_Word32 ret = _rtpModule->SetNACKStatus(kNackOff, int32_t ret = _rtpModule->SetNACKStatus(kNackOff,
kMaxPacketAgeToNack); kMaxPacketAgeToNack);
if (ret < 0) if (ret < 0)
{ {
@ -229,7 +229,7 @@ WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList)
return 0; return 0;
} }
WebRtc_Word32 RTPPlayer::ReadHeader() int32_t RTPPlayer::ReadHeader()
{ {
char firstline[FIRSTLINELEN]; char firstline[FIRSTLINELEN];
if (_rtpFile == NULL) if (_rtpFile == NULL)
@ -254,11 +254,11 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
return -1; return -1;
} }
WebRtc_UWord32 start_sec; uint32_t start_sec;
WebRtc_UWord32 start_usec; uint32_t start_usec;
WebRtc_UWord32 source; uint32_t source;
WebRtc_UWord16 port; uint16_t port;
WebRtc_UWord16 padding; uint16_t padding;
EXPECT_GT(fread(&start_sec, 4, 1, _rtpFile), 0u); EXPECT_GT(fread(&start_sec, 4, 1, _rtpFile), 0u);
start_sec=ntohl(start_sec); start_sec=ntohl(start_sec);
@ -273,18 +273,18 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
return 0; return 0;
} }
WebRtc_UWord32 RTPPlayer::TimeUntilNextPacket() const uint32_t RTPPlayer::TimeUntilNextPacket() const
{ {
WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) - int64_t timeLeft = (_nextRtpTime - _firstPacketRtpTime) -
(_clock->TimeInMilliseconds() - _firstPacketTimeMs); (_clock->TimeInMilliseconds() - _firstPacketTimeMs);
if (timeLeft < 0) if (timeLeft < 0)
{ {
return 0; return 0;
} }
return static_cast<WebRtc_UWord32>(timeLeft); return static_cast<uint32_t>(timeLeft);
} }
WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow) int32_t RTPPlayer::NextPacket(const int64_t timeNow)
{ {
// Send any packets ready to be resent, // Send any packets ready to be resent,
RawRtpPacket* resend_packet = _lostPackets.NextPacketToResend(timeNow); RawRtpPacket* resend_packet = _lostPackets.NextPacketToResend(timeNow);
@ -309,15 +309,15 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
_rtpModule->Process(); _rtpModule->Process();
if (_firstPacket) if (_firstPacket)
{ {
_firstPacketRtpTime = static_cast<WebRtc_Word64>(_nextRtpTime); _firstPacketRtpTime = static_cast<int64_t>(_nextRtpTime);
_firstPacketTimeMs = _clock->TimeInMilliseconds(); _firstPacketTimeMs = _clock->TimeInMilliseconds();
} }
if (_reordering && _reorderBuffer == NULL) if (_reordering && _reorderBuffer == NULL)
{ {
_reorderBuffer = new RawRtpPacket(reinterpret_cast<WebRtc_UWord8*>(_nextPacket), static_cast<WebRtc_UWord16>(_nextPacketLength)); _reorderBuffer = new RawRtpPacket(reinterpret_cast<uint8_t*>(_nextPacket), static_cast<uint16_t>(_nextPacketLength));
return 0; return 0;
} }
WebRtc_Word32 ret = SendPacket(reinterpret_cast<WebRtc_UWord8*>(_nextPacket), static_cast<WebRtc_UWord16>(_nextPacketLength)); int32_t ret = SendPacket(reinterpret_cast<uint8_t*>(_nextPacket), static_cast<uint16_t>(_nextPacketLength));
if (_reordering && _reorderBuffer != NULL) if (_reordering && _reorderBuffer != NULL)
{ {
RawRtpPacket* rtpPacket = _reorderBuffer; RawRtpPacket* rtpPacket = _reorderBuffer;
@ -348,14 +348,14 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
return 0; return 0;
} }
WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen) int32_t RTPPlayer::SendPacket(uint8_t* rtpData, uint16_t rtpLen)
{ {
if ((_randVec[(_randVecPos++) % RAND_VEC_LENGTH] + 1.0)/(RAND_MAX + 1.0) < _lossRate && if ((_randVec[(_randVecPos++) % RAND_VEC_LENGTH] + 1.0)/(RAND_MAX + 1.0) < _lossRate &&
_noLossStartup < 0) _noLossStartup < 0)
{ {
if (_nackEnabled) if (_nackEnabled)
{ {
const WebRtc_UWord16 seqNo = (rtpData[2] << 8) + rtpData[3]; const uint16_t seqNo = (rtpData[2] << 8) + rtpData[3];
printf("Throw: %u\n", seqNo); printf("Throw: %u\n", seqNo);
_lostPackets.AddPacket(new RawRtpPacket(rtpData, rtpLen)); _lostPackets.AddPacket(new RawRtpPacket(rtpData, rtpLen));
return 0; return 0;
@ -363,7 +363,7 @@ WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLe
} }
else if (rtpLen > 0) else if (rtpLen > 0)
{ {
WebRtc_Word32 ret = _rtpModule->IncomingPacket(rtpData, rtpLen); int32_t ret = _rtpModule->IncomingPacket(rtpData, rtpLen);
if (ret < 0) if (ret < 0)
{ {
return -1; return -1;
@ -376,9 +376,9 @@ WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLe
return 1; return 1;
} }
WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset) int32_t RTPPlayer::ReadPacket(int16_t* rtpdata, uint32_t* offset)
{ {
WebRtc_UWord16 length, plen; uint16_t length, plen;
if (fread(&length,2,1,_rtpFile)==0) if (fread(&length,2,1,_rtpFile)==0)
return(-1); return(-1);
@ -393,7 +393,7 @@ WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offs
*offset=ntohl(*offset); *offset=ntohl(*offset);
// Use length here because a plen of 0 specifies rtcp // Use length here because a plen of 0 specifies rtcp
length = (WebRtc_UWord16) (length - HDR_SIZE); length = (uint16_t) (length - HDR_SIZE);
if (fread((unsigned short *) rtpdata,1,length,_rtpFile) != length) if (fread((unsigned short *) rtpdata,1,length,_rtpFile) != length)
return(-1); return(-1);
@ -408,7 +408,7 @@ WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offs
return plen; return plen;
} }
WebRtc_Word32 RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, WebRtc_UWord32 rttMs) int32_t RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, uint32_t rttMs)
{ {
_nackEnabled = enableNack; _nackEnabled = enableNack;
_lossRate = lossRate; _lossRate = lossRate;
@ -416,13 +416,13 @@ WebRtc_Word32 RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, Web
return 0; return 0;
} }
WebRtc_Word32 RTPPlayer::SetReordering(bool enabled) int32_t RTPPlayer::SetReordering(bool enabled)
{ {
_reordering = enabled; _reordering = enabled;
return 0; return 0;
} }
WebRtc_Word32 RTPPlayer::ResendPackets(const WebRtc_UWord16* sequenceNumbers, WebRtc_UWord16 length) int32_t RTPPlayer::ResendPackets(const uint16_t* sequenceNumbers, uint16_t length)
{ {
if (sequenceNumbers == NULL) if (sequenceNumbers == NULL)
{ {

View File

@ -30,7 +30,7 @@ struct PayloadCodecTuple;
struct RawRtpPacket struct RawRtpPacket
{ {
public: public:
RawRtpPacket(WebRtc_UWord8* rtp_data, WebRtc_UWord16 rtp_length); RawRtpPacket(uint8_t* rtp_data, uint16_t rtp_length);
~RawRtpPacket(); ~RawRtpPacket();
uint8_t* data; uint8_t* data;
@ -66,10 +66,10 @@ class LostPackets {
struct PayloadCodecTuple struct PayloadCodecTuple
{ {
PayloadCodecTuple(WebRtc_UWord8 plType, std::string codecName, webrtc::VideoCodecType type) : PayloadCodecTuple(uint8_t plType, std::string codecName, webrtc::VideoCodecType type) :
name(codecName), payloadType(plType), codecType(type) {}; name(codecName), payloadType(plType), codecType(type) {};
const std::string name; const std::string name;
const WebRtc_UWord8 payloadType; const uint8_t payloadType;
const webrtc::VideoCodecType codecType; const webrtc::VideoCodecType codecType;
}; };
@ -81,37 +81,37 @@ public:
webrtc::Clock* clock); webrtc::Clock* clock);
virtual ~RTPPlayer(); virtual ~RTPPlayer();
WebRtc_Word32 Initialize(const PayloadTypeList* payloadList); int32_t Initialize(const PayloadTypeList* payloadList);
WebRtc_Word32 NextPacket(const WebRtc_Word64 timeNow); int32_t NextPacket(const int64_t timeNow);
WebRtc_UWord32 TimeUntilNextPacket() const; uint32_t TimeUntilNextPacket() const;
WebRtc_Word32 SimulatePacketLoss(float lossRate, bool enableNack = false, WebRtc_UWord32 rttMs = 0); int32_t SimulatePacketLoss(float lossRate, bool enableNack = false, uint32_t rttMs = 0);
WebRtc_Word32 SetReordering(bool enabled); int32_t SetReordering(bool enabled);
WebRtc_Word32 ResendPackets(const WebRtc_UWord16* sequenceNumbers, WebRtc_UWord16 length); int32_t ResendPackets(const uint16_t* sequenceNumbers, uint16_t length);
void Print() const; void Print() const;
private: private:
WebRtc_Word32 SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen); int32_t SendPacket(uint8_t* rtpData, uint16_t rtpLen);
WebRtc_Word32 ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset); int32_t ReadPacket(int16_t* rtpdata, uint32_t* offset);
WebRtc_Word32 ReadHeader(); int32_t ReadHeader();
webrtc::Clock* _clock; webrtc::Clock* _clock;
FILE* _rtpFile; FILE* _rtpFile;
webrtc::RtpRtcp* _rtpModule; webrtc::RtpRtcp* _rtpModule;
WebRtc_UWord32 _nextRtpTime; uint32_t _nextRtpTime;
webrtc::RtpData* _dataCallback; webrtc::RtpData* _dataCallback;
bool _firstPacket; bool _firstPacket;
float _lossRate; float _lossRate;
bool _nackEnabled; bool _nackEnabled;
LostPackets _lostPackets; LostPackets _lostPackets;
WebRtc_UWord32 _resendPacketCount; uint32_t _resendPacketCount;
WebRtc_Word32 _noLossStartup; int32_t _noLossStartup;
bool _endOfFile; bool _endOfFile;
WebRtc_UWord32 _rttMs; uint32_t _rttMs;
WebRtc_Word64 _firstPacketRtpTime; int64_t _firstPacketRtpTime;
WebRtc_Word64 _firstPacketTimeMs; int64_t _firstPacketTimeMs;
RawRtpPacket* _reorderBuffer; RawRtpPacket* _reorderBuffer;
bool _reordering; bool _reordering;
WebRtc_Word16 _nextPacket[8000]; int16_t _nextPacket[8000];
WebRtc_Word32 _nextPacketLength; int32_t _nextPacketLength;
int _randVec[RAND_VEC_LENGTH]; int _randVec[RAND_VEC_LENGTH];
int _randVecPos; int _randVecPos;
}; };

View File

@ -47,14 +47,14 @@ VCMEncodeCompleteCallback::RegisterTransportCallback(
{ {
} }
WebRtc_Word32 int32_t
VCMEncodeCompleteCallback::SendData( VCMEncodeCompleteCallback::SendData(
const FrameType frameType, const FrameType frameType,
const WebRtc_UWord8 payloadType, const uint8_t payloadType,
const WebRtc_UWord32 timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const RTPFragmentationHeader& fragmentationHeader, const RTPFragmentationHeader& fragmentationHeader,
const RTPVideoHeader* videoHdr) const RTPVideoHeader* videoHdr)
{ {
@ -68,8 +68,8 @@ VCMEncodeCompleteCallback::SendData(
rtpInfo.header.markerBit = true; // end of frame rtpInfo.header.markerBit = true; // end of frame
rtpInfo.type.Video.isFirstPacket = true; rtpInfo.type.Video.isFirstPacket = true;
rtpInfo.type.Video.codec = _codecType; rtpInfo.type.Video.codec = _codecType;
rtpInfo.type.Video.height = (WebRtc_UWord16)_height; rtpInfo.type.Video.height = (uint16_t)_height;
rtpInfo.type.Video.width = (WebRtc_UWord16)_width; rtpInfo.type.Video.width = (uint16_t)_width;
switch (_codecType) switch (_codecType)
{ {
case webrtc::kRTPVideoVP8: case webrtc::kRTPVideoVP8:
@ -141,14 +141,14 @@ VCMEncodeCompleteCallback::ResetByteCount()
// passes the encoded frame via the RTP module to the decoder // passes the encoded frame via the RTP module to the decoder
// Packetization callback implementation // Packetization callback implementation
WebRtc_Word32 int32_t
VCMRTPEncodeCompleteCallback::SendData( VCMRTPEncodeCompleteCallback::SendData(
const FrameType frameType, const FrameType frameType,
const WebRtc_UWord8 payloadType, const uint8_t payloadType,
const WebRtc_UWord32 timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const RTPFragmentationHeader& fragmentationHeader, const RTPFragmentationHeader& fragmentationHeader,
const RTPVideoHeader* videoHdr) const RTPVideoHeader* videoHdr)
{ {
@ -187,7 +187,7 @@ VCMRTPEncodeCompleteCallback::EncodeComplete()
// Decoded Frame Callback Implementation // Decoded Frame Callback Implementation
WebRtc_Word32 int32_t
VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame) VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
{ {
if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) { if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) {
@ -198,7 +198,7 @@ VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
return VCM_OK; return VCM_OK;
} }
WebRtc_Word32 int32_t
VCMDecodeCompleteCallback::DecodedBytes() VCMDecodeCompleteCallback::DecodedBytes()
{ {
return _decodedBytes; return _decodedBytes;
@ -249,7 +249,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
if (_rtpDump != NULL) if (_rtpDump != NULL)
{ {
if (_rtpDump->DumpPacket((const WebRtc_UWord8*)data, len) != 0) if (_rtpDump->DumpPacket((const uint8_t*)data, len) != 0)
{ {
return -1; return -1;
} }
@ -268,8 +268,8 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
// Simulate receive time = network delay + packet jitter // Simulate receive time = network delay + packet jitter
// simulated as a Normal distribution random variable with // simulated as a Normal distribution random variable with
// mean = networkDelay and variance = jitterVar // mean = networkDelay and variance = jitterVar
WebRtc_Word32 int32_t
simulatedDelay = (WebRtc_Word32)NormalDist(_networkDelayMs, simulatedDelay = (int32_t)NormalDist(_networkDelayMs,
sqrt(_jitterVar)); sqrt(_jitterVar));
newPacket->receiveTime = now + simulatedDelay; newPacket->receiveTime = now + simulatedDelay;
_rtpPackets.push_back(newPacket); _rtpPackets.push_back(newPacket);
@ -282,7 +282,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
{ {
// Take first packet in list // Take first packet in list
packet = _rtpPackets.front(); packet = _rtpPackets.front();
WebRtc_Word64 timeToReceive = packet->receiveTime - now; int64_t timeToReceive = packet->receiveTime - now;
if (timeToReceive > 0) if (timeToReceive > 0)
{ {
// No available packets to send // No available packets to send
@ -292,7 +292,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
_rtpPackets.pop_front(); _rtpPackets.pop_front();
assert(_rtp); // We must have a configured RTP module for this test. assert(_rtp); // We must have a configured RTP module for this test.
// Send to receive side // Send to receive side
if (_rtp->IncomingPacket((const WebRtc_UWord8*)packet->data, if (_rtp->IncomingPacket((const uint8_t*)packet->data,
packet->length) < 0) packet->length) < 0)
{ {
delete packet; delete packet;
@ -397,16 +397,16 @@ RTPSendCompleteCallback::UnifomLoss(double lossPct)
return randVal < lossPct/100; return randVal < lossPct/100;
} }
WebRtc_Word32 int32_t
PacketRequester::ResendPackets(const WebRtc_UWord16* sequenceNumbers, PacketRequester::ResendPackets(const uint16_t* sequenceNumbers,
WebRtc_UWord16 length) uint16_t length)
{ {
return _rtp.SendNACK(sequenceNumbers, length); return _rtp.SendNACK(sequenceNumbers, length);
} }
WebRtc_Word32 int32_t
SendStatsTest::SendStatistics(const WebRtc_UWord32 bitRate, SendStatsTest::SendStatistics(const uint32_t bitRate,
const WebRtc_UWord32 frameRate) const uint32_t frameRate)
{ {
TEST(frameRate <= _framerate); TEST(frameRate <= _framerate);
TEST(bitRate > _bitrate / 2 && bitRate < 3 * _bitrate / 2); TEST(bitRate > _bitrate / 2 && bitRate < 3 * _bitrate / 2);
@ -414,7 +414,7 @@ SendStatsTest::SendStatistics(const WebRtc_UWord32 bitRate,
return 0; return 0;
} }
WebRtc_Word32 KeyFrameReqTest::RequestKeyFrame() { int32_t KeyFrameReqTest::RequestKeyFrame() {
printf("Key frame requested\n"); printf("Key frame requested\n");
return 0; return 0;
} }
@ -433,13 +433,13 @@ VideoProtectionCallback::~VideoProtectionCallback()
// //
} }
WebRtc_Word32 int32_t
VideoProtectionCallback::ProtectionRequest( VideoProtectionCallback::ProtectionRequest(
const FecProtectionParams* delta_fec_params, const FecProtectionParams* delta_fec_params,
const FecProtectionParams* key_fec_params, const FecProtectionParams* key_fec_params,
WebRtc_UWord32* sent_video_rate_bps, uint32_t* sent_video_rate_bps,
WebRtc_UWord32* sent_nack_rate_bps, uint32_t* sent_nack_rate_bps,
WebRtc_UWord32* sent_fec_rate_bps) uint32_t* sent_fec_rate_bps)
{ {
key_fec_params_ = *key_fec_params; key_fec_params_ = *key_fec_params;
delta_fec_params_ = *delta_fec_params; delta_fec_params_ = *delta_fec_params;

View File

@ -42,12 +42,12 @@ public:
void RegisterTransportCallback(VCMPacketizationCallback* transport); void RegisterTransportCallback(VCMPacketizationCallback* transport);
// Process encoded data received from the encoder, pass stream to the // Process encoded data received from the encoder, pass stream to the
// VCMReceiver module // VCMReceiver module
WebRtc_Word32 SendData(const FrameType frameType, int32_t SendData(const FrameType frameType,
const WebRtc_UWord8 payloadType, const uint8_t payloadType,
const WebRtc_UWord32 timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const RTPFragmentationHeader& fragmentationHeader, const RTPFragmentationHeader& fragmentationHeader,
const RTPVideoHeader* videoHdr); const RTPVideoHeader* videoHdr);
// Register exisitng VCM. Currently - encode and decode under same module. // Register exisitng VCM. Currently - encode and decode under same module.
@ -62,7 +62,7 @@ public:
void SetCodecType(RTPVideoCodecTypes codecType) void SetCodecType(RTPVideoCodecTypes codecType)
{_codecType = codecType;} {_codecType = codecType;}
// Inform callback of frame dimensions // Inform callback of frame dimensions
void SetFrameDimensions(WebRtc_Word32 width, WebRtc_Word32 height) void SetFrameDimensions(int32_t width, int32_t height)
{ {
_width = width; _width = width;
_height = height; _height = height;
@ -78,10 +78,10 @@ private:
float _encodedBytes; float _encodedBytes;
VideoCodingModule* _VCMReceiver; VideoCodingModule* _VCMReceiver;
FrameType _frameType; FrameType _frameType;
WebRtc_UWord16 _seqNo; uint16_t _seqNo;
bool _encodeComplete; bool _encodeComplete;
WebRtc_Word32 _width; int32_t _width;
WebRtc_Word32 _height; int32_t _height;
RTPVideoCodecTypes _codecType; RTPVideoCodecTypes _codecType;
}; // end of VCMEncodeCompleteCallback }; // end of VCMEncodeCompleteCallback
@ -99,12 +99,12 @@ public:
virtual ~VCMRTPEncodeCompleteCallback() {} virtual ~VCMRTPEncodeCompleteCallback() {}
// Process encoded data received from the encoder, pass stream to the // Process encoded data received from the encoder, pass stream to the
// RTP module // RTP module
WebRtc_Word32 SendData(const FrameType frameType, int32_t SendData(const FrameType frameType,
const WebRtc_UWord8 payloadType, const uint8_t payloadType,
const WebRtc_UWord32 timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const RTPFragmentationHeader& fragmentationHeader, const RTPFragmentationHeader& fragmentationHeader,
const RTPVideoHeader* videoHdr); const RTPVideoHeader* videoHdr);
// Return size of last encoded frame. Value good for one call // Return size of last encoded frame. Value good for one call
@ -117,7 +117,7 @@ public:
{_codecType = codecType;} {_codecType = codecType;}
// Inform callback of frame dimensions // Inform callback of frame dimensions
void SetFrameDimensions(WebRtc_Word16 width, WebRtc_Word16 height) void SetFrameDimensions(int16_t width, int16_t height)
{ {
_width = width; _width = width;
_height = height; _height = height;
@ -128,8 +128,8 @@ private:
FrameType _frameType; FrameType _frameType;
bool _encodeComplete; bool _encodeComplete;
RtpRtcp* _RTPModule; RtpRtcp* _RTPModule;
WebRtc_Word16 _width; int16_t _width;
WebRtc_Word16 _height; int16_t _height;
RTPVideoCodecTypes _codecType; RTPVideoCodecTypes _codecType;
}; // end of VCMEncodeCompleteCallback }; // end of VCMEncodeCompleteCallback
@ -142,11 +142,11 @@ public:
_decodedFile(decodedFile), _decodedBytes(0) {} _decodedFile(decodedFile), _decodedBytes(0) {}
virtual ~VCMDecodeCompleteCallback() {} virtual ~VCMDecodeCompleteCallback() {}
// Write decoded frame into file // Write decoded frame into file
WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame); int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
WebRtc_Word32 DecodedBytes(); int32_t DecodedBytes();
private: private:
FILE* _decodedFile; FILE* _decodedFile;
WebRtc_UWord32 _decodedBytes; uint32_t _decodedBytes;
}; // end of VCMDecodeCompleCallback class }; // end of VCMDecodeCompleCallback class
// Transport callback // Transport callback
@ -171,15 +171,15 @@ public:
// Set average size of burst loss // Set average size of burst loss
void SetBurstLength(double burstLength); void SetBurstLength(double burstLength);
// Set network delay in the network // Set network delay in the network
void SetNetworkDelay(WebRtc_UWord32 networkDelayMs) void SetNetworkDelay(uint32_t networkDelayMs)
{_networkDelayMs = networkDelayMs;}; {_networkDelayMs = networkDelayMs;};
// Set Packet jitter delay // Set Packet jitter delay
void SetJitterVar(WebRtc_UWord32 jitterVar) void SetJitterVar(uint32_t jitterVar)
{_jitterVar = jitterVar;}; {_jitterVar = jitterVar;};
// Return send count // Return send count
int SendCount() {return _sendCount; } int SendCount() {return _sendCount; }
// Return accumulated length in bytes of transmitted packets // Return accumulated length in bytes of transmitted packets
WebRtc_UWord32 TotalSentLength() {return _totalSentLength;} uint32_t TotalSentLength() {return _totalSentLength;}
protected: protected:
// Randomly decide whether to drop packets, based on the channel model // Randomly decide whether to drop packets, based on the channel model
bool PacketLoss(); bool PacketLoss();
@ -187,14 +187,14 @@ protected:
bool UnifomLoss(double lossPct); bool UnifomLoss(double lossPct);
Clock* _clock; Clock* _clock;
WebRtc_UWord32 _sendCount; uint32_t _sendCount;
RtpRtcp* _rtp; RtpRtcp* _rtp;
double _lossPct; double _lossPct;
double _burstLength; double _burstLength;
WebRtc_UWord32 _networkDelayMs; uint32_t _networkDelayMs;
double _jitterVar; double _jitterVar;
bool _prevLossState; bool _prevLossState;
WebRtc_UWord32 _totalSentLength; uint32_t _totalSentLength;
std::list<RtpPacket*> _rtpPackets; std::list<RtpPacket*> _rtpPackets;
RtpDump* _rtpDump; RtpDump* _rtpDump;
}; };
@ -205,8 +205,8 @@ class PacketRequester: public VCMPacketRequestCallback
public: public:
PacketRequester(RtpRtcp& rtp) : PacketRequester(RtpRtcp& rtp) :
_rtp(rtp) {} _rtp(rtp) {}
WebRtc_Word32 ResendPackets(const WebRtc_UWord16* sequenceNumbers, int32_t ResendPackets(const uint16_t* sequenceNumbers,
WebRtc_UWord16 length); uint16_t length);
private: private:
webrtc::RtpRtcp& _rtp; webrtc::RtpRtcp& _rtp;
}; };
@ -215,7 +215,7 @@ private:
class KeyFrameReqTest: public VCMFrameTypeCallback class KeyFrameReqTest: public VCMFrameTypeCallback
{ {
public: public:
WebRtc_Word32 RequestKeyFrame(); int32_t RequestKeyFrame();
}; };
@ -224,12 +224,12 @@ class SendStatsTest: public webrtc::VCMSendStatisticsCallback
{ {
public: public:
SendStatsTest() : _framerate(15), _bitrate(500) {} SendStatsTest() : _framerate(15), _bitrate(500) {}
WebRtc_Word32 SendStatistics(const WebRtc_UWord32 bitRate, int32_t SendStatistics(const uint32_t bitRate,
const WebRtc_UWord32 frameRate); const uint32_t frameRate);
void set_framerate(WebRtc_UWord32 frameRate) {_framerate = frameRate;} void set_framerate(uint32_t frameRate) {_framerate = frameRate;}
void set_bitrate(uint32_t bitrate) {_bitrate = bitrate;} void set_bitrate(uint32_t bitrate) {_bitrate = bitrate;}
private: private:
WebRtc_UWord32 _framerate; uint32_t _framerate;
uint32_t _bitrate; uint32_t _bitrate;
}; };
@ -241,12 +241,12 @@ public:
VideoProtectionCallback(); VideoProtectionCallback();
virtual ~VideoProtectionCallback(); virtual ~VideoProtectionCallback();
void RegisterRtpModule(RtpRtcp* rtp) {_rtp = rtp;} void RegisterRtpModule(RtpRtcp* rtp) {_rtp = rtp;}
WebRtc_Word32 ProtectionRequest( int32_t ProtectionRequest(
const FecProtectionParams* delta_fec_params, const FecProtectionParams* delta_fec_params,
const FecProtectionParams* key_fec_params, const FecProtectionParams* key_fec_params,
WebRtc_UWord32* sent_video_rate_bps, uint32_t* sent_video_rate_bps,
WebRtc_UWord32* sent_nack_rate_bps, uint32_t* sent_nack_rate_bps,
WebRtc_UWord32* sent_fec_rate_bps); uint32_t* sent_fec_rate_bps);
FecProtectionParams DeltaFecParameters() const; FecProtectionParams DeltaFecParameters() const;
FecProtectionParams KeyFecParameters() const; FecProtectionParams KeyFecParameters() const;
private: private:

View File

@ -69,9 +69,9 @@ int MTRxTxTest(CmdArgs& args);
double NormalDist(double mean, double stdDev); double NormalDist(double mean, double stdDev);
struct RtpPacket { struct RtpPacket {
WebRtc_Word8 data[1650]; // max packet size int8_t data[1650]; // max packet size
WebRtc_Word32 length; int32_t length;
WebRtc_Word64 receiveTime; int64_t receiveTime;
}; };
class NullEvent : public webrtc::EventWrapper { class NullEvent : public webrtc::EventWrapper {

View File

@ -24,9 +24,9 @@
using namespace webrtc; using namespace webrtc;
WebRtc_Word32 int32_t
RtpDataCallback::OnReceivedPayloadData(const WebRtc_UWord8* payloadData, RtpDataCallback::OnReceivedPayloadData(const uint8_t* payloadData,
const WebRtc_UWord16 payloadSize, const uint16_t payloadSize,
const WebRtcRTPHeader* rtpHeader) const WebRtcRTPHeader* rtpHeader)
{ {
return _vcm->IncomingPacket(payloadData, payloadSize, *rtpHeader); return _vcm->IncomingPacket(payloadData, payloadSize, *rtpHeader);
@ -44,7 +44,7 @@ FrameReceiveCallback::~FrameReceiveCallback()
} }
} }
WebRtc_Word32 int32_t
FrameReceiveCallback::FrameToRender(I420VideoFrame& videoFrame) FrameReceiveCallback::FrameToRender(I420VideoFrame& videoFrame)
{ {
if (_timingFile == NULL) if (_timingFile == NULL)
@ -114,12 +114,12 @@ int RtpPlay(CmdArgs& args)
// BEGIN Settings // BEGIN Settings
bool protectionEnabled = true; bool protectionEnabled = true;
VCMVideoProtection protectionMethod = kProtectionNack; VCMVideoProtection protectionMethod = kProtectionNack;
WebRtc_UWord32 rttMS = 0; uint32_t rttMS = 0;
float lossRate = 0.0f; float lossRate = 0.0f;
bool reordering = false; bool reordering = false;
WebRtc_UWord32 renderDelayMs = 0; uint32_t renderDelayMs = 0;
WebRtc_UWord32 minPlayoutDelayMs = 0; uint32_t minPlayoutDelayMs = 0;
const WebRtc_Word64 MAX_RUNTIME_MS = -1; const int64_t MAX_RUNTIME_MS = -1;
std::string outFile = args.outputFile; std::string outFile = args.outputFile;
if (outFile == "") if (outFile == "")
outFile = test::OutputPath() + "RtpPlay_decoded.yuv"; outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
@ -147,7 +147,7 @@ int RtpPlay(CmdArgs& args)
// Set up // Set up
WebRtc_Word32 ret = vcm->InitializeReceiver(); int32_t ret = vcm->InitializeReceiver();
if (ret < 0) if (ret < 0)
{ {
return -1; return -1;

View File

@ -64,11 +64,11 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
// BEGIN Settings // BEGIN Settings
bool protectionEnabled = true; bool protectionEnabled = true;
VCMVideoProtection protection = kProtectionDualDecoder; VCMVideoProtection protection = kProtectionDualDecoder;
WebRtc_UWord8 rttMS = 50; uint8_t rttMS = 50;
float lossRate = 0.05f; float lossRate = 0.05f;
WebRtc_UWord32 renderDelayMs = 0; uint32_t renderDelayMs = 0;
WebRtc_UWord32 minPlayoutDelayMs = 0; uint32_t minPlayoutDelayMs = 0;
const WebRtc_Word64 MAX_RUNTIME_MS = 10000; const int64_t MAX_RUNTIME_MS = 10000;
std::string outFilename = args.outputFile; std::string outFilename = args.outputFile;
if (outFilename == "") if (outFilename == "")
outFilename = test::OutputPath() + "RtpPlayMT_decoded.yuv"; outFilename = test::OutputPath() + "RtpPlayMT_decoded.yuv";
@ -151,7 +151,7 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
} }
rtpStream.SimulatePacketLoss(lossRate, nackEnabled, rttMS); rtpStream.SimulatePacketLoss(lossRate, nackEnabled, rttMS);
WebRtc_Word32 ret = vcm->InitializeReceiver(); int32_t ret = vcm->InitializeReceiver();
if (ret < 0) if (ret < 0)
{ {
return -1; return -1;

View File

@ -40,7 +40,7 @@ _frameRate(frameRate)
GetWidthHeight(size); GetWidthHeight(size);
} }
VideoSource::VideoSource(std::string fileName, WebRtc_UWord16 width, WebRtc_UWord16 height, VideoSource::VideoSource(std::string fileName, uint16_t width, uint16_t height,
float frameRate /*= 30*/, webrtc::VideoType type /*= webrtc::kI420*/) float frameRate /*= 30*/, webrtc::VideoType type /*= webrtc::kI420*/)
: :
_fileName(fileName), _fileName(fileName),
@ -55,7 +55,7 @@ _frameRate(frameRate)
assert(frameRate > 0); assert(frameRate > 0);
} }
WebRtc_Word32 int32_t
VideoSource::GetFrameLength() const VideoSource::GetFrameLength() const
{ {
return webrtc::CalcBufferSize(_type, _width, _height); return webrtc::CalcBufferSize(_type, _width, _height);

View File

@ -56,12 +56,12 @@ class VideoSource
public: public:
VideoSource(); VideoSource();
VideoSource(std::string fileName, VideoSize size, float frameRate, webrtc::VideoType type = webrtc::kI420); VideoSource(std::string fileName, VideoSize size, float frameRate, webrtc::VideoType type = webrtc::kI420);
VideoSource(std::string fileName, WebRtc_UWord16 width, WebRtc_UWord16 height, VideoSource(std::string fileName, uint16_t width, uint16_t height,
float frameRate = 30, webrtc::VideoType type = webrtc::kI420); float frameRate = 30, webrtc::VideoType type = webrtc::kI420);
std::string GetFileName() const { return _fileName; } std::string GetFileName() const { return _fileName; }
WebRtc_UWord16 GetWidth() const { return _width; } uint16_t GetWidth() const { return _width; }
WebRtc_UWord16 GetHeight() const { return _height; } uint16_t GetHeight() const { return _height; }
webrtc::VideoType GetType() const { return _type; } webrtc::VideoType GetType() const { return _type; }
float GetFrameRate() const { return _frameRate; } float GetFrameRate() const { return _frameRate; }
int GetWidthHeight( VideoSize size); int GetWidthHeight( VideoSize size);
@ -69,12 +69,12 @@ public:
// Returns the filename with the path (including the leading slash) removed. // Returns the filename with the path (including the leading slash) removed.
std::string GetName() const; std::string GetName() const;
WebRtc_Word32 GetFrameLength() const; int32_t GetFrameLength() const;
private: private:
std::string _fileName; std::string _fileName;
WebRtc_UWord16 _width; uint16_t _width;
WebRtc_UWord16 _height; uint16_t _height;
webrtc::VideoType _type; webrtc::VideoType _type;
float _frameRate; float _frameRate;
}; };