From 7b859cc1e9c70b81159f46bf623f51eba4fa39f8 Mon Sep 17 00:00:00 2001 From: "pbos@webrtc.org" Date: Tue, 2 Apr 2013 15:54:38 +0000 Subject: [PATCH] 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 --- .../main/interface/mock/mock_vcm_callbacks.h | 2 +- .../main/interface/video_coding.h | 96 ++++----- .../main/interface/video_coding_defines.h | 46 ++-- .../video_coding/main/source/codec_timer.cc | 12 +- .../video_coding/main/source/codec_timer.h | 18 +- .../video_coding/main/source/encoded_frame.cc | 8 +- .../video_coding/main/source/encoded_frame.h | 22 +- .../video_coding/main/source/frame_buffer.cc | 30 +-- .../video_coding/main/source/frame_buffer.h | 20 +- .../main/source/generic_decoder.cc | 36 ++-- .../main/source/generic_decoder.h | 40 ++-- .../main/source/generic_encoder.cc | 46 ++-- .../main/source/generic_encoder.h | 44 ++-- .../main/source/inter_frame_delay.cc | 24 +-- .../main/source/inter_frame_delay.h | 18 +- .../main/source/internal_defines.h | 8 +- .../video_coding/main/source/jitter_buffer.h | 2 +- .../main/source/jitter_buffer_common.cc | 8 +- .../main/source/jitter_buffer_common.h | 8 +- .../main/source/jitter_estimator.cc | 16 +- .../main/source/jitter_estimator.h | 46 ++-- .../main/source/media_opt_util.cc | 124 +++++------ .../video_coding/main/source/media_opt_util.h | 70 +++---- .../main/source/media_optimization.cc | 64 +++--- .../main/source/media_optimization.h | 68 +++--- .../main/source/nack_fec_tables.h | 2 +- .../video_coding/main/source/packet.cc | 6 +- .../modules/video_coding/main/source/packet.h | 22 +- .../video_coding/main/source/rtt_filter.cc | 16 +- .../video_coding/main/source/rtt_filter.h | 32 +-- .../video_coding/main/source/session_info.cc | 10 +- .../main/source/timestamp_extrapolator.cc | 40 ++-- .../main/source/timestamp_extrapolator.h | 32 +-- .../video_coding/main/source/timestamp_map.cc | 8 +- .../video_coding/main/source/timestamp_map.h | 14 +- .../video_coding/main/source/timing.cc | 82 ++++---- .../modules/video_coding/main/source/timing.h | 54 ++--- .../main/source/video_coding_impl.cc | 198 +++++++++--------- .../main/source/video_coding_impl.h | 124 +++++------ .../main/test/codec_database_test.cc | 18 +- .../main/test/codec_database_test.h | 10 +- .../main/test/decode_from_storage_test.cc | 12 +- .../main/test/generic_codec_test.cc | 44 ++-- .../main/test/generic_codec_test.h | 36 ++-- .../main/test/jitter_buffer_test.cc | 14 +- .../main/test/jitter_estimate_test.cc | 4 +- .../main/test/jitter_estimate_test.h | 6 +- .../video_coding/main/test/media_opt_test.cc | 16 +- .../video_coding/main/test/media_opt_test.h | 20 +- .../video_coding/main/test/mt_rx_tx_test.cc | 30 +-- .../video_coding/main/test/mt_test_common.cc | 10 +- .../video_coding/main/test/mt_test_common.h | 4 +- .../video_coding/main/test/normal_test.cc | 40 ++-- .../video_coding/main/test/normal_test.h | 44 ++-- .../main/test/quality_modes_test.cc | 60 +++--- .../main/test/quality_modes_test.h | 24 +-- .../video_coding/main/test/receiver_tests.h | 6 +- .../main/test/receiver_timing_tests.cc | 74 +++---- .../video_coding/main/test/rtp_player.cc | 48 ++--- .../video_coding/main/test/rtp_player.h | 40 ++-- .../video_coding/main/test/test_callbacks.cc | 60 +++--- .../video_coding/main/test/test_callbacks.h | 74 +++---- .../video_coding/main/test/test_util.h | 6 +- .../video_coding/main/test/video_rtp_play.cc | 18 +- .../main/test/video_rtp_play_mt.cc | 10 +- .../video_coding/main/test/video_source.cc | 4 +- .../video_coding/main/test/video_source.h | 12 +- 67 files changed, 1130 insertions(+), 1130 deletions(-) diff --git a/webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h b/webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h index 4d6567ea5..d53caee9b 100644 --- a/webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h +++ b/webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h @@ -21,7 +21,7 @@ class MockVCMFrameTypeCallback : public VCMFrameTypeCallback { public: MOCK_METHOD0(RequestKeyFrame, int32_t()); MOCK_METHOD1(SliceLossIndicationRequest, - WebRtc_Word32(const WebRtc_UWord64 pictureId)); + int32_t(const uint64_t pictureId)); }; class MockPacketRequestCallback : public VCMPacketRequestCallback { diff --git a/webrtc/modules/video_coding/main/interface/video_coding.h b/webrtc/modules/video_coding/main/interface/video_coding.h index bf66748b0..41a63d1f6 100644 --- a/webrtc/modules/video_coding/main/interface/video_coding.h +++ b/webrtc/modules/video_coding/main/interface/video_coding.h @@ -63,9 +63,9 @@ public: 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, EventFactory* event_factory); @@ -74,7 +74,7 @@ public: // Get 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 // @@ -84,7 +84,7 @@ public: // // Return value : VCM_OK, on success // 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 // @@ -94,7 +94,7 @@ public: // // Return value : VCM_OK, on success // VCM_PARAMETER_ERROR if codec not supported - static WebRtc_Word32 Codec(VideoCodecType codecType, VideoCodec* codec); + static int32_t Codec(VideoCodecType codecType, VideoCodec* codec); /* * Sender @@ -108,7 +108,7 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 InitializeSender() = 0; + virtual int32_t InitializeSender() = 0; // Registers a codec to be used for encoding. Calling this // API multiple times overwrites any previously registered codecs. @@ -122,9 +122,9 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 RegisterSendCodec(const VideoCodec* sendCodec, - WebRtc_UWord32 numberOfCores, - WebRtc_UWord32 maxPayloadSize) = 0; + virtual int32_t RegisterSendCodec(const VideoCodec* sendCodec, + uint32_t numberOfCores, + uint32_t maxPayloadSize) = 0; // API to get the current send codec in use. // @@ -133,7 +133,7 @@ public: // // Return value : VCM_OK, on success. // < 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 // @@ -151,8 +151,8 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 RegisterExternalEncoder(VideoEncoder* externalEncoder, - WebRtc_UWord8 payloadType, + virtual int32_t RegisterExternalEncoder(VideoEncoder* externalEncoder, + uint8_t payloadType, bool internalSource = false) = 0; // 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. // < 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. // @@ -189,9 +189,9 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 SetChannelParameters(WebRtc_UWord32 target_bitrate, - WebRtc_UWord8 lossRate, - WebRtc_UWord32 rtt) = 0; + virtual int32_t SetChannelParameters(uint32_t target_bitrate, + uint8_t lossRate, + uint32_t rtt) = 0; // Sets the parameters describing the receive channel. These parameters are inputs to the // Media Optimization inside the VCM. @@ -203,7 +203,7 @@ public: // // Return value : VCM_OK, on success. // < 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 // side information. @@ -213,7 +213,7 @@ public: // // Return value : VCM_OK, on success. // < 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 // 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. // < 0, on error. - virtual WebRtc_Word32 RegisterSendStatisticsCallback( + virtual int32_t RegisterSendStatisticsCallback( VCMSendStatisticsCallback* sendStats) = 0; // Register a video quality settings callback which will be called when @@ -235,7 +235,7 @@ public: // // Return value : VCM_OK, on success. // < 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 // the requested FEC rate and NACK status (on/off). @@ -245,7 +245,7 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 RegisterProtectionCallback(VCMProtectionCallback* protection) = 0; + virtual int32_t RegisterProtectionCallback(VCMProtectionCallback* protection) = 0; // Enable or disable a video protection method. // @@ -256,7 +256,7 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 SetVideoProtection(VCMVideoProtection videoProtection, + virtual int32_t SetVideoProtection(VCMVideoProtection videoProtection, bool enable) = 0; // 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. // < 0, on error. - virtual WebRtc_Word32 AddVideoFrame( + virtual int32_t AddVideoFrame( const I420VideoFrame& videoFrame, const VideoContentMetrics* contentMetrics = NULL, const CodecSpecificInfo* codecSpecificInfo = NULL) = 0; @@ -279,7 +279,7 @@ public: // // Return value : VCM_OK, on success. // < 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 // 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. // < 0, on error. - virtual WebRtc_Word32 EnableFrameDropper(bool enable) = 0; + virtual int32_t EnableFrameDropper(bool enable) = 0; // Sent frame counters - virtual WebRtc_Word32 SentFrameCount(VCMFrameCount& frameCount) const = 0; + virtual int32_t SentFrameCount(VCMFrameCount& frameCount) const = 0; /* * Receiver @@ -309,7 +309,7 @@ public: // // Return value : VCM_OK, on success. // < 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. // The module will automatically switch between registered codecs depending on the @@ -323,8 +323,8 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 RegisterReceiveCodec(const VideoCodec* receiveCodec, - WebRtc_Word32 numberOfCores, + virtual int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec, + int32_t numberOfCores, bool requireKeyFrame = false) = 0; // 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. // < 0, on error. - virtual WebRtc_Word32 RegisterExternalDecoder(VideoDecoder* externalDecoder, - WebRtc_UWord8 payloadType, + virtual int32_t RegisterExternalDecoder(VideoDecoder* externalDecoder, + uint8_t payloadType, bool internalRenderTiming) = 0; // 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. // < 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 // 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. // < 0, on error. - virtual WebRtc_Word32 RegisterReceiveStatisticsCallback( + virtual int32_t RegisterReceiveStatisticsCallback( VCMReceiveStatisticsCallback* receiveStats) = 0; // Register a frame type request callback. This callback will be called when the @@ -378,7 +378,7 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 RegisterFrameTypeCallback( + virtual int32_t RegisterFrameTypeCallback( VCMFrameTypeCallback* frameTypeCallback) = 0; // Register a frame storage callback. This callback will be called right before an @@ -390,7 +390,7 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 RegisterFrameStorageCallback( + virtual int32_t RegisterFrameStorageCallback( VCMFrameStorageCallback* frameStorageCallback) = 0; // Registers a callback which is called whenever the receive side of the VCM @@ -401,7 +401,7 @@ public: // // Return value : VCM_OK, on success. // <0, on error. - virtual WebRtc_Word32 RegisterPacketRequestCallback( + virtual int32_t RegisterPacketRequestCallback( VCMPacketRequestCallback* callback) = 0; // Waits for the next frame in the jitter buffer to become complete @@ -410,7 +410,7 @@ public: // // Return value : VCM_OK, on success. // < 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 no longer than maxWaitTimeMs), then passes it to the dual decoder @@ -421,7 +421,7 @@ public: // Return value : 1, if a frame was decoded // 0, if no frame was decoded // < 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. // Should be used in conjunction with VCMFrameStorageCallback. @@ -432,13 +432,13 @@ public: // // Return value: : VCM_OK, on success // < 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. // // Return value : VCM_OK, on success. // < 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. // @@ -447,7 +447,7 @@ public: // // Return value : VCM_OK, on success. // < 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. // @@ -466,8 +466,8 @@ public: // // Return value : VCM_OK, on success. // < 0, on error. - virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPayload, - WebRtc_UWord32 payloadLength, + virtual int32_t IncomingPacket(const uint8_t* incomingPayload, + uint32_t payloadLength, const WebRtcRTPHeader& rtpInfo) = 0; // Minimum playout delay (Used for lip-sync). This is the minimum delay required @@ -479,7 +479,7 @@ public: // // Return value : VCM_OK, on success. // < 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. // @@ -488,14 +488,14 @@ public: // // Return value : VCM_OK, on success. // < 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 // delay set with SetMinimumPlayoutDelay. // // Return value : Total delay in ms, on success. // < 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 // received since the start of the call. @@ -505,13 +505,13 @@ public: // // Return value : VCM_OK, on success. // <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 // too late. This can include duplicated packets which arrived after the // frame was sent to the decoder. Therefore packets which were prematurely // NACKed will be counted. - virtual WebRtc_UWord32 DiscardedPackets() const = 0; + virtual uint32_t DiscardedPackets() const = 0; // Robustness APIs diff --git a/webrtc/modules/video_coding/main/interface/video_coding_defines.h b/webrtc/modules/video_coding/main/interface/video_coding_defines.h index f36c990cb..9edd00b05 100644 --- a/webrtc/modules/video_coding/main/interface/video_coding_defines.h +++ b/webrtc/modules/video_coding/main/interface/video_coding_defines.h @@ -58,20 +58,20 @@ enum VCMTemporalDecimation { }; struct VCMFrameCount { - WebRtc_UWord32 numKeyFrames; - WebRtc_UWord32 numDeltaFrames; + uint32_t numKeyFrames; + uint32_t numDeltaFrames; }; // Callback class used for sending data ready to be packetized class VCMPacketizationCallback { public: - virtual WebRtc_Word32 SendData( + virtual int32_t SendData( FrameType frameType, - WebRtc_UWord8 payloadType, - WebRtc_UWord32 timeStamp, + uint8_t payloadType, + uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + uint32_t payloadSize, const RTPFragmentationHeader& fragmentationHeader, const RTPVideoHeader* rtpVideoHdr) = 0; protected: @@ -82,7 +82,7 @@ class VCMPacketizationCallback { // Callback class used for passing decoded frames which are ready to be rendered. class VCMFrameStorageCallback { public: - virtual WebRtc_Word32 StoreReceivedFrame( + virtual int32_t StoreReceivedFrame( const EncodedVideoData& frameToStore) = 0; protected: @@ -93,9 +93,9 @@ class VCMFrameStorageCallback { // Callback class used for passing decoded frames which are ready to be rendered. class VCMReceiveCallback { public: - virtual WebRtc_Word32 FrameToRender(I420VideoFrame& videoFrame) = 0; - virtual WebRtc_Word32 ReceivedDecodedReferenceFrame( - const WebRtc_UWord64 pictureId) { + virtual int32_t FrameToRender(I420VideoFrame& videoFrame) = 0; + virtual int32_t ReceivedDecodedReferenceFrame( + const uint64_t pictureId) { return -1; } @@ -108,8 +108,8 @@ class VCMReceiveCallback { // encoder. class VCMSendStatisticsCallback { public: - virtual WebRtc_Word32 SendStatistics(const WebRtc_UWord32 bitRate, - const WebRtc_UWord32 frameRate) = 0; + virtual int32_t SendStatistics(const uint32_t bitRate, + const uint32_t frameRate) = 0; protected: virtual ~VCMSendStatisticsCallback() { @@ -119,8 +119,8 @@ class VCMSendStatisticsCallback { // Callback class used for informing the user of the incoming bit rate and frame rate. class VCMReceiveStatisticsCallback { public: - virtual WebRtc_Word32 ReceiveStatistics(const WebRtc_UWord32 bitRate, - const WebRtc_UWord32 frameRate) = 0; + virtual int32_t ReceiveStatistics(const uint32_t bitRate, + const uint32_t frameRate) = 0; protected: virtual ~VCMReceiveStatisticsCallback() { @@ -146,9 +146,9 @@ class VCMProtectionCallback { // Typically a key frame when the stream has been corrupted in some way. class VCMFrameTypeCallback { public: - virtual WebRtc_Word32 RequestKeyFrame() = 0; - virtual WebRtc_Word32 SliceLossIndicationRequest( - const WebRtc_UWord64 pictureId) { + virtual int32_t RequestKeyFrame() = 0; + virtual int32_t SliceLossIndicationRequest( + const uint64_t pictureId) { return -1; } @@ -161,8 +161,8 @@ class VCMFrameTypeCallback { // missing and need to be resent. class VCMPacketRequestCallback { public: - virtual WebRtc_Word32 ResendPackets(const WebRtc_UWord16* sequenceNumbers, - WebRtc_UWord16 length) = 0; + virtual int32_t ResendPackets(const uint16_t* sequenceNumbers, + uint16_t length) = 0; protected: virtual ~VCMPacketRequestCallback() { @@ -173,9 +173,9 @@ class VCMPacketRequestCallback { // as subscribed by Media Optimization (Quality Modes) class VCMQMSettingsCallback { public: - virtual WebRtc_Word32 SetVideoQMSettings(const WebRtc_UWord32 frameRate, - const WebRtc_UWord32 width, - const WebRtc_UWord32 height) = 0; + virtual int32_t SetVideoQMSettings(const uint32_t frameRate, + const uint32_t width, + const uint32_t height) = 0; protected: virtual ~VCMQMSettingsCallback() { diff --git a/webrtc/modules/video_coding/main/source/codec_timer.cc b/webrtc/modules/video_coding/main/source/codec_timer.cc index 1d112fa29..3b92bb485 100644 --- a/webrtc/modules/video_coding/main/source/codec_timer.cc +++ b/webrtc/modules/video_coding/main/source/codec_timer.cc @@ -25,9 +25,9 @@ _history() Reset(); } -WebRtc_Word32 VCMCodecTimer::StopTimer(WebRtc_Word64 startTimeMs, WebRtc_Word64 nowMs) +int32_t VCMCodecTimer::StopTimer(int64_t startTimeMs, int64_t nowMs) { - const WebRtc_Word32 timeDiff = static_cast(nowMs - startTimeMs); + const int32_t timeDiff = static_cast(nowMs - startTimeMs); MaxFilter(timeDiff, nowMs); return timeDiff; } @@ -45,7 +45,7 @@ void VCMCodecTimer::Reset() } // Update the max-value filter -void VCMCodecTimer::MaxFilter(WebRtc_Word32 decodeTime, WebRtc_Word64 nowMs) +void VCMCodecTimer::MaxFilter(int32_t decodeTime, int64_t nowMs) { if (!_firstDecodeTime) { @@ -59,7 +59,7 @@ void VCMCodecTimer::MaxFilter(WebRtc_Word32 decodeTime, WebRtc_Word64 nowMs) } void -VCMCodecTimer::UpdateMaxHistory(WebRtc_Word32 decodeTime, WebRtc_Word64 now) +VCMCodecTimer::UpdateMaxHistory(int32_t decodeTime, int64_t now) { if (_history[0].timeMs >= 0 && now - _history[0].timeMs < SHORT_FILTER_MS) @@ -98,7 +98,7 @@ VCMCodecTimer::UpdateMaxHistory(WebRtc_Word32 decodeTime, WebRtc_Word64 now) } void -VCMCodecTimer::ProcessHistory(WebRtc_Word64 nowMs) +VCMCodecTimer::ProcessHistory(int64_t nowMs) { _filteredMax = _shortMax; if (_history[0].timeMs == -1) @@ -125,7 +125,7 @@ VCMCodecTimer::ProcessHistory(WebRtc_Word64 nowMs) } // Get the maximum observed time within a time window -WebRtc_Word32 VCMCodecTimer::RequiredDecodeTimeMs(FrameType /*frameType*/) const +int32_t VCMCodecTimer::RequiredDecodeTimeMs(FrameType /*frameType*/) const { return _filteredMax; } diff --git a/webrtc/modules/video_coding/main/source/codec_timer.h b/webrtc/modules/video_coding/main/source/codec_timer.h index e03c5bfe9..f3a186348 100644 --- a/webrtc/modules/video_coding/main/source/codec_timer.h +++ b/webrtc/modules/video_coding/main/source/codec_timer.h @@ -26,8 +26,8 @@ class VCMShortMaxSample public: VCMShortMaxSample() : shortMax(0), timeMs(-1) {}; - WebRtc_Word32 shortMax; - WebRtc_Word64 timeMs; + int32_t shortMax; + int64_t timeMs; }; class VCMCodecTimer @@ -36,22 +36,22 @@ public: VCMCodecTimer(); // Updates and returns the max filtered decode time. - WebRtc_Word32 StopTimer(WebRtc_Word64 startTimeMs, WebRtc_Word64 nowMs); + int32_t StopTimer(int64_t startTimeMs, int64_t nowMs); // Empty the list of timers. void Reset(); // Get the required decode time in ms. - WebRtc_Word32 RequiredDecodeTimeMs(FrameType frameType) const; + int32_t RequiredDecodeTimeMs(FrameType frameType) const; private: - void UpdateMaxHistory(WebRtc_Word32 decodeTime, WebRtc_Word64 now); - void MaxFilter(WebRtc_Word32 newTime, WebRtc_Word64 nowMs); - void ProcessHistory(WebRtc_Word64 nowMs); + void UpdateMaxHistory(int32_t decodeTime, int64_t now); + void MaxFilter(int32_t newTime, int64_t nowMs); + void ProcessHistory(int64_t nowMs); - WebRtc_Word32 _filteredMax; + int32_t _filteredMax; bool _firstDecodeTime; - WebRtc_Word32 _shortMax; + int32_t _shortMax; VCMShortMaxSample _history[MAX_HISTORY_SIZE]; }; diff --git a/webrtc/modules/video_coding/main/source/encoded_frame.cc b/webrtc/modules/video_coding/main/source/encoded_frame.cc index 2ec1f53a7..eb165096a 100644 --- a/webrtc/modules/video_coding/main/source/encoded_frame.cc +++ b/webrtc/modules/video_coding/main/source/encoded_frame.cc @@ -149,7 +149,7 @@ const RTPFragmentationHeader* VCMEncodedFrame::FragmentationHeader() const { return &_fragmentation; } -WebRtc_Word32 +int32_t VCMEncodedFrame::Store(VCMFrameStorageCallback& storeCallback) const { EncodedVideoData frameToStore; @@ -172,13 +172,13 @@ VCMEncodedFrame::Store(VCMFrameStorageCallback& storeCallback) const return VCM_OK; } -WebRtc_Word32 -VCMEncodedFrame::VerifyAndAllocate(const WebRtc_UWord32 minimumSize) +int32_t +VCMEncodedFrame::VerifyAndAllocate(const uint32_t minimumSize) { if(minimumSize > _size) { // create buffer of sufficient size - WebRtc_UWord8* newBuffer = new WebRtc_UWord8[minimumSize]; + uint8_t* newBuffer = new uint8_t[minimumSize]; if (newBuffer == NULL) { return -1; diff --git a/webrtc/modules/video_coding/main/source/encoded_frame.h b/webrtc/modules/video_coding/main/source/encoded_frame.h index 932e98bb5..a36da0ce7 100644 --- a/webrtc/modules/video_coding/main/source/encoded_frame.h +++ b/webrtc/modules/video_coding/main/source/encoded_frame.h @@ -37,12 +37,12 @@ public: /** * Set render time in milliseconds */ - void SetRenderTime(const WebRtc_Word64 renderTimeMs) {_renderTimeMs = renderTimeMs;} + void SetRenderTime(const int64_t renderTimeMs) {_renderTimeMs = renderTimeMs;} /** * Set the encoded frame size */ - void SetEncodedSize(WebRtc_UWord32 width, WebRtc_UWord32 height) + void SetEncodedSize(uint32_t width, uint32_t height) { _encodedWidth = width; _encodedHeight = height; } /** * Get the encoded image @@ -52,19 +52,19 @@ public: /** * Get pointer to frame buffer */ - const WebRtc_UWord8* Buffer() const {return _buffer;} + const uint8_t* Buffer() const {return _buffer;} /** * Get frame length */ - WebRtc_UWord32 Length() const {return _length;} + uint32_t Length() const {return _length;} /** * Get frame timestamp (90kHz) */ - WebRtc_UWord32 TimeStamp() const {return _timeStamp;} + uint32_t TimeStamp() const {return _timeStamp;} /** * Get render time in milliseconds */ - WebRtc_Word64 RenderTimeMs() const {return _renderTimeMs;} + int64_t RenderTimeMs() const {return _renderTimeMs;} /** * Get frame type */ @@ -80,7 +80,7 @@ public: /** * Payload type of the encoded payload */ - WebRtc_UWord8 PayloadType() const { return _payloadType; } + uint8_t PayloadType() const { return _payloadType; } /** * Get codec specific info. * The returned pointer is only valid as long as the VCMEncodedFrame @@ -91,7 +91,7 @@ public: const RTPFragmentationHeader* FragmentationHeader() const; - WebRtc_Word32 Store(VCMFrameStorageCallback& storeCallback) const; + int32_t Store(VCMFrameStorageCallback& storeCallback) const; static webrtc::FrameType ConvertFrameType(VideoFrameType frameType); static VideoFrameType ConvertFrameType(webrtc::FrameType frameType); @@ -106,14 +106,14 @@ protected: * is copied to the new buffer. * Buffer size is updated to minimumSize. */ - WebRtc_Word32 VerifyAndAllocate(const WebRtc_UWord32 minimumSize); + int32_t VerifyAndAllocate(const uint32_t minimumSize); void Reset(); void CopyCodecSpecific(const RTPVideoHeader* header); - WebRtc_Word64 _renderTimeMs; - WebRtc_UWord8 _payloadType; + int64_t _renderTimeMs; + uint8_t _payloadType; bool _missingFrame; CodecSpecificInfo _codecSpecificInfo; webrtc::VideoCodecType _codec; diff --git a/webrtc/modules/video_coding/main/source/frame_buffer.cc b/webrtc/modules/video_coding/main/source/frame_buffer.cc index a864e5536..bc1407b2b 100644 --- a/webrtc/modules/video_coding/main/source/frame_buffer.cc +++ b/webrtc/modules/video_coding/main/source/frame_buffer.cc @@ -52,13 +52,13 @@ VCMFrameBuffer::SetPreviousFrameLoss() _sessionInfo.SetPreviousFrameLoss(); } -WebRtc_Word32 +int32_t VCMFrameBuffer::GetLowSeqNum() const { return _sessionInfo.LowSequenceNumber(); } -WebRtc_Word32 +int32_t VCMFrameBuffer::GetHighSeqNum() const { return _sessionInfo.HighSequenceNumber(); @@ -92,8 +92,8 @@ VCMFrameBuffer::IsSessionComplete() const // Insert packet VCMFrameBufferEnum -VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs, - bool enableDecodableState, WebRtc_UWord32 rttMS) +VCMFrameBuffer::InsertPacket(const VCMPacket& packet, int64_t timeInMs, + bool enableDecodableState, uint32_t rttMS) { if (_state == kStateDecoding) { @@ -142,16 +142,16 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs, } } - WebRtc_UWord32 requiredSizeBytes = Length() + packet.sizeBytes + + uint32_t requiredSizeBytes = Length() + packet.sizeBytes + (packet.insertStartCode ? kH264StartCodeLengthBytes : 0); if (requiredSizeBytes >= _size) { - const WebRtc_UWord8* prevBuffer = _buffer; - const WebRtc_UWord32 increments = requiredSizeBytes / + const uint8_t* prevBuffer = _buffer; + const uint32_t increments = requiredSizeBytes / kBufferIncStepSizeBytes + (requiredSizeBytes % kBufferIncStepSizeBytes > 0); - const WebRtc_UWord32 newSize = _size + + const uint32_t newSize = _size + increments * kBufferIncStepSizeBytes; if (newSize > kMaxJBFrameSizeBytes) { @@ -178,7 +178,7 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs, return kDuplicatePacket; } // update length - _length = Length() + static_cast(retVal); + _length = Length() + static_cast(retVal); _latestPacketTimeMs = timeInMs; @@ -198,7 +198,7 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs, return kIncomplete; } -WebRtc_Word64 +int64_t VCMFrameBuffer::LatestPacketTimeMs() const { return _latestPacketTimeMs; @@ -210,7 +210,7 @@ VCMFrameBuffer::IncrementNackCount() _nackCount++; } -WebRtc_Word16 +int16_t VCMFrameBuffer::GetNackCount() const { return _nackCount; @@ -240,7 +240,7 @@ VCMFrameBuffer::Reset() void VCMFrameBuffer::MakeSessionDecodable() { - WebRtc_UWord32 retVal; + uint32_t retVal; #ifdef INDEPENDENT_PARTITIONS if (_codec != kVideoCodecVP8) { retVal = _sessionInfo.MakeDecodable(); @@ -320,7 +320,7 @@ VCMFrameBuffer::RestructureFrameInformation() _missingFrame = _sessionInfo.PreviousFrameLoss(); } -WebRtc_Word32 +int32_t VCMFrameBuffer::ExtractFromStorage(const EncodedVideoData& frameFromStorage) { _frameType = ConvertFrameType(frameFromStorage.frameType); @@ -332,7 +332,7 @@ VCMFrameBuffer::ExtractFromStorage(const EncodedVideoData& frameFromStorage) _completeFrame = frameFromStorage.completeFrame; _renderTimeMs = frameFromStorage.renderTimeMs; _codec = frameFromStorage.codec; - const WebRtc_UWord8 *prevBuffer = _buffer; + const uint8_t *prevBuffer = _buffer; if (VerifyAndAllocate(frameFromStorage.payloadSize) < 0) { return VCM_MEMORY; @@ -367,7 +367,7 @@ VCMFrameBuffer::GetState() const // Get current state of frame VCMFrameBufferStateEnum -VCMFrameBuffer::GetState(WebRtc_UWord32& timeStamp) const +VCMFrameBuffer::GetState(uint32_t& timeStamp) const { timeStamp = TimeStamp(); return GetState(); diff --git a/webrtc/modules/video_coding/main/source/frame_buffer.h b/webrtc/modules/video_coding/main/source/frame_buffer.h index 33e98b9fc..1d1fd24b9 100644 --- a/webrtc/modules/video_coding/main/source/frame_buffer.h +++ b/webrtc/modules/video_coding/main/source/frame_buffer.h @@ -31,15 +31,15 @@ public: virtual void Reset(); VCMFrameBufferEnum InsertPacket(const VCMPacket& packet, - WebRtc_Word64 timeInMs, + int64_t timeInMs, bool enableDecodableState, - WebRtc_UWord32 rttMs); + uint32_t rttMs); // State // Get current state of frame VCMFrameBufferStateEnum GetState() const; // Get current state and timestamp of frame - VCMFrameBufferStateEnum GetState(WebRtc_UWord32& timeStamp) const; + VCMFrameBufferStateEnum GetState(uint32_t& timeStamp) const; void SetState(VCMFrameBufferStateEnum state); // Set state of frame bool IsRetransmitted() const; @@ -50,9 +50,9 @@ public: // Sequence numbers // Get lowest packet sequence number in frame - WebRtc_Word32 GetLowSeqNum() const; + int32_t GetLowSeqNum() const; // Get highest packet sequence number in frame - WebRtc_Word32 GetHighSeqNum() const; + int32_t GetHighSeqNum() const; int PictureId() const; int TemporalId() const; @@ -69,14 +69,14 @@ public: void IncrementNackCount(); // Returns the number of packets of this frame which were NACKed before they // arrived. - WebRtc_Word16 GetNackCount() const; + int16_t GetNackCount() const; - WebRtc_Word64 LatestPacketTimeMs() const; + int64_t LatestPacketTimeMs() const; webrtc::FrameType FrameType() const; void SetPreviousFrameLoss(); - WebRtc_Word32 ExtractFromStorage(const EncodedVideoData& frameFromStorage); + int32_t ExtractFromStorage(const EncodedVideoData& frameFromStorage); // The number of packets discarded because the decoder can't make use of // them. @@ -90,8 +90,8 @@ private: VCMFrameBufferStateEnum _state; // Current state of the frame bool _frameCounted; // Was this frame counted by JB? VCMSessionInfo _sessionInfo; - WebRtc_UWord16 _nackCount; - WebRtc_Word64 _latestPacketTimeMs; + uint16_t _nackCount; + int64_t _latestPacketTimeMs; }; } // namespace webrtc diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.cc b/webrtc/modules/video_coding/main/source/generic_decoder.cc index a9bb76327..fd90c684a 100644 --- a/webrtc/modules/video_coding/main/source/generic_decoder.cc +++ b/webrtc/modules/video_coding/main/source/generic_decoder.cc @@ -40,7 +40,7 @@ void VCMDecodedFrameCallback::SetUserReceiveCallback( _receiveCallback = receiveCallback; } -WebRtc_Word32 VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage) +int32_t VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage) { // TODO(holmer): We should improve this so that we can handle multiple // callbacks from one call to Decode(). @@ -62,7 +62,7 @@ WebRtc_Word32 VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage) { _frame.SwapFrame(&decodedImage); _frame.set_render_time_ms(frameInfo->renderTimeMs); - WebRtc_Word32 callbackReturn = _receiveCallback->FrameToRender(_frame); + int32_t callbackReturn = _receiveCallback->FrameToRender(_frame); if (callbackReturn < 0) { WEBRTC_TRACE(webrtc::kTraceDebug, @@ -74,9 +74,9 @@ WebRtc_Word32 VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage) return WEBRTC_VIDEO_CODEC_OK; } -WebRtc_Word32 +int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( - const WebRtc_UWord64 pictureId) + const uint64_t pictureId) { CriticalSectionScoped cs(_critSect); if (_receiveCallback != NULL) @@ -86,25 +86,25 @@ VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( return -1; } -WebRtc_Word32 -VCMDecodedFrameCallback::ReceivedDecodedFrame(const WebRtc_UWord64 pictureId) +int32_t +VCMDecodedFrameCallback::ReceivedDecodedFrame(const uint64_t pictureId) { _lastReceivedPictureID = pictureId; return 0; } -WebRtc_UWord64 VCMDecodedFrameCallback::LastReceivedPictureID() const +uint64_t VCMDecodedFrameCallback::LastReceivedPictureID() const { return _lastReceivedPictureID; } -WebRtc_Word32 VCMDecodedFrameCallback::Map(WebRtc_UWord32 timestamp, VCMFrameInformation* frameInfo) +int32_t VCMDecodedFrameCallback::Map(uint32_t timestamp, VCMFrameInformation* frameInfo) { CriticalSectionScoped cs(_critSect); return _timestampMap.Add(timestamp, frameInfo); } -WebRtc_Word32 VCMDecodedFrameCallback::Pop(WebRtc_UWord32 timestamp) +int32_t VCMDecodedFrameCallback::Pop(uint32_t timestamp) { CriticalSectionScoped cs(_critSect); if (_timestampMap.Pop(timestamp) == NULL) @@ -114,7 +114,7 @@ WebRtc_Word32 VCMDecodedFrameCallback::Pop(WebRtc_UWord32 timestamp) return VCM_OK; } -VCMGenericDecoder::VCMGenericDecoder(VideoDecoder& decoder, WebRtc_Word32 id, bool isExternal) +VCMGenericDecoder::VCMGenericDecoder(VideoDecoder& decoder, int32_t id, bool isExternal) : _id(id), _callback(NULL), @@ -132,8 +132,8 @@ VCMGenericDecoder::~VCMGenericDecoder() { } -WebRtc_Word32 VCMGenericDecoder::InitDecode(const VideoCodec* settings, - WebRtc_Word32 numberOfCores, +int32_t VCMGenericDecoder::InitDecode(const VideoCodec* settings, + int32_t numberOfCores, bool requireKeyFrame) { _requireKeyFrame = requireKeyFrame; @@ -143,7 +143,7 @@ WebRtc_Word32 VCMGenericDecoder::InitDecode(const VideoCodec* settings, return _decoder.InitDecode(settings, numberOfCores); } -WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, +int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) { if (_requireKeyFrame && @@ -166,7 +166,7 @@ WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength; - WebRtc_Word32 ret = _decoder.Decode(frame.EncodedImage(), + int32_t ret = _decoder.Decode(frame.EncodedImage(), frame.MissingFrame(), frame.FragmentationHeader(), frame.CodecSpecific(), @@ -190,25 +190,25 @@ WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, return ret; } -WebRtc_Word32 +int32_t VCMGenericDecoder::Release() { _keyFrameDecoded = false; return _decoder.Release(); } -WebRtc_Word32 VCMGenericDecoder::Reset() +int32_t VCMGenericDecoder::Reset() { _keyFrameDecoded = false; return _decoder.Reset(); } -WebRtc_Word32 VCMGenericDecoder::SetCodecConfigParameters(const WebRtc_UWord8* buffer, WebRtc_Word32 size) +int32_t VCMGenericDecoder::SetCodecConfigParameters(const uint8_t* buffer, int32_t size) { return _decoder.SetCodecConfigParameters(buffer, size); } -WebRtc_Word32 VCMGenericDecoder::RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback) +int32_t VCMGenericDecoder::RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback) { _callback = callback; return _decoder.RegisterDecodeCompleteCallback(callback); diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.h b/webrtc/modules/video_coding/main/source/generic_decoder.h index 084bd76c6..755adc792 100644 --- a/webrtc/modules/video_coding/main/source/generic_decoder.h +++ b/webrtc/modules/video_coding/main/source/generic_decoder.h @@ -26,8 +26,8 @@ enum { kDecoderFrameMemoryLength = 10 }; struct VCMFrameInformation { - WebRtc_Word64 renderTimeMs; - WebRtc_Word64 decodeStartTimeMs; + int64_t renderTimeMs; + int64_t decodeStartTimeMs; void* userData; }; @@ -38,14 +38,14 @@ public: virtual ~VCMDecodedFrameCallback(); void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback); - virtual WebRtc_Word32 Decoded(I420VideoFrame& decodedImage); - virtual WebRtc_Word32 ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId); - virtual WebRtc_Word32 ReceivedDecodedFrame(const WebRtc_UWord64 pictureId); + virtual int32_t Decoded(I420VideoFrame& decodedImage); + virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId); + virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId); - WebRtc_UWord64 LastReceivedPictureID() const; + uint64_t LastReceivedPictureID() const; - WebRtc_Word32 Map(WebRtc_UWord32 timestamp, VCMFrameInformation* frameInfo); - WebRtc_Word32 Pop(WebRtc_UWord32 timestamp); + int32_t Map(uint32_t timestamp, VCMFrameInformation* frameInfo); + int32_t Pop(uint32_t timestamp); private: CriticalSectionWrapper* _critSect; @@ -54,7 +54,7 @@ private: VCMReceiveCallback* _receiveCallback; VCMTiming& _timing; VCMTimestampMap _timestampMap; - WebRtc_UWord64 _lastReceivedPictureID; + uint64_t _lastReceivedPictureID; }; @@ -62,14 +62,14 @@ class VCMGenericDecoder { friend class VCMCodecDataBase; public: - VCMGenericDecoder(VideoDecoder& decoder, WebRtc_Word32 id = 0, bool isExternal = false); + VCMGenericDecoder(VideoDecoder& decoder, int32_t id = 0, bool isExternal = false); ~VCMGenericDecoder(); /** * Initialize the decoder with the information from the VideoCodec */ - WebRtc_Word32 InitDecode(const VideoCodec* settings, - WebRtc_Word32 numberOfCores, + int32_t InitDecode(const VideoCodec* settings, + int32_t numberOfCores, bool requireKeyFrame); /** @@ -77,17 +77,17 @@ public: * * inputVideoBuffer reference to encoded video frame */ - WebRtc_Word32 Decode(const VCMEncodedFrame& inputFrame, int64_t nowMs); + int32_t Decode(const VCMEncodedFrame& inputFrame, int64_t nowMs); /** * Free the decoder memory */ - WebRtc_Word32 Release(); + int32_t Release(); /** * Reset the decoder state, prepare for a new call */ - WebRtc_Word32 Reset(); + int32_t Reset(); /** * Codec configuration data sent out-of-band, i.e. in SIP call setup @@ -95,19 +95,19 @@ public: * buffer pointer to the configuration data * size the size of the configuration data in bytes */ - WebRtc_Word32 SetCodecConfigParameters(const WebRtc_UWord8* /*buffer*/, - WebRtc_Word32 /*size*/); + int32_t SetCodecConfigParameters(const uint8_t* /*buffer*/, + int32_t /*size*/); - WebRtc_Word32 RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback); + int32_t RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback); bool External() const; protected: - WebRtc_Word32 _id; + int32_t _id; VCMDecodedFrameCallback* _callback; VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength]; - WebRtc_UWord32 _nextFrameInfoIdx; + uint32_t _nextFrameInfoIdx; VideoDecoder& _decoder; VideoCodecType _codecType; bool _isExternal; diff --git a/webrtc/modules/video_coding/main/source/generic_encoder.cc b/webrtc/modules/video_coding/main/source/generic_encoder.cc index 17526dc1a..6c1adfb7b 100644 --- a/webrtc/modules/video_coding/main/source/generic_encoder.cc +++ b/webrtc/modules/video_coding/main/source/generic_encoder.cc @@ -33,7 +33,7 @@ VCMGenericEncoder::~VCMGenericEncoder() { } -WebRtc_Word32 VCMGenericEncoder::Release() +int32_t VCMGenericEncoder::Release() { _bitRate = 0; _frameRate = 0; @@ -41,10 +41,10 @@ WebRtc_Word32 VCMGenericEncoder::Release() return _encoder.Release(); } -WebRtc_Word32 +int32_t VCMGenericEncoder::InitEncode(const VideoCodec* settings, - WebRtc_Word32 numberOfCores, - WebRtc_UWord32 maxPayloadSize) + int32_t numberOfCores, + uint32_t maxPayloadSize) { _bitRate = settings->startBitrate; _frameRate = settings->maxFramerate; @@ -56,7 +56,7 @@ VCMGenericEncoder::InitEncode(const VideoCodec* settings, return _encoder.InitEncode(settings, numberOfCores, maxPayloadSize); } -WebRtc_Word32 +int32_t VCMGenericEncoder::Encode(const I420VideoFrame& inputFrame, const CodecSpecificInfo* codecSpecificInfo, const std::vector& frameTypes) { @@ -66,17 +66,17 @@ VCMGenericEncoder::Encode(const I420VideoFrame& inputFrame, return _encoder.Encode(inputFrame, codecSpecificInfo, &video_frame_types); } -WebRtc_Word32 -VCMGenericEncoder::SetChannelParameters(WebRtc_Word32 packetLoss, int rtt) +int32_t +VCMGenericEncoder::SetChannelParameters(int32_t packetLoss, int rtt) { return _encoder.SetChannelParameters(packetLoss, rtt); } -WebRtc_Word32 -VCMGenericEncoder::SetRates(WebRtc_UWord32 newBitRate, WebRtc_UWord32 frameRate) +int32_t +VCMGenericEncoder::SetRates(uint32_t newBitRate, uint32_t frameRate) { uint32_t target_bitrate_kbps = (newBitRate + 500) / 1000; - WebRtc_Word32 ret = _encoder.SetRates(target_bitrate_kbps, frameRate); + int32_t ret = _encoder.SetRates(target_bitrate_kbps, frameRate); if (ret < 0) { return ret; @@ -86,10 +86,10 @@ VCMGenericEncoder::SetRates(WebRtc_UWord32 newBitRate, WebRtc_UWord32 frameRate) return VCM_OK; } -WebRtc_Word32 -VCMGenericEncoder::CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 size) +int32_t +VCMGenericEncoder::CodecConfigParameters(uint8_t* buffer, int32_t size) { - WebRtc_Word32 ret = _encoder.CodecConfigParameters(buffer, size); + int32_t ret = _encoder.CodecConfigParameters(buffer, size); if (ret < 0) { return ret; @@ -97,23 +97,23 @@ VCMGenericEncoder::CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 si return ret; } -WebRtc_UWord32 VCMGenericEncoder::BitRate() const +uint32_t VCMGenericEncoder::BitRate() const { return _bitRate; } -WebRtc_UWord32 VCMGenericEncoder::FrameRate() const +uint32_t VCMGenericEncoder::FrameRate() const { return _frameRate; } -WebRtc_Word32 +int32_t VCMGenericEncoder::SetPeriodicKeyFrames(bool enable) { return _encoder.SetPeriodicKeyFrames(enable); } -WebRtc_Word32 VCMGenericEncoder::RequestFrame( +int32_t VCMGenericEncoder::RequestFrame( const std::vector& frame_types) { I420VideoFrame image; std::vector video_frame_types(frame_types.size(), @@ -122,7 +122,7 @@ WebRtc_Word32 VCMGenericEncoder::RequestFrame( return _encoder.Encode(image, NULL, &video_frame_types); } -WebRtc_Word32 +int32_t VCMGenericEncoder::RegisterEncodeCallback(VCMEncodedFrameCallback* VCMencodedFrameCallback) { _VCMencodedFrameCallback = VCMencodedFrameCallback; @@ -164,14 +164,14 @@ VCMEncodedFrameCallback::~VCMEncodedFrameCallback() #endif } -WebRtc_Word32 +int32_t VCMEncodedFrameCallback::SetTransportCallback(VCMPacketizationCallback* transport) { _sendCallback = transport; return VCM_OK; } -WebRtc_Word32 +int32_t VCMEncodedFrameCallback::Encoded( EncodedImage &encodedImage, const CodecSpecificInfo* codecSpecificInfo, @@ -179,7 +179,7 @@ VCMEncodedFrameCallback::Encoded( { FrameType frameType = VCMEncodedFrame::ConvertFrameType(encodedImage._frameType); - WebRtc_UWord32 encodedBytes = 0; + uint32_t encodedBytes = 0; if (_sendCallback != NULL) { encodedBytes = encodedImage._length; @@ -202,7 +202,7 @@ VCMEncodedFrameCallback::Encoded( rtpVideoHeaderPtr = NULL; } - WebRtc_Word32 callbackReturn = _sendCallback->SendData( + int32_t callbackReturn = _sendCallback->SendData( frameType, _payloadType, encodedImage._timeStamp, @@ -232,7 +232,7 @@ VCMEncodedFrameCallback::Encoded( return VCM_OK; } -WebRtc_UWord32 +uint32_t VCMEncodedFrameCallback::EncodedBytes() { return _encodedBytes; diff --git a/webrtc/modules/video_coding/main/source/generic_encoder.h b/webrtc/modules/video_coding/main/source/generic_encoder.h index a96ad9c9c..b58439dc4 100644 --- a/webrtc/modules/video_coding/main/source/generic_encoder.h +++ b/webrtc/modules/video_coding/main/source/generic_encoder.h @@ -34,24 +34,24 @@ public: /* * Callback implementation - codec encode complete */ - WebRtc_Word32 Encoded( + int32_t Encoded( EncodedImage& encodedImage, const CodecSpecificInfo* codecSpecificInfo = NULL, const RTPFragmentationHeader* fragmentationHeader = NULL); /* * Get number of encoded bytes */ - WebRtc_UWord32 EncodedBytes(); + uint32_t EncodedBytes(); /* * Callback implementation - generic encoder encode complete */ - WebRtc_Word32 SetTransportCallback(VCMPacketizationCallback* transport); + int32_t SetTransportCallback(VCMPacketizationCallback* transport); /** * Set media Optimization */ void SetMediaOpt (media_optimization::VCMMediaOptimization* mediaOpt); - void SetPayloadType(WebRtc_UWord8 payloadType) { _payloadType = payloadType; }; + void SetPayloadType(uint8_t payloadType) { _payloadType = payloadType; }; void SetCodecType(VideoCodecType codecType) {_codecType = codecType;}; void SetInternalSource(bool internalSource) { _internalSource = internalSource; }; @@ -65,8 +65,8 @@ private: VCMPacketizationCallback* _sendCallback; media_optimization::VCMMediaOptimization* _mediaOpt; - WebRtc_UWord32 _encodedBytes; - WebRtc_UWord8 _payloadType; + uint32_t _encodedBytes; + uint8_t _payloadType; VideoCodecType _codecType; bool _internalSource; #ifdef DEBUG_ENCODER_BIT_STREAM @@ -87,13 +87,13 @@ public: /** * Free encoder memory */ - WebRtc_Word32 Release(); + int32_t Release(); /** * Initialize the encoder with the information from the VideoCodec */ - WebRtc_Word32 InitEncode(const VideoCodec* settings, - WebRtc_Word32 numberOfCores, - WebRtc_UWord32 maxPayloadSize); + int32_t InitEncode(const VideoCodec* settings, + int32_t numberOfCores, + uint32_t maxPayloadSize); /** * Encode raw image * inputFrame : Frame containing raw image @@ -101,36 +101,36 @@ public: * cameraFrameRate : request or information from the remote side * frameType : The requested frame type to encode */ - WebRtc_Word32 Encode(const I420VideoFrame& inputFrame, + int32_t Encode(const I420VideoFrame& inputFrame, const CodecSpecificInfo* codecSpecificInfo, const std::vector& frameTypes); /** * Set new target bitrate (bits/s) and framerate. * Return Value: new bit rate if OK, otherwise <0s. */ - WebRtc_Word32 SetRates(WebRtc_UWord32 target_bitrate, - WebRtc_UWord32 frameRate); + int32_t SetRates(uint32_t target_bitrate, + uint32_t frameRate); /** * Set a new packet loss rate and a new round-trip time in milliseconds. */ - WebRtc_Word32 SetChannelParameters(WebRtc_Word32 packetLoss, int rtt); - WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 size); + int32_t SetChannelParameters(int32_t packetLoss, int rtt); + int32_t CodecConfigParameters(uint8_t* buffer, int32_t size); /** * Register a transport callback which will be called to deliver the encoded buffers */ - WebRtc_Word32 RegisterEncodeCallback(VCMEncodedFrameCallback* VCMencodedFrameCallback); + int32_t RegisterEncodeCallback(VCMEncodedFrameCallback* VCMencodedFrameCallback); /** * Get encoder bit rate */ - WebRtc_UWord32 BitRate() const; + uint32_t BitRate() const; /** * Get encoder frame rate */ - WebRtc_UWord32 FrameRate() const; + uint32_t FrameRate() const; - WebRtc_Word32 SetPeriodicKeyFrames(bool enable); + int32_t SetPeriodicKeyFrames(bool enable); - WebRtc_Word32 RequestFrame(const std::vector& frame_types); + int32_t RequestFrame(const std::vector& frame_types); bool InternalSource() const; @@ -138,8 +138,8 @@ private: VideoEncoder& _encoder; VideoCodecType _codecType; VCMEncodedFrameCallback* _VCMencodedFrameCallback; - WebRtc_UWord32 _bitRate; - WebRtc_UWord32 _frameRate; + uint32_t _bitRate; + uint32_t _frameRate; bool _internalSource; }; // end of VCMGenericEncoder class diff --git a/webrtc/modules/video_coding/main/source/inter_frame_delay.cc b/webrtc/modules/video_coding/main/source/inter_frame_delay.cc index 3b520b371..ab756e185 100644 --- a/webrtc/modules/video_coding/main/source/inter_frame_delay.cc +++ b/webrtc/modules/video_coding/main/source/inter_frame_delay.cc @@ -31,8 +31,8 @@ VCMInterFrameDelay::Reset(int64_t currentWallClock) // Calculates the delay of a frame with the given timestamp. // This method is called when the frame is complete. bool -VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp, - WebRtc_Word64 *delay, +VCMInterFrameDelay::CalculateDelay(uint32_t timestamp, + int64_t *delay, int64_t currentWallClock) { if (_prevWallClock == 0) @@ -44,11 +44,11 @@ VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp, return true; } - WebRtc_Word32 prevWrapArounds = _wrapArounds; + int32_t prevWrapArounds = _wrapArounds; CheckForWrapArounds(timestamp); // This will be -1 for backward wrap arounds and +1 for forward wrap arounds - WebRtc_Word32 wrapAroundsSincePrev = _wrapArounds - prevWrapArounds; + int32_t wrapAroundsSincePrev = _wrapArounds - prevWrapArounds; // Account for reordering in jitter variance estimate in the future? // Note that this also captures incomplete frames which are grabbed @@ -62,13 +62,13 @@ VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp, // Compute the compensated timestamp difference and convert it to ms and // round it to closest integer. - _dTS = static_cast((timestamp + wrapAroundsSincePrev * - (static_cast(1)<<32) - _prevTimestamp) / 90.0 + 0.5); + _dTS = static_cast((timestamp + wrapAroundsSincePrev * + (static_cast(1)<<32) - _prevTimestamp) / 90.0 + 0.5); // frameDelay is the difference of dT and dTS -- i.e. the difference of // the wall clock time difference and the timestamp difference between // two following frames. - *delay = static_cast(currentWallClock - _prevWallClock - _dTS); + *delay = static_cast(currentWallClock - _prevWallClock - _dTS); _prevTimestamp = timestamp; _prevWallClock = currentWallClock; @@ -77,26 +77,26 @@ VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp, } // Returns the current difference between incoming timestamps -WebRtc_UWord32 VCMInterFrameDelay::CurrentTimeStampDiffMs() const +uint32_t VCMInterFrameDelay::CurrentTimeStampDiffMs() const { if (_dTS < 0) { return 0; } - return static_cast(_dTS); + return static_cast(_dTS); } // Investigates if the timestamp clock has overflowed since the last timestamp and // keeps track of the number of wrap arounds since reset. void -VCMInterFrameDelay::CheckForWrapArounds(WebRtc_UWord32 timestamp) +VCMInterFrameDelay::CheckForWrapArounds(uint32_t timestamp) { if (timestamp < _prevTimestamp) { // This difference will probably be less than -2^31 if we have had a wrap around // (e.g. timestamp = 1, _previousTimestamp = 2^32 - 1). Since it is cast to a Word32, // it should be positive. - if (static_cast(timestamp - _prevTimestamp) > 0) + if (static_cast(timestamp - _prevTimestamp) > 0) { // Forward wrap around _wrapArounds++; @@ -104,7 +104,7 @@ VCMInterFrameDelay::CheckForWrapArounds(WebRtc_UWord32 timestamp) } // This difference will probably be less than -2^31 if we have had a backward wrap around. // Since it is cast to a Word32, it should be positive. - else if (static_cast(_prevTimestamp - timestamp) > 0) + else if (static_cast(_prevTimestamp - timestamp) > 0) { // Backward wrap around _wrapArounds--; diff --git a/webrtc/modules/video_coding/main/source/inter_frame_delay.h b/webrtc/modules/video_coding/main/source/inter_frame_delay.h index 807c64b2c..5b16dbb7a 100644 --- a/webrtc/modules/video_coding/main/source/inter_frame_delay.h +++ b/webrtc/modules/video_coding/main/source/inter_frame_delay.h @@ -33,15 +33,15 @@ public: // - currentWallClock : The current time in milliseconds. // Should be -1 for normal operation, only used for testing. // Return value : true if OK, false when reordered timestamps - bool CalculateDelay(WebRtc_UWord32 timestamp, - WebRtc_Word64 *delay, + bool CalculateDelay(uint32_t timestamp, + int64_t *delay, int64_t currentWallClock); // Returns the current difference between incoming timestamps // // Return value : Wrap-around compensated difference between incoming // timestamps. - WebRtc_UWord32 CurrentTimeStampDiffMs() const; + uint32_t CurrentTimeStampDiffMs() const; private: // Controls if the RTP timestamp counter has had a wrap around @@ -49,16 +49,16 @@ private: // // Input: // - timestmap : RTP timestamp of the current frame. - void CheckForWrapArounds(WebRtc_UWord32 timestamp); + void CheckForWrapArounds(uint32_t timestamp); - WebRtc_Word64 _zeroWallClock; // Local timestamp of the first video packet received - WebRtc_Word32 _wrapArounds; // Number of wrapArounds detected + int64_t _zeroWallClock; // Local timestamp of the first video packet received + int32_t _wrapArounds; // Number of wrapArounds detected // The previous timestamp passed to the delay estimate - WebRtc_UWord32 _prevTimestamp; + uint32_t _prevTimestamp; // The previous wall clock timestamp used by the delay estimate - WebRtc_Word64 _prevWallClock; + int64_t _prevWallClock; // Wrap-around compensated difference between incoming timestamps - WebRtc_Word64 _dTS; + int64_t _dTS; }; } // namespace webrtc diff --git a/webrtc/modules/video_coding/main/source/internal_defines.h b/webrtc/modules/video_coding/main/source/internal_defines.h index 0ba63851e..0ea163c79 100644 --- a/webrtc/modules/video_coding/main/source/internal_defines.h +++ b/webrtc/modules/video_coding/main/source/internal_defines.h @@ -18,9 +18,9 @@ namespace webrtc #define MASK_32_BITS(x) (0xFFFFFFFF & (x)) -inline WebRtc_UWord32 MaskWord64ToUWord32(WebRtc_Word64 w64) +inline uint32_t MaskWord64ToUWord32(int64_t w64) { - return static_cast(MASK_32_BITS(w64)); + return static_cast(MASK_32_BITS(w64)); } #define VCM_MAX(a, b) (((a) > (b)) ? (a) : (b)) @@ -48,9 +48,9 @@ inline WebRtc_UWord32 MaskWord64ToUWord32(WebRtc_Word64 w64) #define VCM_NO_RECEIVER_ID 0 -inline WebRtc_Word32 VCMId(const WebRtc_Word32 vcmId, const WebRtc_Word32 receiverId = 0) +inline int32_t VCMId(const int32_t vcmId, const int32_t receiverId = 0) { - return static_cast((vcmId << 16) + receiverId); + return static_cast((vcmId << 16) + receiverId); } } // namespace webrtc diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer.h b/webrtc/modules/video_coding/main/source/jitter_buffer.h index 0b07c5370..91c04741e 100644 --- a/webrtc/modules/video_coding/main/source/jitter_buffer.h +++ b/webrtc/modules/video_coding/main/source/jitter_buffer.h @@ -285,7 +285,7 @@ class VCMJitterBuffer { // Calculates network delays used for jitter calculations. VCMInterFrameDelay inter_frame_delay_; VCMJitterSample waiting_for_completion_; - WebRtc_UWord32 rtt_ms_; + uint32_t rtt_ms_; // NACK and retransmissions. VCMNackMode nack_mode_; diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer_common.cc b/webrtc/modules/video_coding/main/source/jitter_buffer_common.cc index 79a21b440..bc7e821a5 100644 --- a/webrtc/modules/video_coding/main/source/jitter_buffer_common.cc +++ b/webrtc/modules/video_coding/main/source/jitter_buffer_common.cc @@ -14,8 +14,8 @@ namespace webrtc { -WebRtc_UWord32 LatestTimestamp(WebRtc_UWord32 timestamp1, - WebRtc_UWord32 timestamp2, +uint32_t LatestTimestamp(uint32_t timestamp1, + uint32_t timestamp2, bool* has_wrapped) { bool wrap = (timestamp2 < 0x0000ffff && timestamp1 > 0xffff0000) || (timestamp2 > 0xffff0000 && timestamp1 < 0x0000ffff); @@ -31,8 +31,8 @@ WebRtc_UWord32 LatestTimestamp(WebRtc_UWord32 timestamp1, return timestamp2; } -WebRtc_Word32 LatestSequenceNumber(WebRtc_Word32 seq_num1, - WebRtc_Word32 seq_num2, +int32_t LatestSequenceNumber(int32_t seq_num1, + int32_t seq_num2, bool* has_wrapped) { if (seq_num1 < 0 && seq_num2 < 0) return -1; diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer_common.h b/webrtc/modules/video_coding/main/source/jitter_buffer_common.h index c981e0e90..718f4af40 100644 --- a/webrtc/modules/video_coding/main/source/jitter_buffer_common.h +++ b/webrtc/modules/video_coding/main/source/jitter_buffer_common.h @@ -62,15 +62,15 @@ enum VCMNaluCompleteness { // Returns the latest of the two timestamps, compensating for wrap arounds. // This function assumes that the two timestamps are close in time. -WebRtc_UWord32 LatestTimestamp(WebRtc_UWord32 timestamp1, - WebRtc_UWord32 timestamp2, +uint32_t LatestTimestamp(uint32_t timestamp1, + uint32_t timestamp2, bool* has_wrapped); // Returns the latest of the two sequence numbers, compensating for wrap // arounds. This function assumes that the two sequence numbers are close in // time. -WebRtc_Word32 LatestSequenceNumber(WebRtc_Word32 seq_num1, - WebRtc_Word32 seq_num2, +int32_t LatestSequenceNumber(int32_t seq_num1, + int32_t seq_num2, bool* has_wrapped); } // namespace webrtc diff --git a/webrtc/modules/video_coding/main/source/jitter_estimator.cc b/webrtc/modules/video_coding/main/source/jitter_estimator.cc index 3c8257538..1c6b5492a 100644 --- a/webrtc/modules/video_coding/main/source/jitter_estimator.cc +++ b/webrtc/modules/video_coding/main/source/jitter_estimator.cc @@ -22,7 +22,7 @@ namespace webrtc { enum { kInitialMaxJitterEstimate = 0 }; -VCMJitterEstimator::VCMJitterEstimator(WebRtc_Word32 vcmId, WebRtc_Word32 receiverId) : +VCMJitterEstimator::VCMJitterEstimator(int32_t vcmId, int32_t receiverId) : _vcmId(vcmId), _receiverId(receiverId), _phi(0.97), @@ -114,7 +114,7 @@ VCMJitterEstimator::ResetNackCount() // Updates the estimates with the new measurements void -VCMJitterEstimator::UpdateEstimate(WebRtc_Word64 frameDelayMS, WebRtc_UWord32 frameSizeBytes, +VCMJitterEstimator::UpdateEstimate(int64_t frameDelayMS, uint32_t frameSizeBytes, bool incompleteFrame /* = false */) { WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, @@ -235,8 +235,8 @@ VCMJitterEstimator::FrameNacked() // Updates Kalman estimate of the channel // The caller is expected to sanity check the inputs. void -VCMJitterEstimator::KalmanEstimateChannel(WebRtc_Word64 frameDelayMS, - WebRtc_Word32 deltaFSBytes) +VCMJitterEstimator::KalmanEstimateChannel(int64_t frameDelayMS, + int32_t deltaFSBytes) { double Mh[2]; double hMh_sigma; @@ -313,8 +313,8 @@ VCMJitterEstimator::KalmanEstimateChannel(WebRtc_Word64 frameDelayMS, // Calculate difference in delay between a sample and the // expected delay estimated by the Kalman filter double -VCMJitterEstimator::DeviationFromExpectedDelay(WebRtc_Word64 frameDelayMS, - WebRtc_Word32 deltaFSBytes) const +VCMJitterEstimator::DeviationFromExpectedDelay(int64_t frameDelayMS, + int32_t deltaFSBytes) const { return frameDelayMS - (_theta[0] * deltaFSBytes + _theta[1]); } @@ -395,13 +395,13 @@ VCMJitterEstimator::PostProcessEstimate() } void -VCMJitterEstimator::UpdateRtt(WebRtc_UWord32 rttMs) +VCMJitterEstimator::UpdateRtt(uint32_t rttMs) { _rttFilter.Update(rttMs); } void -VCMJitterEstimator::UpdateMaxFrameSize(WebRtc_UWord32 frameSizeBytes) +VCMJitterEstimator::UpdateMaxFrameSize(uint32_t frameSizeBytes) { if (_maxFrameSize < frameSizeBytes) { diff --git a/webrtc/modules/video_coding/main/source/jitter_estimator.h b/webrtc/modules/video_coding/main/source/jitter_estimator.h index 77d6b6df9..f896c6fdf 100644 --- a/webrtc/modules/video_coding/main/source/jitter_estimator.h +++ b/webrtc/modules/video_coding/main/source/jitter_estimator.h @@ -26,7 +26,7 @@ enum VCMJitterEstimateMode class VCMJitterEstimator { public: - VCMJitterEstimator(WebRtc_Word32 vcmId = 0, WebRtc_Word32 receiverId = 0); + VCMJitterEstimator(int32_t vcmId = 0, int32_t receiverId = 0); VCMJitterEstimator& operator=(const VCMJitterEstimator& rhs); @@ -41,8 +41,8 @@ public: // - frameSize : Frame size of the current frame. // - incompleteFrame : Flags if the frame is used to update the estimate before it // was complete. Default is false. - void UpdateEstimate(WebRtc_Word64 frameDelayMS, - WebRtc_UWord32 frameSizeBytes, + void UpdateEstimate(int64_t frameDelayMS, + uint32_t frameSizeBytes, bool incompleteFrame = false); // Returns the current jitter estimate in milliseconds and adds @@ -60,9 +60,9 @@ public: // // Input: // - rttMs : RTT in ms - void UpdateRtt(WebRtc_UWord32 rttMs); + void UpdateRtt(uint32_t rttMs); - void UpdateMaxFrameSize(WebRtc_UWord32 frameSizeBytes); + void UpdateMaxFrameSize(uint32_t frameSizeBytes); // Set a max filter on the jitter estimate by setting an initial // non-zero delay. When set to zero (default), the last jitter @@ -72,7 +72,7 @@ public: // A constant describing the delay from the jitter buffer // to the delay on the receiving side which is not accounted // for by the jitter buffer nor the decoding delay estimate. - static const WebRtc_UWord32 OPERATING_SYSTEM_JITTER = 10; + static const uint32_t OPERATING_SYSTEM_JITTER = 10; protected: // These are protected for better testing possibilities @@ -87,7 +87,7 @@ private: // - frameDelayMS : Delay-delta calculated by UTILDelayEstimate in milliseconds // - deltaFSBytes : Frame size delta, i.e. // : frame size at time T minus frame size at time T-1 - void KalmanEstimateChannel(WebRtc_Word64 frameDelayMS, WebRtc_Word32 deltaFSBytes); + void KalmanEstimateChannel(int64_t frameDelayMS, int32_t deltaFSBytes); // Updates the random jitter estimate, i.e. the variance // of the time deviations from the line given by the Kalman filter. @@ -117,19 +117,19 @@ private: // T minus frame size at time T-1 // // Return value : The difference in milliseconds - double DeviationFromExpectedDelay(WebRtc_Word64 frameDelayMS, - WebRtc_Word32 deltaFSBytes) const; + double DeviationFromExpectedDelay(int64_t frameDelayMS, + int32_t deltaFSBytes) const; // Constants, filter parameters - WebRtc_Word32 _vcmId; - WebRtc_Word32 _receiverId; + int32_t _vcmId; + int32_t _receiverId; const double _phi; const double _psi; - const WebRtc_UWord32 _alphaCountMax; + const uint32_t _alphaCountMax; const double _thetaLow; - const WebRtc_UWord32 _nackLimit; - const WebRtc_Word32 _numStdDevDelayOutlier; - const WebRtc_Word32 _numStdDevFrameSizeOutlier; + const uint32_t _nackLimit; + const int32_t _numStdDevDelayOutlier; + const int32_t _numStdDevFrameSizeOutlier; const double _noiseStdDevs; const double _noiseStdDevOffset; @@ -139,20 +139,20 @@ private: double _varFrameSize; // Frame size variance double _maxFrameSize; // Largest frame size received (descending // with a factor _psi) - WebRtc_UWord32 _fsSum; - WebRtc_UWord32 _fsCount; + uint32_t _fsSum; + uint32_t _fsCount; - WebRtc_Word64 _lastUpdateT; + int64_t _lastUpdateT; double _prevEstimate; // The previously returned jitter estimate - WebRtc_UWord32 _prevFrameSize; // Frame size of the previous frame + uint32_t _prevFrameSize; // Frame size of the previous frame double _avgNoise; // Average of the random jitter - WebRtc_UWord32 _alphaCount; + uint32_t _alphaCount; double _filterJitterEstimate; // The filtered sum of jitter estimates - WebRtc_UWord32 _startupCount; + uint32_t _startupCount; - WebRtc_Word64 _latestNackTimestamp; // Timestamp in ms when the latest nack was seen - WebRtc_UWord32 _nackCount; // Keeps track of the number of nacks received, + int64_t _latestNackTimestamp; // Timestamp in ms when the latest nack was seen + uint32_t _nackCount; // Keeps track of the number of nacks received, // but never goes above _nackLimit VCMRttFilter _rttFilter; VCMJitterEstimateMode _jitterEstimateMode; diff --git a/webrtc/modules/video_coding/main/source/media_opt_util.cc b/webrtc/modules/video_coding/main/source/media_opt_util.cc index 046332751..787d947fb 100644 --- a/webrtc/modules/video_coding/main/source/media_opt_util.cc +++ b/webrtc/modules/video_coding/main/source/media_opt_util.cc @@ -98,12 +98,12 @@ VCMNackFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) else if (_highRttNackMs == -1 || parameters->rtt < _highRttNackMs) { // TODO(mikhal): Disabling adjustment temporarily. - // WebRtc_UWord16 rttIndex = (WebRtc_UWord16) parameters->rtt; + // uint16_t rttIndex = (uint16_t) parameters->rtt; float adjustRtt = 1.0f;// (float)VCMNackFecTable[rttIndex] / 100.0f; // Adjust FEC with NACK on (for delta frame only) // table depends on RTT relative to rttMax (NACK Threshold) - _protectionFactorD = static_cast + _protectionFactorD = static_cast (adjustRtt * static_cast(_protectionFactorD)); // update FEC rates after applying adjustment @@ -253,40 +253,40 @@ VCMFecMethod::~VCMFecMethod() // } -WebRtc_UWord8 -VCMFecMethod::BoostCodeRateKey(WebRtc_UWord8 packetFrameDelta, - WebRtc_UWord8 packetFrameKey) const +uint8_t +VCMFecMethod::BoostCodeRateKey(uint8_t packetFrameDelta, + uint8_t packetFrameKey) const { - WebRtc_UWord8 boostRateKey = 2; + uint8_t boostRateKey = 2; // Default: ratio scales the FEC protection up for I frames - WebRtc_UWord8 ratio = 1; + uint8_t ratio = 1; if (packetFrameDelta > 0) { - ratio = (WebRtc_Word8) (packetFrameKey / packetFrameDelta); + ratio = (int8_t) (packetFrameKey / packetFrameDelta); } ratio = VCM_MAX(boostRateKey, ratio); return ratio; } -WebRtc_UWord8 -VCMFecMethod::ConvertFECRate(WebRtc_UWord8 codeRateRTP) const +uint8_t +VCMFecMethod::ConvertFECRate(uint8_t codeRateRTP) const { - return static_cast (VCM_MIN(255,(0.5 + 255.0 * codeRateRTP / + return static_cast (VCM_MIN(255,(0.5 + 255.0 * codeRateRTP / (float)(255 - codeRateRTP)))); } // Update FEC with protectionFactorD void -VCMFecMethod::UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD) +VCMFecMethod::UpdateProtectionFactorD(uint8_t protectionFactorD) { _protectionFactorD = protectionFactorD; } // Update FEC with protectionFactorK void -VCMFecMethod::UpdateProtectionFactorK(WebRtc_UWord8 protectionFactorK) +VCMFecMethod::UpdateProtectionFactorK(uint8_t protectionFactorK) { _protectionFactorK = protectionFactorK; } @@ -299,11 +299,11 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const { // Total (avg) bits available per frame: total rate over actual/sent frame // rate units are kbits/frame - const WebRtc_UWord16 bitRatePerFrame = static_cast + const uint16_t bitRatePerFrame = static_cast (parameters->bitRate / (parameters->frameRate)); // Total (average) number of packets per frame (source and fec): - const WebRtc_UWord8 avgTotPackets = 1 + static_cast + const uint8_t avgTotPackets = 1 + static_cast (static_cast (bitRatePerFrame * 1000.0) / static_cast (8.0 * _maxPayloadSize) + 0.5); @@ -312,10 +312,10 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const // Round down for estimated #FEC packets/frame, to keep // |fecPacketsPerFrame| <= |sourcePacketsPerFrame|. - WebRtc_UWord8 fecPacketsPerFrame = static_cast + uint8_t fecPacketsPerFrame = static_cast (protectionFactor * avgTotPackets); - WebRtc_UWord8 sourcePacketsPerFrame = avgTotPackets - fecPacketsPerFrame; + uint8_t sourcePacketsPerFrame = avgTotPackets - fecPacketsPerFrame; if ( (fecPacketsPerFrame == 0) || (sourcePacketsPerFrame == 0) ) { @@ -336,18 +336,18 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const } // Code index for tables: up to (kMaxNumPackets * kMaxNumPackets) - WebRtc_UWord16 codeIndexTable[kMaxNumPackets * kMaxNumPackets]; - WebRtc_UWord16 k = 0; - for (WebRtc_UWord8 i = 1; i <= kMaxNumPackets; i++) + uint16_t codeIndexTable[kMaxNumPackets * kMaxNumPackets]; + uint16_t k = 0; + for (uint8_t i = 1; i <= kMaxNumPackets; i++) { - for (WebRtc_UWord8 j = 1; j <= i; j++) + for (uint8_t j = 1; j <= i; j++) { codeIndexTable[(j - 1) * kMaxNumPackets + i - 1] = k; k += 1; } } - WebRtc_UWord8 lossRate = static_cast (255.0 * + uint8_t lossRate = static_cast (255.0 * parameters->lossPr + 0.5f); // Constrain lossRate to 50%: tables defined up to 50% @@ -356,10 +356,10 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const lossRate = kPacketLossMax - 1; } - const WebRtc_UWord16 codeIndex = (fecPacketsPerFrame - 1) * kMaxNumPackets + + const uint16_t codeIndex = (fecPacketsPerFrame - 1) * kMaxNumPackets + (sourcePacketsPerFrame - 1); - const WebRtc_UWord16 indexTable = codeIndexTable[codeIndex] * kPacketLossMax + + const uint16_t indexTable = codeIndexTable[codeIndex] * kPacketLossMax + lossRate; // Check on table index @@ -375,7 +375,7 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) // FEC PROTECTION SETTINGS: varies with packet loss and bitrate // No protection if (filtered) packetLoss is 0 - WebRtc_UWord8 packetLoss = (WebRtc_UWord8) (255 * parameters->lossPr); + uint8_t packetLoss = (uint8_t) (255 * parameters->lossPr); if (packetLoss == 0) { _protectionFactorK = 0; @@ -387,20 +387,20 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) // first partition size, thresholds, table pars, spatial resoln fac. // First partition protection: ~ 20% - WebRtc_UWord8 firstPartitionProt = (WebRtc_UWord8) (255 * 0.20); + uint8_t firstPartitionProt = (uint8_t) (255 * 0.20); // Minimum protection level needed to generate one FEC packet for one // source packet/frame (in RTP sender) - WebRtc_UWord8 minProtLevelFec = 85; + uint8_t minProtLevelFec = 85; // Threshold on packetLoss and bitRrate/frameRate (=average #packets), // above which we allocate protection to cover at least first partition. - WebRtc_UWord8 lossThr = 0; - WebRtc_UWord8 packetNumThr = 1; + uint8_t lossThr = 0; + uint8_t packetNumThr = 1; // Parameters for range of rate index of table. - const WebRtc_UWord8 ratePar1 = 5; - const WebRtc_UWord8 ratePar2 = 49; + const uint8_t ratePar1 = 5; + const uint8_t ratePar2 = 49; // Spatial resolution size, relative to a reference size. float spatialSizeToRef = static_cast @@ -415,21 +415,21 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) // Average number of packets per frame (source and fec): - const WebRtc_UWord8 avgTotPackets = 1 + (WebRtc_UWord8) + const uint8_t avgTotPackets = 1 + (uint8_t) ((float) bitRatePerFrame * 1000.0 / (float) (8.0 * _maxPayloadSize) + 0.5); // FEC rate parameters: for P and I frame - WebRtc_UWord8 codeRateDelta = 0; - WebRtc_UWord8 codeRateKey = 0; + uint8_t codeRateDelta = 0; + uint8_t codeRateKey = 0; // Get index for table: the FEC protection depends on an effective rate. // The range on the rate index corresponds to rates (bps) // from ~200k to ~8000k, for 30fps - const WebRtc_UWord16 effRateFecTable = static_cast + const uint16_t effRateFecTable = static_cast (resolnFac * bitRatePerFrame); - WebRtc_UWord8 rateIndexTable = - (WebRtc_UWord8) VCM_MAX(VCM_MIN((effRateFecTable - ratePar1) / + uint8_t rateIndexTable = + (uint8_t) VCM_MAX(VCM_MIN((effRateFecTable - ratePar1) / ratePar1, ratePar2), 0); // Restrict packet loss range to 50: @@ -438,7 +438,7 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) { packetLoss = kPacketLossMax - 1; } - WebRtc_UWord16 indexTable = rateIndexTable * kPacketLossMax + packetLoss; + uint16_t indexTable = rateIndexTable * kPacketLossMax + packetLoss; // Check on table index assert(indexTable < kSizeCodeRateXORTable); @@ -473,23 +473,23 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) packetLoss); } - codeRateDelta = static_cast(codeRateDelta * adjustFec); + codeRateDelta = static_cast(codeRateDelta * adjustFec); // For Key frame: // Effectively at a higher rate, so we scale/boost the rate // The boost factor may depend on several factors: ratio of packet // number of I to P frames, how much protection placed on P frames, etc. - const WebRtc_UWord8 packetFrameDelta = (WebRtc_UWord8) + const uint8_t packetFrameDelta = (uint8_t) (0.5 + parameters->packetsPerFrame); - const WebRtc_UWord8 packetFrameKey = (WebRtc_UWord8) + const uint8_t packetFrameKey = (uint8_t) (0.5 + parameters->packetsPerFrameKey); - const WebRtc_UWord8 boostKey = BoostCodeRateKey(packetFrameDelta, + const uint8_t boostKey = BoostCodeRateKey(packetFrameDelta, packetFrameKey); - rateIndexTable = (WebRtc_UWord8) VCM_MAX(VCM_MIN( + rateIndexTable = (uint8_t) VCM_MAX(VCM_MIN( 1 + (boostKey * effRateFecTable - ratePar1) / ratePar1,ratePar2),0); - WebRtc_UWord16 indexTableKey = rateIndexTable * kPacketLossMax + packetLoss; + uint16_t indexTableKey = rateIndexTable * kPacketLossMax + packetLoss; indexTableKey = VCM_MIN(indexTableKey, kSizeCodeRateXORTable); @@ -508,7 +508,7 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) // Make sure I frame protection is at least larger than P frame protection, // and at least as high as filtered packet loss. - codeRateKey = static_cast (VCM_MAX(packetLoss, + codeRateKey = static_cast (VCM_MAX(packetLoss, VCM_MAX(boostKeyProt, codeRateKey))); // Check limit on amount of protection for I frame: 50% is max. @@ -588,7 +588,7 @@ VCMFecMethod::EffectivePacketLoss(const VCMProtectionParameters* parameters) // note: received/input packet loss may be filtered based on FilteredLoss // The packet loss: - WebRtc_UWord8 packetLoss = (WebRtc_UWord8) (255 * parameters->lossPr); + uint8_t packetLoss = (uint8_t) (255 * parameters->lossPr); float avgFecRecov = AvgRecoveryFEC(parameters); @@ -737,7 +737,7 @@ VCMLossProtectionLogic::RequiredBitRate() const } void -VCMLossProtectionLogic::UpdateRtt(WebRtc_UWord32 rtt) +VCMLossProtectionLogic::UpdateRtt(uint32_t rtt) { _rtt = rtt; } @@ -749,8 +749,8 @@ VCMLossProtectionLogic::UpdateResidualPacketLoss(float residualPacketLoss) } void -VCMLossProtectionLogic::UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, - WebRtc_Word64 now) +VCMLossProtectionLogic::UpdateMaxLossHistory(uint8_t lossPr255, + int64_t now) { if (_lossPrHistory[0].timeMs >= 0 && now - _lossPrHistory[0].timeMs < kLossPrShortFilterWinMs) @@ -771,7 +771,7 @@ VCMLossProtectionLogic::UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, else { // Shift - for (WebRtc_Word32 i = (kLossPrHistorySize - 2); i >= 0; i--) + for (int32_t i = (kLossPrHistorySize - 2); i >= 0; i--) { _lossPrHistory[i + 1].lossPr255 = _lossPrHistory[i].lossPr255; _lossPrHistory[i + 1].timeMs = _lossPrHistory[i].timeMs; @@ -788,15 +788,15 @@ VCMLossProtectionLogic::UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, } } -WebRtc_UWord8 -VCMLossProtectionLogic::MaxFilteredLossPr(WebRtc_Word64 nowMs) const +uint8_t +VCMLossProtectionLogic::MaxFilteredLossPr(int64_t nowMs) const { - WebRtc_UWord8 maxFound = _shortMaxLossPr255; + uint8_t maxFound = _shortMaxLossPr255; if (_lossPrHistory[0].timeMs == -1) { return maxFound; } - for (WebRtc_Word32 i = 0; i < kLossPrHistorySize; i++) + for (int32_t i = 0; i < kLossPrHistorySize; i++) { if (_lossPrHistory[i].timeMs == -1) { @@ -817,10 +817,10 @@ VCMLossProtectionLogic::MaxFilteredLossPr(WebRtc_Word64 nowMs) const return maxFound; } -WebRtc_UWord8 VCMLossProtectionLogic::FilteredLoss( +uint8_t VCMLossProtectionLogic::FilteredLoss( int64_t nowMs, FilterPacketLossMode filter_mode, - WebRtc_UWord8 lossPr255) { + uint8_t lossPr255) { // Update the max window filter. UpdateMaxLossHistory(lossPr255, nowMs); @@ -831,13 +831,13 @@ WebRtc_UWord8 VCMLossProtectionLogic::FilteredLoss( _lastPrUpdateT = nowMs; // Filtered loss: default is received loss (no filtering). - WebRtc_UWord8 filtered_loss = lossPr255; + uint8_t filtered_loss = lossPr255; switch (filter_mode) { case kNoFilter: break; case kAvgFilter: - filtered_loss = static_cast (_lossPr255.Value() + 0.5); + filtered_loss = static_cast (_lossPr255.Value() + 0.5); break; case kMaxFilter: filtered_loss = MaxFilteredLossPr(nowMs); @@ -848,7 +848,7 @@ WebRtc_UWord8 VCMLossProtectionLogic::FilteredLoss( } void -VCMLossProtectionLogic::UpdateFilteredLossPr(WebRtc_UWord8 packetLossEnc) +VCMLossProtectionLogic::UpdateFilteredLossPr(uint8_t packetLossEnc) { _lossPr = (float) packetLossEnc / (float) 255.0; } @@ -882,8 +882,8 @@ VCMLossProtectionLogic::UpdateKeyFrameSize(float keyFrameSize) } void -VCMLossProtectionLogic::UpdateFrameSize(WebRtc_UWord16 width, - WebRtc_UWord16 height) +VCMLossProtectionLogic::UpdateFrameSize(uint16_t width, + uint16_t height) { _codecWidth = width; _codecHeight = height; @@ -937,7 +937,7 @@ VCMLossProtectionLogic::Reset(int64_t nowMs) _lossPr255.Reset(0.9999f); _packetsPerFrame.Reset(0.9999f); _fecRateDelta = _fecRateKey = 0; - for (WebRtc_Word32 i = 0; i < kLossPrHistorySize; i++) + for (int32_t i = 0; i < kLossPrHistorySize; i++) { _lossPrHistory[i].lossPr255 = 0; _lossPrHistory[i].timeMs = -1; diff --git a/webrtc/modules/video_coding/main/source/media_opt_util.h b/webrtc/modules/video_coding/main/source/media_opt_util.h index 8f0ac508f..193426923 100644 --- a/webrtc/modules/video_coding/main/source/media_opt_util.h +++ b/webrtc/modules/video_coding/main/source/media_opt_util.h @@ -62,11 +62,11 @@ struct VCMProtectionParameters float packetsPerFrameKey; float frameRate; float keyFrameSize; - WebRtc_UWord8 fecRateDelta; - WebRtc_UWord8 fecRateKey; + uint8_t fecRateDelta; + uint8_t fecRateKey; float residualPacketLossFec; - WebRtc_UWord16 codecWidth; - WebRtc_UWord16 codecHeight; + uint16_t codecWidth; + uint16_t codecHeight; int numLayers; }; @@ -88,8 +88,8 @@ class VCMLossProbabilitySample public: VCMLossProbabilitySample() : lossPr255(0), timeMs(-1) {}; - WebRtc_UWord8 lossPr255; - WebRtc_Word64 timeMs; + uint8_t lossPr255; + int64_t timeMs; }; @@ -122,17 +122,17 @@ public: // Returns the effective packet loss for ER, required by this protection method // // Return value : Required effective packet loss - virtual WebRtc_UWord8 RequiredPacketLossER() { return _effectivePacketLoss; } + virtual uint8_t RequiredPacketLossER() { return _effectivePacketLoss; } // Extracts the FEC protection factor for Key frame, required by this protection method // // Return value : Required protectionFactor for Key frame - virtual WebRtc_UWord8 RequiredProtectionFactorK() { return _protectionFactorK; } + virtual uint8_t RequiredProtectionFactorK() { return _protectionFactorK; } // Extracts the FEC protection factor for Delta frame, required by this protection method // // Return value : Required protectionFactor for delta frame - virtual WebRtc_UWord8 RequiredProtectionFactorD() { return _protectionFactorD; } + virtual uint8_t RequiredProtectionFactorD() { return _protectionFactorD; } // Extracts whether the FEC Unequal protection (UEP) is used for Key frame. // @@ -151,13 +151,13 @@ public: protected: - WebRtc_UWord8 _effectivePacketLoss; - WebRtc_UWord8 _protectionFactorK; - WebRtc_UWord8 _protectionFactorD; + uint8_t _effectivePacketLoss; + uint8_t _protectionFactorK; + uint8_t _protectionFactorD; // Estimation of residual loss after the FEC float _residualPacketLossFec; float _scaleProtKey; - WebRtc_Word32 _maxPayloadSize; + int32_t _maxPayloadSize; VCMQmRobustness* _qmRobustness; bool _useUepProtectionK; @@ -188,16 +188,16 @@ public: // Get the FEC protection factors bool ProtectionFactor(const VCMProtectionParameters* parameters); // Get the boost for key frame protection - WebRtc_UWord8 BoostCodeRateKey(WebRtc_UWord8 packetFrameDelta, - WebRtc_UWord8 packetFrameKey) const; + uint8_t BoostCodeRateKey(uint8_t packetFrameDelta, + uint8_t packetFrameKey) const; // Convert the rates: defined relative to total# packets or source# packets - WebRtc_UWord8 ConvertFECRate(WebRtc_UWord8 codeRate) const; + uint8_t ConvertFECRate(uint8_t codeRate) const; // Get the average effective recovery from FEC: for random loss model float AvgRecoveryFEC(const VCMProtectionParameters* parameters) const; // Update FEC with protectionFactorD - void UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD); + void UpdateProtectionFactorD(uint8_t protectionFactorD); // Update FEC with protectionFactorK - void UpdateProtectionFactorK(WebRtc_UWord8 protectionFactorK); + void UpdateProtectionFactorK(uint8_t protectionFactorK); // Compute the bits per frame. Account for temporal layers when applicable. int BitsPerFrame(const VCMProtectionParameters* parameters); @@ -267,7 +267,7 @@ public: // // Input: // - rtt : Round-trip time in seconds. - void UpdateRtt(WebRtc_UWord32 rtt); + void UpdateRtt(uint32_t rtt); // Update residual packet loss // @@ -281,7 +281,7 @@ public: // Input: // - packetLossEnc : The reported packet loss filtered // (max window or average) - void UpdateFilteredLossPr(WebRtc_UWord8 packetLossEnc); + void UpdateFilteredLossPr(uint8_t packetLossEnc); // Update the current target bit rate. // @@ -318,7 +318,7 @@ public: // Input: // - width : The codec frame width. // - height : The codec frame height. - void UpdateFrameSize(WebRtc_UWord16 width, WebRtc_UWord16 height); + void UpdateFrameSize(uint16_t width, uint16_t height); // Update the number of active layers // @@ -333,7 +333,7 @@ public: // sending key frames. // - fecRateDelta : Packet loss to cover for with FEC when // sending delta frames. - void UpdateFECRates(WebRtc_UWord8 fecRateKey, WebRtc_UWord8 fecRateDelta) + void UpdateFECRates(uint8_t fecRateKey, uint8_t fecRateDelta) { _fecRateKey = fecRateKey; _fecRateDelta = fecRateDelta; } @@ -356,8 +356,8 @@ public: // The input parameter |lossPr255| is the received packet loss. // Return value : The filtered loss probability - WebRtc_UWord8 FilteredLoss(int64_t nowMs, FilterPacketLossMode filter_mode, - WebRtc_UWord8 lossPr255); + uint8_t FilteredLoss(int64_t nowMs, FilterPacketLossMode filter_mode, + uint8_t lossPr255); void Reset(int64_t nowMs); @@ -365,28 +365,28 @@ public: private: // Sets the available loss protection methods. - void UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, WebRtc_Word64 now); - WebRtc_UWord8 MaxFilteredLossPr(WebRtc_Word64 nowMs) const; + void UpdateMaxLossHistory(uint8_t lossPr255, int64_t now); + uint8_t MaxFilteredLossPr(int64_t nowMs) const; VCMProtectionMethod* _selectedMethod; VCMProtectionParameters _currentParameters; - WebRtc_UWord32 _rtt; + uint32_t _rtt; float _lossPr; float _bitRate; float _frameRate; float _keyFrameSize; - WebRtc_UWord8 _fecRateKey; - WebRtc_UWord8 _fecRateDelta; - WebRtc_Word64 _lastPrUpdateT; - WebRtc_Word64 _lastPacketPerFrameUpdateT; - WebRtc_Word64 _lastPacketPerFrameUpdateTKey; + uint8_t _fecRateKey; + uint8_t _fecRateDelta; + int64_t _lastPrUpdateT; + int64_t _lastPacketPerFrameUpdateT; + int64_t _lastPacketPerFrameUpdateTKey; VCMExpFilter _lossPr255; VCMLossProbabilitySample _lossPrHistory[kLossPrHistorySize]; - WebRtc_UWord8 _shortMaxLossPr255; + uint8_t _shortMaxLossPr255; VCMExpFilter _packetsPerFrame; VCMExpFilter _packetsPerFrameKey; float _residualPacketLossFec; - WebRtc_UWord16 _codecWidth; - WebRtc_UWord16 _codecHeight; + uint16_t _codecWidth; + uint16_t _codecHeight; int _numLayers; }; diff --git a/webrtc/modules/video_coding/main/source/media_optimization.cc b/webrtc/modules/video_coding/main/source/media_optimization.cc index fbed51cfe..4262868ad 100644 --- a/webrtc/modules/video_coding/main/source/media_optimization.cc +++ b/webrtc/modules/video_coding/main/source/media_optimization.cc @@ -18,7 +18,7 @@ namespace webrtc { namespace media_optimization { -VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id, +VCMMediaOptimization::VCMMediaOptimization(int32_t id, Clock* clock): _id(id), _clock(clock), @@ -62,7 +62,7 @@ VCMMediaOptimization::~VCMMediaOptimization(void) delete _qmResolution; } -WebRtc_Word32 +int32_t VCMMediaOptimization::Reset() { memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes)); @@ -89,10 +89,10 @@ VCMMediaOptimization::Reset() return VCM_OK; } -WebRtc_UWord32 -VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 target_bitrate, - WebRtc_UWord8 &fractionLost, - WebRtc_UWord32 roundTripTimeMs) +uint32_t +VCMMediaOptimization::SetTargetRates(uint32_t target_bitrate, + uint8_t &fractionLost, + uint32_t roundTripTimeMs) { // TODO(holmer): Consider putting this threshold only on the video bitrate, // and not on protection. @@ -126,7 +126,7 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 target_bitrate, // filtered value (average or max window filter). // Use max window filter for now. FilterPacketLossMode filter_mode = kMaxFilter; - WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss( + uint8_t packetLossEnc = _lossProtLogic->FilteredLoss( _clock->TimeInMilliseconds(), filter_mode, fractionLost); // For now use the filtered loss for computing the robustness settings @@ -256,12 +256,12 @@ bool VCMMediaOptimization::DropFrame() { // leak appropriate number of bytes - _frameDropper->Leak((WebRtc_UWord32)(InputFrameRate() + 0.5f)); + _frameDropper->Leak((uint32_t)(InputFrameRate() + 0.5f)); return _frameDropper->DropFrame(); } -WebRtc_Word32 +int32_t VCMMediaOptimization::SentFrameCount(VCMFrameCount &frameCount) const { frameCount.numDeltaFrames = _deltaFrameCnt; @@ -269,13 +269,13 @@ VCMMediaOptimization::SentFrameCount(VCMFrameCount &frameCount) const return VCM_OK; } -WebRtc_Word32 +int32_t VCMMediaOptimization::SetEncodingData(VideoCodecType sendCodecType, - WebRtc_Word32 maxBitRate, - WebRtc_UWord32 frameRate, - WebRtc_UWord32 target_bitrate, - WebRtc_UWord16 width, - WebRtc_UWord16 height, + int32_t maxBitRate, + uint32_t frameRate, + uint32_t target_bitrate, + uint16_t width, + uint16_t height, int numLayers) { // Everything codec specific should be reset here since this means the codec @@ -300,13 +300,13 @@ VCMMediaOptimization::SetEncodingData(VideoCodecType sendCodecType, _codecWidth = width; _codecHeight = height; _numLayers = (numLayers <= 1) ? 1 : numLayers; // Can also be zero. - WebRtc_Word32 ret = VCM_OK; + int32_t ret = VCM_OK; ret = _qmResolution->Initialize(target_bitrate_kbps, _userFrameRate, _codecWidth, _codecHeight, _numLayers); return ret; } -WebRtc_Word32 +int32_t VCMMediaOptimization::RegisterProtectionCallback(VCMProtectionCallback* protectionCallback) { @@ -347,7 +347,7 @@ VCMMediaOptimization::IsProtectionMethodEnabled(VCMProtectionMethodEnum method) } void -VCMMediaOptimization::SetMtu(WebRtc_Word32 mtu) +VCMMediaOptimization::SetMtu(int32_t mtu) { _maxPayloadSize = mtu; } @@ -369,13 +369,13 @@ VCMMediaOptimization::SentBitRate() return _avgSentBitRateBps; } -WebRtc_Word32 +int32_t VCMMediaOptimization::MaxBitRate() { return _maxBitRate; } -WebRtc_Word32 +int32_t VCMMediaOptimization::UpdateWithEncodedData(int encodedLength, uint32_t timestamp, FrameType encodedFrameType) @@ -481,7 +481,7 @@ void VCMMediaOptimization::UpdateSentFramerate() { } } -WebRtc_Word32 +int32_t VCMMediaOptimization::RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings) { @@ -515,7 +515,7 @@ VCMMediaOptimization::UpdateContentData(const VideoContentMetrics* } } -WebRtc_Word32 +int32_t VCMMediaOptimization::SelectQuality() { // Reset quantities for QM select @@ -526,7 +526,7 @@ VCMMediaOptimization::SelectQuality() // Select quality mode VCMResolutionScale* qm = NULL; - WebRtc_Word32 ret = _qmResolution->SelectResolution(&qm); + int32_t ret = _qmResolution->SelectResolution(&qm); if (ret < 0) { return ret; @@ -562,7 +562,7 @@ VCMMediaOptimization::CheckStatusForQMchange() // (to sample the metrics) from the event lastChangeTime // lastChangeTime is the time where user changed the size/rate/frame rate // (via SetEncodingData) - WebRtc_Word64 now = _clock->TimeInMilliseconds(); + int64_t now = _clock->TimeInMilliseconds(); if ((now - _lastQMUpdateTime) < kQmMinIntervalMs || (now - _lastChangeTime) < kQmMinIntervalMs) { @@ -614,14 +614,14 @@ bool VCMMediaOptimization::QMUpdate(VCMResolutionScale* qm) { void VCMMediaOptimization::UpdateIncomingFrameRate() { - WebRtc_Word64 now = _clock->TimeInMilliseconds(); + int64_t now = _clock->TimeInMilliseconds(); if (_incomingFrameTimes[0] == 0) { // first no shift } else { // shift - for(WebRtc_Word32 i = (kFrameCountHistorySize - 2); i >= 0 ; i--) + for(int32_t i = (kFrameCountHistorySize - 2); i >= 0 ; i--) { _incomingFrameTimes[i+1] = _incomingFrameTimes[i]; } @@ -632,10 +632,10 @@ VCMMediaOptimization::UpdateIncomingFrameRate() // allowing VCM to keep track of incoming frame rate void -VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now) +VCMMediaOptimization::ProcessIncomingFrameRate(int64_t now) { - WebRtc_Word32 num = 0; - WebRtc_Word32 nrOfFrames = 0; + int32_t num = 0; + int32_t nrOfFrames = 0; for (num = 1; num < (kFrameCountHistorySize - 1); num++) { if (_incomingFrameTimes[num] <= 0 || @@ -650,7 +650,7 @@ VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now) } if (num > 1) { - const WebRtc_Word64 diff = now - _incomingFrameTimes[num-1]; + const int64_t diff = now - _incomingFrameTimes[num-1]; _incomingFrameRate = 1.0; if(diff >0) { @@ -659,11 +659,11 @@ VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now) } } -WebRtc_UWord32 +uint32_t VCMMediaOptimization::InputFrameRate() { ProcessIncomingFrameRate(_clock->TimeInMilliseconds()); - return WebRtc_UWord32 (_incomingFrameRate + 0.5f); + return uint32_t (_incomingFrameRate + 0.5f); } } // namespace media_optimization diff --git a/webrtc/modules/video_coding/main/source/media_optimization.h b/webrtc/modules/video_coding/main/source/media_optimization.h index e2b0c3d47..662f5fead 100644 --- a/webrtc/modules/video_coding/main/source/media_optimization.h +++ b/webrtc/modules/video_coding/main/source/media_optimization.h @@ -45,12 +45,12 @@ struct VCMEncodedFrameSample { class VCMMediaOptimization { public: - VCMMediaOptimization(WebRtc_Word32 id, Clock* clock); + VCMMediaOptimization(int32_t id, Clock* clock); ~VCMMediaOptimization(void); /* * Reset the Media Optimization module */ - WebRtc_Word32 Reset(); + int32_t Reset(); /** * Set target Rates for the encoder given the channel parameters * Inputs: target bitrate - the encoder target bitrate in bits/s. @@ -59,19 +59,19 @@ public: * minBitRate - the bit rate of the end-point with lowest rate * maxBitRate - the bit rate of the end-point with highest rate */ - WebRtc_UWord32 SetTargetRates(WebRtc_UWord32 target_bitrate, - WebRtc_UWord8 &fractionLost, - WebRtc_UWord32 roundTripTimeMs); + uint32_t SetTargetRates(uint32_t target_bitrate, + uint8_t &fractionLost, + uint32_t roundTripTimeMs); /** * Inform media optimization of initial encoding state */ - WebRtc_Word32 SetEncodingData(VideoCodecType sendCodecType, - WebRtc_Word32 maxBitRate, - WebRtc_UWord32 frameRate, - WebRtc_UWord32 bitRate, - WebRtc_UWord16 width, - WebRtc_UWord16 height, + int32_t SetEncodingData(VideoCodecType sendCodecType, + int32_t maxBitRate, + uint32_t frameRate, + uint32_t bitRate, + uint16_t width, + uint16_t height, int numTemporalLayers); /** * Enable protection method @@ -84,11 +84,11 @@ public: /** * Updates the max pay load size */ - void SetMtu(WebRtc_Word32 mtu); + void SetMtu(int32_t mtu); /* * Get actual input frame rate */ - WebRtc_UWord32 InputFrameRate(); + uint32_t InputFrameRate(); /* * Get actual sent frame rate @@ -101,23 +101,23 @@ public: /* * Get maximum allowed bit rate */ - WebRtc_Word32 MaxBitRate(); + int32_t MaxBitRate(); /* * Inform Media Optimization of encoding output: Length and frame type */ - WebRtc_Word32 UpdateWithEncodedData(int encodedLength, + int32_t UpdateWithEncodedData(int encodedLength, uint32_t timestamp, FrameType encodedFrameType); /* * Register a protection callback to be used to inform the user about the * protection methods used */ - WebRtc_Word32 RegisterProtectionCallback(VCMProtectionCallback* + int32_t RegisterProtectionCallback(VCMProtectionCallback* protectionCallback); /* * Register a quality settings callback to be used to inform VPM/user about */ - WebRtc_Word32 RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings); + int32_t RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings); void EnableFrameDropper(bool enable); bool DropFrame(); @@ -125,7 +125,7 @@ public: /* * Get number of key/delta frames encoded */ - WebRtc_Word32 SentFrameCount(VCMFrameCount &frameCount) const; + int32_t SentFrameCount(VCMFrameCount &frameCount) const; /* * update incoming frame rate value @@ -140,7 +140,7 @@ public: /** * Compute new Quality Mode */ - WebRtc_Word32 SelectQuality(); + int32_t SelectQuality(); private: typedef std::list FrameSampleList; @@ -168,31 +168,31 @@ private: */ bool CheckStatusForQMchange(); - void ProcessIncomingFrameRate(WebRtc_Word64 now); + void ProcessIncomingFrameRate(int64_t now); enum { kFrameCountHistorySize = 90}; enum { kFrameHistoryWinMs = 2000}; - WebRtc_Word32 _id; + int32_t _id; Clock* _clock; - WebRtc_Word32 _maxBitRate; + int32_t _maxBitRate; VideoCodecType _sendCodecType; - WebRtc_UWord16 _codecWidth; - WebRtc_UWord16 _codecHeight; + uint16_t _codecWidth; + uint16_t _codecHeight; float _userFrameRate; FrameDropper* _frameDropper; VCMLossProtectionLogic* _lossProtLogic; - WebRtc_UWord8 _fractionLost; + uint8_t _fractionLost; - WebRtc_UWord32 _sendStatistics[4]; - WebRtc_UWord32 _sendStatisticsZeroEncode; - WebRtc_Word32 _maxPayloadSize; - WebRtc_UWord32 _targetBitRate; + uint32_t _sendStatistics[4]; + uint32_t _sendStatisticsZeroEncode; + int32_t _maxPayloadSize; + uint32_t _targetBitRate; float _incomingFrameRate; - WebRtc_Word64 _incomingFrameTimes[kFrameCountHistorySize]; + int64_t _incomingFrameTimes[kFrameCountHistorySize]; bool _enableQm; @@ -203,14 +203,14 @@ private: uint32_t _avgSentBitRateBps; uint32_t _avgSentFramerate; - WebRtc_UWord32 _keyFrameCnt; - WebRtc_UWord32 _deltaFrameCnt; + uint32_t _keyFrameCnt; + uint32_t _deltaFrameCnt; VCMContentMetricsProcessing* _content; VCMQmResolution* _qmResolution; - WebRtc_Word64 _lastQMUpdateTime; - WebRtc_Word64 _lastChangeTime; // content/user triggered + int64_t _lastQMUpdateTime; + int64_t _lastChangeTime; // content/user triggered int _numLayers; diff --git a/webrtc/modules/video_coding/main/source/nack_fec_tables.h b/webrtc/modules/video_coding/main/source/nack_fec_tables.h index 88e225d1e..3769d9418 100644 --- a/webrtc/modules/video_coding/main/source/nack_fec_tables.h +++ b/webrtc/modules/video_coding/main/source/nack_fec_tables.h @@ -18,7 +18,7 @@ namespace webrtc // Table values are built as a sigmoid function, ranging from 0 to // kHighRttNackMs (100), based on the HybridNackTH values defined in // media_opt_util.h. -const WebRtc_UWord16 VCMNackFecTable[100] = { +const uint16_t VCMNackFecTable[100] = { 0, 0, 0, diff --git a/webrtc/modules/video_coding/main/source/packet.cc b/webrtc/modules/video_coding/main/source/packet.cc index e52cbdd8b..10eba70fe 100644 --- a/webrtc/modules/video_coding/main/source/packet.cc +++ b/webrtc/modules/video_coding/main/source/packet.cc @@ -31,8 +31,8 @@ VCMPacket::VCMPacket() codecSpecificHeader() { } -VCMPacket::VCMPacket(const WebRtc_UWord8* ptr, - const WebRtc_UWord32 size, +VCMPacket::VCMPacket(const uint8_t* ptr, + const uint32_t size, const WebRtcRTPHeader& rtpHeader) : payloadType(rtpHeader.header.payloadType), timestamp(rtpHeader.header.timestamp), @@ -51,7 +51,7 @@ VCMPacket::VCMPacket(const WebRtc_UWord8* ptr, CopyCodecSpecifics(rtpHeader.type.Video); } -VCMPacket::VCMPacket(const WebRtc_UWord8* ptr, WebRtc_UWord32 size, WebRtc_UWord16 seq, WebRtc_UWord32 ts, bool mBit) : +VCMPacket::VCMPacket(const uint8_t* ptr, uint32_t size, uint16_t seq, uint32_t ts, bool mBit) : payloadType(0), timestamp(ts), seqNum(seq), diff --git a/webrtc/modules/video_coding/main/source/packet.h b/webrtc/modules/video_coding/main/source/packet.h index 2035653e9..2c9b5e0d2 100644 --- a/webrtc/modules/video_coding/main/source/packet.h +++ b/webrtc/modules/video_coding/main/source/packet.h @@ -22,22 +22,22 @@ class VCMPacket { public: VCMPacket(); - VCMPacket(const WebRtc_UWord8* ptr, - const WebRtc_UWord32 size, + VCMPacket(const uint8_t* ptr, + const uint32_t size, const WebRtcRTPHeader& rtpHeader); - VCMPacket(const WebRtc_UWord8* ptr, - WebRtc_UWord32 size, - WebRtc_UWord16 seqNum, - WebRtc_UWord32 timestamp, + VCMPacket(const uint8_t* ptr, + uint32_t size, + uint16_t seqNum, + uint32_t timestamp, bool markerBit); void Reset(); - WebRtc_UWord8 payloadType; - WebRtc_UWord32 timestamp; - WebRtc_UWord16 seqNum; - const WebRtc_UWord8* dataPtr; - WebRtc_UWord32 sizeBytes; + uint8_t payloadType; + uint32_t timestamp; + uint16_t seqNum; + const uint8_t* dataPtr; + uint32_t sizeBytes; bool markerBit; FrameType frameType; diff --git a/webrtc/modules/video_coding/main/source/rtt_filter.cc b/webrtc/modules/video_coding/main/source/rtt_filter.cc index 36f766085..3e9e545f8 100644 --- a/webrtc/modules/video_coding/main/source/rtt_filter.cc +++ b/webrtc/modules/video_coding/main/source/rtt_filter.cc @@ -18,7 +18,7 @@ namespace webrtc { -VCMRttFilter::VCMRttFilter(WebRtc_Word32 vcmId, WebRtc_Word32 receiverId) +VCMRttFilter::VCMRttFilter(int32_t vcmId, int32_t receiverId) : _vcmId(vcmId), _receiverId(receiverId), @@ -63,7 +63,7 @@ VCMRttFilter::Reset() } void -VCMRttFilter::Update(WebRtc_UWord32 rttMs) +VCMRttFilter::Update(uint32_t rttMs) { if (!_gotNonZeroUpdate) { @@ -111,7 +111,7 @@ VCMRttFilter::Update(WebRtc_UWord32 rttMs) } bool -VCMRttFilter::JumpDetection(WebRtc_UWord32 rttMs) +VCMRttFilter::JumpDetection(uint32_t rttMs) { double diffFromAvg = _avgRtt - rttMs; if (abs(diffFromAvg) > _jumpStdDevs * sqrt(_varRtt)) @@ -157,7 +157,7 @@ VCMRttFilter::JumpDetection(WebRtc_UWord32 rttMs) } bool -VCMRttFilter::DriftDetection(WebRtc_UWord32 rttMs) +VCMRttFilter::DriftDetection(uint32_t rttMs) { if (_maxRtt - _avgRtt > _driftStdDevs * sqrt(_varRtt)) { @@ -186,7 +186,7 @@ VCMRttFilter::DriftDetection(WebRtc_UWord32 rttMs) } void -VCMRttFilter::ShortRttFilter(WebRtc_UWord32* buf, WebRtc_UWord32 length) +VCMRttFilter::ShortRttFilter(uint32_t* buf, uint32_t length) { if (length == 0) { @@ -194,7 +194,7 @@ VCMRttFilter::ShortRttFilter(WebRtc_UWord32* buf, WebRtc_UWord32 length) } _maxRtt = 0; _avgRtt = 0; - for (WebRtc_UWord32 i=0; i < length; i++) + for (uint32_t i=0; i < length; i++) { if (buf[i] > _maxRtt) { @@ -205,10 +205,10 @@ VCMRttFilter::ShortRttFilter(WebRtc_UWord32* buf, WebRtc_UWord32 length) _avgRtt = _avgRtt / static_cast(length); } -WebRtc_UWord32 +uint32_t VCMRttFilter::RttMs() const { - return static_cast(_maxRtt + 0.5); + return static_cast(_maxRtt + 0.5); } } diff --git a/webrtc/modules/video_coding/main/source/rtt_filter.h b/webrtc/modules/video_coding/main/source/rtt_filter.h index 5ec85fd8d..747984166 100644 --- a/webrtc/modules/video_coding/main/source/rtt_filter.h +++ b/webrtc/modules/video_coding/main/source/rtt_filter.h @@ -19,16 +19,16 @@ namespace webrtc class VCMRttFilter { public: - VCMRttFilter(WebRtc_Word32 vcmId = 0, WebRtc_Word32 receiverId = 0); + VCMRttFilter(int32_t vcmId = 0, int32_t receiverId = 0); VCMRttFilter& operator=(const VCMRttFilter& rhs); // Resets the filter. void Reset(); // Updates the filter with a new sample. - void Update(WebRtc_UWord32 rttMs); + void Update(uint32_t rttMs); // A getter function for the current RTT level in ms. - WebRtc_UWord32 RttMs() const; + uint32_t RttMs() const; private: // The size of the drift and jump memory buffers @@ -39,30 +39,30 @@ private: // samples and average to the standard deviation. // Returns true if the long time statistics should be updated // and false otherwise - bool JumpDetection(WebRtc_UWord32 rttMs); + bool JumpDetection(uint32_t rttMs); // Detects RTT drifts by comparing the difference between // max and average to the standard deviation. // Returns true if the long time statistics should be updated // and false otherwise - bool DriftDetection(WebRtc_UWord32 rttMs); + bool DriftDetection(uint32_t rttMs); // Computes the short time average and maximum of the vector buf. - void ShortRttFilter(WebRtc_UWord32* buf, WebRtc_UWord32 length); + void ShortRttFilter(uint32_t* buf, uint32_t length); - WebRtc_Word32 _vcmId; - WebRtc_Word32 _receiverId; + int32_t _vcmId; + int32_t _receiverId; bool _gotNonZeroUpdate; double _avgRtt; double _varRtt; - WebRtc_UWord32 _maxRtt; - WebRtc_UWord32 _filtFactCount; - const WebRtc_UWord32 _filtFactMax; + uint32_t _maxRtt; + uint32_t _filtFactCount; + const uint32_t _filtFactMax; const double _jumpStdDevs; const double _driftStdDevs; - WebRtc_Word32 _jumpCount; - WebRtc_Word32 _driftCount; - const WebRtc_Word32 _detectThreshold; - WebRtc_UWord32 _jumpBuf[kMaxDriftJumpCount]; - WebRtc_UWord32 _driftBuf[kMaxDriftJumpCount]; + int32_t _jumpCount; + int32_t _driftCount; + const int32_t _detectThreshold; + uint32_t _jumpBuf[kMaxDriftJumpCount]; + uint32_t _driftBuf[kMaxDriftJumpCount]; }; } // namespace webrtc diff --git a/webrtc/modules/video_coding/main/source/session_info.cc b/webrtc/modules/video_coding/main/source/session_info.cc index a727e4088..40107fbac 100644 --- a/webrtc/modules/video_coding/main/source/session_info.cc +++ b/webrtc/modules/video_coding/main/source/session_info.cc @@ -141,7 +141,7 @@ void VCMSessionInfo::ShiftSubsequentPackets(PacketIterator it, ++it; if (it == packets_.end()) return; - uint8_t* first_packet_ptr = const_cast((*it).dataPtr); + uint8_t* first_packet_ptr = const_cast((*it).dataPtr); int shift_length = 0; // Calculate the total move length and move the data pointers in advance. for (; it != packets_.end(); ++it) { @@ -236,7 +236,7 @@ int VCMSessionInfo::BuildVP8FragmentationHeader( fragmentation->VerifyAndAllocateFragmentationHeader(kMaxVP8Partitions); fragmentation->fragmentationVectorSize = 0; memset(fragmentation->fragmentationLength, 0, - kMaxVP8Partitions * sizeof(WebRtc_UWord32)); + kMaxVP8Partitions * sizeof(uint32_t)); if (packets_.empty()) return new_length; PacketIterator it = FindNextPartitionBeginning(packets_.begin(), @@ -248,11 +248,11 @@ int VCMSessionInfo::BuildVP8FragmentationHeader( fragmentation->fragmentationOffset[partition_id] = (*it).dataPtr - frame_buffer; assert(fragmentation->fragmentationOffset[partition_id] < - static_cast(frame_buffer_length)); + static_cast(frame_buffer_length)); fragmentation->fragmentationLength[partition_id] = (*partition_end).dataPtr + (*partition_end).sizeBytes - (*it).dataPtr; assert(fragmentation->fragmentationLength[partition_id] <= - static_cast(frame_buffer_length)); + static_cast(frame_buffer_length)); new_length += fragmentation->fragmentationLength[partition_id]; ++partition_end; it = FindNextPartitionBeginning(partition_end, &packets_not_decodable_); @@ -319,7 +319,7 @@ bool VCMSessionInfo::InSequence(const PacketIterator& packet_it, // If the two iterators are pointing to the same packet they are considered // to be in sequence. return (packet_it == prev_packet_it || - (static_cast((*prev_packet_it).seqNum + 1) == + (static_cast((*prev_packet_it).seqNum + 1) == (*packet_it).seqNum)); } diff --git a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc index 37ebbdd66..dee48ff2b 100644 --- a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc +++ b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc @@ -16,8 +16,8 @@ namespace webrtc { VCMTimestampExtrapolator::VCMTimestampExtrapolator(Clock* clock, - WebRtc_Word32 vcmId, - WebRtc_Word32 id) + int32_t vcmId, + int32_t id) : _rwLock(RWLockWrapper::CreateRWLock()), _vcmId(vcmId), @@ -47,7 +47,7 @@ VCMTimestampExtrapolator::~VCMTimestampExtrapolator() } void -VCMTimestampExtrapolator::Reset(const WebRtc_Word64 nowMs /* = -1 */) +VCMTimestampExtrapolator::Reset(const int64_t nowMs /* = -1 */) { WriteLockScoped wl(*_rwLock); if (nowMs > -1) @@ -74,7 +74,7 @@ VCMTimestampExtrapolator::Reset(const WebRtc_Word64 nowMs /* = -1 */) } void -VCMTimestampExtrapolator::Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool trace) +VCMTimestampExtrapolator::Update(int64_t tMs, uint32_t ts90khz, bool trace) { _rwLock->AcquireLockExclusive(); @@ -94,9 +94,9 @@ VCMTimestampExtrapolator::Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool // Remove offset to prevent badly scaled matrices tMs -= _startMs; - WebRtc_Word32 prevWrapArounds = _wrapArounds; + int32_t prevWrapArounds = _wrapArounds; CheckForWrapArounds(ts90khz); - WebRtc_Word32 wrapAroundsSincePrev = _wrapArounds - prevWrapArounds; + int32_t wrapAroundsSincePrev = _wrapArounds - prevWrapArounds; if (wrapAroundsSincePrev == 0 && ts90khz < _prevTs90khz) { @@ -115,7 +115,7 @@ VCMTimestampExtrapolator::Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool } // Compensate for wraparounds by changing the line offset - _w[1] = _w[1] - wrapAroundsSincePrev * ((static_cast(1)<<32) - 1); + _w[1] = _w[1] - wrapAroundsSincePrev * ((static_cast(1)<<32) - 1); double residual = (static_cast(ts90khz) - _firstTimestamp) - static_cast(tMs) * _w[0] - _w[1]; if (DelayChangeDetection(residual, trace) && @@ -156,38 +156,38 @@ VCMTimestampExtrapolator::Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool _rwLock->ReleaseLockExclusive(); } -WebRtc_UWord32 -VCMTimestampExtrapolator::ExtrapolateTimestamp(WebRtc_Word64 tMs) const +uint32_t +VCMTimestampExtrapolator::ExtrapolateTimestamp(int64_t tMs) const { ReadLockScoped rl(*_rwLock); - WebRtc_UWord32 timestamp = 0; + uint32_t timestamp = 0; if (_packetCount == 0) { timestamp = 0; } else if (_packetCount < _startUpFilterDelayInPackets) { - timestamp = static_cast(90.0 * (tMs - _prevMs) + _prevTs90khz + 0.5); + timestamp = static_cast(90.0 * (tMs - _prevMs) + _prevTs90khz + 0.5); } else { - timestamp = static_cast(_w[0] * (tMs - _startMs) + _w[1] + _firstTimestamp + 0.5); + timestamp = static_cast(_w[0] * (tMs - _startMs) + _w[1] + _firstTimestamp + 0.5); } return timestamp; } -WebRtc_Word64 -VCMTimestampExtrapolator::ExtrapolateLocalTime(WebRtc_UWord32 timestamp90khz) const +int64_t +VCMTimestampExtrapolator::ExtrapolateLocalTime(uint32_t timestamp90khz) const { ReadLockScoped rl(*_rwLock); - WebRtc_Word64 localTimeMs = 0; + int64_t localTimeMs = 0; if (_packetCount == 0) { localTimeMs = -1; } else if (_packetCount < _startUpFilterDelayInPackets) { - localTimeMs = _prevMs + static_cast(static_cast(timestamp90khz - _prevTs90khz) / 90.0 + 0.5); + localTimeMs = _prevMs + static_cast(static_cast(timestamp90khz - _prevTs90khz) / 90.0 + 0.5); } else { @@ -198,7 +198,7 @@ VCMTimestampExtrapolator::ExtrapolateLocalTime(WebRtc_UWord32 timestamp90khz) co else { double timestampDiff = static_cast(timestamp90khz) - static_cast(_firstTimestamp); - localTimeMs = static_cast(static_cast(_startMs) + (timestampDiff - _w[1]) / _w[0] + 0.5); + localTimeMs = static_cast(static_cast(_startMs) + (timestampDiff - _w[1]) / _w[0] + 0.5); } } return localTimeMs; @@ -207,7 +207,7 @@ VCMTimestampExtrapolator::ExtrapolateLocalTime(WebRtc_UWord32 timestamp90khz) co // Investigates if the timestamp clock has overflowed since the last timestamp and // keeps track of the number of wrap arounds since reset. void -VCMTimestampExtrapolator::CheckForWrapArounds(WebRtc_UWord32 ts90khz) +VCMTimestampExtrapolator::CheckForWrapArounds(uint32_t ts90khz) { if (_prevTs90khz == 0) { @@ -219,7 +219,7 @@ VCMTimestampExtrapolator::CheckForWrapArounds(WebRtc_UWord32 ts90khz) // This difference will probably be less than -2^31 if we have had a wrap around // (e.g. timestamp = 1, _previousTimestamp = 2^32 - 1). Since it is casted to a Word32, // it should be positive. - if (static_cast(ts90khz - _prevTs90khz) > 0) + if (static_cast(ts90khz - _prevTs90khz) > 0) { // Forward wrap around _wrapArounds++; @@ -227,7 +227,7 @@ VCMTimestampExtrapolator::CheckForWrapArounds(WebRtc_UWord32 ts90khz) } // This difference will probably be less than -2^31 if we have had a backward wrap around. // Since it is casted to a Word32, it should be positive. - else if (static_cast(_prevTs90khz - ts90khz) > 0) + else if (static_cast(_prevTs90khz - ts90khz) > 0) { // Backward wrap around _wrapArounds--; diff --git a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h index 1661f5418..233fa1be3 100644 --- a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h +++ b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h @@ -23,32 +23,32 @@ class VCMTimestampExtrapolator { public: VCMTimestampExtrapolator(Clock* clock, - WebRtc_Word32 vcmId = 0, - WebRtc_Word32 receiverId = 0); + int32_t vcmId = 0, + int32_t receiverId = 0); ~VCMTimestampExtrapolator(); - void Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool trace = true); - WebRtc_UWord32 ExtrapolateTimestamp(WebRtc_Word64 tMs) const; - WebRtc_Word64 ExtrapolateLocalTime(WebRtc_UWord32 timestamp90khz) const; - void Reset(WebRtc_Word64 nowMs = -1); + void Update(int64_t tMs, uint32_t ts90khz, bool trace = true); + uint32_t ExtrapolateTimestamp(int64_t tMs) const; + int64_t ExtrapolateLocalTime(uint32_t timestamp90khz) const; + void Reset(int64_t nowMs = -1); private: - void CheckForWrapArounds(WebRtc_UWord32 ts90khz); + void CheckForWrapArounds(uint32_t ts90khz); bool DelayChangeDetection(double error, bool trace = true); RWLockWrapper* _rwLock; - WebRtc_Word32 _vcmId; - WebRtc_Word32 _id; + int32_t _vcmId; + int32_t _id; Clock* _clock; double _w[2]; double _P[2][2]; - WebRtc_Word64 _startMs; - WebRtc_Word64 _prevMs; - WebRtc_UWord32 _firstTimestamp; - WebRtc_Word32 _wrapArounds; - WebRtc_UWord32 _prevTs90khz; + int64_t _startMs; + int64_t _prevMs; + uint32_t _firstTimestamp; + int32_t _wrapArounds; + uint32_t _prevTs90khz; const double _lambda; bool _firstAfterReset; - WebRtc_UWord32 _packetCount; - const WebRtc_UWord32 _startUpFilterDelayInPackets; + uint32_t _packetCount; + const uint32_t _startUpFilterDelayInPackets; double _detectorAccumulatorPos; double _detectorAccumulatorNeg; diff --git a/webrtc/modules/video_coding/main/source/timestamp_map.cc b/webrtc/modules/video_coding/main/source/timestamp_map.cc index f19819be0..d7c554ed0 100644 --- a/webrtc/modules/video_coding/main/source/timestamp_map.cc +++ b/webrtc/modules/video_coding/main/source/timestamp_map.cc @@ -16,7 +16,7 @@ namespace webrtc { // Constructor. Optional parameter specifies maximum number of // coexisting timers. -VCMTimestampMap::VCMTimestampMap(WebRtc_Word32 length): +VCMTimestampMap::VCMTimestampMap(int32_t length): _nextAddIx(0), _nextPopIx(0) { @@ -44,8 +44,8 @@ VCMTimestampMap::Reset() _nextPopIx = 0; } -WebRtc_Word32 -VCMTimestampMap::Add(WebRtc_UWord32 timestamp, void* data) +int32_t +VCMTimestampMap::Add(uint32_t timestamp, void* data) { _map[_nextAddIx].timestamp = timestamp; _map[_nextAddIx].data = data; @@ -61,7 +61,7 @@ VCMTimestampMap::Add(WebRtc_UWord32 timestamp, void* data) } void* -VCMTimestampMap::Pop(WebRtc_UWord32 timestamp) +VCMTimestampMap::Pop(uint32_t timestamp) { while (!IsEmpty()) { diff --git a/webrtc/modules/video_coding/main/source/timestamp_map.h b/webrtc/modules/video_coding/main/source/timestamp_map.h index fd532bcf4..083df776c 100644 --- a/webrtc/modules/video_coding/main/source/timestamp_map.h +++ b/webrtc/modules/video_coding/main/source/timestamp_map.h @@ -18,7 +18,7 @@ namespace webrtc struct VCMTimestampDataTuple { - WebRtc_UWord32 timestamp; + uint32_t timestamp; void* data; }; @@ -27,7 +27,7 @@ class VCMTimestampMap public: // Constructor. Optional parameter specifies maximum number of // timestamps in map. - VCMTimestampMap(const WebRtc_Word32 length = 10); + VCMTimestampMap(const int32_t length = 10); // Destructor. ~VCMTimestampMap(); @@ -35,16 +35,16 @@ public: // Empty the map void Reset(); - WebRtc_Word32 Add(WebRtc_UWord32 timestamp, void* data); - void* Pop(WebRtc_UWord32 timestamp); + int32_t Add(uint32_t timestamp, void* data); + void* Pop(uint32_t timestamp); private: bool IsEmpty() const; VCMTimestampDataTuple* _map; - WebRtc_Word32 _nextAddIx; - WebRtc_Word32 _nextPopIx; - WebRtc_Word32 _length; + int32_t _nextAddIx; + int32_t _nextPopIx; + int32_t _length; }; } // namespace webrtc diff --git a/webrtc/modules/video_coding/main/source/timing.cc b/webrtc/modules/video_coding/main/source/timing.cc index 26bda7e1f..2a381bde1 100644 --- a/webrtc/modules/video_coding/main/source/timing.cc +++ b/webrtc/modules/video_coding/main/source/timing.cc @@ -19,8 +19,8 @@ namespace webrtc { VCMTiming::VCMTiming(Clock* clock, - WebRtc_Word32 vcmId, - WebRtc_Word32 timingId, + int32_t vcmId, + int32_t timingId, VCMTiming* masterTiming) : _critSect(CriticalSectionWrapper::CreateCriticalSection()), @@ -58,7 +58,7 @@ VCMTiming::~VCMTiming() } void -VCMTiming::Reset(WebRtc_Word64 nowMs /* = -1 */) +VCMTiming::Reset(int64_t nowMs /* = -1 */) { CriticalSectionScoped cs(_critSect); if (nowMs > -1) @@ -83,21 +83,21 @@ void VCMTiming::ResetDecodeTime() } void -VCMTiming::SetRenderDelay(WebRtc_UWord32 renderDelayMs) +VCMTiming::SetRenderDelay(uint32_t renderDelayMs) { CriticalSectionScoped cs(_critSect); _renderDelayMs = renderDelayMs; } void -VCMTiming::SetMinimumTotalDelay(WebRtc_UWord32 minTotalDelayMs) +VCMTiming::SetMinimumTotalDelay(uint32_t minTotalDelayMs) { CriticalSectionScoped cs(_critSect); _minTotalDelayMs = minTotalDelayMs; } void -VCMTiming::SetRequiredDelay(WebRtc_UWord32 requiredDelayMs) +VCMTiming::SetRequiredDelay(uint32_t requiredDelayMs) { CriticalSectionScoped cs(_critSect); if (requiredDelayMs != _requiredDelayMs) @@ -111,10 +111,10 @@ VCMTiming::SetRequiredDelay(WebRtc_UWord32 requiredDelayMs) } } -void VCMTiming::UpdateCurrentDelay(WebRtc_UWord32 frameTimestamp) +void VCMTiming::UpdateCurrentDelay(uint32_t frameTimestamp) { CriticalSectionScoped cs(_critSect); - WebRtc_UWord32 targetDelayMs = TargetDelayInternal(); + uint32_t targetDelayMs = TargetDelayInternal(); // Make sure we try to sync with audio if (targetDelayMs < _minTotalDelayMs) @@ -129,19 +129,19 @@ void VCMTiming::UpdateCurrentDelay(WebRtc_UWord32 frameTimestamp) } else if (targetDelayMs != _currentDelayMs) { - WebRtc_Word64 delayDiffMs = static_cast(targetDelayMs) - + int64_t delayDiffMs = static_cast(targetDelayMs) - _currentDelayMs; // Never change the delay with more than 100 ms every second. If we're changing the // delay in too large steps we will get noticeable freezes. By limiting the change we // can increase the delay in smaller steps, which will be experienced as the video is // played in slow motion. When lowering the delay the video will be played at a faster // pace. - WebRtc_Word64 maxChangeMs = 0; + int64_t maxChangeMs = 0; if (frameTimestamp < 0x0000ffff && _prevFrameTimestamp > 0xffff0000) { // wrap maxChangeMs = kDelayMaxChangeMsPerS * (frameTimestamp + - (static_cast(1)<<32) - _prevFrameTimestamp) / 90000; + (static_cast(1)<<32) - _prevFrameTimestamp) / 90000; } else { @@ -163,22 +163,22 @@ void VCMTiming::UpdateCurrentDelay(WebRtc_UWord32 frameTimestamp) { delayDiffMs = maxChangeMs; } - _currentDelayMs = _currentDelayMs + static_cast(delayDiffMs); + _currentDelayMs = _currentDelayMs + static_cast(delayDiffMs); } _prevFrameTimestamp = frameTimestamp; } -void VCMTiming::UpdateCurrentDelay(WebRtc_Word64 renderTimeMs, - WebRtc_Word64 actualDecodeTimeMs) +void VCMTiming::UpdateCurrentDelay(int64_t renderTimeMs, + int64_t actualDecodeTimeMs) { CriticalSectionScoped cs(_critSect); - WebRtc_UWord32 targetDelayMs = TargetDelayInternal(); + uint32_t targetDelayMs = TargetDelayInternal(); // Make sure we try to sync with audio if (targetDelayMs < _minTotalDelayMs) { targetDelayMs = _minTotalDelayMs; } - WebRtc_Word64 delayedMs = actualDecodeTimeMs - + int64_t delayedMs = actualDecodeTimeMs - (renderTimeMs - MaxDecodeTimeMs() - _renderDelayMs); if (delayedMs < 0) { @@ -186,7 +186,7 @@ void VCMTiming::UpdateCurrentDelay(WebRtc_Word64 renderTimeMs, } else if (_currentDelayMs + delayedMs <= targetDelayMs) { - _currentDelayMs += static_cast(delayedMs); + _currentDelayMs += static_cast(delayedMs); } else { @@ -194,14 +194,14 @@ void VCMTiming::UpdateCurrentDelay(WebRtc_Word64 renderTimeMs, } } -WebRtc_Word32 -VCMTiming::StopDecodeTimer(WebRtc_UWord32 timeStamp, - WebRtc_Word64 startTimeMs, - WebRtc_Word64 nowMs) +int32_t +VCMTiming::StopDecodeTimer(uint32_t timeStamp, + int64_t startTimeMs, + int64_t nowMs) { CriticalSectionScoped cs(_critSect); - const WebRtc_Word32 maxDecTime = MaxDecodeTimeMs(); - WebRtc_Word32 timeDiffMs = _codecTimer.StopTimer(startTimeMs, nowMs); + const int32_t maxDecTime = MaxDecodeTimeMs(); + int32_t timeDiffMs = _codecTimer.StopTimer(startTimeMs, nowMs); if (timeDiffMs < 0) { WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding, VCMId(_vcmId, _timingId), @@ -219,17 +219,17 @@ VCMTiming::StopDecodeTimer(WebRtc_UWord32 timeStamp, } void -VCMTiming::IncomingTimestamp(WebRtc_UWord32 timeStamp, WebRtc_Word64 nowMs) +VCMTiming::IncomingTimestamp(uint32_t timeStamp, int64_t nowMs) { CriticalSectionScoped cs(_critSect); _tsExtrapolator->Update(nowMs, timeStamp, _master); } -WebRtc_Word64 -VCMTiming::RenderTimeMs(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 nowMs) const +int64_t +VCMTiming::RenderTimeMs(uint32_t frameTimestamp, int64_t nowMs) const { CriticalSectionScoped cs(_critSect); - const WebRtc_Word64 renderTimeMs = RenderTimeMsInternal(frameTimestamp, nowMs); + const int64_t renderTimeMs = RenderTimeMsInternal(frameTimestamp, nowMs); if (renderTimeMs < 0) { return renderTimeMs; @@ -245,10 +245,10 @@ VCMTiming::RenderTimeMs(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 nowMs) cons return renderTimeMs; } -WebRtc_Word64 -VCMTiming::RenderTimeMsInternal(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 nowMs) const +int64_t +VCMTiming::RenderTimeMsInternal(uint32_t frameTimestamp, int64_t nowMs) const { - WebRtc_Word64 estimatedCompleteTimeMs = + int64_t estimatedCompleteTimeMs = _tsExtrapolator->ExtrapolateLocalTime(frameTimestamp); if (estimatedCompleteTimeMs - nowMs > _maxVideoDelayMs) { @@ -275,10 +275,10 @@ VCMTiming::RenderTimeMsInternal(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 now } // Must be called from inside a critical section -WebRtc_Word32 +int32_t VCMTiming::MaxDecodeTimeMs(FrameType frameType /*= kVideoFrameDelta*/) const { - const WebRtc_Word32 decodeTimeMs = _codecTimer.RequiredDecodeTimeMs(frameType); + const int32_t decodeTimeMs = _codecTimer.RequiredDecodeTimeMs(frameType); if (decodeTimeMs < 0) { @@ -289,26 +289,26 @@ VCMTiming::MaxDecodeTimeMs(FrameType frameType /*= kVideoFrameDelta*/) const return decodeTimeMs; } -WebRtc_UWord32 -VCMTiming::MaxWaitingTime(WebRtc_Word64 renderTimeMs, WebRtc_Word64 nowMs) const +uint32_t +VCMTiming::MaxWaitingTime(int64_t renderTimeMs, int64_t nowMs) const { CriticalSectionScoped cs(_critSect); - const WebRtc_Word64 maxWaitTimeMs = renderTimeMs - nowMs - + const int64_t maxWaitTimeMs = renderTimeMs - nowMs - MaxDecodeTimeMs() - _renderDelayMs; if (maxWaitTimeMs < 0) { return 0; } - return static_cast(maxWaitTimeMs); + return static_cast(maxWaitTimeMs); } bool -VCMTiming::EnoughTimeToDecode(WebRtc_UWord32 availableProcessingTimeMs) const +VCMTiming::EnoughTimeToDecode(uint32_t availableProcessingTimeMs) const { CriticalSectionScoped cs(_critSect); - WebRtc_Word32 maxDecodeTimeMs = MaxDecodeTimeMs(); + int32_t maxDecodeTimeMs = MaxDecodeTimeMs(); if (maxDecodeTimeMs < 0) { // Haven't decoded any frames yet, try decoding one to get an estimate @@ -321,7 +321,7 @@ VCMTiming::EnoughTimeToDecode(WebRtc_UWord32 availableProcessingTimeMs) const // we don't have any better precision. Count ticks later? maxDecodeTimeMs = 1; } - return static_cast(availableProcessingTimeMs) - maxDecodeTimeMs > 0; + return static_cast(availableProcessingTimeMs) - maxDecodeTimeMs > 0; } void VCMTiming::SetMaxVideoDelay(int maxVideoDelayMs) @@ -330,14 +330,14 @@ void VCMTiming::SetMaxVideoDelay(int maxVideoDelayMs) _maxVideoDelayMs = maxVideoDelayMs; } -WebRtc_UWord32 +uint32_t VCMTiming::TargetVideoDelay() const { CriticalSectionScoped cs(_critSect); return TargetDelayInternal(); } -WebRtc_UWord32 +uint32_t VCMTiming::TargetDelayInternal() const { return _requiredDelayMs + MaxDecodeTimeMs() + _renderDelayMs; diff --git a/webrtc/modules/video_coding/main/source/timing.h b/webrtc/modules/video_coding/main/source/timing.h index d1d9cacd2..74bec724a 100644 --- a/webrtc/modules/video_coding/main/source/timing.h +++ b/webrtc/modules/video_coding/main/source/timing.h @@ -27,60 +27,60 @@ public: // The primary timing component should be passed // if this is the dual timing component. VCMTiming(Clock* clock, - WebRtc_Word32 vcmId = 0, - WebRtc_Word32 timingId = 0, + int32_t vcmId = 0, + int32_t timingId = 0, VCMTiming* masterTiming = NULL); ~VCMTiming(); // Resets the timing to the initial state. - void Reset(WebRtc_Word64 nowMs = -1); + void Reset(int64_t nowMs = -1); void ResetDecodeTime(); // The amount of time needed to render an image. Defaults to 10 ms. - void SetRenderDelay(WebRtc_UWord32 renderDelayMs); + void SetRenderDelay(uint32_t renderDelayMs); // The minimum time the video must be delayed on the receiver to // get the desired jitter buffer level. - void SetRequiredDelay(WebRtc_UWord32 requiredDelayMs); + void SetRequiredDelay(uint32_t requiredDelayMs); // Minimum total delay required to sync video with audio. - void SetMinimumTotalDelay(WebRtc_UWord32 minTotalDelayMs); + void SetMinimumTotalDelay(uint32_t minTotalDelayMs); // Increases or decreases the current delay to get closer to the target delay. // Calculates how long it has been since the previous call to this function, // and increases/decreases the delay in proportion to the time difference. - void UpdateCurrentDelay(WebRtc_UWord32 frameTimestamp); + void UpdateCurrentDelay(uint32_t frameTimestamp); // Increases or decreases the current delay to get closer to the target delay. // Given the actual decode time in ms and the render time in ms for a frame, this // function calculates how late the frame is and increases the delay accordingly. - void UpdateCurrentDelay(WebRtc_Word64 renderTimeMs, WebRtc_Word64 actualDecodeTimeMs); + void UpdateCurrentDelay(int64_t renderTimeMs, int64_t actualDecodeTimeMs); // Stops the decoder timer, should be called when the decoder returns a frame // or when the decoded frame callback is called. - WebRtc_Word32 StopDecodeTimer(WebRtc_UWord32 timeStamp, - WebRtc_Word64 startTimeMs, - WebRtc_Word64 nowMs); + int32_t StopDecodeTimer(uint32_t timeStamp, + int64_t startTimeMs, + int64_t nowMs); // Used to report that a frame is passed to decoding. Updates the timestamp filter // which is used to map between timestamps and receiver system time. - void IncomingTimestamp(WebRtc_UWord32 timeStamp, WebRtc_Word64 lastPacketTimeMs); + void IncomingTimestamp(uint32_t timeStamp, int64_t lastPacketTimeMs); // Returns the receiver system time when the frame with timestamp frameTimestamp // should be rendered, assuming that the system time currently is nowMs. - WebRtc_Word64 RenderTimeMs(WebRtc_UWord32 frameTimestamp, WebRtc_Word64 nowMs) const; + int64_t RenderTimeMs(uint32_t frameTimestamp, int64_t nowMs) const; // Returns the maximum time in ms that we can wait for a frame to become complete // before we must pass it to the decoder. - WebRtc_UWord32 MaxWaitingTime(WebRtc_Word64 renderTimeMs, WebRtc_Word64 nowMs) const; + uint32_t MaxWaitingTime(int64_t renderTimeMs, int64_t nowMs) const; // Returns the current target delay which is required delay + decode time + render // delay. - WebRtc_UWord32 TargetVideoDelay() const; + uint32_t TargetVideoDelay() const; // Calculates whether or not there is enough time to decode a frame given a // certain amount of processing time. - bool EnoughTimeToDecode(WebRtc_UWord32 availableProcessingTimeMs) const; + bool EnoughTimeToDecode(uint32_t availableProcessingTimeMs) const; // Set the max allowed video delay. void SetMaxVideoDelay(int maxVideoDelayMs); @@ -89,24 +89,24 @@ public: enum { kDelayMaxChangeMsPerS = 100 }; protected: - WebRtc_Word32 MaxDecodeTimeMs(FrameType frameType = kVideoFrameDelta) const; - WebRtc_Word64 RenderTimeMsInternal(WebRtc_UWord32 frameTimestamp, - WebRtc_Word64 nowMs) const; - WebRtc_UWord32 TargetDelayInternal() const; + int32_t MaxDecodeTimeMs(FrameType frameType = kVideoFrameDelta) const; + int64_t RenderTimeMsInternal(uint32_t frameTimestamp, + int64_t nowMs) const; + uint32_t TargetDelayInternal() const; private: CriticalSectionWrapper* _critSect; - WebRtc_Word32 _vcmId; + int32_t _vcmId; Clock* _clock; - WebRtc_Word32 _timingId; + int32_t _timingId; bool _master; VCMTimestampExtrapolator* _tsExtrapolator; VCMCodecTimer _codecTimer; - WebRtc_UWord32 _renderDelayMs; - WebRtc_UWord32 _minTotalDelayMs; - WebRtc_UWord32 _requiredDelayMs; - WebRtc_UWord32 _currentDelayMs; - WebRtc_UWord32 _prevFrameTimestamp; + uint32_t _renderDelayMs; + uint32_t _minTotalDelayMs; + uint32_t _requiredDelayMs; + uint32_t _currentDelayMs; + uint32_t _prevFrameTimestamp; int _maxVideoDelayMs; }; diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.cc b/webrtc/modules/video_coding/main/source/video_coding_impl.cc index b86780494..a418db8a1 100644 --- a/webrtc/modules/video_coding/main/source/video_coding_impl.cc +++ b/webrtc/modules/video_coding/main/source/video_coding_impl.cc @@ -23,17 +23,17 @@ namespace webrtc //#define DEBUG_DECODER_BIT_STREAM -WebRtc_UWord32 +uint32_t VCMProcessTimer::Period() const { return _periodMs; } -WebRtc_UWord32 +uint32_t VCMProcessTimer::TimeUntilProcess() const { - return static_cast( - VCM_MAX(static_cast(_periodMs) - + return static_cast( + VCM_MAX(static_cast(_periodMs) - (_clock->TimeInMilliseconds() - _latestMs), 0)); } @@ -43,7 +43,7 @@ VCMProcessTimer::Processed() _latestMs = _clock->TimeInMilliseconds(); } -VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id, +VideoCodingModuleImpl::VideoCodingModuleImpl(const int32_t id, Clock* clock, EventFactory* event_factory, bool owns_event_factory) @@ -113,14 +113,14 @@ VideoCodingModuleImpl::~VideoCodingModuleImpl() } VideoCodingModule* -VideoCodingModule::Create(const WebRtc_Word32 id) +VideoCodingModule::Create(const int32_t id) { return new VideoCodingModuleImpl(id, Clock::GetRealTimeClock(), new EventFactoryImpl, true); } VideoCodingModule* -VideoCodingModule::Create(const WebRtc_Word32 id, Clock* clock, +VideoCodingModule::Create(const int32_t id, Clock* clock, EventFactory* event_factory) { assert(clock); @@ -137,10 +137,10 @@ VideoCodingModule::Destroy(VideoCodingModule* module) } } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::Process() { - WebRtc_Word32 returnValue = VCM_OK; + int32_t returnValue = VCM_OK; // Receive-side statistics if (_receiveStatsTimer.TimeUntilProcess() == 0) @@ -148,8 +148,8 @@ VideoCodingModuleImpl::Process() _receiveStatsTimer.Processed(); if (_receiveStatsCallback != NULL) { - WebRtc_UWord32 bitRate; - WebRtc_UWord32 frameRate; + uint32_t bitRate; + uint32_t frameRate; _receiver.ReceiveStatistics(&bitRate, &frameRate); _receiveStatsCallback->ReceiveStatistics(bitRate, frameRate); } @@ -161,8 +161,8 @@ VideoCodingModuleImpl::Process() _sendStatsTimer.Processed(); if (_sendStatsCallback != NULL) { - WebRtc_UWord32 bitRate; - WebRtc_UWord32 frameRate; + uint32_t bitRate; + uint32_t frameRate; { CriticalSectionScoped cs(_sendCritSect); bitRate = _mediaOpt.SentBitRate(); @@ -180,13 +180,13 @@ VideoCodingModuleImpl::Process() _retransmissionTimer.Processed(); if (_packetRequestCallback != NULL) { - WebRtc_UWord16 length; + uint16_t length; { CriticalSectionScoped cs(_receiveCritSect); length = max_nack_list_size_; } std::vector nackList(length); - const WebRtc_Word32 ret = NackList(&nackList[0], length); + const int32_t ret = NackList(&nackList[0], length); if (ret != VCM_OK && returnValue == VCM_OK) { returnValue = ret; @@ -204,7 +204,7 @@ VideoCodingModuleImpl::Process() _keyRequestTimer.Processed(); if (_scheduleKeyRequest && _frameTypeCallback != NULL) { - const WebRtc_Word32 ret = RequestKeyFrame(); + const int32_t ret = RequestKeyFrame(); if (ret != VCM_OK && returnValue == VCM_OK) { returnValue = ret; @@ -215,7 +215,7 @@ VideoCodingModuleImpl::Process() return returnValue; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::Id() const { CriticalSectionScoped receiveCs(_receiveCritSect); @@ -226,8 +226,8 @@ VideoCodingModuleImpl::Id() const } // Change the unique identifier of this object -WebRtc_Word32 -VideoCodingModuleImpl::ChangeUniqueId(const WebRtc_Word32 id) +int32_t +VideoCodingModuleImpl::ChangeUniqueId(const int32_t id) { CriticalSectionScoped receiveCs(_receiveCritSect); { @@ -239,10 +239,10 @@ VideoCodingModuleImpl::ChangeUniqueId(const WebRtc_Word32 id) // Returns the number of milliseconds until the module wants a worker thread to // call Process -WebRtc_Word32 +int32_t VideoCodingModuleImpl::TimeUntilNextProcess() { - WebRtc_UWord32 timeUntilNextProcess = VCM_MIN( + uint32_t timeUntilNextProcess = VCM_MIN( _receiveStatsTimer.TimeUntilProcess(), _sendStatsTimer.TimeUntilProcess()); if ((_receiver.NackMode() != kNoNack) || @@ -260,15 +260,15 @@ VideoCodingModuleImpl::TimeUntilNextProcess() } // Get number of supported codecs -WebRtc_UWord8 +uint8_t VideoCodingModule::NumberOfCodecs() { return VCMCodecDataBase::NumberOfCodecs(); } // Get supported codec with id -WebRtc_Word32 -VideoCodingModule::Codec(WebRtc_UWord8 listId, VideoCodec* codec) +int32_t +VideoCodingModule::Codec(uint8_t listId, VideoCodec* codec) { if (codec == NULL) { @@ -278,7 +278,7 @@ VideoCodingModule::Codec(WebRtc_UWord8 listId, VideoCodec* codec) } // Get supported codec with type -WebRtc_Word32 +int32_t VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec) { if (codec == NULL) @@ -293,7 +293,7 @@ VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec) */ // Reset send side to initial state - all components -WebRtc_Word32 +int32_t VideoCodingModuleImpl::InitializeSender() { CriticalSectionScoped cs(_sendCritSect); @@ -307,10 +307,10 @@ VideoCodingModuleImpl::InitializeSender() } // Register the send codec to be used. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterSendCodec(const VideoCodec* sendCodec, - WebRtc_UWord32 numberOfCores, - WebRtc_UWord32 maxPayloadSize) + uint32_t numberOfCores, + uint32_t maxPayloadSize) { CriticalSectionScoped cs(_sendCritSect); if (sendCodec == NULL) @@ -361,7 +361,7 @@ VideoCodingModuleImpl::RegisterSendCodec(const VideoCodec* sendCodec, } // Get current send codec -WebRtc_Word32 +int32_t VideoCodingModuleImpl::SendCodec(VideoCodec* currentSendCodec) const { CriticalSectionScoped cs(_sendCritSect); @@ -384,9 +384,9 @@ VideoCodingModuleImpl::SendCodec() const // Register an external decoder object. // This can not be used together with external decoder callbacks. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterExternalEncoder(VideoEncoder* externalEncoder, - WebRtc_UWord8 payloadType, + uint8_t payloadType, bool internalSource /*= false*/) { CriticalSectionScoped cs(_sendCritSect); @@ -409,9 +409,9 @@ VideoCodingModuleImpl::RegisterExternalEncoder(VideoEncoder* externalEncoder, } // Get codec config parameters -WebRtc_Word32 -VideoCodingModuleImpl::CodecConfigParameters(WebRtc_UWord8* buffer, - WebRtc_Word32 size) +int32_t +VideoCodingModuleImpl::CodecConfigParameters(uint8_t* buffer, + int32_t size) { CriticalSectionScoped cs(_sendCritSect); if (_encoder != NULL) @@ -446,15 +446,15 @@ int VideoCodingModuleImpl::FrameRate(unsigned int* framerate) const } // Set channel parameters -WebRtc_Word32 -VideoCodingModuleImpl::SetChannelParameters(WebRtc_UWord32 target_bitrate, - WebRtc_UWord8 lossRate, - WebRtc_UWord32 rtt) +int32_t +VideoCodingModuleImpl::SetChannelParameters(uint32_t target_bitrate, + uint8_t lossRate, + uint32_t rtt) { - WebRtc_Word32 ret = 0; + int32_t ret = 0; { CriticalSectionScoped sendCs(_sendCritSect); - WebRtc_UWord32 targetRate = _mediaOpt.SetTargetRates(target_bitrate, + uint32_t targetRate = _mediaOpt.SetTargetRates(target_bitrate, lossRate, rtt); if (_encoder != NULL) @@ -464,7 +464,7 @@ VideoCodingModuleImpl::SetChannelParameters(WebRtc_UWord32 target_bitrate, { return ret; } - ret = (WebRtc_Word32)_encoder->SetRates(targetRate, + ret = (int32_t)_encoder->SetRates(targetRate, _mediaOpt.InputFrameRate()); if (ret < 0) { @@ -479,8 +479,8 @@ VideoCodingModuleImpl::SetChannelParameters(WebRtc_UWord32 target_bitrate, return VCM_OK; } -WebRtc_Word32 -VideoCodingModuleImpl::SetReceiveChannelParameters(WebRtc_UWord32 rtt) +int32_t +VideoCodingModuleImpl::SetReceiveChannelParameters(uint32_t rtt) { CriticalSectionScoped receiveCs(_receiveCritSect); _receiver.UpdateRtt(rtt); @@ -489,7 +489,7 @@ VideoCodingModuleImpl::SetReceiveChannelParameters(WebRtc_UWord32 rtt) // Register a transport callback which will be called to deliver the encoded // buffers -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterTransportCallback( VCMPacketizationCallback* transport) { @@ -502,7 +502,7 @@ VideoCodingModuleImpl::RegisterTransportCallback( // Register video output information callback which will be called to deliver // information about the video stream produced by the encoder, for instance the // average frame rate and bit rate. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterSendStatisticsCallback( VCMSendStatisticsCallback* sendStats) { @@ -513,7 +513,7 @@ VideoCodingModuleImpl::RegisterSendStatisticsCallback( // Register a video quality settings callback which will be called when frame // rate/dimensions need to be updated for video quality optimization -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterVideoQMCallback( VCMQMSettingsCallback* videoQMSettings) { @@ -524,7 +524,7 @@ VideoCodingModuleImpl::RegisterVideoQMCallback( // Register a video protection callback which will be called to deliver the // requested FEC rate and NACK status (on/off). -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterProtectionCallback( VCMProtectionCallback* protection) { @@ -534,7 +534,7 @@ VideoCodingModuleImpl::RegisterProtectionCallback( } // Enable or disable a video protection method. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection, bool enable) { @@ -672,7 +672,7 @@ VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection, } // Add one raw video frame to the encoder, blocking. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::AddVideoFrame(const I420VideoFrame& videoFrame, const VideoContentMetrics* contentMetrics, const CodecSpecificInfo* codecSpecificInfo) @@ -700,7 +700,7 @@ VideoCodingModuleImpl::AddVideoFrame(const I420VideoFrame& videoFrame, else { _mediaOpt.UpdateContentData(contentMetrics); - WebRtc_Word32 ret = _encoder->Encode(videoFrame, + int32_t ret = _encoder->Encode(videoFrame, codecSpecificInfo, _nextFrameTypes); if (_encoderInputFile != NULL) @@ -725,7 +725,7 @@ VideoCodingModuleImpl::AddVideoFrame(const I420VideoFrame& videoFrame, return VCM_OK; } -WebRtc_Word32 VideoCodingModuleImpl::IntraFrameRequest(int stream_index) { +int32_t VideoCodingModuleImpl::IntraFrameRequest(int stream_index) { CriticalSectionScoped cs(_sendCritSect); if (stream_index < 0 || static_cast(stream_index) >= _nextFrameTypes.size()) { @@ -743,7 +743,7 @@ WebRtc_Word32 VideoCodingModuleImpl::IntraFrameRequest(int stream_index) { return VCM_OK; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::EnableFrameDropper(bool enable) { CriticalSectionScoped cs(_sendCritSect); @@ -753,7 +753,7 @@ VideoCodingModuleImpl::EnableFrameDropper(bool enable) } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::SentFrameCount(VCMFrameCount &frameCount) const { CriticalSectionScoped cs(_sendCritSect); @@ -761,11 +761,11 @@ VideoCodingModuleImpl::SentFrameCount(VCMFrameCount &frameCount) const } // Initialize receiver, resets codec database etc -WebRtc_Word32 +int32_t VideoCodingModuleImpl::InitializeReceiver() { CriticalSectionScoped cs(_receiveCritSect); - WebRtc_Word32 ret = _receiver.Initialize(); + int32_t ret = _receiver.Initialize(); if (ret < 0) { return ret; @@ -794,7 +794,7 @@ VideoCodingModuleImpl::InitializeReceiver() // Register a receive callback. Will be called whenever there is a new frame // ready for rendering. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterReceiveCallback( VCMReceiveCallback* receiveCallback) { @@ -803,7 +803,7 @@ VideoCodingModuleImpl::RegisterReceiveCallback( return VCM_OK; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterReceiveStatisticsCallback( VCMReceiveStatisticsCallback* receiveStats) { @@ -814,9 +814,9 @@ VideoCodingModuleImpl::RegisterReceiveStatisticsCallback( // Register an externally defined decoder/render object. // Can be a decoder only or a decoder coupled with a renderer. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterExternalDecoder(VideoDecoder* externalDecoder, - WebRtc_UWord8 payloadType, + uint8_t payloadType, bool internalRenderTiming) { CriticalSectionScoped cs(_receiveCritSect); @@ -831,7 +831,7 @@ VideoCodingModuleImpl::RegisterExternalDecoder(VideoDecoder* externalDecoder, } // Register a frame type request callback. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterFrameTypeCallback( VCMFrameTypeCallback* frameTypeCallback) { @@ -840,7 +840,7 @@ VideoCodingModuleImpl::RegisterFrameTypeCallback( return VCM_OK; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterFrameStorageCallback( VCMFrameStorageCallback* frameStorageCallback) { @@ -849,7 +849,7 @@ VideoCodingModuleImpl::RegisterFrameStorageCallback( return VCM_OK; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterPacketRequestCallback( VCMPacketRequestCallback* callback) { @@ -860,10 +860,10 @@ VideoCodingModuleImpl::RegisterPacketRequestCallback( // Decode next frame, blocking. // Should be called as often as possible to get the most out of the decoder. -WebRtc_Word32 -VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs) +int32_t +VideoCodingModuleImpl::Decode(uint16_t maxWaitTimeMs) { - WebRtc_Word64 nextRenderTimeMs; + int64_t nextRenderTimeMs; { CriticalSectionScoped cs(_receiveCritSect); if (!_receiverInited) @@ -932,14 +932,14 @@ VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs) #endif if (_frameStorageCallback != NULL) { - WebRtc_Word32 ret = frame->Store(*_frameStorageCallback); + int32_t ret = frame->Store(*_frameStorageCallback); if (ret < 0) { return ret; } } - const WebRtc_Word32 ret = Decode(*frame); + const int32_t ret = Decode(*frame); _receiver.ReleaseFrame(frame); frame = NULL; if (ret != VCM_OK) @@ -950,13 +950,13 @@ VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs) return VCM_OK; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RequestSliceLossIndication( - const WebRtc_UWord64 pictureID) const + const uint64_t pictureID) const { if (_frameTypeCallback != NULL) { - const WebRtc_Word32 ret = + const int32_t ret = _frameTypeCallback->SliceLossIndicationRequest(pictureID); if (ret < 0) { @@ -977,12 +977,12 @@ VideoCodingModuleImpl::RequestSliceLossIndication( return VCM_OK; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RequestKeyFrame() { if (_frameTypeCallback != NULL) { - const WebRtc_Word32 ret = _frameTypeCallback->RequestKeyFrame(); + const int32_t ret = _frameTypeCallback->RequestKeyFrame(); if (ret < 0) { WEBRTC_TRACE(webrtc::kTraceError, @@ -1004,8 +1004,8 @@ VideoCodingModuleImpl::RequestKeyFrame() return VCM_OK; } -WebRtc_Word32 -VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs) +int32_t +VideoCodingModuleImpl::DecodeDualFrame(uint16_t maxWaitTimeMs) { CriticalSectionScoped cs(_receiveCritSect); if (_dualReceiver.State() != kReceiving || @@ -1015,8 +1015,8 @@ VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs) // dual decoder mode is disabled. return VCM_OK; } - WebRtc_Word64 dummyRenderTime; - WebRtc_Word32 decodeCount = 0; + int64_t dummyRenderTime; + int32_t decodeCount = 0; VCMEncodedFrame* dualFrame = _dualReceiver.FrameForDecoding( maxWaitTimeMs, dummyRenderTime); @@ -1028,7 +1028,7 @@ VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs) "Decoding frame %u with dual decoder", dualFrame->TimeStamp()); // Decode dualFrame and try to catch up - WebRtc_Word32 ret = _dualDecoder->Decode(*dualFrame, + int32_t ret = _dualDecoder->Decode(*dualFrame, clock_->TimeInMilliseconds()); if (ret != WEBRTC_VIDEO_CODEC_OK) { @@ -1059,7 +1059,7 @@ VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs) // Must be called from inside the receive side critical section. -WebRtc_Word32 +int32_t VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame) { // Change decoder if payload type has changed @@ -1077,7 +1077,7 @@ VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame) return VCM_NO_CODEC_REGISTERED; } // Decode a frame - WebRtc_Word32 ret = _decoder->Decode(frame, clock_->TimeInMilliseconds()); + int32_t ret = _decoder->Decode(frame, clock_->TimeInMilliseconds()); // Check for failed decoding, run frame type request callback if needed. if (ret < 0) @@ -1127,12 +1127,12 @@ VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame) return ret; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::DecodeFromStorage( const EncodedVideoData& frameFromStorage) { CriticalSectionScoped cs(_receiveCritSect); - WebRtc_Word32 ret = _frameFromFile.ExtractFromStorage(frameFromStorage); + int32_t ret = _frameFromFile.ExtractFromStorage(frameFromStorage); if (ret < 0) { return ret; @@ -1141,7 +1141,7 @@ VideoCodingModuleImpl::DecodeFromStorage( } // Reset the decoder state -WebRtc_Word32 +int32_t VideoCodingModuleImpl::ResetDecoder() { CriticalSectionScoped cs(_receiveCritSect); @@ -1165,9 +1165,9 @@ VideoCodingModuleImpl::ResetDecoder() } // Register possible receive codecs, can be called multiple times -WebRtc_Word32 +int32_t VideoCodingModuleImpl::RegisterReceiveCodec(const VideoCodec* receiveCodec, - WebRtc_Word32 numberOfCores, + int32_t numberOfCores, bool requireKeyFrame) { CriticalSectionScoped cs(_receiveCritSect); @@ -1183,7 +1183,7 @@ VideoCodingModuleImpl::RegisterReceiveCodec(const VideoCodec* receiveCodec, } // Get current received codec -WebRtc_Word32 +int32_t VideoCodingModuleImpl::ReceiveCodec(VideoCodec* currentReceiveCodec) const { CriticalSectionScoped cs(_receiveCritSect); @@ -1203,9 +1203,9 @@ VideoCodingModuleImpl::ReceiveCodec() const } // Incoming packet from network parsed and ready for decode, non blocking. -WebRtc_Word32 -VideoCodingModuleImpl::IncomingPacket(const WebRtc_UWord8* incomingPayload, - WebRtc_UWord32 payloadLength, +int32_t +VideoCodingModuleImpl::IncomingPacket(const uint8_t* incomingPayload, + uint32_t payloadLength, const WebRtcRTPHeader& rtpInfo) { if (incomingPayload == NULL) { @@ -1215,7 +1215,7 @@ VideoCodingModuleImpl::IncomingPacket(const WebRtc_UWord8* incomingPayload, payloadLength = 0; } const VCMPacket packet(incomingPayload, payloadLength, rtpInfo); - WebRtc_Word32 ret; + int32_t ret; if (_dualReceiver.State() != kPassive) { ret = _dualReceiver.InsertPacket(packet, @@ -1245,8 +1245,8 @@ VideoCodingModuleImpl::IncomingPacket(const WebRtc_UWord8* incomingPayload, // Minimum playout delay (used for lip-sync). This is the minimum delay required // to sync with audio. Not included in VideoCodingModule::Delay() // Defaults to 0 ms. -WebRtc_Word32 -VideoCodingModuleImpl::SetMinimumPlayoutDelay(WebRtc_UWord32 minPlayoutDelayMs) +int32_t +VideoCodingModuleImpl::SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs) { _timing.SetMinimumTotalDelay(minPlayoutDelayMs); return VCM_OK; @@ -1254,23 +1254,23 @@ VideoCodingModuleImpl::SetMinimumPlayoutDelay(WebRtc_UWord32 minPlayoutDelayMs) // The estimated delay caused by rendering, defaults to // kDefaultRenderDelayMs = 10 ms -WebRtc_Word32 -VideoCodingModuleImpl::SetRenderDelay(WebRtc_UWord32 timeMS) +int32_t +VideoCodingModuleImpl::SetRenderDelay(uint32_t timeMS) { _timing.SetRenderDelay(timeMS); return VCM_OK; } // Current video delay -WebRtc_Word32 +int32_t VideoCodingModuleImpl::Delay() const { return _timing.TargetVideoDelay(); } // Nack list -WebRtc_Word32 -VideoCodingModuleImpl::NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size) +int32_t +VideoCodingModuleImpl::NackList(uint16_t* nackList, uint16_t& size) { VCMNackStatus nackStatus = kNackOk; uint16_t nack_list_length = 0; @@ -1312,14 +1312,14 @@ VideoCodingModuleImpl::NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size) return VCM_OK; } -WebRtc_Word32 +int32_t VideoCodingModuleImpl::ReceivedFrameCount(VCMFrameCount& frameCount) const { _receiver.ReceivedFrameCount(&frameCount); return VCM_OK; } -WebRtc_UWord32 VideoCodingModuleImpl::DiscardedPackets() const { +uint32_t VideoCodingModuleImpl::DiscardedPackets() const { return _receiver.DiscardedPackets(); } diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.h b/webrtc/modules/video_coding/main/source/video_coding_impl.h index 421d3db12..91f151cc5 100644 --- a/webrtc/modules/video_coding/main/source/video_coding_impl.h +++ b/webrtc/modules/video_coding/main/source/video_coding_impl.h @@ -32,18 +32,18 @@ namespace webrtc class VCMProcessTimer { public: - VCMProcessTimer(WebRtc_UWord32 periodMs, Clock* clock) + VCMProcessTimer(uint32_t periodMs, Clock* clock) : _clock(clock), _periodMs(periodMs), _latestMs(_clock->TimeInMilliseconds()) {} - WebRtc_UWord32 Period() const; - WebRtc_UWord32 TimeUntilProcess() const; + uint32_t Period() const; + uint32_t TimeUntilProcess() const; void Processed(); private: Clock* _clock; - WebRtc_UWord32 _periodMs; - WebRtc_Word64 _latestMs; + uint32_t _periodMs; + int64_t _latestMs; }; enum VCMKeyRequestMode @@ -58,48 +58,48 @@ enum VCMKeyRequestMode class VideoCodingModuleImpl : public VideoCodingModule { public: - VideoCodingModuleImpl(const WebRtc_Word32 id, Clock* clock, + VideoCodingModuleImpl(const int32_t id, Clock* clock, EventFactory* event_factory, bool owns_event_factory); virtual ~VideoCodingModuleImpl(); - WebRtc_Word32 Id() const; + int32_t Id() const; // Change the unique identifier of this object - virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); + virtual int32_t ChangeUniqueId(const int32_t id); // Returns the number of milliseconds until the module want a worker thread // to call Process - virtual WebRtc_Word32 TimeUntilNextProcess(); + virtual int32_t TimeUntilNextProcess(); - virtual WebRtc_Word32 Process(); + virtual int32_t Process(); /* * Sender */ // Initialize send codec - virtual WebRtc_Word32 InitializeSender(); + virtual int32_t InitializeSender(); // Register the send codec to be used. - virtual WebRtc_Word32 RegisterSendCodec(const VideoCodec* sendCodec, - WebRtc_UWord32 numberOfCores, - WebRtc_UWord32 maxPayloadSize); + virtual int32_t RegisterSendCodec(const VideoCodec* sendCodec, + uint32_t numberOfCores, + uint32_t maxPayloadSize); // Get current send codec - virtual WebRtc_Word32 SendCodec(VideoCodec* currentSendCodec) const; + virtual int32_t SendCodec(VideoCodec* currentSendCodec) const; // Get current send codec type virtual VideoCodecType SendCodec() const; // Register an external encoder object. - virtual WebRtc_Word32 RegisterExternalEncoder(VideoEncoder* externalEncoder, - WebRtc_UWord8 payloadType, + virtual int32_t RegisterExternalEncoder(VideoEncoder* externalEncoder, + uint8_t payloadType, bool internalSource = false); // Get codec config parameters - virtual WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* buffer, - WebRtc_Word32 size); + virtual int32_t CodecConfigParameters(uint8_t* buffer, + int32_t size); // Get encode bitrate virtual int Bitrate(unsigned int* bitrate) const; @@ -108,138 +108,138 @@ public: virtual int FrameRate(unsigned int* framerate) const; // Set channel parameters - virtual WebRtc_Word32 SetChannelParameters( - WebRtc_UWord32 target_bitrate, // bits/s. - WebRtc_UWord8 lossRate, - WebRtc_UWord32 rtt); + virtual int32_t SetChannelParameters( + uint32_t target_bitrate, // bits/s. + uint8_t lossRate, + uint32_t rtt); // Set recieve channel parameters - virtual WebRtc_Word32 SetReceiveChannelParameters(WebRtc_UWord32 rtt); + virtual int32_t SetReceiveChannelParameters(uint32_t rtt); // Register a transport callback which will be called to deliver the // encoded buffers - virtual WebRtc_Word32 RegisterTransportCallback( + virtual int32_t RegisterTransportCallback( VCMPacketizationCallback* transport); // Register a send statistics callback which will be called to deliver // information about the video stream produced by the encoder, // for instance the average frame rate and bit rate. - virtual WebRtc_Word32 RegisterSendStatisticsCallback( + virtual int32_t RegisterSendStatisticsCallback( VCMSendStatisticsCallback* sendStats); // Register a video quality settings callback which will be called when // frame rate/dimensions need to be updated for video quality optimization - virtual WebRtc_Word32 RegisterVideoQMCallback( + virtual int32_t RegisterVideoQMCallback( VCMQMSettingsCallback* videoQMSettings); // Register a video protection callback which will be called to deliver // the requested FEC rate and NACK status (on/off). - virtual WebRtc_Word32 RegisterProtectionCallback( + virtual int32_t RegisterProtectionCallback( VCMProtectionCallback* protection); // Enable or disable a video protection method. - virtual WebRtc_Word32 SetVideoProtection(VCMVideoProtection videoProtection, + virtual int32_t SetVideoProtection(VCMVideoProtection videoProtection, bool enable); // Add one raw video frame to the encoder, blocking. - virtual WebRtc_Word32 AddVideoFrame( + virtual int32_t AddVideoFrame( const I420VideoFrame& videoFrame, const VideoContentMetrics* _contentMetrics = NULL, const CodecSpecificInfo* codecSpecificInfo = NULL); - virtual WebRtc_Word32 IntraFrameRequest(int stream_index); + virtual int32_t IntraFrameRequest(int stream_index); //Enable frame dropper - virtual WebRtc_Word32 EnableFrameDropper(bool enable); + virtual int32_t EnableFrameDropper(bool enable); // Sent frame counters - virtual WebRtc_Word32 SentFrameCount(VCMFrameCount& frameCount) const; + virtual int32_t SentFrameCount(VCMFrameCount& frameCount) const; /* * Receiver */ // Initialize receiver, resets codec database etc - virtual WebRtc_Word32 InitializeReceiver(); + virtual int32_t InitializeReceiver(); // Register possible reveive codecs, can be called multiple times - virtual WebRtc_Word32 RegisterReceiveCodec(const VideoCodec* receiveCodec, - WebRtc_Word32 numberOfCores, + virtual int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec, + int32_t numberOfCores, bool requireKeyFrame = false); // Register an externally defined decoder/render object. // Can be a decoder only or a decoder coupled with a renderer. - virtual WebRtc_Word32 RegisterExternalDecoder(VideoDecoder* externalDecoder, - WebRtc_UWord8 payloadType, + virtual int32_t RegisterExternalDecoder(VideoDecoder* externalDecoder, + uint8_t payloadType, bool internalRenderTiming); // Register a receive callback. Will be called whenever there are a new // frame ready for rendering. - virtual WebRtc_Word32 RegisterReceiveCallback( + virtual int32_t RegisterReceiveCallback( VCMReceiveCallback* receiveCallback); // Register a receive statistics callback which will be called to deliver // information about the video stream received by the receiving side of the // VCM, for instance the average frame rate and bit rate. - virtual WebRtc_Word32 RegisterReceiveStatisticsCallback( + virtual int32_t RegisterReceiveStatisticsCallback( VCMReceiveStatisticsCallback* receiveStats); // Register a frame type request callback. - virtual WebRtc_Word32 RegisterFrameTypeCallback( + virtual int32_t RegisterFrameTypeCallback( VCMFrameTypeCallback* frameTypeCallback); // Register a frame storage callback. - virtual WebRtc_Word32 RegisterFrameStorageCallback( + virtual int32_t RegisterFrameStorageCallback( VCMFrameStorageCallback* frameStorageCallback); // Nack callback - virtual WebRtc_Word32 RegisterPacketRequestCallback( + virtual int32_t RegisterPacketRequestCallback( VCMPacketRequestCallback* callback); // Decode next frame, blocks for a maximum of maxWaitTimeMs milliseconds. // Should be called as often as possible to get the most out of the decoder. - virtual WebRtc_Word32 Decode(WebRtc_UWord16 maxWaitTimeMs = 200); + virtual int32_t Decode(uint16_t maxWaitTimeMs = 200); // Decode next dual frame, blocks for a maximum of maxWaitTimeMs // milliseconds. - virtual WebRtc_Word32 DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs = 200); + virtual int32_t DecodeDualFrame(uint16_t maxWaitTimeMs = 200); // Reset the decoder state - virtual WebRtc_Word32 ResetDecoder(); + virtual int32_t ResetDecoder(); // Get current received codec - virtual WebRtc_Word32 ReceiveCodec(VideoCodec* currentReceiveCodec) const; + virtual int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const; // Get current received codec type virtual VideoCodecType ReceiveCodec() const; // Incoming packet from network parsed and ready for decode, non blocking. - virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPayload, - WebRtc_UWord32 payloadLength, + virtual int32_t IncomingPacket(const uint8_t* incomingPayload, + uint32_t payloadLength, const WebRtcRTPHeader& rtpInfo); // A part of an encoded frame to be decoded. // Used in conjunction with VCMFrameStorageCallback. - virtual WebRtc_Word32 DecodeFromStorage( + virtual int32_t DecodeFromStorage( const EncodedVideoData& frameFromStorage); // Minimum playout delay (Used for lip-sync). This is the minimum delay // required to sync with audio. Not included in VideoCodingModule::Delay() // Defaults to 0 ms. - virtual WebRtc_Word32 SetMinimumPlayoutDelay( - WebRtc_UWord32 minPlayoutDelayMs); + virtual int32_t SetMinimumPlayoutDelay( + uint32_t minPlayoutDelayMs); // The estimated delay caused by rendering - virtual WebRtc_Word32 SetRenderDelay(WebRtc_UWord32 timeMS); + virtual int32_t SetRenderDelay(uint32_t timeMS); // Current delay - virtual WebRtc_Word32 Delay() const; + virtual int32_t Delay() const; // Received frame counters - virtual WebRtc_Word32 ReceivedFrameCount(VCMFrameCount& frameCount) const; + virtual int32_t ReceivedFrameCount(VCMFrameCount& frameCount) const; // Returns the number of packets discarded by the jitter buffer. - virtual WebRtc_UWord32 DiscardedPackets() const; + virtual uint32_t DiscardedPackets() const; // Robustness APIs @@ -273,14 +273,14 @@ public: virtual int StopDebugRecording(); protected: - WebRtc_Word32 Decode(const webrtc::VCMEncodedFrame& frame); - WebRtc_Word32 RequestKeyFrame(); - WebRtc_Word32 RequestSliceLossIndication( - const WebRtc_UWord64 pictureID) const; - WebRtc_Word32 NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size); + int32_t Decode(const webrtc::VCMEncodedFrame& frame); + int32_t RequestKeyFrame(); + int32_t RequestSliceLossIndication( + const uint64_t pictureID) const; + int32_t NackList(uint16_t* nackList, uint16_t& size); private: - WebRtc_Word32 _id; + int32_t _id; Clock* clock_; CriticalSectionWrapper* _receiveCritSect; bool _receiverInited; diff --git a/webrtc/modules/video_coding/main/test/codec_database_test.cc b/webrtc/modules/video_coding/main/test/codec_database_test.cc index 9ee82bf82..23daf38f3 100644 --- a/webrtc/modules/video_coding/main/test/codec_database_test.cc +++ b/webrtc/modules/video_coding/main/test/codec_database_test.cc @@ -89,7 +89,7 @@ CodecDataBaseTest::Setup(CmdArgs& args) -WebRtc_Word32 +int32_t CodecDataBaseTest::Perform(CmdArgs& args) { #ifndef VIDEOCODEC_VP8 @@ -113,7 +113,7 @@ CodecDataBaseTest::Perform(CmdArgs& args) // registering the callback - encode and decode with the same vcm (could be later changed) _encodeCompleteCallback->RegisterReceiverVCM(_vcm); // preparing a frame to be encoded - WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; + uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame]; TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0); I420VideoFrame sourceFrame; int half_width = (_width + 1) / 2; @@ -125,7 +125,7 @@ CodecDataBaseTest::Perform(CmdArgs& args) size_uv, tmpBuffer + size_y + size_uv, _width, _height, _width, half_width, half_width); - _timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); + _timeStamp += (uint32_t)(9e4 / _frameRate); sourceFrame.set_timestamp(_timeStamp); // Encoder registration TEST (VideoCodingModule::NumberOfCodecs() > 0); @@ -202,7 +202,7 @@ CodecDataBaseTest::Perform(CmdArgs& args) TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->Decode() == VCM_OK); waitEvent->Wait(33); - _timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); + _timeStamp += (uint32_t)(9e4 / _frameRate); sourceFrame.set_timestamp(_timeStamp); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->Decode() == VCM_OK); @@ -237,14 +237,14 @@ CodecDataBaseTest::Perform(CmdArgs& args) TEST(_vcm->Decode() == VCM_OK); TEST(_vcm->ResetDecoder() == VCM_OK); waitEvent->Wait(33); - _timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); + _timeStamp += (uint32_t)(9e4 / _frameRate); sourceFrame.set_timestamp(_timeStamp); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); // Try to decode a delta frame. Should get a warning since we have enabled the "require key frame" setting // and because no frame type request callback has been registered. TEST(_vcm->Decode() == VCM_MISSING_CALLBACK); TEST(_vcm->IntraFrameRequest(0) == VCM_OK); - _timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); + _timeStamp += (uint32_t)(9e4 / _frameRate); sourceFrame.set_timestamp(_timeStamp); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->Decode() == VCM_OK); @@ -257,13 +257,13 @@ CodecDataBaseTest::Perform(CmdArgs& args) TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); TEST(_vcm->IntraFrameRequest(0) == VCM_OK); waitEvent->Wait(33); - _timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); + _timeStamp += (uint32_t)(9e4 / _frameRate); sourceFrame.set_timestamp(_timeStamp); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); TEST(_vcm->Decode() == VCM_OK); TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); waitEvent->Wait(33); - _timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); + _timeStamp += (uint32_t)(9e4 / _frameRate); sourceFrame.set_timestamp(_timeStamp); TEST(_vcm->IntraFrameRequest(0) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); @@ -339,7 +339,7 @@ CodecDataBaseTest::Perform(CmdArgs& args) size_uv, tmpBuffer + size_y + size_uv, _width, _height, _width, half_width, half_width); - _timeStamp += (WebRtc_UWord32)(9e4 / _frameRate); + _timeStamp += (uint32_t)(9e4 / _frameRate); sourceFrame.set_timestamp(_timeStamp); // send frame to the encoder TEST (_vcm->AddVideoFrame(sourceFrame) == VCM_OK); diff --git a/webrtc/modules/video_coding/main/test/codec_database_test.h b/webrtc/modules/video_coding/main/test/codec_database_test.h index cc33e05a9..631819ec3 100644 --- a/webrtc/modules/video_coding/main/test/codec_database_test.h +++ b/webrtc/modules/video_coding/main/test/codec_database_test.h @@ -29,7 +29,7 @@ public: CodecDataBaseTest(webrtc::VideoCodingModule* vcm); ~CodecDataBaseTest(); static int RunTest(CmdArgs& args); - WebRtc_Word32 Perform(CmdArgs& args); + int32_t Perform(CmdArgs& args); private: void TearDown(); void Setup(CmdArgs& args); @@ -41,10 +41,10 @@ private: FILE* _sourceFile; FILE* _decodedFile; FILE* _encodedFile; - WebRtc_UWord16 _width; - WebRtc_UWord16 _height; - WebRtc_UWord32 _lengthSourceFrame; - WebRtc_UWord32 _timeStamp; + uint16_t _width; + uint16_t _height; + uint32_t _lengthSourceFrame; + uint32_t _timeStamp; float _frameRate; }; // end of codecDBTest class definition diff --git a/webrtc/modules/video_coding/main/test/decode_from_storage_test.cc b/webrtc/modules/video_coding/main/test/decode_from_storage_test.cc index c1f91d03a..969a4a4d5 100644 --- a/webrtc/modules/video_coding/main/test/decode_from_storage_test.cc +++ b/webrtc/modules/video_coding/main/test/decode_from_storage_test.cc @@ -22,7 +22,7 @@ class FrameStorageCallback : public VCMFrameStorageCallback public: FrameStorageCallback(VideoCodingModule* vcm) : _vcm(vcm) {} - WebRtc_Word32 StoreReceivedFrame(const EncodedVideoData& frameToStore) + int32_t StoreReceivedFrame(const EncodedVideoData& frameToStore) { _vcm->DecodeFromStorage(frameToStore); return VCM_OK; @@ -37,12 +37,12 @@ int DecodeFromStorageTest(CmdArgs& args) // BEGIN Settings bool protectionEnabled = false; VCMVideoProtection protectionMethod = kProtectionNack; - WebRtc_UWord32 rttMS = 100; + uint32_t rttMS = 100; float lossRate = 0.00f; bool reordering = false; - WebRtc_UWord32 renderDelayMs = 0; - WebRtc_UWord32 minPlayoutDelayMs = 0; - const WebRtc_Word64 MAX_RUNTIME_MS = -1; + uint32_t renderDelayMs = 0; + uint32_t minPlayoutDelayMs = 0; + const int64_t MAX_RUNTIME_MS = -1; std::string rtpFilename = args.inputFile; std::string outFilename = args.outputFile; if (outFilename == "") @@ -67,7 +67,7 @@ int DecodeFromStorageTest(CmdArgs& args) &event_factory); FrameStorageCallback storageCallback(vcmPlayback); RtpDataCallback dataCallback(vcm); - WebRtc_Word32 ret = vcm->InitializeReceiver(); + int32_t ret = vcm->InitializeReceiver(); if (ret < 0) { return -1; diff --git a/webrtc/modules/video_coding/main/test/generic_codec_test.cc b/webrtc/modules/video_coding/main/test/generic_codec_test.cc index 082485e39..88ae05564 100644 --- a/webrtc/modules/video_coding/main/test/generic_codec_test.cc +++ b/webrtc/modules/video_coding/main/test/generic_codec_test.cc @@ -95,10 +95,10 @@ GenericCodecTest::Setup(CmdArgs& args) return; } -WebRtc_Word32 +int32_t GenericCodecTest::Perform(CmdArgs& args) { - WebRtc_Word32 ret; + int32_t ret; Setup(args); /* 1. sanity checks @@ -117,7 +117,7 @@ GenericCodecTest::Perform(CmdArgs& args) TEST(_vcm->Codec(0, &sendCodec) == VCM_OK); _vcm->InitializeSender(); _vcm->InitializeReceiver(); - WebRtc_Word32 NumberOfCodecs = _vcm->NumberOfCodecs(); + int32_t NumberOfCodecs = _vcm->NumberOfCodecs(); // registration of first codec in the list int i = 0; _vcm->Codec(0, &_sendCodec); @@ -146,7 +146,7 @@ GenericCodecTest::Perform(CmdArgs& args) _vcm->Codec(i, &receiveCodec); _vcm->RegisterReceiveCodec(&receiveCodec, 1); } - WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; + uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame]; TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0); int half_width = (_width + 1) / 2; int half_height = (_height + 1) / 2; @@ -179,7 +179,7 @@ GenericCodecTest::Perform(CmdArgs& args) // Set target frame rate to half of the incoming frame rate // to test the frame rate control in the VCM - sendCodec.maxFramerate = (WebRtc_UWord8)(_frameRate / 2); + sendCodec.maxFramerate = (uint8_t)(_frameRate / 2); sendCodec.width = _width; sendCodec.height = _height; TEST(strncmp(_sendCodec.plName, "VP8", 3) == 0); // was VP8 @@ -205,13 +205,13 @@ GenericCodecTest::Perform(CmdArgs& args) size_uv, tmpBuffer + size_y + size_uv, _width, _height, _width, half_width, half_width); - _timeStamp += (WebRtc_UWord32)(9e4 / static_cast(_frameRate)); + _timeStamp += (uint32_t)(9e4 / static_cast(_frameRate)); sourceFrame.set_timestamp(_timeStamp); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); IncrementDebugClock(_frameRate); _vcm->Process(); } - sendCodec.maxFramerate = (WebRtc_UWord8)_frameRate; + sendCodec.maxFramerate = (uint8_t)_frameRate; _vcm->InitializeSender(); TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); // same codec for encode and decode ret = 0; @@ -251,7 +251,7 @@ GenericCodecTest::Perform(CmdArgs& args) TEST(_vcm->RegisterFrameTypeCallback(&frameTypeCallback) == VCM_OK); TEST(_vcm->RegisterReceiveCodec(&sendCodec, 1) == VCM_OK); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); - _timeStamp += (WebRtc_UWord32)(9e4 / static_cast(_frameRate)); + _timeStamp += (uint32_t)(9e4 / static_cast(_frameRate)); sourceFrame.set_timestamp(_timeStamp); // First packet of a subsequent frame required before the jitter buffer // will allow decoding an incomplete frame. @@ -317,7 +317,7 @@ GenericCodecTest::Perform(CmdArgs& args) _frameCnt = 0; totalBytes = 0; _encodeCompleteCallback->Initialize(); - sendStats.set_framerate(static_cast(_frameRate)); + sendStats.set_framerate(static_cast(_frameRate)); sendStats.set_bitrate(1000 * _bitRate); _vcm->RegisterSendStatisticsCallback(&sendStats); while (fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) == @@ -330,7 +330,7 @@ GenericCodecTest::Perform(CmdArgs& args) _width, _height, _width, (_width + 1) / 2, (_width + 1) / 2); - _timeStamp += (WebRtc_UWord32)(9e4 / static_cast(_frameRate)); + _timeStamp += (uint32_t)(9e4 / static_cast(_frameRate)); sourceFrame.set_timestamp(_timeStamp); ret = _vcm->AddVideoFrame(sourceFrame); @@ -394,7 +394,7 @@ GenericCodecTest::Perform(CmdArgs& args) size_uv, tmpBuffer + size_y + size_uv, _width, _height, _width, half_width, half_width); - _timeStamp += (WebRtc_UWord32)(9e4 / static_cast(_frameRate)); + _timeStamp += (uint32_t)(9e4 / static_cast(_frameRate)); sourceFrame.set_timestamp(_timeStamp); _vcm->AddVideoFrame(sourceFrame); encodeComplete = _encodeCompleteCallback->EncodeComplete(); @@ -430,14 +430,14 @@ GenericCodecTest::Perform(CmdArgs& args) } TEST(strncmp(_sendCodec.plName, "I420", 4) == 0); _vcm->InitializeSender(); - _sendCodec.maxFramerate = static_cast(_frameRate / 2.0 + 0.5f); + _sendCodec.maxFramerate = static_cast(_frameRate / 2.0 + 0.5f); _vcm->RegisterSendCodec(&_sendCodec, 4, 1440); _vcm->SetChannelParameters(2000000, 0, 0); _vcm->RegisterTransportCallback(_encodeCompleteCallback); // up to here _vcm->SetChannelParameters(static_cast(1000 * _bitRate), 0, 20); _encodeCompleteCallback->Initialize(); - sendStats.set_framerate(static_cast(_frameRate)); + sendStats.set_framerate(static_cast(_frameRate)); sendStats.set_bitrate(1000 * _bitRate); _vcm->RegisterSendStatisticsCallback(&sendStats); rewind(_sourceFile); @@ -448,7 +448,7 @@ GenericCodecTest::Perform(CmdArgs& args) size_uv, tmpBuffer + size_y + size_uv, _width, _height, _width, half_width, half_width); - _timeStamp += (WebRtc_UWord32)(9e4 / static_cast(_frameRate)); + _timeStamp += (uint32_t)(9e4 / static_cast(_frameRate)); sourceFrame.set_timestamp(_timeStamp); ret = _vcm->AddVideoFrame(sourceFrame); if (_vcm->TimeUntilNextProcess() <= 0) @@ -484,7 +484,7 @@ GenericCodecTest::Print() float GenericCodecTest::WaitForEncodedFrame() const { - WebRtc_Word64 startTime = _clock->TimeInMilliseconds(); + int64_t startTime = _clock->TimeInMilliseconds(); while (_clock->TimeInMilliseconds() - startTime < kMaxWaitEncTimeMs*10) { if (_encodeCompleteCallback->EncodeComplete()) @@ -507,12 +507,12 @@ RTPSendCallback_SizeTest::SendPacket(int channel, const void *data, int len) _nPackets++; _payloadSizeSum += len; // Make sure no payloads (len - header size) are larger than maxPayloadSize - TEST(len > 0 && static_cast(len - 12) <= _maxPayloadSize); + TEST(len > 0 && static_cast(len - 12) <= _maxPayloadSize); return 0; } void -RTPSendCallback_SizeTest::SetMaxPayloadSize(WebRtc_UWord32 maxPayloadSize) +RTPSendCallback_SizeTest::SetMaxPayloadSize(uint32_t maxPayloadSize) { _maxPayloadSize = maxPayloadSize; } @@ -534,14 +534,14 @@ RTPSendCallback_SizeTest::AveragePayloadSize() const return 0; } -WebRtc_Word32 +int32_t VCMEncComplete_KeyReqTest::SendData( const FrameType frameType, - const WebRtc_UWord8 payloadType, - const WebRtc_UWord32 timeStamp, + const uint8_t payloadType, + const uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - const WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + const uint32_t payloadSize, const RTPFragmentationHeader& /*fragmentationHeader*/, const webrtc::RTPVideoHeader* /*videoHdr*/) { diff --git a/webrtc/modules/video_coding/main/test/generic_codec_test.h b/webrtc/modules/video_coding/main/test/generic_codec_test.h index f0f46dc56..acfff8dba 100644 --- a/webrtc/modules/video_coding/main/test/generic_codec_test.h +++ b/webrtc/modules/video_coding/main/test/generic_codec_test.h @@ -40,13 +40,13 @@ public: webrtc::SimulatedClock* clock); ~GenericCodecTest(); static int RunTest(CmdArgs& args); - WebRtc_Word32 Perform(CmdArgs& args); + int32_t Perform(CmdArgs& args); float WaitForEncodedFrame() const; private: void Setup(CmdArgs& args); void Print(); - WebRtc_Word32 TearDown(); + int32_t TearDown(); void IncrementDebugClock(float frameRate); webrtc::SimulatedClock* _clock; @@ -56,15 +56,15 @@ private: std::string _inname; std::string _outname; std::string _encodedName; - WebRtc_Word32 _sumEncBytes; + int32_t _sumEncBytes; FILE* _sourceFile; FILE* _decodedFile; FILE* _encodedFile; - WebRtc_UWord16 _width; - WebRtc_UWord16 _height; + uint16_t _width; + uint16_t _height; float _frameRate; - WebRtc_UWord32 _lengthSourceFrame; - WebRtc_UWord32 _timeStamp; + uint32_t _lengthSourceFrame; + uint32_t _timeStamp; VCMDecodeCompleteCallback* _decodeCallback; VCMEncodeCompleteCallback* _encodeCompleteCallback; @@ -77,32 +77,32 @@ public: RTPSendCallback_SizeTest() : _maxPayloadSize(0), _payloadSizeSum(0), _nPackets(0) {} virtual int SendPacket(int channel, const void *data, int len); virtual int SendRTCPPacket(int channel, const void *data, int len) {return 0;} - void SetMaxPayloadSize(WebRtc_UWord32 maxPayloadSize); + void SetMaxPayloadSize(uint32_t maxPayloadSize); void Reset(); float AveragePayloadSize() const; private: - WebRtc_UWord32 _maxPayloadSize; - WebRtc_UWord32 _payloadSizeSum; - WebRtc_UWord32 _nPackets; + uint32_t _maxPayloadSize; + uint32_t _payloadSizeSum; + uint32_t _nPackets; }; class VCMEncComplete_KeyReqTest : public webrtc::VCMPacketizationCallback { public: VCMEncComplete_KeyReqTest(webrtc::VideoCodingModule &vcm) : _vcm(vcm), _seqNo(0), _timeStamp(0) {} - WebRtc_Word32 SendData( + int32_t SendData( const webrtc::FrameType frameType, - const WebRtc_UWord8 payloadType, - WebRtc_UWord32 timeStamp, + const uint8_t payloadType, + uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - const WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + const uint32_t payloadSize, const webrtc::RTPFragmentationHeader& fragmentationHeader, const webrtc::RTPVideoHeader* videoHdr); private: webrtc::VideoCodingModule& _vcm; - WebRtc_UWord16 _seqNo; - WebRtc_UWord32 _timeStamp; + uint16_t _seqNo; + uint32_t _timeStamp; }; // end of VCMEncodeCompleteCallback } // namespace webrtc diff --git a/webrtc/modules/video_coding/main/test/jitter_buffer_test.cc b/webrtc/modules/video_coding/main/test/jitter_buffer_test.cc index e34e986f4..975468c35 100644 --- a/webrtc/modules/video_coding/main/test/jitter_buffer_test.cc +++ b/webrtc/modules/video_coding/main/test/jitter_buffer_test.cc @@ -36,7 +36,7 @@ int CheckOutFrame(VCMEncodedFrame* frameOut, unsigned int size, bool startCode) return -1; } - const WebRtc_UWord8* outData = frameOut->Buffer(); + const uint8_t* outData = frameOut->Buffer(); unsigned int i = 0; @@ -96,10 +96,10 @@ int JitterBufferTest(CmdArgs& args) Clock* clock = Clock::GetRealTimeClock(); // Start test - WebRtc_UWord16 seqNum = 1234; - WebRtc_UWord32 timeStamp = 0; + uint16_t seqNum = 1234; + uint32_t timeStamp = 0; int size = 1400; - WebRtc_UWord8 data[1500]; + uint8_t data[1500]; VCMPacket packet(data, size, seqNum, timeStamp, true); NullEventFactory event_factory; @@ -109,7 +109,7 @@ int JitterBufferTest(CmdArgs& args) timeStamp = 123*90; FrameType incomingFrameType(kVideoFrameKey); VCMEncodedFrame* frameOut=NULL; - WebRtc_Word64 renderTimeMs = 0; + int64_t renderTimeMs = 0; packet.timestamp = timeStamp; packet.seqNum = seqNum; @@ -1568,8 +1568,8 @@ int JitterBufferTest(CmdArgs& args) loop = 0; seqNum = 65485; - WebRtc_UWord32 timeStampStart = timeStamp + 33*90; - WebRtc_UWord32 timeStampFirstKey = 0; + uint32_t timeStampStart = timeStamp + 33*90; + uint32_t timeStampFirstKey = 0; VCMEncodedFrame* ptrLastDeltaFrame = NULL; VCMEncodedFrame* ptrFirstKeyFrame = NULL; // insert MAX_NUMBER_OF_FRAMES frames diff --git a/webrtc/modules/video_coding/main/test/jitter_estimate_test.cc b/webrtc/modules/video_coding/main/test/jitter_estimate_test.cc index ac74a8a9d..ee1c0b03d 100644 --- a/webrtc/modules/video_coding/main/test/jitter_estimate_test.cc +++ b/webrtc/modules/video_coding/main/test/jitter_estimate_test.cc @@ -64,8 +64,8 @@ JitterEstimateTest::GenerateFrameSample() else _counter++; } - WebRtc_Word64 jitter = static_cast(_jitter.RandValue() + 1.0/_capacity * frameSize + 0.5); - _prevWallClock += static_cast(1000*increment + 0.5); + int64_t jitter = static_cast(_jitter.RandValue() + 1.0/_capacity * frameSize + 0.5); + _prevWallClock += static_cast(1000*increment + 0.5); double rndValue = RandUniform(); resent = (rndValue < _lossrate); //printf("rndValue = %f\n", rndValue); diff --git a/webrtc/modules/video_coding/main/test/jitter_estimate_test.h b/webrtc/modules/video_coding/main/test/jitter_estimate_test.h index cd7338afc..ec9fdeb9f 100644 --- a/webrtc/modules/video_coding/main/test/jitter_estimate_test.h +++ b/webrtc/modules/video_coding/main/test/jitter_estimate_test.h @@ -63,11 +63,11 @@ class FrameSample { public: FrameSample() {FrameSample(0, 0, 0, false, false);} - FrameSample(unsigned int ts, WebRtc_Word64 wallClk, unsigned int fs, bool _keyFrame, bool _resent): + FrameSample(unsigned int ts, int64_t wallClk, unsigned int fs, bool _keyFrame, bool _resent): timestamp90Khz(ts), wallClockMs(wallClk), frameSize(fs), keyFrame(_keyFrame), resent(_resent) {} unsigned int timestamp90Khz; - WebRtc_Word64 wallClockMs; + int64_t wallClockMs; unsigned int frameSize; bool keyFrame; bool resent; @@ -94,7 +94,7 @@ private: //GaussDist _noResend; GaussDist _deltaFrameSize; unsigned int _prevTimestamp; - WebRtc_Word64 _prevWallClock; + int64_t _prevWallClock; unsigned int _nextDelay; double _keyFrameRate; unsigned int _counter; diff --git a/webrtc/modules/video_coding/main/test/media_opt_test.cc b/webrtc/modules/video_coding/main/test/media_opt_test.cc index 59f320420..493791b12 100644 --- a/webrtc/modules/video_coding/main/test/media_opt_test.cc +++ b/webrtc/modules/video_coding/main/test/media_opt_test.cc @@ -168,7 +168,7 @@ void MediaOptTest::Setup(int testType, CmdArgs& args) { void MediaOptTest::GeneralSetup() { - WebRtc_UWord32 minPlayoutDelayMs = 0; + uint32_t minPlayoutDelayMs = 0; if ((_sourceFile = fopen(_inname.c_str(), "rb")) == NULL) { @@ -237,7 +237,7 @@ MediaOptTest::GeneralSetup() VideoCodec sendCodec; _vcm->InitializeSender(); _vcm->InitializeReceiver(); - WebRtc_Word32 numberOfCodecs = _vcm->NumberOfCodecs(); + int32_t numberOfCodecs = _vcm->NumberOfCodecs(); if (numberOfCodecs < 1) { exit(1); @@ -252,7 +252,7 @@ MediaOptTest::GeneralSetup() sendCodec.startBitrate = (int) _bitRate; sendCodec.height = _height; sendCodec.width = _width; - sendCodec.maxFramerate = (WebRtc_UWord8)_frameRate; + sendCodec.maxFramerate = (uint8_t)_frameRate; _vcm->RegisterSendCodec(&sendCodec, _numberOfCores, 1440); _vcm->RegisterReceiveCodec(&sendCodec, _numberOfCores); // same settings for encode and decode @@ -263,7 +263,7 @@ MediaOptTest::GeneralSetup() -WebRtc_Word32 +int32_t MediaOptTest::Perform() { VCMDecodeCompleteCallback receiveCallback(_decodedFile); @@ -289,9 +289,9 @@ MediaOptTest::Perform() // START TEST I420VideoFrame sourceFrame; - WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; + uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame]; _vcm->SetChannelParameters(static_cast(1000 * _bitRate), - (WebRtc_UWord8)_lossRate, _rttMS); + (uint8_t)_lossRate, _rttMS); _vcm->RegisterReceiveCallback(&receiveCallback); _frameCnt = 0; @@ -311,14 +311,14 @@ MediaOptTest::Perform() size_uv, tmpBuffer + size_y + size_uv, _width, _height, _width, half_width, half_width); - _timeStamp += (WebRtc_UWord32)(9e4 / static_cast(_frameRate)); + _timeStamp += (uint32_t)(9e4 / static_cast(_frameRate)); sourceFrame.set_timestamp(_timeStamp); TEST(_vcm->AddVideoFrame(sourceFrame) == VCM_OK); // inform RTP Module of error resilience features //_rtp->SetFECCodeRate(protectionCallback.FECKeyRate(),protectionCallback.FECDeltaRate()); //_rtp->SetNACKStatus(protectionCallback.NACKMethod()); - WebRtc_Word32 ret = _vcm->Decode(); + int32_t ret = _vcm->Decode(); if (ret < 0 ) { TEST(ret == 0); diff --git a/webrtc/modules/video_coding/main/test/media_opt_test.h b/webrtc/modules/video_coding/main/test/media_opt_test.h index 24f53ab14..cdbd53d9f 100644 --- a/webrtc/modules/video_coding/main/test/media_opt_test.h +++ b/webrtc/modules/video_coding/main/test/media_opt_test.h @@ -39,7 +39,7 @@ public: static int RunTest(int testNum, CmdArgs& args); // perform encode-decode of an entire sequence - WebRtc_Word32 Perform(); + int32_t Perform(); // Set up for a single mode test void Setup(int testType, CmdArgs& args); // General set up - applicable for both modes @@ -66,24 +66,24 @@ private: FILE* _decodedFile; FILE* _actualSourceFile; FILE* _outputRes; - WebRtc_UWord16 _width; - WebRtc_UWord16 _height; - WebRtc_UWord32 _lengthSourceFrame; - WebRtc_UWord32 _timeStamp; + uint16_t _width; + uint16_t _height; + uint32_t _lengthSourceFrame; + uint32_t _timeStamp; float _frameRate; bool _nackEnabled; bool _fecEnabled; bool _nackFecEnabled; - WebRtc_UWord8 _rttMS; + uint8_t _rttMS; float _bitRate; double _lossRate; - WebRtc_UWord32 _renderDelayMs; - WebRtc_Word32 _frameCnt; + uint32_t _renderDelayMs; + int32_t _frameCnt; float _sumEncBytes; - WebRtc_Word32 _numFramesDropped; + int32_t _numFramesDropped; std::string _codecName; webrtc::VideoCodecType _sendCodecType; - WebRtc_Word32 _numberOfCores; + int32_t _numberOfCores; //for release test#2 FILE* _fpinp; diff --git a/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc b/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc index b135169ff..c7cd95f5f 100644 --- a/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc +++ b/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc @@ -34,11 +34,11 @@ MainSenderThread(void* obj) EventWrapper& waitEvent = *EventWrapper::Create(); // preparing a frame for encoding I420VideoFrame sourceFrame; - WebRtc_Word32 width = state->_args.width; - WebRtc_Word32 height = state->_args.height; + int32_t width = state->_args.width; + int32_t height = state->_args.height; float frameRate = state->_args.frameRate; - WebRtc_Word32 lengthSourceFrame = 3*width*height/2; - WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[lengthSourceFrame]; + int32_t lengthSourceFrame = 3*width*height/2; + uint8_t* tmpBuffer = new uint8_t[lengthSourceFrame]; if (state->_sourceFile == NULL) { @@ -65,10 +65,10 @@ MainSenderThread(void* obj) size_uv, tmpBuffer + size_y + size_uv, width, height, width, half_width, half_width); - state->_timestamp += (WebRtc_UWord32)(9e4 / frameRate); + state->_timestamp += (uint32_t)(9e4 / frameRate); sourceFrame.set_timestamp(state->_timestamp); - WebRtc_Word32 ret = state->_vcm.AddVideoFrame(sourceFrame); + int32_t ret = state->_vcm.AddVideoFrame(sourceFrame); if (ret < 0) { printf("Add Frame error: %d\n", ret); @@ -105,21 +105,21 @@ int MTRxTxTest(CmdArgs& args) else outname = args.outputFile; - WebRtc_UWord16 width = args.width; - WebRtc_UWord16 height = args.height; + uint16_t width = args.width; + uint16_t height = args.height; float frameRate = args.frameRate; float bitRate = args.bitRate; - WebRtc_Word32 numberOfCores = 1; + int32_t numberOfCores = 1; // error resilience/network // Nack support is currently not implemented in this test. bool nackEnabled = false; bool fecEnabled = false; - WebRtc_UWord8 rttMS = 20; + uint8_t rttMS = 20; float lossRate = 0.0*255; // no packet loss - WebRtc_UWord32 renderDelayMs = 0; - WebRtc_UWord32 minPlayoutDelayMs = 0; + uint32_t renderDelayMs = 0; + uint32_t minPlayoutDelayMs = 0; /* TEST SET-UP */ @@ -187,7 +187,7 @@ int MTRxTxTest(CmdArgs& args) // registering codecs for the VCM module VideoCodec sendCodec; vcm->InitializeSender(); - WebRtc_Word32 numberOfCodecs = vcm->NumberOfCodecs(); + int32_t numberOfCodecs = vcm->NumberOfCodecs(); if (numberOfCodecs < 1) { return -1; @@ -203,7 +203,7 @@ int MTRxTxTest(CmdArgs& args) sendCodec.startBitrate = (int) bitRate; sendCodec.height = height; sendCodec.width = width; - sendCodec.maxFramerate = (WebRtc_UWord8)frameRate; + sendCodec.maxFramerate = (uint8_t)frameRate; vcm->RegisterSendCodec(&sendCodec, numberOfCores, 1440); vcm->RegisterReceiveCodec(&sendCodec, numberOfCores); // same settings for encode and decode @@ -240,7 +240,7 @@ int MTRxTxTest(CmdArgs& args) rtp->SetNACKStatus(nackEnabled ? kNackRtcp : kNackOff, kMaxPacketAgeToNack); vcm->SetChannelParameters(static_cast(1000 * bitRate), - (WebRtc_UWord8) lossRate, rttMS); + (uint8_t) lossRate, rttMS); SharedRTPState mtState(*vcm, *rtp); // receive side SendSharedState mtSendState(*vcm, *rtp, args); // send side diff --git a/webrtc/modules/video_coding/main/test/mt_test_common.cc b/webrtc/modules/video_coding/main/test/mt_test_common.cc index e27f1660c..b93e1e942 100644 --- a/webrtc/modules/video_coding/main/test/mt_test_common.cc +++ b/webrtc/modules/video_coding/main/test/mt_test_common.cc @@ -34,7 +34,7 @@ TransportCallback::SendPacket(int channel, const void *data, int len) if (_rtpDump != NULL) { - if (_rtpDump->DumpPacket((const WebRtc_UWord8*)data, len) != 0) + if (_rtpDump->DumpPacket((const uint8_t*)data, len) != 0) { return -1; } @@ -58,8 +58,8 @@ TransportCallback::SendPacket(int channel, const void *data, int len) // Simulate receive time = network delay + packet jitter // simulated as a Normal distribution random variable with // mean = networkDelay and variance = jitterVar - WebRtc_Word32 - simulatedDelay = (WebRtc_Word32)NormalDist(_networkDelayMs, + int32_t + simulatedDelay = (int32_t)NormalDist(_networkDelayMs, sqrt(_jitterVar)); newPacket->receiveTime = now + simulatedDelay; _rtpPackets.push_back(newPacket); @@ -79,7 +79,7 @@ TransportCallback::TransportPackets() { // Take first packet in list packet = _rtpPackets.front(); - WebRtc_Word64 timeToReceive = packet->receiveTime - now; + int64_t timeToReceive = packet->receiveTime - now; if (timeToReceive > 0) { // No available packets to send @@ -88,7 +88,7 @@ TransportCallback::TransportPackets() _rtpPackets.pop_front(); // Send to receive side - if (_rtp->IncomingPacket((const WebRtc_UWord8*)packet->data, + if (_rtp->IncomingPacket((const uint8_t*)packet->data, packet->length) < 0) { delete packet; diff --git a/webrtc/modules/video_coding/main/test/mt_test_common.h b/webrtc/modules/video_coding/main/test/mt_test_common.h index e1ae0c6e0..2386085b7 100644 --- a/webrtc/modules/video_coding/main/test/mt_test_common.h +++ b/webrtc/modules/video_coding/main/test/mt_test_common.h @@ -38,8 +38,8 @@ public: webrtc::RtpRtcp& _rtp; CmdArgs _args; FILE* _sourceFile; - WebRtc_Word32 _frameCnt; - WebRtc_Word32 _timestamp; + int32_t _frameCnt; + int32_t _timestamp; }; // MT implementation of the RTPSendCompleteCallback (Transport) diff --git a/webrtc/modules/video_coding/main/test/normal_test.cc b/webrtc/modules/video_coding/main/test/normal_test.cc index c9d9efdd0..9d5dedf80 100644 --- a/webrtc/modules/video_coding/main/test/normal_test.cc +++ b/webrtc/modules/video_coding/main/test/normal_test.cc @@ -69,14 +69,14 @@ void VCMNTEncodeCompleteCallback::RegisterTransportCallback( { } -WebRtc_Word32 +int32_t VCMNTEncodeCompleteCallback::SendData( const FrameType frameType, - const WebRtc_UWord8 payloadType, - const WebRtc_UWord32 timeStamp, + const uint8_t payloadType, + const uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - const WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + const uint32_t payloadSize, const RTPFragmentationHeader& /*fragmentationHeader*/, const webrtc::RTPVideoHeader* videoHdr) @@ -131,13 +131,13 @@ VCMNTEncodeCompleteCallback::RegisterReceiverVCM(VideoCodingModule *vcm) _VCMReceiver = vcm; return; } - WebRtc_Word32 + int32_t VCMNTEncodeCompleteCallback::EncodedBytes() { return _encodedBytes; } -WebRtc_UWord32 +uint32_t VCMNTEncodeCompleteCallback::SkipCnt() { return _skipCnt; @@ -149,7 +149,7 @@ VCMNTDecodeCompleCallback::~VCMNTDecodeCompleCallback() if (_decodedFile) fclose(_decodedFile); } - WebRtc_Word32 + int32_t VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame) { if (videoFrame.width() != _currentWidth || @@ -172,7 +172,7 @@ VCMNTDecodeCompleCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame) return VCM_OK; } - WebRtc_Word32 + int32_t VCMNTDecodeCompleCallback::DecodedBytes() { return _decodedBytes; @@ -241,7 +241,7 @@ NormalTest::Setup(const CmdArgs& args) std::fstream::out | std::fstream::app); } -WebRtc_Word32 +int32_t NormalTest::Perform(const CmdArgs& args) { Setup(args); @@ -252,8 +252,8 @@ NormalTest::Perform(const CmdArgs& args) TEST(VideoCodingModule::Codec(_videoType, &_sendCodec) == VCM_OK); // should be later on changed via the API _sendCodec.startBitrate = (int)_bitRate; - _sendCodec.width = static_cast(_width); - _sendCodec.height = static_cast(_height); + _sendCodec.width = static_cast(_width); + _sendCodec.height = static_cast(_height); _sendCodec.maxFramerate = _frameRate; // will also set and init the desired codec TEST(_vcm->RegisterSendCodec(&_sendCodec, 4, 1400) == VCM_OK); @@ -276,12 +276,12 @@ NormalTest::Perform(const CmdArgs& args) int size_uv = half_width * half_height; sourceFrame.CreateEmptyFrame(_width, _height, _width, half_width, half_width); - WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; + uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame]; double startTime = clock()/(double)CLOCKS_PER_SEC; _vcm->SetChannelParameters(static_cast(1000 * _bitRate), 0, 0); SendStatsTest sendStats; - sendStats.set_framerate(static_cast(_frameRate)); + sendStats.set_framerate(static_cast(_frameRate)); sendStats.set_bitrate(1000 * _bitRate); _vcm->RegisterSendStatisticsCallback(&sendStats); @@ -295,11 +295,11 @@ NormalTest::Perform(const CmdArgs& args) _width, _height, _width, half_width, half_width); _timeStamp += - (WebRtc_UWord32)(9e4 / static_cast(_sendCodec.maxFramerate)); + (uint32_t)(9e4 / static_cast(_sendCodec.maxFramerate)); sourceFrame.set_timestamp(_timeStamp); _encodeTimes[int(sourceFrame.timestamp())] = clock()/(double)CLOCKS_PER_SEC; - WebRtc_Word32 ret = _vcm->AddVideoFrame(sourceFrame); + int32_t ret = _vcm->AddVideoFrame(sourceFrame); double encodeTime = clock()/(double)CLOCKS_PER_SEC - _encodeTimes[int(sourceFrame.timestamp())]; _totalEncodeTime += encodeTime; @@ -322,8 +322,8 @@ NormalTest::Perform(const CmdArgs& args) { _vcm->Process(); } - WebRtc_UWord32 framePeriod = - static_cast( + uint32_t framePeriod = + static_cast( 1000.0f / static_cast(_sendCodec.maxFramerate) + 0.5f); static_cast(_clock)->AdvanceTimeMilliseconds(framePeriod); } @@ -339,7 +339,7 @@ NormalTest::Perform(const CmdArgs& args) } void -NormalTest::FrameEncoded(WebRtc_UWord32 timeStamp) +NormalTest::FrameEncoded(uint32_t timeStamp) { _encodeCompleteTime = clock()/(double)CLOCKS_PER_SEC; _encFrameCnt++; @@ -348,7 +348,7 @@ NormalTest::FrameEncoded(WebRtc_UWord32 timeStamp) } void -NormalTest::FrameDecoded(WebRtc_UWord32 timeStamp) +NormalTest::FrameDecoded(uint32_t timeStamp) { _decodeCompleteTime = clock()/(double)CLOCKS_PER_SEC; _decFrameCnt++; diff --git a/webrtc/modules/video_coding/main/test/normal_test.h b/webrtc/modules/video_coding/main/test/normal_test.h index 14d55a161..8fc0e1f35 100644 --- a/webrtc/modules/video_coding/main/test/normal_test.h +++ b/webrtc/modules/video_coding/main/test/normal_test.h @@ -30,13 +30,13 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback void RegisterTransportCallback(webrtc::VCMPacketizationCallback* transport); // process encoded data received from the encoder, // pass stream to the VCMReceiver module - WebRtc_Word32 + int32_t SendData(const webrtc::FrameType frameType, - const WebRtc_UWord8 payloadType, - const WebRtc_UWord32 timeStamp, + const uint8_t payloadType, + const uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - const WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + const uint32_t payloadSize, const webrtc::RTPFragmentationHeader& fragmentationHeader, const webrtc::RTPVideoHeader* videoHdr); @@ -44,19 +44,19 @@ class VCMNTEncodeCompleteCallback : public webrtc::VCMPacketizationCallback // Currently - encode and decode with the same vcm module. void RegisterReceiverVCM(webrtc::VideoCodingModule *vcm); // Return sum of encoded data (all frames in the sequence) - WebRtc_Word32 EncodedBytes(); + int32_t EncodedBytes(); // return number of encoder-skipped frames - WebRtc_UWord32 SkipCnt();; + uint32_t SkipCnt();; // conversion function for payload type (needed for the callback function) -// RTPVideoVideoCodecTypes ConvertPayloadType(WebRtc_UWord8 payloadType); +// RTPVideoVideoCodecTypes ConvertPayloadType(uint8_t payloadType); private: FILE* _encodedFile; - WebRtc_UWord32 _encodedBytes; - WebRtc_UWord32 _skipCnt; + uint32_t _encodedBytes; + uint32_t _skipCnt; webrtc::VideoCodingModule* _VCMReceiver; webrtc::FrameType _frameType; - WebRtc_UWord16 _seqNo; + uint16_t _seqNo; NormalTest& _test; }; // end of VCMEncodeCompleteCallback @@ -72,8 +72,8 @@ public: virtual ~VCMNTDecodeCompleCallback(); void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback); // will write decoded frame into file - WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame); - WebRtc_Word32 DecodedBytes(); + int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame); + int32_t DecodedBytes(); private: FILE* _decodedFile; std::string _outname; @@ -89,7 +89,7 @@ public: webrtc::Clock* clock); ~NormalTest(); static int RunTest(const CmdArgs& args); - WebRtc_Word32 Perform(const CmdArgs& args); + int32_t Perform(const CmdArgs& args); // option:: turn into private and call from perform int Width() const { return _width; }; int Height() const { return _height; }; @@ -104,9 +104,9 @@ protected: // print results to std output and to log file void Print(); // calculating pipeline delay, and encoding time - void FrameEncoded(WebRtc_UWord32 timeStamp); + void FrameEncoded(uint32_t timeStamp); // calculating pipeline delay, and decoding time - void FrameDecoded(WebRtc_UWord32 timeStamp); + void FrameDecoded(uint32_t timeStamp); webrtc::Clock* _clock; webrtc::VideoCodingModule* _vcm; @@ -115,7 +115,7 @@ protected: std::string _inname; std::string _outname; std::string _encodedName; - WebRtc_Word32 _sumEncBytes; + int32_t _sumEncBytes; FILE* _sourceFile; FILE* _decodedFile; FILE* _encodedFile; @@ -124,8 +124,8 @@ protected: int _height; float _frameRate; float _bitRate; - WebRtc_UWord32 _lengthSourceFrame; - WebRtc_UWord32 _timeStamp; + uint32_t _lengthSourceFrame; + uint32_t _timeStamp; webrtc::VideoCodecType _videoType; double _totalEncodeTime; double _totalDecodeTime; @@ -136,9 +136,9 @@ protected: double _testTotalTime; std::map _encodeTimes; std::map _decodeTimes; - WebRtc_Word32 _frameCnt; - WebRtc_Word32 _encFrameCnt; - WebRtc_Word32 _decFrameCnt; + int32_t _frameCnt; + int32_t _encFrameCnt; + int32_t _decFrameCnt; }; // end of VCMNormalTestClass diff --git a/webrtc/modules/video_coding/main/test/quality_modes_test.cc b/webrtc/modules/video_coding/main/test/quality_modes_test.cc index 4611a405a..d582b1c92 100644 --- a/webrtc/modules/video_coding/main/test/quality_modes_test.cc +++ b/webrtc/modules/video_coding/main/test/quality_modes_test.cc @@ -172,7 +172,7 @@ QualityModesTest::Teardown() return; } -WebRtc_Word32 +int32_t QualityModesTest::Perform(const CmdArgs& args) { Setup(args); @@ -182,24 +182,24 @@ QualityModesTest::Perform(const CmdArgs& args) // frame num at which an update will occur const int updateFrameNum[] = {10000}; - WebRtc_UWord32 numChanges = sizeof(updateFrameNum)/sizeof(*updateFrameNum); - WebRtc_UWord8 change = 0;// change counter + uint32_t numChanges = sizeof(updateFrameNum)/sizeof(*updateFrameNum); + uint8_t change = 0;// change counter _vpm = VideoProcessingModule::Create(1); EventWrapper* waitEvent = EventWrapper::Create(); VideoCodec codec;//both send and receive _vcm->InitializeReceiver(); _vcm->InitializeSender(); - WebRtc_Word32 NumberOfCodecs = _vcm->NumberOfCodecs(); + int32_t NumberOfCodecs = _vcm->NumberOfCodecs(); for (int i = 0; i < NumberOfCodecs; i++) { _vcm->Codec(i, &codec); if(strncmp(codec.plName,"VP8" , 5) == 0) { codec.startBitrate = (int)_bitRate; - codec.maxFramerate = (WebRtc_UWord8) _frameRate; - codec.width = (WebRtc_UWord16)_width; - codec.height = (WebRtc_UWord16)_height; + codec.maxFramerate = (uint8_t) _frameRate; + codec.width = (uint16_t)_width; + codec.height = (uint16_t)_height; codec.codecSpecific.VP8.frameDroppingOn = false; // Will also set and init the desired codec @@ -237,27 +237,27 @@ QualityModesTest::Perform(const CmdArgs& args) I420VideoFrame sourceFrame; I420VideoFrame *decimatedFrame = NULL; - WebRtc_UWord8* tmpBuffer = new WebRtc_UWord8[_lengthSourceFrame]; + uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame]; double startTime = clock()/(double)CLOCKS_PER_SEC; _vcm->SetChannelParameters(static_cast(1000 * _bitRate), 0, 0); SendStatsTest sendStats; - sendStats.set_framerate(static_cast(_frameRate)); + sendStats.set_framerate(static_cast(_frameRate)); sendStats.set_bitrate(1000 * _bitRate); _vcm->RegisterSendStatisticsCallback(&sendStats); VideoContentMetrics* contentMetrics = NULL; // setting user frame rate - _vpm->SetMaxFrameRate((WebRtc_UWord32)(_nativeFrameRate+ 0.5f)); + _vpm->SetMaxFrameRate((uint32_t)(_nativeFrameRate+ 0.5f)); // for starters: keeping native values: _vpm->SetTargetResolution(_width, _height, - (WebRtc_UWord32)(_frameRate+ 0.5f)); + (uint32_t)(_frameRate+ 0.5f)); _decodeCallback.SetOriginalFrameDimensions(_nativeWidth, _nativeHeight); //tmp - disabling VPM frame dropping _vpm->EnableTemporalDecimation(false); - WebRtc_Word32 ret = 0; + int32_t ret = 0; _numFramesDroppedVPM = 0; do { @@ -273,7 +273,7 @@ QualityModesTest::Perform(const CmdArgs& args) (_nativeWidth + 1) / 2); _timeStamp += - (WebRtc_UWord32)(9e4 / static_cast(codec.maxFramerate)); + (uint32_t)(9e4 / static_cast(codec.maxFramerate)); sourceFrame.set_timestamp(_timeStamp); ret = _vpm->PreprocessFrame(sourceFrame, &decimatedFrame); @@ -303,7 +303,7 @@ QualityModesTest::Perform(const CmdArgs& args) _encodeTimes[int(sourceFrame.timestamp())] = clock()/(double)CLOCKS_PER_SEC; - WebRtc_Word32 ret = _vcm->AddVideoFrame(*decimatedFrame, contentMetrics); + int32_t ret = _vcm->AddVideoFrame(*decimatedFrame, contentMetrics); _totalEncodeTime += clock()/(double)CLOCKS_PER_SEC - _encodeTimes[int(sourceFrame.timestamp())]; @@ -345,7 +345,7 @@ QualityModesTest::Perform(const CmdArgs& args) _bitRate = bitRateUpdate[change]; _frameRate = frameRateUpdate[change]; codec.startBitrate = (int)_bitRate; - codec.maxFramerate = (WebRtc_UWord8) _frameRate; + codec.maxFramerate = (uint8_t) _frameRate; // Will also set and init the desired codec TEST(_vcm->RegisterSendCodec(&codec, 2, 1440) == VCM_OK); change++; @@ -421,12 +421,12 @@ QMTestVideoSettingsCallback::Updated() return false; } -WebRtc_Word32 -QMTestVideoSettingsCallback::SetVideoQMSettings(const WebRtc_UWord32 frameRate, - const WebRtc_UWord32 width, - const WebRtc_UWord32 height) +int32_t +QMTestVideoSettingsCallback::SetVideoQMSettings(const uint32_t frameRate, + const uint32_t width, + const uint32_t height) { - WebRtc_Word32 retVal = 0; + int32_t retVal = 0; printf("QM updates: W = %d, H = %d, FR = %d, \n", width, height, frameRate); retVal = _vpm->SetTargetResolution(width, height, frameRate); //Initialize codec with new values - is this the best place to do it? @@ -436,9 +436,9 @@ QMTestVideoSettingsCallback::SetVideoQMSettings(const WebRtc_UWord32 frameRate, VideoCodec currentCodec; _vcm->SendCodec(¤tCodec); // now set new values: - currentCodec.height = (WebRtc_UWord16)height; - currentCodec.width = (WebRtc_UWord16)width; - currentCodec.maxFramerate = (WebRtc_UWord8)frameRate; + currentCodec.height = (uint16_t)height; + currentCodec.width = (uint16_t)width; + currentCodec.maxFramerate = (uint8_t)frameRate; // re-register encoder retVal = _vcm->RegisterSendCodec(¤tCodec, 2, 1440); @@ -482,7 +482,7 @@ VCMQMDecodeCompleCallback::~VCMQMDecodeCompleCallback() } } -WebRtc_Word32 +int32_t VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame) { ++frames_cnt_since_drop_; @@ -537,26 +537,26 @@ VCMQMDecodeCompleCallback::FrameToRender(I420VideoFrame& videoFrame) return VCM_OK; } -WebRtc_Word32 VCMQMDecodeCompleCallback::DecodedBytes() +int32_t VCMQMDecodeCompleCallback::DecodedBytes() { return _decodedBytes; } -void VCMQMDecodeCompleCallback::SetOriginalFrameDimensions(WebRtc_Word32 width, - WebRtc_Word32 height) +void VCMQMDecodeCompleCallback::SetOriginalFrameDimensions(int32_t width, + int32_t height) { _origWidth = width; _origHeight = height; } -WebRtc_Word32 VCMQMDecodeCompleCallback::buildInterpolator() +int32_t VCMQMDecodeCompleCallback::buildInterpolator() { - WebRtc_UWord32 decFrameLength = _origWidth*_origHeight*3 >> 1; + uint32_t decFrameLength = _origWidth*_origHeight*3 >> 1; if (_decBuffer != NULL) { delete [] _decBuffer; } - _decBuffer = new WebRtc_UWord8[decFrameLength]; + _decBuffer = new uint8_t[decFrameLength]; if (_decBuffer == NULL) { return -1; diff --git a/webrtc/modules/video_coding/main/test/quality_modes_test.h b/webrtc/modules/video_coding/main/test/quality_modes_test.h index 0bb7e0945..5ed4ffd84 100644 --- a/webrtc/modules/video_coding/main/test/quality_modes_test.h +++ b/webrtc/modules/video_coding/main/test/quality_modes_test.h @@ -24,7 +24,7 @@ public: QualityModesTest(webrtc::VideoCodingModule* vcm, webrtc::Clock* clock); virtual ~QualityModesTest(); - WebRtc_Word32 Perform(const CmdArgs& args); + int32_t Perform(const CmdArgs& args); private: @@ -42,7 +42,7 @@ private: int _nativeHeight; float _nativeFrameRate; - WebRtc_UWord32 _numFramesDroppedVPM; + uint32_t _numFramesDroppedVPM; bool _flagSSIM; std::string filename_testvideo_; std::string fv_outfilename_; @@ -61,24 +61,24 @@ public: virtual ~VCMQMDecodeCompleCallback(); void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback); // will write decoded frame into file - WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame); - WebRtc_Word32 DecodedBytes(); - void SetOriginalFrameDimensions(WebRtc_Word32 width, WebRtc_Word32 height); - WebRtc_Word32 buildInterpolator(); + int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame); + int32_t DecodedBytes(); + void SetOriginalFrameDimensions(int32_t width, int32_t height); + int32_t buildInterpolator(); // Check if last frame is dropped, if so, repeat the last rendered frame. void WriteEnd(int input_tot_frame_count); private: FILE* _decodedFile; - WebRtc_UWord32 _decodedBytes; + uint32_t _decodedBytes; // QualityModesTest& _test; int _origWidth; int _origHeight; int _decWidth; int _decHeight; // VideoInterpolator* _interpolator; - WebRtc_UWord8* _decBuffer; - WebRtc_UWord32 _frameCnt; // debug + uint8_t* _decBuffer; + uint32_t _frameCnt; // debug webrtc::I420VideoFrame last_frame_; int frame_rate_; int frames_cnt_since_drop_; @@ -93,9 +93,9 @@ class QMTestVideoSettingsCallback : public webrtc::VCMQMSettingsCallback public: QMTestVideoSettingsCallback(); // update VPM with QM settings - WebRtc_Word32 SetVideoQMSettings(const WebRtc_UWord32 frameRate, - const WebRtc_UWord32 width, - const WebRtc_UWord32 height); + int32_t SetVideoQMSettings(const uint32_t frameRate, + const uint32_t width, + const uint32_t height); // register VPM used by test void RegisterVPM(webrtc::VideoProcessingModule* vpm); void RegisterVCM(webrtc::VideoCodingModule* vcm); diff --git a/webrtc/modules/video_coding/main/test/receiver_tests.h b/webrtc/modules/video_coding/main/test/receiver_tests.h index 7ecc28dcb..079fd6125 100644 --- a/webrtc/modules/video_coding/main/test/receiver_tests.h +++ b/webrtc/modules/video_coding/main/test/receiver_tests.h @@ -28,8 +28,8 @@ public: RtpDataCallback(webrtc::VideoCodingModule* vcm) : _vcm(vcm) {}; - virtual WebRtc_Word32 OnReceivedPayloadData(const WebRtc_UWord8* payloadData, - const WebRtc_UWord16 payloadSize, + virtual int32_t OnReceivedPayloadData(const uint8_t* payloadData, + const uint16_t payloadSize, const webrtc::WebRtcRTPHeader* rtpHeader); private: webrtc::VideoCodingModule* _vcm; @@ -48,7 +48,7 @@ public: virtual ~FrameReceiveCallback(); - WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame); + int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame); private: static void SplitFilename(std::string filename, std::string* basename, diff --git a/webrtc/modules/video_coding/main/test/receiver_timing_tests.cc b/webrtc/modules/video_coding/main/test/receiver_timing_tests.cc index 7b64f0990..f809d07ee 100644 --- a/webrtc/modules/video_coding/main/test/receiver_timing_tests.cc +++ b/webrtc/modules/video_coding/main/test/receiver_timing_tests.cc @@ -58,23 +58,23 @@ int ReceiverTimingTests(CmdArgs& args) Clock* clock = Clock::GetRealTimeClock(); VCMTiming timing(clock); float clockInMs = 0.0; - WebRtc_UWord32 waitTime = 0; - WebRtc_UWord32 jitterDelayMs = 0; - WebRtc_UWord32 maxDecodeTimeMs = 0; - WebRtc_UWord32 timeStamp = 0; + uint32_t waitTime = 0; + uint32_t jitterDelayMs = 0; + uint32_t maxDecodeTimeMs = 0; + uint32_t timeStamp = 0; - timing.Reset(static_cast(clockInMs + 0.5)); + timing.Reset(static_cast(clockInMs + 0.5)); timing.UpdateCurrentDelay(timeStamp); - timing.Reset(static_cast(clockInMs + 0.5)); + timing.Reset(static_cast(clockInMs + 0.5)); - timing.IncomingTimestamp(timeStamp, static_cast(clockInMs + 0.5)); + timing.IncomingTimestamp(timeStamp, static_cast(clockInMs + 0.5)); jitterDelayMs = 20; timing.SetRequiredDelay(jitterDelayMs); timing.UpdateCurrentDelay(timeStamp); - waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), - static_cast(clockInMs + 0.5)); + waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), + static_cast(clockInMs + 0.5)); // First update initializes the render time. Since we have no decode delay // we get waitTime = renderTime - now - renderDelay = jitter TEST(waitTime == jitterDelayMs); @@ -84,8 +84,8 @@ int ReceiverTimingTests(CmdArgs& args) clockInMs += 1000.0f; timing.SetRequiredDelay(jitterDelayMs); timing.UpdateCurrentDelay(timeStamp); - waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), - static_cast(clockInMs + 0.5)); + waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), + static_cast(clockInMs + 0.5)); // Since we gradually increase the delay we only get // 100 ms every second. TEST(waitTime == jitterDelayMs - 10); @@ -93,8 +93,8 @@ int ReceiverTimingTests(CmdArgs& args) timeStamp += 90000; clockInMs += 1000.0; timing.UpdateCurrentDelay(timeStamp); - waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), - static_cast(clockInMs + 0.5)); + waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), + static_cast(clockInMs + 0.5)); TEST(waitTime == jitterDelayMs); // 300 incoming frames without jitter, verify that this gives the exact wait time @@ -102,41 +102,41 @@ int ReceiverTimingTests(CmdArgs& args) { clockInMs += 1000.0f/30.0f; timeStamp += 3000; - timing.IncomingTimestamp(timeStamp, static_cast(clockInMs + 0.5)); + timing.IncomingTimestamp(timeStamp, static_cast(clockInMs + 0.5)); } timing.UpdateCurrentDelay(timeStamp); - waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), - static_cast(clockInMs + 0.5)); + waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), + static_cast(clockInMs + 0.5)); TEST(waitTime == jitterDelayMs); // Add decode time estimates for (int i=0; i < 10; i++) { - WebRtc_Word64 startTimeMs = static_cast(clockInMs + 0.5); + int64_t startTimeMs = static_cast(clockInMs + 0.5); clockInMs += 10.0f; - timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast(clockInMs + 0.5)); + timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast(clockInMs + 0.5)); timeStamp += 3000; clockInMs += 1000.0f/30.0f - 10.0f; - timing.IncomingTimestamp(timeStamp, static_cast(clockInMs + 0.5)); + timing.IncomingTimestamp(timeStamp, static_cast(clockInMs + 0.5)); } maxDecodeTimeMs = 10; timing.SetRequiredDelay(jitterDelayMs); clockInMs += 1000.0f; timeStamp += 90000; timing.UpdateCurrentDelay(timeStamp); - waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), - static_cast(clockInMs + 0.5)); + waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), + static_cast(clockInMs + 0.5)); TEST(waitTime == jitterDelayMs); - WebRtc_UWord32 totalDelay1 = timing.TargetVideoDelay(); - WebRtc_UWord32 minTotalDelayMs = 200; + uint32_t totalDelay1 = timing.TargetVideoDelay(); + uint32_t minTotalDelayMs = 200; timing.SetMinimumTotalDelay(minTotalDelayMs); clockInMs += 5000.0f; timeStamp += 5*90000; timing.UpdateCurrentDelay(timeStamp); - waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), - static_cast(clockInMs + 0.5)); - WebRtc_UWord32 totalDelay2 = timing.TargetVideoDelay(); + waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), + static_cast(clockInMs + 0.5)); + uint32_t totalDelay2 = timing.TargetVideoDelay(); // We should at least have minTotalDelayMs - decodeTime (10) - renderTime (10) to wait TEST(waitTime == minTotalDelayMs - maxDecodeTimeMs - 10); // The total video delay should not increase with the extra delay, @@ -151,8 +151,8 @@ int ReceiverTimingTests(CmdArgs& args) // A sudden increase in timestamp of 2.1 seconds clockInMs += 1000.0f/30.0f; - timeStamp += static_cast(2.1*90000 + 0.5); - WebRtc_Word64 ret = timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)); + timeStamp += static_cast(2.1*90000 + 0.5); + int64_t ret = timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)); TEST(ret == -1); timing.Reset(); @@ -164,9 +164,9 @@ int ReceiverTimingTests(CmdArgs& args) jitterDelayMs = 60; maxDecodeTimeMs = 10; - timeStamp = static_cast(-10000); // To produce a wrap + timeStamp = static_cast(-10000); // To produce a wrap clockInMs = 10000.0f; - timing.Reset(static_cast(clockInMs + 0.5)); + timing.Reset(static_cast(clockInMs + 0.5)); float noise = 0.0f; for (int i=0; i < 1400; i++) @@ -189,23 +189,23 @@ int ReceiverTimingTests(CmdArgs& args) minTotalDelayMs = 0; timing.SetMinimumTotalDelay(minTotalDelayMs); } - WebRtc_Word64 startTimeMs = static_cast(clockInMs + 0.5); + int64_t startTimeMs = static_cast(clockInMs + 0.5); noise = vcmFloatMin(vcmFloatMax(GaussDist::RandValue(0, 2), -10.0f), 30.0f); clockInMs += 10.0f; - timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast(clockInMs + noise + 0.5)); + timing.StopDecodeTimer(timeStamp, startTimeMs, static_cast(clockInMs + noise + 0.5)); timeStamp += 3000; clockInMs += 1000.0f/30.0f - 10.0f; noise = vcmFloatMin(vcmFloatMax(GaussDist::RandValue(0, 8), -15.0f), 15.0f); - timing.IncomingTimestamp(timeStamp, static_cast(clockInMs + noise + 0.5)); + timing.IncomingTimestamp(timeStamp, static_cast(clockInMs + noise + 0.5)); timing.SetRequiredDelay(jitterDelayMs); timing.UpdateCurrentDelay(timeStamp); - waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), - static_cast(clockInMs + 0.5)); + waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)), + static_cast(clockInMs + 0.5)); WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, -1, "timeStamp=%u clock=%u maxWaitTime=%u", timeStamp, - static_cast(clockInMs + 0.5), waitTime); + static_cast(clockInMs + 0.5), waitTime); - WebRtc_Word64 renderTimeMs = timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)); + int64_t renderTimeMs = timing.RenderTimeMs(timeStamp, static_cast(clockInMs + 0.5)); WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, -1, "timeStamp=%u renderTime=%u", diff --git a/webrtc/modules/video_coding/main/test/rtp_player.cc b/webrtc/modules/video_coding/main/test/rtp_player.cc index 20ae1aed1..2487ef4a2 100644 --- a/webrtc/modules/video_coding/main/test/rtp_player.cc +++ b/webrtc/modules/video_coding/main/test/rtp_player.cc @@ -178,7 +178,7 @@ RTPPlayer::~RTPPlayer() } } -WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList) +int32_t RTPPlayer::Initialize(const PayloadTypeList* payloadList) { RtpRtcp::Configuration configuration; configuration.id = 1; @@ -192,7 +192,7 @@ WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList) _randVec[i] = rand(); } _randVecPos = 0; - WebRtc_Word32 ret = _rtpModule->SetNACKStatus(kNackOff, + int32_t ret = _rtpModule->SetNACKStatus(kNackOff, kMaxPacketAgeToNack); if (ret < 0) { @@ -229,7 +229,7 @@ WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList) return 0; } -WebRtc_Word32 RTPPlayer::ReadHeader() +int32_t RTPPlayer::ReadHeader() { char firstline[FIRSTLINELEN]; if (_rtpFile == NULL) @@ -254,11 +254,11 @@ WebRtc_Word32 RTPPlayer::ReadHeader() return -1; } - WebRtc_UWord32 start_sec; - WebRtc_UWord32 start_usec; - WebRtc_UWord32 source; - WebRtc_UWord16 port; - WebRtc_UWord16 padding; + uint32_t start_sec; + uint32_t start_usec; + uint32_t source; + uint16_t port; + uint16_t padding; EXPECT_GT(fread(&start_sec, 4, 1, _rtpFile), 0u); start_sec=ntohl(start_sec); @@ -273,18 +273,18 @@ WebRtc_Word32 RTPPlayer::ReadHeader() return 0; } -WebRtc_UWord32 RTPPlayer::TimeUntilNextPacket() const +uint32_t RTPPlayer::TimeUntilNextPacket() const { - WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) - + int64_t timeLeft = (_nextRtpTime - _firstPacketRtpTime) - (_clock->TimeInMilliseconds() - _firstPacketTimeMs); if (timeLeft < 0) { return 0; } - return static_cast(timeLeft); + return static_cast(timeLeft); } -WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow) +int32_t RTPPlayer::NextPacket(const int64_t timeNow) { // Send any packets ready to be resent, RawRtpPacket* resend_packet = _lostPackets.NextPacketToResend(timeNow); @@ -309,15 +309,15 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow) _rtpModule->Process(); if (_firstPacket) { - _firstPacketRtpTime = static_cast(_nextRtpTime); + _firstPacketRtpTime = static_cast(_nextRtpTime); _firstPacketTimeMs = _clock->TimeInMilliseconds(); } if (_reordering && _reorderBuffer == NULL) { - _reorderBuffer = new RawRtpPacket(reinterpret_cast(_nextPacket), static_cast(_nextPacketLength)); + _reorderBuffer = new RawRtpPacket(reinterpret_cast(_nextPacket), static_cast(_nextPacketLength)); return 0; } - WebRtc_Word32 ret = SendPacket(reinterpret_cast(_nextPacket), static_cast(_nextPacketLength)); + int32_t ret = SendPacket(reinterpret_cast(_nextPacket), static_cast(_nextPacketLength)); if (_reordering && _reorderBuffer != NULL) { RawRtpPacket* rtpPacket = _reorderBuffer; @@ -348,14 +348,14 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow) return 0; } -WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen) +int32_t RTPPlayer::SendPacket(uint8_t* rtpData, uint16_t rtpLen) { if ((_randVec[(_randVecPos++) % RAND_VEC_LENGTH] + 1.0)/(RAND_MAX + 1.0) < _lossRate && _noLossStartup < 0) { if (_nackEnabled) { - const WebRtc_UWord16 seqNo = (rtpData[2] << 8) + rtpData[3]; + const uint16_t seqNo = (rtpData[2] << 8) + rtpData[3]; printf("Throw: %u\n", seqNo); _lostPackets.AddPacket(new RawRtpPacket(rtpData, rtpLen)); return 0; @@ -363,7 +363,7 @@ WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLe } else if (rtpLen > 0) { - WebRtc_Word32 ret = _rtpModule->IncomingPacket(rtpData, rtpLen); + int32_t ret = _rtpModule->IncomingPacket(rtpData, rtpLen); if (ret < 0) { return -1; @@ -376,9 +376,9 @@ WebRtc_Word32 RTPPlayer::SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLe return 1; } -WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset) +int32_t RTPPlayer::ReadPacket(int16_t* rtpdata, uint32_t* offset) { - WebRtc_UWord16 length, plen; + uint16_t length, plen; if (fread(&length,2,1,_rtpFile)==0) return(-1); @@ -393,7 +393,7 @@ WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offs *offset=ntohl(*offset); // Use length here because a plen of 0 specifies rtcp - length = (WebRtc_UWord16) (length - HDR_SIZE); + length = (uint16_t) (length - HDR_SIZE); if (fread((unsigned short *) rtpdata,1,length,_rtpFile) != length) return(-1); @@ -408,7 +408,7 @@ WebRtc_Word32 RTPPlayer::ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offs return plen; } -WebRtc_Word32 RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, WebRtc_UWord32 rttMs) +int32_t RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, uint32_t rttMs) { _nackEnabled = enableNack; _lossRate = lossRate; @@ -416,13 +416,13 @@ WebRtc_Word32 RTPPlayer::SimulatePacketLoss(float lossRate, bool enableNack, Web return 0; } -WebRtc_Word32 RTPPlayer::SetReordering(bool enabled) +int32_t RTPPlayer::SetReordering(bool enabled) { _reordering = enabled; return 0; } -WebRtc_Word32 RTPPlayer::ResendPackets(const WebRtc_UWord16* sequenceNumbers, WebRtc_UWord16 length) +int32_t RTPPlayer::ResendPackets(const uint16_t* sequenceNumbers, uint16_t length) { if (sequenceNumbers == NULL) { diff --git a/webrtc/modules/video_coding/main/test/rtp_player.h b/webrtc/modules/video_coding/main/test/rtp_player.h index d6b073469..4d615d8c3 100644 --- a/webrtc/modules/video_coding/main/test/rtp_player.h +++ b/webrtc/modules/video_coding/main/test/rtp_player.h @@ -30,7 +30,7 @@ struct PayloadCodecTuple; struct RawRtpPacket { public: - RawRtpPacket(WebRtc_UWord8* rtp_data, WebRtc_UWord16 rtp_length); + RawRtpPacket(uint8_t* rtp_data, uint16_t rtp_length); ~RawRtpPacket(); uint8_t* data; @@ -66,10 +66,10 @@ class LostPackets { struct PayloadCodecTuple { - PayloadCodecTuple(WebRtc_UWord8 plType, std::string codecName, webrtc::VideoCodecType type) : + PayloadCodecTuple(uint8_t plType, std::string codecName, webrtc::VideoCodecType type) : name(codecName), payloadType(plType), codecType(type) {}; const std::string name; - const WebRtc_UWord8 payloadType; + const uint8_t payloadType; const webrtc::VideoCodecType codecType; }; @@ -81,37 +81,37 @@ public: webrtc::Clock* clock); virtual ~RTPPlayer(); - WebRtc_Word32 Initialize(const PayloadTypeList* payloadList); - WebRtc_Word32 NextPacket(const WebRtc_Word64 timeNow); - WebRtc_UWord32 TimeUntilNextPacket() const; - WebRtc_Word32 SimulatePacketLoss(float lossRate, bool enableNack = false, WebRtc_UWord32 rttMs = 0); - WebRtc_Word32 SetReordering(bool enabled); - WebRtc_Word32 ResendPackets(const WebRtc_UWord16* sequenceNumbers, WebRtc_UWord16 length); + int32_t Initialize(const PayloadTypeList* payloadList); + int32_t NextPacket(const int64_t timeNow); + uint32_t TimeUntilNextPacket() const; + int32_t SimulatePacketLoss(float lossRate, bool enableNack = false, uint32_t rttMs = 0); + int32_t SetReordering(bool enabled); + int32_t ResendPackets(const uint16_t* sequenceNumbers, uint16_t length); void Print() const; private: - WebRtc_Word32 SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen); - WebRtc_Word32 ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset); - WebRtc_Word32 ReadHeader(); + int32_t SendPacket(uint8_t* rtpData, uint16_t rtpLen); + int32_t ReadPacket(int16_t* rtpdata, uint32_t* offset); + int32_t ReadHeader(); webrtc::Clock* _clock; FILE* _rtpFile; webrtc::RtpRtcp* _rtpModule; - WebRtc_UWord32 _nextRtpTime; + uint32_t _nextRtpTime; webrtc::RtpData* _dataCallback; bool _firstPacket; float _lossRate; bool _nackEnabled; LostPackets _lostPackets; - WebRtc_UWord32 _resendPacketCount; - WebRtc_Word32 _noLossStartup; + uint32_t _resendPacketCount; + int32_t _noLossStartup; bool _endOfFile; - WebRtc_UWord32 _rttMs; - WebRtc_Word64 _firstPacketRtpTime; - WebRtc_Word64 _firstPacketTimeMs; + uint32_t _rttMs; + int64_t _firstPacketRtpTime; + int64_t _firstPacketTimeMs; RawRtpPacket* _reorderBuffer; bool _reordering; - WebRtc_Word16 _nextPacket[8000]; - WebRtc_Word32 _nextPacketLength; + int16_t _nextPacket[8000]; + int32_t _nextPacketLength; int _randVec[RAND_VEC_LENGTH]; int _randVecPos; }; diff --git a/webrtc/modules/video_coding/main/test/test_callbacks.cc b/webrtc/modules/video_coding/main/test/test_callbacks.cc index 9119dd2d3..e972e2349 100644 --- a/webrtc/modules/video_coding/main/test/test_callbacks.cc +++ b/webrtc/modules/video_coding/main/test/test_callbacks.cc @@ -47,14 +47,14 @@ VCMEncodeCompleteCallback::RegisterTransportCallback( { } -WebRtc_Word32 +int32_t VCMEncodeCompleteCallback::SendData( const FrameType frameType, - const WebRtc_UWord8 payloadType, - const WebRtc_UWord32 timeStamp, + const uint8_t payloadType, + const uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - const WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + const uint32_t payloadSize, const RTPFragmentationHeader& fragmentationHeader, const RTPVideoHeader* videoHdr) { @@ -68,8 +68,8 @@ VCMEncodeCompleteCallback::SendData( rtpInfo.header.markerBit = true; // end of frame rtpInfo.type.Video.isFirstPacket = true; rtpInfo.type.Video.codec = _codecType; - rtpInfo.type.Video.height = (WebRtc_UWord16)_height; - rtpInfo.type.Video.width = (WebRtc_UWord16)_width; + rtpInfo.type.Video.height = (uint16_t)_height; + rtpInfo.type.Video.width = (uint16_t)_width; switch (_codecType) { case webrtc::kRTPVideoVP8: @@ -141,14 +141,14 @@ VCMEncodeCompleteCallback::ResetByteCount() // passes the encoded frame via the RTP module to the decoder // Packetization callback implementation -WebRtc_Word32 +int32_t VCMRTPEncodeCompleteCallback::SendData( const FrameType frameType, - const WebRtc_UWord8 payloadType, - const WebRtc_UWord32 timeStamp, + const uint8_t payloadType, + const uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - const WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + const uint32_t payloadSize, const RTPFragmentationHeader& fragmentationHeader, const RTPVideoHeader* videoHdr) { @@ -187,7 +187,7 @@ VCMRTPEncodeCompleteCallback::EncodeComplete() // Decoded Frame Callback Implementation -WebRtc_Word32 +int32_t VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame) { if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) { @@ -198,7 +198,7 @@ VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame) return VCM_OK; } -WebRtc_Word32 +int32_t VCMDecodeCompleteCallback::DecodedBytes() { return _decodedBytes; @@ -249,7 +249,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len) if (_rtpDump != NULL) { - if (_rtpDump->DumpPacket((const WebRtc_UWord8*)data, len) != 0) + if (_rtpDump->DumpPacket((const uint8_t*)data, len) != 0) { return -1; } @@ -268,8 +268,8 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len) // Simulate receive time = network delay + packet jitter // simulated as a Normal distribution random variable with // mean = networkDelay and variance = jitterVar - WebRtc_Word32 - simulatedDelay = (WebRtc_Word32)NormalDist(_networkDelayMs, + int32_t + simulatedDelay = (int32_t)NormalDist(_networkDelayMs, sqrt(_jitterVar)); newPacket->receiveTime = now + simulatedDelay; _rtpPackets.push_back(newPacket); @@ -282,7 +282,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len) { // Take first packet in list packet = _rtpPackets.front(); - WebRtc_Word64 timeToReceive = packet->receiveTime - now; + int64_t timeToReceive = packet->receiveTime - now; if (timeToReceive > 0) { // No available packets to send @@ -292,7 +292,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len) _rtpPackets.pop_front(); assert(_rtp); // We must have a configured RTP module for this test. // Send to receive side - if (_rtp->IncomingPacket((const WebRtc_UWord8*)packet->data, + if (_rtp->IncomingPacket((const uint8_t*)packet->data, packet->length) < 0) { delete packet; @@ -397,16 +397,16 @@ RTPSendCompleteCallback::UnifomLoss(double lossPct) return randVal < lossPct/100; } -WebRtc_Word32 -PacketRequester::ResendPackets(const WebRtc_UWord16* sequenceNumbers, - WebRtc_UWord16 length) +int32_t +PacketRequester::ResendPackets(const uint16_t* sequenceNumbers, + uint16_t length) { return _rtp.SendNACK(sequenceNumbers, length); } -WebRtc_Word32 -SendStatsTest::SendStatistics(const WebRtc_UWord32 bitRate, - const WebRtc_UWord32 frameRate) +int32_t +SendStatsTest::SendStatistics(const uint32_t bitRate, + const uint32_t frameRate) { TEST(frameRate <= _framerate); TEST(bitRate > _bitrate / 2 && bitRate < 3 * _bitrate / 2); @@ -414,7 +414,7 @@ SendStatsTest::SendStatistics(const WebRtc_UWord32 bitRate, return 0; } -WebRtc_Word32 KeyFrameReqTest::RequestKeyFrame() { +int32_t KeyFrameReqTest::RequestKeyFrame() { printf("Key frame requested\n"); return 0; } @@ -433,13 +433,13 @@ VideoProtectionCallback::~VideoProtectionCallback() // } -WebRtc_Word32 +int32_t VideoProtectionCallback::ProtectionRequest( const FecProtectionParams* delta_fec_params, const FecProtectionParams* key_fec_params, - WebRtc_UWord32* sent_video_rate_bps, - WebRtc_UWord32* sent_nack_rate_bps, - WebRtc_UWord32* sent_fec_rate_bps) + uint32_t* sent_video_rate_bps, + uint32_t* sent_nack_rate_bps, + uint32_t* sent_fec_rate_bps) { key_fec_params_ = *key_fec_params; delta_fec_params_ = *delta_fec_params; diff --git a/webrtc/modules/video_coding/main/test/test_callbacks.h b/webrtc/modules/video_coding/main/test/test_callbacks.h index ebf530b7c..14d76bc83 100644 --- a/webrtc/modules/video_coding/main/test/test_callbacks.h +++ b/webrtc/modules/video_coding/main/test/test_callbacks.h @@ -42,12 +42,12 @@ public: void RegisterTransportCallback(VCMPacketizationCallback* transport); // Process encoded data received from the encoder, pass stream to the // VCMReceiver module - WebRtc_Word32 SendData(const FrameType frameType, - const WebRtc_UWord8 payloadType, - const WebRtc_UWord32 timeStamp, + int32_t SendData(const FrameType frameType, + const uint8_t payloadType, + const uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - const WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + const uint32_t payloadSize, const RTPFragmentationHeader& fragmentationHeader, const RTPVideoHeader* videoHdr); // Register exisitng VCM. Currently - encode and decode under same module. @@ -62,7 +62,7 @@ public: void SetCodecType(RTPVideoCodecTypes codecType) {_codecType = codecType;} // Inform callback of frame dimensions - void SetFrameDimensions(WebRtc_Word32 width, WebRtc_Word32 height) + void SetFrameDimensions(int32_t width, int32_t height) { _width = width; _height = height; @@ -78,10 +78,10 @@ private: float _encodedBytes; VideoCodingModule* _VCMReceiver; FrameType _frameType; - WebRtc_UWord16 _seqNo; + uint16_t _seqNo; bool _encodeComplete; - WebRtc_Word32 _width; - WebRtc_Word32 _height; + int32_t _width; + int32_t _height; RTPVideoCodecTypes _codecType; }; // end of VCMEncodeCompleteCallback @@ -99,12 +99,12 @@ public: virtual ~VCMRTPEncodeCompleteCallback() {} // Process encoded data received from the encoder, pass stream to the // RTP module - WebRtc_Word32 SendData(const FrameType frameType, - const WebRtc_UWord8 payloadType, - const WebRtc_UWord32 timeStamp, + int32_t SendData(const FrameType frameType, + const uint8_t payloadType, + const uint32_t timeStamp, int64_t capture_time_ms, - const WebRtc_UWord8* payloadData, - const WebRtc_UWord32 payloadSize, + const uint8_t* payloadData, + const uint32_t payloadSize, const RTPFragmentationHeader& fragmentationHeader, const RTPVideoHeader* videoHdr); // Return size of last encoded frame. Value good for one call @@ -117,7 +117,7 @@ public: {_codecType = codecType;} // Inform callback of frame dimensions - void SetFrameDimensions(WebRtc_Word16 width, WebRtc_Word16 height) + void SetFrameDimensions(int16_t width, int16_t height) { _width = width; _height = height; @@ -128,8 +128,8 @@ private: FrameType _frameType; bool _encodeComplete; RtpRtcp* _RTPModule; - WebRtc_Word16 _width; - WebRtc_Word16 _height; + int16_t _width; + int16_t _height; RTPVideoCodecTypes _codecType; }; // end of VCMEncodeCompleteCallback @@ -142,11 +142,11 @@ public: _decodedFile(decodedFile), _decodedBytes(0) {} virtual ~VCMDecodeCompleteCallback() {} // Write decoded frame into file - WebRtc_Word32 FrameToRender(webrtc::I420VideoFrame& videoFrame); - WebRtc_Word32 DecodedBytes(); + int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame); + int32_t DecodedBytes(); private: FILE* _decodedFile; - WebRtc_UWord32 _decodedBytes; + uint32_t _decodedBytes; }; // end of VCMDecodeCompleCallback class // Transport callback @@ -171,15 +171,15 @@ public: // Set average size of burst loss void SetBurstLength(double burstLength); // Set network delay in the network - void SetNetworkDelay(WebRtc_UWord32 networkDelayMs) + void SetNetworkDelay(uint32_t networkDelayMs) {_networkDelayMs = networkDelayMs;}; // Set Packet jitter delay - void SetJitterVar(WebRtc_UWord32 jitterVar) + void SetJitterVar(uint32_t jitterVar) {_jitterVar = jitterVar;}; // Return send count int SendCount() {return _sendCount; } // Return accumulated length in bytes of transmitted packets - WebRtc_UWord32 TotalSentLength() {return _totalSentLength;} + uint32_t TotalSentLength() {return _totalSentLength;} protected: // Randomly decide whether to drop packets, based on the channel model bool PacketLoss(); @@ -187,14 +187,14 @@ protected: bool UnifomLoss(double lossPct); Clock* _clock; - WebRtc_UWord32 _sendCount; + uint32_t _sendCount; RtpRtcp* _rtp; double _lossPct; double _burstLength; - WebRtc_UWord32 _networkDelayMs; + uint32_t _networkDelayMs; double _jitterVar; bool _prevLossState; - WebRtc_UWord32 _totalSentLength; + uint32_t _totalSentLength; std::list _rtpPackets; RtpDump* _rtpDump; }; @@ -205,8 +205,8 @@ class PacketRequester: public VCMPacketRequestCallback public: PacketRequester(RtpRtcp& rtp) : _rtp(rtp) {} - WebRtc_Word32 ResendPackets(const WebRtc_UWord16* sequenceNumbers, - WebRtc_UWord16 length); + int32_t ResendPackets(const uint16_t* sequenceNumbers, + uint16_t length); private: webrtc::RtpRtcp& _rtp; }; @@ -215,7 +215,7 @@ private: class KeyFrameReqTest: public VCMFrameTypeCallback { public: - WebRtc_Word32 RequestKeyFrame(); + int32_t RequestKeyFrame(); }; @@ -224,12 +224,12 @@ class SendStatsTest: public webrtc::VCMSendStatisticsCallback { public: SendStatsTest() : _framerate(15), _bitrate(500) {} - WebRtc_Word32 SendStatistics(const WebRtc_UWord32 bitRate, - const WebRtc_UWord32 frameRate); - void set_framerate(WebRtc_UWord32 frameRate) {_framerate = frameRate;} + int32_t SendStatistics(const uint32_t bitRate, + const uint32_t frameRate); + void set_framerate(uint32_t frameRate) {_framerate = frameRate;} void set_bitrate(uint32_t bitrate) {_bitrate = bitrate;} private: - WebRtc_UWord32 _framerate; + uint32_t _framerate; uint32_t _bitrate; }; @@ -241,12 +241,12 @@ public: VideoProtectionCallback(); virtual ~VideoProtectionCallback(); void RegisterRtpModule(RtpRtcp* rtp) {_rtp = rtp;} - WebRtc_Word32 ProtectionRequest( + int32_t ProtectionRequest( const FecProtectionParams* delta_fec_params, const FecProtectionParams* key_fec_params, - WebRtc_UWord32* sent_video_rate_bps, - WebRtc_UWord32* sent_nack_rate_bps, - WebRtc_UWord32* sent_fec_rate_bps); + uint32_t* sent_video_rate_bps, + uint32_t* sent_nack_rate_bps, + uint32_t* sent_fec_rate_bps); FecProtectionParams DeltaFecParameters() const; FecProtectionParams KeyFecParameters() const; private: diff --git a/webrtc/modules/video_coding/main/test/test_util.h b/webrtc/modules/video_coding/main/test/test_util.h index dc8ec38fd..1e0537aea 100644 --- a/webrtc/modules/video_coding/main/test/test_util.h +++ b/webrtc/modules/video_coding/main/test/test_util.h @@ -69,9 +69,9 @@ int MTRxTxTest(CmdArgs& args); double NormalDist(double mean, double stdDev); struct RtpPacket { - WebRtc_Word8 data[1650]; // max packet size - WebRtc_Word32 length; - WebRtc_Word64 receiveTime; + int8_t data[1650]; // max packet size + int32_t length; + int64_t receiveTime; }; class NullEvent : public webrtc::EventWrapper { diff --git a/webrtc/modules/video_coding/main/test/video_rtp_play.cc b/webrtc/modules/video_coding/main/test/video_rtp_play.cc index 819edc5ba..020a5bcde 100644 --- a/webrtc/modules/video_coding/main/test/video_rtp_play.cc +++ b/webrtc/modules/video_coding/main/test/video_rtp_play.cc @@ -24,9 +24,9 @@ using namespace webrtc; -WebRtc_Word32 -RtpDataCallback::OnReceivedPayloadData(const WebRtc_UWord8* payloadData, - const WebRtc_UWord16 payloadSize, +int32_t +RtpDataCallback::OnReceivedPayloadData(const uint8_t* payloadData, + const uint16_t payloadSize, const WebRtcRTPHeader* rtpHeader) { return _vcm->IncomingPacket(payloadData, payloadSize, *rtpHeader); @@ -44,7 +44,7 @@ FrameReceiveCallback::~FrameReceiveCallback() } } -WebRtc_Word32 +int32_t FrameReceiveCallback::FrameToRender(I420VideoFrame& videoFrame) { if (_timingFile == NULL) @@ -114,12 +114,12 @@ int RtpPlay(CmdArgs& args) // BEGIN Settings bool protectionEnabled = true; VCMVideoProtection protectionMethod = kProtectionNack; - WebRtc_UWord32 rttMS = 0; + uint32_t rttMS = 0; float lossRate = 0.0f; bool reordering = false; - WebRtc_UWord32 renderDelayMs = 0; - WebRtc_UWord32 minPlayoutDelayMs = 0; - const WebRtc_Word64 MAX_RUNTIME_MS = -1; + uint32_t renderDelayMs = 0; + uint32_t minPlayoutDelayMs = 0; + const int64_t MAX_RUNTIME_MS = -1; std::string outFile = args.outputFile; if (outFile == "") outFile = test::OutputPath() + "RtpPlay_decoded.yuv"; @@ -147,7 +147,7 @@ int RtpPlay(CmdArgs& args) // Set up - WebRtc_Word32 ret = vcm->InitializeReceiver(); + int32_t ret = vcm->InitializeReceiver(); if (ret < 0) { return -1; diff --git a/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc b/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc index 5e42f03c0..1e43b9246 100644 --- a/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc +++ b/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc @@ -64,11 +64,11 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe // BEGIN Settings bool protectionEnabled = true; VCMVideoProtection protection = kProtectionDualDecoder; - WebRtc_UWord8 rttMS = 50; + uint8_t rttMS = 50; float lossRate = 0.05f; - WebRtc_UWord32 renderDelayMs = 0; - WebRtc_UWord32 minPlayoutDelayMs = 0; - const WebRtc_Word64 MAX_RUNTIME_MS = 10000; + uint32_t renderDelayMs = 0; + uint32_t minPlayoutDelayMs = 0; + const int64_t MAX_RUNTIME_MS = 10000; std::string outFilename = args.outputFile; if (outFilename == "") outFilename = test::OutputPath() + "RtpPlayMT_decoded.yuv"; @@ -151,7 +151,7 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe } rtpStream.SimulatePacketLoss(lossRate, nackEnabled, rttMS); - WebRtc_Word32 ret = vcm->InitializeReceiver(); + int32_t ret = vcm->InitializeReceiver(); if (ret < 0) { return -1; diff --git a/webrtc/modules/video_coding/main/test/video_source.cc b/webrtc/modules/video_coding/main/test/video_source.cc index d7ba0b927..3078f769e 100644 --- a/webrtc/modules/video_coding/main/test/video_source.cc +++ b/webrtc/modules/video_coding/main/test/video_source.cc @@ -40,7 +40,7 @@ _frameRate(frameRate) GetWidthHeight(size); } -VideoSource::VideoSource(std::string fileName, WebRtc_UWord16 width, WebRtc_UWord16 height, +VideoSource::VideoSource(std::string fileName, uint16_t width, uint16_t height, float frameRate /*= 30*/, webrtc::VideoType type /*= webrtc::kI420*/) : _fileName(fileName), @@ -55,7 +55,7 @@ _frameRate(frameRate) assert(frameRate > 0); } -WebRtc_Word32 +int32_t VideoSource::GetFrameLength() const { return webrtc::CalcBufferSize(_type, _width, _height); diff --git a/webrtc/modules/video_coding/main/test/video_source.h b/webrtc/modules/video_coding/main/test/video_source.h index 980650bc1..822249e57 100644 --- a/webrtc/modules/video_coding/main/test/video_source.h +++ b/webrtc/modules/video_coding/main/test/video_source.h @@ -56,12 +56,12 @@ class VideoSource public: VideoSource(); VideoSource(std::string fileName, VideoSize size, float frameRate, webrtc::VideoType type = webrtc::kI420); - VideoSource(std::string fileName, WebRtc_UWord16 width, WebRtc_UWord16 height, + VideoSource(std::string fileName, uint16_t width, uint16_t height, float frameRate = 30, webrtc::VideoType type = webrtc::kI420); std::string GetFileName() const { return _fileName; } - WebRtc_UWord16 GetWidth() const { return _width; } - WebRtc_UWord16 GetHeight() const { return _height; } + uint16_t GetWidth() const { return _width; } + uint16_t GetHeight() const { return _height; } webrtc::VideoType GetType() const { return _type; } float GetFrameRate() const { return _frameRate; } int GetWidthHeight( VideoSize size); @@ -69,12 +69,12 @@ public: // Returns the filename with the path (including the leading slash) removed. std::string GetName() const; - WebRtc_Word32 GetFrameLength() const; + int32_t GetFrameLength() const; private: std::string _fileName; - WebRtc_UWord16 _width; - WebRtc_UWord16 _height; + uint16_t _width; + uint16_t _height; webrtc::VideoType _type; float _frameRate; };