WebRtc_Word32 => int32_t for rtp_rtcp/

BUG=314

Review URL: https://webrtc-codereview.appspot.com/1279007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3777 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2013-04-08 11:08:41 +00:00
parent 367804cce2
commit 2f44673d66
86 changed files with 3934 additions and 3956 deletions

View File

@ -89,9 +89,9 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetPacketTimeout(
const WebRtc_UWord32 RTPtimeoutMS,
const WebRtc_UWord32 RTCPtimeoutMS) = 0;
virtual int32_t SetPacketTimeout(
const uint32_t RTPtimeoutMS,
const uint32_t RTCPtimeoutMS) = 0;
/*
* Set periodic dead or alive notification
@ -102,9 +102,9 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
virtual int32_t SetPeriodicDeadOrAliveStatus(
const bool enable,
const WebRtc_UWord8 sampleTimeSeconds) = 0;
const uint8_t sampleTimeSeconds) = 0;
/*
* Get periodic dead or alive notification status
@ -115,16 +115,16 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
virtual int32_t PeriodicDeadOrAliveStatus(
bool& enable,
WebRtc_UWord8& sampleTimeSeconds) = 0;
uint8_t& sampleTimeSeconds) = 0;
/*
* set voice codec name and payload type
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RegisterReceivePayload(
virtual int32_t RegisterReceivePayload(
const CodecInst& voiceCodec) = 0;
/*
@ -132,7 +132,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RegisterReceivePayload(
virtual int32_t RegisterReceivePayload(
const VideoCodec& videoCodec) = 0;
/*
@ -140,18 +140,18 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 ReceivePayloadType(
virtual int32_t ReceivePayloadType(
const CodecInst& voiceCodec,
WebRtc_Word8* plType) = 0;
int8_t* plType) = 0;
/*
* get payload type for a video codec
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 ReceivePayloadType(
virtual int32_t ReceivePayloadType(
const VideoCodec& videoCodec,
WebRtc_Word8* plType) = 0;
int8_t* plType) = 0;
/*
* Remove a registered payload type from list of accepted payloads
@ -160,25 +160,25 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 DeRegisterReceivePayload(
const WebRtc_Word8 payloadType) = 0;
virtual int32_t DeRegisterReceivePayload(
const int8_t payloadType) = 0;
/*
* (De)register RTP header extension type and id.
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
virtual int32_t RegisterReceiveRtpHeaderExtension(
const RTPExtensionType type,
const WebRtc_UWord8 id) = 0;
const uint8_t id) = 0;
virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
virtual int32_t DeregisterReceiveRtpHeaderExtension(
const RTPExtensionType type) = 0;
/*
* Get last received remote timestamp
*/
virtual WebRtc_UWord32 RemoteTimestamp() const = 0;
virtual uint32_t RemoteTimestamp() const = 0;
/*
* Get the local time of the last received remote timestamp
@ -192,13 +192,13 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
WebRtc_UWord32& timestamp) const = 0;
virtual int32_t EstimatedRemoteTimeStamp(
uint32_t& timestamp) const = 0;
/*
* Get incoming SSRC
*/
virtual WebRtc_UWord32 RemoteSSRC() const = 0;
virtual uint32_t RemoteSSRC() const = 0;
/*
* Get remote CSRC
@ -207,8 +207,8 @@ class RtpRtcp : public Module {
*
* return -1 on failure else the number of valid entries in the list
*/
virtual WebRtc_Word32 RemoteCSRCs(
WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
virtual int32_t RemoteCSRCs(
uint32_t arrOfCSRC[kRtpCsrcSize]) const = 0;
/*
* get the currently configured SSRC filter
@ -217,7 +217,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowedSSRC) const = 0;
virtual int32_t SSRCFilter(uint32_t& allowedSSRC) const = 0;
/*
* set a SSRC to be used as a filter for incoming RTP streams
@ -226,20 +226,20 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
const WebRtc_UWord32 allowedSSRC) = 0;
virtual int32_t SetSSRCFilter(const bool enable,
const uint32_t allowedSSRC) = 0;
/*
* Turn on/off receiving RTX (RFC 4588) on a specific SSRC.
*/
virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
const WebRtc_UWord32 SSRC) = 0;
virtual int32_t SetRTXReceiveStatus(const bool enable,
const uint32_t SSRC) = 0;
/*
* Get status of receiving RTX (RFC 4588) on a specific SSRC.
*/
virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
WebRtc_UWord32* SSRC) const = 0;
virtual int32_t RTXReceiveStatus(bool* enable,
uint32_t* SSRC) const = 0;
/*
* called by the network module when we receive a packet
@ -249,8 +249,8 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPacket,
const WebRtc_UWord16 packetLength) = 0;
virtual int32_t IncomingPacket(const uint8_t* incomingPacket,
const uint16_t packetLength) = 0;
/**************************************************************************
*
@ -265,7 +265,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size) = 0;
virtual int32_t SetMaxTransferUnit(const uint16_t size) = 0;
/*
* set transtport overhead
@ -278,10 +278,10 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetTransportOverhead(
virtual int32_t SetTransportOverhead(
const bool TCP,
const bool IPV6,
const WebRtc_UWord8 authenticationOverhead = 0) = 0;
const uint8_t authenticationOverhead = 0) = 0;
/*
* Get max payload length
@ -291,7 +291,7 @@ class RtpRtcp : public Module {
* Does not account FEC/ULP/RED overhead if FEC is enabled.
* Does not account for RTP headers
*/
virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
virtual uint16_t MaxPayloadLength() const = 0;
/*
* Get max data payload length
@ -301,14 +301,14 @@ class RtpRtcp : public Module {
* Takes into account FEC/ULP/RED overhead if FEC is enabled.
* Takes into account RTP headers
*/
virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
virtual uint16_t MaxDataPayloadLength() const = 0;
/*
* set codec name and payload type
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RegisterSendPayload(
virtual int32_t RegisterSendPayload(
const CodecInst& voiceCodec) = 0;
/*
@ -316,7 +316,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RegisterSendPayload(
virtual int32_t RegisterSendPayload(
const VideoCodec& videoCodec) = 0;
/*
@ -326,25 +326,25 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 DeRegisterSendPayload(
const WebRtc_Word8 payloadType) = 0;
virtual int32_t DeRegisterSendPayload(
const int8_t payloadType) = 0;
/*
* (De)register RTP header extension type and id.
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
virtual int32_t RegisterSendRtpHeaderExtension(
const RTPExtensionType type,
const WebRtc_UWord8 id) = 0;
const uint8_t id) = 0;
virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
virtual int32_t DeregisterSendRtpHeaderExtension(
const RTPExtensionType type) = 0;
/*
* get start timestamp
*/
virtual WebRtc_UWord32 StartTimestamp() const = 0;
virtual uint32_t StartTimestamp() const = 0;
/*
* configure start timestamp, default is a random number
@ -353,32 +353,32 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetStartTimestamp(
const WebRtc_UWord32 timestamp) = 0;
virtual int32_t SetStartTimestamp(
const uint32_t timestamp) = 0;
/*
* Get SequenceNumber
*/
virtual WebRtc_UWord16 SequenceNumber() const = 0;
virtual uint16_t SequenceNumber() const = 0;
/*
* Set SequenceNumber, default is a random number
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq) = 0;
virtual int32_t SetSequenceNumber(const uint16_t seq) = 0;
/*
* Get SSRC
*/
virtual WebRtc_UWord32 SSRC() const = 0;
virtual uint32_t SSRC() const = 0;
/*
* configure SSRC, default is a random number
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc) = 0;
virtual int32_t SetSSRC(const uint32_t ssrc) = 0;
/*
* Get CSRC
@ -387,8 +387,8 @@ class RtpRtcp : public Module {
*
* return -1 on failure else number of valid entries in the array
*/
virtual WebRtc_Word32 CSRCs(
WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
virtual int32_t CSRCs(
uint32_t arrOfCSRC[kRtpCsrcSize]) const = 0;
/*
* Set CSRC
@ -398,9 +398,9 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetCSRCs(
const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
const WebRtc_UWord8 arrLength) = 0;
virtual int32_t SetCSRCs(
const uint32_t arrOfCSRC[kRtpCsrcSize],
const uint8_t arrLength) = 0;
/*
* includes CSRCs in RTP header if enabled
@ -411,20 +411,20 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetCSRCStatus(const bool include) = 0;
virtual int32_t SetCSRCStatus(const bool include) = 0;
/*
* Turn on/off sending RTX (RFC 4588) on a specific SSRC.
*/
virtual WebRtc_Word32 SetRTXSendStatus(const RtxMode mode,
const bool setSSRC,
const WebRtc_UWord32 SSRC) = 0;
virtual int32_t SetRTXSendStatus(const RtxMode mode,
const bool setSSRC,
const uint32_t SSRC) = 0;
/*
* Get status of sending RTX (RFC 4588) on a specific SSRC.
*/
virtual WebRtc_Word32 RTXSendStatus(RtxMode* mode,
WebRtc_UWord32* SSRC) const = 0;
virtual int32_t RTXSendStatus(RtxMode* mode,
uint32_t* SSRC) const = 0;
/*
* sends kRtcpByeCode when going from true to false
@ -433,7 +433,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetSendingStatus(const bool sending) = 0;
virtual int32_t SetSendingStatus(const bool sending) = 0;
/*
* get send status
@ -447,7 +447,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending) = 0;
virtual int32_t SetSendingMediaStatus(const bool sending) = 0;
/*
* get send status
@ -457,10 +457,10 @@ class RtpRtcp : public Module {
/*
* get sent bitrate in Kbit/s
*/
virtual void BitrateSent(WebRtc_UWord32* totalRate,
WebRtc_UWord32* videoRate,
WebRtc_UWord32* fecRate,
WebRtc_UWord32* nackRate) const = 0;
virtual void BitrateSent(uint32_t* totalRate,
uint32_t* videoRate,
uint32_t* fecRate,
uint32_t* nackRate) const = 0;
/*
* Used by the codec module to deliver a video or audio frame for
@ -476,13 +476,13 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SendOutgoingData(
virtual int32_t SendOutgoingData(
const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 timeStamp,
const int8_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* fragmentation = NULL,
const RTPVideoHeader* rtpVideoHdr = NULL) = 0;
@ -507,29 +507,29 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method) = 0;
virtual int32_t SetRTCPStatus(const RTCPMethod method) = 0;
/*
* Set RTCP CName (i.e unique identifier)
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
virtual int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
/*
* Get RTCP CName (i.e unique identifier)
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
virtual int32_t CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
/*
* Get remote CName
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RemoteCNAME(
const WebRtc_UWord32 remoteSSRC,
virtual int32_t RemoteCNAME(
const uint32_t remoteSSRC,
char cName[RTCP_CNAME_SIZE]) const = 0;
/*
@ -537,20 +537,20 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RemoteNTP(
WebRtc_UWord32 *ReceivedNTPsecs,
WebRtc_UWord32 *ReceivedNTPfrac,
WebRtc_UWord32 *RTCPArrivalTimeSecs,
WebRtc_UWord32 *RTCPArrivalTimeFrac,
WebRtc_UWord32 *rtcp_timestamp) const = 0;
virtual int32_t RemoteNTP(
uint32_t *ReceivedNTPsecs,
uint32_t *ReceivedNTPfrac,
uint32_t *RTCPArrivalTimeSecs,
uint32_t *RTCPArrivalTimeFrac,
uint32_t *rtcp_timestamp) const = 0;
/*
* AddMixedCNAME
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 AddMixedCNAME(
const WebRtc_UWord32 SSRC,
virtual int32_t AddMixedCNAME(
const uint32_t SSRC,
const char cName[RTCP_CNAME_SIZE]) = 0;
/*
@ -558,25 +558,25 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC) = 0;
virtual int32_t RemoveMixedCNAME(const uint32_t SSRC) = 0;
/*
* Get RoundTripTime
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
WebRtc_UWord16* RTT,
WebRtc_UWord16* avgRTT,
WebRtc_UWord16* minRTT,
WebRtc_UWord16* maxRTT) const = 0 ;
virtual int32_t RTT(const uint32_t remoteSSRC,
uint16_t* RTT,
uint16_t* avgRTT,
uint16_t* minRTT,
uint16_t* maxRTT) const = 0 ;
/*
* Reset RoundTripTime statistics
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC)= 0 ;
virtual int32_t ResetRTT(const uint32_t remoteSSRC)= 0 ;
/*
* Sets the estimated RTT, to be used for receive only modules without
@ -590,86 +590,86 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SendRTCP(
WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
virtual int32_t SendRTCP(
uint32_t rtcpPacketType = kRtcpReport) = 0;
/*
* Good state of RTP receiver inform sender
*/
virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
const WebRtc_UWord64 pictureID) = 0;
virtual int32_t SendRTCPReferencePictureSelection(
const uint64_t pictureID) = 0;
/*
* Send a RTCP Slice Loss Indication (SLI)
* 6 least significant bits of pictureID
*/
virtual WebRtc_Word32 SendRTCPSliceLossIndication(
const WebRtc_UWord8 pictureID) = 0;
virtual int32_t SendRTCPSliceLossIndication(
const uint8_t pictureID) = 0;
/*
* Reset RTP statistics
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 ResetStatisticsRTP() = 0;
virtual int32_t ResetStatisticsRTP() = 0;
/*
* statistics of our localy created statistics of the received RTP stream
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 StatisticsRTP(
WebRtc_UWord8* fraction_lost, // scale 0 to 255
WebRtc_UWord32* cum_lost, // number of lost packets
WebRtc_UWord32* ext_max, // highest sequence number received
WebRtc_UWord32* jitter,
WebRtc_UWord32* max_jitter = NULL) const = 0;
virtual int32_t StatisticsRTP(
uint8_t* fraction_lost, // scale 0 to 255
uint32_t* cum_lost, // number of lost packets
uint32_t* ext_max, // highest sequence number received
uint32_t* jitter,
uint32_t* max_jitter = NULL) const = 0;
/*
* Reset RTP data counters for the receiving side
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 ResetReceiveDataCountersRTP() = 0;
virtual int32_t ResetReceiveDataCountersRTP() = 0;
/*
* Reset RTP data counters for the sending side
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 ResetSendDataCountersRTP() = 0;
virtual int32_t ResetSendDataCountersRTP() = 0;
/*
* statistics of the amount of data sent and received
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 DataCountersRTP(
WebRtc_UWord32* bytesSent,
WebRtc_UWord32* packetsSent,
WebRtc_UWord32* bytesReceived,
WebRtc_UWord32* packetsReceived) const = 0;
virtual int32_t DataCountersRTP(
uint32_t* bytesSent,
uint32_t* packetsSent,
uint32_t* bytesReceived,
uint32_t* packetsReceived) const = 0;
/*
* Get received RTCP sender info
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
virtual int32_t RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
/*
* Get received RTCP report block
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RemoteRTCPStat(
virtual int32_t RemoteRTCPStat(
std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
/*
* Set received RTCP report block
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 AddRTCPReportBlock(
const WebRtc_UWord32 SSRC,
virtual int32_t AddRTCPReportBlock(
const uint32_t SSRC,
const RTCPReportBlock* receiveBlock) = 0;
/*
@ -677,24 +677,24 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 SSRC) = 0;
virtual int32_t RemoveRTCPReportBlock(const uint32_t SSRC) = 0;
/*
* (APP) Application specific data
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
const WebRtc_UWord8 subType,
const WebRtc_UWord32 name,
const WebRtc_UWord8* data,
const WebRtc_UWord16 length) = 0;
virtual int32_t SetRTCPApplicationSpecificData(
const uint8_t subType,
const uint32_t name,
const uint8_t* data,
const uint16_t length) = 0;
/*
* (XR) VOIP metric
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetRTCPVoIPMetrics(
virtual int32_t SetRTCPVoIPMetrics(
const RTCPVoIPMetric* VoIPMetric) = 0;
/*
@ -702,18 +702,18 @@ class RtpRtcp : public Module {
*/
virtual bool REMB() const = 0;
virtual WebRtc_Word32 SetREMBStatus(const bool enable) = 0;
virtual int32_t SetREMBStatus(const bool enable) = 0;
virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
const WebRtc_UWord8 numberOfSSRC,
const WebRtc_UWord32* SSRC) = 0;
virtual int32_t SetREMBData(const uint32_t bitrate,
const uint8_t numberOfSSRC,
const uint32_t* SSRC) = 0;
/*
* (IJ) Extended jitter report.
*/
virtual bool IJ() const = 0;
virtual WebRtc_Word32 SetIJStatus(const bool enable) = 0;
virtual int32_t SetIJStatus(const bool enable) = 0;
/*
* (TMMBR) Temporary Max Media Bit Rate
@ -724,7 +724,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetTMMBRStatus(const bool enable) = 0;
virtual int32_t SetTMMBRStatus(const bool enable) = 0;
/*
* (NACK)
@ -739,8 +739,8 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method,
int max_reordering_threshold) = 0;
virtual int32_t SetNACKStatus(const NACKMethod method,
int max_reordering_threshold) = 0;
/*
* TODO(holmer): Propagate this API to VideoEngine.
@ -767,8 +767,8 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nackList,
const WebRtc_UWord16 size) = 0;
virtual int32_t SendNACK(const uint16_t* nackList,
const uint16_t size) = 0;
/*
* Store the sent packets, needed to answer to a Negative acknowledgement
@ -776,9 +776,9 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetStorePacketsStatus(
virtual int32_t SetStorePacketsStatus(
const bool enable,
const WebRtc_UWord16 numberToStore) = 0;
const uint16_t numberToStore) = 0;
/**************************************************************************
*
@ -792,8 +792,8 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetAudioPacketSize(
const WebRtc_UWord16 packetSizeSamples) = 0;
virtual int32_t SetAudioPacketSize(
const uint16_t packetSizeSamples) = 0;
/*
* Forward DTMF to decoder for playout.
@ -816,33 +816,33 @@ class RtpRtcp : public Module {
* by the microphone and send inband just after the tone has ended.
*/
virtual bool SendTelephoneEventActive(
WebRtc_Word8& telephoneEvent) const = 0;
int8_t& telephoneEvent) const = 0;
/*
* Send a TelephoneEvent tone using RFC 2833 (4733)
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SendTelephoneEventOutband(
const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level) = 0;
virtual int32_t SendTelephoneEventOutband(
const uint8_t key,
const uint16_t time_ms,
const uint8_t level) = 0;
/*
* Set payload type for Redundant Audio Data RFC 2198
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetSendREDPayloadType(
const WebRtc_Word8 payloadType) = 0;
virtual int32_t SetSendREDPayloadType(
const int8_t payloadType) = 0;
/*
* Get payload type for Redundant Audio Data RFC 2198
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SendREDPayloadType(
WebRtc_Word8& payloadType) const = 0;
virtual int32_t SendREDPayloadType(
int8_t& payloadType) const = 0;
/*
* Set status and ID for header-extension-for-audio-level-indication.
@ -850,18 +850,18 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
virtual int32_t SetRTPAudioLevelIndicationStatus(
const bool enable,
const WebRtc_UWord8 ID) = 0;
const uint8_t ID) = 0;
/*
* Get status and ID for header-extension-for-audio-level-indication.
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
virtual int32_t GetRTPAudioLevelIndicationStatus(
bool& enable,
WebRtc_UWord8& ID) const = 0;
uint8_t& ID) const = 0;
/*
* Store the audio level in dBov for header-extension-for-audio-level-
@ -871,7 +871,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0.
*/
virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov) = 0;
virtual int32_t SetAudioLevel(const uint8_t level_dBov) = 0;
/**************************************************************************
*
@ -884,34 +884,34 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS) = 0;
virtual int32_t SetCameraDelay(const int32_t delayMS) = 0;
/*
* Set the target send bitrate
*/
virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate) = 0;
virtual void SetTargetSendBitrate(const uint32_t bitrate) = 0;
/*
* Turn on/off generic FEC
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetGenericFECStatus(
virtual int32_t SetGenericFECStatus(
const bool enable,
const WebRtc_UWord8 payloadTypeRED,
const WebRtc_UWord8 payloadTypeFEC) = 0;
const uint8_t payloadTypeRED,
const uint8_t payloadTypeFEC) = 0;
/*
* Get generic FEC setting
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 GenericFECStatus(bool& enable,
WebRtc_UWord8& payloadTypeRED,
WebRtc_UWord8& payloadTypeFEC) = 0;
virtual int32_t GenericFECStatus(bool& enable,
uint8_t& payloadTypeRED,
uint8_t& payloadTypeFEC) = 0;
virtual WebRtc_Word32 SetFecParameters(
virtual int32_t SetFecParameters(
const FecProtectionParams* delta_params,
const FecProtectionParams* key_params) = 0;
@ -920,7 +920,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetKeyFrameRequestMethod(
virtual int32_t SetKeyFrameRequestMethod(
const KeyFrameRequestMethod method) = 0;
/*
@ -928,7 +928,7 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RequestKeyFrame() = 0;
virtual int32_t RequestKeyFrame() = 0;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_

View File

@ -26,7 +26,7 @@
namespace webrtc{
const WebRtc_Word32 kDefaultVideoFrequency = 90000;
const int32_t kDefaultVideoFrequency = 90000;
enum RTCPMethod
{
@ -115,32 +115,32 @@ enum RtxMode {
struct RTCPSenderInfo
{
WebRtc_UWord32 NTPseconds;
WebRtc_UWord32 NTPfraction;
WebRtc_UWord32 RTPtimeStamp;
WebRtc_UWord32 sendPacketCount;
WebRtc_UWord32 sendOctetCount;
uint32_t NTPseconds;
uint32_t NTPfraction;
uint32_t RTPtimeStamp;
uint32_t sendPacketCount;
uint32_t sendOctetCount;
};
struct RTCPReportBlock
{
// Fields as described by RFC 3550 6.4.2.
WebRtc_UWord32 remoteSSRC; // SSRC of sender of this report.
WebRtc_UWord32 sourceSSRC; // SSRC of the RTP packet sender.
WebRtc_UWord8 fractionLost;
WebRtc_UWord32 cumulativeLost; // 24 bits valid
WebRtc_UWord32 extendedHighSeqNum;
WebRtc_UWord32 jitter;
WebRtc_UWord32 lastSR;
WebRtc_UWord32 delaySinceLastSR;
uint32_t remoteSSRC; // SSRC of sender of this report.
uint32_t sourceSSRC; // SSRC of the RTP packet sender.
uint8_t fractionLost;
uint32_t cumulativeLost; // 24 bits valid
uint32_t extendedHighSeqNum;
uint32_t jitter;
uint32_t lastSR;
uint32_t delaySinceLastSR;
};
class RtpData
{
public:
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 WebRtcRTPHeader* rtpHeader) = 0;
protected:
virtual ~RtpData() {}
@ -149,29 +149,29 @@ protected:
class RtcpFeedback
{
public:
virtual void OnApplicationDataReceived(const WebRtc_Word32 /*id*/,
const WebRtc_UWord8 /*subType*/,
const WebRtc_UWord32 /*name*/,
const WebRtc_UWord16 /*length*/,
const WebRtc_UWord8* /*data*/) {};
virtual void OnApplicationDataReceived(const int32_t /*id*/,
const uint8_t /*subType*/,
const uint32_t /*name*/,
const uint16_t /*length*/,
const uint8_t* /*data*/) {};
virtual void OnXRVoIPMetricReceived(
const WebRtc_Word32 /*id*/,
const int32_t /*id*/,
const RTCPVoIPMetric* /*metric*/) {};
virtual void OnRTCPPacketTimeout(const WebRtc_Word32 /*id*/) {};
virtual void OnRTCPPacketTimeout(const int32_t /*id*/) {};
// |ntp_secs|, |ntp_frac| and |timestamp| are the NTP time and RTP timestamp
// parsed from the RTCP sender report from the sender with ssrc
// |senderSSRC|.
virtual void OnSendReportReceived(const WebRtc_Word32 id,
const WebRtc_UWord32 senderSSRC,
virtual void OnSendReportReceived(const int32_t id,
const uint32_t senderSSRC,
uint32_t ntp_secs,
uint32_t ntp_frac,
uint32_t timestamp) {};
virtual void OnReceiveReportReceived(const WebRtc_Word32 id,
const WebRtc_UWord32 senderSSRC) {};
virtual void OnReceiveReportReceived(const int32_t id,
const uint32_t senderSSRC) {};
protected:
virtual ~RtcpFeedback() {}
@ -184,27 +184,27 @@ public:
/*
* channels - number of channels in codec (1 = mono, 2 = stereo)
*/
virtual WebRtc_Word32 OnInitializeDecoder(
const WebRtc_Word32 id,
const WebRtc_Word8 payloadType,
virtual int32_t OnInitializeDecoder(
const int32_t id,
const int8_t payloadType,
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const int frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) = 0;
const uint8_t channels,
const uint32_t rate) = 0;
virtual void OnPacketTimeout(const WebRtc_Word32 id) = 0;
virtual void OnPacketTimeout(const int32_t id) = 0;
virtual void OnReceivedPacket(const WebRtc_Word32 id,
virtual void OnReceivedPacket(const int32_t id,
const RtpRtcpPacketType packetType) = 0;
virtual void OnPeriodicDeadOrAlive(const WebRtc_Word32 id,
virtual void OnPeriodicDeadOrAlive(const int32_t id,
const RTPAliveType alive) = 0;
virtual void OnIncomingSSRCChanged( const WebRtc_Word32 id,
const WebRtc_UWord32 SSRC) = 0;
virtual void OnIncomingSSRCChanged( const int32_t id,
const uint32_t SSRC) = 0;
virtual void OnIncomingCSRCChanged( const WebRtc_Word32 id,
const WebRtc_UWord32 CSRC,
virtual void OnIncomingCSRCChanged( const int32_t id,
const uint32_t CSRC,
const bool added) = 0;
protected:
@ -214,10 +214,10 @@ protected:
class RtpAudioFeedback {
public:
virtual void OnPlayTelephoneEvent(const WebRtc_Word32 id,
const WebRtc_UWord8 event,
const WebRtc_UWord16 lengthMs,
const WebRtc_UWord8 volume) = 0;
virtual void OnPlayTelephoneEvent(const int32_t id,
const uint8_t event,
const uint16_t lengthMs,
const uint8_t volume) = 0;
protected:
virtual ~RtpAudioFeedback() {}
};
@ -264,29 +264,29 @@ class NullRtpFeedback : public RtpFeedback {
public:
virtual ~NullRtpFeedback() {}
virtual WebRtc_Word32 OnInitializeDecoder(
const WebRtc_Word32 id,
const WebRtc_Word8 payloadType,
virtual int32_t OnInitializeDecoder(
const int32_t id,
const int8_t payloadType,
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const int frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) {
const uint8_t channels,
const uint32_t rate) {
return 0;
}
virtual void OnPacketTimeout(const WebRtc_Word32 id) {}
virtual void OnPacketTimeout(const int32_t id) {}
virtual void OnReceivedPacket(const WebRtc_Word32 id,
virtual void OnReceivedPacket(const int32_t id,
const RtpRtcpPacketType packetType) {}
virtual void OnPeriodicDeadOrAlive(const WebRtc_Word32 id,
virtual void OnPeriodicDeadOrAlive(const int32_t id,
const RTPAliveType alive) {}
virtual void OnIncomingSSRCChanged(const WebRtc_Word32 id,
const WebRtc_UWord32 SSRC) {}
virtual void OnIncomingSSRCChanged(const int32_t id,
const uint32_t SSRC) {}
virtual void OnIncomingCSRCChanged(const WebRtc_Word32 id,
const WebRtc_UWord32 CSRC,
virtual void OnIncomingCSRCChanged(const int32_t id,
const uint32_t CSRC,
const bool added) {}
};
@ -294,9 +294,9 @@ class NullRtpFeedback : public RtpFeedback {
class NullRtpData : public RtpData {
public:
virtual ~NullRtpData() {}
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 WebRtcRTPHeader* rtpHeader) {
return 0;
}
@ -307,10 +307,10 @@ class NullRtpAudioFeedback : public RtpAudioFeedback {
public:
virtual ~NullRtpAudioFeedback() {}
virtual void OnPlayTelephoneEvent(const WebRtc_Word32 id,
const WebRtc_UWord8 event,
const WebRtc_UWord16 lengthMs,
const WebRtc_UWord8 volume) {}
virtual void OnPlayTelephoneEvent(const int32_t id,
const uint8_t event,
const uint16_t lengthMs,
const uint8_t volume) {}
};
} // namespace webrtc

View File

@ -22,137 +22,137 @@ namespace webrtc {
class MockRtpRtcp : public RtpRtcp {
public:
MOCK_METHOD1(ChangeUniqueId,
WebRtc_Word32(const WebRtc_Word32 id));
int32_t(const int32_t id));
MOCK_METHOD1(RegisterDefaultModule,
WebRtc_Word32(RtpRtcp* module));
int32_t(RtpRtcp* module));
MOCK_METHOD0(DeRegisterDefaultModule,
WebRtc_Word32());
int32_t());
MOCK_METHOD0(DefaultModuleRegistered,
bool());
MOCK_METHOD0(NumberChildModules,
WebRtc_UWord32());
uint32_t());
MOCK_METHOD1(RegisterSyncModule,
WebRtc_Word32(RtpRtcp* module));
int32_t(RtpRtcp* module));
MOCK_METHOD0(DeRegisterSyncModule,
WebRtc_Word32());
int32_t());
MOCK_METHOD0(InitReceiver,
WebRtc_Word32());
int32_t());
MOCK_METHOD1(RegisterIncomingDataCallback,
WebRtc_Word32(RtpData* incomingDataCallback));
int32_t(RtpData* incomingDataCallback));
MOCK_METHOD1(RegisterIncomingRTPCallback,
WebRtc_Word32(RtpFeedback* incomingMessagesCallback));
int32_t(RtpFeedback* incomingMessagesCallback));
MOCK_METHOD2(SetPacketTimeout,
WebRtc_Word32(const WebRtc_UWord32 RTPtimeoutMS, const WebRtc_UWord32 RTCPtimeoutMS));
int32_t(const uint32_t RTPtimeoutMS, const uint32_t RTCPtimeoutMS));
MOCK_METHOD2(SetPeriodicDeadOrAliveStatus,
WebRtc_Word32(const bool enable, const WebRtc_UWord8 sampleTimeSeconds));
int32_t(const bool enable, const uint8_t sampleTimeSeconds));
MOCK_METHOD2(PeriodicDeadOrAliveStatus,
WebRtc_Word32(bool &enable, WebRtc_UWord8 &sampleTimeSeconds));
int32_t(bool &enable, uint8_t &sampleTimeSeconds));
MOCK_METHOD1(RegisterReceivePayload,
WebRtc_Word32(const CodecInst& voiceCodec));
int32_t(const CodecInst& voiceCodec));
MOCK_METHOD1(RegisterReceivePayload,
WebRtc_Word32(const VideoCodec& videoCodec));
int32_t(const VideoCodec& videoCodec));
MOCK_METHOD2(ReceivePayloadType,
WebRtc_Word32(const CodecInst& voiceCodec, WebRtc_Word8* plType));
int32_t(const CodecInst& voiceCodec, int8_t* plType));
MOCK_METHOD2(ReceivePayloadType,
WebRtc_Word32(const VideoCodec& videoCodec, WebRtc_Word8* plType));
int32_t(const VideoCodec& videoCodec, int8_t* plType));
MOCK_METHOD1(DeRegisterReceivePayload,
WebRtc_Word32(const WebRtc_Word8 payloadType));
int32_t(const int8_t payloadType));
MOCK_METHOD2(RegisterReceiveRtpHeaderExtension,
WebRtc_Word32(const RTPExtensionType type, const WebRtc_UWord8 id));
int32_t(const RTPExtensionType type, const uint8_t id));
MOCK_METHOD1(DeregisterReceiveRtpHeaderExtension,
WebRtc_Word32(const RTPExtensionType type));
int32_t(const RTPExtensionType type));
MOCK_CONST_METHOD0(RemoteTimestamp,
WebRtc_UWord32());
uint32_t());
MOCK_CONST_METHOD0(LocalTimeOfRemoteTimeStamp,
int64_t());
MOCK_CONST_METHOD1(EstimatedRemoteTimeStamp,
WebRtc_Word32(WebRtc_UWord32& timestamp));
int32_t(uint32_t& timestamp));
MOCK_CONST_METHOD0(RemoteSSRC,
WebRtc_UWord32());
uint32_t());
MOCK_CONST_METHOD1(RemoteCSRCs,
WebRtc_Word32(WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]));
int32_t(uint32_t arrOfCSRC[kRtpCsrcSize]));
MOCK_CONST_METHOD1(SSRCFilter,
WebRtc_Word32(WebRtc_UWord32& allowedSSRC));
int32_t(uint32_t& allowedSSRC));
MOCK_METHOD2(SetSSRCFilter,
WebRtc_Word32(const bool enable, const WebRtc_UWord32 allowedSSRC));
int32_t(const bool enable, const uint32_t allowedSSRC));
MOCK_METHOD2(SetRTXReceiveStatus,
WebRtc_Word32(const bool enable, const WebRtc_UWord32 SSRC));
int32_t(const bool enable, const uint32_t SSRC));
MOCK_CONST_METHOD2(RTXReceiveStatus,
WebRtc_Word32(bool* enable, WebRtc_UWord32* SSRC));
int32_t(bool* enable, uint32_t* SSRC));
MOCK_METHOD2(IncomingPacket,
WebRtc_Word32(const WebRtc_UWord8* incomingPacket, const WebRtc_UWord16 packetLength));
int32_t(const uint8_t* incomingPacket, const uint16_t packetLength));
MOCK_METHOD4(IncomingAudioNTP,
WebRtc_Word32(const WebRtc_UWord32 audioReceivedNTPsecs,
const WebRtc_UWord32 audioReceivedNTPfrac,
const WebRtc_UWord32 audioRTCPArrivalTimeSecs,
const WebRtc_UWord32 audioRTCPArrivalTimeFrac));
int32_t(const uint32_t audioReceivedNTPsecs,
const uint32_t audioReceivedNTPfrac,
const uint32_t audioRTCPArrivalTimeSecs,
const uint32_t audioRTCPArrivalTimeFrac));
MOCK_METHOD0(InitSender,
WebRtc_Word32());
int32_t());
MOCK_METHOD1(RegisterSendTransport,
WebRtc_Word32(Transport* outgoingTransport));
int32_t(Transport* outgoingTransport));
MOCK_METHOD1(SetMaxTransferUnit,
WebRtc_Word32(const WebRtc_UWord16 size));
int32_t(const uint16_t size));
MOCK_METHOD3(SetTransportOverhead,
WebRtc_Word32(const bool TCP, const bool IPV6,
const WebRtc_UWord8 authenticationOverhead));
int32_t(const bool TCP, const bool IPV6,
const uint8_t authenticationOverhead));
MOCK_CONST_METHOD0(MaxPayloadLength,
WebRtc_UWord16());
uint16_t());
MOCK_CONST_METHOD0(MaxDataPayloadLength,
WebRtc_UWord16());
uint16_t());
MOCK_METHOD1(RegisterSendPayload,
WebRtc_Word32(const CodecInst& voiceCodec));
int32_t(const CodecInst& voiceCodec));
MOCK_METHOD1(RegisterSendPayload,
WebRtc_Word32(const VideoCodec& videoCodec));
int32_t(const VideoCodec& videoCodec));
MOCK_METHOD1(DeRegisterSendPayload,
WebRtc_Word32(const WebRtc_Word8 payloadType));
int32_t(const int8_t payloadType));
MOCK_METHOD2(RegisterSendRtpHeaderExtension,
WebRtc_Word32(const RTPExtensionType type, const WebRtc_UWord8 id));
int32_t(const RTPExtensionType type, const uint8_t id));
MOCK_METHOD1(DeregisterSendRtpHeaderExtension,
WebRtc_Word32(const RTPExtensionType type));
int32_t(const RTPExtensionType type));
MOCK_CONST_METHOD0(StartTimestamp,
WebRtc_UWord32());
uint32_t());
MOCK_METHOD1(SetStartTimestamp,
WebRtc_Word32(const WebRtc_UWord32 timestamp));
int32_t(const uint32_t timestamp));
MOCK_CONST_METHOD0(SequenceNumber,
WebRtc_UWord16());
uint16_t());
MOCK_METHOD1(SetSequenceNumber,
WebRtc_Word32(const WebRtc_UWord16 seq));
int32_t(const uint16_t seq));
MOCK_CONST_METHOD0(SSRC,
WebRtc_UWord32());
uint32_t());
MOCK_METHOD1(SetSSRC,
WebRtc_Word32(const WebRtc_UWord32 ssrc));
int32_t(const uint32_t ssrc));
MOCK_CONST_METHOD1(CSRCs,
WebRtc_Word32(WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]));
int32_t(uint32_t arrOfCSRC[kRtpCsrcSize]));
MOCK_METHOD2(SetCSRCs,
WebRtc_Word32(const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize], const WebRtc_UWord8 arrLength));
int32_t(const uint32_t arrOfCSRC[kRtpCsrcSize], const uint8_t arrLength));
MOCK_METHOD1(SetCSRCStatus,
WebRtc_Word32(const bool include));
int32_t(const bool include));
MOCK_METHOD3(SetRTXSendStatus,
WebRtc_Word32(const RtxMode mode, const bool setSSRC,
const WebRtc_UWord32 SSRC));
int32_t(const RtxMode mode, const bool setSSRC,
const uint32_t SSRC));
MOCK_CONST_METHOD2(RTXSendStatus,
WebRtc_Word32(RtxMode* mode, WebRtc_UWord32* SSRC));
int32_t(RtxMode* mode, uint32_t* SSRC));
MOCK_METHOD1(SetSendingStatus,
WebRtc_Word32(const bool sending));
int32_t(const bool sending));
MOCK_CONST_METHOD0(Sending,
bool());
MOCK_METHOD1(SetSendingMediaStatus,
WebRtc_Word32(const bool sending));
int32_t(const bool sending));
MOCK_CONST_METHOD0(SendingMedia,
bool());
MOCK_CONST_METHOD4(BitrateSent,
void(WebRtc_UWord32* totalRate, WebRtc_UWord32* videoRate, WebRtc_UWord32* fecRate, WebRtc_UWord32* nackRate));
void(uint32_t* totalRate, uint32_t* videoRate, uint32_t* fecRate, uint32_t* nackRate));
MOCK_CONST_METHOD1(EstimatedReceiveBandwidth,
int(WebRtc_UWord32* available_bandwidth));
int(uint32_t* available_bandwidth));
MOCK_METHOD8(SendOutgoingData,
WebRtc_Word32(const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 timeStamp,
int64_t capture_time_ms,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const RTPFragmentationHeader* fragmentation,
const RTPVideoHeader* rtpVideoHdr));
int32_t(const FrameType frameType,
const int8_t payloadType,
const uint32_t timeStamp,
int64_t capture_time_ms,
const uint8_t* payloadData,
const uint32_t payloadSize,
const RTPFragmentationHeader* fragmentation,
const RTPVideoHeader* rtpVideoHdr));
MOCK_METHOD3(TimeToSendPacket,
void(uint32_t ssrc, uint16_t sequence_number, int64_t capture_time_ms));
MOCK_METHOD3(RegisterRtcpObservers,
@ -162,124 +162,124 @@ class MockRtpRtcp : public RtpRtcp {
MOCK_CONST_METHOD0(RTCP,
RTCPMethod());
MOCK_METHOD1(SetRTCPStatus,
WebRtc_Word32(const RTCPMethod method));
int32_t(const RTCPMethod method));
MOCK_METHOD1(SetCNAME,
WebRtc_Word32(const char cName[RTCP_CNAME_SIZE]));
int32_t(const char cName[RTCP_CNAME_SIZE]));
MOCK_METHOD1(CNAME,
WebRtc_Word32(char cName[RTCP_CNAME_SIZE]));
int32_t(char cName[RTCP_CNAME_SIZE]));
MOCK_CONST_METHOD2(RemoteCNAME,
WebRtc_Word32(const WebRtc_UWord32 remoteSSRC,
char cName[RTCP_CNAME_SIZE]));
int32_t(const uint32_t remoteSSRC,
char cName[RTCP_CNAME_SIZE]));
MOCK_CONST_METHOD5(RemoteNTP,
WebRtc_Word32(WebRtc_UWord32 *ReceivedNTPsecs,
WebRtc_UWord32 *ReceivedNTPfrac,
WebRtc_UWord32 *RTCPArrivalTimeSecs,
WebRtc_UWord32 *RTCPArrivalTimeFrac,
WebRtc_UWord32 *rtcp_timestamp));
int32_t(uint32_t *ReceivedNTPsecs,
uint32_t *ReceivedNTPfrac,
uint32_t *RTCPArrivalTimeSecs,
uint32_t *RTCPArrivalTimeFrac,
uint32_t *rtcp_timestamp));
MOCK_METHOD2(AddMixedCNAME,
WebRtc_Word32(const WebRtc_UWord32 SSRC,
const char cName[RTCP_CNAME_SIZE]));
int32_t(const uint32_t SSRC,
const char cName[RTCP_CNAME_SIZE]));
MOCK_METHOD1(RemoveMixedCNAME,
WebRtc_Word32(const WebRtc_UWord32 SSRC));
int32_t(const uint32_t SSRC));
MOCK_CONST_METHOD5(RTT,
WebRtc_Word32(const WebRtc_UWord32 remoteSSRC, WebRtc_UWord16* RTT, WebRtc_UWord16* avgRTT, WebRtc_UWord16* minRTT, WebRtc_UWord16* maxRTT));
int32_t(const uint32_t remoteSSRC, uint16_t* RTT, uint16_t* avgRTT, uint16_t* minRTT, uint16_t* maxRTT));
MOCK_METHOD1(ResetRTT,
WebRtc_Word32(const WebRtc_UWord32 remoteSSRC));
int32_t(const uint32_t remoteSSRC));
MOCK_METHOD1(SetRtt, void(uint32_t rtt));
MOCK_METHOD1(SendRTCP,
WebRtc_Word32(WebRtc_UWord32 rtcpPacketType));
int32_t(uint32_t rtcpPacketType));
MOCK_METHOD1(SendRTCPReferencePictureSelection,
WebRtc_Word32(const WebRtc_UWord64 pictureID));
int32_t(const uint64_t pictureID));
MOCK_METHOD1(SendRTCPSliceLossIndication,
WebRtc_Word32(const WebRtc_UWord8 pictureID));
int32_t(const uint8_t pictureID));
MOCK_METHOD0(ResetStatisticsRTP,
WebRtc_Word32());
int32_t());
MOCK_CONST_METHOD5(StatisticsRTP,
WebRtc_Word32(WebRtc_UWord8 *fraction_lost, WebRtc_UWord32 *cum_lost, WebRtc_UWord32 *ext_max, WebRtc_UWord32 *jitter, WebRtc_UWord32 *max_jitter));
int32_t(uint8_t *fraction_lost, uint32_t *cum_lost, uint32_t *ext_max, uint32_t *jitter, uint32_t *max_jitter));
MOCK_METHOD0(ResetReceiveDataCountersRTP,
WebRtc_Word32());
int32_t());
MOCK_METHOD0(ResetSendDataCountersRTP,
WebRtc_Word32());
int32_t());
MOCK_CONST_METHOD4(DataCountersRTP,
WebRtc_Word32(WebRtc_UWord32 *bytesSent, WebRtc_UWord32 *packetsSent, WebRtc_UWord32 *bytesReceived, WebRtc_UWord32 *packetsReceived));
int32_t(uint32_t *bytesSent, uint32_t *packetsSent, uint32_t *bytesReceived, uint32_t *packetsReceived));
MOCK_METHOD1(RemoteRTCPStat,
WebRtc_Word32(RTCPSenderInfo* senderInfo));
int32_t(RTCPSenderInfo* senderInfo));
MOCK_CONST_METHOD1(RemoteRTCPStat,
WebRtc_Word32(std::vector<RTCPReportBlock>* receiveBlocks));
int32_t(std::vector<RTCPReportBlock>* receiveBlocks));
MOCK_METHOD2(AddRTCPReportBlock,
WebRtc_Word32(const WebRtc_UWord32 SSRC, const RTCPReportBlock* receiveBlock));
int32_t(const uint32_t SSRC, const RTCPReportBlock* receiveBlock));
MOCK_METHOD1(RemoveRTCPReportBlock,
WebRtc_Word32(const WebRtc_UWord32 SSRC));
int32_t(const uint32_t SSRC));
MOCK_METHOD4(SetRTCPApplicationSpecificData,
WebRtc_Word32(const WebRtc_UWord8 subType, const WebRtc_UWord32 name, const WebRtc_UWord8* data, const WebRtc_UWord16 length));
int32_t(const uint8_t subType, const uint32_t name, const uint8_t* data, const uint16_t length));
MOCK_METHOD1(SetRTCPVoIPMetrics,
WebRtc_Word32(const RTCPVoIPMetric* VoIPMetric));
int32_t(const RTCPVoIPMetric* VoIPMetric));
MOCK_CONST_METHOD0(REMB,
bool());
MOCK_METHOD1(SetREMBStatus,
WebRtc_Word32(const bool enable));
int32_t(const bool enable));
MOCK_METHOD3(SetREMBData,
WebRtc_Word32(const WebRtc_UWord32 bitrate, const WebRtc_UWord8 numberOfSSRC, const WebRtc_UWord32* SSRC));
int32_t(const uint32_t bitrate, const uint8_t numberOfSSRC, const uint32_t* SSRC));
MOCK_METHOD1(SetRemoteBitrateObserver,
bool(RemoteBitrateObserver*));
MOCK_CONST_METHOD0(IJ,
bool());
MOCK_METHOD1(SetIJStatus,
WebRtc_Word32(const bool));
int32_t(const bool));
MOCK_CONST_METHOD0(TMMBR,
bool());
MOCK_METHOD1(SetTMMBRStatus,
WebRtc_Word32(const bool enable));
int32_t(const bool enable));
MOCK_METHOD1(OnBandwidthEstimateUpdate,
void(WebRtc_UWord16 bandWidthKbit));
void(uint16_t bandWidthKbit));
MOCK_CONST_METHOD0(NACK,
NACKMethod());
MOCK_METHOD2(SetNACKStatus,
WebRtc_Word32(const NACKMethod method, int oldestSequenceNumberToNack));
int32_t(const NACKMethod method, int oldestSequenceNumberToNack));
MOCK_CONST_METHOD0(SelectiveRetransmissions,
int());
MOCK_METHOD1(SetSelectiveRetransmissions,
int(uint8_t settings));
MOCK_METHOD2(SendNACK,
WebRtc_Word32(const WebRtc_UWord16* nackList, const WebRtc_UWord16 size));
int32_t(const uint16_t* nackList, const uint16_t size));
MOCK_METHOD2(SetStorePacketsStatus,
WebRtc_Word32(const bool enable, const WebRtc_UWord16 numberToStore));
int32_t(const bool enable, const uint16_t numberToStore));
MOCK_METHOD1(RegisterAudioCallback,
WebRtc_Word32(RtpAudioFeedback* messagesCallback));
int32_t(RtpAudioFeedback* messagesCallback));
MOCK_METHOD1(SetAudioPacketSize,
WebRtc_Word32(const WebRtc_UWord16 packetSizeSamples));
int32_t(const uint16_t packetSizeSamples));
MOCK_METHOD1(SetTelephoneEventForwardToDecoder, int(bool forwardToDecoder));
MOCK_CONST_METHOD0(TelephoneEventForwardToDecoder,
bool());
MOCK_CONST_METHOD1(SendTelephoneEventActive,
bool(WebRtc_Word8& telephoneEvent));
bool(int8_t& telephoneEvent));
MOCK_METHOD3(SendTelephoneEventOutband,
WebRtc_Word32(const WebRtc_UWord8 key, const WebRtc_UWord16 time_ms, const WebRtc_UWord8 level));
int32_t(const uint8_t key, const uint16_t time_ms, const uint8_t level));
MOCK_METHOD1(SetSendREDPayloadType,
WebRtc_Word32(const WebRtc_Word8 payloadType));
int32_t(const int8_t payloadType));
MOCK_CONST_METHOD1(SendREDPayloadType,
WebRtc_Word32(WebRtc_Word8& payloadType));
int32_t(int8_t& payloadType));
MOCK_METHOD2(SetRTPAudioLevelIndicationStatus,
WebRtc_Word32(const bool enable, const WebRtc_UWord8 ID));
int32_t(const bool enable, const uint8_t ID));
MOCK_CONST_METHOD2(GetRTPAudioLevelIndicationStatus,
WebRtc_Word32(bool& enable, WebRtc_UWord8& ID));
int32_t(bool& enable, uint8_t& ID));
MOCK_METHOD1(SetAudioLevel,
WebRtc_Word32(const WebRtc_UWord8 level_dBov));
int32_t(const uint8_t level_dBov));
MOCK_METHOD1(SetCameraDelay,
WebRtc_Word32(const WebRtc_Word32 delayMS));
int32_t(const int32_t delayMS));
MOCK_METHOD1(SetTargetSendBitrate,
void(const WebRtc_UWord32 bitrate));
void(const uint32_t bitrate));
MOCK_METHOD3(SetGenericFECStatus,
WebRtc_Word32(const bool enable, const WebRtc_UWord8 payloadTypeRED, const WebRtc_UWord8 payloadTypeFEC));
int32_t(const bool enable, const uint8_t payloadTypeRED, const uint8_t payloadTypeFEC));
MOCK_METHOD3(GenericFECStatus,
WebRtc_Word32(bool& enable, WebRtc_UWord8& payloadTypeRED, WebRtc_UWord8& payloadTypeFEC));
int32_t(bool& enable, uint8_t& payloadTypeRED, uint8_t& payloadTypeFEC));
MOCK_METHOD2(SetFecParameters,
WebRtc_Word32(const FecProtectionParams* delta_params,
const FecProtectionParams* key_params));
int32_t(const FecProtectionParams* delta_params,
const FecProtectionParams* key_params));
MOCK_METHOD1(SetKeyFrameRequestMethod,
WebRtc_Word32(const KeyFrameRequestMethod method));
int32_t(const KeyFrameRequestMethod method));
MOCK_METHOD0(RequestKeyFrame,
WebRtc_Word32());
int32_t());
MOCK_CONST_METHOD3(Version,
int32_t(char* version, uint32_t& remaining_buffer_in_bytes, uint32_t& position));
MOCK_METHOD0(TimeUntilNextProcess,

View File

@ -13,7 +13,7 @@
#include <string.h>
namespace webrtc {
BitstreamBuilder::BitstreamBuilder(WebRtc_UWord8* data, const WebRtc_UWord32 dataSize) :
BitstreamBuilder::BitstreamBuilder(uint8_t* data, const uint32_t dataSize) :
_data(data),
_dataSize(dataSize),
_byteOffset(0),
@ -22,14 +22,14 @@ BitstreamBuilder::BitstreamBuilder(WebRtc_UWord8* data, const WebRtc_UWord32 dat
memset(data, 0, dataSize);
}
WebRtc_UWord32
uint32_t
BitstreamBuilder::Length() const
{
return _byteOffset+ (_bitOffset?1:0);
}
WebRtc_Word32
BitstreamBuilder::Add1Bit(const WebRtc_UWord8 bit)
int32_t
BitstreamBuilder::Add1Bit(const uint8_t bit)
{
// sanity
if(_bitOffset + 1 > 8)
@ -45,7 +45,7 @@ BitstreamBuilder::Add1Bit(const WebRtc_UWord8 bit)
}
void
BitstreamBuilder::Add1BitWithoutSanity(const WebRtc_UWord8 bit)
BitstreamBuilder::Add1BitWithoutSanity(const uint8_t bit)
{
if(bit & 0x1)
{
@ -63,8 +63,8 @@ BitstreamBuilder::Add1BitWithoutSanity(const WebRtc_UWord8 bit)
}
}
WebRtc_Word32
BitstreamBuilder::Add2Bits(const WebRtc_UWord8 bits)
int32_t
BitstreamBuilder::Add2Bits(const uint8_t bits)
{
// sanity
if(_bitOffset + 2 > 8)
@ -80,8 +80,8 @@ BitstreamBuilder::Add2Bits(const WebRtc_UWord8 bits)
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add3Bits(const WebRtc_UWord8 bits)
int32_t
BitstreamBuilder::Add3Bits(const uint8_t bits)
{
// sanity
if(_bitOffset + 3 > 8)
@ -98,8 +98,8 @@ BitstreamBuilder::Add3Bits(const WebRtc_UWord8 bits)
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add4Bits(const WebRtc_UWord8 bits)
int32_t
BitstreamBuilder::Add4Bits(const uint8_t bits)
{
// sanity
if(_bitOffset + 4 > 8)
@ -117,8 +117,8 @@ BitstreamBuilder::Add4Bits(const WebRtc_UWord8 bits)
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add5Bits(const WebRtc_UWord8 bits)
int32_t
BitstreamBuilder::Add5Bits(const uint8_t bits)
{
// sanity
if(_bitOffset + 5 > 8)
@ -137,8 +137,8 @@ BitstreamBuilder::Add5Bits(const WebRtc_UWord8 bits)
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add6Bits(const WebRtc_UWord8 bits)
int32_t
BitstreamBuilder::Add6Bits(const uint8_t bits)
{
// sanity
if(_bitOffset + 6 > 8)
@ -158,8 +158,8 @@ BitstreamBuilder::Add6Bits(const WebRtc_UWord8 bits)
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add7Bits(const WebRtc_UWord8 bits)
int32_t
BitstreamBuilder::Add7Bits(const uint8_t bits)
{
// sanity
if(_bitOffset + 7 > 8)
@ -180,8 +180,8 @@ BitstreamBuilder::Add7Bits(const WebRtc_UWord8 bits)
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add8Bits(const WebRtc_UWord8 bits)
int32_t
BitstreamBuilder::Add8Bits(const uint8_t bits)
{
// sanity
if(_dataSize < Length()+1)
@ -201,8 +201,8 @@ BitstreamBuilder::Add8Bits(const WebRtc_UWord8 bits)
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add16Bits(const WebRtc_UWord16 bits)
int32_t
BitstreamBuilder::Add16Bits(const uint16_t bits)
{
// sanity
if(_dataSize < Length()+2)
@ -212,20 +212,20 @@ BitstreamBuilder::Add16Bits(const WebRtc_UWord16 bits)
}
if(_bitOffset == 0)
{
_data[_byteOffset] = (WebRtc_UWord8)(bits >> 8);
_data[_byteOffset+1] = (WebRtc_UWord8)(bits);
_data[_byteOffset] = (uint8_t)(bits >> 8);
_data[_byteOffset+1] = (uint8_t)(bits);
} else
{
_data[_byteOffset] += (WebRtc_UWord8)(bits >> (_bitOffset + 8));
_data[_byteOffset+1] += (WebRtc_UWord8)(bits >> _bitOffset);
_data[_byteOffset+2] += (WebRtc_UWord8)(bits << (8-_bitOffset));
_data[_byteOffset] += (uint8_t)(bits >> (_bitOffset + 8));
_data[_byteOffset+1] += (uint8_t)(bits >> _bitOffset);
_data[_byteOffset+2] += (uint8_t)(bits << (8-_bitOffset));
}
_byteOffset += 2;
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add24Bits(const WebRtc_UWord32 bits)
int32_t
BitstreamBuilder::Add24Bits(const uint32_t bits)
{
// sanity
if(_dataSize < Length()+3)
@ -235,22 +235,22 @@ BitstreamBuilder::Add24Bits(const WebRtc_UWord32 bits)
}
if(_bitOffset == 0)
{
_data[_byteOffset] = (WebRtc_UWord8)(bits >> 16);
_data[_byteOffset+1] = (WebRtc_UWord8)(bits >> 8);
_data[_byteOffset+2] = (WebRtc_UWord8)(bits);
_data[_byteOffset] = (uint8_t)(bits >> 16);
_data[_byteOffset+1] = (uint8_t)(bits >> 8);
_data[_byteOffset+2] = (uint8_t)(bits);
} else
{
_data[_byteOffset] += (WebRtc_UWord8)(bits >> (_bitOffset+16));
_data[_byteOffset+1] += (WebRtc_UWord8)(bits >> (_bitOffset+8));
_data[_byteOffset+2] += (WebRtc_UWord8)(bits >> (_bitOffset));
_data[_byteOffset+3] += (WebRtc_UWord8)(bits << (8-_bitOffset));
_data[_byteOffset] += (uint8_t)(bits >> (_bitOffset+16));
_data[_byteOffset+1] += (uint8_t)(bits >> (_bitOffset+8));
_data[_byteOffset+2] += (uint8_t)(bits >> (_bitOffset));
_data[_byteOffset+3] += (uint8_t)(bits << (8-_bitOffset));
}
_byteOffset += 3;
return 0;
}
WebRtc_Word32
BitstreamBuilder::Add32Bits(const WebRtc_UWord32 bits)
int32_t
BitstreamBuilder::Add32Bits(const uint32_t bits)
{
// sanity
if(_dataSize < Length()+4)
@ -260,17 +260,17 @@ BitstreamBuilder::Add32Bits(const WebRtc_UWord32 bits)
}
if(_bitOffset == 0)
{
_data[_byteOffset] = (WebRtc_UWord8)(bits >> 24);
_data[_byteOffset+1] = (WebRtc_UWord8)(bits >> 16);
_data[_byteOffset+2] = (WebRtc_UWord8)(bits >> 8);
_data[_byteOffset+3] = (WebRtc_UWord8)(bits);
_data[_byteOffset] = (uint8_t)(bits >> 24);
_data[_byteOffset+1] = (uint8_t)(bits >> 16);
_data[_byteOffset+2] = (uint8_t)(bits >> 8);
_data[_byteOffset+3] = (uint8_t)(bits);
} else
{
_data[_byteOffset] += (WebRtc_UWord8)(bits >> (_bitOffset+24));
_data[_byteOffset+1] += (WebRtc_UWord8)(bits >> (_bitOffset+16));
_data[_byteOffset+2] += (WebRtc_UWord8)(bits >> (_bitOffset+8));
_data[_byteOffset+3] += (WebRtc_UWord8)(bits >> (_bitOffset));
_data[_byteOffset+4] += (WebRtc_UWord8)(bits << (8-_bitOffset));
_data[_byteOffset] += (uint8_t)(bits >> (_bitOffset+24));
_data[_byteOffset+1] += (uint8_t)(bits >> (_bitOffset+16));
_data[_byteOffset+2] += (uint8_t)(bits >> (_bitOffset+8));
_data[_byteOffset+3] += (uint8_t)(bits >> (_bitOffset));
_data[_byteOffset+4] += (uint8_t)(bits << (8-_bitOffset));
}
_byteOffset += 4;
return 0;
@ -287,8 +287,8 @@ BitstreamBuilder::Add32Bits(const WebRtc_UWord32 bits)
0 0 0 0 1 x3 x2 x1 x0 15..30
0 0 0 0 0 1 x4 x3 x2 x1 x0 31..62
*/
WebRtc_Word32
BitstreamBuilder::AddUE(const WebRtc_UWord32 value)
int32_t
BitstreamBuilder::AddUE(const uint32_t value)
{
// un-rolled on 8 bit base to avoid too deep if else chain
if(value < 0x0000ffff)
@ -543,18 +543,18 @@ BitstreamBuilder::AddUE(const WebRtc_UWord32 value)
return 0;
}
WebRtc_Word32
BitstreamBuilder::AddPrefix(const WebRtc_UWord8 numZeros)
int32_t
BitstreamBuilder::AddPrefix(const uint8_t numZeros)
{
// sanity for the sufix too
WebRtc_UWord32 numBitsToAdd = numZeros * 2 + 1;
uint32_t numBitsToAdd = numZeros * 2 + 1;
if(((_dataSize - _byteOffset) *8 + 8-_bitOffset) < numBitsToAdd)
{
return -1;
}
// add numZeros
for (WebRtc_UWord32 i = 0; i < numZeros; i++)
for (uint32_t i = 0; i < numZeros; i++)
{
Add1Bit(0);
}
@ -563,10 +563,10 @@ BitstreamBuilder::AddPrefix(const WebRtc_UWord8 numZeros)
}
void
BitstreamBuilder::AddSuffix(const WebRtc_UWord8 numBits, const WebRtc_UWord32 rest)
BitstreamBuilder::AddSuffix(const uint8_t numBits, const uint32_t rest)
{
// most significant bit first
for(WebRtc_Word32 i = numBits - 1; i >= 0; i--)
for(int32_t i = numBits - 1; i >= 0; i--)
{
if(( rest >> i) & 0x1)
{

View File

@ -17,35 +17,35 @@ namespace webrtc {
class BitstreamBuilder
{
public:
BitstreamBuilder(WebRtc_UWord8* data, const WebRtc_UWord32 dataSize);
BitstreamBuilder(uint8_t* data, const uint32_t dataSize);
WebRtc_UWord32 Length() const;
uint32_t Length() const;
WebRtc_Word32 Add1Bit(const WebRtc_UWord8 bit);
WebRtc_Word32 Add2Bits(const WebRtc_UWord8 bits);
WebRtc_Word32 Add3Bits(const WebRtc_UWord8 bits);
WebRtc_Word32 Add4Bits(const WebRtc_UWord8 bits);
WebRtc_Word32 Add5Bits(const WebRtc_UWord8 bits);
WebRtc_Word32 Add6Bits(const WebRtc_UWord8 bits);
WebRtc_Word32 Add7Bits(const WebRtc_UWord8 bits);
WebRtc_Word32 Add8Bits(const WebRtc_UWord8 bits);
WebRtc_Word32 Add16Bits(const WebRtc_UWord16 bits);
WebRtc_Word32 Add24Bits(const WebRtc_UWord32 bits);
WebRtc_Word32 Add32Bits(const WebRtc_UWord32 bits);
int32_t Add1Bit(const uint8_t bit);
int32_t Add2Bits(const uint8_t bits);
int32_t Add3Bits(const uint8_t bits);
int32_t Add4Bits(const uint8_t bits);
int32_t Add5Bits(const uint8_t bits);
int32_t Add6Bits(const uint8_t bits);
int32_t Add7Bits(const uint8_t bits);
int32_t Add8Bits(const uint8_t bits);
int32_t Add16Bits(const uint16_t bits);
int32_t Add24Bits(const uint32_t bits);
int32_t Add32Bits(const uint32_t bits);
// Exp-Golomb codes
WebRtc_Word32 AddUE(const WebRtc_UWord32 value);
int32_t AddUE(const uint32_t value);
private:
WebRtc_Word32 AddPrefix(const WebRtc_UWord8 numZeros);
void AddSuffix(const WebRtc_UWord8 numBits, const WebRtc_UWord32 rest);
void Add1BitWithoutSanity(const WebRtc_UWord8 bit);
int32_t AddPrefix(const uint8_t numZeros);
void AddSuffix(const uint8_t numBits, const uint32_t rest);
void Add1BitWithoutSanity(const uint8_t bit);
WebRtc_UWord8* _data;
WebRtc_UWord32 _dataSize;
uint8_t* _data;
uint32_t _dataSize;
WebRtc_UWord32 _byteOffset;
WebRtc_UWord8 _bitOffset;
uint32_t _byteOffset;
uint8_t _bitOffset;
};
} // namespace webrtc

View File

@ -11,7 +11,7 @@
#include "bitstream_parser.h"
namespace webrtc {
BitstreamParser::BitstreamParser(const WebRtc_UWord8* data, const WebRtc_UWord32 dataLength) :
BitstreamParser::BitstreamParser(const uint8_t* data, const uint32_t dataLength) :
_data(data),
_dataLength(dataLength),
_byteOffset(0),
@ -20,10 +20,10 @@ BitstreamParser::BitstreamParser(const WebRtc_UWord8* data, const WebRtc_UWord32
}
// todo should we have any error codes from this?
WebRtc_UWord8
uint8_t
BitstreamParser::Get1Bit()
{
WebRtc_UWord8 retVal = 0x1 & (_data[_byteOffset] >> (7-_bitOffset++));
uint8_t retVal = 0x1 & (_data[_byteOffset] >> (7-_bitOffset++));
// prepare next byte
if(_bitOffset == 8)
@ -34,37 +34,37 @@ BitstreamParser::Get1Bit()
return retVal;
}
WebRtc_UWord8
uint8_t
BitstreamParser::Get2Bits()
{
WebRtc_UWord8 retVal = (Get1Bit() << 1);
uint8_t retVal = (Get1Bit() << 1);
retVal += Get1Bit();
return retVal;
}
WebRtc_UWord8
uint8_t
BitstreamParser::Get3Bits()
{
WebRtc_UWord8 retVal = (Get1Bit() << 2);
uint8_t retVal = (Get1Bit() << 2);
retVal += (Get1Bit() << 1);
retVal += Get1Bit();
return retVal;
}
WebRtc_UWord8
uint8_t
BitstreamParser::Get4Bits()
{
WebRtc_UWord8 retVal = (Get1Bit() << 3);
uint8_t retVal = (Get1Bit() << 3);
retVal += (Get1Bit() << 2);
retVal += (Get1Bit() << 1);
retVal += Get1Bit();
return retVal;
}
WebRtc_UWord8
uint8_t
BitstreamParser::Get5Bits()
{
WebRtc_UWord8 retVal = (Get1Bit() << 4);
uint8_t retVal = (Get1Bit() << 4);
retVal += (Get1Bit() << 3);
retVal += (Get1Bit() << 2);
retVal += (Get1Bit() << 1);
@ -72,10 +72,10 @@ BitstreamParser::Get5Bits()
return retVal;
}
WebRtc_UWord8
uint8_t
BitstreamParser::Get6Bits()
{
WebRtc_UWord8 retVal = (Get1Bit() << 5);
uint8_t retVal = (Get1Bit() << 5);
retVal += (Get1Bit() << 4);
retVal += (Get1Bit() << 3);
retVal += (Get1Bit() << 2);
@ -84,10 +84,10 @@ BitstreamParser::Get6Bits()
return retVal;
}
WebRtc_UWord8
uint8_t
BitstreamParser::Get7Bits()
{
WebRtc_UWord8 retVal = (Get1Bit() << 6);
uint8_t retVal = (Get1Bit() << 6);
retVal += (Get1Bit() << 5);
retVal += (Get1Bit() << 4);
retVal += (Get1Bit() << 3);
@ -97,10 +97,10 @@ BitstreamParser::Get7Bits()
return retVal;
}
WebRtc_UWord8
uint8_t
BitstreamParser::Get8Bits()
{
WebRtc_UWord16 retVal;
uint16_t retVal;
if(_bitOffset != 0)
{
@ -112,13 +112,13 @@ BitstreamParser::Get8Bits()
retVal = _data[_byteOffset];
}
_byteOffset++;
return (WebRtc_UWord8)retVal;
return (uint8_t)retVal;
}
WebRtc_UWord16
uint16_t
BitstreamParser::Get16Bits()
{
WebRtc_UWord32 retVal;
uint32_t retVal;
if(_bitOffset != 0)
{
@ -131,13 +131,13 @@ BitstreamParser::Get16Bits()
retVal = (_data[_byteOffset] << 8) + (_data[_byteOffset+1]) ;
}
_byteOffset += 2;
return (WebRtc_UWord16)retVal;
return (uint16_t)retVal;
}
WebRtc_UWord32
uint32_t
BitstreamParser::Get24Bits()
{
WebRtc_UWord32 retVal;
uint32_t retVal;
if(_bitOffset != 0)
{
@ -153,15 +153,15 @@ BitstreamParser::Get24Bits()
return retVal & 0x00ffffff; // we need to clean up the high 8 bits
}
WebRtc_UWord32
uint32_t
BitstreamParser::Get32Bits()
{
WebRtc_UWord32 retVal;
uint32_t retVal;
if(_bitOffset != 0)
{
// read 40 bits
WebRtc_UWord64 tempVal = _data[_byteOffset];
uint64_t tempVal = _data[_byteOffset];
tempVal <<= 8;
tempVal += _data[_byteOffset+1];
tempVal <<= 8;
@ -172,7 +172,7 @@ BitstreamParser::Get32Bits()
tempVal += _data[_byteOffset+4];
tempVal >>= (8-_bitOffset);
retVal = WebRtc_UWord32(tempVal);
retVal = uint32_t(tempVal);
}else
{
// read 32 bits
@ -194,11 +194,11 @@ BitstreamParser::Get32Bits()
0 0 0 0 0 1 x4 x3 x2 x1 x0 31..62
*/
WebRtc_UWord32
uint32_t
BitstreamParser::GetUE()
{
WebRtc_UWord32 retVal = 0;
WebRtc_UWord8 numLeadingZeros = 0;
uint32_t retVal = 0;
uint8_t numLeadingZeros = 0;
while (Get1Bit() != 1)
{

View File

@ -17,29 +17,29 @@ namespace webrtc {
class BitstreamParser
{
public:
BitstreamParser(const WebRtc_UWord8* data, const WebRtc_UWord32 dataLength);
BitstreamParser(const uint8_t* data, const uint32_t dataLength);
WebRtc_UWord8 Get1Bit();
WebRtc_UWord8 Get2Bits();
WebRtc_UWord8 Get3Bits();
WebRtc_UWord8 Get4Bits();
WebRtc_UWord8 Get5Bits();
WebRtc_UWord8 Get6Bits();
WebRtc_UWord8 Get7Bits();
WebRtc_UWord8 Get8Bits();
WebRtc_UWord16 Get16Bits();
WebRtc_UWord32 Get24Bits();
WebRtc_UWord32 Get32Bits();
uint8_t Get1Bit();
uint8_t Get2Bits();
uint8_t Get3Bits();
uint8_t Get4Bits();
uint8_t Get5Bits();
uint8_t Get6Bits();
uint8_t Get7Bits();
uint8_t Get8Bits();
uint16_t Get16Bits();
uint32_t Get24Bits();
uint32_t Get32Bits();
// Exp-Golomb codes
WebRtc_UWord32 GetUE();
uint32_t GetUE();
private:
const WebRtc_UWord8* _data;
const WebRtc_UWord32 _dataLength;
const uint8_t* _data;
const uint32_t _dataLength;
WebRtc_UWord32 _byteOffset;
WebRtc_UWord8 _bitOffset;
uint32_t _byteOffset;
uint8_t _bitOffset;
};
} // namespace webrtc

View File

@ -18,9 +18,9 @@
#include <stdio.h>
#include <math.h>
WebRtc_UWord32 BitRateBPS(WebRtc_UWord16 x )
uint32_t BitRateBPS(uint16_t x )
{
return (x & 0x3fff) * WebRtc_UWord32(pow(10.0f,(2 + (x >> 14))));
return (x & 0x3fff) * uint32_t(pow(10.0f,(2 + (x >> 14))));
}
#endif
@ -52,7 +52,7 @@ H264Information::Reset()
memset(_info.type, 0, sizeof(_info.type));
memset(_info.accLayerSize, 0, sizeof(_info.accLayerSize));
for (WebRtc_Word32 i = 0; i < KMaxNumberOfNALUs; i++)
for (int32_t i = 0; i < KMaxNumberOfNALUs; i++)
{
_info.SVCheader[i].idr = 0;
_info.SVCheader[i].priorityID = 0;
@ -81,8 +81,8 @@ H264Information::Reset()
}
/*******************************************************************************
* WebRtc_Word32 GetInfo(const WebRtc_UWord8* ptrEncodedBuffer,
* const WebRtc_UWord32 length,
* int32_t GetInfo(const uint8_t* ptrEncodedBuffer,
* const uint32_t length,
* const H264Info*& ptrInfo);
*
* Gets information from an encoded stream.
@ -98,9 +98,9 @@ H264Information::Reset()
* - 0 : ok
* - (-1) : Error
*/
WebRtc_Word32
H264Information::GetInfo(const WebRtc_UWord8* ptrEncodedBuffer,
const WebRtc_UWord32 length,
int32_t
H264Information::GetInfo(const uint8_t* ptrEncodedBuffer,
const uint32_t length,
const H264Info*& ptrInfo)
{
if (!ptrEncodedBuffer || length < 4)
@ -132,7 +132,7 @@ H264Information::Type()
/*******************************************************************************
* bool HasInfo(const WebRtc_UWord32 length);
* bool HasInfo(const uint32_t length);
*
* Checks if information has already been stored for this encoded stream.
*
@ -144,7 +144,7 @@ H264Information::Type()
*/
bool
H264Information::HasInfo(const WebRtc_UWord32 length)
H264Information::HasInfo(const uint32_t length)
{
if (!_info.numNALUs)
{
@ -162,8 +162,8 @@ H264Information::HasInfo(const WebRtc_UWord32 length)
}
/*******************************************************************************
* WebRtc_Word32 FindInfo(const WebRtc_UWord8* ptrEncodedBuffer,
* const WebRtc_UWord32 length);
* int32_t FindInfo(const uint8_t* ptrEncodedBuffer,
* const uint32_t length);
*
* Parses the encoded stream.
*
@ -175,8 +175,8 @@ H264Information::HasInfo(const WebRtc_UWord32 length)
* - 0 : ok
* - (-1) : Error
*/
WebRtc_Word32
H264Information::FindInfo(const WebRtc_UWord8* ptrEncodedBuffer, const WebRtc_UWord32 length)
int32_t
H264Information::FindInfo(const uint8_t* ptrEncodedBuffer, const uint32_t length)
{
_ptrData = ptrEncodedBuffer;
_length = length;
@ -193,7 +193,7 @@ H264Information::FindInfo(const WebRtc_UWord8* ptrEncodedBuffer, const WebRtc_UW
}
// Get NAL unit payload size
WebRtc_Word32 foundLast = FindNALU();
int32_t foundLast = FindNALU();
if (foundLast == -1)
{
Reset();
@ -251,7 +251,7 @@ H264Information::FindInfo(const WebRtc_UWord8* ptrEncodedBuffer, const WebRtc_UW
}
/*******************************************************************************
* WebRtc_Word32 FindNALUStartCodeSize();
* int32_t FindNALUStartCodeSize();
*
* Finds the start code length of the current NAL unit.
*
@ -262,15 +262,15 @@ H264Information::FindInfo(const WebRtc_UWord8* ptrEncodedBuffer, const WebRtc_UW
* - 0 : ok
* - (-1) : Error
*/
WebRtc_Word32
int32_t
H264Information::FindNALUStartCodeSize()
{
// NAL unit start code. Ex. {0,0,1} or {0,0,0,1}
for (WebRtc_UWord32 i = 2; i < _remLength; i++)
for (uint32_t i = 2; i < _remLength; i++)
{
if (_ptrData[i] == 1 && _ptrData[i - 1] == 0 && _ptrData[i - 2] == 0)
{
_info.startCodeSize[_info.numNALUs] = WebRtc_UWord8(i + 1);
_info.startCodeSize[_info.numNALUs] = uint8_t(i + 1);
return 0;
}
}
@ -278,7 +278,7 @@ H264Information::FindNALUStartCodeSize()
}
/*******************************************************************************
* WebRtc_Word32 FindNALU();
* int32_t FindNALU();
*
* Finds the length of the current NAL unit.
*
@ -292,14 +292,14 @@ H264Information::FindNALUStartCodeSize()
* - 0 : ok
* - (-1) : Error
*/
WebRtc_Word32
int32_t
H264Information::FindNALU()
{
for (WebRtc_UWord32 i = _info.startCodeSize[_info.numNALUs]; i < _remLength - 2; i += 2)
for (uint32_t i = _info.startCodeSize[_info.numNALUs]; i < _remLength - 2; i += 2)
{
if (_ptrData[i] == 0)
{
WebRtc_Word32 size = 0;
int32_t size = 0;
if ((_ptrData[i + 1] == 1 && _ptrData[i - 1] == 0) ||
(_ptrData[i + 2] == 1 && _ptrData[i + 1] == 0))
{
@ -354,7 +354,7 @@ H264Information::GetNRI()
// in the same layer, or contains a parameter set.
const WebRtc_UWord8 type = _ptrData[_info.startCodeSize[_info.numNALUs]] & 0x1f;
const uint8_t type = _ptrData[_info.startCodeSize[_info.numNALUs]] & 0x1f;
// NALU type of 5, 7 and 8 shoud have NRI to b011
if( type == 5 ||
@ -370,7 +370,7 @@ H264Information::GetNRI()
/*******************************************************************************
* WebRtc_Word32 FindNALUType();
* int32_t FindNALUType();
*
* Finds the type of the current NAL unit.
*
@ -381,7 +381,7 @@ H264Information::GetNRI()
* - 0 : ok
* - (-1) : Error
*/
WebRtc_Word32
int32_t
H264Information::FindNALUType()
{
// NAL unit header (1 byte)
@ -406,7 +406,7 @@ H264Information::FindNALUType()
}
/*******************************************************************************
* WebRtc_Word32 ParseSVCNALUHeader();
* int32_t ParseSVCNALUHeader();
*
* Finds the extended header of the current NAL unit. Included for NAL unit types 14 and 20.
*
@ -417,7 +417,7 @@ H264Information::FindNALUType()
* - 0 : ok
* - (-1) : Error
*/
WebRtc_Word32
int32_t
H264Information::ParseSVCNALUHeader()
{
if (_info.type[_info.numNALUs] == 5)
@ -426,16 +426,16 @@ H264Information::ParseSVCNALUHeader()
}
if (_info.type[_info.numNALUs] == 6)
{
WebRtc_UWord32 seiPayloadSize;
uint32_t seiPayloadSize;
do
{
// SEI message
seiPayloadSize = 0;
WebRtc_UWord32 curByte = _info.startCodeSize[_info.numNALUs] + 1;
const WebRtc_UWord32 seiStartOffset = curByte;
uint32_t curByte = _info.startCodeSize[_info.numNALUs] + 1;
const uint32_t seiStartOffset = curByte;
WebRtc_UWord32 seiPayloadType = 0;
uint32_t seiPayloadType = 0;
while(_ptrData[curByte] == 0xff)
{
seiPayloadType += 255;
@ -466,27 +466,27 @@ H264Information::ParseSVCNALUHeader()
{
_info.PACSI[0].seiMessageLength[0] = seiPayloadSize;
delete [] _info.PACSI[0].seiMessageData[0];
_info.PACSI[0].seiMessageData[0] = new WebRtc_UWord8[seiPayloadSize];
_info.PACSI[0].seiMessageData[0] = new uint8_t[seiPayloadSize];
}
memcpy(_info.PACSI[0].seiMessageData[0], _ptrData+seiStartOffset, seiPayloadSize);
_info.PACSI[0].NALlength += seiPayloadSize + 2; // additional 2 is the length
#ifdef DEBUG_SEI_MESSAGE
const WebRtc_UWord8 numberOfLayers = 10;
WebRtc_UWord16 avgBitrate[numberOfLayers]= {0,0,0,0,0,0,0,0,0,0};
WebRtc_UWord16 maxBitrateLayer[numberOfLayers]= {0,0,0,0,0,0,0,0,0,0};
WebRtc_UWord16 maxBitrateLayerRepresentation[numberOfLayers] = {0,0,0,0,0,0,0,0,0,0};
WebRtc_UWord16 maxBitrareCalcWindow[numberOfLayers] = {0,0,0,0,0,0,0,0,0,0};
const uint8_t numberOfLayers = 10;
uint16_t avgBitrate[numberOfLayers]= {0,0,0,0,0,0,0,0,0,0};
uint16_t maxBitrateLayer[numberOfLayers]= {0,0,0,0,0,0,0,0,0,0};
uint16_t maxBitrateLayerRepresentation[numberOfLayers] = {0,0,0,0,0,0,0,0,0,0};
uint16_t maxBitrareCalcWindow[numberOfLayers] = {0,0,0,0,0,0,0,0,0,0};
BitstreamParser parserScalabilityInfo(_ptrData+curByte, seiPayloadSize);
parserScalabilityInfo.Get1Bit(); // not used in futher parsing
const WebRtc_UWord8 priority_layer_info_present = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 priority_id_setting_flag = parserScalabilityInfo.Get1Bit();
const uint8_t priority_layer_info_present = parserScalabilityInfo.Get1Bit();
const uint8_t priority_id_setting_flag = parserScalabilityInfo.Get1Bit();
WebRtc_UWord32 numberOfLayersMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 j = 0; j<= numberOfLayersMinusOne; j++)
uint32_t numberOfLayersMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t j = 0; j<= numberOfLayersMinusOne; j++)
{
printf("\nLayer ID:%d \n",parserScalabilityInfo.GetUE());
printf("Priority ID:%d \n", parserScalabilityInfo.Get6Bits());
@ -496,24 +496,24 @@ H264Information::ParseSVCNALUHeader()
printf("Quality ID:%d \n", parserScalabilityInfo.Get4Bits());
printf("Temporal ID:%d \n", parserScalabilityInfo.Get3Bits());
const WebRtc_UWord8 sub_pic_layer_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 sub_region_layer_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 iroi_division_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 profile_level_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 bitrate_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 frm_rate_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 frm_size_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 layer_dependency_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 parameter_sets_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 bitstream_restriction_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 exact_inter_layer_pred_flag = parserScalabilityInfo.Get1Bit(); // not used in futher parsing
const uint8_t sub_pic_layer_flag = parserScalabilityInfo.Get1Bit();
const uint8_t sub_region_layer_flag = parserScalabilityInfo.Get1Bit();
const uint8_t iroi_division_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t profile_level_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t bitrate_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t frm_rate_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t frm_size_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t layer_dependency_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t parameter_sets_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t bitstream_restriction_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t exact_inter_layer_pred_flag = parserScalabilityInfo.Get1Bit(); // not used in futher parsing
if(sub_pic_layer_flag || iroi_division_info_present_flag)
{
parserScalabilityInfo.Get1Bit();
}
const WebRtc_UWord8 layer_conversion_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 layer_output_flag = parserScalabilityInfo.Get1Bit(); // not used in futher parsing
const uint8_t layer_conversion_flag = parserScalabilityInfo.Get1Bit();
const uint8_t layer_output_flag = parserScalabilityInfo.Get1Bit(); // not used in futher parsing
if(profile_level_info_present_flag)
{
@ -565,8 +565,8 @@ H264Information::ParseSVCNALUHeader()
parserScalabilityInfo.GetUE();
}else
{
const WebRtc_UWord32 numRoisMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k <= numRoisMinusOne; k++)
const uint32_t numRoisMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t k = 0; k <= numRoisMinusOne; k++)
{
parserScalabilityInfo.GetUE();
parserScalabilityInfo.GetUE();
@ -576,8 +576,8 @@ H264Information::ParseSVCNALUHeader()
}
if(layer_dependency_info_present_flag)
{
const WebRtc_UWord32 numDirectlyDependentLayers = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k < numDirectlyDependentLayers; k++)
const uint32_t numDirectlyDependentLayers = parserScalabilityInfo.GetUE();
for(uint32_t k = 0; k < numDirectlyDependentLayers; k++)
{
parserScalabilityInfo.GetUE();
}
@ -587,18 +587,18 @@ H264Information::ParseSVCNALUHeader()
}
if(parameter_sets_info_present_flag)
{
const WebRtc_UWord32 numSeqParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k <= numSeqParameterSetMinusOne; k++)
const uint32_t numSeqParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t k = 0; k <= numSeqParameterSetMinusOne; k++)
{
parserScalabilityInfo.GetUE();
}
const WebRtc_UWord32 numSubsetSeqParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 l = 0; l <= numSubsetSeqParameterSetMinusOne; l++)
const uint32_t numSubsetSeqParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t l = 0; l <= numSubsetSeqParameterSetMinusOne; l++)
{
parserScalabilityInfo.GetUE();
}
const WebRtc_UWord32 numPicParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 m = 0; m <= numPicParameterSetMinusOne; m++)
const uint32_t numPicParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t m = 0; m <= numPicParameterSetMinusOne; m++)
{
parserScalabilityInfo.GetUE();
}
@ -619,7 +619,7 @@ H264Information::ParseSVCNALUHeader()
if(layer_conversion_flag)
{
parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k <2;k++)
for(uint32_t k = 0; k <2;k++)
{
if(parserScalabilityInfo.Get1Bit())
{
@ -632,12 +632,12 @@ H264Information::ParseSVCNALUHeader()
}
if(priority_layer_info_present)
{
const WebRtc_UWord32 prNumDidMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k <= prNumDidMinusOne;k++)
const uint32_t prNumDidMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t k = 0; k <= prNumDidMinusOne;k++)
{
parserScalabilityInfo.Get3Bits();
const WebRtc_UWord32 prNumMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 l = 0; l <= prNumMinusOne; l++)
const uint32_t prNumMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t l = 0; l <= prNumMinusOne; l++)
{
parserScalabilityInfo.GetUE();
parserScalabilityInfo.Get24Bits();
@ -648,8 +648,8 @@ H264Information::ParseSVCNALUHeader()
}
if(priority_id_setting_flag)
{
WebRtc_UWord8 priorityIdSettingUri;
WebRtc_UWord32 priorityIdSettingUriIdx = 0;
uint8_t priorityIdSettingUri;
uint32_t priorityIdSettingUriIdx = 0;
do
{
priorityIdSettingUri = parserScalabilityInfo.Get8Bits();
@ -686,7 +686,7 @@ H264Information::ParseSVCNALUHeader()
if (_info.type[_info.numNALUs] == 14 ||
_info.type[_info.numNALUs] == 20)
{
WebRtc_UWord32 curByte = _info.startCodeSize[_info.numNALUs] + 1;
uint32_t curByte = _info.startCodeSize[_info.numNALUs] + 1;
if (_remLength < curByte + 3)
{
@ -726,7 +726,7 @@ H264Information::ParseSVCNALUHeader()
*
*/
void
H264Information::SetLayerSEBit(WebRtc_Word32 foundLast)
H264Information::SetLayerSEBit(int32_t foundLast)
{
if (_info.numNALUs == 0)
{
@ -766,7 +766,7 @@ H264Information::SetLayerSEBit(WebRtc_Word32 foundLast)
}
/*******************************************************************************
* WebRtc_Word32 SetLayerLengths();
* int32_t SetLayerLengths();
*
* Sets the accumulated layer length.
*
@ -778,17 +778,17 @@ H264Information::SetLayerSEBit(WebRtc_Word32 foundLast)
* - (-1) : Error
*
*/
WebRtc_Word32
int32_t
H264Information::SetLayerLengths()
{
for (WebRtc_UWord32 curNALU = 0; curNALU < _info.numNALUs; curNALU++)
for (uint32_t curNALU = 0; curNALU < _info.numNALUs; curNALU++)
{
_info.accLayerSize[_info.numLayers] += _info.startCodeSize[curNALU] + _info.payloadSize[curNALU];
if (_info.PACSI[curNALU].E == 1)
{
_info.numLayers++;
if (curNALU == WebRtc_UWord32(_info.numNALUs - 1))
if (curNALU == uint32_t(_info.numNALUs - 1))
{
break;
}
@ -807,7 +807,7 @@ H264Information::SetLayerLengths()
return -1;
}
if (_info.accLayerSize[_info.numLayers - 1] != WebRtc_Word32(_length))
if (_info.accLayerSize[_info.numLayers - 1] != int32_t(_length))
{
Reset();
return -1;

View File

@ -40,18 +40,18 @@ struct H264_SVC_NALUHeader
length(3)
{
}
const WebRtc_UWord8 r;
WebRtc_UWord8 idr;
WebRtc_UWord8 priorityID;
WebRtc_UWord8 interLayerPred;
WebRtc_UWord8 dependencyID;
WebRtc_UWord8 qualityID;
WebRtc_UWord8 temporalID;
WebRtc_UWord8 useRefBasePic;
WebRtc_UWord8 discardable;
WebRtc_UWord8 output;
const WebRtc_UWord8 rr;
const WebRtc_UWord8 length;
const uint8_t r;
uint8_t idr;
uint8_t priorityID;
uint8_t interLayerPred;
uint8_t dependencyID;
uint8_t qualityID;
uint8_t temporalID;
uint8_t useRefBasePic;
uint8_t discardable;
uint8_t output;
const uint8_t rr;
const uint8_t length;
};
class H264_PACSI_NALU
@ -87,22 +87,22 @@ public:
}
}
WebRtc_UWord32 NALlength;
const WebRtc_UWord8 type;
WebRtc_UWord8 X;
WebRtc_UWord8 Y;
// WebRtc_UWord8 T;
WebRtc_UWord8 A;
WebRtc_UWord8 P;
WebRtc_UWord8 C;
WebRtc_UWord8 S;
WebRtc_UWord8 E;
WebRtc_UWord8 TL0picIDx;
WebRtc_UWord16 IDRpicID;
WebRtc_UWord16 DONC;
WebRtc_UWord32 numSEINALUs;
WebRtc_UWord32 seiMessageLength[KMaxNumberOfSEINALUs]; // we allow KMaxNumberOfSEINALUs SEI messages
WebRtc_UWord8* seiMessageData[KMaxNumberOfSEINALUs];
uint32_t NALlength;
const uint8_t type;
uint8_t X;
uint8_t Y;
// uint8_t T;
uint8_t A;
uint8_t P;
uint8_t C;
uint8_t S;
uint8_t E;
uint8_t TL0picIDx;
uint16_t IDRpicID;
uint16_t DONC;
uint32_t numSEINALUs;
uint32_t seiMessageLength[KMaxNumberOfSEINALUs]; // we allow KMaxNumberOfSEINALUs SEI messages
uint8_t* seiMessageData[KMaxNumberOfSEINALUs];
};
struct H264Info
@ -118,15 +118,15 @@ struct H264Info
memset(type, 0, sizeof(type));
memset(accLayerSize, 0, sizeof(accLayerSize));
}
WebRtc_UWord16 numNALUs;
WebRtc_UWord8 numLayers;
WebRtc_UWord8 startCodeSize[KMaxNumberOfNALUs];
WebRtc_UWord32 payloadSize[KMaxNumberOfNALUs];
WebRtc_UWord8 NRI[KMaxNumberOfNALUs];
WebRtc_UWord8 type[KMaxNumberOfNALUs];
uint16_t numNALUs;
uint8_t numLayers;
uint8_t startCodeSize[KMaxNumberOfNALUs];
uint32_t payloadSize[KMaxNumberOfNALUs];
uint8_t NRI[KMaxNumberOfNALUs];
uint8_t type[KMaxNumberOfNALUs];
H264_SVC_NALUHeader SVCheader[KMaxNumberOfNALUs];
H264_PACSI_NALU PACSI[KMaxNumberOfNALUs];
WebRtc_Word32 accLayerSize[KMaxNumberOfLayers];
int32_t accLayerSize[KMaxNumberOfLayers];
};
@ -140,29 +140,29 @@ public:
virtual RtpVideoCodecTypes Type();
virtual WebRtc_Word32 GetInfo(const WebRtc_UWord8* ptrEncodedBuffer, const WebRtc_UWord32 length, const H264Info*& ptrInfo);
virtual int32_t GetInfo(const uint8_t* ptrEncodedBuffer, const uint32_t length, const H264Info*& ptrInfo);
protected:
bool HasInfo(const WebRtc_UWord32 length);
WebRtc_Word32 FindInfo(const WebRtc_UWord8* ptrEncodedBuffer, const WebRtc_UWord32 length);
bool HasInfo(const uint32_t length);
int32_t FindInfo(const uint8_t* ptrEncodedBuffer, const uint32_t length);
void GetNRI();
WebRtc_Word32 FindNALU();
WebRtc_Word32 FindNALUStartCodeSize();
WebRtc_Word32 FindNALUType();
int32_t FindNALU();
int32_t FindNALUStartCodeSize();
int32_t FindNALUType();
WebRtc_Word32 ParseSVCNALUHeader();
int32_t ParseSVCNALUHeader();
void SetLayerSEBit(WebRtc_Word32 foundLast);
WebRtc_Word32 SetLayerLengths();
void SetLayerSEBit(int32_t foundLast);
int32_t SetLayerLengths();
private:
const bool _SVC;
const WebRtc_UWord8* _ptrData;
WebRtc_UWord32 _length;
WebRtc_UWord32 _parsedLength;
WebRtc_UWord32 _remLength;
const uint8_t* _ptrData;
uint32_t _length;
uint32_t _parsedLength;
uint32_t _remLength;
H264Info _info;
};
} // namespace webrtc

View File

@ -36,7 +36,7 @@ RTPSenderH264::~RTPSenderH264()
{
}
WebRtc_Word32
int32_t
RTPSenderH264::Init()
{
_h264SendPPS_SPS = true;
@ -71,8 +71,8 @@ RTPSenderH264::Init()
bool
RTPSenderH264::AddH264SVCNALUHeader(const H264_SVC_NALUHeader& svc,
WebRtc_UWord8* databuffer,
WebRtc_Word32& curByte) const
uint8_t* databuffer,
int32_t& curByte) const
{
// +---------------+---------------+---------------+
// |0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
@ -100,14 +100,14 @@ RTPSenderH264::AddH264SVCNALUHeader(const H264_SVC_NALUHeader& svc,
return true;
}
WebRtc_Word32
int32_t
RTPSenderH264::AddH264PACSINALU(const bool firstPacketInNALU,
const bool lastPacketInNALU,
const H264_PACSI_NALU& pacsi,
const H264_SVC_NALUHeader& svc,
const WebRtc_UWord16 DONC,
WebRtc_UWord8* databuffer,
WebRtc_Word32& curByte) const
const uint16_t DONC,
uint8_t* databuffer,
int32_t& curByte) const
{
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@ -144,7 +144,7 @@ RTPSenderH264::AddH264PACSINALU(const bool firstPacketInNALU,
return 0;
}
WebRtc_Word32 startByte = curByte;
int32_t startByte = curByte;
// NAL unit header
databuffer[curByte++] = 30; // NRI will be added later
@ -166,25 +166,25 @@ RTPSenderH264::AddH264PACSINALU(const bool firstPacketInNALU,
if (pacsi.Y)
{
databuffer[curByte++] = pacsi.TL0picIDx;
databuffer[curByte++] = (WebRtc_UWord8)(pacsi.IDRpicID >> 8);
databuffer[curByte++] = (WebRtc_UWord8)(pacsi.IDRpicID);
databuffer[curByte++] = (uint8_t)(pacsi.IDRpicID >> 8);
databuffer[curByte++] = (uint8_t)(pacsi.IDRpicID);
}
// Decoding order number
if (addDONC) // pacsi.T
{
databuffer[curByte++] = (WebRtc_UWord8)(DONC >> 8);
databuffer[curByte++] = (WebRtc_UWord8)(DONC);
databuffer[curByte++] = (uint8_t)(DONC >> 8);
databuffer[curByte++] = (uint8_t)(DONC);
}
// SEI NALU
if(firstPacketInNALU) // IMPROVEMENT duplicate it to make sure it arrives...
{
// we only set this for NALU 0 to make sure we send it only once per frame
for (WebRtc_UWord32 i = 0; i < pacsi.numSEINALUs; i++)
for (uint32_t i = 0; i < pacsi.numSEINALUs; i++)
{
// NALU size
databuffer[curByte++] = (WebRtc_UWord8)(pacsi.seiMessageLength[i] >> 8);
databuffer[curByte++] = (WebRtc_UWord8)(pacsi.seiMessageLength[i]);
databuffer[curByte++] = (uint8_t)(pacsi.seiMessageLength[i] >> 8);
databuffer[curByte++] = (uint8_t)(pacsi.seiMessageLength[i]);
// NALU data
memcpy(databuffer + curByte, pacsi.seiMessageData[i], pacsi.seiMessageLength[i]);
@ -194,14 +194,14 @@ RTPSenderH264::AddH264PACSINALU(const bool firstPacketInNALU,
return curByte - startByte;
}
WebRtc_Word32
RTPSenderH264::SetH264RelaySequenceNumber(const WebRtc_UWord16 seqNum)
int32_t
RTPSenderH264::SetH264RelaySequenceNumber(const uint16_t seqNum)
{
_h264SVCRelaySequenceNumber = seqNum;
return 0;
}
WebRtc_Word32
int32_t
RTPSenderH264::SetH264RelayCompleteLayer(const bool complete)
{
_h264SVCRelayLayerComplete = complete;
@ -215,12 +215,12 @@ RTPSenderH264::SetH264RelayCompleteLayer(const bool complete)
access unit is that they shall not precede the first VCL
NAL unit with the same access unit.
*/
WebRtc_Word32
int32_t
RTPSenderH264::SendH264FillerData(const WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord16 bytesToSend,
const WebRtc_UWord32 ssrc)
const uint16_t bytesToSend,
const uint32_t ssrc)
{
WebRtc_UWord16 fillerLength = bytesToSend - 12 - 1;
uint16_t fillerLength = bytesToSend - 12 - 1;
if (fillerLength > WEBRTC_IP_PACKET_SIZE - 12 - 1)
{
@ -234,9 +234,9 @@ RTPSenderH264::SendH264FillerData(const WebRtcRTPHeader* rtpHeader,
}
// send codec valid data, H.264 has defined data which is binary 1111111
WebRtc_UWord8 dataBuffer[WEBRTC_IP_PACKET_SIZE];
uint8_t dataBuffer[WEBRTC_IP_PACKET_SIZE];
dataBuffer[0] = static_cast<WebRtc_UWord8>(0x80); // version 2
dataBuffer[0] = static_cast<uint8_t>(0x80); // version 2
dataBuffer[1] = rtpHeader->header.payloadType;
ModuleRTPUtility::AssignUWord16ToBuffer(dataBuffer+2, _rtpSender.IncrementSequenceNumber()); // get the current SequenceNumber and add by 1 after returning
ModuleRTPUtility::AssignUWord32ToBuffer(dataBuffer+4, rtpHeader->header.timestamp);
@ -253,27 +253,27 @@ RTPSenderH264::SendH264FillerData(const WebRtcRTPHeader* rtpHeader,
12 + 1);
}
WebRtc_Word32
RTPSenderH264::SendH264FillerData(const WebRtc_UWord32 captureTimestamp,
const WebRtc_UWord8 payloadType,
const WebRtc_UWord32 bytes
int32_t
RTPSenderH264::SendH264FillerData(const uint32_t captureTimestamp,
const uint8_t payloadType,
const uint32_t bytes
)
{
const WebRtc_UWord16 rtpHeaderLength = _rtpSender.RTPHeaderLength();
WebRtc_UWord16 maxLength = _rtpSender.MaxPayloadLength() - FECPacketOverhead() - _rtpSender.RTPHeaderLength();
const uint16_t rtpHeaderLength = _rtpSender.RTPHeaderLength();
uint16_t maxLength = _rtpSender.MaxPayloadLength() - FECPacketOverhead() - _rtpSender.RTPHeaderLength();
WebRtc_Word32 bytesToSend=bytes;
WebRtc_UWord16 fillerLength=0;
int32_t bytesToSend=bytes;
uint16_t fillerLength=0;
WebRtc_UWord8 dataBuffer[WEBRTC_IP_PACKET_SIZE];
uint8_t dataBuffer[WEBRTC_IP_PACKET_SIZE];
while(bytesToSend>0)
{
fillerLength=maxLength;
if(fillerLength<maxLength)
{
fillerLength = (WebRtc_UWord16) bytesToSend;
fillerLength = (uint16_t) bytesToSend;
}
bytesToSend-=fillerLength;
@ -311,14 +311,14 @@ RTPSenderH264::SendH264FillerData(const WebRtc_UWord32 captureTimestamp,
return 0;
}
WebRtc_Word32
int32_t
RTPSenderH264::SendH264SVCRelayPacket(const WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* incomingRTPPacket,
const WebRtc_UWord16 incomingRTPPacketSize,
const WebRtc_UWord32 ssrc,
const uint8_t* incomingRTPPacket,
const uint16_t incomingRTPPacketSize,
const uint32_t ssrc,
const bool higestLayer)
{
if (rtpHeader->header.sequenceNumber != (WebRtc_UWord16)(_h264SVCRelaySequenceNumber + 1))
if (rtpHeader->header.sequenceNumber != (uint16_t)(_h264SVCRelaySequenceNumber + 1))
{
// not continous, signal loss
_rtpSender.IncrementSequenceNumber();
@ -346,7 +346,7 @@ RTPSenderH264::SendH264SVCRelayPacket(const WebRtcRTPHeader* rtpHeader,
// we keep the timestap unchanged
// make a copy and only change the SSRC and seqNum
WebRtc_UWord8 dataBuffer[WEBRTC_IP_PACKET_SIZE];
uint8_t dataBuffer[WEBRTC_IP_PACKET_SIZE];
memcpy(dataBuffer, incomingRTPPacket, incomingRTPPacketSize);
// _sequenceNumber initiated in Init()
@ -382,28 +382,28 @@ RTPSenderH264::SendH264SVCRelayPacket(const WebRtcRTPHeader* rtpHeader,
rtpHeader->header.headerLength);
}
WebRtc_Word32
int32_t
RTPSenderH264::SendH264_STAP_A(const FrameType frameType,
const H264Info* ptrH264Info,
WebRtc_UWord16 &idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
uint16_t &idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
bool& switchToFUA,
WebRtc_Word32 &payloadBytesToSend,
const WebRtc_UWord8*& data,
const WebRtc_UWord16 rtpHeaderLength)
int32_t &payloadBytesToSend,
const uint8_t*& data,
const uint16_t rtpHeaderLength)
{
const WebRtc_Word32 H264_NALU_LENGTH = 2;
const int32_t H264_NALU_LENGTH = 2;
WebRtc_UWord16 h264HeaderLength = 1; // normal header length
WebRtc_UWord16 maxPayloadLengthSTAP_A = _rtpSender.MaxPayloadLength() -
uint16_t h264HeaderLength = 1; // normal header length
uint16_t maxPayloadLengthSTAP_A = _rtpSender.MaxPayloadLength() -
FECPacketOverhead() - rtpHeaderLength -
h264HeaderLength - H264_NALU_LENGTH;
WebRtc_Word32 dataOffset = rtpHeaderLength + h264HeaderLength;
WebRtc_UWord8 NRI = 0;
WebRtc_UWord16 payloadBytesInPacket = 0;
WebRtc_UWord8 dataBuffer[WEBRTC_IP_PACKET_SIZE];
int32_t dataOffset = rtpHeaderLength + h264HeaderLength;
uint8_t NRI = 0;
uint16_t payloadBytesInPacket = 0;
uint8_t dataBuffer[WEBRTC_IP_PACKET_SIZE];
if (ptrH264Info->payloadSize[idxNALU] > maxPayloadLengthSTAP_A)
{
@ -432,15 +432,15 @@ RTPSenderH264::SendH264_STAP_A(const FrameType frameType,
NRI = ptrH264Info->NRI[idxNALU];
}
// put NAL size into packet
dataBuffer[dataOffset] = (WebRtc_UWord8)(ptrH264Info->payloadSize[idxNALU] >> 8);
dataBuffer[dataOffset] = (uint8_t)(ptrH264Info->payloadSize[idxNALU] >> 8);
dataOffset++;
dataBuffer[dataOffset] = (WebRtc_UWord8)(ptrH264Info->payloadSize[idxNALU] & 0xff);
dataBuffer[dataOffset] = (uint8_t)(ptrH264Info->payloadSize[idxNALU] & 0xff);
dataOffset++;
// Put payload in packet
memcpy(&dataBuffer[dataOffset], &data[ptrH264Info->startCodeSize[idxNALU]], ptrH264Info->payloadSize[idxNALU]);
dataOffset += ptrH264Info->payloadSize[idxNALU];
data += ptrH264Info->payloadSize[idxNALU] + ptrH264Info->startCodeSize[idxNALU];
payloadBytesInPacket += (WebRtc_UWord16)(ptrH264Info->payloadSize[idxNALU] + H264_NALU_LENGTH);
payloadBytesInPacket += (uint16_t)(ptrH264Info->payloadSize[idxNALU] + H264_NALU_LENGTH);
payloadBytesToSend -= ptrH264Info->payloadSize[idxNALU] + ptrH264Info->startCodeSize[idxNALU];
} else
{
@ -458,7 +458,7 @@ RTPSenderH264::SendH264_STAP_A(const FrameType frameType,
// add RTP header
_rtpSender.BuildRTPheader(dataBuffer, payloadType, (payloadBytesToSend==0)?true:false, captureTimeStamp);
dataBuffer[rtpHeaderLength] = 24 + NRI; // STAP-A == 24
WebRtc_UWord16 payloadLength = payloadBytesInPacket + h264HeaderLength;
uint16_t payloadLength = payloadBytesInPacket + h264HeaderLength;
if(-1 == SendVideoPacket(frameType, dataBuffer, payloadLength, rtpHeaderLength))
{
@ -469,43 +469,43 @@ RTPSenderH264::SendH264_STAP_A(const FrameType frameType,
} // end STAP-A
// STAP-A for H.264 SVC
WebRtc_Word32
int32_t
RTPSenderH264::SendH264_STAP_A_PACSI(const FrameType frameType,
const H264Info* ptrH264Info,
WebRtc_UWord16 &idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
uint16_t &idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
bool& switchToFUA,
WebRtc_Word32 &payloadBytesToSend,
const WebRtc_UWord8*& data,
const WebRtc_UWord16 rtpHeaderLength,
WebRtc_UWord16& decodingOrderNumber)
int32_t &payloadBytesToSend,
const uint8_t*& data,
const uint16_t rtpHeaderLength,
uint16_t& decodingOrderNumber)
{
const WebRtc_Word32 H264_NALU_LENGTH = 2;
const int32_t H264_NALU_LENGTH = 2;
WebRtc_UWord16 h264HeaderLength = 1; // normal header length
WebRtc_UWord16 maxPayloadLengthSTAP_A = _rtpSender.MaxPayloadLength() - FECPacketOverhead() - rtpHeaderLength - h264HeaderLength - H264_NALU_LENGTH;
WebRtc_Word32 dataOffset = rtpHeaderLength + h264HeaderLength;
WebRtc_UWord8 NRI = 0;
WebRtc_UWord16 payloadBytesInPacket = 0;
WebRtc_UWord8 dataBuffer[WEBRTC_IP_PACKET_SIZE];
uint16_t h264HeaderLength = 1; // normal header length
uint16_t maxPayloadLengthSTAP_A = _rtpSender.MaxPayloadLength() - FECPacketOverhead() - rtpHeaderLength - h264HeaderLength - H264_NALU_LENGTH;
int32_t dataOffset = rtpHeaderLength + h264HeaderLength;
uint8_t NRI = 0;
uint16_t payloadBytesInPacket = 0;
uint8_t dataBuffer[WEBRTC_IP_PACKET_SIZE];
bool firstNALUNotIDR = true; //delta
// Put PACSI NAL unit into packet
WebRtc_Word32 lengthPACSI = 0;
WebRtc_UWord32 PACSI_NALlength = ptrH264Info->PACSI[idxNALU].NALlength;
int32_t lengthPACSI = 0;
uint32_t PACSI_NALlength = ptrH264Info->PACSI[idxNALU].NALlength;
if (PACSI_NALlength > maxPayloadLengthSTAP_A)
{
return -1;
}
dataBuffer[dataOffset++] = (WebRtc_UWord8)(PACSI_NALlength >> 8);
dataBuffer[dataOffset++] = (WebRtc_UWord8)(PACSI_NALlength & 0xff);
dataBuffer[dataOffset++] = (uint8_t)(PACSI_NALlength >> 8);
dataBuffer[dataOffset++] = (uint8_t)(PACSI_NALlength & 0xff);
// end bit will be updated later, since another NALU in this packet might be the last
WebRtc_Word32 lengthPASCINALU = AddH264PACSINALU(true,
false,
ptrH264Info->PACSI[idxNALU],
ptrH264Info->SVCheader[idxNALU],
int32_t lengthPASCINALU = AddH264PACSINALU(true,
false,
ptrH264Info->PACSI[idxNALU],
ptrH264Info->SVCheader[idxNALU],
decodingOrderNumber,
dataBuffer,
dataOffset);
@ -516,7 +516,7 @@ RTPSenderH264::SendH264_STAP_A_PACSI(const FrameType frameType,
decodingOrderNumber++;
lengthPACSI = H264_NALU_LENGTH + lengthPASCINALU;
maxPayloadLengthSTAP_A -= (WebRtc_UWord16)lengthPACSI;
maxPayloadLengthSTAP_A -= (uint16_t)lengthPACSI;
if (ptrH264Info->payloadSize[idxNALU] > maxPayloadLengthSTAP_A)
{
// we need to fragment NAL switch to mode FU-A
@ -528,7 +528,7 @@ RTPSenderH264::SendH264_STAP_A_PACSI(const FrameType frameType,
firstNALUNotIDR = true;
}
WebRtc_UWord32 layer = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
uint32_t layer = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
(ptrH264Info->SVCheader[idxNALU].qualityID << 8) +
ptrH264Info->SVCheader[idxNALU].temporalID;
@ -560,7 +560,7 @@ RTPSenderH264::SendH264_STAP_A_PACSI(const FrameType frameType,
continue;
}
const WebRtc_UWord32 layerNALU = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
const uint32_t layerNALU = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
(ptrH264Info->SVCheader[idxNALU].qualityID << 8) +
ptrH264Info->SVCheader[idxNALU].temporalID;
@ -573,15 +573,15 @@ RTPSenderH264::SendH264_STAP_A_PACSI(const FrameType frameType,
NRI = ptrH264Info->NRI[idxNALU];
}
// put NAL size into packet
dataBuffer[dataOffset] = (WebRtc_UWord8)(ptrH264Info->payloadSize[idxNALU] >> 8);
dataBuffer[dataOffset] = (uint8_t)(ptrH264Info->payloadSize[idxNALU] >> 8);
dataOffset++;
dataBuffer[dataOffset] = (WebRtc_UWord8)(ptrH264Info->payloadSize[idxNALU] & 0xff);
dataBuffer[dataOffset] = (uint8_t)(ptrH264Info->payloadSize[idxNALU] & 0xff);
dataOffset++;
// Put payload in packet
memcpy(&dataBuffer[dataOffset], &data[ptrH264Info->startCodeSize[idxNALU]], ptrH264Info->payloadSize[idxNALU]);
dataOffset += ptrH264Info->payloadSize[idxNALU];
data += ptrH264Info->payloadSize[idxNALU] + ptrH264Info->startCodeSize[idxNALU];
payloadBytesInPacket += (WebRtc_UWord16)(ptrH264Info->payloadSize[idxNALU] + H264_NALU_LENGTH);
payloadBytesInPacket += (uint16_t)(ptrH264Info->payloadSize[idxNALU] + H264_NALU_LENGTH);
payloadBytesToSend -= ptrH264Info->payloadSize[idxNALU] + ptrH264Info->startCodeSize[idxNALU];
} else
{
@ -595,7 +595,7 @@ RTPSenderH264::SendH264_STAP_A_PACSI(const FrameType frameType,
{
// we don't send this NALU due to it's a new layer
// check if we should send the next or if this is the last
const WebRtc_UWord8 dependencyQualityID = (ptrH264Info->SVCheader[idxNALU].dependencyID << 4) + ptrH264Info->SVCheader[idxNALU].qualityID;
const uint8_t dependencyQualityID = (ptrH264Info->SVCheader[idxNALU].dependencyID << 4) + ptrH264Info->SVCheader[idxNALU].qualityID;
bool highestLayer;
if(SendH264SVCLayer(frameType,
@ -649,7 +649,7 @@ RTPSenderH264::SendH264_STAP_A_PACSI(const FrameType frameType,
dataBuffer[rtpHeaderLength + H264_NALU_LENGTH + 2] |= 0x40;
}
}
const WebRtc_UWord16 payloadLength = payloadBytesInPacket + h264HeaderLength + (WebRtc_UWord16)lengthPACSI;
const uint16_t payloadLength = payloadBytesInPacket + h264HeaderLength + (uint16_t)lengthPACSI;
if(-1 == SendVideoPacket(frameType,
dataBuffer,
payloadLength,
@ -662,30 +662,30 @@ RTPSenderH264::SendH264_STAP_A_PACSI(const FrameType frameType,
return 0;
} // end STAP-A
WebRtc_Word32
int32_t
RTPSenderH264::SendH264_FU_A(const FrameType frameType,
const H264Info* ptrH264Info,
WebRtc_UWord16 &idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
WebRtc_Word32 &payloadBytesToSend,
const WebRtc_UWord8*& data,
const WebRtc_UWord16 rtpHeaderLength,
WebRtc_UWord16& decodingOrderNumber,
uint16_t &idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
int32_t &payloadBytesToSend,
const uint8_t*& data,
const uint16_t rtpHeaderLength,
uint16_t& decodingOrderNumber,
const bool sendSVCPACSI)
{
// FUA for the rest of the frame
WebRtc_UWord16 maxPayloadLength = _rtpSender.MaxPayloadLength() - FECPacketOverhead() - rtpHeaderLength;
WebRtc_UWord8 dataBuffer[WEBRTC_IP_PACKET_SIZE];
WebRtc_UWord32 payloadBytesRemainingInNALU = ptrH264Info->payloadSize[idxNALU];
uint16_t maxPayloadLength = _rtpSender.MaxPayloadLength() - FECPacketOverhead() - rtpHeaderLength;
uint8_t dataBuffer[WEBRTC_IP_PACKET_SIZE];
uint32_t payloadBytesRemainingInNALU = ptrH264Info->payloadSize[idxNALU];
bool isBaseLayer=false;
if(payloadBytesRemainingInNALU > maxPayloadLength)
{
// we need to fragment NALU
const WebRtc_UWord16 H264_FUA_LENGTH = 2; // FU-a H.264 header is 2 bytes
const uint16_t H264_FUA_LENGTH = 2; // FU-a H.264 header is 2 bytes
if(sendSVCPACSI)
{
@ -697,7 +697,7 @@ RTPSenderH264::SendH264_FU_A(const FrameType frameType,
true,
false);
WebRtc_UWord32 layer = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
uint32_t layer = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
(ptrH264Info->SVCheader[idxNALU].qualityID << 8) +
ptrH264Info->SVCheader[idxNALU].temporalID;
isBaseLayer=(layer==0);
@ -706,13 +706,13 @@ RTPSenderH264::SendH264_FU_A(const FrameType frameType,
// First packet
_rtpSender.BuildRTPheader(dataBuffer,payloadType, false, captureTimeStamp);
WebRtc_UWord16 maxPayloadLengthFU_A = maxPayloadLength - H264_FUA_LENGTH ;
WebRtc_UWord8 fuaIndc = 28 + ptrH264Info->NRI[idxNALU];
uint16_t maxPayloadLengthFU_A = maxPayloadLength - H264_FUA_LENGTH ;
uint8_t fuaIndc = 28 + ptrH264Info->NRI[idxNALU];
dataBuffer[rtpHeaderLength] = fuaIndc; // FU-A indicator
dataBuffer[rtpHeaderLength+1] = (WebRtc_UWord8)(ptrH264Info->type[idxNALU] + 0x80)/*start*/; // FU-A header
dataBuffer[rtpHeaderLength+1] = (uint8_t)(ptrH264Info->type[idxNALU] + 0x80)/*start*/; // FU-A header
memcpy(&dataBuffer[rtpHeaderLength + H264_FUA_LENGTH], &data[ptrH264Info->startCodeSize[idxNALU]+1], maxPayloadLengthFU_A);
WebRtc_UWord16 payloadLength = maxPayloadLengthFU_A + H264_FUA_LENGTH;
uint16_t payloadLength = maxPayloadLengthFU_A + H264_FUA_LENGTH;
if(-1 == SendVideoPacket(frameType, dataBuffer, payloadLength, rtpHeaderLength, isBaseLayer))
{
return -1;
@ -740,7 +740,7 @@ RTPSenderH264::SendH264_FU_A(const FrameType frameType,
// prepare next header
_rtpSender.BuildRTPheader(dataBuffer, payloadType, false, captureTimeStamp);
dataBuffer[rtpHeaderLength] = (WebRtc_UWord8)fuaIndc; // FU-A indicator
dataBuffer[rtpHeaderLength] = (uint8_t)fuaIndc; // FU-A indicator
dataBuffer[rtpHeaderLength+1] = ptrH264Info->type[idxNALU]; // FU-A header
memcpy(&dataBuffer[rtpHeaderLength+H264_FUA_LENGTH], data, maxPayloadLengthFU_A);
@ -772,7 +772,7 @@ RTPSenderH264::SendH264_FU_A(const FrameType frameType,
// check if it's the the next layer should not be sent
// check if we should send the next or if this is the last
const WebRtc_UWord8 dependencyQualityID = (ptrH264Info->SVCheader[idxNALU+1].dependencyID << 4) +
const uint8_t dependencyQualityID = (ptrH264Info->SVCheader[idxNALU+1].dependencyID << 4) +
ptrH264Info->SVCheader[idxNALU+1].qualityID;
bool highestLayer;
@ -787,11 +787,11 @@ RTPSenderH264::SendH264_FU_A(const FrameType frameType,
}
}
// last packet in NALU
_rtpSender.BuildRTPheader(dataBuffer, payloadType,(payloadBytesToSend == (WebRtc_Word32)payloadBytesRemainingInNALU)?true:false, captureTimeStamp);
_rtpSender.BuildRTPheader(dataBuffer, payloadType,(payloadBytesToSend == (int32_t)payloadBytesRemainingInNALU)?true:false, captureTimeStamp);
dataBuffer[rtpHeaderLength+1] = ptrH264Info->type[idxNALU] + 0x40/*stop*/; // FU-A header
memcpy(&dataBuffer[rtpHeaderLength+H264_FUA_LENGTH], data, payloadBytesRemainingInNALU);
payloadLength = (WebRtc_UWord16)payloadBytesRemainingInNALU + H264_FUA_LENGTH;
payloadLength = (uint16_t)payloadBytesRemainingInNALU + H264_FUA_LENGTH;
payloadBytesToSend -= payloadBytesRemainingInNALU;
if(payloadBytesToSend != 0)
{
@ -819,22 +819,22 @@ RTPSenderH264::SendH264_FU_A(const FrameType frameType,
return 0;
}
WebRtc_Word32
int32_t
RTPSenderH264::SendH264_SingleMode(const FrameType frameType,
const H264Info* ptrH264Info,
WebRtc_UWord16 &idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
WebRtc_Word32 &payloadBytesToSend,
const WebRtc_UWord8*& data,
const WebRtc_UWord16 rtpHeaderLength,
WebRtc_UWord16& decodingOrderNumber,
uint16_t &idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
int32_t &payloadBytesToSend,
const uint8_t*& data,
const uint16_t rtpHeaderLength,
uint16_t& decodingOrderNumber,
const bool sendSVCPACSI)
{
// no H.264 header lenght in single mode
// we use WEBRTC_IP_PACKET_SIZE instead of the configured MTU since it's better to send fragmented UDP than not to send
const WebRtc_UWord16 maxPayloadLength = WEBRTC_IP_PACKET_SIZE - _rtpSender.PacketOverHead() - FECPacketOverhead() - rtpHeaderLength;
WebRtc_UWord8 dataBuffer[WEBRTC_IP_PACKET_SIZE];
const uint16_t maxPayloadLength = WEBRTC_IP_PACKET_SIZE - _rtpSender.PacketOverHead() - FECPacketOverhead() - rtpHeaderLength;
uint8_t dataBuffer[WEBRTC_IP_PACKET_SIZE];
bool isBaseLayer=false;
if(ptrH264Info->payloadSize[idxNALU] > maxPayloadLength)
@ -862,7 +862,7 @@ RTPSenderH264::SendH264_SingleMode(const FrameType frameType,
true,
true);
WebRtc_UWord32 layer = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
uint32_t layer = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
(ptrH264Info->SVCheader[idxNALU].qualityID << 8) +
ptrH264Info->SVCheader[idxNALU].temporalID;
isBaseLayer=(layer==0);
@ -871,7 +871,7 @@ RTPSenderH264::SendH264_SingleMode(const FrameType frameType,
// Put payload in packet
memcpy(&dataBuffer[rtpHeaderLength], &data[ptrH264Info->startCodeSize[idxNALU]], ptrH264Info->payloadSize[idxNALU]);
WebRtc_UWord16 payloadBytesInPacket = (WebRtc_UWord16)ptrH264Info->payloadSize[idxNALU];
uint16_t payloadBytesInPacket = (uint16_t)ptrH264Info->payloadSize[idxNALU];
payloadBytesToSend -= ptrH264Info->payloadSize[idxNALU] + ptrH264Info->startCodeSize[idxNALU]; // left to send
//
@ -891,27 +891,27 @@ RTPSenderH264::SendH264_SingleMode(const FrameType frameType,
return 0;
}
WebRtc_Word32
int32_t
RTPSenderH264::SendH264_SinglePACSI(const FrameType frameType,
const H264Info* ptrH264Info,
const WebRtc_UWord16 idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
const uint16_t idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
const bool firstPacketInNALU,
const bool lastPacketInNALU);
{
// Send PACSI in single mode
WebRtc_UWord8 dataBuffer[WEBRTC_IP_PACKET_SIZE];
WebRtc_UWord16 rtpHeaderLength = (WebRtc_UWord16)_rtpSender.BuildRTPheader(dataBuffer, payloadType,false, captureTimeStamp);
WebRtc_Word32 dataOffset = rtpHeaderLength;
uint8_t dataBuffer[WEBRTC_IP_PACKET_SIZE];
uint16_t rtpHeaderLength = (uint16_t)_rtpSender.BuildRTPheader(dataBuffer, payloadType,false, captureTimeStamp);
int32_t dataOffset = rtpHeaderLength;
WebRtc_Word32 lengthPASCINALU = AddH264PACSINALU(firstPacketInNALU,
lastPacketInNALU,
ptrH264Info->PACSI[idxNALU],
ptrH264Info->SVCheader[idxNALU],
decodingOrderNumber,
dataBuffer,
dataOffset);
int32_t lengthPASCINALU = AddH264PACSINALU(firstPacketInNALU,
lastPacketInNALU,
ptrH264Info->PACSI[idxNALU],
ptrH264Info->SVCheader[idxNALU],
decodingOrderNumber,
dataBuffer,
dataOffset);
if (lengthPASCINALU <= 0)
{
@ -919,13 +919,13 @@ RTPSenderH264::SendH264_SinglePACSI(const FrameType frameType,
}
decodingOrderNumber++;
WebRtc_UWord16 payloadBytesInPacket = (WebRtc_UWord16)lengthPASCINALU;
uint16_t payloadBytesInPacket = (uint16_t)lengthPASCINALU;
// Set payload header (first payload byte co-serves as the payload header)
dataBuffer[rtpHeaderLength] &= 0x1f; // zero out NRI field
dataBuffer[rtpHeaderLength] |= ptrH264Info->NRI[idxNALU]; // nri
const WebRtc_UWord32 layer = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
const uint32_t layer = (ptrH264Info->SVCheader[idxNALU].dependencyID << 16)+
(ptrH264Info->SVCheader[idxNALU].qualityID << 8) +
ptrH264Info->SVCheader[idxNALU].temporalID;
@ -939,17 +939,17 @@ RTPSenderH264::SendH264_SinglePACSI(const FrameType frameType,
WebRtc_Word32
int32_t
RTPSenderH264::SendH264SVC(const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const int8_t payloadType,
const uint32_t captureTimeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
H264Information& h264Information,
WebRtc_UWord16& decodingOrderNumber)
uint16_t& decodingOrderNumber)
{
WebRtc_Word32 payloadBytesToSend = payloadSize;
const WebRtc_UWord16 rtpHeaderLength = _rtpSender.RTPHeaderLength();
int32_t payloadBytesToSend = payloadSize;
const uint16_t rtpHeaderLength = _rtpSender.RTPHeaderLength();
const H264Info* ptrH264Info = NULL;
if (h264Information.GetInfo(payloadData,payloadSize, ptrH264Info) == -1)
@ -960,7 +960,7 @@ RTPSenderH264::SendH264SVC(const FrameType frameType,
{
// we need to check if we should drop the frame
// it could be a temporal layer (aka a temporal frame)
const WebRtc_UWord8 dependencyQualityID = (ptrH264Info->SVCheader[0].dependencyID << 4) + ptrH264Info->SVCheader[0].qualityID;
const uint8_t dependencyQualityID = (ptrH264Info->SVCheader[0].dependencyID << 4) + ptrH264Info->SVCheader[0].qualityID;
bool dummyHighestLayer;
if(SendH264SVCLayer(frameType,
@ -973,7 +973,7 @@ RTPSenderH264::SendH264SVC(const FrameType frameType,
}
}
WebRtc_UWord16 idxNALU = 0;
uint16_t idxNALU = 0;
while (payloadBytesToSend > 0)
{
bool switchToFUA = false;
@ -1010,14 +1010,14 @@ RTPSenderH264::SendH264SVC(const FrameType frameType,
return 0;
}
WebRtc_Word32
int32_t
RTPSenderH264::SetH264PacketizationMode(const H264PacketizationMode mode)
{
_h264Mode = mode;
return 0;
}
WebRtc_Word32
int32_t
RTPSenderH264::SetH264SendModeNALU_PPS_SPS(const bool dontSend)
{
_h264SendPPS_SPS = !dontSend;
@ -1026,11 +1026,11 @@ RTPSenderH264::SetH264SendModeNALU_PPS_SPS(const bool dontSend)
bool
RTPSenderH264::SendH264SVCLayer(const FrameType frameType,
const WebRtc_UWord8 temporalID,
const WebRtc_UWord8 dependencyQualityID,
const uint8_t temporalID,
const uint8_t dependencyQualityID,
bool& higestLayer)
{
WebRtc_UWord8 dependencyID = dependencyQualityID >> 4;
uint8_t dependencyID = dependencyQualityID >> 4;
// keyframe required to switch between dependency layers not quality and temporal
if( _highestDependencyLayer != _highestDependencyLayerOld)
@ -1146,11 +1146,11 @@ RTPSenderH264::SendH264SVCLayer(const FrameType frameType,
return true;
}
WebRtc_Word32
RTPSenderH264::SetHighestSendLayer(const WebRtc_UWord8 dependencyQualityLayer,
const WebRtc_UWord8 temporalLayer)
int32_t
RTPSenderH264::SetHighestSendLayer(const uint8_t dependencyQualityLayer,
const uint8_t temporalLayer)
{
const WebRtc_UWord8 dependencyLayer = (dependencyQualityLayer >> 4);
const uint8_t dependencyLayer = (dependencyQualityLayer >> 4);
if(_highestDependencyLayerOld != _highestDependencyLayer)
{
@ -1175,9 +1175,9 @@ RTPSenderH264::SetHighestSendLayer(const WebRtc_UWord8 dependencyQualityLayer,
return 0;
}
WebRtc_Word32
RTPSenderH264::HighestSendLayer(WebRtc_UWord8& dependencyQualityLayer,
WebRtc_UWord8& temporalLayer)
int32_t
RTPSenderH264::HighestSendLayer(uint8_t& dependencyQualityLayer,
uint8_t& temporalLayer)
{
if (!_useHighestSendLayer)
{
@ -1191,26 +1191,26 @@ RTPSenderH264::HighestSendLayer(WebRtc_UWord8& dependencyQualityLayer,
/*
* H.264
*/
WebRtc_Word32
int32_t
RTPSenderH264::SendH264(const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const int8_t payloadType,
const uint32_t captureTimeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
H264Information& h264Information)
{
WebRtc_Word32 payloadBytesToSend = payloadSize;
const WebRtc_UWord8* data = payloadData;
int32_t payloadBytesToSend = payloadSize;
const uint8_t* data = payloadData;
bool switchToFUA = false;
const WebRtc_UWord16 rtpHeaderLength = _rtpSender.RTPHeaderLength();
const uint16_t rtpHeaderLength = _rtpSender.RTPHeaderLength();
const H264Info* ptrH264Info = NULL;
if (h264Information.GetInfo(payloadData,payloadSize, ptrH264Info) == -1)
{
return -1;
}
WebRtc_UWord16 idxNALU = 0;
WebRtc_UWord16 DONCdummy = 0;
uint16_t idxNALU = 0;
uint16_t DONCdummy = 0;
while (payloadBytesToSend > 0)
{

View File

@ -22,154 +22,154 @@ namespace webrtc {
class RTPSenderH264
{
public:
WebRtc_Word32 SendH264(const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
H264Information& h264Information);
int32_t SendH264(const FrameType frameType,
const int8_t payloadType,
const uint32_t captureTimeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
H264Information& h264Information);
WebRtc_Word32 SendH264SVC(const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
H264Information& h264Information);
int32_t SendH264SVC(const FrameType frameType,
const int8_t payloadType,
const uint32_t captureTimeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
H264Information& h264Information);
// H.264 AVC
WebRtc_Word32 SetH264PacketizationMode(const H264PacketizationMode mode);
int32_t SetH264PacketizationMode(const H264PacketizationMode mode);
WebRtc_Word32 SetH264SendModeNALU_PPS_SPS(const bool dontSend);
int32_t SetH264SendModeNALU_PPS_SPS(const bool dontSend);
// H.264 SVC
WebRtc_Word32 SetHighestSendLayer(const WebRtc_UWord8 dependencyQualityLayer,
const WebRtc_UWord8 temporalLayer);
int32_t SetHighestSendLayer(const uint8_t dependencyQualityLayer,
const uint8_t temporalLayer);
WebRtc_Word32 HighestSendLayer(WebRtc_UWord8& dependencyQualityLayer,
WebRtc_UWord8& temporalLayer);
int32_t HighestSendLayer(uint8_t& dependencyQualityLayer,
uint8_t& temporalLayer);
protected:
RTPSenderH264(RTPSenderInterface* rtpSender);
virtual ~RTPSenderH264();
WebRtc_Word32 Init();
int32_t Init();
virtual WebRtc_UWord16 FECPacketOverhead() const = 0;
virtual uint16_t FECPacketOverhead() const = 0;
virtual RtpVideoCodecTypes VideoCodecType() const = 0;
virtual WebRtc_Word32 SendVideoPacket(const FrameType frameType,
const WebRtc_UWord8* dataBuffer,
const WebRtc_UWord16 payloadLength,
const WebRtc_UWord16 rtpHeaderLength,
bool baseLayerVideoPacket=false) = 0;
virtual int32_t SendVideoPacket(const FrameType frameType,
const uint8_t* dataBuffer,
const uint16_t payloadLength,
const uint16_t rtpHeaderLength,
bool baseLayerVideoPacket=false) = 0;
bool SendH264SVCLayer(const FrameType frameType,
const WebRtc_UWord8 temporalID,
const WebRtc_UWord8 dependencyQualityID,
const uint8_t temporalID,
const uint8_t dependencyQualityID,
bool& higestLayer);
// H.264 SVC
WebRtc_Word32 AddH264PACSINALU(const bool firstPacketInNALU,
const bool lastPacketInNALU,
const H264_PACSI_NALU& paci,
const H264_SVC_NALUHeader& svc,
const WebRtc_UWord16 DONC,
WebRtc_UWord8* databuffer,
WebRtc_Word32& curByte) const;
int32_t AddH264PACSINALU(const bool firstPacketInNALU,
const bool lastPacketInNALU,
const H264_PACSI_NALU& paci,
const H264_SVC_NALUHeader& svc,
const uint16_t DONC,
uint8_t* databuffer,
int32_t& curByte) const;
WebRtc_Word32 SendH264FillerData(const WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord16 bytesToSend,
const WebRtc_UWord32 ssrc);
int32_t SendH264FillerData(const WebRtcRTPHeader* rtpHeader,
const uint16_t bytesToSend,
const uint32_t ssrc);
WebRtc_Word32 SendH264FillerData(const WebRtc_UWord32 captureTimestamp,
const WebRtc_UWord8 payloadType,
const WebRtc_UWord32 bytesToSend);
int32_t SendH264FillerData(const uint32_t captureTimestamp,
const uint8_t payloadType,
const uint32_t bytesToSend);
WebRtc_Word32 SendH264SVCRelayPacket(const WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* incomingRTPPacket,
const WebRtc_UWord16 incomingRTPPacketSize,
const WebRtc_UWord32 ssrc,
const bool higestLayer);
int32_t SendH264SVCRelayPacket(const WebRtcRTPHeader* rtpHeader,
const uint8_t* incomingRTPPacket,
const uint16_t incomingRTPPacketSize,
const uint32_t ssrc,
const bool higestLayer);
WebRtc_Word32 SetH264RelaySequenceNumber(const WebRtc_UWord16 seqNum);
int32_t SetH264RelaySequenceNumber(const uint16_t seqNum);
WebRtc_Word32 SetH264RelayCompleteLayer(const bool complete);
int32_t SetH264RelayCompleteLayer(const bool complete);
// H.264
H264PacketizationMode _h264Mode;
bool _h264SendPPS_SPS;
// H.264-SVC
WebRtc_Word8 _h264SVCPayloadType;
WebRtc_UWord16 _h264SVCRelaySequenceNumber;
WebRtc_UWord32 _h264SVCRelayTimeStamp;
int8_t _h264SVCPayloadType;
uint16_t _h264SVCRelaySequenceNumber;
uint32_t _h264SVCRelayTimeStamp;
bool _h264SVCRelayLayerComplete;
private:
// H.264
WebRtc_Word32 SendH264_SingleMode(const FrameType frameType,
int32_t SendH264_SingleMode(const FrameType frameType,
const H264Info* ptrH264Info,
WebRtc_UWord16 &idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
WebRtc_Word32 &payloadBytesToSend,
const WebRtc_UWord8*& data,
const WebRtc_UWord16 rtpHeaderLength,
const bool sendSVCPACSI=false);
uint16_t &idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
int32_t &payloadBytesToSend,
const uint8_t*& data,
const uint16_t rtpHeaderLength,
const bool sendSVCPACSI=false);
WebRtc_Word32 SendH264_FU_A(const FrameType frameType,
const H264Info* ptrH264Info,
WebRtc_UWord16 &idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
WebRtc_Word32 &payloadBytesToSend,
const WebRtc_UWord8*& data,
const WebRtc_UWord16 rtpHeaderLength,
const bool sendSVCPACSI = false);
int32_t SendH264_FU_A(const FrameType frameType,
const H264Info* ptrH264Info,
uint16_t &idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
int32_t &payloadBytesToSend,
const uint8_t*& data,
const uint16_t rtpHeaderLength,
const bool sendSVCPACSI = false);
WebRtc_Word32 SendH264_STAP_A(const FrameType frameType,
int32_t SendH264_STAP_A(const FrameType frameType,
const H264Info* ptrH264Info,
WebRtc_UWord16 &idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
bool& switchToFUA,
WebRtc_Word32 &payloadBytesToSend,
const WebRtc_UWord8*& data,
const WebRtc_UWord16 rtpHeaderLength);
uint16_t &idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
bool& switchToFUA,
int32_t &payloadBytesToSend,
const uint8_t*& data,
const uint16_t rtpHeaderLength);
WebRtc_Word32 SendH264_STAP_A_PACSI(const FrameType frameType,
const H264Info* ptrH264Info,
WebRtc_UWord16 &idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
bool& switchToFUA,
WebRtc_Word32 &payloadBytesToSend,
const WebRtc_UWord8*& data,
const WebRtc_UWord16 rtpHeaderLengh)
int32_t SendH264_STAP_A_PACSI(const FrameType frameType,
const H264Info* ptrH264Info,
uint16_t &idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
bool& switchToFUA,
int32_t &payloadBytesToSend,
const uint8_t*& data,
const uint16_t rtpHeaderLengh)
WebRtc_Word32 SendH264_SinglePACSI(const FrameType frameType,
int32_t SendH264_SinglePACSI(const FrameType frameType,
const H264Info* ptrH264Info,
const WebRtc_UWord16 idxNALU,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
const bool firstPacketInNALU,
const bool lastPacketInNALU);
const uint16_t idxNALU,
const int8_t payloadType,
const uint32_t captureTimeStamp,
const bool firstPacketInNALU,
const bool lastPacketInNALU);
bool AddH264SVCNALUHeader(const H264_SVC_NALUHeader& svc,
WebRtc_UWord8* databuffer,
WebRtc_Word32& curByte) const;
uint8_t* databuffer,
int32_t& curByte) const;
RTPSenderInterface& _rtpSender;
// relay
bool _useHighestSendLayer;
WebRtc_UWord8 _highestDependencyLayerOld;
WebRtc_UWord8 _highestDependencyQualityIDOld;
WebRtc_UWord8 _highestDependencyLayer;
WebRtc_UWord8 _highestDependencyQualityID;
WebRtc_UWord8 _highestTemporalLayer;
uint8_t _highestDependencyLayerOld;
uint8_t _highestDependencyQualityIDOld;
uint8_t _highestDependencyLayer;
uint8_t _highestDependencyQualityID;
uint8_t _highestTemporalLayer;
};

View File

@ -27,40 +27,40 @@ Bitrate::Bitrate(Clock* clock)
memset(bitrate_array_, 0, sizeof(bitrate_array_));
}
void Bitrate::Update(const WebRtc_Word32 bytes) {
void Bitrate::Update(const int32_t bytes) {
bytes_count_ += bytes;
packet_count_++;
}
WebRtc_UWord32 Bitrate::PacketRate() const {
uint32_t Bitrate::PacketRate() const {
return packet_rate_;
}
WebRtc_UWord32 Bitrate::BitrateLast() const {
uint32_t Bitrate::BitrateLast() const {
return bitrate_;
}
WebRtc_UWord32 Bitrate::BitrateNow() const {
WebRtc_Word64 now = clock_->TimeInMilliseconds();
WebRtc_Word64 diff_ms = now - time_last_rate_update_;
uint32_t Bitrate::BitrateNow() const {
int64_t now = clock_->TimeInMilliseconds();
int64_t diff_ms = now - time_last_rate_update_;
if (diff_ms > 10000) { // 10 seconds.
// Too high difference, ignore.
return bitrate_;
}
WebRtc_Word64 bits_since_last_rate_update = 8 * bytes_count_ * 1000;
int64_t bits_since_last_rate_update = 8 * bytes_count_ * 1000;
// We have to consider the time when the measurement was done:
// ((bits/sec * sec) + (bits)) / sec.
WebRtc_Word64 bitrate = (static_cast<WebRtc_UWord64>(bitrate_) * 1000 +
int64_t bitrate = (static_cast<uint64_t>(bitrate_) * 1000 +
bits_since_last_rate_update) / (1000 + diff_ms);
return static_cast<WebRtc_UWord32>(bitrate);
return static_cast<uint32_t>(bitrate);
}
void Bitrate::Process() {
// Triggered by timer.
WebRtc_Word64 now = clock_->TimeInMilliseconds();
WebRtc_Word64 diff_ms = now - time_last_rate_update_;
int64_t now = clock_->TimeInMilliseconds();
int64_t diff_ms = now - time_last_rate_update_;
if (diff_ms < 100) {
// Not enough data, wait...
@ -80,9 +80,9 @@ void Bitrate::Process() {
if (bitrate_next_idx_ >= 10) {
bitrate_next_idx_ = 0;
}
WebRtc_Word64 sum_diffMS = 0;
WebRtc_Word64 sum_bitrateMS = 0;
WebRtc_Word64 sum_packetrateMS = 0;
int64_t sum_diffMS = 0;
int64_t sum_bitrateMS = 0;
int64_t sum_packetrateMS = 0;
for (int i = 0; i < 10; i++) {
sum_diffMS += bitrate_diff_ms_[i];
sum_bitrateMS += bitrate_array_[i] * bitrate_diff_ms_[i];
@ -91,8 +91,8 @@ void Bitrate::Process() {
time_last_rate_update_ = now;
bytes_count_ = 0;
packet_count_ = 0;
packet_rate_ = static_cast<WebRtc_UWord32>(sum_packetrateMS / sum_diffMS);
bitrate_ = static_cast<WebRtc_UWord32>(sum_bitrateMS / sum_diffMS);
packet_rate_ = static_cast<uint32_t>(sum_packetrateMS / sum_diffMS);
bitrate_ = static_cast<uint32_t>(sum_bitrateMS / sum_diffMS);
}
} // namespace webrtc

View File

@ -30,30 +30,30 @@ class Bitrate {
void Process();
// Update with a packet.
void Update(const WebRtc_Word32 bytes);
void Update(const int32_t bytes);
// Packet rate last second, updated roughly every 100 ms.
WebRtc_UWord32 PacketRate() const;
uint32_t PacketRate() const;
// Bitrate last second, updated roughly every 100 ms.
WebRtc_UWord32 BitrateLast() const;
uint32_t BitrateLast() const;
// Bitrate last second, updated now.
WebRtc_UWord32 BitrateNow() const;
uint32_t BitrateNow() const;
protected:
Clock* clock_;
private:
WebRtc_UWord32 packet_rate_;
WebRtc_UWord32 bitrate_;
WebRtc_UWord8 bitrate_next_idx_;
WebRtc_Word64 packet_rate_array_[10];
WebRtc_Word64 bitrate_array_[10];
WebRtc_Word64 bitrate_diff_ms_[10];
WebRtc_Word64 time_last_rate_update_;
WebRtc_UWord32 bytes_count_;
WebRtc_UWord32 packet_count_;
uint32_t packet_rate_;
uint32_t bitrate_;
uint8_t bitrate_next_idx_;
int64_t packet_rate_array_[10];
int64_t bitrate_array_[10];
int64_t bitrate_diff_ms_[10];
int64_t time_last_rate_update_;
uint32_t bytes_count_;
uint32_t packet_count_;
};
} // namespace webrtc

View File

@ -27,8 +27,8 @@ DTMFqueue::~DTMFqueue()
delete _DTMFCritsect;
}
WebRtc_Word32
DTMFqueue::AddDTMF(WebRtc_UWord8 key, WebRtc_UWord16 len, WebRtc_UWord8 level)
int32_t
DTMFqueue::AddDTMF(uint8_t key, uint16_t len, uint8_t level)
{
CriticalSectionScoped lock(_DTMFCritsect);
@ -36,7 +36,7 @@ DTMFqueue::AddDTMF(WebRtc_UWord8 key, WebRtc_UWord16 len, WebRtc_UWord8 level)
{
return -1;
}
WebRtc_Word32 index = _nextEmptyIndex;
int32_t index = _nextEmptyIndex;
_DTMFKey[index] = key;
_DTMFLen[index] = len;
_DTMFLevel[index] = level;
@ -44,8 +44,8 @@ DTMFqueue::AddDTMF(WebRtc_UWord8 key, WebRtc_UWord16 len, WebRtc_UWord8 level)
return 0;
}
WebRtc_Word8
DTMFqueue::NextDTMF(WebRtc_UWord8* DTMFKey, WebRtc_UWord16* len, WebRtc_UWord8* level)
int8_t
DTMFqueue::NextDTMF(uint8_t* DTMFKey, uint16_t* len, uint8_t* level)
{
CriticalSectionScoped lock(_DTMFCritsect);
@ -57,9 +57,9 @@ DTMFqueue::NextDTMF(WebRtc_UWord8* DTMFKey, WebRtc_UWord16* len, WebRtc_UWord8*
*len=_DTMFLen[0];
*level=_DTMFLevel[0];
memmove(&(_DTMFKey[0]), &(_DTMFKey[1]), _nextEmptyIndex*sizeof(WebRtc_UWord8));
memmove(&(_DTMFLen[0]), &(_DTMFLen[1]), _nextEmptyIndex*sizeof(WebRtc_UWord16));
memmove(&(_DTMFLevel[0]), &(_DTMFLevel[1]), _nextEmptyIndex*sizeof(WebRtc_UWord8));
memmove(&(_DTMFKey[0]), &(_DTMFKey[1]), _nextEmptyIndex*sizeof(uint8_t));
memmove(&(_DTMFLen[0]), &(_DTMFLen[1]), _nextEmptyIndex*sizeof(uint16_t));
memmove(&(_DTMFLevel[0]), &(_DTMFLevel[1]), _nextEmptyIndex*sizeof(uint8_t));
_nextEmptyIndex--;
return 0;

View File

@ -23,17 +23,17 @@ public:
DTMFqueue();
virtual ~DTMFqueue();
WebRtc_Word32 AddDTMF(WebRtc_UWord8 DTMFKey, WebRtc_UWord16 len, WebRtc_UWord8 level);
WebRtc_Word8 NextDTMF(WebRtc_UWord8* DTMFKey, WebRtc_UWord16 * len, WebRtc_UWord8 * level);
int32_t AddDTMF(uint8_t DTMFKey, uint16_t len, uint8_t level);
int8_t NextDTMF(uint8_t* DTMFKey, uint16_t * len, uint8_t * level);
bool PendingDTMF();
void ResetDTMF();
private:
CriticalSectionWrapper* _DTMFCritsect;
WebRtc_UWord8 _nextEmptyIndex;
WebRtc_UWord8 _DTMFKey[DTMF_OUTBAND_MAX];
WebRtc_UWord16 _DTMFLen[DTMF_OUTBAND_MAX];
WebRtc_UWord8 _DTMFLevel[DTMF_OUTBAND_MAX];
uint8_t _nextEmptyIndex;
uint8_t _DTMFKey[DTMF_OUTBAND_MAX];
uint16_t _DTMFLen[DTMF_OUTBAND_MAX];
uint8_t _DTMFLevel[DTMF_OUTBAND_MAX];
};
} // namespace webrtc

View File

@ -22,18 +22,18 @@ class MockRTPPayloadStrategy : public RTPPayloadStrategy {
bool());
MOCK_CONST_METHOD4(PayloadIsCompatible,
bool(const ModuleRTPUtility::Payload& payload,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate));
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate));
MOCK_CONST_METHOD2(UpdatePayloadRate,
void(ModuleRTPUtility::Payload* payload, const WebRtc_UWord32 rate));
void(ModuleRTPUtility::Payload* payload, const uint32_t rate));
MOCK_CONST_METHOD5(CreatePayloadType,
ModuleRTPUtility::Payload*(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate));
const int8_t payloadType,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate));
};
} // namespace webrtc

View File

@ -19,27 +19,27 @@ class MockRTPReceiverVideo : public RTPReceiverVideo {
public:
MockRTPReceiverVideo() : RTPReceiverVideo(0, NULL, NULL) {}
MOCK_METHOD1(ChangeUniqueId,
void(const WebRtc_Word32 id));
void(const int32_t id));
MOCK_METHOD3(ReceiveRecoveredPacketCallback,
WebRtc_Word32(WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadDataLength));
int32_t(WebRtcRTPHeader* rtpHeader,
const uint8_t* payloadData,
const uint16_t payloadDataLength));
MOCK_METHOD3(CallbackOfReceivedPayloadData,
WebRtc_Word32(const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize,
const WebRtcRTPHeader* rtpHeader));
int32_t(const uint8_t* payloadData,
const uint16_t payloadSize,
const WebRtcRTPHeader* rtpHeader));
MOCK_CONST_METHOD0(TimeStamp,
WebRtc_UWord32());
uint32_t());
MOCK_CONST_METHOD0(SequenceNumber,
WebRtc_UWord16());
uint16_t());
MOCK_CONST_METHOD2(PayloadTypeToPayload,
WebRtc_UWord32(const WebRtc_UWord8 payloadType,
ModuleRTPUtility::Payload*& payload));
uint32_t(const uint8_t payloadType,
ModuleRTPUtility::Payload*& payload));
MOCK_CONST_METHOD2(RetransmitOfOldPacket,
bool(const WebRtc_UWord16 sequenceNumber,
const WebRtc_UWord32 rtpTimeStamp));
bool(const uint16_t sequenceNumber,
const uint32_t rtpTimeStamp));
MOCK_CONST_METHOD0(REDPayloadType,
WebRtc_Word8());
int8_t());
MOCK_CONST_METHOD0(HaveNotReceivedPackets,
bool());
};

View File

@ -19,18 +19,18 @@
namespace webrtc {
const int kVideoNackListSize = 10;
const int kTestId = 123;
const WebRtc_UWord32 kTestSsrc = 3456;
const WebRtc_UWord16 kTestSequenceNumber = 2345;
const WebRtc_UWord32 kTestNumberOfPackets = 450;
const uint32_t kTestSsrc = 3456;
const uint16_t kTestSequenceNumber = 2345;
const uint32_t kTestNumberOfPackets = 450;
const int kTestNumberOfRtxPackets = 49;
class VerifyingRtxReceiver : public RtpData {
public:
VerifyingRtxReceiver() {}
virtual WebRtc_Word32 OnReceivedPayloadData(
const WebRtc_UWord8* data,
const WebRtc_UWord16 size,
virtual int32_t OnReceivedPayloadData(
const uint8_t* data,
const uint16_t size,
const webrtc::WebRtcRTPHeader* rtp_header) {
if (!sequence_numbers_.empty()) {
EXPECT_EQ(kTestSsrc, rtp_header->header.ssrc);
@ -38,7 +38,7 @@ class VerifyingRtxReceiver : public RtpData {
sequence_numbers_.push_back(rtp_header->header.sequenceNumber);
return 0;
}
std::vector<WebRtc_UWord16 > sequence_numbers_;
std::vector<uint16_t > sequence_numbers_;
};
class RtxLoopBackTransport : public webrtc::Transport {
@ -66,13 +66,13 @@ class RtxLoopBackTransport : public webrtc::Transport {
return len;
}
}
if (module_->IncomingPacket((const WebRtc_UWord8*)data, len) == 0) {
if (module_->IncomingPacket((const uint8_t*)data, len) == 0) {
return len;
}
return -1;
}
virtual int SendRTCPPacket(int channel, const void *data, int len) {
if (module_->IncomingPacket((const WebRtc_UWord8*)data, len) == 0) {
if (module_->IncomingPacket((const uint8_t*)data, len) == 0) {
return len;
}
return -1;
@ -133,14 +133,14 @@ class RtpRtcpRtxNackTest : public ::testing::Test {
RtpRtcp* rtp_rtcp_module_;
RtxLoopBackTransport transport_;
VerifyingRtxReceiver receiver_;
WebRtc_UWord8 payload_data[65000];
uint8_t payload_data[65000];
int payload_data_length;
SimulatedClock fake_clock;
};
TEST_F(RtpRtcpRtxNackTest, RTCP) {
WebRtc_UWord32 timestamp = 3000;
WebRtc_UWord16 nack_list[kVideoNackListSize];
uint32_t timestamp = 3000;
uint16_t nack_list[kVideoNackListSize];
transport_.DropEveryNthPacket(10);
for (int frame = 0; frame < 10; ++frame) {
@ -154,17 +154,17 @@ TEST_F(RtpRtcpRtxNackTest, RTCP) {
std::sort(receiver_.sequence_numbers_.begin(),
receiver_.sequence_numbers_.end());
std::vector<WebRtc_UWord16> missing_sequence_numbers;
std::vector<WebRtc_UWord16>::iterator it =
std::vector<uint16_t> missing_sequence_numbers;
std::vector<uint16_t>::iterator it =
receiver_.sequence_numbers_.begin();
while (it != receiver_.sequence_numbers_.end()) {
WebRtc_UWord16 sequence_number_1 = *it;
uint16_t sequence_number_1 = *it;
++it;
if (it != receiver_.sequence_numbers_.end()) {
WebRtc_UWord16 sequence_number_2 = *it;
uint16_t sequence_number_2 = *it;
// Add all missing sequence numbers to list.
for (WebRtc_UWord16 i = sequence_number_1 + 1; i < sequence_number_2;
for (uint16_t i = sequence_number_1 + 1; i < sequence_number_2;
++i) {
missing_sequence_numbers.push_back(i);
}
@ -198,8 +198,8 @@ TEST_F(RtpRtcpRtxNackTest, RTXNack) {
transport_.DropEveryNthPacket(10);
WebRtc_UWord32 timestamp = 3000;
WebRtc_UWord16 nack_list[kVideoNackListSize];
uint32_t timestamp = 3000;
uint16_t nack_list[kVideoNackListSize];
for (int frame = 0; frame < 10; ++frame) {
EXPECT_EQ(0, rtp_rtcp_module_->SendOutgoingData(webrtc::kVideoFrameDelta,
@ -212,10 +212,10 @@ TEST_F(RtpRtcpRtxNackTest, RTXNack) {
std::sort(receiver_.sequence_numbers_.begin(),
receiver_.sequence_numbers_.end());
std::vector<WebRtc_UWord16> missing_sequence_numbers;
std::vector<uint16_t> missing_sequence_numbers;
std::vector<WebRtc_UWord16>::iterator it =
std::vector<uint16_t>::iterator it =
receiver_.sequence_numbers_.begin();
while (it != receiver_.sequence_numbers_.end()) {
int sequence_number_1 = *it;
@ -255,7 +255,7 @@ TEST_F(RtpRtcpRtxNackTest, RTXAllNoLoss) {
true, kTestSsrc + 1));
transport_.DropEveryNthPacket(0);
WebRtc_UWord32 timestamp = 3000;
uint32_t timestamp = 3000;
for (int frame = 0; frame < 10; ++frame) {
EXPECT_EQ(0, rtp_rtcp_module_->SendOutgoingData(webrtc::kVideoFrameDelta,
@ -292,8 +292,8 @@ TEST_F(RtpRtcpRtxNackTest, RTXAllWithLoss) {
int loss = 10;
transport_.DropEveryNthPacket(loss);
WebRtc_UWord32 timestamp = 3000;
WebRtc_UWord16 nack_list[kVideoNackListSize];
uint32_t timestamp = 3000;
uint16_t nack_list[kVideoNackListSize];
for (int frame = 0; frame < 10; ++frame) {
EXPECT_EQ(0, rtp_rtcp_module_->SendOutgoingData(webrtc::kVideoFrameDelta,
@ -304,9 +304,9 @@ TEST_F(RtpRtcpRtxNackTest, RTXAllWithLoss) {
payload_data_length));
std::sort(receiver_.sequence_numbers_.begin(),
receiver_.sequence_numbers_.end());
std::vector<WebRtc_UWord16> missing_sequence_numbers;
std::vector<uint16_t> missing_sequence_numbers;
std::vector<WebRtc_UWord16>::iterator it =
std::vector<uint16_t>::iterator it =
receiver_.sequence_numbers_.begin();
while (it != receiver_.sequence_numbers_.end()) {
int sequence_number_1 = *it;

View File

@ -32,7 +32,7 @@ enum { kHighProtectionThreshold = 80 }; // Corresponds to ~30 overhead, range
// media packets).
struct RtpPacket {
WebRtc_UWord16 rtpHeaderLength;
uint16_t rtpHeaderLength;
ForwardErrorCorrection::Packet* pkt;
};

View File

@ -19,7 +19,7 @@
// RFC 5109
namespace webrtc {
ReceiverFEC::ReceiverFEC(const WebRtc_Word32 id, RTPReceiverVideo* owner)
ReceiverFEC::ReceiverFEC(const int32_t id, RTPReceiverVideo* owner)
: _id(id),
_owner(owner),
_fec(new ForwardErrorCorrection(id)),
@ -42,7 +42,7 @@ ReceiverFEC::~ReceiverFEC() {
}
}
void ReceiverFEC::SetPayloadTypeFEC(const WebRtc_Word8 payloadType) {
void ReceiverFEC::SetPayloadTypeFEC(const int8_t payloadType) {
_payloadTypeFEC = payloadType;
}
@ -76,16 +76,16 @@ RFC 2198 RTP Payload for Redundant Audio Data September 1997
block excluding header.
*/
WebRtc_Word32 ReceiverFEC::AddReceivedFECPacket(
int32_t ReceiverFEC::AddReceivedFECPacket(
const WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* incomingRtpPacket,
const WebRtc_UWord16 payloadDataLength,
const uint8_t* incomingRtpPacket,
const uint16_t payloadDataLength,
bool& FECpacket) {
if (_payloadTypeFEC == -1) {
return -1;
}
WebRtc_UWord8 REDHeaderLength = 1;
uint8_t REDHeaderLength = 1;
// Add to list without RED header, aka a virtual RTP packet
// we remove the RED header
@ -95,7 +95,7 @@ WebRtc_Word32 ReceiverFEC::AddReceivedFECPacket(
receivedPacket->pkt = new ForwardErrorCorrection::Packet;
// get payload type from RED header
WebRtc_UWord8 payloadType =
uint8_t payloadType =
incomingRtpPacket[rtpHeader->header.headerLength] & 0x7f;
// use the payloadType to decide if it's FEC or coded data
@ -108,11 +108,11 @@ WebRtc_Word32 ReceiverFEC::AddReceivedFECPacket(
}
receivedPacket->seqNum = rtpHeader->header.sequenceNumber;
WebRtc_UWord16 blockLength = 0;
uint16_t blockLength = 0;
if(incomingRtpPacket[rtpHeader->header.headerLength] & 0x80) {
// f bit set in RED header
REDHeaderLength = 4;
WebRtc_UWord16 timestampOffset =
uint16_t timestampOffset =
(incomingRtpPacket[rtpHeader->header.headerLength + 1]) << 8;
timestampOffset += incomingRtpPacket[rtpHeader->header.headerLength+2];
timestampOffset = timestampOffset >> 2;
@ -221,7 +221,7 @@ WebRtc_Word32 ReceiverFEC::AddReceivedFECPacket(
return 0;
}
WebRtc_Word32 ReceiverFEC::ProcessReceivedFEC() {
int32_t ReceiverFEC::ProcessReceivedFEC() {
if (!_receivedPacketList.empty()) {
// Send received media packet to VCM.
if (!_receivedPacketList.front()->isFec) {

View File

@ -23,17 +23,17 @@ class RTPReceiverVideo;
class ReceiverFEC
{
public:
ReceiverFEC(const WebRtc_Word32 id, RTPReceiverVideo* owner);
ReceiverFEC(const int32_t id, RTPReceiverVideo* owner);
virtual ~ReceiverFEC();
WebRtc_Word32 AddReceivedFECPacket(const WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* incomingRtpPacket,
const WebRtc_UWord16 payloadDataLength,
bool& FECpacket);
int32_t AddReceivedFECPacket(const WebRtcRTPHeader* rtpHeader,
const uint8_t* incomingRtpPacket,
const uint16_t payloadDataLength,
bool& FECpacket);
WebRtc_Word32 ProcessReceivedFEC();
int32_t ProcessReceivedFEC();
void SetPayloadTypeFEC(const WebRtc_Word8 payloadType);
void SetPayloadTypeFEC(const int8_t payloadType);
private:
int ParseAndReceivePacket(const ForwardErrorCorrection::Packet* packet);
@ -46,7 +46,7 @@ private:
// arrives. We should remove the list.
ForwardErrorCorrection::ReceivedPacketList _receivedPacketList;
ForwardErrorCorrection::RecoveredPacketList _recoveredPacketList;
WebRtc_Word8 _payloadTypeFEC;
int8_t _payloadTypeFEC;
};
} // namespace webrtc

View File

@ -36,8 +36,8 @@ class TestTransport : public Transport {
virtual int SendRTCPPacket(int /*channel*/,
const void *packet,
int packetLength) {
RTCPUtility::RTCPParserV2 rtcpParser((WebRtc_UWord8*)packet,
(WebRtc_Word32)packetLength,
RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet,
(int32_t)packetLength,
true); // Allow non-compound RTCP
EXPECT_TRUE(rtcpParser.IsValid());
@ -45,9 +45,9 @@ class TestTransport : public Transport {
EXPECT_EQ(0, rtcp_receiver_->IncomingRTCPPacket(rtcpPacketInformation,
&rtcpParser));
EXPECT_EQ((WebRtc_UWord32)kRtcpRemb,
EXPECT_EQ((uint32_t)kRtcpRemb,
rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb);
EXPECT_EQ((WebRtc_UWord32)1234,
EXPECT_EQ((uint32_t)1234,
rtcpPacketInformation.receiverEstimatedMaxBitrate);
return packetLength;
}
@ -113,14 +113,14 @@ TEST_F(RtcpFormatRembTest, TestBasicAPI) {
}
TEST_F(RtcpFormatRembTest, TestNonCompund) {
WebRtc_UWord32 SSRC = 456789;
uint32_t SSRC = 456789;
EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpNonCompound));
EXPECT_EQ(0, rtcp_sender_->SetREMBData(1234, 1, &SSRC));
EXPECT_EQ(0, rtcp_sender_->SendRTCP(kRtcpRemb));
}
TEST_F(RtcpFormatRembTest, TestCompund) {
WebRtc_UWord32 SSRCs[2] = {456789, 98765};
uint32_t SSRCs[2] = {456789, 98765};
EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound));
EXPECT_EQ(0, rtcp_sender_->SetREMBData(1234, 2, SSRCs));
EXPECT_EQ(0, rtcp_sender_->SendRTCP(kRtcpRemb));

View File

@ -30,7 +30,7 @@ using namespace RTCPHelp;
// The number of RTCP time intervals needed to trigger a timeout.
const int kRrTimeoutIntervals = 3;
RTCPReceiver::RTCPReceiver(const WebRtc_Word32 id, Clock* clock,
RTCPReceiver::RTCPReceiver(const int32_t id, Clock* clock,
ModuleRtpRtcpImpl* owner)
: TMMBRHelp(),
_id(id),
@ -64,19 +64,19 @@ RTCPReceiver::~RTCPReceiver() {
delete _criticalSectionFeedbacks;
while (!_receivedReportBlockMap.empty()) {
std::map<WebRtc_UWord32, RTCPReportBlockInformation*>::iterator first =
std::map<uint32_t, RTCPReportBlockInformation*>::iterator first =
_receivedReportBlockMap.begin();
delete first->second;
_receivedReportBlockMap.erase(first);
}
while (!_receivedInfoMap.empty()) {
std::map<WebRtc_UWord32, RTCPReceiveInformation*>::iterator first =
std::map<uint32_t, RTCPReceiveInformation*>::iterator first =
_receivedInfoMap.begin();
delete first->second;
_receivedInfoMap.erase(first);
}
while (!_receivedCnameMap.empty()) {
std::map<WebRtc_UWord32, RTCPCnameInformation*>::iterator first =
std::map<uint32_t, RTCPCnameInformation*>::iterator first =
_receivedCnameMap.begin();
delete first->second;
_receivedCnameMap.erase(first);
@ -86,7 +86,7 @@ RTCPReceiver::~RTCPReceiver() {
}
void
RTCPReceiver::ChangeUniqueId(const WebRtc_Word32 id)
RTCPReceiver::ChangeUniqueId(const int32_t id)
{
_id = id;
}
@ -98,7 +98,7 @@ RTCPReceiver::Status() const
return _method;
}
WebRtc_Word32
int32_t
RTCPReceiver::SetRTCPStatus(const RTCPMethod method)
{
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
@ -106,17 +106,17 @@ RTCPReceiver::SetRTCPStatus(const RTCPMethod method)
return 0;
}
WebRtc_Word64
int64_t
RTCPReceiver::LastReceived()
{
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
return _lastReceived;
}
WebRtc_Word64
int64_t
RTCPReceiver::LastReceivedReceiverReport() const {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
WebRtc_Word64 last_received_rr = -1;
int64_t last_received_rr = -1;
for (ReceivedInfoMap::const_iterator it = _receivedInfoMap.begin();
it != _receivedInfoMap.end(); ++it) {
if (it->second->lastTimeReceived > last_received_rr) {
@ -126,8 +126,8 @@ RTCPReceiver::LastReceivedReceiverReport() const {
return last_received_rr;
}
WebRtc_Word32
RTCPReceiver::SetRemoteSSRC( const WebRtc_UWord32 ssrc)
int32_t
RTCPReceiver::SetRemoteSSRC( const uint32_t ssrc)
{
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
@ -151,8 +151,8 @@ void RTCPReceiver::RegisterRtcpObservers(
}
void RTCPReceiver::SetSSRC(const WebRtc_UWord32 ssrc) {
WebRtc_UWord32 old_ssrc = 0;
void RTCPReceiver::SetSSRC(const uint32_t ssrc) {
uint32_t old_ssrc = 0;
{
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
old_ssrc = _SSRC;
@ -166,7 +166,7 @@ void RTCPReceiver::SetSSRC(const WebRtc_UWord32 ssrc) {
}
}
WebRtc_Word32 RTCPReceiver::ResetRTT(const WebRtc_UWord32 remoteSSRC) {
int32_t RTCPReceiver::ResetRTT(const uint32_t remoteSSRC) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
RTCPReportBlockInformation* reportBlock =
GetReportBlockInformation(remoteSSRC);
@ -182,11 +182,11 @@ WebRtc_Word32 RTCPReceiver::ResetRTT(const WebRtc_UWord32 remoteSSRC) {
return 0;
}
WebRtc_Word32 RTCPReceiver::RTT(const WebRtc_UWord32 remoteSSRC,
WebRtc_UWord16* RTT,
WebRtc_UWord16* avgRTT,
WebRtc_UWord16* minRTT,
WebRtc_UWord16* maxRTT) const {
int32_t RTCPReceiver::RTT(const uint32_t remoteSSRC,
uint16_t* RTT,
uint16_t* avgRTT,
uint16_t* minRTT,
uint16_t* maxRTT) const {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
RTCPReportBlockInformation* reportBlock =
@ -210,7 +210,7 @@ WebRtc_Word32 RTCPReceiver::RTT(const WebRtc_UWord32 remoteSSRC,
return 0;
}
WebRtc_UWord16 RTCPReceiver::RTT() const {
uint16_t RTCPReceiver::RTT() const {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
if (!_receivedReportBlockMap.empty()) {
return 0;
@ -218,7 +218,7 @@ WebRtc_UWord16 RTCPReceiver::RTT() const {
return _rtt;
}
int RTCPReceiver::SetRTT(WebRtc_UWord16 rtt) {
int RTCPReceiver::SetRTT(uint16_t rtt) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
if (!_receivedReportBlockMap.empty()) {
return -1;
@ -227,12 +227,12 @@ int RTCPReceiver::SetRTT(WebRtc_UWord16 rtt) {
return 0;
}
WebRtc_Word32
RTCPReceiver::NTP(WebRtc_UWord32 *ReceivedNTPsecs,
WebRtc_UWord32 *ReceivedNTPfrac,
WebRtc_UWord32 *RTCPArrivalTimeSecs,
WebRtc_UWord32 *RTCPArrivalTimeFrac,
WebRtc_UWord32 *rtcp_timestamp) const
int32_t
RTCPReceiver::NTP(uint32_t *ReceivedNTPsecs,
uint32_t *ReceivedNTPfrac,
uint32_t *RTCPArrivalTimeSecs,
uint32_t *RTCPArrivalTimeFrac,
uint32_t *rtcp_timestamp) const
{
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
if(ReceivedNTPsecs)
@ -257,7 +257,7 @@ RTCPReceiver::NTP(WebRtc_UWord32 *ReceivedNTPsecs,
return 0;
}
WebRtc_Word32
int32_t
RTCPReceiver::SenderInfoReceived(RTCPSenderInfo* senderInfo) const
{
if(senderInfo == NULL)
@ -277,12 +277,12 @@ RTCPReceiver::SenderInfoReceived(RTCPSenderInfo* senderInfo) const
// statistics
// we can get multiple receive reports when we receive the report from a CE
WebRtc_Word32 RTCPReceiver::StatisticsReceived(
int32_t RTCPReceiver::StatisticsReceived(
std::vector<RTCPReportBlock>* receiveBlocks) const {
assert(receiveBlocks);
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPReportBlockInformation*>::const_iterator it =
std::map<uint32_t, RTCPReportBlockInformation*>::const_iterator it =
_receivedReportBlockMap.begin();
while (it != _receivedReportBlockMap.end()) {
@ -292,7 +292,7 @@ WebRtc_Word32 RTCPReceiver::StatisticsReceived(
return 0;
}
WebRtc_Word32
int32_t
RTCPReceiver::IncomingRTCPPacket(RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2* rtcpParser)
{
@ -383,8 +383,8 @@ RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser,
// rtcpPacket.RR.SenderSSRC
// The source of the packet sender, same as of SR? or is this a CE?
const WebRtc_UWord32 remoteSSRC = (rtcpPacketType == RTCPUtility::kRtcpRrCode) ? rtcpPacket.RR.SenderSSRC:rtcpPacket.SR.SenderSSRC;
const WebRtc_UWord8 numberOfReportBlocks = (rtcpPacketType == RTCPUtility::kRtcpRrCode) ? rtcpPacket.RR.NumberOfReportBlocks:rtcpPacket.SR.NumberOfReportBlocks;
const uint32_t remoteSSRC = (rtcpPacketType == RTCPUtility::kRtcpRrCode) ? rtcpPacket.RR.SenderSSRC:rtcpPacket.SR.SenderSSRC;
const uint8_t numberOfReportBlocks = (rtcpPacketType == RTCPUtility::kRtcpRrCode) ? rtcpPacket.RR.NumberOfReportBlocks:rtcpPacket.SR.NumberOfReportBlocks;
rtcpPacketInformation.remoteSSRC = remoteSSRC;
@ -447,8 +447,8 @@ RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser,
void
RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation,
const WebRtc_UWord32 remoteSSRC,
const WebRtc_UWord8 numberOfReportBlocks) {
const uint32_t remoteSSRC,
const uint8_t numberOfReportBlocks) {
// This will be called once per report block in the RTCP packet.
// We filter out all report blocks that are not for us.
// Each packet has max 31 RR blocks.
@ -467,7 +467,7 @@ RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
// To avoid problem with acquiring _criticalSectionRTCPSender while holding
// _criticalSectionRTCPReceiver.
_criticalSectionRTCPReceiver->Leave();
WebRtc_UWord32 sendTimeMS =
uint32_t sendTimeMS =
_rtpRtcp.SendTimeOfSendReport(rtcpPacket.ReportBlockItem.LastSR);
_criticalSectionRTCPReceiver->Enter();
@ -502,25 +502,25 @@ RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
reportBlock->remoteMaxJitter = rtcpPacket.ReportBlockItem.Jitter;
}
WebRtc_UWord32 delaySinceLastSendReport =
uint32_t delaySinceLastSendReport =
rtcpPacket.ReportBlockItem.DelayLastSR;
// local NTP time when we received this
WebRtc_UWord32 lastReceivedRRNTPsecs = 0;
WebRtc_UWord32 lastReceivedRRNTPfrac = 0;
uint32_t lastReceivedRRNTPsecs = 0;
uint32_t lastReceivedRRNTPfrac = 0;
_clock->CurrentNtp(lastReceivedRRNTPsecs, lastReceivedRRNTPfrac);
// time when we received this in MS
WebRtc_UWord32 receiveTimeMS = ModuleRTPUtility::ConvertNTPTimeToMS(
uint32_t receiveTimeMS = ModuleRTPUtility::ConvertNTPTimeToMS(
lastReceivedRRNTPsecs, lastReceivedRRNTPfrac);
// Estimate RTT
WebRtc_UWord32 d = (delaySinceLastSendReport & 0x0000ffff) * 1000;
uint32_t d = (delaySinceLastSendReport & 0x0000ffff) * 1000;
d /= 65536;
d += ((delaySinceLastSendReport & 0xffff0000) >> 16) * 1000;
WebRtc_Word32 RTT = 0;
int32_t RTT = 0;
if (sendTimeMS > 0) {
RTT = receiveTimeMS - d - sendTimeMS;
@ -529,17 +529,17 @@ RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
}
if (RTT > reportBlock->maxRTT) {
// store max RTT
reportBlock->maxRTT = (WebRtc_UWord16) RTT;
reportBlock->maxRTT = (uint16_t) RTT;
}
if (reportBlock->minRTT == 0) {
// first RTT
reportBlock->minRTT = (WebRtc_UWord16) RTT;
reportBlock->minRTT = (uint16_t) RTT;
} else if (RTT < reportBlock->minRTT) {
// Store min RTT
reportBlock->minRTT = (WebRtc_UWord16) RTT;
reportBlock->minRTT = (uint16_t) RTT;
}
// store last RTT
reportBlock->RTT = (WebRtc_UWord16) RTT;
reportBlock->RTT = (uint16_t) RTT;
// store average RTT
if (reportBlock->numAverageCalcs != 0) {
@ -549,7 +549,7 @@ RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
reportBlock->avgRTT = static_cast<int> (newAverage + 0.5f);
} else {
// first RTT
reportBlock->avgRTT = (WebRtc_UWord16) RTT;
reportBlock->avgRTT = (uint16_t) RTT;
}
reportBlock->numAverageCalcs++;
}
@ -560,16 +560,16 @@ RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
// rtcpPacketInformation
rtcpPacketInformation.AddReportInfo(
reportBlock->remoteReceiveBlock.fractionLost, (WebRtc_UWord16) RTT,
reportBlock->remoteReceiveBlock.fractionLost, (uint16_t) RTT,
reportBlock->remoteReceiveBlock.extendedHighSeqNum,
reportBlock->remoteReceiveBlock.jitter);
}
RTCPReportBlockInformation*
RTCPReceiver::CreateReportBlockInformation(WebRtc_UWord32 remoteSSRC) {
RTCPReceiver::CreateReportBlockInformation(uint32_t remoteSSRC) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPReportBlockInformation*>::iterator it =
std::map<uint32_t, RTCPReportBlockInformation*>::iterator it =
_receivedReportBlockMap.find(remoteSSRC);
RTCPReportBlockInformation* ptrReportBlockInfo = NULL;
@ -583,10 +583,10 @@ RTCPReceiver::CreateReportBlockInformation(WebRtc_UWord32 remoteSSRC) {
}
RTCPReportBlockInformation*
RTCPReceiver::GetReportBlockInformation(WebRtc_UWord32 remoteSSRC) const {
RTCPReceiver::GetReportBlockInformation(uint32_t remoteSSRC) const {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPReportBlockInformation*>::const_iterator it =
std::map<uint32_t, RTCPReportBlockInformation*>::const_iterator it =
_receivedReportBlockMap.find(remoteSSRC);
if (it == _receivedReportBlockMap.end()) {
@ -596,10 +596,10 @@ RTCPReceiver::GetReportBlockInformation(WebRtc_UWord32 remoteSSRC) const {
}
RTCPCnameInformation*
RTCPReceiver::CreateCnameInformation(WebRtc_UWord32 remoteSSRC) {
RTCPReceiver::CreateCnameInformation(uint32_t remoteSSRC) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPCnameInformation*>::iterator it =
std::map<uint32_t, RTCPCnameInformation*>::iterator it =
_receivedCnameMap.find(remoteSSRC);
if (it != _receivedCnameMap.end()) {
@ -612,10 +612,10 @@ RTCPReceiver::CreateCnameInformation(WebRtc_UWord32 remoteSSRC) {
}
RTCPCnameInformation*
RTCPReceiver::GetCnameInformation(WebRtc_UWord32 remoteSSRC) const {
RTCPReceiver::GetCnameInformation(uint32_t remoteSSRC) const {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPCnameInformation*>::const_iterator it =
std::map<uint32_t, RTCPCnameInformation*>::const_iterator it =
_receivedCnameMap.find(remoteSSRC);
if (it == _receivedCnameMap.end()) {
@ -625,10 +625,10 @@ RTCPReceiver::GetCnameInformation(WebRtc_UWord32 remoteSSRC) const {
}
RTCPReceiveInformation*
RTCPReceiver::CreateReceiveInformation(WebRtc_UWord32 remoteSSRC) {
RTCPReceiver::CreateReceiveInformation(uint32_t remoteSSRC) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPReceiveInformation*>::iterator it =
std::map<uint32_t, RTCPReceiveInformation*>::iterator it =
_receivedInfoMap.find(remoteSSRC);
if (it != _receivedInfoMap.end()) {
@ -640,10 +640,10 @@ RTCPReceiver::CreateReceiveInformation(WebRtc_UWord32 remoteSSRC) {
}
RTCPReceiveInformation*
RTCPReceiver::GetReceiveInformation(WebRtc_UWord32 remoteSSRC) {
RTCPReceiver::GetReceiveInformation(uint32_t remoteSSRC) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPReceiveInformation*>::iterator it =
std::map<uint32_t, RTCPReceiveInformation*>::iterator it =
_receivedInfoMap.find(remoteSSRC);
if (it == _receivedInfoMap.end()) {
return NULL;
@ -690,9 +690,9 @@ bool RTCPReceiver::UpdateRTCPReceiveInformationTimers() {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
bool updateBoundingSet = false;
WebRtc_Word64 timeNow = _clock->TimeInMilliseconds();
int64_t timeNow = _clock->TimeInMilliseconds();
std::map<WebRtc_UWord32, RTCPReceiveInformation*>::iterator receiveInfoIt =
std::map<uint32_t, RTCPReceiveInformation*>::iterator receiveInfoIt =
_receivedInfoMap.begin();
while (receiveInfoIt != _receivedInfoMap.end()) {
@ -718,7 +718,7 @@ bool RTCPReceiver::UpdateRTCPReceiveInformationTimers() {
receiveInfoIt++;
} else if (receiveInfo->readyForDelete) {
// store our current receiveInfoItem
std::map<WebRtc_UWord32, RTCPReceiveInformation*>::iterator
std::map<uint32_t, RTCPReceiveInformation*>::iterator
receiveInfoItemToBeErased = receiveInfoIt;
receiveInfoIt++;
delete receiveInfoItemToBeErased->second;
@ -730,11 +730,10 @@ bool RTCPReceiver::UpdateRTCPReceiveInformationTimers() {
return updateBoundingSet;
}
WebRtc_Word32 RTCPReceiver::BoundingSet(bool &tmmbrOwner,
TMMBRSet* boundingSetRec) {
int32_t RTCPReceiver::BoundingSet(bool &tmmbrOwner, TMMBRSet* boundingSetRec) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPReceiveInformation*>::iterator receiveInfoIt =
std::map<uint32_t, RTCPReceiveInformation*>::iterator receiveInfoIt =
_receivedInfoMap.find(_remoteSSRC);
if (receiveInfoIt == _receivedInfoMap.end()) {
@ -750,7 +749,7 @@ WebRtc_Word32 RTCPReceiver::BoundingSet(bool &tmmbrOwner,
if (receiveInfo->TmmbnBoundingSet.lengthOfSet() > 0) {
boundingSetRec->VerifyAndAllocateSet(
receiveInfo->TmmbnBoundingSet.lengthOfSet() + 1);
for(WebRtc_UWord32 i=0; i< receiveInfo->TmmbnBoundingSet.lengthOfSet();
for(uint32_t i=0; i< receiveInfo->TmmbnBoundingSet.lengthOfSet();
i++) {
if(receiveInfo->TmmbnBoundingSet.Ssrc(i) == _SSRC) {
// owner of bounding set
@ -817,7 +816,7 @@ RTCPReceiver::HandleNACKItem(const RTCPUtility::RTCPPacket& rtcpPacket,
{
rtcpPacketInformation.AddNACKPacket(rtcpPacket.NACKItem.PacketID);
WebRtc_UWord16 bitMask = rtcpPacket.NACKItem.BitMask;
uint16_t bitMask = rtcpPacket.NACKItem.BitMask;
if(bitMask)
{
for(int i=1; i <= 16; ++i)
@ -839,7 +838,7 @@ void RTCPReceiver::HandleBYE(RTCPUtility::RTCPParserV2& rtcpParser) {
// clear our lists
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPReportBlockInformation*>::iterator
std::map<uint32_t, RTCPReportBlockInformation*>::iterator
reportBlockInfoIt = _receivedReportBlockMap.find(
rtcpPacket.BYE.SenderSSRC);
@ -848,14 +847,14 @@ void RTCPReceiver::HandleBYE(RTCPUtility::RTCPParserV2& rtcpParser) {
_receivedReportBlockMap.erase(reportBlockInfoIt);
}
// we can't delete it due to TMMBR
std::map<WebRtc_UWord32, RTCPReceiveInformation*>::iterator receiveInfoIt =
std::map<uint32_t, RTCPReceiveInformation*>::iterator receiveInfoIt =
_receivedInfoMap.find(rtcpPacket.BYE.SenderSSRC);
if (receiveInfoIt != _receivedInfoMap.end()) {
receiveInfoIt->second->readyForDelete = true;
}
std::map<WebRtc_UWord32, RTCPCnameInformation*>::iterator cnameInfoIt =
std::map<uint32_t, RTCPCnameInformation*>::iterator cnameInfoIt =
_receivedCnameMap.find(rtcpPacket.BYE.SenderSSRC);
if (cnameInfoIt != _receivedCnameMap.end()) {
@ -927,7 +926,7 @@ RTCPReceiver::HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser,
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
WebRtc_UWord32 senderSSRC = rtcpPacket.TMMBR.SenderSSRC;
uint32_t senderSSRC = rtcpPacket.TMMBR.SenderSSRC;
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(senderSSRC);
if (ptrReceiveInfo == NULL)
{
@ -953,7 +952,7 @@ RTCPReceiver::HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser,
rtcpParser.Iterate();
return;
}
ptrReceiveInfo->VerifyAndAllocateTMMBRSet((WebRtc_UWord32)maxNumOfTMMBRBlocks);
ptrReceiveInfo->VerifyAndAllocateTMMBRSet((uint32_t)maxNumOfTMMBRBlocks);
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpRtpfbTmmbrItemCode)
@ -968,7 +967,7 @@ void
RTCPReceiver::HandleTMMBRItem(RTCPReceiveInformation& receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation,
const WebRtc_UWord32 senderSSRC)
const uint32_t senderSSRC)
{
if (_SSRC == rtcpPacket.TMMBRItem.SSRC &&
rtcpPacket.TMMBRItem.MaxTotalMediaBitRate > 0)
@ -1005,7 +1004,7 @@ RTCPReceiver::HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser,
return;
}
ptrReceiveInfo->VerifyAndAllocateBoundingSet((WebRtc_UWord32)maxNumOfTMMBNBlocks);
ptrReceiveInfo->VerifyAndAllocateBoundingSet((uint32_t)maxNumOfTMMBNBlocks);
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpRtpfbTmmbnItemCode)
@ -1078,8 +1077,8 @@ RTCPReceiver::HandleRPSI(RTCPUtility::RTCPParserV2& rtcpParser,
rtcpPacketInformation.rpsiPictureId = 0;
// convert NativeBitString to rpsiPictureId
WebRtc_UWord8 numberOfBytes = rtcpPacket.RPSI.NumberOfValidBits /8;
for(WebRtc_UWord8 n = 0; n < (numberOfBytes-1); n++)
uint8_t numberOfBytes = rtcpPacket.RPSI.NumberOfValidBits /8;
for(uint8_t n = 0; n < (numberOfBytes-1); n++)
{
rtcpPacketInformation.rpsiPictureId += (rtcpPacket.RPSI.NativeBitString[n] & 0x7f);
rtcpPacketInformation.rpsiPictureId <<= 7; // prepare next
@ -1162,7 +1161,7 @@ void RTCPReceiver::HandleFIRItem(RTCPReceiveInformation* receiveInfo,
// check if we have reported this FIRSequenceNumber before
if (rtcpPacket.FIRItem.CommandSequenceNumber !=
receiveInfo->lastFIRSequenceNumber) {
WebRtc_Word64 now = _clock->TimeInMilliseconds();
int64_t now = _clock->TimeInMilliseconds();
// sanity; don't go crazy with the callbacks
if ((now - receiveInfo->lastFIRRequest) > RTCP_MIN_FRAME_LENGTH_MS) {
receiveInfo->lastFIRRequest = now;
@ -1202,12 +1201,12 @@ RTCPReceiver::HandleAPPItem(RTCPUtility::RTCPParserV2& rtcpParser,
rtcpParser.Iterate();
}
WebRtc_Word32 RTCPReceiver::UpdateTMMBR() {
WebRtc_Word32 numBoundingSet = 0;
WebRtc_UWord32 bitrate = 0;
WebRtc_UWord32 accNumCandidates = 0;
int32_t RTCPReceiver::UpdateTMMBR() {
int32_t numBoundingSet = 0;
uint32_t bitrate = 0;
uint32_t accNumCandidates = 0;
WebRtc_Word32 size = TMMBRReceived(0, 0, NULL);
int32_t size = TMMBRReceived(0, 0, NULL);
if (size > 0) {
TMMBRSet* candidateSet = VerifyAndAllocateCandidateSet(size);
// Get candidate set from receiver.
@ -1318,7 +1317,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
if ((rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSr ||
rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRr) &&
rtcpPacketInformation.reportBlock) {
WebRtc_Word64 now = _clock->TimeInMilliseconds();
int64_t now = _clock->TimeInMilliseconds();
_cbRtcpBandwidthObserver->OnReceivedRtcpReceiverReport(
rtcpPacketInformation.remoteSSRC,
rtcpPacketInformation.fractionLost,
@ -1353,8 +1352,8 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
}
}
WebRtc_Word32 RTCPReceiver::CNAME(const WebRtc_UWord32 remoteSSRC,
char cName[RTCP_CNAME_SIZE]) const {
int32_t RTCPReceiver::CNAME(const uint32_t remoteSSRC,
char cName[RTCP_CNAME_SIZE]) const {
assert(cName);
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
@ -1368,24 +1367,24 @@ WebRtc_Word32 RTCPReceiver::CNAME(const WebRtc_UWord32 remoteSSRC,
}
// no callbacks allowed inside this function
WebRtc_Word32 RTCPReceiver::TMMBRReceived(const WebRtc_UWord32 size,
const WebRtc_UWord32 accNumCandidates,
TMMBRSet* candidateSet) const {
int32_t RTCPReceiver::TMMBRReceived(const uint32_t size,
const uint32_t accNumCandidates,
TMMBRSet* candidateSet) const {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
std::map<WebRtc_UWord32, RTCPReceiveInformation*>::const_iterator
std::map<uint32_t, RTCPReceiveInformation*>::const_iterator
receiveInfoIt = _receivedInfoMap.begin();
if (receiveInfoIt == _receivedInfoMap.end()) {
return -1;
}
WebRtc_UWord32 num = accNumCandidates;
uint32_t num = accNumCandidates;
if (candidateSet) {
while( num < size && receiveInfoIt != _receivedInfoMap.end()) {
RTCPReceiveInformation* receiveInfo = receiveInfoIt->second;
if (receiveInfo == NULL) {
return 0;
}
for (WebRtc_UWord32 i = 0;
for (uint32_t i = 0;
(num < size) && (i < receiveInfo->TmmbrSet.lengthOfSet()); i++) {
if (receiveInfo->GetTMMBRSet(i, num, candidateSet,
_clock->TimeInMilliseconds()) == 0) {
@ -1410,8 +1409,8 @@ WebRtc_Word32 RTCPReceiver::TMMBRReceived(const WebRtc_UWord32 size,
return num;
}
WebRtc_Word32
RTCPReceiver::SetPacketTimeout(const WebRtc_UWord32 timeoutMS)
int32_t
RTCPReceiver::SetPacketTimeout(const uint32_t timeoutMS)
{
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
_packetTimeOutMS = timeoutMS;
@ -1435,7 +1434,7 @@ void RTCPReceiver::PacketTimeout()
return;
}
WebRtc_Word64 now = _clock->TimeInMilliseconds();
int64_t now = _clock->TimeInMilliseconds();
if(now - _lastReceived > _packetTimeOutMS)
{
packetTimeOut = true;

View File

@ -27,61 +27,62 @@ class ModuleRtpRtcpImpl;
class RTCPReceiver : public TMMBRHelp
{
public:
RTCPReceiver(const WebRtc_Word32 id, Clock* clock,
RTCPReceiver(const int32_t id, Clock* clock,
ModuleRtpRtcpImpl* owner);
virtual ~RTCPReceiver();
void ChangeUniqueId(const WebRtc_Word32 id);
void ChangeUniqueId(const int32_t id);
RTCPMethod Status() const;
WebRtc_Word32 SetRTCPStatus(const RTCPMethod method);
int32_t SetRTCPStatus(const RTCPMethod method);
WebRtc_Word64 LastReceived();
WebRtc_Word64 LastReceivedReceiverReport() const;
int64_t LastReceived();
int64_t LastReceivedReceiverReport() const;
void SetSSRC( const WebRtc_UWord32 ssrc);
void SetRelaySSRC( const WebRtc_UWord32 ssrc);
WebRtc_Word32 SetRemoteSSRC( const WebRtc_UWord32 ssrc);
void SetSSRC( const uint32_t ssrc);
void SetRelaySSRC( const uint32_t ssrc);
int32_t SetRemoteSSRC( const uint32_t ssrc);
WebRtc_UWord32 RelaySSRC() const;
uint32_t RelaySSRC() const;
void RegisterRtcpObservers(RtcpIntraFrameObserver* intra_frame_callback,
RtcpBandwidthObserver* bandwidth_callback,
RtcpFeedback* feedback_callback);
WebRtc_Word32 IncomingRTCPPacket(RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2 *rtcpParser);
int32_t IncomingRTCPPacket(
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2 *rtcpParser);
void TriggerCallbacksFromRTCPPacket(RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
// get received cname
WebRtc_Word32 CNAME(const WebRtc_UWord32 remoteSSRC,
char cName[RTCP_CNAME_SIZE]) const;
int32_t CNAME(const uint32_t remoteSSRC,
char cName[RTCP_CNAME_SIZE]) const;
// get received NTP
WebRtc_Word32 NTP(WebRtc_UWord32 *ReceivedNTPsecs,
WebRtc_UWord32 *ReceivedNTPfrac,
WebRtc_UWord32 *RTCPArrivalTimeSecs,
WebRtc_UWord32 *RTCPArrivalTimeFrac,
WebRtc_UWord32 *rtcp_timestamp) const;
int32_t NTP(uint32_t *ReceivedNTPsecs,
uint32_t *ReceivedNTPfrac,
uint32_t *RTCPArrivalTimeSecs,
uint32_t *RTCPArrivalTimeFrac,
uint32_t *rtcp_timestamp) const;
// get rtt
WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
WebRtc_UWord16* RTT,
WebRtc_UWord16* avgRTT,
WebRtc_UWord16* minRTT,
WebRtc_UWord16* maxRTT) const;
int32_t RTT(const uint32_t remoteSSRC,
uint16_t* RTT,
uint16_t* avgRTT,
uint16_t* minRTT,
uint16_t* maxRTT) const;
WebRtc_UWord16 RTT() const;
uint16_t RTT() const;
int SetRTT(WebRtc_UWord16 rtt);
int SetRTT(uint16_t rtt);
WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC);
int32_t ResetRTT(const uint32_t remoteSSRC);
WebRtc_Word32 SenderInfoReceived(RTCPSenderInfo* senderInfo) const;
int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const;
// get statistics
WebRtc_Word32 StatisticsReceived(
int32_t StatisticsReceived(
std::vector<RTCPReportBlock>* receiveBlocks) const;
// Returns true if we haven't received an RTCP RR for several RTCP
@ -95,28 +96,28 @@ public:
bool RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms);
// Get TMMBR
WebRtc_Word32 TMMBRReceived(const WebRtc_UWord32 size,
const WebRtc_UWord32 accNumCandidates,
TMMBRSet* candidateSet) const;
int32_t TMMBRReceived(const uint32_t size,
const uint32_t accNumCandidates,
TMMBRSet* candidateSet) const;
bool UpdateRTCPReceiveInformationTimers();
WebRtc_Word32 BoundingSet(bool &tmmbrOwner, TMMBRSet* boundingSetRec);
int32_t BoundingSet(bool &tmmbrOwner, TMMBRSet* boundingSetRec);
WebRtc_Word32 UpdateTMMBR();
int32_t UpdateTMMBR();
WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 timeoutMS);
int32_t SetPacketTimeout(const uint32_t timeoutMS);
void PacketTimeout();
protected:
RTCPHelp::RTCPReportBlockInformation* CreateReportBlockInformation(const WebRtc_UWord32 remoteSSRC);
RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation(const WebRtc_UWord32 remoteSSRC) const;
RTCPHelp::RTCPReportBlockInformation* CreateReportBlockInformation(const uint32_t remoteSSRC);
RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation(const uint32_t remoteSSRC) const;
RTCPUtility::RTCPCnameInformation* CreateCnameInformation(const WebRtc_UWord32 remoteSSRC);
RTCPUtility::RTCPCnameInformation* GetCnameInformation(const WebRtc_UWord32 remoteSSRC) const;
RTCPUtility::RTCPCnameInformation* CreateCnameInformation(const uint32_t remoteSSRC);
RTCPUtility::RTCPCnameInformation* GetCnameInformation(const uint32_t remoteSSRC) const;
RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation(const WebRtc_UWord32 remoteSSRC);
RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(const WebRtc_UWord32 remoteSSRC);
RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation(const uint32_t remoteSSRC);
RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(const uint32_t remoteSSRC);
void UpdateReceiveInformation( RTCPHelp::RTCPReceiveInformation& receiveInformation);
@ -125,8 +126,8 @@ protected:
void HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
const WebRtc_UWord32 remoteSSRC,
const WebRtc_UWord8 numberOfReportBlocks);
const uint32_t remoteSSRC,
const uint8_t numberOfReportBlocks);
void HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser);
@ -173,7 +174,7 @@ protected:
void HandleTMMBRItem(RTCPHelp::RTCPReceiveInformation& receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
const WebRtc_UWord32 senderSSRC);
const uint32_t senderSSRC);
void HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
@ -198,12 +199,12 @@ protected:
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
private:
typedef std::map<WebRtc_UWord32, RTCPHelp::RTCPReceiveInformation*>
typedef std::map<uint32_t, RTCPHelp::RTCPReceiveInformation*>
ReceivedInfoMap;
WebRtc_Word32 _id;
int32_t _id;
Clock* _clock;
RTCPMethod _method;
WebRtc_Word64 _lastReceived;
int64_t _lastReceived;
ModuleRtpRtcpImpl& _rtpRtcp;
CriticalSectionWrapper* _criticalSectionFeedbacks;
@ -212,23 +213,23 @@ protected:
RtcpIntraFrameObserver* _cbRtcpIntraFrameObserver;
CriticalSectionWrapper* _criticalSectionRTCPReceiver;
WebRtc_UWord32 _SSRC;
WebRtc_UWord32 _remoteSSRC;
uint32_t _SSRC;
uint32_t _remoteSSRC;
// Received send report
RTCPSenderInfo _remoteSenderInfo;
// when did we receive the last send report
WebRtc_UWord32 _lastReceivedSRNTPsecs;
WebRtc_UWord32 _lastReceivedSRNTPfrac;
uint32_t _lastReceivedSRNTPsecs;
uint32_t _lastReceivedSRNTPfrac;
// Received report blocks.
std::map<WebRtc_UWord32, RTCPHelp::RTCPReportBlockInformation*>
std::map<uint32_t, RTCPHelp::RTCPReportBlockInformation*>
_receivedReportBlockMap;
ReceivedInfoMap _receivedInfoMap;
std::map<WebRtc_UWord32, RTCPUtility::RTCPCnameInformation*>
std::map<uint32_t, RTCPUtility::RTCPCnameInformation*>
_receivedCnameMap;
WebRtc_UWord32 _packetTimeOutMS;
uint32_t _packetTimeOutMS;
// The last time we received an RTCP RR.
int64_t _lastReceivedRrMs;
@ -239,7 +240,7 @@ protected:
// Externally set RTT. This value can only be used if there are no valid
// RTT estimates.
WebRtc_UWord16 _rtt;
uint16_t _rtt;
};
} // namespace webrtc

View File

@ -54,19 +54,19 @@ RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric)
memcpy(VoIPMetric, metric, sizeof(RTCPVoIPMetric));
}
void RTCPPacketInformation::AddApplicationData(const WebRtc_UWord8* data,
const WebRtc_UWord16 size) {
WebRtc_UWord8* oldData = applicationData;
WebRtc_UWord16 oldLength = applicationLength;
void RTCPPacketInformation::AddApplicationData(const uint8_t* data,
const uint16_t size) {
uint8_t* oldData = applicationData;
uint16_t oldLength = applicationLength;
// Don't copy more than kRtcpAppCode_DATA_SIZE bytes.
WebRtc_UWord16 copySize = size;
uint16_t copySize = size;
if (size > kRtcpAppCode_DATA_SIZE) {
copySize = kRtcpAppCode_DATA_SIZE;
}
applicationLength += copySize;
applicationData = new WebRtc_UWord8[applicationLength];
applicationData = new uint8_t[applicationLength];
if (oldData)
{
@ -86,7 +86,7 @@ RTCPPacketInformation::ResetNACKPacketIdArray()
}
void
RTCPPacketInformation::AddNACKPacket(const WebRtc_UWord16 packetID)
RTCPPacketInformation::AddNACKPacket(const uint16_t packetID)
{
if (nackSequenceNumbers.size() >= kSendSideNackListSizeSanity) {
return;
@ -95,10 +95,10 @@ RTCPPacketInformation::AddNACKPacket(const WebRtc_UWord16 packetID)
}
void
RTCPPacketInformation::AddReportInfo(const WebRtc_UWord8 fraction,
const WebRtc_UWord16 rtt,
const WebRtc_UWord32 extendedHighSeqNum,
const WebRtc_UWord32 j)
RTCPPacketInformation::AddReportInfo(const uint8_t fraction,
const uint16_t rtt,
const uint32_t extendedHighSeqNum,
const uint32_t j)
{
reportBlock = true;
fractionLost = fraction;
@ -136,7 +136,7 @@ RTCPReceiveInformation::~RTCPReceiveInformation() {
// Increase size of TMMBRSet if needed, and also take care of
// the _tmmbrSetTimeouts vector.
void RTCPReceiveInformation::VerifyAndAllocateTMMBRSet(
const WebRtc_UWord32 minimumSize) {
const uint32_t minimumSize) {
if (minimumSize > TmmbrSet.sizeOfSet()) {
TmmbrSet.VerifyAndAllocateSetKeepingData(minimumSize);
// make sure that our buffers are big enough
@ -145,11 +145,11 @@ void RTCPReceiveInformation::VerifyAndAllocateTMMBRSet(
}
void RTCPReceiveInformation::InsertTMMBRItem(
const WebRtc_UWord32 senderSSRC,
const uint32_t senderSSRC,
const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem,
const WebRtc_Word64 currentTimeMS) {
const int64_t currentTimeMS) {
// serach to see if we have it in our list
for (WebRtc_UWord32 i = 0; i < TmmbrSet.lengthOfSet(); i++) {
for (uint32_t i = 0; i < TmmbrSet.lengthOfSet(); i++) {
if (TmmbrSet.Ssrc(i) == senderSSRC) {
// we already have this SSRC in our list update it
TmmbrSet.SetEntry(i,
@ -167,11 +167,11 @@ void RTCPReceiveInformation::InsertTMMBRItem(
_tmmbrSetTimeouts.push_back(currentTimeMS);
}
WebRtc_Word32 RTCPReceiveInformation::GetTMMBRSet(
const WebRtc_UWord32 sourceIdx,
const WebRtc_UWord32 targetIdx,
int32_t RTCPReceiveInformation::GetTMMBRSet(
const uint32_t sourceIdx,
const uint32_t targetIdx,
TMMBRSet* candidateSet,
const WebRtc_Word64 currentTimeMS) {
const int64_t currentTimeMS) {
if (sourceIdx >= TmmbrSet.lengthOfSet()) {
return -1;
}
@ -194,7 +194,7 @@ WebRtc_Word32 RTCPReceiveInformation::GetTMMBRSet(
}
void RTCPReceiveInformation::VerifyAndAllocateBoundingSet(
const WebRtc_UWord32 minimumSize) {
const uint32_t minimumSize) {
TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize);
}
} // namespace webrtc

View File

@ -32,38 +32,38 @@ public:
void AddVoIPMetric(const RTCPVoIPMetric* metric);
void AddApplicationData(const WebRtc_UWord8* data,
const WebRtc_UWord16 size);
void AddApplicationData(const uint8_t* data,
const uint16_t size);
void AddNACKPacket(const WebRtc_UWord16 packetID);
void AddNACKPacket(const uint16_t packetID);
void ResetNACKPacketIdArray();
void AddReportInfo(const WebRtc_UWord8 fractionLost,
const WebRtc_UWord16 rtt,
const WebRtc_UWord32 extendedHighSeqNum,
const WebRtc_UWord32 jitter);
void AddReportInfo(const uint8_t fractionLost,
const uint16_t rtt,
const uint32_t extendedHighSeqNum,
const uint32_t jitter);
WebRtc_UWord32 rtcpPacketTypeFlags; // RTCPPacketTypeFlags bit field
WebRtc_UWord32 remoteSSRC;
uint32_t rtcpPacketTypeFlags; // RTCPPacketTypeFlags bit field
uint32_t remoteSSRC;
std::list<uint16_t> nackSequenceNumbers;
WebRtc_UWord8 applicationSubType;
WebRtc_UWord32 applicationName;
WebRtc_UWord8* applicationData;
WebRtc_UWord16 applicationLength;
uint8_t applicationSubType;
uint32_t applicationName;
uint8_t* applicationData;
uint16_t applicationLength;
bool reportBlock;
WebRtc_UWord8 fractionLost;
WebRtc_UWord16 roundTripTime;
WebRtc_UWord32 lastReceivedExtendedHighSeqNum;
WebRtc_UWord32 jitter;
uint8_t fractionLost;
uint16_t roundTripTime;
uint32_t lastReceivedExtendedHighSeqNum;
uint32_t jitter;
WebRtc_UWord32 interArrivalJitter;
uint32_t interArrivalJitter;
WebRtc_UWord8 sliPictureId;
WebRtc_UWord64 rpsiPictureId;
WebRtc_UWord32 receiverEstimatedMaxBitrate;
uint8_t sliPictureId;
uint64_t rpsiPictureId;
uint32_t receiverEstimatedMaxBitrate;
uint32_t ntp_secs;
uint32_t ntp_frac;
@ -84,14 +84,14 @@ public:
// Statistics
RTCPReportBlock remoteReceiveBlock;
WebRtc_UWord32 remoteMaxJitter;
uint32_t remoteMaxJitter;
// RTT
WebRtc_UWord16 RTT;
WebRtc_UWord16 minRTT;
WebRtc_UWord16 maxRTT;
WebRtc_UWord16 avgRTT;
WebRtc_UWord32 numAverageCalcs;
uint16_t RTT;
uint16_t minRTT;
uint16_t maxRTT;
uint16_t avgRTT;
uint32_t numAverageCalcs;
};
class RTCPReceiveInformation
@ -100,24 +100,24 @@ public:
RTCPReceiveInformation();
~RTCPReceiveInformation();
void VerifyAndAllocateBoundingSet(const WebRtc_UWord32 minimumSize);
void VerifyAndAllocateTMMBRSet(const WebRtc_UWord32 minimumSize);
void VerifyAndAllocateBoundingSet(const uint32_t minimumSize);
void VerifyAndAllocateTMMBRSet(const uint32_t minimumSize);
void InsertTMMBRItem(const WebRtc_UWord32 senderSSRC,
void InsertTMMBRItem(const uint32_t senderSSRC,
const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem,
const WebRtc_Word64 currentTimeMS);
const int64_t currentTimeMS);
// get
WebRtc_Word32 GetTMMBRSet(const WebRtc_UWord32 sourceIdx,
const WebRtc_UWord32 targetIdx,
TMMBRSet* candidateSet,
const WebRtc_Word64 currentTimeMS);
int32_t GetTMMBRSet(const uint32_t sourceIdx,
const uint32_t targetIdx,
TMMBRSet* candidateSet,
const int64_t currentTimeMS);
WebRtc_Word64 lastTimeReceived;
int64_t lastTimeReceived;
// FIR
WebRtc_Word32 lastFIRSequenceNumber;
WebRtc_Word64 lastFIRRequest;
int32_t lastFIRSequenceNumber;
int64_t lastFIRRequest;
// TMMBN
TMMBRSet TmmbnBoundingSet;
@ -127,7 +127,7 @@ public:
bool readyForDelete;
private:
std::vector<WebRtc_Word64> _tmmbrSetTimeouts;
std::vector<int64_t> _tmmbrSetTimeouts;
};
} // end namespace RTCPHelp

View File

@ -39,25 +39,25 @@ class PacketBuilder {
}
void Add8(WebRtc_UWord8 byte) {
void Add8(uint8_t byte) {
EXPECT_LT(pos_, kMaxPacketSize - 1);
buffer_[pos_] = byte;
++ pos_;
}
void Add16(WebRtc_UWord16 word) {
void Add16(uint16_t word) {
Add8(word >> 8);
Add8(word & 0xFF);
}
void Add32(WebRtc_UWord32 word) {
void Add32(uint32_t word) {
Add8(word >> 24);
Add8((word >> 16) & 0xFF);
Add8((word >> 8) & 0xFF);
Add8(word & 0xFF);
}
void Add64(WebRtc_UWord32 upper_half, WebRtc_UWord32 lower_half) {
void Add64(uint32_t upper_half, uint32_t lower_half) {
Add32(upper_half);
Add32(lower_half);
}
@ -76,14 +76,14 @@ class PacketBuilder {
void AddTmmbrBandwidth(int mantissa, int exponent, int overhead) {
// 6 bits exponent, 17 bits mantissa, 9 bits overhead.
WebRtc_UWord32 word = 0;
uint32_t word = 0;
word |= (exponent << 26);
word |= ((mantissa & 0x1FFFF) << 9);
word |= (overhead & 0x1FF);
Add32(word);
}
void AddSrPacket(WebRtc_UWord32 sender_ssrc) {
void AddSrPacket(uint32_t sender_ssrc) {
AddRtcpHeader(200, 0);
Add32(sender_ssrc);
Add64(0x10203, 0x4050607); // NTP timestamp
@ -92,8 +92,8 @@ class PacketBuilder {
Add32(0); // Sender's octet count
}
void AddRrPacket(WebRtc_UWord32 sender_ssrc, WebRtc_UWord32 rtp_ssrc,
WebRtc_UWord32 extended_max) {
void AddRrPacket(uint32_t sender_ssrc, uint32_t rtp_ssrc,
uint32_t extended_max) {
AddRtcpHeader(201, 1);
Add32(sender_ssrc);
Add32(rtp_ssrc);
@ -104,7 +104,7 @@ class PacketBuilder {
Add32(0); // Delay since last SR.
}
const WebRtc_UWord8* packet() {
const uint8_t* packet() {
PatchLengthField();
return buffer_;
}
@ -131,7 +131,7 @@ class PacketBuilder {
// Where the length field of the current packet is.
// Note that 0 is not a legal value, so is used for "uninitialized".
int pos_of_len_;
WebRtc_UWord8 buffer_[kMaxPacketSize];
uint8_t buffer_[kMaxPacketSize];
};
// This test transport verifies that no functions get called.
@ -155,8 +155,8 @@ class TestTransport : public Transport,
return 0;
}
virtual int OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize,
virtual int OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize,
const WebRtcRTPHeader* rtpHeader) {
ADD_FAILURE();
return 0;
@ -196,8 +196,8 @@ class RtcpReceiverTest : public ::testing::Test {
// Injects an RTCP packet into the receiver.
// Returns 0 for OK, non-0 for failure.
int InjectRtcpPacket(const WebRtc_UWord8* packet,
WebRtc_UWord16 packet_len) {
int InjectRtcpPacket(const uint8_t* packet,
uint16_t packet_len) {
RTCPUtility::RTCPParserV2 rtcpParser(packet,
packet_len,
true); // Allow non-compound RTCP
@ -243,13 +243,13 @@ class RtcpReceiverTest : public ::testing::Test {
TEST_F(RtcpReceiverTest, BrokenPacketIsIgnored) {
const WebRtc_UWord8 bad_packet[] = {0, 0, 0, 0};
const uint8_t bad_packet[] = {0, 0, 0, 0};
EXPECT_EQ(0, InjectRtcpPacket(bad_packet, sizeof(bad_packet)));
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags);
}
TEST_F(RtcpReceiverTest, InjectSrPacket) {
const WebRtc_UWord32 kSenderSsrc = 0x10203;
const uint32_t kSenderSsrc = 0x10203;
PacketBuilder p;
p.AddSrPacket(kSenderSsrc);
EXPECT_EQ(0, InjectRtcpPacket(p.packet(), p.length()));
@ -326,9 +326,9 @@ TEST_F(RtcpReceiverTest, TmmbrReceivedWithNoIncomingPacket) {
}
TEST_F(RtcpReceiverTest, TmmbrPacketAccepted) {
const WebRtc_UWord32 kMediaFlowSsrc = 0x2040608;
const WebRtc_UWord32 kSenderSsrc = 0x10203;
const WebRtc_UWord32 kMediaRecipientSsrc = 0x101;
const uint32_t kMediaFlowSsrc = 0x2040608;
const uint32_t kSenderSsrc = 0x10203;
const uint32_t kMediaRecipientSsrc = 0x101;
rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above.
PacketBuilder p;
@ -350,10 +350,10 @@ TEST_F(RtcpReceiverTest, TmmbrPacketAccepted) {
}
TEST_F(RtcpReceiverTest, TmmbrPacketNotForUsIgnored) {
const WebRtc_UWord32 kMediaFlowSsrc = 0x2040608;
const WebRtc_UWord32 kSenderSsrc = 0x10203;
const WebRtc_UWord32 kMediaRecipientSsrc = 0x101;
const WebRtc_UWord32 kOtherMediaFlowSsrc = 0x9999;
const uint32_t kMediaFlowSsrc = 0x2040608;
const uint32_t kSenderSsrc = 0x10203;
const uint32_t kMediaRecipientSsrc = 0x101;
const uint32_t kOtherMediaFlowSsrc = 0x9999;
PacketBuilder p;
p.AddSrPacket(kSenderSsrc);
@ -370,9 +370,9 @@ TEST_F(RtcpReceiverTest, TmmbrPacketNotForUsIgnored) {
}
TEST_F(RtcpReceiverTest, TmmbrPacketZeroRateIgnored) {
const WebRtc_UWord32 kMediaFlowSsrc = 0x2040608;
const WebRtc_UWord32 kSenderSsrc = 0x10203;
const WebRtc_UWord32 kMediaRecipientSsrc = 0x101;
const uint32_t kMediaFlowSsrc = 0x2040608;
const uint32_t kSenderSsrc = 0x10203;
const uint32_t kMediaRecipientSsrc = 0x101;
rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above.
PacketBuilder p;
@ -389,14 +389,14 @@ TEST_F(RtcpReceiverTest, TmmbrPacketZeroRateIgnored) {
}
TEST_F(RtcpReceiverTest, TmmbrThreeConstraintsTimeOut) {
const WebRtc_UWord32 kMediaFlowSsrc = 0x2040608;
const WebRtc_UWord32 kSenderSsrc = 0x10203;
const WebRtc_UWord32 kMediaRecipientSsrc = 0x101;
const uint32_t kMediaFlowSsrc = 0x2040608;
const uint32_t kSenderSsrc = 0x10203;
const uint32_t kMediaRecipientSsrc = 0x101;
rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above.
// Inject 3 packets "from" kMediaRecipientSsrc, Ssrc+1, Ssrc+2.
// The times of arrival are starttime + 0, starttime + 5 and starttime + 10.
for (WebRtc_UWord32 ssrc = kMediaRecipientSsrc;
for (uint32_t ssrc = kMediaRecipientSsrc;
ssrc < kMediaRecipientSsrc+3; ++ssrc) {
PacketBuilder p;
p.AddSrPacket(kSenderSsrc);

File diff suppressed because it is too large Load Diff

View File

@ -32,176 +32,173 @@ class NACKStringBuilder
{
public:
NACKStringBuilder();
void PushNACK(WebRtc_UWord16 nack);
void PushNACK(uint16_t nack);
std::string GetResult();
private:
std::ostringstream _stream;
int _count;
WebRtc_UWord16 _prevNack;
uint16_t _prevNack;
bool _consecutive;
};
class RTCPSender
{
public:
RTCPSender(const WebRtc_Word32 id, const bool audio,
RTCPSender(const int32_t id, const bool audio,
Clock* clock, ModuleRtpRtcpImpl* owner);
virtual ~RTCPSender();
void ChangeUniqueId(const WebRtc_Word32 id);
void ChangeUniqueId(const int32_t id);
WebRtc_Word32 Init();
int32_t Init();
WebRtc_Word32 RegisterSendTransport(Transport* outgoingTransport);
int32_t RegisterSendTransport(Transport* outgoingTransport);
RTCPMethod Status() const;
WebRtc_Word32 SetRTCPStatus(const RTCPMethod method);
int32_t SetRTCPStatus(const RTCPMethod method);
bool Sending() const;
WebRtc_Word32 SetSendingStatus(const bool enabled); // combine the functions
int32_t SetSendingStatus(const bool enabled); // combine the functions
WebRtc_Word32 SetNackStatus(const bool enable);
int32_t SetNackStatus(const bool enable);
void SetStartTimestamp(uint32_t start_timestamp);
void SetLastRtpTime(uint32_t rtp_timestamp,
int64_t capture_time_ms);
void SetSSRC( const WebRtc_UWord32 ssrc);
void SetSSRC( const uint32_t ssrc);
WebRtc_Word32 SetRemoteSSRC( const WebRtc_UWord32 ssrc);
int32_t SetRemoteSSRC( const uint32_t ssrc);
WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS);
int32_t SetCameraDelay(const int32_t delayMS);
WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]);
WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]);
int32_t CNAME(char cName[RTCP_CNAME_SIZE]);
int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]);
WebRtc_Word32 AddMixedCNAME(const WebRtc_UWord32 SSRC,
const char cName[RTCP_CNAME_SIZE]);
int32_t AddMixedCNAME(const uint32_t SSRC,
const char cName[RTCP_CNAME_SIZE]);
WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC);
int32_t RemoveMixedCNAME(const uint32_t SSRC);
WebRtc_UWord32 SendTimeOfSendReport(const WebRtc_UWord32 sendReport);
uint32_t SendTimeOfSendReport(const uint32_t sendReport);
bool TimeToSendRTCPReport(const bool sendKeyframeBeforeRTP = false) const;
WebRtc_UWord32 LastSendReport(WebRtc_UWord32& lastRTCPTime);
uint32_t LastSendReport(uint32_t& lastRTCPTime);
WebRtc_Word32 SendRTCP(const WebRtc_UWord32 rtcpPacketTypeFlags,
const WebRtc_Word32 nackSize = 0,
const WebRtc_UWord16* nackList = 0,
const bool repeat = false,
const WebRtc_UWord64 pictureID = 0);
int32_t SendRTCP(const uint32_t rtcpPacketTypeFlags,
const int32_t nackSize = 0,
const uint16_t* nackList = 0,
const bool repeat = false,
const uint64_t pictureID = 0);
WebRtc_Word32 AddReportBlock(const WebRtc_UWord32 SSRC,
const RTCPReportBlock* receiveBlock);
int32_t AddReportBlock(const uint32_t SSRC,
const RTCPReportBlock* receiveBlock);
WebRtc_Word32 RemoveReportBlock(const WebRtc_UWord32 SSRC);
int32_t RemoveReportBlock(const uint32_t SSRC);
/*
* REMB
*/
bool REMB() const;
WebRtc_Word32 SetREMBStatus(const bool enable);
int32_t SetREMBStatus(const bool enable);
WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
const WebRtc_UWord8 numberOfSSRC,
const WebRtc_UWord32* SSRC);
int32_t SetREMBData(const uint32_t bitrate,
const uint8_t numberOfSSRC,
const uint32_t* SSRC);
/*
* TMMBR
*/
bool TMMBR() const;
WebRtc_Word32 SetTMMBRStatus(const bool enable);
int32_t SetTMMBRStatus(const bool enable);
WebRtc_Word32 SetTMMBN(const TMMBRSet* boundingSet,
const WebRtc_UWord32 maxBitrateKbit);
int32_t SetTMMBN(const TMMBRSet* boundingSet,
const uint32_t maxBitrateKbit);
/*
* Extended jitter report
*/
bool IJ() const;
WebRtc_Word32 SetIJStatus(const bool enable);
int32_t SetIJStatus(const bool enable);
/*
*
*/
WebRtc_Word32 SetApplicationSpecificData(const WebRtc_UWord8 subType,
const WebRtc_UWord32 name,
const WebRtc_UWord8* data,
const WebRtc_UWord16 length);
int32_t SetApplicationSpecificData(const uint8_t subType,
const uint32_t name,
const uint8_t* data,
const uint16_t length);
WebRtc_Word32 SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
WebRtc_Word32 SetCSRCs(const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
const WebRtc_UWord8 arrLength);
int32_t SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize],
const uint8_t arrLength);
WebRtc_Word32 SetCSRCStatus(const bool include);
int32_t SetCSRCStatus(const bool include);
void SetTargetBitrate(unsigned int target_bitrate);
private:
WebRtc_Word32 SendToNetwork(const WebRtc_UWord8* dataBuffer,
const WebRtc_UWord16 length);
int32_t SendToNetwork(const uint8_t* dataBuffer, const uint16_t length);
void UpdatePacketRate();
WebRtc_Word32 AddReportBlocks(WebRtc_UWord8* rtcpbuffer,
WebRtc_UWord32& pos,
WebRtc_UWord8& numberOfReportBlocks,
const RTCPReportBlock* received,
const WebRtc_UWord32 NTPsec,
const WebRtc_UWord32 NTPfrac);
int32_t AddReportBlocks(uint8_t* rtcpbuffer,
uint32_t& pos,
uint8_t& numberOfReportBlocks,
const RTCPReportBlock* received,
const uint32_t NTPsec,
const uint32_t NTPfrac);
WebRtc_Word32 BuildSR(WebRtc_UWord8* rtcpbuffer,
WebRtc_UWord32& pos,
const WebRtc_UWord32 NTPsec,
const WebRtc_UWord32 NTPfrac,
const RTCPReportBlock* received = NULL);
int32_t BuildSR(uint8_t* rtcpbuffer,
uint32_t& pos,
const uint32_t NTPsec,
const uint32_t NTPfrac,
const RTCPReportBlock* received = NULL);
WebRtc_Word32 BuildRR(WebRtc_UWord8* rtcpbuffer,
WebRtc_UWord32& pos,
const WebRtc_UWord32 NTPsec,
const WebRtc_UWord32 NTPfrac,
const RTCPReportBlock* received = NULL);
int32_t BuildRR(uint8_t* rtcpbuffer,
uint32_t& pos,
const uint32_t NTPsec,
const uint32_t NTPfrac,
const RTCPReportBlock* received = NULL);
WebRtc_Word32 BuildExtendedJitterReport(
WebRtc_UWord8* rtcpbuffer,
WebRtc_UWord32& pos,
const WebRtc_UWord32 jitterTransmissionTimeOffset);
int32_t BuildExtendedJitterReport(
uint8_t* rtcpbuffer,
uint32_t& pos,
const uint32_t jitterTransmissionTimeOffset);
WebRtc_Word32 BuildSDEC(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos);
WebRtc_Word32 BuildPLI(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos);
WebRtc_Word32 BuildREMB(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos);
WebRtc_Word32 BuildTMMBR(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos);
WebRtc_Word32 BuildTMMBN(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos);
WebRtc_Word32 BuildAPP(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos);
WebRtc_Word32 BuildVoIPMetric(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos);
WebRtc_Word32 BuildBYE(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos);
WebRtc_Word32 BuildFIR(WebRtc_UWord8* rtcpbuffer,
WebRtc_UWord32& pos,
bool repeat);
WebRtc_Word32 BuildSLI(WebRtc_UWord8* rtcpbuffer,
WebRtc_UWord32& pos,
const WebRtc_UWord8 pictureID);
WebRtc_Word32 BuildRPSI(WebRtc_UWord8* rtcpbuffer,
WebRtc_UWord32& pos,
const WebRtc_UWord64 pictureID,
const WebRtc_UWord8 payloadType);
int32_t BuildSDEC(uint8_t* rtcpbuffer, uint32_t& pos);
int32_t BuildPLI(uint8_t* rtcpbuffer, uint32_t& pos);
int32_t BuildREMB(uint8_t* rtcpbuffer, uint32_t& pos);
int32_t BuildTMMBR(uint8_t* rtcpbuffer, uint32_t& pos);
int32_t BuildTMMBN(uint8_t* rtcpbuffer, uint32_t& pos);
int32_t BuildAPP(uint8_t* rtcpbuffer, uint32_t& pos);
int32_t BuildVoIPMetric(uint8_t* rtcpbuffer, uint32_t& pos);
int32_t BuildBYE(uint8_t* rtcpbuffer, uint32_t& pos);
int32_t BuildFIR(uint8_t* rtcpbuffer, uint32_t& pos, bool repeat);
int32_t BuildSLI(uint8_t* rtcpbuffer,
uint32_t& pos,
const uint8_t pictureID);
int32_t BuildRPSI(uint8_t* rtcpbuffer,
uint32_t& pos,
const uint64_t pictureID,
const uint8_t payloadType);
WebRtc_Word32 BuildNACK(WebRtc_UWord8* rtcpbuffer,
WebRtc_UWord32& pos,
const WebRtc_Word32 nackSize,
const WebRtc_UWord16* nackList,
int32_t BuildNACK(uint8_t* rtcpbuffer,
uint32_t& pos,
const int32_t nackSize,
const uint16_t* nackList,
std::string* nackString);
private:
WebRtc_Word32 _id;
int32_t _id;
const bool _audio;
Clock* _clock;
RTCPMethod _method;
@ -220,57 +217,57 @@ private:
bool _TMMBR;
bool _IJ;
WebRtc_Word64 _nextTimeToSendRTCP;
int64_t _nextTimeToSendRTCP;
uint32_t start_timestamp_;
uint32_t last_rtp_timestamp_;
int64_t last_frame_capture_time_ms_;
WebRtc_UWord32 _SSRC;
WebRtc_UWord32 _remoteSSRC; // SSRC that we receive on our RTP channel
uint32_t _SSRC;
uint32_t _remoteSSRC; // SSRC that we receive on our RTP channel
char _CNAME[RTCP_CNAME_SIZE];
std::map<WebRtc_UWord32, RTCPReportBlock*> _reportBlocks;
std::map<WebRtc_UWord32, RTCPUtility::RTCPCnameInformation*> _csrcCNAMEs;
std::map<uint32_t, RTCPReportBlock*> _reportBlocks;
std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> _csrcCNAMEs;
WebRtc_Word32 _cameraDelayMS;
int32_t _cameraDelayMS;
// Sent
WebRtc_UWord32 _lastSendReport[RTCP_NUMBER_OF_SR]; // allow packet loss and RTT above 1 sec
WebRtc_UWord32 _lastRTCPTime[RTCP_NUMBER_OF_SR];
uint32_t _lastSendReport[RTCP_NUMBER_OF_SR]; // allow packet loss and RTT above 1 sec
uint32_t _lastRTCPTime[RTCP_NUMBER_OF_SR];
// send CSRCs
WebRtc_UWord8 _CSRCs;
WebRtc_UWord32 _CSRC[kRtpCsrcSize];
uint8_t _CSRCs;
uint32_t _CSRC[kRtpCsrcSize];
bool _includeCSRCs;
// Full intra request
WebRtc_UWord8 _sequenceNumberFIR;
uint8_t _sequenceNumberFIR;
// REMB
WebRtc_UWord8 _lengthRembSSRC;
WebRtc_UWord8 _sizeRembSSRC;
WebRtc_UWord32* _rembSSRC;
WebRtc_UWord32 _rembBitrate;
uint8_t _lengthRembSSRC;
uint8_t _sizeRembSSRC;
uint32_t* _rembSSRC;
uint32_t _rembBitrate;
TMMBRHelp _tmmbrHelp;
WebRtc_UWord32 _tmmbr_Send;
WebRtc_UWord32 _packetOH_Send;
uint32_t _tmmbr_Send;
uint32_t _packetOH_Send;
// APP
bool _appSend;
WebRtc_UWord8 _appSubType;
WebRtc_UWord32 _appName;
WebRtc_UWord8* _appData;
WebRtc_UWord16 _appLength;
uint8_t _appSubType;
uint32_t _appName;
uint8_t* _appData;
uint16_t _appLength;
// XR VoIP metric
bool _xrSendVoIPMetric;
RTCPVoIPMetric _xrVoIPMetric;
// Counters
WebRtc_UWord32 _nackCount;
WebRtc_UWord32 _pliCount;
WebRtc_UWord32 _fullIntraRequestCount;
uint32_t _nackCount;
uint32_t _pliCount;
uint32_t _fullIntraRequestCount;
};
} // namespace webrtc

View File

@ -181,10 +181,10 @@ TEST(NACKStringBuilderTest, TestCase13) {
EXPECT_EQ(std::string("5-6,9"), builder.GetResult());
}
void CreateRtpPacket(const bool marker_bit, const WebRtc_UWord8 payload,
const WebRtc_UWord16 seq_num, const WebRtc_UWord32 timestamp,
const WebRtc_UWord32 ssrc, WebRtc_UWord8* array,
WebRtc_UWord16* cur_pos) {
void CreateRtpPacket(const bool marker_bit, const uint8_t payload,
const uint16_t seq_num, const uint32_t timestamp,
const uint32_t ssrc, uint8_t* array,
uint16_t* cur_pos) {
ASSERT_TRUE(payload <= 127);
array[(*cur_pos)++] = 0x80;
array[(*cur_pos)++] = payload | (marker_bit ? 0x80 : 0);
@ -228,8 +228,8 @@ class TestTransport : public Transport,
}
virtual int SendRTCPPacket(int /*ch*/, const void *packet, int packet_len) {
RTCPUtility::RTCPParserV2 rtcpParser((WebRtc_UWord8*)packet,
(WebRtc_Word32)packet_len,
RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet,
(int32_t)packet_len,
true); // Allow non-compound RTCP
EXPECT_TRUE(rtcpParser.IsValid());
@ -261,8 +261,8 @@ class TestTransport : public Transport,
return packet_len;
}
virtual int OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize,
virtual int OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize,
const WebRtcRTPHeader* rtpHeader) {
return 0;
}
@ -339,11 +339,11 @@ TEST_F(RtcpSenderTest, IJStatus) {
TEST_F(RtcpSenderTest, TestCompound) {
const bool marker_bit = false;
const WebRtc_UWord8 payload = 100;
const WebRtc_UWord16 seq_num = 11111;
const WebRtc_UWord32 timestamp = 1234567;
const WebRtc_UWord32 ssrc = 0x11111111;
WebRtc_UWord16 packet_length = 0;
const uint8_t payload = 100;
const uint16_t seq_num = 11111;
const uint32_t timestamp = 1234567;
const uint32_t ssrc = 0x11111111;
uint16_t packet_length = 0;
CreateRtpPacket(marker_bit, payload, seq_num, timestamp, ssrc, packet_,
&packet_length);
EXPECT_EQ(25, packet_length);
@ -404,7 +404,7 @@ TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndValid) {
EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound));
TMMBRSet bounding_set;
bounding_set.VerifyAndAllocateSet(1);
const WebRtc_UWord32 kSourceSsrc = 12345;
const uint32_t kSourceSsrc = 12345;
bounding_set.AddEntry(32768, 0, kSourceSsrc);
EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set, 3));

View File

@ -17,7 +17,7 @@
namespace webrtc {
// RTCPParserV2 : currently read only
RTCPUtility::RTCPParserV2::RTCPParserV2(const WebRtc_UWord8* rtcpData,
RTCPUtility::RTCPParserV2::RTCPParserV2(const uint8_t* rtcpData,
size_t rtcpDataLength,
bool rtcpReducedSizeEnable)
: _ptrRTCPDataBegin(rtcpData),
@ -411,8 +411,8 @@ RTCPUtility::RTCPParserV2::EndCurrentBlock()
}
bool
RTCPUtility::RTCPParseCommonHeader( const WebRtc_UWord8* ptrDataBegin,
const WebRtc_UWord8* ptrDataEnd,
RTCPUtility::RTCPParseCommonHeader( const uint8_t* ptrDataBegin,
const uint8_t* ptrDataEnd,
RTCPCommonHeader& parsedHeader)
{
if (!ptrDataBegin || !ptrDataEnd)
@ -689,7 +689,7 @@ RTCPUtility::RTCPParserV2::ParseSDESChunk()
return false;
}
WebRtc_UWord32 SSRC = *_ptrRTCPData++ << 24;
uint32_t SSRC = *_ptrRTCPData++ << 24;
SSRC += *_ptrRTCPData++ << 16;
SSRC += *_ptrRTCPData++ << 8;
SSRC += *_ptrRTCPData++;
@ -717,7 +717,7 @@ RTCPUtility::RTCPParserV2::ParseSDESItem()
size_t itemOctetsRead = 0;
while (_ptrRTCPData < _ptrRTCPBlockEnd)
{
const WebRtc_UWord8 tag = *_ptrRTCPData++;
const uint8_t tag = *_ptrRTCPData++;
++itemOctetsRead;
if (tag == 0)
@ -732,7 +732,7 @@ RTCPUtility::RTCPParserV2::ParseSDESItem()
if (_ptrRTCPData < _ptrRTCPBlockEnd)
{
const WebRtc_UWord8 len = *_ptrRTCPData++;
const uint8_t len = *_ptrRTCPData++;
++itemOctetsRead;
if (tag == 1)
@ -747,10 +747,10 @@ RTCPUtility::RTCPParserV2::ParseSDESItem()
EndCurrentBlock();
return false;
}
WebRtc_UWord8 i = 0;
uint8_t i = 0;
for (; i < len; ++i)
{
const WebRtc_UWord8 c = _ptrRTCPData[i];
const uint8_t c = _ptrRTCPData[i];
if ((c < ' ') || (c > '{') || (c == '%') || (c == '\\'))
{
// Illegal char
@ -870,10 +870,10 @@ RTCPUtility::RTCPParserV2::ParseXRItem()
return false;
}
WebRtc_UWord8 blockType = *_ptrRTCPData++;
WebRtc_UWord8 typeSpecific = *_ptrRTCPData++;
uint8_t blockType = *_ptrRTCPData++;
uint8_t typeSpecific = *_ptrRTCPData++;
WebRtc_UWord16 blockLength = *_ptrRTCPData++ << 8;
uint16_t blockLength = *_ptrRTCPData++ << 8;
blockLength = *_ptrRTCPData++;
if(blockType == 7 && typeSpecific == 0)
@ -985,12 +985,12 @@ RTCPUtility::RTCPParserV2::ParseFBCommon(const RTCPCommonHeader& header)
_ptrRTCPData += 4; // Skip RTCP header
WebRtc_UWord32 senderSSRC = *_ptrRTCPData++ << 24;
uint32_t senderSSRC = *_ptrRTCPData++ << 24;
senderSSRC += *_ptrRTCPData++ << 16;
senderSSRC += *_ptrRTCPData++ << 8;
senderSSRC += *_ptrRTCPData++;
WebRtc_UWord32 mediaSSRC = *_ptrRTCPData++ << 24;
uint32_t mediaSSRC = *_ptrRTCPData++ << 24;
mediaSSRC += *_ptrRTCPData++ << 16;
mediaSSRC += *_ptrRTCPData++ << 8;
mediaSSRC += *_ptrRTCPData++;
@ -1149,12 +1149,12 @@ RTCPUtility::RTCPParserV2::ParseRPSIItem()
_packetType = kRtcpPsfbRpsiCode;
WebRtc_UWord8 paddingBits = *_ptrRTCPData++;
uint8_t paddingBits = *_ptrRTCPData++;
_packet.RPSI.PayloadType = *_ptrRTCPData++;
memcpy(_packet.RPSI.NativeBitString, _ptrRTCPData, length-2);
_packet.RPSI.NumberOfValidBits = WebRtc_UWord16(length-2)*8 - paddingBits;
_packet.RPSI.NumberOfValidBits = uint16_t(length-2)*8 - paddingBits;
return true;
}
@ -1243,9 +1243,9 @@ RTCPUtility::RTCPParserV2::ParsePsfbREMBItem()
}
_packet.REMBItem.NumberOfSSRCs = *_ptrRTCPData++;
const WebRtc_UWord8 brExp = (_ptrRTCPData[0] >> 2) & 0x3F;
const uint8_t brExp = (_ptrRTCPData[0] >> 2) & 0x3F;
WebRtc_UWord32 brMantissa = (_ptrRTCPData[0] & 0x03) << 16;
uint32_t brMantissa = (_ptrRTCPData[0] & 0x03) << 16;
brMantissa += (_ptrRTCPData[1] << 8);
brMantissa += (_ptrRTCPData[2]);
@ -1295,13 +1295,13 @@ RTCPUtility::RTCPParserV2::ParseTMMBRItem()
_packet.TMMBRItem.SSRC += *_ptrRTCPData++ << 8;
_packet.TMMBRItem.SSRC += *_ptrRTCPData++;
WebRtc_UWord8 mxtbrExp = (_ptrRTCPData[0] >> 2) & 0x3F;
uint8_t mxtbrExp = (_ptrRTCPData[0] >> 2) & 0x3F;
WebRtc_UWord32 mxtbrMantissa = (_ptrRTCPData[0] & 0x03) << 15;
uint32_t mxtbrMantissa = (_ptrRTCPData[0] & 0x03) << 15;
mxtbrMantissa += (_ptrRTCPData[1] << 7);
mxtbrMantissa += (_ptrRTCPData[2] >> 1) & 0x7F;
WebRtc_UWord32 measuredOH = (_ptrRTCPData[2] & 0x01) << 8;
uint32_t measuredOH = (_ptrRTCPData[2] & 0x01) << 8;
measuredOH += _ptrRTCPData[3];
_ptrRTCPData += 4; // Fwd read data
@ -1334,13 +1334,13 @@ RTCPUtility::RTCPParserV2::ParseTMMBNItem()
_packet.TMMBNItem.SSRC += *_ptrRTCPData++ << 8;
_packet.TMMBNItem.SSRC += *_ptrRTCPData++;
WebRtc_UWord8 mxtbrExp = (_ptrRTCPData[0] >> 2) & 0x3F;
uint8_t mxtbrExp = (_ptrRTCPData[0] >> 2) & 0x3F;
WebRtc_UWord32 mxtbrMantissa = (_ptrRTCPData[0] & 0x03) << 15;
uint32_t mxtbrMantissa = (_ptrRTCPData[0] & 0x03) << 15;
mxtbrMantissa += (_ptrRTCPData[1] << 7);
mxtbrMantissa += (_ptrRTCPData[2] >> 1) & 0x7F;
WebRtc_UWord32 measuredOH = (_ptrRTCPData[2] & 0x01) << 8;
uint32_t measuredOH = (_ptrRTCPData[2] & 0x01) << 8;
measuredOH += _ptrRTCPData[3];
_ptrRTCPData += 4; // Fwd read data
@ -1374,15 +1374,15 @@ RTCPUtility::RTCPParserV2::ParseSLIItem()
}
_packetType = kRtcpPsfbSliItemCode;
WebRtc_UWord32 buffer;
uint32_t buffer;
buffer = *_ptrRTCPData++ << 24;
buffer += *_ptrRTCPData++ << 16;
buffer += *_ptrRTCPData++ << 8;
buffer += *_ptrRTCPData++;
_packet.SLIItem.FirstMB = WebRtc_UWord16((buffer>>19) & 0x1fff);
_packet.SLIItem.NumberOfMB = WebRtc_UWord16((buffer>>6) & 0x1fff);
_packet.SLIItem.PictureId = WebRtc_UWord8(buffer & 0x3f);
_packet.SLIItem.FirstMB = uint16_t((buffer>>19) & 0x1fff);
_packet.SLIItem.NumberOfMB = uint16_t((buffer>>6) & 0x1fff);
_packet.SLIItem.PictureId = uint8_t(buffer & 0x3f);
return true;
}
@ -1427,12 +1427,12 @@ RTCPUtility::RTCPParserV2::ParseAPP( const RTCPCommonHeader& header)
_ptrRTCPData += 4; // Skip RTCP header
WebRtc_UWord32 senderSSRC = *_ptrRTCPData++ << 24;
uint32_t senderSSRC = *_ptrRTCPData++ << 24;
senderSSRC += *_ptrRTCPData++ << 16;
senderSSRC += *_ptrRTCPData++ << 8;
senderSSRC += *_ptrRTCPData++;
WebRtc_UWord32 name = *_ptrRTCPData++ << 24;
uint32_t name = *_ptrRTCPData++ << 24;
name += *_ptrRTCPData++ << 16;
name += *_ptrRTCPData++ << 8;
name += *_ptrRTCPData++;
@ -1469,13 +1469,13 @@ RTCPUtility::RTCPParserV2::ParseAPPItem()
}else
{
memcpy(_packet.APP.Data, _ptrRTCPData, length);
_packet.APP.Size = (WebRtc_UWord16)length;
_packet.APP.Size = (uint16_t)length;
_ptrRTCPData += length;
}
return true;
}
RTCPUtility::RTCPPacketIterator::RTCPPacketIterator(WebRtc_UWord8* rtcpData,
RTCPUtility::RTCPPacketIterator::RTCPPacketIterator(uint8_t* rtcpData,
size_t rtcpDataLength)
: _ptrBegin(rtcpData),
_ptrEnd(rtcpData + rtcpDataLength),

View File

@ -26,177 +26,177 @@ namespace RTCPUtility {
};
struct RTCPPacketRR
{
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord8 NumberOfReportBlocks;
uint32_t SenderSSRC;
uint8_t NumberOfReportBlocks;
};
struct RTCPPacketSR
{
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord8 NumberOfReportBlocks;
uint32_t SenderSSRC;
uint8_t NumberOfReportBlocks;
// sender info
WebRtc_UWord32 NTPMostSignificant;
WebRtc_UWord32 NTPLeastSignificant;
WebRtc_UWord32 RTPTimestamp;
WebRtc_UWord32 SenderPacketCount;
WebRtc_UWord32 SenderOctetCount;
uint32_t NTPMostSignificant;
uint32_t NTPLeastSignificant;
uint32_t RTPTimestamp;
uint32_t SenderPacketCount;
uint32_t SenderOctetCount;
};
struct RTCPPacketReportBlockItem
{
// report block
WebRtc_UWord32 SSRC;
WebRtc_UWord8 FractionLost;
WebRtc_UWord32 CumulativeNumOfPacketsLost;
WebRtc_UWord32 ExtendedHighestSequenceNumber;
WebRtc_UWord32 Jitter;
WebRtc_UWord32 LastSR;
WebRtc_UWord32 DelayLastSR;
uint32_t SSRC;
uint8_t FractionLost;
uint32_t CumulativeNumOfPacketsLost;
uint32_t ExtendedHighestSequenceNumber;
uint32_t Jitter;
uint32_t LastSR;
uint32_t DelayLastSR;
};
struct RTCPPacketSDESCName
{
// RFC3550
WebRtc_UWord32 SenderSSRC;
uint32_t SenderSSRC;
char CName[RTCP_CNAME_SIZE];
};
struct RTCPPacketExtendedJitterReportItem
{
// RFC 5450
WebRtc_UWord32 Jitter;
uint32_t Jitter;
};
struct RTCPPacketBYE
{
WebRtc_UWord32 SenderSSRC;
uint32_t SenderSSRC;
};
struct RTCPPacketXR
{
// RFC 3611
WebRtc_UWord32 OriginatorSSRC;
uint32_t OriginatorSSRC;
};
struct RTCPPacketXRVOIPMetricItem
{
// RFC 3611 4.7
WebRtc_UWord32 SSRC;
WebRtc_UWord8 lossRate;
WebRtc_UWord8 discardRate;
WebRtc_UWord8 burstDensity;
WebRtc_UWord8 gapDensity;
WebRtc_UWord16 burstDuration;
WebRtc_UWord16 gapDuration;
WebRtc_UWord16 roundTripDelay;
WebRtc_UWord16 endSystemDelay;
WebRtc_UWord8 signalLevel;
WebRtc_UWord8 noiseLevel;
WebRtc_UWord8 RERL;
WebRtc_UWord8 Gmin;
WebRtc_UWord8 Rfactor;
WebRtc_UWord8 extRfactor;
WebRtc_UWord8 MOSLQ;
WebRtc_UWord8 MOSCQ;
WebRtc_UWord8 RXconfig;
WebRtc_UWord16 JBnominal;
WebRtc_UWord16 JBmax;
WebRtc_UWord16 JBabsMax;
uint32_t SSRC;
uint8_t lossRate;
uint8_t discardRate;
uint8_t burstDensity;
uint8_t gapDensity;
uint16_t burstDuration;
uint16_t gapDuration;
uint16_t roundTripDelay;
uint16_t endSystemDelay;
uint8_t signalLevel;
uint8_t noiseLevel;
uint8_t RERL;
uint8_t Gmin;
uint8_t Rfactor;
uint8_t extRfactor;
uint8_t MOSLQ;
uint8_t MOSCQ;
uint8_t RXconfig;
uint16_t JBnominal;
uint16_t JBmax;
uint16_t JBabsMax;
};
struct RTCPPacketRTPFBNACK
{
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord32 MediaSSRC;
uint32_t SenderSSRC;
uint32_t MediaSSRC;
};
struct RTCPPacketRTPFBNACKItem
{
// RFC4585
WebRtc_UWord16 PacketID;
WebRtc_UWord16 BitMask;
uint16_t PacketID;
uint16_t BitMask;
};
struct RTCPPacketRTPFBTMMBR
{
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord32 MediaSSRC; // zero!
uint32_t SenderSSRC;
uint32_t MediaSSRC; // zero!
};
struct RTCPPacketRTPFBTMMBRItem
{
// RFC5104
WebRtc_UWord32 SSRC;
WebRtc_UWord32 MaxTotalMediaBitRate; // In Kbit/s
WebRtc_UWord32 MeasuredOverhead;
uint32_t SSRC;
uint32_t MaxTotalMediaBitRate; // In Kbit/s
uint32_t MeasuredOverhead;
};
struct RTCPPacketRTPFBTMMBN
{
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord32 MediaSSRC; // zero!
uint32_t SenderSSRC;
uint32_t MediaSSRC; // zero!
};
struct RTCPPacketRTPFBTMMBNItem
{
// RFC5104
WebRtc_UWord32 SSRC; // "Owner"
WebRtc_UWord32 MaxTotalMediaBitRate;
WebRtc_UWord32 MeasuredOverhead;
uint32_t SSRC; // "Owner"
uint32_t MaxTotalMediaBitRate;
uint32_t MeasuredOverhead;
};
struct RTCPPacketPSFBFIR
{
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord32 MediaSSRC; // zero!
uint32_t SenderSSRC;
uint32_t MediaSSRC; // zero!
};
struct RTCPPacketPSFBFIRItem
{
// RFC5104
WebRtc_UWord32 SSRC;
WebRtc_UWord8 CommandSequenceNumber;
uint32_t SSRC;
uint8_t CommandSequenceNumber;
};
struct RTCPPacketPSFBPLI
{
// RFC4585
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord32 MediaSSRC;
uint32_t SenderSSRC;
uint32_t MediaSSRC;
};
struct RTCPPacketPSFBSLI
{
// RFC4585
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord32 MediaSSRC;
uint32_t SenderSSRC;
uint32_t MediaSSRC;
};
struct RTCPPacketPSFBSLIItem
{
// RFC4585
WebRtc_UWord16 FirstMB;
WebRtc_UWord16 NumberOfMB;
WebRtc_UWord8 PictureId;
uint16_t FirstMB;
uint16_t NumberOfMB;
uint8_t PictureId;
};
struct RTCPPacketPSFBRPSI
{
// RFC4585
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord32 MediaSSRC;
WebRtc_UWord8 PayloadType;
WebRtc_UWord16 NumberOfValidBits;
WebRtc_UWord8 NativeBitString[RTCP_RPSI_DATA_SIZE];
uint32_t SenderSSRC;
uint32_t MediaSSRC;
uint8_t PayloadType;
uint16_t NumberOfValidBits;
uint8_t NativeBitString[RTCP_RPSI_DATA_SIZE];
};
struct RTCPPacketPSFBAPP
{
WebRtc_UWord32 SenderSSRC;
WebRtc_UWord32 MediaSSRC;
uint32_t SenderSSRC;
uint32_t MediaSSRC;
};
struct RTCPPacketPSFBREMBItem
{
WebRtc_UWord32 BitRate;
WebRtc_UWord8 NumberOfSSRCs;
WebRtc_UWord32 SSRCs[MAX_NUMBER_OF_REMB_FEEDBACK_SSRCS];
uint32_t BitRate;
uint8_t NumberOfSSRCs;
uint32_t SSRCs[MAX_NUMBER_OF_REMB_FEEDBACK_SSRCS];
};
// generic name APP
struct RTCPPacketAPP
{
WebRtc_UWord8 SubType;
WebRtc_UWord32 Name;
WebRtc_UWord8 Data[kRtcpAppCode_DATA_SIZE];
WebRtc_UWord16 Size;
uint8_t SubType;
uint32_t Name;
uint8_t Data[kRtcpAppCode_DATA_SIZE];
uint16_t Size;
};
union RTCPPacket
@ -282,23 +282,23 @@ namespace RTCPUtility {
struct RTCPRawPacket
{
const WebRtc_UWord8* _ptrPacketBegin;
const WebRtc_UWord8* _ptrPacketEnd;
const uint8_t* _ptrPacketBegin;
const uint8_t* _ptrPacketEnd;
};
struct RTCPModRawPacket
{
WebRtc_UWord8* _ptrPacketBegin;
WebRtc_UWord8* _ptrPacketEnd;
uint8_t* _ptrPacketBegin;
uint8_t* _ptrPacketEnd;
};
struct RTCPCommonHeader
{
WebRtc_UWord8 V; // Version
uint8_t V; // Version
bool P; // Padding
WebRtc_UWord8 IC; // Item count/subtype
WebRtc_UWord8 PT; // Packet Type
WebRtc_UWord16 LengthInOctets;
uint8_t IC; // Item count/subtype
uint8_t PT; // Packet Type
uint16_t LengthInOctets;
};
enum RTCPPT
@ -314,14 +314,14 @@ namespace RTCPUtility {
PT_XR = 207
};
bool RTCPParseCommonHeader( const WebRtc_UWord8* ptrDataBegin,
const WebRtc_UWord8* ptrDataEnd,
bool RTCPParseCommonHeader( const uint8_t* ptrDataBegin,
const uint8_t* ptrDataEnd,
RTCPCommonHeader& parsedHeader);
class RTCPParserV2
{
public:
RTCPParserV2(const WebRtc_UWord8* rtcpData,
RTCPParserV2(const uint8_t* rtcpData,
size_t rtcpDataLength,
bool rtcpReducedSizeEnable); // Set to true, to allow non-compound RTCP!
~RTCPParserV2();
@ -407,16 +407,16 @@ namespace RTCPUtility {
bool ParseAPPItem();
private:
const WebRtc_UWord8* const _ptrRTCPDataBegin;
const uint8_t* const _ptrRTCPDataBegin;
const bool _RTCPReducedSizeEnable;
const WebRtc_UWord8* const _ptrRTCPDataEnd;
const uint8_t* const _ptrRTCPDataEnd;
bool _validPacket;
const WebRtc_UWord8* _ptrRTCPData;
const WebRtc_UWord8* _ptrRTCPBlockEnd;
const uint8_t* _ptrRTCPData;
const uint8_t* _ptrRTCPBlockEnd;
ParseState _state;
WebRtc_UWord8 _numberOfBlocks;
uint8_t _numberOfBlocks;
RTCPPacketTypes _packetType;
RTCPPacket _packet;
@ -425,7 +425,7 @@ namespace RTCPUtility {
class RTCPPacketIterator
{
public:
RTCPPacketIterator(WebRtc_UWord8* rtcpData,
RTCPPacketIterator(uint8_t* rtcpData,
size_t rtcpDataLength);
~RTCPPacketIterator();
@ -434,10 +434,10 @@ namespace RTCPUtility {
const RTCPCommonHeader* Current();
private:
WebRtc_UWord8* const _ptrBegin;
WebRtc_UWord8* const _ptrEnd;
uint8_t* const _ptrBegin;
uint8_t* const _ptrEnd;
WebRtc_UWord8* _ptrBlock;
uint8_t* _ptrBlock;
RTCPCommonHeader _header;
};

View File

@ -28,8 +28,8 @@ const bool RtpFormatVp8::balance_modes_[kNumModes] =
const bool RtpFormatVp8::separate_first_modes_[kNumModes] =
{ true, false, false };
RtpFormatVp8::RtpFormatVp8(const WebRtc_UWord8* payload_data,
WebRtc_UWord32 payload_size,
RtpFormatVp8::RtpFormatVp8(const uint8_t* payload_data,
uint32_t payload_size,
const RTPVideoHeaderVP8& hdr_info,
int max_payload_len,
const RTPFragmentationHeader& fragmentation,
@ -47,8 +47,8 @@ RtpFormatVp8::RtpFormatVp8(const WebRtc_UWord8* payload_data,
part_info_.CopyFrom(fragmentation);
}
RtpFormatVp8::RtpFormatVp8(const WebRtc_UWord8* payload_data,
WebRtc_UWord32 payload_size,
RtpFormatVp8::RtpFormatVp8(const uint8_t* payload_data,
uint32_t payload_size,
const RTPVideoHeaderVP8& hdr_info,
int max_payload_len)
: payload_data_(payload_data),
@ -67,7 +67,7 @@ RtpFormatVp8::RtpFormatVp8(const WebRtc_UWord8* payload_data,
part_info_.fragmentationOffset[0] = 0;
}
int RtpFormatVp8::NextPacket(WebRtc_UWord8* buffer,
int RtpFormatVp8::NextPacket(uint8_t* buffer,
int* bytes_to_send,
bool* last_packet) {
if (!packets_calculated_) {
@ -297,7 +297,7 @@ void RtpFormatVp8::QueuePacket(int start_pos,
}
int RtpFormatVp8::WriteHeaderAndPayload(const InfoStruct& packet_info,
WebRtc_UWord8* buffer,
uint8_t* buffer,
int buffer_length) const {
// Write the VP8 payload descriptor.
// 0
@ -331,11 +331,11 @@ int RtpFormatVp8::WriteHeaderAndPayload(const InfoStruct& packet_info,
+ extension_length;
}
int RtpFormatVp8::WriteExtensionFields(WebRtc_UWord8* buffer,
int RtpFormatVp8::WriteExtensionFields(uint8_t* buffer,
int buffer_length) const {
int extension_length = 0;
if (XFieldPresent()) {
WebRtc_UWord8* x_field = buffer + vp8_fixed_payload_descriptor_bytes_;
uint8_t* x_field = buffer + vp8_fixed_payload_descriptor_bytes_;
*x_field = 0;
extension_length = 1; // One octet for the X field.
if (PictureIdPresent()) {
@ -361,8 +361,8 @@ int RtpFormatVp8::WriteExtensionFields(WebRtc_UWord8* buffer,
return extension_length;
}
int RtpFormatVp8::WritePictureIDFields(WebRtc_UWord8* x_field,
WebRtc_UWord8* buffer,
int RtpFormatVp8::WritePictureIDFields(uint8_t* x_field,
uint8_t* buffer,
int buffer_length,
int* extension_length) const {
*x_field |= kIBit;
@ -375,10 +375,10 @@ int RtpFormatVp8::WritePictureIDFields(WebRtc_UWord8* x_field,
return 0;
}
int RtpFormatVp8::WritePictureID(WebRtc_UWord8* buffer,
int RtpFormatVp8::WritePictureID(uint8_t* buffer,
int buffer_length) const {
const WebRtc_UWord16 pic_id =
static_cast<WebRtc_UWord16> (hdr_info_.pictureId);
const uint16_t pic_id =
static_cast<uint16_t> (hdr_info_.pictureId);
int picture_id_len = PictureIdLength();
if (picture_id_len > buffer_length) return -1;
if (picture_id_len == 2) {
@ -390,8 +390,8 @@ int RtpFormatVp8::WritePictureID(WebRtc_UWord8* buffer,
return picture_id_len;
}
int RtpFormatVp8::WriteTl0PicIdxFields(WebRtc_UWord8* x_field,
WebRtc_UWord8* buffer,
int RtpFormatVp8::WriteTl0PicIdxFields(uint8_t* x_field,
uint8_t* buffer,
int buffer_length,
int* extension_length) const {
if (buffer_length < vp8_fixed_payload_descriptor_bytes_ + *extension_length
@ -405,15 +405,15 @@ int RtpFormatVp8::WriteTl0PicIdxFields(WebRtc_UWord8* x_field,
return 0;
}
int RtpFormatVp8::WriteTIDAndKeyIdxFields(WebRtc_UWord8* x_field,
WebRtc_UWord8* buffer,
int RtpFormatVp8::WriteTIDAndKeyIdxFields(uint8_t* x_field,
uint8_t* buffer,
int buffer_length,
int* extension_length) const {
if (buffer_length < vp8_fixed_payload_descriptor_bytes_ + *extension_length
+ 1) {
return -1;
}
WebRtc_UWord8* data_field =
uint8_t* data_field =
&buffer[vp8_fixed_payload_descriptor_bytes_ + *extension_length];
*data_field = 0;
if (TIDFieldPresent()) {

View File

@ -48,8 +48,8 @@ class RtpFormatVp8 {
public:
// Initialize with payload from encoder and fragmentation info.
// The payload_data must be exactly one encoded VP8 frame.
RtpFormatVp8(const WebRtc_UWord8* payload_data,
WebRtc_UWord32 payload_size,
RtpFormatVp8(const uint8_t* payload_data,
uint32_t payload_size,
const RTPVideoHeaderVP8& hdr_info,
int max_payload_len,
const RTPFragmentationHeader& fragmentation,
@ -57,8 +57,8 @@ class RtpFormatVp8 {
// Initialize without fragmentation info. Mode kEqualSize will be used.
// The payload_data must be exactly one encoded VP8 frame.
RtpFormatVp8(const WebRtc_UWord8* payload_data,
WebRtc_UWord32 payload_size,
RtpFormatVp8(const uint8_t* payload_data,
uint32_t payload_size,
const RTPVideoHeaderVP8& hdr_info,
int max_payload_len);
@ -73,7 +73,7 @@ class RtpFormatVp8 {
// the first payload byte in the packet is taken, with the first partition
// having index 0; returns negative on error.
// For the kEqualSize mode: returns 0 on success, return negative on error.
int NextPacket(WebRtc_UWord8* buffer,
int NextPacket(uint8_t* buffer,
int* bytes_to_send,
bool* last_packet);
@ -139,35 +139,35 @@ class RtpFormatVp8 {
// The info in packet_info determines which part of the payload is written
// and what to write in the header fields.
int WriteHeaderAndPayload(const InfoStruct& packet_info,
WebRtc_UWord8* buffer,
uint8_t* buffer,
int buffer_length) const;
// Write the X field and the appropriate extension fields to buffer.
// The function returns the extension length (including X field), or -1
// on error.
int WriteExtensionFields(WebRtc_UWord8* buffer, int buffer_length) const;
int WriteExtensionFields(uint8_t* buffer, int buffer_length) const;
// Set the I bit in the x_field, and write PictureID to the appropriate
// position in buffer. The function returns 0 on success, -1 otherwise.
int WritePictureIDFields(WebRtc_UWord8* x_field, WebRtc_UWord8* buffer,
int WritePictureIDFields(uint8_t* x_field, uint8_t* buffer,
int buffer_length, int* extension_length) const;
// Set the L bit in the x_field, and write Tl0PicIdx to the appropriate
// position in buffer. The function returns 0 on success, -1 otherwise.
int WriteTl0PicIdxFields(WebRtc_UWord8* x_field, WebRtc_UWord8* buffer,
int WriteTl0PicIdxFields(uint8_t* x_field, uint8_t* buffer,
int buffer_length, int* extension_length) const;
// Set the T and K bits in the x_field, and write TID, Y and KeyIdx to the
// appropriate position in buffer. The function returns 0 on success,
// -1 otherwise.
int WriteTIDAndKeyIdxFields(WebRtc_UWord8* x_field, WebRtc_UWord8* buffer,
int WriteTIDAndKeyIdxFields(uint8_t* x_field, uint8_t* buffer,
int buffer_length, int* extension_length) const;
// Write the PictureID from codec_specific_info_ to buffer. One or two
// bytes are written, depending on magnitude of PictureID. The function
// returns the number of bytes written.
int WritePictureID(WebRtc_UWord8* buffer, int buffer_length) const;
int WritePictureID(uint8_t* buffer, int buffer_length) const;
// Calculate and return length (octets) of the variable header fields in
// the next header (i.e., header length in addition to vp8_header_bytes_).
@ -184,7 +184,7 @@ class RtpFormatVp8 {
bool TL0PicIdxFieldPresent() const;
bool PictureIdPresent() const { return (PictureIdLength() > 0); }
const WebRtc_UWord8* payload_data_;
const uint8_t* payload_data_;
const int payload_size_;
RTPFragmentationHeader part_info_;
const int vp8_fixed_payload_descriptor_bytes_; // Length of VP8 payload

View File

@ -46,8 +46,8 @@ bool RtpFormatVp8TestHelper::Init(const int* partition_sizes,
payload_size_ += partition_sizes[p];
}
buffer_size_ = payload_size_ + 6; // Add space for payload descriptor.
payload_data_ = new WebRtc_UWord8[payload_size_];
buffer_ = new WebRtc_UWord8[buffer_size_];
payload_data_ = new uint8_t[payload_size_];
buffer_ = new uint8_t[buffer_size_];
int j = 0;
// Loop through the partitions again.
for (int p = 0; p < num_partitions; ++p) {

View File

@ -15,7 +15,7 @@
namespace webrtc {
RTPPayloadRegistry::RTPPayloadRegistry(
const WebRtc_Word32 id,
const int32_t id,
RTPPayloadStrategy* rtp_payload_strategy)
: id_(id),
rtp_payload_strategy_(rtp_payload_strategy),
@ -32,12 +32,12 @@ RTPPayloadRegistry::~RTPPayloadRegistry() {
}
}
WebRtc_Word32 RTPPayloadRegistry::RegisterReceivePayload(
int32_t RTPPayloadRegistry::RegisterReceivePayload(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate,
const int8_t payload_type,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate,
bool* created_new_payload) {
assert(payload_type >= 0);
assert(payload_name);
@ -121,8 +121,8 @@ WebRtc_Word32 RTPPayloadRegistry::RegisterReceivePayload(
return 0;
}
WebRtc_Word32 RTPPayloadRegistry::DeRegisterReceivePayload(
const WebRtc_Word8 payload_type) {
int32_t RTPPayloadRegistry::DeRegisterReceivePayload(
const int8_t payload_type) {
ModuleRTPUtility::PayloadTypeMap::iterator it =
payload_type_map_.find(payload_type);
@ -142,9 +142,9 @@ WebRtc_Word32 RTPPayloadRegistry::DeRegisterReceivePayload(
void RTPPayloadRegistry::DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const size_t payload_name_length,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) {
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) {
ModuleRTPUtility::PayloadTypeMap::iterator iterator =
payload_type_map_.begin();
for (; iterator != payload_type_map_.end(); ++iterator) {
@ -173,12 +173,12 @@ void RTPPayloadRegistry::DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType(
}
}
WebRtc_Word32 RTPPayloadRegistry::ReceivePayloadType(
int32_t RTPPayloadRegistry::ReceivePayloadType(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate,
WebRtc_Word8* payload_type) const {
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate,
int8_t* payload_type) const {
if (payload_type == NULL) {
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
"%s invalid argument", __FUNCTION__);
@ -226,8 +226,8 @@ WebRtc_Word32 RTPPayloadRegistry::ReceivePayloadType(
return -1;
}
WebRtc_Word32 RTPPayloadRegistry::PayloadTypeToPayload(
const WebRtc_UWord8 payload_type,
int32_t RTPPayloadRegistry::PayloadTypeToPayload(
const uint8_t payload_type,
ModuleRTPUtility::Payload*& payload) const {
ModuleRTPUtility::PayloadTypeMap::const_iterator it =
@ -242,7 +242,7 @@ WebRtc_Word32 RTPPayloadRegistry::PayloadTypeToPayload(
}
bool RTPPayloadRegistry::ReportMediaPayloadType(
WebRtc_UWord8 media_payload_type) {
uint8_t media_payload_type) {
if (last_received_media_payload_type_ == media_payload_type) {
// Media type unchanged.
return true;
@ -257,9 +257,9 @@ class RTPPayloadAudioStrategy : public RTPPayloadStrategy {
bool PayloadIsCompatible(
const ModuleRTPUtility::Payload& payload,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) const {
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) const {
return
payload.audio &&
payload.typeSpecific.Audio.frequency == frequency &&
@ -270,16 +270,16 @@ class RTPPayloadAudioStrategy : public RTPPayloadStrategy {
void UpdatePayloadRate(
ModuleRTPUtility::Payload* payload,
const WebRtc_UWord32 rate) const {
const uint32_t rate) const {
payload->typeSpecific.Audio.rate = rate;
}
ModuleRTPUtility::Payload* CreatePayloadType(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) const {
const int8_t payloadType,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) const {
ModuleRTPUtility::Payload* payload = new ModuleRTPUtility::Payload;
payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
strncpy(payload->name, payloadName, RTP_PAYLOAD_NAME_SIZE - 1);
@ -297,24 +297,24 @@ class RTPPayloadVideoStrategy : public RTPPayloadStrategy {
bool PayloadIsCompatible(
const ModuleRTPUtility::Payload& payload,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) const {
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) const {
return !payload.audio;
}
void UpdatePayloadRate(
ModuleRTPUtility::Payload* payload,
const WebRtc_UWord32 rate) const {
const uint32_t rate) const {
payload->typeSpecific.Video.maxRate = rate;
}
ModuleRTPUtility::Payload* CreatePayloadType(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) const {
const int8_t payloadType,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) const {
RtpVideoCodecTypes videoType = kRtpGenericVideo;
if (ModuleRTPUtility::StringCompare(payloadName, "VP8", 3)) {
videoType = kRtpVp8Video;

View File

@ -27,20 +27,20 @@ class RTPPayloadStrategy {
virtual bool PayloadIsCompatible(
const ModuleRTPUtility::Payload& payload,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) const = 0;
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) const = 0;
virtual void UpdatePayloadRate(
ModuleRTPUtility::Payload* payload,
const WebRtc_UWord32 rate) const = 0;
const uint32_t rate) const = 0;
virtual ModuleRTPUtility::Payload* CreatePayloadType(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) const = 0;
const int8_t payloadType,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) const = 0;
static RTPPayloadStrategy* CreateStrategy(const bool handling_audio);
@ -51,30 +51,30 @@ class RTPPayloadStrategy {
class RTPPayloadRegistry {
public:
// The registry takes ownership of the strategy.
RTPPayloadRegistry(const WebRtc_Word32 id,
RTPPayloadRegistry(const int32_t id,
RTPPayloadStrategy* rtp_payload_strategy);
~RTPPayloadRegistry();
WebRtc_Word32 RegisterReceivePayload(
int32_t RegisterReceivePayload(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate,
const int8_t payload_type,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate,
bool* created_new_payload_type);
WebRtc_Word32 DeRegisterReceivePayload(
const WebRtc_Word8 payload_type);
int32_t DeRegisterReceivePayload(
const int8_t payload_type);
WebRtc_Word32 ReceivePayloadType(
int32_t ReceivePayloadType(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate,
WebRtc_Word8* payload_type) const;
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate,
int8_t* payload_type) const;
WebRtc_Word32 PayloadTypeToPayload(
const WebRtc_UWord8 payload_type,
int32_t PayloadTypeToPayload(
const uint8_t payload_type,
ModuleRTPUtility::Payload*& payload) const;
void ResetLastReceivedPayloadTypes() {
@ -83,13 +83,13 @@ class RTPPayloadRegistry {
}
// Returns true if the new media payload type has not changed.
bool ReportMediaPayloadType(WebRtc_UWord8 media_payload_type);
bool ReportMediaPayloadType(uint8_t media_payload_type);
WebRtc_Word8 red_payload_type() const { return red_payload_type_; }
WebRtc_Word8 last_received_payload_type() const {
int8_t red_payload_type() const { return red_payload_type_; }
int8_t last_received_payload_type() const {
return last_received_payload_type_;
}
void set_last_received_payload_type(WebRtc_Word8 last_received_payload_type) {
void set_last_received_payload_type(int8_t last_received_payload_type) {
last_received_payload_type_ = last_received_payload_type;
}
@ -98,16 +98,16 @@ class RTPPayloadRegistry {
void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const size_t payload_name_length,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate);
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate);
ModuleRTPUtility::PayloadTypeMap payload_type_map_;
WebRtc_Word32 id_;
int32_t id_;
scoped_ptr<RTPPayloadStrategy> rtp_payload_strategy_;
WebRtc_Word8 red_payload_type_;
WebRtc_Word8 last_received_payload_type_;
WebRtc_Word8 last_received_media_payload_type_;
int8_t red_payload_type_;
int8_t last_received_payload_type_;
int8_t last_received_media_payload_type_;
};
} // namespace webrtc

View File

@ -32,7 +32,7 @@ using ModuleRTPUtility::RTPPayloadParser;
using ModuleRTPUtility::StringCompare;
using ModuleRTPUtility::VideoPayload;
RTPReceiver::RTPReceiver(const WebRtc_Word32 id,
RTPReceiver::RTPReceiver(const int32_t id,
Clock* clock,
ModuleRtpRtcpImpl* owner,
RtpAudioFeedback* incoming_audio_messages_callback,
@ -120,21 +120,21 @@ RtpVideoCodecTypes RTPReceiver::VideoCodecType() const {
return media_specific.Video.videoCodecType;
}
WebRtc_UWord32 RTPReceiver::MaxConfiguredBitrate() const {
uint32_t RTPReceiver::MaxConfiguredBitrate() const {
ModuleRTPUtility::PayloadUnion media_specific;
rtp_media_receiver_->GetLastMediaSpecificPayload(&media_specific);
return media_specific.Video.maxRate;
}
bool RTPReceiver::REDPayloadType(const WebRtc_Word8 payload_type) const {
bool RTPReceiver::REDPayloadType(const int8_t payload_type) const {
return rtp_payload_registry_->red_payload_type() == payload_type;
}
WebRtc_Word8 RTPReceiver::REDPayloadType() const {
int8_t RTPReceiver::REDPayloadType() const {
return rtp_payload_registry_->red_payload_type();
}
WebRtc_Word32 RTPReceiver::SetPacketTimeout(const WebRtc_UWord32 timeout_ms) {
int32_t RTPReceiver::SetPacketTimeout(const uint32_t timeout_ms) {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
packet_timeout_ms_ = timeout_ms;
return 0;
@ -158,7 +158,7 @@ void RTPReceiver::PacketTimeout() {
return;
}
WebRtc_Word64 now = clock_->TimeInMilliseconds();
int64_t now = clock_->TimeInMilliseconds();
if (now - last_receive_time_ > packet_timeout_ms_) {
packet_time_out = true;
@ -172,7 +172,7 @@ void RTPReceiver::PacketTimeout() {
}
void RTPReceiver::ProcessDeadOrAlive(const bool rtcp_alive,
const WebRtc_Word64 now) {
const int64_t now) {
RTPAliveType alive = kRtpDead;
if (last_receive_time_ + 1000 > now) {
@ -191,34 +191,34 @@ void RTPReceiver::ProcessDeadOrAlive(const bool rtcp_alive,
cb_rtp_feedback_->OnPeriodicDeadOrAlive(id_, alive);
}
WebRtc_UWord16 RTPReceiver::PacketOHReceived() const {
uint16_t RTPReceiver::PacketOHReceived() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
return received_packet_oh_;
}
WebRtc_UWord32 RTPReceiver::PacketCountReceived() const {
uint32_t RTPReceiver::PacketCountReceived() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
return received_inorder_packet_count_;
}
WebRtc_UWord32 RTPReceiver::ByteCountReceived() const {
uint32_t RTPReceiver::ByteCountReceived() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
return received_byte_count_;
}
WebRtc_Word32 RTPReceiver::RegisterReceivePayload(
int32_t RTPReceiver::RegisterReceivePayload(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) {
const int8_t payload_type,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
// TODO(phoglund): Try to streamline handling of the RED codec and some other
// cases which makes it necessary to keep track of whether we created a
// payload or not.
bool created_new_payload = false;
WebRtc_Word32 result = rtp_payload_registry_->RegisterReceivePayload(
int32_t result = rtp_payload_registry_->RegisterReceivePayload(
payload_name, payload_type, frequency, channels, rate,
&created_new_payload);
if (created_new_payload) {
@ -233,31 +233,31 @@ WebRtc_Word32 RTPReceiver::RegisterReceivePayload(
return result;
}
WebRtc_Word32 RTPReceiver::DeRegisterReceivePayload(
const WebRtc_Word8 payload_type) {
int32_t RTPReceiver::DeRegisterReceivePayload(
const int8_t payload_type) {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
return rtp_payload_registry_->DeRegisterReceivePayload(payload_type);
}
WebRtc_Word32 RTPReceiver::ReceivePayloadType(
int32_t RTPReceiver::ReceivePayloadType(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate,
WebRtc_Word8* payload_type) const {
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate,
int8_t* payload_type) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
return rtp_payload_registry_->ReceivePayloadType(
payload_name, frequency, channels, rate, payload_type);
}
WebRtc_Word32 RTPReceiver::RegisterRtpHeaderExtension(
int32_t RTPReceiver::RegisterRtpHeaderExtension(
const RTPExtensionType type,
const WebRtc_UWord8 id) {
const uint8_t id) {
CriticalSectionScoped cs(critical_section_rtp_receiver_);
return rtp_header_extension_map_.Register(type, id);
}
WebRtc_Word32 RTPReceiver::DeregisterRtpHeaderExtension(
int32_t RTPReceiver::DeregisterRtpHeaderExtension(
const RTPExtensionType type) {
CriticalSectionScoped cs(critical_section_rtp_receiver_);
return rtp_header_extension_map_.Deregister(type);
@ -274,8 +274,8 @@ NACKMethod RTPReceiver::NACK() const {
}
// Turn negative acknowledgment requests on/off.
WebRtc_Word32 RTPReceiver::SetNACKStatus(const NACKMethod method,
int max_reordering_threshold) {
int32_t RTPReceiver::SetNACKStatus(const NACKMethod method,
int max_reordering_threshold) {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
if (max_reordering_threshold < 0) {
return -1;
@ -289,54 +289,54 @@ WebRtc_Word32 RTPReceiver::SetNACKStatus(const NACKMethod method,
}
void RTPReceiver::SetRTXStatus(const bool enable,
const WebRtc_UWord32 ssrc) {
const uint32_t ssrc) {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
rtx_ = enable;
ssrc_rtx_ = ssrc;
}
void RTPReceiver::RTXStatus(bool* enable, WebRtc_UWord32* ssrc) const {
void RTPReceiver::RTXStatus(bool* enable, uint32_t* ssrc) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
*enable = rtx_;
*ssrc = ssrc_rtx_;
}
WebRtc_UWord32 RTPReceiver::SSRC() const {
uint32_t RTPReceiver::SSRC() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
return ssrc_;
}
// Get remote CSRC.
WebRtc_Word32 RTPReceiver::CSRCs(
WebRtc_UWord32 array_of_csrcs[kRtpCsrcSize]) const {
int32_t RTPReceiver::CSRCs(
uint32_t array_of_csrcs[kRtpCsrcSize]) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
assert(num_csrcs_ <= kRtpCsrcSize);
if (num_csrcs_ > 0) {
memcpy(array_of_csrcs, current_remote_csrc_,
sizeof(WebRtc_UWord32)*num_csrcs_);
sizeof(uint32_t)*num_csrcs_);
}
return num_csrcs_;
}
WebRtc_Word32 RTPReceiver::Energy(
WebRtc_UWord8 array_of_energy[kRtpCsrcSize]) const {
int32_t RTPReceiver::Energy(
uint8_t array_of_energy[kRtpCsrcSize]) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
assert(num_energy_ <= kRtpCsrcSize);
if (num_energy_ > 0) {
memcpy(array_of_energy, current_remote_energy_,
sizeof(WebRtc_UWord8)*num_csrcs_);
sizeof(uint8_t)*num_csrcs_);
}
return num_energy_;
}
WebRtc_Word32 RTPReceiver::IncomingRTPPacket(
int32_t RTPReceiver::IncomingRTPPacket(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* packet,
const WebRtc_UWord16 packet_length) {
const uint8_t* packet,
const uint16_t packet_length) {
// The rtp_header argument contains the parsed RTP header.
int length = packet_length - rtp_header->header.paddingLength;
@ -378,7 +378,7 @@ WebRtc_Word32 RTPReceiver::IncomingRTPPacket(
cb_rtp_feedback_->OnReceivedPacket(id_, kPacketRtp);
}
}
WebRtc_Word8 first_payload_byte = 0;
int8_t first_payload_byte = 0;
if (length > 0) {
first_payload_byte = packet[rtp_header->header.headerLength];
}
@ -406,7 +406,7 @@ WebRtc_Word32 RTPReceiver::IncomingRTPPacket(
}
CheckCSRC(rtp_header);
WebRtc_UWord16 payload_data_length =
uint16_t payload_data_length =
ModuleRTPUtility::GetPayloadDataLength(rtp_header, packet_length);
bool is_first_packet_in_frame =
@ -414,7 +414,7 @@ WebRtc_Word32 RTPReceiver::IncomingRTPPacket(
TimeStamp() != rtp_header->header.timestamp;
bool is_first_packet = is_first_packet_in_frame || HaveNotReceivedPackets();
WebRtc_Word32 ret_val = rtp_media_receiver_->ParseRtpPacket(
int32_t ret_val = rtp_media_receiver_->ParseRtpPacket(
rtp_header, specific_payload, is_red, packet, packet_length,
clock_->TimeInMilliseconds(), is_first_packet);
@ -452,9 +452,9 @@ WebRtc_Word32 RTPReceiver::IncomingRTPPacket(
// Implementation note: we expect to have the critical_section_rtp_receiver_
// critsect when we call this.
void RTPReceiver::UpdateStatistics(const WebRtcRTPHeader* rtp_header,
const WebRtc_UWord16 bytes,
const uint16_t bytes,
const bool old_packet) {
WebRtc_UWord32 frequency_hz = rtp_media_receiver_->GetFrequencyHz();
uint32_t frequency_hz = rtp_media_receiver_->GetFrequencyHz();
Bitrate::Update(bytes);
@ -472,12 +472,12 @@ void RTPReceiver::UpdateStatistics(const WebRtcRTPHeader* rtp_header,
// Count only the new packets received.
if (InOrderPacket(rtp_header->header.sequenceNumber)) {
const WebRtc_UWord32 RTPtime =
const uint32_t RTPtime =
GetCurrentRTP(clock_, frequency_hz); // Time in samples.
received_inorder_packet_count_++;
// Wrong if we use RetransmitOfOldPacket.
WebRtc_Word32 seq_diff =
int32_t seq_diff =
rtp_header->header.sequenceNumber - received_seq_max_;
if (seq_diff < 0) {
// Wrap around detected.
@ -488,7 +488,7 @@ void RTPReceiver::UpdateStatistics(const WebRtcRTPHeader* rtp_header,
if (rtp_header->header.timestamp != last_received_timestamp_ &&
received_inorder_packet_count_ > 1) {
WebRtc_Word32 time_diff_samples =
int32_t time_diff_samples =
(RTPtime - local_time_last_received_timestamp_) -
(rtp_header->header.timestamp - last_received_timestamp_);
@ -499,13 +499,13 @@ void RTPReceiver::UpdateStatistics(const WebRtcRTPHeader* rtp_header,
// as the treshold.
if (time_diff_samples < 450000) {
// Note we calculate in Q4 to avoid using float.
WebRtc_Word32 jitter_diff_q4 = (time_diff_samples << 4) - jitter_q4_;
int32_t jitter_diff_q4 = (time_diff_samples << 4) - jitter_q4_;
jitter_q4_ += ((jitter_diff_q4 + 8) >> 4);
}
// Extended jitter report, RFC 5450.
// Actual network jitter, excluding the source-introduced jitter.
WebRtc_Word32 time_diff_samples_ext =
int32_t time_diff_samples_ext =
(RTPtime - local_time_last_received_timestamp_) -
((rtp_header->header.timestamp +
rtp_header->extension.transmissionTimeOffset) -
@ -515,7 +515,7 @@ void RTPReceiver::UpdateStatistics(const WebRtcRTPHeader* rtp_header,
time_diff_samples_ext = abs(time_diff_samples_ext);
if (time_diff_samples_ext < 450000) {
WebRtc_Word32 jitter_diffQ4TransmissionTimeOffset =
int32_t jitter_diffQ4TransmissionTimeOffset =
(time_diff_samples_ext << 4) - jitter_q4_transmission_time_offset_;
jitter_q4_transmission_time_offset_ +=
((jitter_diffQ4TransmissionTimeOffset + 8) >> 4);
@ -530,7 +530,7 @@ void RTPReceiver::UpdateStatistics(const WebRtcRTPHeader* rtp_header,
}
}
WebRtc_UWord16 packet_oh =
uint16_t packet_oh =
rtp_header->header.headerLength + rtp_header->header.paddingLength;
// Our measured overhead. Filter from RFC 5104 4.2.1.2:
@ -541,23 +541,23 @@ void RTPReceiver::UpdateStatistics(const WebRtcRTPHeader* rtp_header,
// Implementation note: we expect to have the critical_section_rtp_receiver_
// critsect when we call this.
bool RTPReceiver::RetransmitOfOldPacket(
const WebRtc_UWord16 sequence_number,
const WebRtc_UWord32 rtp_time_stamp) const {
const uint16_t sequence_number,
const uint32_t rtp_time_stamp) const {
if (InOrderPacket(sequence_number)) {
return false;
}
WebRtc_UWord32 frequency_khz = rtp_media_receiver_->GetFrequencyHz() / 1000;
WebRtc_Word64 time_diff_ms = clock_->TimeInMilliseconds() -
uint32_t frequency_khz = rtp_media_receiver_->GetFrequencyHz() / 1000;
int64_t time_diff_ms = clock_->TimeInMilliseconds() -
last_receive_time_;
// Diff in time stamp since last received in order.
WebRtc_Word32 rtp_time_stamp_diff_ms =
static_cast<WebRtc_Word32>(rtp_time_stamp - last_received_timestamp_) /
int32_t rtp_time_stamp_diff_ms =
static_cast<int32_t>(rtp_time_stamp - last_received_timestamp_) /
frequency_khz;
WebRtc_UWord16 min_rtt = 0;
WebRtc_Word32 max_delay_ms = 0;
uint16_t min_rtt = 0;
int32_t max_delay_ms = 0;
rtp_rtcp_.RTT(ssrc_, NULL, NULL, &min_rtt, NULL);
if (min_rtt == 0) {
// Jitter variance in samples.
@ -568,7 +568,7 @@ bool RTPReceiver::RetransmitOfOldPacket(
// 2 times the standard deviation => 95% confidence.
// And transform to milliseconds by dividing by the frequency in kHz.
max_delay_ms = static_cast<WebRtc_Word32>((2 * jitter_std) / frequency_khz);
max_delay_ms = static_cast<int32_t>((2 * jitter_std) / frequency_khz);
// Min max_delay_ms is 1.
if (max_delay_ms == 0) {
@ -583,7 +583,7 @@ bool RTPReceiver::RetransmitOfOldPacket(
return false;
}
bool RTPReceiver::InOrderPacket(const WebRtc_UWord16 sequence_number) const {
bool RTPReceiver::InOrderPacket(const uint16_t sequence_number) const {
if (received_seq_max_ >= sequence_number) {
// Detect wrap-around.
if (!(received_seq_max_ > 0xff00 && sequence_number < 0x0ff)) {
@ -608,12 +608,12 @@ bool RTPReceiver::InOrderPacket(const WebRtc_UWord16 sequence_number) const {
return true;
}
WebRtc_UWord16 RTPReceiver::SequenceNumber() const {
uint16_t RTPReceiver::SequenceNumber() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
return last_received_sequence_number_;
}
WebRtc_UWord32 RTPReceiver::TimeStamp() const {
uint32_t RTPReceiver::TimeStamp() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
return last_received_timestamp_;
}
@ -625,10 +625,10 @@ int32_t RTPReceiver::LastReceivedTimeMs() const {
// Compute time stamp of the last incoming packet that is the first packet of
// its frame.
WebRtc_Word32 RTPReceiver::EstimatedRemoteTimeStamp(
WebRtc_UWord32& timestamp) const {
int32_t RTPReceiver::EstimatedRemoteTimeStamp(
uint32_t& timestamp) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
WebRtc_UWord32 frequency_hz = rtp_media_receiver_->GetFrequencyHz();
uint32_t frequency_hz = rtp_media_receiver_->GetFrequencyHz();
if (local_time_last_received_timestamp_ == 0) {
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
@ -636,7 +636,7 @@ WebRtc_Word32 RTPReceiver::EstimatedRemoteTimeStamp(
return -1;
}
// Time in samples.
WebRtc_UWord32 diff = GetCurrentRTP(clock_, frequency_hz) -
uint32_t diff = GetCurrentRTP(clock_, frequency_hz) -
local_time_last_received_timestamp_;
timestamp = last_received_timestamp_ + diff;
@ -644,7 +644,7 @@ WebRtc_Word32 RTPReceiver::EstimatedRemoteTimeStamp(
}
// Get the currently configured SSRC filter.
WebRtc_Word32 RTPReceiver::SSRCFilter(WebRtc_UWord32& allowed_ssrc) const {
int32_t RTPReceiver::SSRCFilter(uint32_t& allowed_ssrc) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
if (use_ssrc_filter_) {
allowed_ssrc = ssrc_filter_;
@ -656,8 +656,8 @@ WebRtc_Word32 RTPReceiver::SSRCFilter(WebRtc_UWord32& allowed_ssrc) const {
}
// Set a SSRC to be used as a filter for incoming RTP streams.
WebRtc_Word32 RTPReceiver::SetSSRCFilter(
const bool enable, const WebRtc_UWord32 allowed_ssrc) {
int32_t RTPReceiver::SetSSRCFilter(
const bool enable, const uint32_t allowed_ssrc) {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
use_ssrc_filter_ = enable;
@ -674,14 +674,14 @@ void RTPReceiver::CheckSSRCChanged(const WebRtcRTPHeader* rtp_header) {
bool new_ssrc = false;
bool re_initialize_decoder = false;
char payload_name[RTP_PAYLOAD_NAME_SIZE];
WebRtc_UWord32 frequency = kDefaultVideoFrequency;
WebRtc_UWord8 channels = 1;
WebRtc_UWord32 rate = 0;
uint32_t frequency = kDefaultVideoFrequency;
uint8_t channels = 1;
uint32_t rate = 0;
{
CriticalSectionScoped lock(critical_section_rtp_receiver_);
WebRtc_Word8 last_received_payload_type =
int8_t last_received_payload_type =
rtp_payload_registry_->last_received_payload_type();
if (ssrc_ != rtp_header->header.ssrc ||
(last_received_payload_type == -1 && ssrc_ == 0)) {
@ -746,20 +746,20 @@ void RTPReceiver::CheckSSRCChanged(const WebRtcRTPHeader* rtp_header) {
// this code path moves we can get rid of some of the rtp_receiver ->
// media_specific interface (such as CheckPayloadChange, possibly get/set
// last known payload).
WebRtc_Word32 RTPReceiver::CheckPayloadChanged(
int32_t RTPReceiver::CheckPayloadChanged(
const WebRtcRTPHeader* rtp_header,
const WebRtc_Word8 first_payload_byte,
const int8_t first_payload_byte,
bool& is_red,
ModuleRTPUtility::PayloadUnion* specific_payload) {
bool re_initialize_decoder = false;
char payload_name[RTP_PAYLOAD_NAME_SIZE];
WebRtc_Word8 payload_type = rtp_header->header.payloadType;
int8_t payload_type = rtp_header->header.payloadType;
{
CriticalSectionScoped lock(critical_section_rtp_receiver_);
WebRtc_Word8 last_received_payload_type =
int8_t last_received_payload_type =
rtp_payload_registry_->last_received_payload_type();
if (payload_type != last_received_payload_type) {
if (REDPayloadType(payload_type)) {
@ -846,9 +846,9 @@ WebRtc_Word32 RTPReceiver::CheckPayloadChanged(
// Implementation note: must not hold critsect when called.
void RTPReceiver::CheckCSRC(const WebRtcRTPHeader* rtp_header) {
WebRtc_Word32 num_csrcs_diff = 0;
WebRtc_UWord32 old_remote_csrc[kRtpCsrcSize];
WebRtc_UWord8 old_num_csrcs = 0;
int32_t num_csrcs_diff = 0;
uint32_t old_remote_csrc[kRtpCsrcSize];
uint8_t old_num_csrcs = 0;
{
CriticalSectionScoped lock(critical_section_rtp_receiver_);
@ -868,14 +868,14 @@ void RTPReceiver::CheckCSRC(const WebRtcRTPHeader* rtp_header) {
if (old_num_csrcs > 0) {
// Make a copy of old.
memcpy(old_remote_csrc, current_remote_csrc_,
num_csrcs_ * sizeof(WebRtc_UWord32));
num_csrcs_ * sizeof(uint32_t));
}
const WebRtc_UWord8 num_csrcs = rtp_header->header.numCSRCs;
const uint8_t num_csrcs = rtp_header->header.numCSRCs;
if ((num_csrcs > 0) && (num_csrcs <= kRtpCsrcSize)) {
// Copy new.
memcpy(current_remote_csrc_,
rtp_header->header.arrOfCSRCs,
num_csrcs * sizeof(WebRtc_UWord32));
num_csrcs * sizeof(uint32_t));
}
if (num_csrcs > 0 || old_num_csrcs > 0) {
num_csrcs_diff = num_csrcs - old_num_csrcs;
@ -888,11 +888,11 @@ void RTPReceiver::CheckCSRC(const WebRtcRTPHeader* rtp_header) {
bool have_called_callback = false;
// Search for new CSRC in old array.
for (WebRtc_UWord8 i = 0; i < rtp_header->header.numCSRCs; ++i) {
const WebRtc_UWord32 csrc = rtp_header->header.arrOfCSRCs[i];
for (uint8_t i = 0; i < rtp_header->header.numCSRCs; ++i) {
const uint32_t csrc = rtp_header->header.arrOfCSRCs[i];
bool found_match = false;
for (WebRtc_UWord8 j = 0; j < old_num_csrcs; ++j) {
for (uint8_t j = 0; j < old_num_csrcs; ++j) {
if (csrc == old_remote_csrc[j]) { // old list
found_match = true;
break;
@ -905,11 +905,11 @@ void RTPReceiver::CheckCSRC(const WebRtcRTPHeader* rtp_header) {
}
}
// Search for old CSRC in new array.
for (WebRtc_UWord8 i = 0; i < old_num_csrcs; ++i) {
const WebRtc_UWord32 csrc = old_remote_csrc[i];
for (uint8_t i = 0; i < old_num_csrcs; ++i) {
const uint32_t csrc = old_remote_csrc[i];
bool found_match = false;
for (WebRtc_UWord8 j = 0; j < rtp_header->header.numCSRCs; ++j) {
for (uint8_t j = 0; j < rtp_header->header.numCSRCs; ++j) {
if (csrc == rtp_header->header.arrOfCSRCs[j]) {
found_match = true;
break;
@ -933,7 +933,7 @@ void RTPReceiver::CheckCSRC(const WebRtcRTPHeader* rtp_header) {
}
}
WebRtc_Word32 RTPReceiver::ResetStatistics() {
int32_t RTPReceiver::ResetStatistics() {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
last_report_inorder_packets_ = 0;
@ -957,7 +957,7 @@ WebRtc_Word32 RTPReceiver::ResetStatistics() {
return 0;
}
WebRtc_Word32 RTPReceiver::ResetDataCounters() {
int32_t RTPReceiver::ResetDataCounters() {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
received_byte_count_ = 0;
@ -968,15 +968,15 @@ WebRtc_Word32 RTPReceiver::ResetDataCounters() {
return 0;
}
WebRtc_Word32 RTPReceiver::Statistics(
WebRtc_UWord8* fraction_lost,
WebRtc_UWord32* cum_lost,
WebRtc_UWord32* ext_max,
WebRtc_UWord32* jitter,
WebRtc_UWord32* max_jitter,
WebRtc_UWord32* jitter_transmission_time_offset,
int32_t RTPReceiver::Statistics(
uint8_t* fraction_lost,
uint32_t* cum_lost,
uint32_t* ext_max,
uint32_t* jitter,
uint32_t* max_jitter,
uint32_t* jitter_transmission_time_offset,
bool reset) const {
WebRtc_Word32 missing;
int32_t missing;
return Statistics(fraction_lost,
cum_lost,
ext_max,
@ -987,14 +987,14 @@ WebRtc_Word32 RTPReceiver::Statistics(
reset);
}
WebRtc_Word32 RTPReceiver::Statistics(
WebRtc_UWord8* fraction_lost,
WebRtc_UWord32* cum_lost,
WebRtc_UWord32* ext_max,
WebRtc_UWord32* jitter,
WebRtc_UWord32* max_jitter,
WebRtc_UWord32* jitter_transmission_time_offset,
WebRtc_Word32* missing,
int32_t RTPReceiver::Statistics(
uint8_t* fraction_lost,
uint32_t* cum_lost,
uint32_t* ext_max,
uint32_t* jitter,
uint32_t* max_jitter,
uint32_t* jitter_transmission_time_offset,
int32_t* missing,
bool reset) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
@ -1039,7 +1039,7 @@ WebRtc_Word32 RTPReceiver::Statistics(
last_report_seq_max_ = received_seq_first_ - 1;
}
// Calculate fraction lost.
WebRtc_UWord16 exp_since_last = (received_seq_max_ - last_report_seq_max_);
uint16_t exp_since_last = (received_seq_max_ - last_report_seq_max_);
if (last_report_seq_max_ > received_seq_max_) {
// Can we assume that the seq_num can't go decrease over a full RTCP period?
@ -1048,12 +1048,12 @@ WebRtc_Word32 RTPReceiver::Statistics(
// Number of received RTP packets since last report, counts all packets but
// not re-transmissions.
WebRtc_UWord32 rec_since_last =
uint32_t rec_since_last =
received_inorder_packet_count_ - last_report_inorder_packets_;
if (nack_method_ == kNackOff) {
// This is needed for re-ordered packets.
WebRtc_UWord32 old_packets =
uint32_t old_packets =
received_old_packet_count_ - last_report_old_packets_;
rec_since_last += old_packets;
} else {
@ -1072,10 +1072,10 @@ WebRtc_Word32 RTPReceiver::Statistics(
if (exp_since_last > rec_since_last) {
*missing = (exp_since_last - rec_since_last);
}
WebRtc_UWord8 local_fraction_lost = 0;
uint8_t local_fraction_lost = 0;
if (exp_since_last) {
// Scale 0 to 255, where 255 is 100% loss.
local_fraction_lost = (WebRtc_UWord8)((255 * (*missing)) / exp_since_last);
local_fraction_lost = (uint8_t)((255 * (*missing)) / exp_since_last);
}
if (fraction_lost) {
*fraction_lost = local_fraction_lost;
@ -1122,9 +1122,9 @@ WebRtc_Word32 RTPReceiver::Statistics(
return 0;
}
WebRtc_Word32 RTPReceiver::DataCounters(
WebRtc_UWord32* bytes_received,
WebRtc_UWord32* packets_received) const {
int32_t RTPReceiver::DataCounters(
uint32_t* bytes_received,
uint32_t* packets_received) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_);
if (bytes_received) {

View File

@ -37,7 +37,7 @@ class RTPReceiver : public Bitrate {
// Callbacks passed in here may not be NULL (use Null Object callbacks if you
// want callbacks to do nothing). This class takes ownership of the media
// receiver but nothing else.
RTPReceiver(const WebRtc_Word32 id,
RTPReceiver(const int32_t id,
Clock* clock,
ModuleRtpRtcpImpl* owner,
RtpAudioFeedback* incoming_audio_messages_callback,
@ -49,193 +49,191 @@ class RTPReceiver : public Bitrate {
virtual ~RTPReceiver();
RtpVideoCodecTypes VideoCodecType() const;
WebRtc_UWord32 MaxConfiguredBitrate() const;
uint32_t MaxConfiguredBitrate() const;
WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 timeout_ms);
int32_t SetPacketTimeout(const uint32_t timeout_ms);
void PacketTimeout();
void ProcessDeadOrAlive(const bool RTCPalive, const WebRtc_Word64 now);
void ProcessDeadOrAlive(const bool RTCPalive, const int64_t now);
void ProcessBitrate();
WebRtc_Word32 RegisterReceivePayload(
int32_t RegisterReceivePayload(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate);
const int8_t payload_type,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate);
WebRtc_Word32 DeRegisterReceivePayload(const WebRtc_Word8 payload_type);
int32_t DeRegisterReceivePayload(const int8_t payload_type);
WebRtc_Word32 ReceivePayloadType(
int32_t ReceivePayloadType(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate,
WebRtc_Word8* payload_type) const;
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate,
int8_t* payload_type) const;
WebRtc_Word32 IncomingRTPPacket(
int32_t IncomingRTPPacket(
WebRtcRTPHeader* rtpheader,
const WebRtc_UWord8* incoming_rtp_packet,
const WebRtc_UWord16 incoming_rtp_packet_length);
const uint8_t* incoming_rtp_packet,
const uint16_t incoming_rtp_packet_length);
NACKMethod NACK() const ;
// Turn negative acknowledgement requests on/off.
WebRtc_Word32 SetNACKStatus(const NACKMethod method,
int max_reordering_threshold);
int32_t SetNACKStatus(const NACKMethod method, int max_reordering_threshold);
// Returns the last received timestamp.
virtual WebRtc_UWord32 TimeStamp() const;
virtual uint32_t TimeStamp() const;
int32_t LastReceivedTimeMs() const;
virtual WebRtc_UWord16 SequenceNumber() const;
virtual uint16_t SequenceNumber() const;
WebRtc_Word32 EstimatedRemoteTimeStamp(WebRtc_UWord32& timestamp) const;
int32_t EstimatedRemoteTimeStamp(uint32_t& timestamp) const;
WebRtc_UWord32 SSRC() const;
uint32_t SSRC() const;
WebRtc_Word32 CSRCs(WebRtc_UWord32 array_of_csrc[kRtpCsrcSize]) const;
int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const;
WebRtc_Word32 Energy(WebRtc_UWord8 array_of_energy[kRtpCsrcSize]) const;
int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const;
// Get the currently configured SSRC filter.
WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowed_ssrc) const;
int32_t SSRCFilter(uint32_t& allowed_ssrc) const;
// Set a SSRC to be used as a filter for incoming RTP streams.
WebRtc_Word32 SetSSRCFilter(const bool enable,
const WebRtc_UWord32 allowed_ssrc);
int32_t SetSSRCFilter(const bool enable, const uint32_t allowed_ssrc);
WebRtc_Word32 Statistics(WebRtc_UWord8* fraction_lost,
WebRtc_UWord32* cum_lost,
WebRtc_UWord32* ext_max,
WebRtc_UWord32* jitter, // Will be moved from JB.
WebRtc_UWord32* max_jitter,
WebRtc_UWord32* jitter_transmission_time_offset,
bool reset) const;
int32_t Statistics(uint8_t* fraction_lost,
uint32_t* cum_lost,
uint32_t* ext_max,
uint32_t* jitter, // Will be moved from JB.
uint32_t* max_jitter,
uint32_t* jitter_transmission_time_offset,
bool reset) const;
WebRtc_Word32 Statistics(WebRtc_UWord8* fraction_lost,
WebRtc_UWord32* cum_lost,
WebRtc_UWord32* ext_max,
WebRtc_UWord32* jitter, // Will be moved from JB.
WebRtc_UWord32* max_jitter,
WebRtc_UWord32* jitter_transmission_time_offset,
WebRtc_Word32* missing,
bool reset) const;
int32_t Statistics(uint8_t* fraction_lost,
uint32_t* cum_lost,
uint32_t* ext_max,
uint32_t* jitter, // Will be moved from JB.
uint32_t* max_jitter,
uint32_t* jitter_transmission_time_offset,
int32_t* missing,
bool reset) const;
WebRtc_Word32 DataCounters(WebRtc_UWord32* bytes_received,
WebRtc_UWord32* packets_received) const;
int32_t DataCounters(uint32_t* bytes_received,
uint32_t* packets_received) const;
WebRtc_Word32 ResetStatistics();
int32_t ResetStatistics();
WebRtc_Word32 ResetDataCounters();
int32_t ResetDataCounters();
WebRtc_UWord16 PacketOHReceived() const;
uint16_t PacketOHReceived() const;
WebRtc_UWord32 PacketCountReceived() const;
uint32_t PacketCountReceived() const;
WebRtc_UWord32 ByteCountReceived() const;
uint32_t ByteCountReceived() const;
WebRtc_Word32 RegisterRtpHeaderExtension(const RTPExtensionType type,
const WebRtc_UWord8 id);
int32_t RegisterRtpHeaderExtension(const RTPExtensionType type,
const uint8_t id);
WebRtc_Word32 DeregisterRtpHeaderExtension(const RTPExtensionType type);
int32_t DeregisterRtpHeaderExtension(const RTPExtensionType type);
void GetHeaderExtensionMapCopy(RtpHeaderExtensionMap* map) const;
// RTX.
void SetRTXStatus(const bool enable, const WebRtc_UWord32 ssrc);
void SetRTXStatus(const bool enable, const uint32_t ssrc);
void RTXStatus(bool* enable, WebRtc_UWord32* ssrc) const;
void RTXStatus(bool* enable, uint32_t* ssrc) const;
virtual WebRtc_Word8 REDPayloadType() const;
virtual int8_t REDPayloadType() const;
bool HaveNotReceivedPackets() const;
virtual bool RetransmitOfOldPacket(const WebRtc_UWord16 sequence_number,
const WebRtc_UWord32 rtp_time_stamp) const;
virtual bool RetransmitOfOldPacket(const uint16_t sequence_number,
const uint32_t rtp_time_stamp) const;
void UpdateStatistics(const WebRtcRTPHeader* rtp_header,
const WebRtc_UWord16 bytes,
const uint16_t bytes,
const bool old_packet);
private:
// Returns whether RED is configured with payload_type.
bool REDPayloadType(const WebRtc_Word8 payload_type) const;
bool REDPayloadType(const int8_t payload_type) const;
bool InOrderPacket(const WebRtc_UWord16 sequence_number) const;
bool InOrderPacket(const uint16_t sequence_number) const;
void CheckSSRCChanged(const WebRtcRTPHeader* rtp_header);
void CheckCSRC(const WebRtcRTPHeader* rtp_header);
WebRtc_Word32 CheckPayloadChanged(const WebRtcRTPHeader* rtp_header,
const WebRtc_Word8 first_payload_byte,
bool& isRED,
ModuleRTPUtility::PayloadUnion* payload);
int32_t CheckPayloadChanged(const WebRtcRTPHeader* rtp_header,
const int8_t first_payload_byte,
bool& isRED,
ModuleRTPUtility::PayloadUnion* payload);
void UpdateNACKBitRate(WebRtc_Word32 bytes, WebRtc_UWord32 now);
bool ProcessNACKBitRate(WebRtc_UWord32 now);
void UpdateNACKBitRate(int32_t bytes, uint32_t now);
bool ProcessNACKBitRate(uint32_t now);
RTPPayloadRegistry* rtp_payload_registry_;
scoped_ptr<RTPReceiverStrategy> rtp_media_receiver_;
WebRtc_Word32 id_;
int32_t id_;
ModuleRtpRtcpImpl& rtp_rtcp_;
RtpFeedback* cb_rtp_feedback_;
CriticalSectionWrapper* critical_section_rtp_receiver_;
mutable WebRtc_Word64 last_receive_time_;
WebRtc_UWord16 last_received_payload_length_;
mutable int64_t last_receive_time_;
uint16_t last_received_payload_length_;
WebRtc_UWord32 packet_timeout_ms_;
uint32_t packet_timeout_ms_;
RtpHeaderExtensionMap rtp_header_extension_map_;
// SSRCs.
WebRtc_UWord32 ssrc_;
WebRtc_UWord8 num_csrcs_;
WebRtc_UWord32 current_remote_csrc_[kRtpCsrcSize];
WebRtc_UWord8 num_energy_;
WebRtc_UWord8 current_remote_energy_[kRtpCsrcSize];
uint32_t ssrc_;
uint8_t num_csrcs_;
uint32_t current_remote_csrc_[kRtpCsrcSize];
uint8_t num_energy_;
uint8_t current_remote_energy_[kRtpCsrcSize];
bool use_ssrc_filter_;
WebRtc_UWord32 ssrc_filter_;
uint32_t ssrc_filter_;
// Stats on received RTP packets.
WebRtc_UWord32 jitter_q4_;
mutable WebRtc_UWord32 jitter_max_q4_;
mutable WebRtc_UWord32 cumulative_loss_;
WebRtc_UWord32 jitter_q4_transmission_time_offset_;
uint32_t jitter_q4_;
mutable uint32_t jitter_max_q4_;
mutable uint32_t cumulative_loss_;
uint32_t jitter_q4_transmission_time_offset_;
WebRtc_UWord32 local_time_last_received_timestamp_;
uint32_t local_time_last_received_timestamp_;
int64_t last_received_frame_time_ms_;
WebRtc_UWord32 last_received_timestamp_;
WebRtc_UWord16 last_received_sequence_number_;
WebRtc_Word32 last_received_transmission_time_offset_;
WebRtc_UWord16 received_seq_first_;
WebRtc_UWord16 received_seq_max_;
WebRtc_UWord16 received_seq_wraps_;
uint32_t last_received_timestamp_;
uint16_t last_received_sequence_number_;
int32_t last_received_transmission_time_offset_;
uint16_t received_seq_first_;
uint16_t received_seq_max_;
uint16_t received_seq_wraps_;
// Current counter values.
WebRtc_UWord16 received_packet_oh_;
WebRtc_UWord32 received_byte_count_;
WebRtc_UWord32 received_old_packet_count_;
WebRtc_UWord32 received_inorder_packet_count_;
uint16_t received_packet_oh_;
uint32_t received_byte_count_;
uint32_t received_old_packet_count_;
uint32_t received_inorder_packet_count_;
// Counter values when we sent the last report.
mutable WebRtc_UWord32 last_report_inorder_packets_;
mutable WebRtc_UWord32 last_report_old_packets_;
mutable WebRtc_UWord16 last_report_seq_max_;
mutable WebRtc_UWord8 last_report_fraction_lost_;
mutable WebRtc_UWord32 last_report_cumulative_lost_; // 24 bits valid.
mutable WebRtc_UWord32 last_report_extended_high_seq_num_;
mutable WebRtc_UWord32 last_report_jitter_;
mutable WebRtc_UWord32 last_report_jitter_transmission_time_offset_;
mutable uint32_t last_report_inorder_packets_;
mutable uint32_t last_report_old_packets_;
mutable uint16_t last_report_seq_max_;
mutable uint8_t last_report_fraction_lost_;
mutable uint32_t last_report_cumulative_lost_; // 24 bits valid.
mutable uint32_t last_report_extended_high_seq_num_;
mutable uint32_t last_report_jitter_;
mutable uint32_t last_report_jitter_transmission_time_offset_;
NACKMethod nack_method_;
int max_reordering_threshold_;
bool rtx_;
WebRtc_UWord32 ssrc_rtx_;
uint32_t ssrc_rtx_;
};
} // namespace webrtc

View File

@ -20,7 +20,7 @@
#include "webrtc/system_wrappers/interface/trace_event.h"
namespace webrtc {
RTPReceiverAudio::RTPReceiverAudio(const WebRtc_Word32 id,
RTPReceiverAudio::RTPReceiverAudio(const int32_t id,
RtpData* data_callback,
RtpAudioFeedback* incoming_messages_callback)
: RTPReceiverStrategy(data_callback),
@ -41,7 +41,7 @@ RTPReceiverAudio::RTPReceiverAudio(const WebRtc_Word32 id,
last_payload_.Audio.channels = 1;
}
WebRtc_UWord32 RTPReceiverAudio::AudioFrequency() const {
uint32_t RTPReceiverAudio::AudioFrequency() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
if (last_received_g722_) {
return 8000;
@ -64,13 +64,13 @@ bool RTPReceiverAudio::TelephoneEventForwardToDecoder() const {
}
bool RTPReceiverAudio::TelephoneEventPayloadType(
const WebRtc_Word8 payload_type) const {
const int8_t payload_type) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
return (telephone_event_payload_type_ == payload_type) ? true : false;
}
bool RTPReceiverAudio::CNGPayloadType(const WebRtc_Word8 payload_type,
WebRtc_UWord32* frequency,
bool RTPReceiverAudio::CNGPayloadType(const int8_t payload_type,
uint32_t* frequency,
bool* cng_payload_type_has_changed) {
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
*cng_payload_type_has_changed = false;
@ -119,7 +119,7 @@ bool RTPReceiverAudio::CNGPayloadType(const WebRtc_Word8 payload_type,
}
bool RTPReceiverAudio::ShouldReportCsrcChanges(
WebRtc_UWord8 payload_type) const {
uint8_t payload_type) const {
// Don't do this for DTMF packets, otherwise it's fine.
return !TelephoneEventPayloadType(payload_type);
}
@ -156,10 +156,10 @@ bool RTPReceiverAudio::ShouldReportCsrcChanges(
// - MPA frame N/A var. var.
// -
// - G7221 frame N/A
WebRtc_Word32 RTPReceiverAudio::OnNewPayloadTypeCreated(
int32_t RTPReceiverAudio::OnNewPayloadTypeCreated(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 frequency) {
const int8_t payload_type,
const uint32_t frequency) {
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
if (ModuleRTPUtility::StringCompare(payload_name, "telephone-event", 15)) {
@ -183,21 +183,21 @@ WebRtc_Word32 RTPReceiverAudio::OnNewPayloadTypeCreated(
return 0;
}
WebRtc_Word32 RTPReceiverAudio::ParseRtpPacket(
int32_t RTPReceiverAudio::ParseRtpPacket(
WebRtcRTPHeader* rtp_header,
const ModuleRTPUtility::PayloadUnion& specific_payload,
const bool is_red,
const WebRtc_UWord8* packet,
const WebRtc_UWord16 packet_length,
const WebRtc_Word64 timestamp_ms,
const uint8_t* packet,
const uint16_t packet_length,
const int64_t timestamp_ms,
const bool is_first_packet) {
TRACE_EVENT_INSTANT2("webrtc_rtp", "RTPReceiverAudio::ParseRtpPacket",
"seqnum", rtp_header->header.sequenceNumber,
"timestamp", rtp_header->header.timestamp);
const WebRtc_UWord8* payload_data =
const uint8_t* payload_data =
ModuleRTPUtility::GetPayloadData(rtp_header, packet);
const WebRtc_UWord16 payload_data_length =
const uint16_t payload_data_length =
ModuleRTPUtility::GetPayloadDataLength(rtp_header, packet_length);
return ParseAudioCodecSpecific(rtp_header,
@ -207,12 +207,12 @@ WebRtc_Word32 RTPReceiverAudio::ParseRtpPacket(
is_red);
}
WebRtc_Word32 RTPReceiverAudio::GetFrequencyHz() const {
int32_t RTPReceiverAudio::GetFrequencyHz() const {
return AudioFrequency();
}
RTPAliveType RTPReceiverAudio::ProcessDeadOrAlive(
WebRtc_UWord16 last_payload_length) const {
uint16_t last_payload_length) const {
// Our CNG is 9 bytes; if it's a likely CNG the receiver needs to check
// kRtpNoRtp against NetEq speech_type kOutputPLCtoCNG.
@ -224,7 +224,7 @@ RTPAliveType RTPReceiverAudio::ProcessDeadOrAlive(
}
void RTPReceiverAudio::CheckPayloadChanged(
const WebRtc_Word8 payload_type,
const int8_t payload_type,
ModuleRTPUtility::PayloadUnion* specific_payload,
bool* should_reset_statistics,
bool* should_discard_changes) {
@ -251,10 +251,10 @@ void RTPReceiverAudio::CheckPayloadChanged(
}
}
WebRtc_Word32 RTPReceiverAudio::InvokeOnInitializeDecoder(
int32_t RTPReceiverAudio::InvokeOnInitializeDecoder(
RtpFeedback* callback,
const WebRtc_Word32 id,
const WebRtc_Word8 payload_type,
const int32_t id,
const int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const ModuleRTPUtility::PayloadUnion& specific_payload) const {
if (-1 == callback->OnInitializeDecoder(id,
@ -274,10 +274,10 @@ WebRtc_Word32 RTPReceiverAudio::InvokeOnInitializeDecoder(
}
// We are not allowed to have any critsects when calling data_callback.
WebRtc_Word32 RTPReceiverAudio::ParseAudioCodecSpecific(
int32_t RTPReceiverAudio::ParseAudioCodecSpecific(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_length,
const uint8_t* payload_data,
const uint16_t payload_length,
const ModuleRTPUtility::AudioPayload& audio_specific,
const bool is_red) {
@ -300,7 +300,7 @@ WebRtc_Word32 RTPReceiverAudio::ParseAudioCodecSpecific(
if (payload_length % 4 != 0) {
return -1;
}
WebRtc_UWord8 number_of_events = payload_length / 4;
uint8_t number_of_events = payload_length / 4;
// sanity
if (number_of_events >= MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS) {
@ -309,7 +309,7 @@ WebRtc_Word32 RTPReceiverAudio::ParseAudioCodecSpecific(
for (int n = 0; n < number_of_events; ++n) {
bool end = (payload_data[(4 * n) + 1] & 0x80) ? true : false;
std::set<WebRtc_UWord8>::iterator event =
std::set<uint8_t>::iterator event =
telephone_event_reported_.find(payload_data[4 * n]);
if (event != telephone_event_reported_.end()) {
@ -340,7 +340,7 @@ WebRtc_Word32 RTPReceiverAudio::ParseAudioCodecSpecific(
}
// Check if this is a CNG packet, receiver might want to know
WebRtc_UWord32 ignored;
uint32_t ignored;
bool also_ignored;
if (CNGPayloadType(rtp_header->header.payloadType,
&ignored,
@ -358,7 +358,7 @@ WebRtc_Word32 RTPReceiverAudio::ParseAudioCodecSpecific(
// don't forward event to decoder
return 0;
}
std::set<WebRtc_UWord8>::iterator first =
std::set<uint8_t>::iterator first =
telephone_event_reported_.begin();
if (first != telephone_event_reported_.end() && *first > 15) {
// don't forward non DTMF events

View File

@ -27,11 +27,11 @@ class CriticalSectionWrapper;
// Handles audio RTP packets. This class is thread-safe.
class RTPReceiverAudio : public RTPReceiverStrategy {
public:
RTPReceiverAudio(const WebRtc_Word32 id,
RTPReceiverAudio(const int32_t id,
RtpData* data_callback,
RtpAudioFeedback* incoming_messages_callback);
WebRtc_UWord32 AudioFrequency() const;
uint32_t AudioFrequency() const;
// Forward DTMFs to decoder for playout.
int SetTelephoneEventForwardToDecoder(bool forward_to_decoder);
@ -40,38 +40,38 @@ class RTPReceiverAudio : public RTPReceiverStrategy {
bool TelephoneEventForwardToDecoder() const;
// Is TelephoneEvent configured with payload type payload_type
bool TelephoneEventPayloadType(const WebRtc_Word8 payload_type) const;
bool TelephoneEventPayloadType(const int8_t payload_type) const;
// Returns true if CNG is configured with payload type payload_type. If so,
// the frequency and cng_payload_type_has_changed are filled in.
bool CNGPayloadType(const WebRtc_Word8 payload_type,
WebRtc_UWord32* frequency,
bool CNGPayloadType(const int8_t payload_type,
uint32_t* frequency,
bool* cng_payload_type_has_changed);
WebRtc_Word32 ParseRtpPacket(
int32_t ParseRtpPacket(
WebRtcRTPHeader* rtp_header,
const ModuleRTPUtility::PayloadUnion& specific_payload,
const bool is_red,
const WebRtc_UWord8* packet,
const WebRtc_UWord16 packet_length,
const WebRtc_Word64 timestamp_ms,
const uint8_t* packet,
const uint16_t packet_length,
const int64_t timestamp_ms,
const bool is_first_packet);
WebRtc_Word32 GetFrequencyHz() const;
int32_t GetFrequencyHz() const;
RTPAliveType ProcessDeadOrAlive(WebRtc_UWord16 last_payload_length) const;
RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const;
bool ShouldReportCsrcChanges(WebRtc_UWord8 payload_type) const;
bool ShouldReportCsrcChanges(uint8_t payload_type) const;
WebRtc_Word32 OnNewPayloadTypeCreated(
int32_t OnNewPayloadTypeCreated(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 frequency);
const int8_t payload_type,
const uint32_t frequency);
WebRtc_Word32 InvokeOnInitializeDecoder(
int32_t InvokeOnInitializeDecoder(
RtpFeedback* callback,
const WebRtc_Word32 id,
const WebRtc_Word8 payload_type,
const int32_t id,
const int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const ModuleRTPUtility::PayloadUnion& specific_payload) const;
@ -81,44 +81,44 @@ class RTPReceiverAudio : public RTPReceiverStrategy {
ModuleRTPUtility::PayloadTypeMap* payload_type_map,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const size_t payload_name_length,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) const;
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) const;
// We need to look out for special payload types here and sometimes reset
// statistics. In addition we sometimes need to tweak the frequency.
void CheckPayloadChanged(const WebRtc_Word8 payload_type,
void CheckPayloadChanged(const int8_t payload_type,
ModuleRTPUtility::PayloadUnion* specific_payload,
bool* should_reset_statistics,
bool* should_discard_changes);
private:
WebRtc_Word32 ParseAudioCodecSpecific(
int32_t ParseAudioCodecSpecific(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_length,
const uint8_t* payload_data,
const uint16_t payload_length,
const ModuleRTPUtility::AudioPayload& audio_specific,
const bool is_red);
WebRtc_Word32 id_;
int32_t id_;
scoped_ptr<CriticalSectionWrapper> critical_section_rtp_receiver_audio_;
WebRtc_UWord32 last_received_frequency_;
uint32_t last_received_frequency_;
bool telephone_event_forward_to_decoder_;
WebRtc_Word8 telephone_event_payload_type_;
std::set<WebRtc_UWord8> telephone_event_reported_;
int8_t telephone_event_payload_type_;
std::set<uint8_t> telephone_event_reported_;
WebRtc_Word8 cng_nb_payload_type_;
WebRtc_Word8 cng_wb_payload_type_;
WebRtc_Word8 cng_swb_payload_type_;
WebRtc_Word8 cng_fb_payload_type_;
WebRtc_Word8 cng_payload_type_;
int8_t cng_nb_payload_type_;
int8_t cng_wb_payload_type_;
int8_t cng_swb_payload_type_;
int8_t cng_fb_payload_type_;
int8_t cng_payload_type_;
// G722 is special since it use the wrong number of RTP samples in timestamp
// VS. number of samples in the frame
WebRtc_Word8 g722_payload_type_;
int8_t g722_payload_type_;
bool last_received_g722_;
RtpAudioFeedback* cb_audio_feedback_;

View File

@ -39,45 +39,45 @@ class RTPReceiverStrategy {
// make changes in the data as necessary. The specific_payload argument
// provides audio or video-specific data. The is_first_packet argument is true
// if this packet is either the first packet ever or the first in its frame.
virtual WebRtc_Word32 ParseRtpPacket(
virtual int32_t ParseRtpPacket(
WebRtcRTPHeader* rtp_header,
const ModuleRTPUtility::PayloadUnion& specific_payload,
const bool is_red,
const WebRtc_UWord8* packet,
const WebRtc_UWord16 packet_length,
const WebRtc_Word64 timestamp_ms,
const uint8_t* packet,
const uint16_t packet_length,
const int64_t timestamp_ms,
const bool is_first_packet) = 0;
// Retrieves the last known applicable frequency.
virtual WebRtc_Word32 GetFrequencyHz() const = 0;
virtual int32_t GetFrequencyHz() const = 0;
// Computes the current dead-or-alive state.
virtual RTPAliveType ProcessDeadOrAlive(
WebRtc_UWord16 last_payload_length) const = 0;
uint16_t last_payload_length) const = 0;
// Returns true if we should report CSRC changes for this payload type.
// TODO(phoglund): should move out of here along with other payload stuff.
virtual bool ShouldReportCsrcChanges(WebRtc_UWord8 payload_type) const = 0;
virtual bool ShouldReportCsrcChanges(uint8_t payload_type) const = 0;
// Notifies the strategy that we have created a new non-RED payload type in
// the payload registry.
virtual WebRtc_Word32 OnNewPayloadTypeCreated(
virtual int32_t OnNewPayloadTypeCreated(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency) = 0;
const int8_t payloadType,
const uint32_t frequency) = 0;
// Invokes the OnInitializeDecoder callback in a media-specific way.
virtual WebRtc_Word32 InvokeOnInitializeDecoder(
virtual int32_t InvokeOnInitializeDecoder(
RtpFeedback* callback,
const WebRtc_Word32 id,
const WebRtc_Word8 payload_type,
const int32_t id,
const int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const ModuleRTPUtility::PayloadUnion& specific_payload) const = 0;
// Checks if the payload type has changed, and returns whether we should
// reset statistics and/or discard this packet.
virtual void CheckPayloadChanged(
const WebRtc_Word8 payload_type,
const int8_t payload_type,
ModuleRTPUtility::PayloadUnion* specific_payload,
bool* should_reset_statistics,
bool* should_discard_changes) {

View File

@ -25,12 +25,12 @@
#include "webrtc/system_wrappers/interface/trace_event.h"
namespace webrtc {
WebRtc_UWord32 BitRateBPS(WebRtc_UWord16 x) {
return (x & 0x3fff) * WebRtc_UWord32(pow(10.0f, (2 + (x >> 14))));
uint32_t BitRateBPS(uint16_t x) {
return (x & 0x3fff) * uint32_t(pow(10.0f, (2 + (x >> 14))));
}
RTPReceiverVideo::RTPReceiverVideo(
const WebRtc_Word32 id,
const int32_t id,
const RTPPayloadRegistry* rtp_rtp_payload_registry,
RtpData* data_callback)
: RTPReceiverStrategy(data_callback),
@ -48,15 +48,15 @@ RTPReceiverVideo::~RTPReceiverVideo() {
}
bool RTPReceiverVideo::ShouldReportCsrcChanges(
WebRtc_UWord8 payload_type) const {
uint8_t payload_type) const {
// Always do this for video packets.
return true;
}
WebRtc_Word32 RTPReceiverVideo::OnNewPayloadTypeCreated(
int32_t RTPReceiverVideo::OnNewPayloadTypeCreated(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 frequency) {
const int8_t payload_type,
const uint32_t frequency) {
if (ModuleRTPUtility::StringCompare(payload_name, "ULPFEC", 6)) {
// Enable FEC if not enabled.
if (receive_fec_ == NULL) {
@ -67,20 +67,20 @@ WebRtc_Word32 RTPReceiverVideo::OnNewPayloadTypeCreated(
return 0;
}
WebRtc_Word32 RTPReceiverVideo::ParseRtpPacket(
int32_t RTPReceiverVideo::ParseRtpPacket(
WebRtcRTPHeader* rtp_header,
const ModuleRTPUtility::PayloadUnion& specific_payload,
const bool is_red,
const WebRtc_UWord8* packet,
const WebRtc_UWord16 packet_length,
const WebRtc_Word64 timestamp_ms,
const uint8_t* packet,
const uint16_t packet_length,
const int64_t timestamp_ms,
const bool is_first_packet) {
TRACE_EVENT_INSTANT2("webrtc_rtp", "RTPReceiverVideo::ParseRtpPacket",
"seqnum", rtp_header->header.sequenceNumber,
"timestamp", rtp_header->header.timestamp);
const WebRtc_UWord8* payload_data =
const uint8_t* payload_data =
ModuleRTPUtility::GetPayloadData(rtp_header, packet);
const WebRtc_UWord16 payload_data_length =
const uint16_t payload_data_length =
ModuleRTPUtility::GetPayloadDataLength(rtp_header, packet_length);
return ParseVideoCodecSpecific(rtp_header,
payload_data,
@ -93,19 +93,19 @@ WebRtc_Word32 RTPReceiverVideo::ParseRtpPacket(
is_first_packet);
}
WebRtc_Word32 RTPReceiverVideo::GetFrequencyHz() const {
int32_t RTPReceiverVideo::GetFrequencyHz() const {
return kDefaultVideoFrequency;
}
RTPAliveType RTPReceiverVideo::ProcessDeadOrAlive(
WebRtc_UWord16 last_payload_length) const {
uint16_t last_payload_length) const {
return kRtpDead;
}
WebRtc_Word32 RTPReceiverVideo::InvokeOnInitializeDecoder(
int32_t RTPReceiverVideo::InvokeOnInitializeDecoder(
RtpFeedback* callback,
const WebRtc_Word32 id,
const WebRtc_Word8 payload_type,
const int32_t id,
const int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const ModuleRTPUtility::PayloadUnion& specific_payload) const {
// For video we just go with default values.
@ -124,17 +124,17 @@ WebRtc_Word32 RTPReceiverVideo::InvokeOnInitializeDecoder(
// we have no critext when calling this
// we are not allowed to have any critsects when calling
// CallbackOfReceivedPayloadData
WebRtc_Word32 RTPReceiverVideo::ParseVideoCodecSpecific(
int32_t RTPReceiverVideo::ParseVideoCodecSpecific(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length,
const uint8_t* payload_data,
const uint16_t payload_data_length,
const RtpVideoCodecTypes video_type,
const bool is_red,
const WebRtc_UWord8* incoming_rtp_packet,
const WebRtc_UWord16 incoming_rtp_packet_size,
const WebRtc_Word64 now_ms,
const uint8_t* incoming_rtp_packet,
const uint16_t incoming_rtp_packet_size,
const int64_t now_ms,
const bool is_first_packet) {
WebRtc_Word32 ret_val = 0;
int32_t ret_val = 0;
critical_section_receiver_video_->Enter();
@ -158,7 +158,7 @@ WebRtc_Word32 RTPReceiverVideo::ParseVideoCodecSpecific(
// empty payload and data length.
rtp_header->frameType = kFrameEmpty;
// We need this for the routing.
WebRtc_Word32 ret_val = SetCodecType(video_type, rtp_header);
int32_t ret_val = SetCodecType(video_type, rtp_header);
if (ret_val != 0) {
return ret_val;
}
@ -178,11 +178,11 @@ WebRtc_Word32 RTPReceiverVideo::ParseVideoCodecSpecific(
return ret_val;
}
WebRtc_Word32 RTPReceiverVideo::BuildRTPheader(
int32_t RTPReceiverVideo::BuildRTPheader(
const WebRtcRTPHeader* rtp_header,
WebRtc_UWord8* data_buffer) const {
data_buffer[0] = static_cast<WebRtc_UWord8>(0x80); // version 2
data_buffer[1] = static_cast<WebRtc_UWord8>(rtp_header->header.payloadType);
uint8_t* data_buffer) const {
data_buffer[0] = static_cast<uint8_t>(0x80); // version 2
data_buffer[1] = static_cast<uint8_t>(rtp_header->header.payloadType);
if (rtp_header->header.markerBit) {
data_buffer[1] |= kRtpMarkerBitMask; // MarkerBit is 1
}
@ -193,7 +193,7 @@ WebRtc_Word32 RTPReceiverVideo::BuildRTPheader(
ModuleRTPUtility::AssignUWord32ToBuffer(data_buffer + 8,
rtp_header->header.ssrc);
WebRtc_Word32 rtp_header_length = 12;
int32_t rtp_header_length = 12;
// Add the CSRCs if any
if (rtp_header->header.numCSRCs > 0) {
@ -201,23 +201,23 @@ WebRtc_Word32 RTPReceiverVideo::BuildRTPheader(
// error
assert(false);
}
WebRtc_UWord8* ptr = &data_buffer[rtp_header_length];
for (WebRtc_UWord32 i = 0; i < rtp_header->header.numCSRCs; ++i) {
uint8_t* ptr = &data_buffer[rtp_header_length];
for (uint32_t i = 0; i < rtp_header->header.numCSRCs; ++i) {
ModuleRTPUtility::AssignUWord32ToBuffer(ptr,
rtp_header->header.arrOfCSRCs[i]);
ptr += 4;
}
data_buffer[0] = (data_buffer[0] & 0xf0) | rtp_header->header.numCSRCs;
// Update length of header
rtp_header_length += sizeof(WebRtc_UWord32) * rtp_header->header.numCSRCs;
rtp_header_length += sizeof(uint32_t) * rtp_header->header.numCSRCs;
}
return rtp_header_length;
}
WebRtc_Word32 RTPReceiverVideo::ReceiveRecoveredPacketCallback(
int32_t RTPReceiverVideo::ReceiveRecoveredPacketCallback(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length) {
const uint8_t* payload_data,
const uint16_t payload_data_length) {
// TODO(pwestin) Re-factor this to avoid the messy critsect handling.
critical_section_receiver_video_->Enter();
@ -231,11 +231,11 @@ WebRtc_Word32 RTPReceiverVideo::ReceiveRecoveredPacketCallback(
}
// here we can re-create the original lost packet so that we can use it for
// the relay we need to re-create the RED header too
WebRtc_UWord8 recovered_packet[IP_PACKET_SIZE];
WebRtc_UWord16 rtp_header_length =
(WebRtc_UWord16) BuildRTPheader(rtp_header, recovered_packet);
uint8_t recovered_packet[IP_PACKET_SIZE];
uint16_t rtp_header_length =
(uint16_t) BuildRTPheader(rtp_header, recovered_packet);
const WebRtc_UWord8 kREDForFECHeaderLength = 1;
const uint8_t kREDForFECHeaderLength = 1;
// replace pltype
recovered_packet[1] &= 0x80; // Reset.
@ -262,7 +262,7 @@ WebRtc_Word32 RTPReceiverVideo::ReceiveRecoveredPacketCallback(
is_first_packet);
}
WebRtc_Word32 RTPReceiverVideo::SetCodecType(
int32_t RTPReceiverVideo::SetCodecType(
const RtpVideoCodecTypes video_type,
WebRtcRTPHeader* rtp_header) const {
switch (video_type) {
@ -279,13 +279,13 @@ WebRtc_Word32 RTPReceiverVideo::SetCodecType(
return 0;
}
WebRtc_Word32 RTPReceiverVideo::ParseVideoCodecSpecificSwitch(
int32_t RTPReceiverVideo::ParseVideoCodecSpecificSwitch(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length,
const uint8_t* payload_data,
const uint16_t payload_data_length,
const RtpVideoCodecTypes video_type,
const bool is_first_packet) {
WebRtc_Word32 ret_val = SetCodecType(video_type, rtp_header);
int32_t ret_val = SetCodecType(video_type, rtp_header);
if (ret_val != 0) {
critical_section_receiver_video_->Leave();
return ret_val;
@ -312,10 +312,10 @@ WebRtc_Word32 RTPReceiverVideo::ParseVideoCodecSpecificSwitch(
return -1;
}
WebRtc_Word32 RTPReceiverVideo::ReceiveVp8Codec(
int32_t RTPReceiverVideo::ReceiveVp8Codec(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length) {
const uint8_t* payload_data,
const uint16_t payload_data_length) {
bool success;
ModuleRTPUtility::RTPPayload parsed_packet;
if (payload_data_length == 0) {
@ -378,10 +378,10 @@ WebRtc_Word32 RTPReceiverVideo::ReceiveVp8Codec(
return 0;
}
WebRtc_Word32 RTPReceiverVideo::ReceiveGenericCodec(
int32_t RTPReceiverVideo::ReceiveGenericCodec(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
WebRtc_UWord16 payload_data_length) {
const uint8_t* payload_data,
uint16_t payload_data_length) {
uint8_t generic_header = *payload_data++;
--payload_data_length;

View File

@ -27,81 +27,81 @@ class RTPPayloadRegistry;
class RTPReceiverVideo : public RTPReceiverStrategy {
public:
RTPReceiverVideo(const WebRtc_Word32 id,
RTPReceiverVideo(const int32_t id,
const RTPPayloadRegistry* rtp_payload_registry,
RtpData* data_callback);
virtual ~RTPReceiverVideo();
WebRtc_Word32 ParseRtpPacket(
int32_t ParseRtpPacket(
WebRtcRTPHeader* rtp_header,
const ModuleRTPUtility::PayloadUnion& specific_payload,
const bool is_red,
const WebRtc_UWord8* packet,
const WebRtc_UWord16 packet_length,
const WebRtc_Word64 timestamp,
const uint8_t* packet,
const uint16_t packet_length,
const int64_t timestamp,
const bool is_first_packet);
WebRtc_Word32 GetFrequencyHz() const;
int32_t GetFrequencyHz() const;
RTPAliveType ProcessDeadOrAlive(WebRtc_UWord16 last_payload_length) const;
RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const;
bool ShouldReportCsrcChanges(WebRtc_UWord8 payload_type) const;
bool ShouldReportCsrcChanges(uint8_t payload_type) const;
WebRtc_Word32 OnNewPayloadTypeCreated(
int32_t OnNewPayloadTypeCreated(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 frequency);
const int8_t payload_type,
const uint32_t frequency);
WebRtc_Word32 InvokeOnInitializeDecoder(
int32_t InvokeOnInitializeDecoder(
RtpFeedback* callback,
const WebRtc_Word32 id,
const WebRtc_Word8 payload_type,
const int32_t id,
const int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const ModuleRTPUtility::PayloadUnion& specific_payload) const;
virtual WebRtc_Word32 ReceiveRecoveredPacketCallback(
virtual int32_t ReceiveRecoveredPacketCallback(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length);
const uint8_t* payload_data,
const uint16_t payload_data_length);
void SetPacketOverHead(WebRtc_UWord16 packet_over_head);
void SetPacketOverHead(uint16_t packet_over_head);
protected:
WebRtc_Word32 SetCodecType(const RtpVideoCodecTypes video_type,
WebRtcRTPHeader* rtp_header) const;
int32_t SetCodecType(const RtpVideoCodecTypes video_type,
WebRtcRTPHeader* rtp_header) const;
WebRtc_Word32 ParseVideoCodecSpecificSwitch(
int32_t ParseVideoCodecSpecificSwitch(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length,
const uint8_t* payload_data,
const uint16_t payload_data_length,
const RtpVideoCodecTypes video_type,
const bool is_first_packet);
WebRtc_Word32 ReceiveGenericCodec(WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length);
int32_t ReceiveGenericCodec(WebRtcRTPHeader* rtp_header,
const uint8_t* payload_data,
const uint16_t payload_data_length);
WebRtc_Word32 ReceiveVp8Codec(WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length);
int32_t ReceiveVp8Codec(WebRtcRTPHeader* rtp_header,
const uint8_t* payload_data,
const uint16_t payload_data_length);
WebRtc_Word32 BuildRTPheader(const WebRtcRTPHeader* rtp_header,
WebRtc_UWord8* data_buffer) const;
int32_t BuildRTPheader(const WebRtcRTPHeader* rtp_header,
uint8_t* data_buffer) const;
private:
WebRtc_Word32 ParseVideoCodecSpecific(
int32_t ParseVideoCodecSpecific(
WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord16 payload_data_length,
const uint8_t* payload_data,
const uint16_t payload_data_length,
const RtpVideoCodecTypes video_type,
const bool is_red,
const WebRtc_UWord8* incoming_rtp_packet,
const WebRtc_UWord16 incoming_rtp_packet_size,
const WebRtc_Word64 now_ms,
const uint8_t* incoming_rtp_packet,
const uint16_t incoming_rtp_packet_size,
const int64_t now_ms,
const bool is_first_packet);
WebRtc_Word32 id_;
int32_t id_;
const RTPPayloadRegistry* rtp_rtp_payload_registry_;
CriticalSectionWrapper* critical_section_receiver_video_;

File diff suppressed because it is too large Load Diff

View File

@ -36,153 +36,152 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
// Returns the number of milliseconds until the module want a worker thread to
// call Process.
virtual WebRtc_Word32 TimeUntilNextProcess();
virtual int32_t TimeUntilNextProcess();
// Process any pending tasks such as timeouts.
virtual WebRtc_Word32 Process();
virtual int32_t Process();
// Receiver part.
// Configure a timeout value.
virtual WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 rtp_timeout_ms,
const WebRtc_UWord32 rtcp_timeout_ms);
virtual int32_t SetPacketTimeout(const uint32_t rtp_timeout_ms,
const uint32_t rtcp_timeout_ms);
// Set periodic dead or alive notification.
virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
virtual int32_t SetPeriodicDeadOrAliveStatus(
const bool enable,
const WebRtc_UWord8 sample_time_seconds);
const uint8_t sample_time_seconds);
// Get periodic dead or alive notification status.
virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
virtual int32_t PeriodicDeadOrAliveStatus(
bool& enable,
WebRtc_UWord8& sample_time_seconds);
uint8_t& sample_time_seconds);
virtual WebRtc_Word32 RegisterReceivePayload(const CodecInst& voice_codec);
virtual int32_t RegisterReceivePayload(const CodecInst& voice_codec);
virtual WebRtc_Word32 RegisterReceivePayload(const VideoCodec& video_codec);
virtual int32_t RegisterReceivePayload(const VideoCodec& video_codec);
virtual WebRtc_Word32 ReceivePayloadType(const CodecInst& voice_codec,
WebRtc_Word8* pl_type);
virtual int32_t ReceivePayloadType(const CodecInst& voice_codec,
int8_t* pl_type);
virtual WebRtc_Word32 ReceivePayloadType(const VideoCodec& video_codec,
WebRtc_Word8* pl_type);
virtual int32_t ReceivePayloadType(const VideoCodec& video_codec,
int8_t* pl_type);
virtual WebRtc_Word32 DeRegisterReceivePayload(
const WebRtc_Word8 payload_type);
virtual int32_t DeRegisterReceivePayload(
const int8_t payload_type);
// Register RTP header extension.
virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
virtual int32_t RegisterReceiveRtpHeaderExtension(
const RTPExtensionType type,
const WebRtc_UWord8 id);
const uint8_t id);
virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
virtual int32_t DeregisterReceiveRtpHeaderExtension(
const RTPExtensionType type);
// Get the currently configured SSRC filter.
virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowed_ssrc) const;
virtual int32_t SSRCFilter(uint32_t& allowed_ssrc) const;
// Set a SSRC to be used as a filter for incoming RTP streams.
virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
const WebRtc_UWord32 allowed_ssrc);
virtual int32_t SetSSRCFilter(const bool enable,
const uint32_t allowed_ssrc);
// Get last received remote timestamp.
virtual WebRtc_UWord32 RemoteTimestamp() const;
virtual uint32_t RemoteTimestamp() const;
// Get the local time of the last received remote timestamp.
virtual int64_t LocalTimeOfRemoteTimeStamp() const;
// Get the current estimated remote timestamp.
virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
WebRtc_UWord32& timestamp) const;
virtual int32_t EstimatedRemoteTimeStamp(
uint32_t& timestamp) const;
virtual WebRtc_UWord32 RemoteSSRC() const;
virtual uint32_t RemoteSSRC() const;
virtual WebRtc_Word32 RemoteCSRCs(
WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const;
virtual int32_t RemoteCSRCs(
uint32_t arr_of_csrc[kRtpCsrcSize]) const;
virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
const WebRtc_UWord32 ssrc);
virtual int32_t SetRTXReceiveStatus(const bool enable,
const uint32_t ssrc);
virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
WebRtc_UWord32* ssrc) const;
virtual int32_t RTXReceiveStatus(bool* enable,
uint32_t* ssrc) const;
// Called by the network module when we receive a packet.
virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incoming_packet,
const WebRtc_UWord16 packet_length);
virtual int32_t IncomingPacket(const uint8_t* incoming_packet,
const uint16_t packet_length);
// Sender part.
virtual WebRtc_Word32 RegisterSendPayload(const CodecInst& voice_codec);
virtual int32_t RegisterSendPayload(const CodecInst& voice_codec);
virtual WebRtc_Word32 RegisterSendPayload(const VideoCodec& video_codec);
virtual int32_t RegisterSendPayload(const VideoCodec& video_codec);
virtual WebRtc_Word32 DeRegisterSendPayload(const WebRtc_Word8 payload_type);
virtual int32_t DeRegisterSendPayload(const int8_t payload_type);
virtual WebRtc_Word8 SendPayloadType() const;
virtual int8_t SendPayloadType() const;
// Register RTP header extension.
virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
virtual int32_t RegisterSendRtpHeaderExtension(
const RTPExtensionType type,
const WebRtc_UWord8 id);
const uint8_t id);
virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
virtual int32_t DeregisterSendRtpHeaderExtension(
const RTPExtensionType type);
// Get start timestamp.
virtual WebRtc_UWord32 StartTimestamp() const;
virtual uint32_t StartTimestamp() const;
// Configure start timestamp, default is a random number.
virtual WebRtc_Word32 SetStartTimestamp(const WebRtc_UWord32 timestamp);
virtual int32_t SetStartTimestamp(const uint32_t timestamp);
virtual WebRtc_UWord16 SequenceNumber() const;
virtual uint16_t SequenceNumber() const;
// Set SequenceNumber, default is a random number.
virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq);
virtual int32_t SetSequenceNumber(const uint16_t seq);
virtual WebRtc_UWord32 SSRC() const;
virtual uint32_t SSRC() const;
// Configure SSRC, default is a random number.
virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc);
virtual int32_t SetSSRC(const uint32_t ssrc);
virtual WebRtc_Word32 CSRCs(WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const;
virtual int32_t CSRCs(uint32_t arr_of_csrc[kRtpCsrcSize]) const;
virtual WebRtc_Word32 SetCSRCs(const WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize],
const WebRtc_UWord8 arr_length);
virtual int32_t SetCSRCs(const uint32_t arr_of_csrc[kRtpCsrcSize],
const uint8_t arr_length);
virtual WebRtc_Word32 SetCSRCStatus(const bool include);
virtual int32_t SetCSRCStatus(const bool include);
virtual WebRtc_UWord32 PacketCountSent() const;
virtual uint32_t PacketCountSent() const;
virtual int CurrentSendFrequencyHz() const;
virtual WebRtc_UWord32 ByteCountSent() const;
virtual uint32_t ByteCountSent() const;
virtual WebRtc_Word32 SetRTXSendStatus(const RtxMode mode,
const bool set_ssrc,
const WebRtc_UWord32 ssrc);
virtual int32_t SetRTXSendStatus(const RtxMode mode,
const bool set_ssrc,
const uint32_t ssrc);
virtual WebRtc_Word32 RTXSendStatus(RtxMode* mode,
WebRtc_UWord32* ssrc) const;
virtual int32_t RTXSendStatus(RtxMode* mode, uint32_t* ssrc) const;
// Sends kRtcpByeCode when going from true to false.
virtual WebRtc_Word32 SetSendingStatus(const bool sending);
virtual int32_t SetSendingStatus(const bool sending);
virtual bool Sending() const;
// Drops or relays media packets.
virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending);
virtual int32_t SetSendingMediaStatus(const bool sending);
virtual bool SendingMedia() const;
// Used by the codec module to deliver a video or audio frame for
// packetization.
virtual WebRtc_Word32 SendOutgoingData(
virtual int32_t SendOutgoingData(
const FrameType frame_type,
const WebRtc_Word8 payload_type,
const WebRtc_UWord32 time_stamp,
const int8_t payload_type,
const uint32_t time_stamp,
int64_t capture_time_ms,
const WebRtc_UWord8* payload_data,
const WebRtc_UWord32 payload_size,
const uint8_t* payload_data,
const uint32_t payload_size,
const RTPFragmentationHeader* fragmentation = NULL,
const RTPVideoHeader* rtp_video_hdr = NULL);
@ -194,117 +193,117 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
virtual RTCPMethod RTCP() const;
// Configure RTCP status i.e on/off.
virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method);
virtual int32_t SetRTCPStatus(const RTCPMethod method);
// Set RTCP CName.
virtual WebRtc_Word32 SetCNAME(const char c_name[RTCP_CNAME_SIZE]);
virtual int32_t SetCNAME(const char c_name[RTCP_CNAME_SIZE]);
// Get RTCP CName.
virtual WebRtc_Word32 CNAME(char c_name[RTCP_CNAME_SIZE]);
virtual int32_t CNAME(char c_name[RTCP_CNAME_SIZE]);
// Get remote CName.
virtual WebRtc_Word32 RemoteCNAME(const WebRtc_UWord32 remote_ssrc,
char c_name[RTCP_CNAME_SIZE]) const;
virtual int32_t RemoteCNAME(const uint32_t remote_ssrc,
char c_name[RTCP_CNAME_SIZE]) const;
// Get remote NTP.
virtual WebRtc_Word32 RemoteNTP(WebRtc_UWord32* received_ntp_secs,
WebRtc_UWord32* received_ntp_frac,
WebRtc_UWord32* rtcp_arrival_time_secs,
WebRtc_UWord32* rtcp_arrival_time_frac,
WebRtc_UWord32* rtcp_timestamp) const;
virtual int32_t RemoteNTP(uint32_t* received_ntp_secs,
uint32_t* received_ntp_frac,
uint32_t* rtcp_arrival_time_secs,
uint32_t* rtcp_arrival_time_frac,
uint32_t* rtcp_timestamp) const;
virtual WebRtc_Word32 AddMixedCNAME(const WebRtc_UWord32 ssrc,
const char c_name[RTCP_CNAME_SIZE]);
virtual int32_t AddMixedCNAME(const uint32_t ssrc,
const char c_name[RTCP_CNAME_SIZE]);
virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 ssrc);
virtual int32_t RemoveMixedCNAME(const uint32_t ssrc);
// Get RoundTripTime.
virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remote_ssrc,
WebRtc_UWord16* rtt,
WebRtc_UWord16* avg_rtt,
WebRtc_UWord16* min_rtt,
WebRtc_UWord16* max_rtt) const;
virtual int32_t RTT(const uint32_t remote_ssrc,
uint16_t* rtt,
uint16_t* avg_rtt,
uint16_t* min_rtt,
uint16_t* max_rtt) const;
// Reset RoundTripTime statistics.
virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remote_ssrc);
virtual int32_t ResetRTT(const uint32_t remote_ssrc);
virtual void SetRtt(uint32_t rtt);
// Force a send of an RTCP packet.
// Normal SR and RR are triggered via the process function.
virtual WebRtc_Word32 SendRTCP(WebRtc_UWord32 rtcp_packet_type = kRtcpReport);
virtual int32_t SendRTCP(uint32_t rtcp_packet_type = kRtcpReport);
// Statistics of our locally created statistics of the received RTP stream.
virtual WebRtc_Word32 StatisticsRTP(WebRtc_UWord8* fraction_lost,
WebRtc_UWord32* cum_lost,
WebRtc_UWord32* ext_max,
WebRtc_UWord32* jitter,
WebRtc_UWord32* max_jitter = NULL) const;
virtual int32_t StatisticsRTP(uint8_t* fraction_lost,
uint32_t* cum_lost,
uint32_t* ext_max,
uint32_t* jitter,
uint32_t* max_jitter = NULL) const;
// Reset RTP statistics.
virtual WebRtc_Word32 ResetStatisticsRTP();
virtual int32_t ResetStatisticsRTP();
virtual WebRtc_Word32 ResetReceiveDataCountersRTP();
virtual int32_t ResetReceiveDataCountersRTP();
virtual WebRtc_Word32 ResetSendDataCountersRTP();
virtual int32_t ResetSendDataCountersRTP();
// Statistics of the amount of data sent and received.
virtual WebRtc_Word32 DataCountersRTP(WebRtc_UWord32* bytes_sent,
WebRtc_UWord32* packets_sent,
WebRtc_UWord32* bytes_received,
WebRtc_UWord32* packets_received) const;
virtual int32_t DataCountersRTP(uint32_t* bytes_sent,
uint32_t* packets_sent,
uint32_t* bytes_received,
uint32_t* packets_received) const;
virtual WebRtc_Word32 ReportBlockStatistics(
WebRtc_UWord8* fraction_lost,
WebRtc_UWord32* cum_lost,
WebRtc_UWord32* ext_max,
WebRtc_UWord32* jitter,
WebRtc_UWord32* jitter_transmission_time_offset);
virtual int32_t ReportBlockStatistics(
uint8_t* fraction_lost,
uint32_t* cum_lost,
uint32_t* ext_max,
uint32_t* jitter,
uint32_t* jitter_transmission_time_offset);
// Get received RTCP report, sender info.
virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* sender_info);
virtual int32_t RemoteRTCPStat(RTCPSenderInfo* sender_info);
// Get received RTCP report, report block.
virtual WebRtc_Word32 RemoteRTCPStat(
virtual int32_t RemoteRTCPStat(
std::vector<RTCPReportBlock>* receive_blocks) const;
// Set received RTCP report block.
virtual WebRtc_Word32 AddRTCPReportBlock(
const WebRtc_UWord32 ssrc, const RTCPReportBlock* receive_block);
virtual int32_t AddRTCPReportBlock(
const uint32_t ssrc, const RTCPReportBlock* receive_block);
virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 ssrc);
virtual int32_t RemoveRTCPReportBlock(const uint32_t ssrc);
// (REMB) Receiver Estimated Max Bitrate.
virtual bool REMB() const;
virtual WebRtc_Word32 SetREMBStatus(const bool enable);
virtual int32_t SetREMBStatus(const bool enable);
virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
const WebRtc_UWord8 number_of_ssrc,
const WebRtc_UWord32* ssrc);
virtual int32_t SetREMBData(const uint32_t bitrate,
const uint8_t number_of_ssrc,
const uint32_t* ssrc);
// (IJ) Extended jitter report.
virtual bool IJ() const;
virtual WebRtc_Word32 SetIJStatus(const bool enable);
virtual int32_t SetIJStatus(const bool enable);
// (TMMBR) Temporary Max Media Bit Rate.
virtual bool TMMBR() const;
virtual WebRtc_Word32 SetTMMBRStatus(const bool enable);
virtual int32_t SetTMMBRStatus(const bool enable);
WebRtc_Word32 SetTMMBN(const TMMBRSet* bounding_set);
int32_t SetTMMBN(const TMMBRSet* bounding_set);
virtual WebRtc_UWord16 MaxPayloadLength() const;
virtual uint16_t MaxPayloadLength() const;
virtual WebRtc_UWord16 MaxDataPayloadLength() const;
virtual uint16_t MaxDataPayloadLength() const;
virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size);
virtual int32_t SetMaxTransferUnit(const uint16_t size);
virtual WebRtc_Word32 SetTransportOverhead(
virtual int32_t SetTransportOverhead(
const bool tcp,
const bool ipv6,
const WebRtc_UWord8 authentication_overhead = 0);
const uint8_t authentication_overhead = 0);
// (NACK) Negative acknowledgment part.
@ -312,38 +311,37 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
virtual NACKMethod NACK() const;
// Turn negative acknowledgment requests on/off.
virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method,
int max_reordering_threshold);
virtual int32_t SetNACKStatus(const NACKMethod method,
int max_reordering_threshold);
virtual int SelectiveRetransmissions() const;
virtual int SetSelectiveRetransmissions(uint8_t settings);
// Send a Negative acknowledgment packet.
virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nack_list,
const WebRtc_UWord16 size);
virtual int32_t SendNACK(const uint16_t* nack_list, const uint16_t size);
// Store the sent packets, needed to answer to a negative acknowledgment
// requests.
virtual WebRtc_Word32 SetStorePacketsStatus(
const bool enable, const WebRtc_UWord16 number_to_store);
virtual int32_t SetStorePacketsStatus(
const bool enable, const uint16_t number_to_store);
// (APP) Application specific data.
virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
const WebRtc_UWord8 sub_type,
const WebRtc_UWord32 name,
const WebRtc_UWord8* data,
const WebRtc_UWord16 length);
virtual int32_t SetRTCPApplicationSpecificData(
const uint8_t sub_type,
const uint32_t name,
const uint8_t* data,
const uint16_t length);
// (XR) VOIP metric.
virtual WebRtc_Word32 SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
virtual int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
// Audio part.
// Set audio packet size, used to determine when it's time to send a DTMF
// packet in silence (CNG).
virtual WebRtc_Word32 SetAudioPacketSize(
const WebRtc_UWord16 packet_size_samples);
virtual int32_t SetAudioPacketSize(
const uint16_t packet_size_samples);
// Forward DTMFs to decoder for playout.
virtual int SetTelephoneEventForwardToDecoder(bool forward_to_decoder);
@ -351,30 +349,30 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
// Is forwarding of outband telephone events turned on/off?
virtual bool TelephoneEventForwardToDecoder() const;
virtual bool SendTelephoneEventActive(WebRtc_Word8& telephone_event) const;
virtual bool SendTelephoneEventActive(int8_t& telephone_event) const;
// Send a TelephoneEvent tone using RFC 2833 (4733).
virtual WebRtc_Word32 SendTelephoneEventOutband(const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level);
virtual int32_t SendTelephoneEventOutband(const uint8_t key,
const uint16_t time_ms,
const uint8_t level);
// Set payload type for Redundant Audio Data RFC 2198.
virtual WebRtc_Word32 SetSendREDPayloadType(const WebRtc_Word8 payload_type);
virtual int32_t SetSendREDPayloadType(const int8_t payload_type);
// Get payload type for Redundant Audio Data RFC 2198.
virtual WebRtc_Word32 SendREDPayloadType(WebRtc_Word8& payload_type) const;
virtual int32_t SendREDPayloadType(int8_t& payload_type) const;
// Set status and id for header-extension-for-audio-level-indication.
virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
const bool enable, const WebRtc_UWord8 id);
virtual int32_t SetRTPAudioLevelIndicationStatus(
const bool enable, const uint8_t id);
// Get status and id for header-extension-for-audio-level-indication.
virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
bool& enable, WebRtc_UWord8& id) const;
virtual int32_t GetRTPAudioLevelIndicationStatus(
bool& enable, uint8_t& id) const;
// Store the audio level in d_bov for header-extension-for-audio-level-
// indication.
virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_d_bov);
virtual int32_t SetAudioLevel(const uint8_t level_d_bov);
// Video part.
@ -382,53 +380,52 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
virtual RtpVideoCodecTypes SendVideoCodec() const;
virtual WebRtc_Word32 SendRTCPSliceLossIndication(
const WebRtc_UWord8 picture_id);
virtual int32_t SendRTCPSliceLossIndication(
const uint8_t picture_id);
// Set method for requestion a new key frame.
virtual WebRtc_Word32 SetKeyFrameRequestMethod(
virtual int32_t SetKeyFrameRequestMethod(
const KeyFrameRequestMethod method);
// Send a request for a keyframe.
virtual WebRtc_Word32 RequestKeyFrame();
virtual int32_t RequestKeyFrame();
virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delay_ms);
virtual int32_t SetCameraDelay(const int32_t delay_ms);
virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate);
virtual void SetTargetSendBitrate(const uint32_t bitrate);
virtual WebRtc_Word32 SetGenericFECStatus(
virtual int32_t SetGenericFECStatus(
const bool enable,
const WebRtc_UWord8 payload_type_red,
const WebRtc_UWord8 payload_type_fec);
const uint8_t payload_type_red,
const uint8_t payload_type_fec);
virtual WebRtc_Word32 GenericFECStatus(
virtual int32_t GenericFECStatus(
bool& enable,
WebRtc_UWord8& payload_type_red,
WebRtc_UWord8& payload_type_fec);
uint8_t& payload_type_red,
uint8_t& payload_type_fec);
virtual WebRtc_Word32 SetFecParameters(
virtual int32_t SetFecParameters(
const FecProtectionParams* delta_params,
const FecProtectionParams* key_params);
virtual WebRtc_Word32 LastReceivedNTP(WebRtc_UWord32& NTPsecs,
WebRtc_UWord32& NTPfrac,
WebRtc_UWord32& remote_sr);
virtual int32_t LastReceivedNTP(uint32_t& NTPsecs,
uint32_t& NTPfrac,
uint32_t& remote_sr);
virtual WebRtc_Word32 BoundingSet(bool& tmmbr_owner,
TMMBRSet*& bounding_set_rec);
virtual int32_t BoundingSet(bool& tmmbr_owner, TMMBRSet*& bounding_set_rec);
virtual void BitrateSent(WebRtc_UWord32* total_rate,
WebRtc_UWord32* video_rate,
WebRtc_UWord32* fec_rate,
WebRtc_UWord32* nackRate) const;
virtual void BitrateSent(uint32_t* total_rate,
uint32_t* video_rate,
uint32_t* fec_rate,
uint32_t* nackRate) const;
virtual void SetRemoteSSRC(const WebRtc_UWord32 ssrc);
virtual void SetRemoteSSRC(const uint32_t ssrc);
virtual WebRtc_UWord32 SendTimeOfSendReport(const WebRtc_UWord32 send_report);
virtual uint32_t SendTimeOfSendReport(const uint32_t send_report);
// Good state of RTP receiver inform sender.
virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
const WebRtc_UWord64 picture_id);
virtual int32_t SendRTCPReferencePictureSelection(
const uint64_t picture_id);
void OnReceivedTMMBR();
@ -436,11 +433,11 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
void OnRequestIntraFrame();
// Received a request for a new SLI.
void OnReceivedSliceLossIndication(const WebRtc_UWord8 picture_id);
void OnReceivedSliceLossIndication(const uint8_t picture_id);
// Received a new reference frame.
void OnReceivedReferencePictureSelectionIndication(
const WebRtc_UWord64 picture_id);
const uint64_t picture_id);
void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers);
@ -455,13 +452,13 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
void ProcessDeadOrAliveTimer();
WebRtc_UWord32 BitrateReceivedNow() const;
uint32_t BitrateReceivedNow() const;
// Get remote SequenceNumber.
WebRtc_UWord16 RemoteSequenceNumber() const;
uint16_t RemoteSequenceNumber() const;
// Only for internal testing.
WebRtc_UWord32 LastSendReport(WebRtc_UWord32& last_rtcptime);
uint32_t LastSendReport(uint32_t& last_rtcptime);
RTPPayloadRegistry rtp_payload_registry_;
@ -478,14 +475,14 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
RTPReceiverAudio* rtp_telephone_event_handler_;
WebRtc_Word32 id_;
int32_t id_;
const bool audio_;
bool collision_detected_;
WebRtc_Word64 last_process_time_;
WebRtc_Word64 last_bitrate_process_time_;
WebRtc_Word64 last_packet_timeout_process_time_;
WebRtc_Word64 last_rtt_process_time_;
WebRtc_UWord16 packet_overhead_;
int64_t last_process_time_;
int64_t last_bitrate_process_time_;
int64_t last_packet_timeout_process_time_;
int64_t last_rtt_process_time_;
uint16_t packet_overhead_;
scoped_ptr<CriticalSectionWrapper> critical_section_module_ptrs_;
scoped_ptr<CriticalSectionWrapper> critical_section_module_ptrs_feedback_;
@ -494,12 +491,12 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
// Dead or alive.
bool dead_or_alive_active_;
WebRtc_UWord32 dead_or_alive_timeout_ms_;
WebRtc_Word64 dead_or_alive_last_timer_;
uint32_t dead_or_alive_timeout_ms_;
int64_t dead_or_alive_last_timer_;
// Send side
NACKMethod nack_method_;
WebRtc_UWord32 nack_last_time_sent_full_;
WebRtc_UWord16 nack_last_seq_number_sent_;
uint32_t nack_last_time_sent_full_;
uint16_t nack_last_seq_number_sent_;
bool simulcast_;
VideoCodec send_video_codec_;

View File

@ -21,7 +21,7 @@
namespace webrtc {
RTPSender::RTPSender(const WebRtc_Word32 id, const bool audio, Clock *clock,
RTPSender::RTPSender(const int32_t id, const bool audio, Clock *clock,
Transport *transport, RtpAudioFeedback *audio_feedback,
PacedSender *paced_sender)
: Bitrate(clock), id_(id), audio_configured_(audio), audio_(NULL),
@ -45,7 +45,7 @@ RTPSender::RTPSender(const WebRtc_Word32 id, const bool audio, Clock *clock,
memset(nack_byte_count_, 0, sizeof(nack_byte_count_));
memset(csrc_, 0, sizeof(csrc_));
// We need to seed the random generator.
srand(static_cast<WebRtc_UWord32>(clock_->TimeInMilliseconds()));
srand(static_cast<uint32_t>(clock_->TimeInMilliseconds()));
ssrc_ = ssrc_db_.CreateSSRC(); // Can't be 0.
ssrc_rtx_ = ssrc_db_.CreateSSRC(); // Can't be 0.
// Random start, 16 bits. Can't be 0.
@ -70,7 +70,7 @@ RTPSender::~RTPSender() {
SSRCDatabase::ReturnSSRCDatabase();
delete send_critsect_;
while (!payload_type_map_.empty()) {
std::map<WebRtc_Word8, ModuleRTPUtility::Payload *>::iterator it =
std::map<int8_t, ModuleRTPUtility::Payload *>::iterator it =
payload_type_map_.begin();
delete it->second;
payload_type_map_.erase(it);
@ -82,34 +82,34 @@ RTPSender::~RTPSender() {
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id_, "%s deleted", __FUNCTION__);
}
void RTPSender::SetTargetSendBitrate(const WebRtc_UWord32 bits) {
void RTPSender::SetTargetSendBitrate(const uint32_t bits) {
target_send_bitrate_ = static_cast<uint16_t>(bits / 1000);
}
WebRtc_UWord16 RTPSender::ActualSendBitrateKbit() const {
return (WebRtc_UWord16)(Bitrate::BitrateNow() / 1000);
uint16_t RTPSender::ActualSendBitrateKbit() const {
return (uint16_t)(Bitrate::BitrateNow() / 1000);
}
WebRtc_UWord32 RTPSender::VideoBitrateSent() const {
uint32_t RTPSender::VideoBitrateSent() const {
if (video_) {
return video_->VideoBitrateSent();
}
return 0;
}
WebRtc_UWord32 RTPSender::FecOverheadRate() const {
uint32_t RTPSender::FecOverheadRate() const {
if (video_) {
return video_->FecOverheadRate();
}
return 0;
}
WebRtc_UWord32 RTPSender::NackOverheadRate() const {
uint32_t RTPSender::NackOverheadRate() const {
return nack_bitrate_.BitrateLast();
}
WebRtc_Word32 RTPSender::SetTransmissionTimeOffset(
const WebRtc_Word32 transmission_time_offset) {
int32_t RTPSender::SetTransmissionTimeOffset(
const int32_t transmission_time_offset) {
if (transmission_time_offset > (0x800000 - 1) ||
transmission_time_offset < -(0x800000 - 1)) { // Word24.
return -1;
@ -119,31 +119,31 @@ WebRtc_Word32 RTPSender::SetTransmissionTimeOffset(
return 0;
}
WebRtc_Word32 RTPSender::RegisterRtpHeaderExtension(const RTPExtensionType type,
const WebRtc_UWord8 id) {
int32_t RTPSender::RegisterRtpHeaderExtension(const RTPExtensionType type,
const uint8_t id) {
CriticalSectionScoped cs(send_critsect_);
return rtp_header_extension_map_.Register(type, id);
}
WebRtc_Word32 RTPSender::DeregisterRtpHeaderExtension(
int32_t RTPSender::DeregisterRtpHeaderExtension(
const RTPExtensionType type) {
CriticalSectionScoped cs(send_critsect_);
return rtp_header_extension_map_.Deregister(type);
}
WebRtc_UWord16 RTPSender::RtpHeaderExtensionTotalLength() const {
uint16_t RTPSender::RtpHeaderExtensionTotalLength() const {
CriticalSectionScoped cs(send_critsect_);
return rtp_header_extension_map_.GetTotalLengthInBytes();
}
WebRtc_Word32 RTPSender::RegisterPayload(
int32_t RTPSender::RegisterPayload(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_number, const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels, const WebRtc_UWord32 rate) {
const int8_t payload_number, const uint32_t frequency,
const uint8_t channels, const uint32_t rate) {
assert(payload_name);
CriticalSectionScoped cs(send_critsect_);
std::map<WebRtc_Word8, ModuleRTPUtility::Payload *>::iterator it =
std::map<int8_t, ModuleRTPUtility::Payload *>::iterator it =
payload_type_map_.find(payload_number);
if (payload_type_map_.end() != it) {
@ -168,7 +168,7 @@ WebRtc_Word32 RTPSender::RegisterPayload(
}
return -1;
}
WebRtc_Word32 ret_val = -1;
int32_t ret_val = -1;
ModuleRTPUtility::Payload *payload = NULL;
if (audio_configured_) {
ret_val = audio_->RegisterAudioPayload(payload_name, payload_number,
@ -183,11 +183,11 @@ WebRtc_Word32 RTPSender::RegisterPayload(
return ret_val;
}
WebRtc_Word32 RTPSender::DeRegisterSendPayload(
const WebRtc_Word8 payload_type) {
int32_t RTPSender::DeRegisterSendPayload(
const int8_t payload_type) {
CriticalSectionScoped lock(send_critsect_);
std::map<WebRtc_Word8, ModuleRTPUtility::Payload *>::iterator it =
std::map<int8_t, ModuleRTPUtility::Payload *>::iterator it =
payload_type_map_.find(payload_type);
if (payload_type_map_.end() == it) {
@ -199,13 +199,13 @@ WebRtc_Word32 RTPSender::DeRegisterSendPayload(
return 0;
}
WebRtc_Word8 RTPSender::SendPayloadType() const { return payload_type_; }
int8_t RTPSender::SendPayloadType() const { return payload_type_; }
int RTPSender::SendPayloadFrequency() const { return audio_->AudioFrequency(); }
WebRtc_Word32 RTPSender::SetMaxPayloadLength(
const WebRtc_UWord16 max_payload_length,
const WebRtc_UWord16 packet_over_head) {
int32_t RTPSender::SetMaxPayloadLength(
const uint16_t max_payload_length,
const uint16_t packet_over_head) {
// Sanity check.
if (max_payload_length < 100 || max_payload_length > IP_PACKET_SIZE) {
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_, "%s invalid argument",
@ -221,7 +221,7 @@ WebRtc_Word32 RTPSender::SetMaxPayloadLength(
return 0;
}
WebRtc_UWord16 RTPSender::MaxDataPayloadLength() const {
uint16_t RTPSender::MaxDataPayloadLength() const {
if (audio_configured_) {
return max_payload_length_ - RTPHeaderLength();
} else {
@ -231,14 +231,14 @@ WebRtc_UWord16 RTPSender::MaxDataPayloadLength() const {
}
}
WebRtc_UWord16 RTPSender::MaxPayloadLength() const {
uint16_t RTPSender::MaxPayloadLength() const {
return max_payload_length_;
}
WebRtc_UWord16 RTPSender::PacketOverHead() const { return packet_over_head_; }
uint16_t RTPSender::PacketOverHead() const { return packet_over_head_; }
void RTPSender::SetRTXStatus(const RtxMode mode, const bool set_ssrc,
const WebRtc_UWord32 ssrc) {
const uint32_t ssrc) {
CriticalSectionScoped cs(send_critsect_);
rtx_ = mode;
if (rtx_ != kRtxOff) {
@ -250,14 +250,14 @@ void RTPSender::SetRTXStatus(const RtxMode mode, const bool set_ssrc,
}
}
void RTPSender::RTXStatus(RtxMode* mode, WebRtc_UWord32 *SSRC) const {
void RTPSender::RTXStatus(RtxMode* mode, uint32_t *SSRC) const {
CriticalSectionScoped cs(send_critsect_);
*mode = rtx_;
*SSRC = ssrc_rtx_;
}
WebRtc_Word32 RTPSender::CheckPayloadType(const WebRtc_Word8 payload_type,
RtpVideoCodecTypes *video_type) {
int32_t RTPSender::CheckPayloadType(const int8_t payload_type,
RtpVideoCodecTypes *video_type) {
CriticalSectionScoped cs(send_critsect_);
if (payload_type < 0) {
@ -266,7 +266,7 @@ WebRtc_Word32 RTPSender::CheckPayloadType(const WebRtc_Word8 payload_type,
return -1;
}
if (audio_configured_) {
WebRtc_Word8 red_pl_type = -1;
int8_t red_pl_type = -1;
if (audio_->RED(red_pl_type) == 0) {
// We have configured RED.
if (red_pl_type == payload_type) {
@ -281,7 +281,7 @@ WebRtc_Word32 RTPSender::CheckPayloadType(const WebRtc_Word8 payload_type,
}
return 0;
}
std::map<WebRtc_Word8, ModuleRTPUtility::Payload *>::iterator it =
std::map<int8_t, ModuleRTPUtility::Payload *>::iterator it =
payload_type_map_.find(payload_type);
if (it == payload_type_map_.end()) {
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
@ -299,10 +299,10 @@ WebRtc_Word32 RTPSender::CheckPayloadType(const WebRtc_Word8 payload_type,
return 0;
}
WebRtc_Word32 RTPSender::SendOutgoingData(
const FrameType frame_type, const WebRtc_Word8 payload_type,
const WebRtc_UWord32 capture_timestamp, int64_t capture_time_ms,
const WebRtc_UWord8 *payload_data, const WebRtc_UWord32 payload_size,
int32_t RTPSender::SendOutgoingData(
const FrameType frame_type, const int8_t payload_type,
const uint32_t capture_timestamp, int64_t capture_time_ms,
const uint8_t *payload_data, const uint32_t payload_size,
const RTPFragmentationHeader *fragmentation,
VideoCodecInformation *codec_info, const RTPVideoTypeHeader *rtp_type_hdr) {
{
@ -340,8 +340,8 @@ WebRtc_Word32 RTPSender::SendOutgoingData(
}
}
WebRtc_Word32 RTPSender::SendPaddingAccordingToBitrate(
WebRtc_Word8 payload_type, WebRtc_UWord32 capture_timestamp,
int32_t RTPSender::SendPaddingAccordingToBitrate(
int8_t payload_type, uint32_t capture_timestamp,
int64_t capture_time_ms) {
// Current bitrate since last estimate(1 second) averaged with the
// estimate since then, to get the most up to date bitrate.
@ -365,16 +365,16 @@ WebRtc_Word32 RTPSender::SendPaddingAccordingToBitrate(
return SendPadData(payload_type, capture_timestamp, capture_time_ms, bytes);
}
WebRtc_Word32 RTPSender::SendPadData(
WebRtc_Word8 payload_type, WebRtc_UWord32 capture_timestamp,
int64_t capture_time_ms, WebRtc_Word32 bytes) {
int32_t RTPSender::SendPadData(
int8_t payload_type, uint32_t capture_timestamp,
int64_t capture_time_ms, int32_t bytes) {
// Drop this packet if we're not sending media packets.
if (!sending_media_) {
return 0;
}
// Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP.
int max_length = 224;
WebRtc_UWord8 data_buffer[IP_PACKET_SIZE];
uint8_t data_buffer[IP_PACKET_SIZE];
for (; bytes > 0; bytes -= max_length) {
int padding_bytes_in_packet = max_length;
@ -391,8 +391,8 @@ WebRtc_Word32 RTPSender::SendPadData(
capture_timestamp, true, // Timestamp provided.
true); // Increment sequence number.
data_buffer[0] |= 0x20; // Set padding bit.
WebRtc_Word32 *data =
reinterpret_cast<WebRtc_Word32 *>(&(data_buffer[header_length]));
int32_t *data =
reinterpret_cast<int32_t *>(&(data_buffer[header_length]));
// Fill data buffer with random data.
for (int j = 0; j < (padding_bytes_in_packet >> 2); ++j) {
@ -416,17 +416,16 @@ WebRtc_Word32 RTPSender::SendPadData(
}
void RTPSender::SetStorePacketsStatus(const bool enable,
const WebRtc_UWord16 number_to_store) {
const uint16_t number_to_store) {
packet_history_->SetStorePacketsStatus(enable, number_to_store);
}
bool RTPSender::StorePackets() const { return packet_history_->StorePackets(); }
WebRtc_Word32 RTPSender::ReSendPacket(WebRtc_UWord16 packet_id,
WebRtc_UWord32 min_resend_time) {
WebRtc_UWord16 length = IP_PACKET_SIZE;
WebRtc_UWord8 data_buffer[IP_PACKET_SIZE];
WebRtc_UWord8 *buffer_to_send_ptr = data_buffer;
int32_t RTPSender::ReSendPacket(uint16_t packet_id, uint32_t min_resend_time) {
uint16_t length = IP_PACKET_SIZE;
uint8_t data_buffer[IP_PACKET_SIZE];
uint8_t *buffer_to_send_ptr = data_buffer;
int64_t stored_time_in_ms;
StorageType type;
@ -442,13 +441,13 @@ WebRtc_Word32 RTPSender::ReSendPacket(WebRtc_UWord16 packet_id,
// packet should not be retransmitted.
return 0;
}
WebRtc_UWord8 data_buffer_rtx[IP_PACKET_SIZE];
uint8_t data_buffer_rtx[IP_PACKET_SIZE];
if (rtx_ != kRtxOff) {
BuildRtxPacket(data_buffer, &length, data_buffer_rtx);
buffer_to_send_ptr = data_buffer_rtx;
}
WebRtc_Word32 bytes_sent = ReSendToNetwork(buffer_to_send_ptr, length);
int32_t bytes_sent = ReSendToNetwork(buffer_to_send_ptr, length);
if (bytes_sent <= 0) {
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
"Transport failed to resend packet_id %u", packet_id);
@ -459,9 +458,8 @@ WebRtc_Word32 RTPSender::ReSendPacket(WebRtc_UWord16 packet_id,
return bytes_sent;
}
WebRtc_Word32 RTPSender::ReSendToNetwork(const WebRtc_UWord8 *packet,
const WebRtc_UWord32 size) {
WebRtc_Word32 bytes_sent = -1;
int32_t RTPSender::ReSendToNetwork(const uint8_t *packet, const uint32_t size) {
int32_t bytes_sent = -1;
if (transport_) {
bytes_sent = transport_->SendPacket(id_, packet, size);
}
@ -491,9 +489,9 @@ int RTPSender::SetSelectiveRetransmissions(uint8_t settings) {
void RTPSender::OnReceivedNACK(
const std::list<uint16_t>& nack_sequence_numbers,
const WebRtc_UWord16 avg_rtt) {
const WebRtc_Word64 now = clock_->TimeInMilliseconds();
WebRtc_UWord32 bytes_re_sent = 0;
const uint16_t avg_rtt) {
const int64_t now = clock_->TimeInMilliseconds();
uint32_t bytes_re_sent = 0;
// Enough bandwidth to send NACK?
if (!ProcessNACKBitRate(now)) {
@ -505,7 +503,7 @@ void RTPSender::OnReceivedNACK(
for (std::list<uint16_t>::const_iterator it = nack_sequence_numbers.begin();
it != nack_sequence_numbers.end(); ++it) {
const WebRtc_Word32 bytes_sent = ReSendPacket(*it, 5 + avg_rtt);
const int32_t bytes_sent = ReSendPacket(*it, 5 + avg_rtt);
if (bytes_sent > 0) {
bytes_re_sent += bytes_sent;
} else if (bytes_sent == 0) {
@ -522,8 +520,8 @@ void RTPSender::OnReceivedNACK(
// Delay bandwidth estimate (RTT * BW).
if (target_send_bitrate_ != 0 && avg_rtt) {
// kbits/s * ms = bits => bits/8 = bytes
WebRtc_UWord32 target_bytes =
(static_cast<WebRtc_UWord32>(target_send_bitrate_) * avg_rtt) >> 3;
uint32_t target_bytes =
(static_cast<uint32_t>(target_send_bitrate_) * avg_rtt) >> 3;
if (bytes_re_sent > target_bytes) {
break; // Ignore the rest of the packets in the list.
}
@ -536,10 +534,10 @@ void RTPSender::OnReceivedNACK(
}
}
bool RTPSender::ProcessNACKBitRate(const WebRtc_UWord32 now) {
WebRtc_UWord32 num = 0;
WebRtc_Word32 byte_count = 0;
const WebRtc_UWord32 avg_interval = 1000;
bool RTPSender::ProcessNACKBitRate(const uint32_t now) {
uint32_t num = 0;
int32_t byte_count = 0;
const uint32_t avg_interval = 1000;
CriticalSectionScoped cs(send_critsect_);
@ -554,7 +552,7 @@ bool RTPSender::ProcessNACKBitRate(const WebRtc_UWord32 now) {
byte_count += nack_byte_count_[num];
}
}
WebRtc_Word32 time_interval = avg_interval;
int32_t time_interval = avg_interval;
if (num == NACK_BYTECOUNT_SIZE) {
// More than NACK_BYTECOUNT_SIZE nack messages has been received
// during the last msg_interval.
@ -566,8 +564,8 @@ bool RTPSender::ProcessNACKBitRate(const WebRtc_UWord32 now) {
return (byte_count * 8) < (target_send_bitrate_ * time_interval);
}
void RTPSender::UpdateNACKBitRate(const WebRtc_UWord32 bytes,
const WebRtc_UWord32 now) {
void RTPSender::UpdateNACKBitRate(const uint32_t bytes,
const uint32_t now) {
CriticalSectionScoped cs(send_critsect_);
// Save bitrate statistics.
@ -635,7 +633,7 @@ void RTPSender::TimeToSendPacket(uint16_t sequence_number,
}
// TODO(pwestin): send in the RTPHeaderParser to avoid parsing it again.
WebRtc_Word32 RTPSender::SendToNetwork(
int32_t RTPSender::SendToNetwork(
uint8_t *buffer, int payload_length, int rtp_header_length,
int64_t capture_time_ms, StorageType storage) {
ModuleRTPUtility::RTPHeaderParser rtp_parser(
@ -658,11 +656,11 @@ WebRtc_Word32 RTPSender::SendToNetwork(
return -1;
}
WebRtc_Word32 bytes_sent = -1;
int32_t bytes_sent = -1;
// Create and send RTX Packet.
if (rtx_ == kRtxAll && storage == kAllowRetransmission) {
WebRtc_UWord16 length_rtx = payload_length + rtp_header_length;
WebRtc_UWord8 data_buffer_rtx[IP_PACKET_SIZE];
uint16_t length_rtx = payload_length + rtp_header_length;
uint8_t data_buffer_rtx[IP_PACKET_SIZE];
BuildRtxPacket(buffer, &length_rtx, data_buffer_rtx);
if (transport_) {
bytes_sent += transport_->SendPacket(id_, data_buffer_rtx, length_rtx);
@ -711,16 +709,16 @@ void RTPSender::ProcessBitrate() {
video_->ProcessBitrate();
}
WebRtc_UWord16 RTPSender::RTPHeaderLength() const {
WebRtc_UWord16 rtp_header_length = 12;
uint16_t RTPSender::RTPHeaderLength() const {
uint16_t rtp_header_length = 12;
if (include_csrcs_) {
rtp_header_length += sizeof(WebRtc_UWord32) * csrcs_;
rtp_header_length += sizeof(uint32_t) * csrcs_;
}
rtp_header_length += RtpHeaderExtensionTotalLength();
return rtp_header_length;
}
WebRtc_UWord16 RTPSender::IncrementSequenceNumber() {
uint16_t RTPSender::IncrementSequenceNumber() {
CriticalSectionScoped cs(send_critsect_);
return sequence_number_++;
}
@ -730,26 +728,26 @@ void RTPSender::ResetDataCounters() {
payload_bytes_sent_ = 0;
}
WebRtc_UWord32 RTPSender::Packets() const {
uint32_t RTPSender::Packets() const {
// Don't use critsect to avoid potential deadlock.
return packets_sent_;
}
// Number of sent RTP bytes.
// Don't use critsect to avoid potental deadlock.
WebRtc_UWord32 RTPSender::Bytes() const {
uint32_t RTPSender::Bytes() const {
return payload_bytes_sent_;
}
WebRtc_Word32 RTPSender::BuildRTPheader(
WebRtc_UWord8 *data_buffer, const WebRtc_Word8 payload_type,
const bool marker_bit, const WebRtc_UWord32 capture_time_stamp,
int32_t RTPSender::BuildRTPheader(
uint8_t *data_buffer, const int8_t payload_type,
const bool marker_bit, const uint32_t capture_time_stamp,
const bool time_stamp_provided, const bool inc_sequence_number) {
assert(payload_type >= 0);
CriticalSectionScoped cs(send_critsect_);
data_buffer[0] = static_cast<WebRtc_UWord8>(0x80); // version 2.
data_buffer[1] = static_cast<WebRtc_UWord8>(payload_type);
data_buffer[0] = static_cast<uint8_t>(0x80); // version 2.
data_buffer[1] = static_cast<uint8_t>(payload_type);
if (marker_bit) {
data_buffer[1] |= kRtpMarkerBitMask; // Marker bit is set.
}
@ -764,7 +762,7 @@ WebRtc_Word32 RTPSender::BuildRTPheader(
ModuleRTPUtility::AssignUWord16ToBuffer(data_buffer + 2, sequence_number_);
ModuleRTPUtility::AssignUWord32ToBuffer(data_buffer + 4, time_stamp_);
ModuleRTPUtility::AssignUWord32ToBuffer(data_buffer + 8, ssrc_);
WebRtc_Word32 rtp_header_length = 12;
int32_t rtp_header_length = 12;
// Add the CSRCs if any.
if (include_csrcs_ && csrcs_ > 0) {
@ -773,19 +771,19 @@ WebRtc_Word32 RTPSender::BuildRTPheader(
assert(false);
return -1;
}
WebRtc_UWord8 *ptr = &data_buffer[rtp_header_length];
for (WebRtc_UWord32 i = 0; i < csrcs_; ++i) {
uint8_t *ptr = &data_buffer[rtp_header_length];
for (uint32_t i = 0; i < csrcs_; ++i) {
ModuleRTPUtility::AssignUWord32ToBuffer(ptr, csrc_[i]);
ptr += 4;
}
data_buffer[0] = (data_buffer[0] & 0xf0) | csrcs_;
// Update length of header.
rtp_header_length += sizeof(WebRtc_UWord32) * csrcs_;
rtp_header_length += sizeof(uint32_t) * csrcs_;
}
sequence_number_++; // Prepare for next packet.
WebRtc_UWord16 len = BuildRTPHeaderExtension(data_buffer + rtp_header_length);
uint16_t len = BuildRTPHeaderExtension(data_buffer + rtp_header_length);
if (len) {
data_buffer[0] |= 0x10; // Set extension bit.
rtp_header_length += len;
@ -793,8 +791,8 @@ WebRtc_Word32 RTPSender::BuildRTPheader(
return rtp_header_length;
}
WebRtc_UWord16 RTPSender::BuildRTPHeaderExtension(
WebRtc_UWord8 *data_buffer) const {
uint16_t RTPSender::BuildRTPHeaderExtension(
uint8_t *data_buffer) const {
if (rtp_header_extension_map_.Size() <= 0) {
return 0;
}
@ -807,19 +805,19 @@ WebRtc_UWord16 RTPSender::BuildRTPHeaderExtension(
// | header extension |
// | .... |
//
const WebRtc_UWord32 kPosLength = 2;
const WebRtc_UWord32 kHeaderLength = RTP_ONE_BYTE_HEADER_LENGTH_IN_BYTES;
const uint32_t kPosLength = 2;
const uint32_t kHeaderLength = RTP_ONE_BYTE_HEADER_LENGTH_IN_BYTES;
// Add extension ID (0xBEDE).
ModuleRTPUtility::AssignUWord16ToBuffer(data_buffer,
RTP_ONE_BYTE_HEADER_EXTENSION);
// Add extensions.
WebRtc_UWord16 total_block_length = 0;
uint16_t total_block_length = 0;
RTPExtensionType type = rtp_header_extension_map_.First();
while (type != kRtpExtensionNone) {
WebRtc_UWord8 block_length = 0;
uint8_t block_length = 0;
if (type == kRtpExtensionTransmissionTimeOffset) {
block_length = BuildTransmissionTimeOffsetExtension(
data_buffer + kHeaderLength + total_block_length);
@ -839,8 +837,8 @@ WebRtc_UWord16 RTPSender::BuildRTPHeaderExtension(
return kHeaderLength + total_block_length;
}
WebRtc_UWord8 RTPSender::BuildTransmissionTimeOffsetExtension(
WebRtc_UWord8* data_buffer) const {
uint8_t RTPSender::BuildTransmissionTimeOffsetExtension(
uint8_t* data_buffer) const {
// From RFC 5450: Transmission Time Offsets in RTP Streams.
//
// The transmission time is signaled to the receiver in-band using the
@ -859,14 +857,14 @@ WebRtc_UWord8 RTPSender::BuildTransmissionTimeOffsetExtension(
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// Get id defined by user.
WebRtc_UWord8 id;
uint8_t id;
if (rtp_header_extension_map_.GetId(kRtpExtensionTransmissionTimeOffset,
&id) != 0) {
// Not registered.
return 0;
}
int pos = 0;
const WebRtc_UWord8 len = 2;
const uint8_t len = 2;
data_buffer[pos++] = (id << 4) + len;
ModuleRTPUtility::AssignUWord24ToBuffer(data_buffer + pos,
transmission_time_offset_);
@ -876,8 +874,8 @@ WebRtc_UWord8 RTPSender::BuildTransmissionTimeOffsetExtension(
}
bool RTPSender::UpdateTransmissionTimeOffset(
WebRtc_UWord8 *rtp_packet, const WebRtc_UWord16 rtp_packet_length,
const WebRtcRTPHeader &rtp_header, const WebRtc_Word64 time_diff_ms) const {
uint8_t *rtp_packet, const uint16_t rtp_packet_length,
const WebRtcRTPHeader &rtp_header, const int64_t time_diff_ms) const {
CriticalSectionScoped cs(send_critsect_);
// Get length until start of transmission block.
@ -905,7 +903,7 @@ bool RTPSender::UpdateTransmissionTimeOffset(
return false;
}
// Get id.
WebRtc_UWord8 id = 0;
uint8_t id = 0;
if (rtp_header_extension_map_.GetId(kRtpExtensionTransmissionTimeOffset,
&id) != 0) {
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
@ -913,7 +911,7 @@ bool RTPSender::UpdateTransmissionTimeOffset(
return false;
}
// Verify first byte in block.
const WebRtc_UWord8 first_block_byte = (id << 4) + 2;
const uint8_t first_block_byte = (id << 4) + 2;
if (rtp_packet[block_pos] != first_block_byte) {
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
"Failed to update transmission time offset.");
@ -927,9 +925,9 @@ bool RTPSender::UpdateTransmissionTimeOffset(
void RTPSender::SetSendingStatus(const bool enabled) {
if (enabled) {
WebRtc_UWord32 frequency_hz;
uint32_t frequency_hz;
if (audio_configured_) {
WebRtc_UWord32 frequency = audio_->AudioFrequency();
uint32_t frequency = audio_->AudioFrequency();
// sanity
switch (frequency) {
@ -947,8 +945,7 @@ void RTPSender::SetSendingStatus(const bool enabled) {
} else {
frequency_hz = kDefaultVideoFrequency;
}
WebRtc_UWord32 RTPtime = ModuleRTPUtility::GetCurrentRTP(clock_,
frequency_hz);
uint32_t RTPtime = ModuleRTPUtility::GetCurrentRTP(clock_, frequency_hz);
// Will be ignored if it's already configured via API.
SetStartTimestamp(RTPtime, false);
@ -977,12 +974,12 @@ bool RTPSender::SendingMedia() const {
return sending_media_;
}
WebRtc_UWord32 RTPSender::Timestamp() const {
uint32_t RTPSender::Timestamp() const {
CriticalSectionScoped cs(send_critsect_);
return time_stamp_;
}
void RTPSender::SetStartTimestamp(WebRtc_UWord32 timestamp, bool force) {
void RTPSender::SetStartTimestamp(uint32_t timestamp, bool force) {
CriticalSectionScoped cs(send_critsect_);
if (force) {
start_time_stamp_forced_ = force;
@ -994,12 +991,12 @@ void RTPSender::SetStartTimestamp(WebRtc_UWord32 timestamp, bool force) {
}
}
WebRtc_UWord32 RTPSender::StartTimestamp() const {
uint32_t RTPSender::StartTimestamp() const {
CriticalSectionScoped cs(send_critsect_);
return start_time_stamp_;
}
WebRtc_UWord32 RTPSender::GenerateNewSSRC() {
uint32_t RTPSender::GenerateNewSSRC() {
// If configured via API, return 0.
CriticalSectionScoped cs(send_critsect_);
@ -1010,7 +1007,7 @@ WebRtc_UWord32 RTPSender::GenerateNewSSRC() {
return ssrc_;
}
void RTPSender::SetSSRC(WebRtc_UWord32 ssrc) {
void RTPSender::SetSSRC(uint32_t ssrc) {
// This is configured via the API.
CriticalSectionScoped cs(send_critsect_);
@ -1027,7 +1024,7 @@ void RTPSender::SetSSRC(WebRtc_UWord32 ssrc) {
}
}
WebRtc_UWord32 RTPSender::SSRC() const {
uint32_t RTPSender::SSRC() const {
CriticalSectionScoped cs(send_critsect_);
return ssrc_;
}
@ -1036,8 +1033,8 @@ void RTPSender::SetCSRCStatus(const bool include) {
include_csrcs_ = include;
}
void RTPSender::SetCSRCs(const WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize],
const WebRtc_UWord8 arr_length) {
void RTPSender::SetCSRCs(const uint32_t arr_of_csrc[kRtpCsrcSize],
const uint8_t arr_length) {
assert(arr_length <= kRtpCsrcSize);
CriticalSectionScoped cs(send_critsect_);
@ -1047,7 +1044,7 @@ void RTPSender::SetCSRCs(const WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize],
csrcs_ = arr_length;
}
WebRtc_Word32 RTPSender::CSRCs(WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const {
int32_t RTPSender::CSRCs(uint32_t arr_of_csrc[kRtpCsrcSize]) const {
assert(arr_of_csrc);
CriticalSectionScoped cs(send_critsect_);
for (int i = 0; i < csrcs_ && i < kRtpCsrcSize; i++) {
@ -1056,67 +1053,67 @@ WebRtc_Word32 RTPSender::CSRCs(WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const {
return csrcs_;
}
void RTPSender::SetSequenceNumber(WebRtc_UWord16 seq) {
void RTPSender::SetSequenceNumber(uint16_t seq) {
CriticalSectionScoped cs(send_critsect_);
sequence_number_forced_ = true;
sequence_number_ = seq;
}
WebRtc_UWord16 RTPSender::SequenceNumber() const {
uint16_t RTPSender::SequenceNumber() const {
CriticalSectionScoped cs(send_critsect_);
return sequence_number_;
}
// Audio.
WebRtc_Word32 RTPSender::SendTelephoneEvent(const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level) {
int32_t RTPSender::SendTelephoneEvent(const uint8_t key,
const uint16_t time_ms,
const uint8_t level) {
if (!audio_configured_) {
return -1;
}
return audio_->SendTelephoneEvent(key, time_ms, level);
}
bool RTPSender::SendTelephoneEventActive(WebRtc_Word8 *telephone_event) const {
bool RTPSender::SendTelephoneEventActive(int8_t *telephone_event) const {
if (!audio_configured_) {
return false;
}
return audio_->SendTelephoneEventActive(*telephone_event);
}
WebRtc_Word32 RTPSender::SetAudioPacketSize(
const WebRtc_UWord16 packet_size_samples) {
int32_t RTPSender::SetAudioPacketSize(
const uint16_t packet_size_samples) {
if (!audio_configured_) {
return -1;
}
return audio_->SetAudioPacketSize(packet_size_samples);
}
WebRtc_Word32 RTPSender::SetAudioLevelIndicationStatus(const bool enable,
const WebRtc_UWord8 ID) {
int32_t RTPSender::SetAudioLevelIndicationStatus(const bool enable,
const uint8_t ID) {
if (!audio_configured_) {
return -1;
}
return audio_->SetAudioLevelIndicationStatus(enable, ID);
}
WebRtc_Word32 RTPSender::AudioLevelIndicationStatus(bool *enable,
WebRtc_UWord8* id) const {
int32_t RTPSender::AudioLevelIndicationStatus(bool *enable,
uint8_t* id) const {
return audio_->AudioLevelIndicationStatus(*enable, *id);
}
WebRtc_Word32 RTPSender::SetAudioLevel(const WebRtc_UWord8 level_d_bov) {
int32_t RTPSender::SetAudioLevel(const uint8_t level_d_bov) {
return audio_->SetAudioLevel(level_d_bov);
}
WebRtc_Word32 RTPSender::SetRED(const WebRtc_Word8 payload_type) {
int32_t RTPSender::SetRED(const int8_t payload_type) {
if (!audio_configured_) {
return -1;
}
return audio_->SetRED(payload_type);
}
WebRtc_Word32 RTPSender::RED(WebRtc_Word8 *payload_type) const {
int32_t RTPSender::RED(int8_t *payload_type) const {
if (!audio_configured_) {
return -1;
}
@ -1136,23 +1133,23 @@ RtpVideoCodecTypes RTPSender::VideoCodecType() const {
return video_->VideoCodecType();
}
WebRtc_UWord32 RTPSender::MaxConfiguredBitrateVideo() const {
uint32_t RTPSender::MaxConfiguredBitrateVideo() const {
if (audio_configured_) {
return 0;
}
return video_->MaxConfiguredBitrateVideo();
}
WebRtc_Word32 RTPSender::SendRTPIntraRequest() {
int32_t RTPSender::SendRTPIntraRequest() {
if (audio_configured_) {
return -1;
}
return video_->SendRTPIntraRequest();
}
WebRtc_Word32 RTPSender::SetGenericFECStatus(
const bool enable, const WebRtc_UWord8 payload_type_red,
const WebRtc_UWord8 payload_type_fec) {
int32_t RTPSender::SetGenericFECStatus(
const bool enable, const uint8_t payload_type_red,
const uint8_t payload_type_fec) {
if (audio_configured_) {
return -1;
}
@ -1160,9 +1157,9 @@ WebRtc_Word32 RTPSender::SetGenericFECStatus(
payload_type_fec);
}
WebRtc_Word32 RTPSender::GenericFECStatus(
bool *enable, WebRtc_UWord8 *payload_type_red,
WebRtc_UWord8 *payload_type_fec) const {
int32_t RTPSender::GenericFECStatus(
bool *enable, uint8_t *payload_type_red,
uint8_t *payload_type_fec) const {
if (audio_configured_) {
return -1;
}
@ -1170,7 +1167,7 @@ WebRtc_Word32 RTPSender::GenericFECStatus(
*enable, *payload_type_red, *payload_type_fec);
}
WebRtc_Word32 RTPSender::SetFecParameters(
int32_t RTPSender::SetFecParameters(
const FecProtectionParams *delta_params,
const FecProtectionParams *key_params) {
if (audio_configured_) {
@ -1179,13 +1176,13 @@ WebRtc_Word32 RTPSender::SetFecParameters(
return video_->SetFecParameters(delta_params, key_params);
}
void RTPSender::BuildRtxPacket(WebRtc_UWord8* buffer, WebRtc_UWord16* length,
WebRtc_UWord8* buffer_rtx) {
void RTPSender::BuildRtxPacket(uint8_t* buffer, uint16_t* length,
uint8_t* buffer_rtx) {
CriticalSectionScoped cs(send_critsect_);
WebRtc_UWord8* data_buffer_rtx = buffer_rtx;
uint8_t* data_buffer_rtx = buffer_rtx;
// Add RTX header.
ModuleRTPUtility::RTPHeaderParser rtp_parser(
reinterpret_cast<const WebRtc_UWord8 *>(buffer), *length);
reinterpret_cast<const uint8_t *>(buffer), *length);
WebRtcRTPHeader rtp_header;
rtp_parser.Parse(rtp_header);
@ -1194,7 +1191,7 @@ void RTPSender::BuildRtxPacket(WebRtc_UWord8* buffer, WebRtc_UWord16* length,
memcpy(data_buffer_rtx, buffer, rtp_header.header.headerLength);
// Replace sequence number.
WebRtc_UWord8 *ptr = data_buffer_rtx + 2;
uint8_t *ptr = data_buffer_rtx + 2;
ModuleRTPUtility::AssignUWord16ToBuffer(ptr, sequence_number_rtx_++);
// Replace SSRC.

View File

@ -38,55 +38,55 @@ class RTPSenderInterface {
RTPSenderInterface() {}
virtual ~RTPSenderInterface() {}
virtual WebRtc_UWord32 SSRC() const = 0;
virtual WebRtc_UWord32 Timestamp() const = 0;
virtual uint32_t SSRC() const = 0;
virtual uint32_t Timestamp() const = 0;
virtual WebRtc_Word32 BuildRTPheader(
WebRtc_UWord8 *data_buffer, const WebRtc_Word8 payload_type,
const bool marker_bit, const WebRtc_UWord32 capture_time_stamp,
virtual int32_t BuildRTPheader(
uint8_t *data_buffer, const int8_t payload_type,
const bool marker_bit, const uint32_t capture_time_stamp,
const bool time_stamp_provided = true,
const bool inc_sequence_number = true) = 0;
virtual WebRtc_UWord16 RTPHeaderLength() const = 0;
virtual WebRtc_UWord16 IncrementSequenceNumber() = 0;
virtual WebRtc_UWord16 SequenceNumber() const = 0;
virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
virtual WebRtc_UWord16 PacketOverHead() const = 0;
virtual WebRtc_UWord16 ActualSendBitrateKbit() const = 0;
virtual uint16_t RTPHeaderLength() const = 0;
virtual uint16_t IncrementSequenceNumber() = 0;
virtual uint16_t SequenceNumber() const = 0;
virtual uint16_t MaxPayloadLength() const = 0;
virtual uint16_t MaxDataPayloadLength() const = 0;
virtual uint16_t PacketOverHead() const = 0;
virtual uint16_t ActualSendBitrateKbit() const = 0;
virtual WebRtc_Word32 SendToNetwork(
virtual int32_t SendToNetwork(
uint8_t *data_buffer, int payload_length, int rtp_header_length,
int64_t capture_time_ms, StorageType storage) = 0;
};
class RTPSender : public Bitrate, public RTPSenderInterface {
public:
RTPSender(const WebRtc_Word32 id, const bool audio, Clock *clock,
RTPSender(const int32_t id, const bool audio, Clock *clock,
Transport *transport, RtpAudioFeedback *audio_feedback,
PacedSender *paced_sender);
virtual ~RTPSender();
void ProcessBitrate();
WebRtc_UWord16 ActualSendBitrateKbit() const;
uint16_t ActualSendBitrateKbit() const;
WebRtc_UWord32 VideoBitrateSent() const;
WebRtc_UWord32 FecOverheadRate() const;
WebRtc_UWord32 NackOverheadRate() const;
uint32_t VideoBitrateSent() const;
uint32_t FecOverheadRate() const;
uint32_t NackOverheadRate() const;
void SetTargetSendBitrate(const WebRtc_UWord32 bits);
void SetTargetSendBitrate(const uint32_t bits);
WebRtc_UWord16 MaxDataPayloadLength() const; // with RTP and FEC headers.
uint16_t MaxDataPayloadLength() const; // with RTP and FEC headers.
WebRtc_Word32 RegisterPayload(
int32_t RegisterPayload(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payload_type, const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels, const WebRtc_UWord32 rate);
const int8_t payload_type, const uint32_t frequency,
const uint8_t channels, const uint32_t rate);
WebRtc_Word32 DeRegisterSendPayload(const WebRtc_Word8 payload_type);
int32_t DeRegisterSendPayload(const int8_t payload_type);
WebRtc_Word8 SendPayloadType() const;
int8_t SendPayloadType() const;
int SendPayloadFrequency() const;
@ -96,63 +96,63 @@ class RTPSender : public Bitrate, public RTPSenderInterface {
bool SendingMedia() const;
// Number of sent RTP packets.
WebRtc_UWord32 Packets() const;
uint32_t Packets() const;
// Number of sent RTP bytes.
WebRtc_UWord32 Bytes() const;
uint32_t Bytes() const;
void ResetDataCounters();
WebRtc_UWord32 StartTimestamp() const;
void SetStartTimestamp(WebRtc_UWord32 timestamp, bool force);
uint32_t StartTimestamp() const;
void SetStartTimestamp(uint32_t timestamp, bool force);
WebRtc_UWord32 GenerateNewSSRC();
void SetSSRC(const WebRtc_UWord32 ssrc);
uint32_t GenerateNewSSRC();
void SetSSRC(const uint32_t ssrc);
WebRtc_UWord16 SequenceNumber() const;
void SetSequenceNumber(WebRtc_UWord16 seq);
uint16_t SequenceNumber() const;
void SetSequenceNumber(uint16_t seq);
WebRtc_Word32 CSRCs(WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize]) const;
int32_t CSRCs(uint32_t arr_of_csrc[kRtpCsrcSize]) const;
void SetCSRCStatus(const bool include);
void SetCSRCs(const WebRtc_UWord32 arr_of_csrc[kRtpCsrcSize],
const WebRtc_UWord8 arr_length);
void SetCSRCs(const uint32_t arr_of_csrc[kRtpCsrcSize],
const uint8_t arr_length);
WebRtc_Word32 SetMaxPayloadLength(const WebRtc_UWord16 length,
const WebRtc_UWord16 packet_over_head);
int32_t SetMaxPayloadLength(const uint16_t length,
const uint16_t packet_over_head);
WebRtc_Word32 SendOutgoingData(
const FrameType frame_type, const WebRtc_Word8 payload_type,
const WebRtc_UWord32 time_stamp, int64_t capture_time_ms,
const WebRtc_UWord8 *payload_data, const WebRtc_UWord32 payload_size,
int32_t SendOutgoingData(
const FrameType frame_type, const int8_t payload_type,
const uint32_t time_stamp, int64_t capture_time_ms,
const uint8_t *payload_data, const uint32_t payload_size,
const RTPFragmentationHeader *fragmentation,
VideoCodecInformation *codec_info = NULL,
const RTPVideoTypeHeader * rtp_type_hdr = NULL);
WebRtc_Word32 SendPadData(WebRtc_Word8 payload_type,
WebRtc_UWord32 capture_timestamp,
int64_t capture_time_ms, WebRtc_Word32 bytes);
int32_t SendPadData(int8_t payload_type,
uint32_t capture_timestamp,
int64_t capture_time_ms, int32_t bytes);
// RTP header extension
WebRtc_Word32 SetTransmissionTimeOffset(
const WebRtc_Word32 transmission_time_offset);
int32_t SetTransmissionTimeOffset(
const int32_t transmission_time_offset);
WebRtc_Word32 RegisterRtpHeaderExtension(const RTPExtensionType type,
const WebRtc_UWord8 id);
int32_t RegisterRtpHeaderExtension(const RTPExtensionType type,
const uint8_t id);
WebRtc_Word32 DeregisterRtpHeaderExtension(const RTPExtensionType type);
int32_t DeregisterRtpHeaderExtension(const RTPExtensionType type);
WebRtc_UWord16 RtpHeaderExtensionTotalLength() const;
uint16_t RtpHeaderExtensionTotalLength() const;
WebRtc_UWord16 BuildRTPHeaderExtension(WebRtc_UWord8 *data_buffer) const;
uint16_t BuildRTPHeaderExtension(uint8_t *data_buffer) const;
WebRtc_UWord8 BuildTransmissionTimeOffsetExtension(
WebRtc_UWord8 *data_buffer) const;
uint8_t BuildTransmissionTimeOffsetExtension(
uint8_t *data_buffer) const;
bool UpdateTransmissionTimeOffset(WebRtc_UWord8 *rtp_packet,
const WebRtc_UWord16 rtp_packet_length,
bool UpdateTransmissionTimeOffset(uint8_t *rtp_packet,
const uint16_t rtp_packet_length,
const WebRtcRTPHeader &rtp_header,
const WebRtc_Word64 time_diff_ms) const;
const int64_t time_diff_ms) const;
void TimeToSendPacket(uint16_t sequence_number, int64_t capture_time_ms);
@ -160,113 +160,109 @@ class RTPSender : public Bitrate, public RTPSenderInterface {
int SelectiveRetransmissions() const;
int SetSelectiveRetransmissions(uint8_t settings);
void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers,
const WebRtc_UWord16 avg_rtt);
const uint16_t avg_rtt);
void SetStorePacketsStatus(const bool enable,
const WebRtc_UWord16 number_to_store);
const uint16_t number_to_store);
bool StorePackets() const;
WebRtc_Word32 ReSendPacket(WebRtc_UWord16 packet_id,
WebRtc_UWord32 min_resend_time = 0);
int32_t ReSendPacket(uint16_t packet_id, uint32_t min_resend_time = 0);
WebRtc_Word32 ReSendToNetwork(const WebRtc_UWord8 *packet,
const WebRtc_UWord32 size);
int32_t ReSendToNetwork(const uint8_t *packet, const uint32_t size);
bool ProcessNACKBitRate(const WebRtc_UWord32 now);
bool ProcessNACKBitRate(const uint32_t now);
// RTX.
void SetRTXStatus(const RtxMode mode, const bool set_ssrc,
const WebRtc_UWord32 SSRC);
const uint32_t SSRC);
void RTXStatus(RtxMode* mode, WebRtc_UWord32 *SSRC) const;
void RTXStatus(RtxMode* mode, uint32_t *SSRC) const;
// Functions wrapping RTPSenderInterface.
virtual WebRtc_Word32 BuildRTPheader(
WebRtc_UWord8 *data_buffer, const WebRtc_Word8 payload_type,
const bool marker_bit, const WebRtc_UWord32 capture_time_stamp,
virtual int32_t BuildRTPheader(
uint8_t *data_buffer, const int8_t payload_type,
const bool marker_bit, const uint32_t capture_time_stamp,
const bool time_stamp_provided = true,
const bool inc_sequence_number = true);
virtual WebRtc_UWord16 RTPHeaderLength() const;
virtual WebRtc_UWord16 IncrementSequenceNumber();
virtual WebRtc_UWord16 MaxPayloadLength() const;
virtual WebRtc_UWord16 PacketOverHead() const;
virtual uint16_t RTPHeaderLength() const;
virtual uint16_t IncrementSequenceNumber();
virtual uint16_t MaxPayloadLength() const;
virtual uint16_t PacketOverHead() const;
// Current timestamp.
virtual WebRtc_UWord32 Timestamp() const;
virtual WebRtc_UWord32 SSRC() const;
virtual uint32_t Timestamp() const;
virtual uint32_t SSRC() const;
virtual WebRtc_Word32 SendToNetwork(
virtual int32_t SendToNetwork(
uint8_t *data_buffer, int payload_length, int rtp_header_length,
int64_t capture_time_ms, StorageType storage);
// Audio.
// Send a DTMF tone using RFC 2833 (4733).
WebRtc_Word32 SendTelephoneEvent(const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level);
int32_t SendTelephoneEvent(const uint8_t key,
const uint16_t time_ms,
const uint8_t level);
bool SendTelephoneEventActive(WebRtc_Word8 *telephone_event) const;
bool SendTelephoneEventActive(int8_t *telephone_event) const;
// Set audio packet size, used to determine when it's time to send a DTMF
// packet in silence (CNG).
WebRtc_Word32 SetAudioPacketSize(const WebRtc_UWord16 packet_size_samples);
int32_t SetAudioPacketSize(const uint16_t packet_size_samples);
// Set status and ID for header-extension-for-audio-level-indication.
WebRtc_Word32 SetAudioLevelIndicationStatus(const bool enable,
const WebRtc_UWord8 ID);
int32_t SetAudioLevelIndicationStatus(const bool enable, const uint8_t ID);
// Get status and ID for header-extension-for-audio-level-indication.
WebRtc_Word32 AudioLevelIndicationStatus(bool *enable,
WebRtc_UWord8 *id) const;
int32_t AudioLevelIndicationStatus(bool *enable, uint8_t *id) const;
// Store the audio level in d_bov for
// header-extension-for-audio-level-indication.
WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_d_bov);
int32_t SetAudioLevel(const uint8_t level_d_bov);
// Set payload type for Redundant Audio Data RFC 2198.
WebRtc_Word32 SetRED(const WebRtc_Word8 payload_type);
int32_t SetRED(const int8_t payload_type);
// Get payload type for Redundant Audio Data RFC 2198.
WebRtc_Word32 RED(WebRtc_Word8 *payload_type) const;
int32_t RED(int8_t *payload_type) const;
// Video.
VideoCodecInformation *CodecInformationVideo();
RtpVideoCodecTypes VideoCodecType() const;
WebRtc_UWord32 MaxConfiguredBitrateVideo() const;
uint32_t MaxConfiguredBitrateVideo() const;
WebRtc_Word32 SendRTPIntraRequest();
int32_t SendRTPIntraRequest();
// FEC.
WebRtc_Word32 SetGenericFECStatus(const bool enable,
const WebRtc_UWord8 payload_type_red,
const WebRtc_UWord8 payload_type_fec);
int32_t SetGenericFECStatus(const bool enable,
const uint8_t payload_type_red,
const uint8_t payload_type_fec);
WebRtc_Word32 GenericFECStatus(bool *enable, WebRtc_UWord8 *payload_type_red,
WebRtc_UWord8 *payload_type_fec) const;
int32_t GenericFECStatus(bool *enable, uint8_t *payload_type_red,
uint8_t *payload_type_fec) const;
WebRtc_Word32 SetFecParameters(const FecProtectionParams *delta_params,
const FecProtectionParams *key_params);
int32_t SetFecParameters(const FecProtectionParams *delta_params,
const FecProtectionParams *key_params);
protected:
WebRtc_Word32 CheckPayloadType(const WebRtc_Word8 payload_type,
RtpVideoCodecTypes *video_type);
int32_t CheckPayloadType(const int8_t payload_type,
RtpVideoCodecTypes *video_type);
private:
void UpdateNACKBitRate(const WebRtc_UWord32 bytes, const WebRtc_UWord32 now);
void UpdateNACKBitRate(const uint32_t bytes, const uint32_t now);
WebRtc_Word32 SendPaddingAccordingToBitrate(WebRtc_Word8 payload_type,
WebRtc_UWord32 capture_timestamp,
int64_t capture_time_ms);
int32_t SendPaddingAccordingToBitrate(int8_t payload_type,
uint32_t capture_timestamp,
int64_t capture_time_ms);
void BuildRtxPacket(WebRtc_UWord8* buffer, WebRtc_UWord16* length,
WebRtc_UWord8* buffer_rtx);
void BuildRtxPacket(uint8_t* buffer, uint16_t* length,
uint8_t* buffer_rtx);
WebRtc_Word32 id_;
int32_t id_;
const bool audio_configured_;
RTPSenderAudio *audio_;
RTPSenderVideo *video_;
@ -277,43 +273,43 @@ class RTPSender : public Bitrate, public RTPSenderInterface {
Transport *transport_;
bool sending_media_;
WebRtc_UWord16 max_payload_length_;
WebRtc_UWord16 target_send_bitrate_;
WebRtc_UWord16 packet_over_head_;
uint16_t max_payload_length_;
uint16_t target_send_bitrate_;
uint16_t packet_over_head_;
WebRtc_Word8 payload_type_;
std::map<WebRtc_Word8, ModuleRTPUtility::Payload *> payload_type_map_;
int8_t payload_type_;
std::map<int8_t, ModuleRTPUtility::Payload *> payload_type_map_;
RtpHeaderExtensionMap rtp_header_extension_map_;
WebRtc_Word32 transmission_time_offset_;
int32_t transmission_time_offset_;
// NACK
WebRtc_UWord32 nack_byte_count_times_[NACK_BYTECOUNT_SIZE];
WebRtc_Word32 nack_byte_count_[NACK_BYTECOUNT_SIZE];
uint32_t nack_byte_count_times_[NACK_BYTECOUNT_SIZE];
int32_t nack_byte_count_[NACK_BYTECOUNT_SIZE];
Bitrate nack_bitrate_;
RTPPacketHistory *packet_history_;
// Statistics
WebRtc_UWord32 packets_sent_;
WebRtc_UWord32 payload_bytes_sent_;
uint32_t packets_sent_;
uint32_t payload_bytes_sent_;
// RTP variables
bool start_time_stamp_forced_;
WebRtc_UWord32 start_time_stamp_;
uint32_t start_time_stamp_;
SSRCDatabase &ssrc_db_;
WebRtc_UWord32 remote_ssrc_;
uint32_t remote_ssrc_;
bool sequence_number_forced_;
WebRtc_UWord16 sequence_number_;
WebRtc_UWord16 sequence_number_rtx_;
uint16_t sequence_number_;
uint16_t sequence_number_rtx_;
bool ssrc_forced_;
WebRtc_UWord32 ssrc_;
WebRtc_UWord32 time_stamp_;
WebRtc_UWord8 csrcs_;
WebRtc_UWord32 csrc_[kRtpCsrcSize];
uint32_t ssrc_;
uint32_t time_stamp_;
uint8_t csrcs_;
uint32_t csrc_[kRtpCsrcSize];
bool include_csrcs_;
RtxMode rtx_;
WebRtc_UWord32 ssrc_rtx_;
uint32_t ssrc_rtx_;
};
} // namespace webrtc

View File

@ -14,7 +14,7 @@
#include <cassert> //assert
namespace webrtc {
RTPSenderAudio::RTPSenderAudio(const WebRtc_Word32 id, Clock* clock,
RTPSenderAudio::RTPSenderAudio(const int32_t id, Clock* clock,
RTPSenderInterface* rtpSender) :
_id(id),
_clock(clock),
@ -51,7 +51,7 @@ RTPSenderAudio::~RTPSenderAudio()
delete _audioFeedbackCritsect;
}
WebRtc_Word32
int32_t
RTPSenderAudio::RegisterAudioCallback(RtpAudioFeedback* messagesCallback)
{
CriticalSectionScoped cs(_audioFeedbackCritsect);
@ -60,7 +60,7 @@ RTPSenderAudio::RegisterAudioCallback(RtpAudioFeedback* messagesCallback)
}
void
RTPSenderAudio::SetAudioFrequency(const WebRtc_UWord32 f)
RTPSenderAudio::SetAudioFrequency(const uint32_t f)
{
CriticalSectionScoped cs(_sendAudioCritsect);
_frequency = f;
@ -74,8 +74,8 @@ RTPSenderAudio::AudioFrequency() const
}
// set audio packet size, used to determine when it's time to send a DTMF packet in silence (CNG)
WebRtc_Word32
RTPSenderAudio::SetAudioPacketSize(const WebRtc_UWord16 packetSizeSamples)
int32_t
RTPSenderAudio::SetAudioPacketSize(const uint16_t packetSizeSamples)
{
CriticalSectionScoped cs(_sendAudioCritsect);
@ -83,12 +83,12 @@ RTPSenderAudio::SetAudioPacketSize(const WebRtc_UWord16 packetSizeSamples)
return 0;
}
WebRtc_Word32 RTPSenderAudio::RegisterAudioPayload(
int32_t RTPSenderAudio::RegisterAudioPayload(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate,
const int8_t payloadType,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate,
ModuleRTPUtility::Payload*& payload) {
CriticalSectionScoped cs(_sendAudioCritsect);
@ -129,7 +129,7 @@ WebRtc_Word32 RTPSenderAudio::RegisterAudioPayload(
bool
RTPSenderAudio::MarkerBit(const FrameType frameType,
const WebRtc_Word8 payloadType)
const int8_t payloadType)
{
CriticalSectionScoped cs(_sendAudioCritsect);
@ -210,14 +210,14 @@ RTPSenderAudio::MarkerBit(const FrameType frameType,
}
bool
RTPSenderAudio::SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const
RTPSenderAudio::SendTelephoneEventActive(int8_t& telephoneEvent) const
{
if(_dtmfEventIsOn)
{
telephoneEvent = _dtmfKey;
return true;
}
WebRtc_Word64 delaySinceLastDTMF = _clock->TimeInMilliseconds() -
int64_t delaySinceLastDTMF = _clock->TimeInMilliseconds() -
_dtmfTimeLastSent;
if(delaySinceLastDTMF < 100)
{
@ -228,25 +228,25 @@ RTPSenderAudio::SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const
return false;
}
WebRtc_Word32 RTPSenderAudio::SendAudio(
int32_t RTPSenderAudio::SendAudio(
const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 dataSize,
const int8_t payloadType,
const uint32_t captureTimeStamp,
const uint8_t* payloadData,
const uint32_t dataSize,
const RTPFragmentationHeader* fragmentation) {
// TODO(pwestin) Breakup function in smaller functions.
WebRtc_UWord16 payloadSize = static_cast<WebRtc_UWord16>(dataSize);
WebRtc_UWord16 maxPayloadLength = _rtpSender->MaxPayloadLength();
uint16_t payloadSize = static_cast<uint16_t>(dataSize);
uint16_t maxPayloadLength = _rtpSender->MaxPayloadLength();
bool dtmfToneStarted = false;
WebRtc_UWord16 dtmfLengthMS = 0;
WebRtc_UWord8 key = 0;
uint16_t dtmfLengthMS = 0;
uint8_t key = 0;
// Check if we have pending DTMFs to send
if (!_dtmfEventIsOn && PendingDTMF()) {
CriticalSectionScoped cs(_sendAudioCritsect);
WebRtc_Word64 delaySinceLastDTMF = _clock->TimeInMilliseconds() -
int64_t delaySinceLastDTMF = _clock->TimeInMilliseconds() -
_dtmfTimeLastSent;
if (delaySinceLastDTMF > 100) {
@ -285,7 +285,7 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
}
}
_dtmfTimestampLastSent = captureTimeStamp;
WebRtc_UWord32 dtmfDurationSamples = captureTimeStamp - _dtmfTimestamp;
uint32_t dtmfDurationSamples = captureTimeStamp - _dtmfTimestamp;
bool ended = false;
bool send = true;
@ -305,7 +305,7 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
if (dtmfDurationSamples > 0xffff) {
// RFC 4733 2.5.2.3 Long-Duration Events
SendTelephoneEventPacket(ended, _dtmfTimestamp,
static_cast<WebRtc_UWord16>(0xffff), false);
static_cast<uint16_t>(0xffff), false);
// set new timestap for this segment
_dtmfTimestamp = captureTimeStamp;
@ -315,7 +315,7 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
return SendTelephoneEventPacket(
ended,
_dtmfTimestamp,
static_cast<WebRtc_UWord16>(dtmfDurationSamples),
static_cast<uint16_t>(dtmfDurationSamples),
false);
} else {
// set markerBit on the first packet in the burst
@ -323,7 +323,7 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
return SendTelephoneEventPacket(
ended,
_dtmfTimestamp,
static_cast<WebRtc_UWord16>(dtmfDurationSamples),
static_cast<uint16_t>(dtmfDurationSamples),
!_dtmfEventFirstPacketSent);
}
}
@ -339,21 +339,21 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
}
return -1;
}
WebRtc_UWord8 dataBuffer[IP_PACKET_SIZE];
uint8_t dataBuffer[IP_PACKET_SIZE];
bool markerBit = MarkerBit(frameType, payloadType);
WebRtc_Word32 rtpHeaderLength = 0;
WebRtc_UWord16 timestampOffset = 0;
int32_t rtpHeaderLength = 0;
uint16_t timestampOffset = 0;
if (_REDPayloadType >= 0 && fragmentation && !markerBit &&
fragmentation->fragmentationVectorSize > 1) {
// have we configured RED? use its payload type
// we need to get the current timestamp to calc the diff
WebRtc_UWord32 oldTimeStamp = _rtpSender->Timestamp();
uint32_t oldTimeStamp = _rtpSender->Timestamp();
rtpHeaderLength = _rtpSender->BuildRTPheader(dataBuffer, _REDPayloadType,
markerBit, captureTimeStamp);
timestampOffset = WebRtc_UWord16(_rtpSender->Timestamp() - oldTimeStamp);
timestampOffset = uint16_t(_rtpSender->Timestamp() - oldTimeStamp);
} else {
rtpHeaderLength = _rtpSender->BuildRTPheader(dataBuffer, payloadType,
markerBit, captureTimeStamp);
@ -382,19 +382,19 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
rtpHeaderLength += 2;
// add the length (length=1) in number of word32
const WebRtc_UWord8 length = 1;
const uint8_t length = 1;
ModuleRTPUtility::AssignUWord16ToBuffer(dataBuffer+rtpHeaderLength,
length);
rtpHeaderLength += 2;
// add ID (defined by the user) and len(=0) byte
const WebRtc_UWord8 id = _audioLevelIndicationID;
const WebRtc_UWord8 len = 0;
const uint8_t id = _audioLevelIndicationID;
const uint8_t len = 0;
dataBuffer[rtpHeaderLength++] = (id << 4) + len;
// add voice-activity flag (V) bit and the audio level (in dBov)
const WebRtc_UWord8 V = (frameType == kAudioFrameSpeech);
WebRtc_UWord8 level = _audioLevel_dBov;
const uint8_t V = (frameType == kAudioFrameSpeech);
uint8_t level = _audioLevel_dBov;
dataBuffer[rtpHeaderLength++] = (V << 7) + level;
// add two bytes zero padding
@ -419,13 +419,13 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
// only 0x80 if we have multiple blocks
dataBuffer[rtpHeaderLength++] = 0x80 +
fragmentation->fragmentationPlType[1];
WebRtc_UWord32 blockLength = fragmentation->fragmentationLength[1];
uint32_t blockLength = fragmentation->fragmentationLength[1];
// sanity blockLength
if(blockLength > 0x3ff) { // block length 10 bits 1023 bytes
return -1;
}
WebRtc_UWord32 REDheader = (timestampOffset << 10) + blockLength;
uint32_t REDheader = (timestampOffset << 10) + blockLength;
ModuleRTPUtility::AssignUWord24ToBuffer(dataBuffer + rtpHeaderLength,
REDheader);
rtpHeaderLength += 3;
@ -442,7 +442,7 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
payloadData + fragmentation->fragmentationOffset[0],
fragmentation->fragmentationLength[0]);
payloadSize = static_cast<WebRtc_UWord16>(
payloadSize = static_cast<uint16_t>(
fragmentation->fragmentationLength[0] +
fragmentation->fragmentationLength[1]);
} else {
@ -452,7 +452,7 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
payloadData + fragmentation->fragmentationOffset[0],
fragmentation->fragmentationLength[0]);
payloadSize = static_cast<WebRtc_UWord16>(
payloadSize = static_cast<uint16_t>(
fragmentation->fragmentationLength[0]);
}
} else {
@ -463,7 +463,7 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
payloadData + fragmentation->fragmentationOffset[0],
fragmentation->fragmentationLength[0]);
payloadSize = static_cast<WebRtc_UWord16>(
payloadSize = static_cast<uint16_t>(
fragmentation->fragmentationLength[0]);
} else {
memcpy(dataBuffer+rtpHeaderLength, payloadData, payloadSize);
@ -473,14 +473,14 @@ WebRtc_Word32 RTPSenderAudio::SendAudio(
} // end critical section
return _rtpSender->SendToNetwork(dataBuffer,
payloadSize,
static_cast<WebRtc_UWord16>(rtpHeaderLength),
static_cast<uint16_t>(rtpHeaderLength),
-1,
kAllowRetransmission);
}
WebRtc_Word32
int32_t
RTPSenderAudio::SetAudioLevelIndicationStatus(const bool enable,
const WebRtc_UWord8 ID)
const uint8_t ID)
{
if(ID < 1 || ID > 14)
{
@ -494,9 +494,9 @@ RTPSenderAudio::SetAudioLevelIndicationStatus(const bool enable,
return 0;
}
WebRtc_Word32
int32_t
RTPSenderAudio::AudioLevelIndicationStatus(bool& enable,
WebRtc_UWord8& ID) const
uint8_t& ID) const
{
CriticalSectionScoped cs(_sendAudioCritsect);
enable = _includeAudioLevelIndication;
@ -505,8 +505,8 @@ RTPSenderAudio::AudioLevelIndicationStatus(bool& enable,
}
// Audio level magnitude and voice activity flag are set for each RTP packet
WebRtc_Word32
RTPSenderAudio::SetAudioLevel(const WebRtc_UWord8 level_dBov)
int32_t
RTPSenderAudio::SetAudioLevel(const uint8_t level_dBov)
{
if (level_dBov > 127)
{
@ -518,8 +518,8 @@ RTPSenderAudio::SetAudioLevel(const WebRtc_UWord8 level_dBov)
}
// Set payload type for Redundant Audio Data RFC 2198
WebRtc_Word32
RTPSenderAudio::SetRED(const WebRtc_Word8 payloadType)
int32_t
RTPSenderAudio::SetRED(const int8_t payloadType)
{
if(payloadType < -1 )
{
@ -530,8 +530,8 @@ RTPSenderAudio::SetRED(const WebRtc_Word8 payloadType)
}
// Get payload type for Redundant Audio Data RFC 2198
WebRtc_Word32
RTPSenderAudio::RED(WebRtc_Word8& payloadType) const
int32_t
RTPSenderAudio::RED(int8_t& payloadType) const
{
if(_REDPayloadType == -1)
{
@ -543,10 +543,10 @@ RTPSenderAudio::RED(WebRtc_Word8& payloadType) const
}
// Send a TelephoneEvent tone using RFC 2833 (4733)
WebRtc_Word32
RTPSenderAudio::SendTelephoneEvent(const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level)
int32_t
RTPSenderAudio::SendTelephoneEvent(const uint8_t key,
const uint16_t time_ms,
const uint8_t level)
{
// DTMF is protected by its own critsect
if(_dtmfPayloadType < 0)
@ -557,15 +557,15 @@ RTPSenderAudio::SendTelephoneEvent(const WebRtc_UWord8 key,
return AddDTMF(key, time_ms, level);
}
WebRtc_Word32
int32_t
RTPSenderAudio::SendTelephoneEventPacket(const bool ended,
const WebRtc_UWord32 dtmfTimeStamp,
const WebRtc_UWord16 duration,
const uint32_t dtmfTimeStamp,
const uint16_t duration,
const bool markerBit)
{
WebRtc_UWord8 dtmfbuffer[IP_PACKET_SIZE];
WebRtc_UWord8 sendCount = 1;
WebRtc_Word32 retVal = 0;
uint8_t dtmfbuffer[IP_PACKET_SIZE];
uint8_t sendCount = 1;
int32_t retVal = 0;
if(ended)
{
@ -592,11 +592,11 @@ RTPSenderAudio::SendTelephoneEventPacket(const bool ended,
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
// R bit always cleared
WebRtc_UWord8 R = 0x00;
WebRtc_UWord8 volume = _dtmfLevel;
uint8_t R = 0x00;
uint8_t volume = _dtmfLevel;
// First packet un-ended
WebRtc_UWord8 E = 0x00;
uint8_t E = 0x00;
if(ended)
{

View File

@ -24,71 +24,69 @@ namespace webrtc {
class RTPSenderAudio: public DTMFqueue
{
public:
RTPSenderAudio(const WebRtc_Word32 id, Clock* clock,
RTPSenderAudio(const int32_t id, Clock* clock,
RTPSenderInterface* rtpSender);
virtual ~RTPSenderAudio();
WebRtc_Word32 RegisterAudioPayload(
int32_t RegisterAudioPayload(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate,
const int8_t payloadType,
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate,
ModuleRTPUtility::Payload*& payload);
WebRtc_Word32 SendAudio(const FrameType frameType,
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 captureTimeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const RTPFragmentationHeader* fragmentation);
int32_t SendAudio(const FrameType frameType,
const int8_t payloadType,
const uint32_t captureTimeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
const RTPFragmentationHeader* fragmentation);
// set audio packet size, used to determine when it's time to send a DTMF packet in silence (CNG)
WebRtc_Word32 SetAudioPacketSize(const WebRtc_UWord16 packetSizeSamples);
int32_t SetAudioPacketSize(const uint16_t packetSizeSamples);
// Set status and ID for header-extension-for-audio-level-indication.
// Valid ID range is [1,14].
WebRtc_Word32 SetAudioLevelIndicationStatus(const bool enable,
const WebRtc_UWord8 ID);
int32_t SetAudioLevelIndicationStatus(const bool enable, const uint8_t ID);
// Get status and ID for header-extension-for-audio-level-indication.
WebRtc_Word32 AudioLevelIndicationStatus(bool& enable,
WebRtc_UWord8& ID) const;
int32_t AudioLevelIndicationStatus(bool& enable, uint8_t& ID) const;
// Store the audio level in dBov for header-extension-for-audio-level-indication.
// Valid range is [0,100]. Actual value is negative.
WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov);
int32_t SetAudioLevel(const uint8_t level_dBov);
// Send a DTMF tone using RFC 2833 (4733)
WebRtc_Word32 SendTelephoneEvent(const WebRtc_UWord8 key,
const WebRtc_UWord16 time_ms,
const WebRtc_UWord8 level);
int32_t SendTelephoneEvent(const uint8_t key,
const uint16_t time_ms,
const uint8_t level);
bool SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const;
bool SendTelephoneEventActive(int8_t& telephoneEvent) const;
void SetAudioFrequency(const WebRtc_UWord32 f);
void SetAudioFrequency(const uint32_t f);
int AudioFrequency() const;
// Set payload type for Redundant Audio Data RFC 2198
WebRtc_Word32 SetRED(const WebRtc_Word8 payloadType);
int32_t SetRED(const int8_t payloadType);
// Get payload type for Redundant Audio Data RFC 2198
WebRtc_Word32 RED(WebRtc_Word8& payloadType) const;
int32_t RED(int8_t& payloadType) const;
WebRtc_Word32 RegisterAudioCallback(RtpAudioFeedback* messagesCallback);
int32_t RegisterAudioCallback(RtpAudioFeedback* messagesCallback);
protected:
WebRtc_Word32 SendTelephoneEventPacket(const bool ended,
const WebRtc_UWord32 dtmfTimeStamp,
const WebRtc_UWord16 duration,
const bool markerBit); // set on first packet in talk burst
int32_t SendTelephoneEventPacket(const bool ended,
const uint32_t dtmfTimeStamp,
const uint16_t duration,
const bool markerBit); // set on first packet in talk burst
bool MarkerBit(const FrameType frameType,
const WebRtc_Word8 payloadType);
const int8_t payloadType);
private:
WebRtc_Word32 _id;
int32_t _id;
Clock* _clock;
RTPSenderInterface* _rtpSender;
CriticalSectionWrapper* _audioFeedbackCritsect;
@ -96,34 +94,34 @@ private:
CriticalSectionWrapper* _sendAudioCritsect;
WebRtc_UWord32 _frequency;
WebRtc_UWord16 _packetSizeSamples;
uint32_t _frequency;
uint16_t _packetSizeSamples;
// DTMF
bool _dtmfEventIsOn;
bool _dtmfEventFirstPacketSent;
WebRtc_Word8 _dtmfPayloadType;
WebRtc_UWord32 _dtmfTimestamp;
WebRtc_UWord8 _dtmfKey;
WebRtc_UWord32 _dtmfLengthSamples;
WebRtc_UWord8 _dtmfLevel;
WebRtc_Word64 _dtmfTimeLastSent;
WebRtc_UWord32 _dtmfTimestampLastSent;
int8_t _dtmfPayloadType;
uint32_t _dtmfTimestamp;
uint8_t _dtmfKey;
uint32_t _dtmfLengthSamples;
uint8_t _dtmfLevel;
int64_t _dtmfTimeLastSent;
uint32_t _dtmfTimestampLastSent;
WebRtc_Word8 _REDPayloadType;
int8_t _REDPayloadType;
// VAD detection, used for markerbit
bool _inbandVADactive;
WebRtc_Word8 _cngNBPayloadType;
WebRtc_Word8 _cngWBPayloadType;
WebRtc_Word8 _cngSWBPayloadType;
WebRtc_Word8 _cngFBPayloadType;
WebRtc_Word8 _lastPayloadType;
int8_t _cngNBPayloadType;
int8_t _cngWBPayloadType;
int8_t _cngSWBPayloadType;
int8_t _cngFBPayloadType;
int8_t _lastPayloadType;
// Audio level indication (https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/)
bool _includeAudioLevelIndication;
WebRtc_UWord8 _audioLevelIndicationID;
WebRtc_UWord8 _audioLevel_dBov;
uint8_t _audioLevelIndicationID;
uint8_t _audioLevel_dBov;
};
} // namespace webrtc

View File

@ -92,10 +92,10 @@ TEST_F(RtpSenderTest, RegisterRtpHeaderExtension) {
}
TEST_F(RtpSenderTest, BuildRTPPacket) {
WebRtc_Word32 length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
int32_t length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
EXPECT_EQ(12, length);
// Verify
@ -117,10 +117,10 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithTransmissionOffsetExtension) {
EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kTimeOffset));
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId));
WebRtc_Word32 length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
int32_t length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
EXPECT_EQ(12 + rtp_sender_->RtpHeaderExtensionTotalLength(), length);
// Verify
@ -152,10 +152,10 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kNegTimeOffset));
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId));
WebRtc_Word32 length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
int32_t length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
EXPECT_EQ(12 + rtp_sender_->RtpHeaderExtensionTotalLength(), length);
// Verify
@ -174,10 +174,10 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
}
TEST_F(RtpSenderTest, NoTrafficSmoothing) {
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
int32_t rtp_length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
// Packet should be sent immediately.
EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_,
@ -194,10 +194,10 @@ TEST_F(RtpSenderTest, DISABLED_TrafficSmoothing) {
rtp_sender_->SetStorePacketsStatus(true, 10);
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId));
rtp_sender_->SetTargetSendBitrate(300000);
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
int32_t rtp_length = rtp_sender_->BuildRTPheader(packet_,
kPayload,
kMarkerBit,
kTimestamp);
// Packet should be stored in a send bucket.
EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_,
0,

View File

@ -27,11 +27,11 @@ namespace webrtc {
enum { REDForFECHeaderLength = 1 };
struct RtpPacket {
WebRtc_UWord16 rtpHeaderLength;
uint16_t rtpHeaderLength;
ForwardErrorCorrection::Packet* pkt;
};
RTPSenderVideo::RTPSenderVideo(const WebRtc_Word32 id,
RTPSenderVideo::RTPSenderVideo(const int32_t id,
Clock* clock,
RTPSenderInterface* rtpSender) :
_id(id),
@ -83,10 +83,10 @@ RTPSenderVideo::VideoCodecType() const
return _videoType;
}
WebRtc_Word32 RTPSenderVideo::RegisterVideoPayload(
int32_t RTPSenderVideo::RegisterVideoPayload(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 maxBitRate,
const int8_t payloadType,
const uint32_t maxBitRate,
ModuleRTPUtility::Payload*& payload) {
CriticalSectionScoped cs(_sendVideoCritsect);
@ -107,10 +107,10 @@ WebRtc_Word32 RTPSenderVideo::RegisterVideoPayload(
return 0;
}
WebRtc_Word32
RTPSenderVideo::SendVideoPacket(WebRtc_UWord8* data_buffer,
const WebRtc_UWord16 payload_length,
const WebRtc_UWord16 rtp_header_length,
int32_t
RTPSenderVideo::SendVideoPacket(uint8_t* data_buffer,
const uint16_t payload_length,
const uint16_t rtp_header_length,
int64_t capture_time_ms,
StorageType storage,
bool protect) {
@ -188,14 +188,14 @@ RTPSenderVideo::SendVideoPacket(WebRtc_UWord8* data_buffer,
return ret;
}
WebRtc_Word32
int32_t
RTPSenderVideo::SendRTPIntraRequest()
{
// RFC 2032
// 5.2.1. Full intra-frame Request (FIR) packet
WebRtc_UWord16 length = 8;
WebRtc_UWord8 data[8];
uint16_t length = 8;
uint8_t data[8];
data[0] = 0x80;
data[1] = 192;
data[2] = 0;
@ -206,10 +206,10 @@ RTPSenderVideo::SendRTPIntraRequest()
return _rtpSender.SendToNetwork(data, 0, length, -1, kDontStore);
}
WebRtc_Word32
int32_t
RTPSenderVideo::SetGenericFECStatus(const bool enable,
const WebRtc_UWord8 payloadTypeRED,
const WebRtc_UWord8 payloadTypeFEC)
const uint8_t payloadTypeRED,
const uint8_t payloadTypeFEC)
{
_fecEnabled = enable;
_payloadTypeRED = payloadTypeRED;
@ -222,10 +222,10 @@ RTPSenderVideo::SetGenericFECStatus(const bool enable,
return 0;
}
WebRtc_Word32
int32_t
RTPSenderVideo::GenericFECStatus(bool& enable,
WebRtc_UWord8& payloadTypeRED,
WebRtc_UWord8& payloadTypeFEC) const
uint8_t& payloadTypeRED,
uint8_t& payloadTypeFEC) const
{
enable = _fecEnabled;
payloadTypeRED = _payloadTypeRED;
@ -233,7 +233,7 @@ RTPSenderVideo::GenericFECStatus(bool& enable,
return 0;
}
WebRtc_UWord16
uint16_t
RTPSenderVideo::FECPacketOverhead() const
{
if (_fecEnabled)
@ -244,7 +244,7 @@ RTPSenderVideo::FECPacketOverhead() const
return 0;
}
WebRtc_Word32 RTPSenderVideo::SetFecParameters(
int32_t RTPSenderVideo::SetFecParameters(
const FecProtectionParams* delta_params,
const FecProtectionParams* key_params) {
assert(delta_params);
@ -254,14 +254,14 @@ WebRtc_Word32 RTPSenderVideo::SetFecParameters(
return 0;
}
WebRtc_Word32
int32_t
RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
const FrameType frameType,
const WebRtc_Word8 payloadType,
const int8_t payloadType,
const uint32_t captureTimeStamp,
int64_t capture_time_ms,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const uint8_t* payloadData,
const uint32_t payloadSize,
const RTPFragmentationHeader* fragmentation,
VideoCodecInformation* codecInfo,
const RTPVideoTypeHeader* rtpTypeHdr)
@ -283,7 +283,7 @@ RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
// Will be extracted in SendVP8 for VP8 codec; other codecs use 0
_numberFirstPartition = 0;
WebRtc_Word32 retVal = -1;
int32_t retVal = -1;
switch(videoType)
{
case kRtpGenericVideo:
@ -375,33 +375,33 @@ RTPSenderVideo::CodecInformationVideo()
}
void
RTPSenderVideo::SetMaxConfiguredBitrateVideo(const WebRtc_UWord32 maxBitrate)
RTPSenderVideo::SetMaxConfiguredBitrateVideo(const uint32_t maxBitrate)
{
_maxBitrate = maxBitrate;
}
WebRtc_UWord32
uint32_t
RTPSenderVideo::MaxConfiguredBitrateVideo() const
{
return _maxBitrate;
}
WebRtc_Word32
int32_t
RTPSenderVideo::SendVP8(const FrameType frameType,
const WebRtc_Word8 payloadType,
const int8_t payloadType,
const uint32_t captureTimeStamp,
int64_t capture_time_ms,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const uint8_t* payloadData,
const uint32_t payloadSize,
const RTPFragmentationHeader* fragmentation,
const RTPVideoTypeHeader* rtpTypeHdr)
{
const WebRtc_UWord16 rtpHeaderLength = _rtpSender.RTPHeaderLength();
const uint16_t rtpHeaderLength = _rtpSender.RTPHeaderLength();
WebRtc_Word32 payloadBytesToSend = payloadSize;
const WebRtc_UWord8* data = payloadData;
int32_t payloadBytesToSend = payloadSize;
const uint8_t* data = payloadData;
WebRtc_UWord16 maxPayloadLengthVP8 = _rtpSender.MaxDataPayloadLength();
uint16_t maxPayloadLengthVP8 = _rtpSender.MaxDataPayloadLength();
assert(rtpTypeHdr);
// Initialize disregarding partition boundaries: this will use kEqualSize
@ -427,7 +427,7 @@ RTPSenderVideo::SendVP8(const FrameType frameType,
while (!last)
{
// Write VP8 Payload Descriptor and VP8 payload.
WebRtc_UWord8 dataBuffer[IP_PACKET_SIZE] = {0};
uint8_t dataBuffer[IP_PACKET_SIZE] = {0};
int payloadBytesInPacket = 0;
int packetStartPartition =
packetizer.NextPacket(&dataBuffer[rtpHeaderLength],
@ -465,11 +465,11 @@ void RTPSenderVideo::ProcessBitrate() {
_fecOverheadRate.Process();
}
WebRtc_UWord32 RTPSenderVideo::VideoBitrateSent() const {
uint32_t RTPSenderVideo::VideoBitrateSent() const {
return _videoBitrate.BitrateLast();
}
WebRtc_UWord32 RTPSenderVideo::FecOverheadRate() const {
uint32_t RTPSenderVideo::FecOverheadRate() const {
return _fecOverheadRate.BitrateLast();
}

View File

@ -33,100 +33,100 @@ struct RtpPacket;
class RTPSenderVideo
{
public:
RTPSenderVideo(const WebRtc_Word32 id, Clock* clock,
RTPSenderVideo(const int32_t id, Clock* clock,
RTPSenderInterface* rtpSender);
virtual ~RTPSenderVideo();
virtual RtpVideoCodecTypes VideoCodecType() const;
WebRtc_UWord16 FECPacketOverhead() const;
uint16_t FECPacketOverhead() const;
WebRtc_Word32 RegisterVideoPayload(
int32_t RegisterVideoPayload(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_Word8 payloadType,
const WebRtc_UWord32 maxBitRate,
const int8_t payloadType,
const uint32_t maxBitRate,
ModuleRTPUtility::Payload*& payload);
WebRtc_Word32 SendVideo(const RtpVideoCodecTypes videoType,
const FrameType frameType,
const WebRtc_Word8 payloadType,
const uint32_t captureTimeStamp,
int64_t capture_time_ms,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const RTPFragmentationHeader* fragmentation,
VideoCodecInformation* codecInfo,
const RTPVideoTypeHeader* rtpTypeHdr);
int32_t SendVideo(const RtpVideoCodecTypes videoType,
const FrameType frameType,
const int8_t payloadType,
const uint32_t captureTimeStamp,
int64_t capture_time_ms,
const uint8_t* payloadData,
const uint32_t payloadSize,
const RTPFragmentationHeader* fragmentation,
VideoCodecInformation* codecInfo,
const RTPVideoTypeHeader* rtpTypeHdr);
WebRtc_Word32 SendRTPIntraRequest();
int32_t SendRTPIntraRequest();
void SetVideoCodecType(RtpVideoCodecTypes type);
VideoCodecInformation* CodecInformationVideo();
void SetMaxConfiguredBitrateVideo(const WebRtc_UWord32 maxBitrate);
void SetMaxConfiguredBitrateVideo(const uint32_t maxBitrate);
WebRtc_UWord32 MaxConfiguredBitrateVideo() const;
uint32_t MaxConfiguredBitrateVideo() const;
// FEC
WebRtc_Word32 SetGenericFECStatus(const bool enable,
const WebRtc_UWord8 payloadTypeRED,
const WebRtc_UWord8 payloadTypeFEC);
int32_t SetGenericFECStatus(const bool enable,
const uint8_t payloadTypeRED,
const uint8_t payloadTypeFEC);
WebRtc_Word32 GenericFECStatus(bool& enable,
WebRtc_UWord8& payloadTypeRED,
WebRtc_UWord8& payloadTypeFEC) const;
int32_t GenericFECStatus(bool& enable,
uint8_t& payloadTypeRED,
uint8_t& payloadTypeFEC) const;
WebRtc_Word32 SetFecParameters(const FecProtectionParams* delta_params,
const FecProtectionParams* key_params);
int32_t SetFecParameters(const FecProtectionParams* delta_params,
const FecProtectionParams* key_params);
void ProcessBitrate();
WebRtc_UWord32 VideoBitrateSent() const;
WebRtc_UWord32 FecOverheadRate() const;
uint32_t VideoBitrateSent() const;
uint32_t FecOverheadRate() const;
int SelectiveRetransmissions() const;
int SetSelectiveRetransmissions(uint8_t settings);
protected:
virtual WebRtc_Word32 SendVideoPacket(WebRtc_UWord8* dataBuffer,
const WebRtc_UWord16 payloadLength,
const WebRtc_UWord16 rtpHeaderLength,
int64_t capture_time_ms,
StorageType storage,
bool protect);
virtual int32_t SendVideoPacket(uint8_t* dataBuffer,
const uint16_t payloadLength,
const uint16_t rtpHeaderLength,
int64_t capture_time_ms,
StorageType storage,
bool protect);
private:
WebRtc_Word32 SendGeneric(const FrameType frame_type,
const int8_t payload_type,
const uint32_t capture_timestamp,
int64_t capture_time_ms,
const uint8_t* payload, const uint32_t size);
WebRtc_Word32 SendVP8(const FrameType frameType,
const WebRtc_Word8 payloadType,
const uint32_t captureTimeStamp,
int32_t SendGeneric(const FrameType frame_type,
const int8_t payload_type,
const uint32_t capture_timestamp,
int64_t capture_time_ms,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
const RTPFragmentationHeader* fragmentation,
const RTPVideoTypeHeader* rtpTypeHdr);
const uint8_t* payload, const uint32_t size);
int32_t SendVP8(const FrameType frameType,
const int8_t payloadType,
const uint32_t captureTimeStamp,
int64_t capture_time_ms,
const uint8_t* payloadData,
const uint32_t payloadSize,
const RTPFragmentationHeader* fragmentation,
const RTPVideoTypeHeader* rtpTypeHdr);
private:
WebRtc_Word32 _id;
int32_t _id;
RTPSenderInterface& _rtpSender;
CriticalSectionWrapper* _sendVideoCritsect;
RtpVideoCodecTypes _videoType;
VideoCodecInformation* _videoCodecInformation;
WebRtc_UWord32 _maxBitrate;
WebRtc_Word32 _retransmissionSettings;
uint32_t _maxBitrate;
int32_t _retransmissionSettings;
// FEC
ForwardErrorCorrection _fec;
bool _fecEnabled;
WebRtc_Word8 _payloadTypeRED;
WebRtc_Word8 _payloadTypeFEC;
int8_t _payloadTypeRED;
int8_t _payloadTypeFEC;
unsigned int _numberFirstPartition;
FecProtectionParams delta_fec_params_;
FecProtectionParams key_fec_params_;

View File

@ -54,13 +54,13 @@ enum {
* Time routines.
*/
WebRtc_UWord32 GetCurrentRTP(Clock* clock, WebRtc_UWord32 freq) {
uint32_t GetCurrentRTP(Clock* clock, uint32_t freq) {
const bool use_global_clock = (clock == NULL);
Clock* local_clock = clock;
if (use_global_clock) {
local_clock = Clock::GetRealTimeClock();
}
WebRtc_UWord32 secs = 0, frac = 0;
uint32_t secs = 0, frac = 0;
local_clock->CurrentNtp(secs, frac);
if (use_global_clock) {
delete local_clock;
@ -68,20 +68,17 @@ WebRtc_UWord32 GetCurrentRTP(Clock* clock, WebRtc_UWord32 freq) {
return ConvertNTPTimeToRTP(secs, frac, freq);
}
WebRtc_UWord32 ConvertNTPTimeToRTP(WebRtc_UWord32 NTPsec,
WebRtc_UWord32 NTPfrac,
WebRtc_UWord32 freq) {
uint32_t ConvertNTPTimeToRTP(uint32_t NTPsec, uint32_t NTPfrac, uint32_t freq) {
float ftemp = (float)NTPfrac / (float)NTP_FRAC;
WebRtc_UWord32 tmp = (WebRtc_UWord32)(ftemp * freq);
uint32_t tmp = (uint32_t)(ftemp * freq);
return NTPsec * freq + tmp;
}
WebRtc_UWord32 ConvertNTPTimeToMS(WebRtc_UWord32 NTPsec,
WebRtc_UWord32 NTPfrac) {
uint32_t ConvertNTPTimeToMS(uint32_t NTPsec, uint32_t NTPfrac) {
int freq = 1000;
float ftemp = (float)NTPfrac / (float)NTP_FRAC;
WebRtc_UWord32 tmp = (WebRtc_UWord32)(ftemp * freq);
WebRtc_UWord32 MStime = NTPsec * freq + tmp;
uint32_t tmp = (uint32_t)(ftemp * freq);
uint32_t MStime = NTPsec * freq + tmp;
return MStime;
}
@ -107,26 +104,26 @@ bool OldTimestamp(uint32_t newTimestamp,
* Misc utility routines
*/
const WebRtc_UWord8* GetPayloadData(const WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* packet) {
const uint8_t* GetPayloadData(const WebRtcRTPHeader* rtp_header,
const uint8_t* packet) {
return packet + rtp_header->header.headerLength;
}
WebRtc_UWord16 GetPayloadDataLength(const WebRtcRTPHeader* rtp_header,
const WebRtc_UWord16 packet_length) {
WebRtc_UWord16 length = packet_length - rtp_header->header.paddingLength -
uint16_t GetPayloadDataLength(const WebRtcRTPHeader* rtp_header,
const uint16_t packet_length) {
uint16_t length = packet_length - rtp_header->header.paddingLength -
rtp_header->header.headerLength;
return static_cast<WebRtc_UWord16>(length);
return static_cast<uint16_t>(length);
}
#if defined(_WIN32)
bool StringCompare(const char* str1, const char* str2,
const WebRtc_UWord32 length) {
const uint32_t length) {
return (_strnicmp(str1, str2, length) == 0) ? true : false;
}
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
bool StringCompare(const char* str1, const char* str2,
const WebRtc_UWord32 length) {
const uint32_t length) {
return (strncasecmp(str1, str2, length) == 0) ? true : false;
}
#endif
@ -139,62 +136,62 @@ bool StringCompare(const char* str1, const char* str2,
All integer fields are carried in network byte order, that is, most
significant byte (octet) first. AKA big-endian.
*/
void AssignUWord32ToBuffer(WebRtc_UWord8* dataBuffer, WebRtc_UWord32 value) {
void AssignUWord32ToBuffer(uint8_t* dataBuffer, uint32_t value) {
#if defined(WEBRTC_LITTLE_ENDIAN)
dataBuffer[0] = static_cast<WebRtc_UWord8>(value >> 24);
dataBuffer[1] = static_cast<WebRtc_UWord8>(value >> 16);
dataBuffer[2] = static_cast<WebRtc_UWord8>(value >> 8);
dataBuffer[3] = static_cast<WebRtc_UWord8>(value);
dataBuffer[0] = static_cast<uint8_t>(value >> 24);
dataBuffer[1] = static_cast<uint8_t>(value >> 16);
dataBuffer[2] = static_cast<uint8_t>(value >> 8);
dataBuffer[3] = static_cast<uint8_t>(value);
#else
WebRtc_UWord32* ptr = reinterpret_cast<WebRtc_UWord32*>(dataBuffer);
uint32_t* ptr = reinterpret_cast<uint32_t*>(dataBuffer);
ptr[0] = value;
#endif
}
void AssignUWord24ToBuffer(WebRtc_UWord8* dataBuffer, WebRtc_UWord32 value) {
void AssignUWord24ToBuffer(uint8_t* dataBuffer, uint32_t value) {
#if defined(WEBRTC_LITTLE_ENDIAN)
dataBuffer[0] = static_cast<WebRtc_UWord8>(value >> 16);
dataBuffer[1] = static_cast<WebRtc_UWord8>(value >> 8);
dataBuffer[2] = static_cast<WebRtc_UWord8>(value);
dataBuffer[0] = static_cast<uint8_t>(value >> 16);
dataBuffer[1] = static_cast<uint8_t>(value >> 8);
dataBuffer[2] = static_cast<uint8_t>(value);
#else
dataBuffer[0] = static_cast<WebRtc_UWord8>(value);
dataBuffer[1] = static_cast<WebRtc_UWord8>(value >> 8);
dataBuffer[2] = static_cast<WebRtc_UWord8>(value >> 16);
dataBuffer[0] = static_cast<uint8_t>(value);
dataBuffer[1] = static_cast<uint8_t>(value >> 8);
dataBuffer[2] = static_cast<uint8_t>(value >> 16);
#endif
}
void AssignUWord16ToBuffer(WebRtc_UWord8* dataBuffer, WebRtc_UWord16 value) {
void AssignUWord16ToBuffer(uint8_t* dataBuffer, uint16_t value) {
#if defined(WEBRTC_LITTLE_ENDIAN)
dataBuffer[0] = static_cast<WebRtc_UWord8>(value >> 8);
dataBuffer[1] = static_cast<WebRtc_UWord8>(value);
dataBuffer[0] = static_cast<uint8_t>(value >> 8);
dataBuffer[1] = static_cast<uint8_t>(value);
#else
WebRtc_UWord16* ptr = reinterpret_cast<WebRtc_UWord16*>(dataBuffer);
uint16_t* ptr = reinterpret_cast<uint16_t*>(dataBuffer);
ptr[0] = value;
#endif
}
WebRtc_UWord16 BufferToUWord16(const WebRtc_UWord8* dataBuffer) {
uint16_t BufferToUWord16(const uint8_t* dataBuffer) {
#if defined(WEBRTC_LITTLE_ENDIAN)
return (dataBuffer[0] << 8) + dataBuffer[1];
#else
return *reinterpret_cast<const WebRtc_UWord16*>(dataBuffer);
return *reinterpret_cast<const uint16_t*>(dataBuffer);
#endif
}
WebRtc_UWord32 BufferToUWord24(const WebRtc_UWord8* dataBuffer) {
uint32_t BufferToUWord24(const uint8_t* dataBuffer) {
return (dataBuffer[0] << 16) + (dataBuffer[1] << 8) + dataBuffer[2];
}
WebRtc_UWord32 BufferToUWord32(const WebRtc_UWord8* dataBuffer) {
uint32_t BufferToUWord32(const uint8_t* dataBuffer) {
#if defined(WEBRTC_LITTLE_ENDIAN)
return (dataBuffer[0] << 24) + (dataBuffer[1] << 16) + (dataBuffer[2] << 8) +
dataBuffer[3];
#else
return *reinterpret_cast<const WebRtc_UWord32*>(dataBuffer);
return *reinterpret_cast<const uint32_t*>(dataBuffer);
#endif
}
WebRtc_UWord32 pow2(WebRtc_UWord8 exp) {
uint32_t pow2(uint8_t exp) {
return 1 << exp;
}
@ -225,8 +222,8 @@ void RTPPayload::SetType(RtpVideoCodecTypes videoType) {
}
}
RTPHeaderParser::RTPHeaderParser(const WebRtc_UWord8* rtpData,
const WebRtc_UWord32 rtpDataLength)
RTPHeaderParser::RTPHeaderParser(const uint8_t* rtpData,
const uint32_t rtpDataLength)
: _ptrRTPDataBegin(rtpData),
_ptrRTPDataEnd(rtpData ? (rtpData + rtpDataLength) : NULL) {
}
@ -279,12 +276,12 @@ bool RTPHeaderParser::RTCP() const {
return false;
}
const WebRtc_UWord8 V = _ptrRTPDataBegin[0] >> 6;
const uint8_t V = _ptrRTPDataBegin[0] >> 6;
if (V != kRtcpExpectedVersion) {
return false;
}
const WebRtc_UWord8 payloadType = _ptrRTPDataBegin[1];
const uint8_t payloadType = _ptrRTPDataBegin[1];
bool RTCP = false;
switch (payloadType) {
case 192:
@ -318,27 +315,27 @@ bool RTPHeaderParser::Parse(WebRtcRTPHeader& parsedPacket,
}
// Version
const WebRtc_UWord8 V = _ptrRTPDataBegin[0] >> 6;
const uint8_t V = _ptrRTPDataBegin[0] >> 6;
// Padding
const bool P = ((_ptrRTPDataBegin[0] & 0x20) == 0) ? false : true;
// eXtension
const bool X = ((_ptrRTPDataBegin[0] & 0x10) == 0) ? false : true;
const WebRtc_UWord8 CC = _ptrRTPDataBegin[0] & 0x0f;
const uint8_t CC = _ptrRTPDataBegin[0] & 0x0f;
const bool M = ((_ptrRTPDataBegin[1] & 0x80) == 0) ? false : true;
const WebRtc_UWord8 PT = _ptrRTPDataBegin[1] & 0x7f;
const uint8_t PT = _ptrRTPDataBegin[1] & 0x7f;
const WebRtc_UWord16 sequenceNumber = (_ptrRTPDataBegin[2] << 8) +
const uint16_t sequenceNumber = (_ptrRTPDataBegin[2] << 8) +
_ptrRTPDataBegin[3];
const WebRtc_UWord8* ptr = &_ptrRTPDataBegin[4];
const uint8_t* ptr = &_ptrRTPDataBegin[4];
WebRtc_UWord32 RTPTimestamp = *ptr++ << 24;
uint32_t RTPTimestamp = *ptr++ << 24;
RTPTimestamp += *ptr++ << 16;
RTPTimestamp += *ptr++ << 8;
RTPTimestamp += *ptr++;
WebRtc_UWord32 SSRC = *ptr++ << 24;
uint32_t SSRC = *ptr++ << 24;
SSRC += *ptr++ << 16;
SSRC += *ptr++ << 8;
SSRC += *ptr++;
@ -347,7 +344,7 @@ bool RTPHeaderParser::Parse(WebRtcRTPHeader& parsedPacket,
return false;
}
const WebRtc_UWord8 CSRCocts = CC * 4;
const uint8_t CSRCocts = CC * 4;
if ((ptr + CSRCocts) > _ptrRTPDataEnd) {
return false;
@ -362,7 +359,7 @@ bool RTPHeaderParser::Parse(WebRtcRTPHeader& parsedPacket,
parsedPacket.header.paddingLength = P ? *(_ptrRTPDataEnd - 1) : 0;
for (unsigned int i = 0; i < CC; ++i) {
WebRtc_UWord32 CSRC = *ptr++ << 24;
uint32_t CSRC = *ptr++ << 24;
CSRC += *ptr++ << 16;
CSRC += *ptr++ << 8;
CSRC += *ptr++;
@ -393,10 +390,10 @@ bool RTPHeaderParser::Parse(WebRtcRTPHeader& parsedPacket,
parsedPacket.header.headerLength += 4;
WebRtc_UWord16 definedByProfile = *ptr++ << 8;
uint16_t definedByProfile = *ptr++ << 8;
definedByProfile += *ptr++;
WebRtc_UWord16 XLen = *ptr++ << 8;
uint16_t XLen = *ptr++ << 8;
XLen += *ptr++; // in 32 bit words
XLen *= 4; // in octs
@ -404,7 +401,7 @@ bool RTPHeaderParser::Parse(WebRtcRTPHeader& parsedPacket,
return false;
}
if (definedByProfile == RTP_ONE_BYTE_HEADER_EXTENSION) {
const WebRtc_UWord8* ptrRTPDataExtensionEnd = ptr + XLen;
const uint8_t* ptrRTPDataExtensionEnd = ptr + XLen;
ParseOneByteExtensionHeader(parsedPacket,
ptrExtensionMap,
ptrRTPDataExtensionEnd,
@ -418,8 +415,8 @@ bool RTPHeaderParser::Parse(WebRtcRTPHeader& parsedPacket,
void RTPHeaderParser::ParseOneByteExtensionHeader(
WebRtcRTPHeader& parsedPacket,
const RtpHeaderExtensionMap* ptrExtensionMap,
const WebRtc_UWord8* ptrRTPDataExtensionEnd,
const WebRtc_UWord8* ptr) const {
const uint8_t* ptrRTPDataExtensionEnd,
const uint8_t* ptr) const {
if (!ptrExtensionMap) {
return;
}
@ -431,8 +428,8 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
// | ID | len |
// +-+-+-+-+-+-+-+-+
const WebRtc_UWord8 id = (*ptr & 0xf0) >> 4;
const WebRtc_UWord8 len = (*ptr & 0x0f);
const uint8_t id = (*ptr & 0xf0) >> 4;
const uint8_t len = (*ptr & 0x0f);
ptr++;
if (id == 15) {
@ -461,7 +458,7 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
// | ID | len=2 | transmission offset |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
WebRtc_Word32 transmissionTimeOffset = *ptr++ << 16;
int32_t transmissionTimeOffset = *ptr++ << 16;
transmissionTimeOffset += *ptr++ << 8;
transmissionTimeOffset += *ptr++;
parsedPacket.extension.transmissionTimeOffset = transmissionTimeOffset;
@ -481,8 +478,8 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
//
// Parse out the fields but only use it for debugging for now.
// const WebRtc_UWord8 V = (*ptr & 0x80) >> 7;
// const WebRtc_UWord8 level = (*ptr & 0x7f);
// const uint8_t V = (*ptr & 0x80) >> 7;
// const uint8_t level = (*ptr & 0x7f);
// DEBUG_PRINT("RTP_AUDIO_LEVEL_UNIQUE_ID: ID=%u, len=%u, V=%u,
// level=%u", ID, len, V, level);
break;
@ -493,16 +490,16 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
return;
}
}
WebRtc_UWord8 num_bytes = ParsePaddingBytes(ptrRTPDataExtensionEnd, ptr);
uint8_t num_bytes = ParsePaddingBytes(ptrRTPDataExtensionEnd, ptr);
ptr += num_bytes;
}
}
WebRtc_UWord8 RTPHeaderParser::ParsePaddingBytes(
const WebRtc_UWord8* ptrRTPDataExtensionEnd,
const WebRtc_UWord8* ptr) const {
uint8_t RTPHeaderParser::ParsePaddingBytes(
const uint8_t* ptrRTPDataExtensionEnd,
const uint8_t* ptr) const {
WebRtc_UWord8 num_zero_bytes = 0;
uint8_t num_zero_bytes = 0;
while (ptrRTPDataExtensionEnd - ptr > 0) {
if (*ptr != 0) {
return num_zero_bytes;
@ -515,9 +512,9 @@ WebRtc_UWord8 RTPHeaderParser::ParsePaddingBytes(
// RTP payload parser
RTPPayloadParser::RTPPayloadParser(const RtpVideoCodecTypes videoType,
const WebRtc_UWord8* payloadData,
WebRtc_UWord16 payloadDataLength,
WebRtc_Word32 id)
const uint8_t* payloadData,
uint16_t payloadDataLength,
int32_t id)
:
_id(id),
_dataPtr(payloadData),
@ -572,7 +569,7 @@ bool RTPPayloadParser::ParseGeneric(RTPPayload& /*parsedPacket*/) const {
bool RTPPayloadParser::ParseVP8(RTPPayload& parsedPacket) const {
RTPPayloadVP8* vp8 = &parsedPacket.info.VP8;
const WebRtc_UWord8* dataPtr = _dataPtr;
const uint8_t* dataPtr = _dataPtr;
int dataLength = _dataLength;
// Parse mandatory first byte of payload descriptor
@ -618,7 +615,7 @@ bool RTPPayloadParser::ParseVP8(RTPPayload& parsedPacket) const {
}
int RTPPayloadParser::ParseVP8FrameSize(RTPPayload& parsedPacket,
const WebRtc_UWord8* dataPtr,
const uint8_t* dataPtr,
int dataLength) const {
if (parsedPacket.frameType != kIFrame) {
// Included in payload header for I-frames.
@ -636,7 +633,7 @@ int RTPPayloadParser::ParseVP8FrameSize(RTPPayload& parsedPacket,
}
int RTPPayloadParser::ParseVP8Extension(RTPPayloadVP8* vp8,
const WebRtc_UWord8* dataPtr,
const uint8_t* dataPtr,
int dataLength) const {
int parsedBytes = 0;
if (dataLength <= 0) return -1;
@ -672,7 +669,7 @@ int RTPPayloadParser::ParseVP8Extension(RTPPayloadVP8* vp8,
}
int RTPPayloadParser::ParseVP8PictureID(RTPPayloadVP8* vp8,
const WebRtc_UWord8** dataPtr,
const uint8_t** dataPtr,
int* dataLength,
int* parsedBytes) const {
if (*dataLength <= 0) return -1;
@ -691,7 +688,7 @@ int RTPPayloadParser::ParseVP8PictureID(RTPPayloadVP8* vp8,
}
int RTPPayloadParser::ParseVP8Tl0PicIdx(RTPPayloadVP8* vp8,
const WebRtc_UWord8** dataPtr,
const uint8_t** dataPtr,
int* dataLength,
int* parsedBytes) const {
if (*dataLength <= 0) return -1;
@ -703,7 +700,7 @@ int RTPPayloadParser::ParseVP8Tl0PicIdx(RTPPayloadVP8* vp8,
}
int RTPPayloadParser::ParseVP8TIDAndKeyIdx(RTPPayloadVP8* vp8,
const WebRtc_UWord8** dataPtr,
const uint8_t** dataPtr,
int* dataLength,
int* parsedBytes) const {
if (*dataLength <= 0) return -1;

View File

@ -26,7 +26,7 @@ enum RtpVideoCodecTypes
kRtpVp8Video = 11
};
const WebRtc_UWord8 kRtpMarkerBitMask = 0x80;
const uint8_t kRtpMarkerBitMask = 0x80;
namespace ModuleRTPUtility
{
@ -38,14 +38,14 @@ namespace ModuleRTPUtility
struct AudioPayload
{
WebRtc_UWord32 frequency;
WebRtc_UWord8 channels;
WebRtc_UWord32 rate;
uint32_t frequency;
uint8_t channels;
uint32_t rate;
};
struct VideoPayload
{
RtpVideoCodecTypes videoCodecType;
WebRtc_UWord32 maxRate;
uint32_t maxRate;
};
union PayloadUnion
{
@ -59,31 +59,31 @@ namespace ModuleRTPUtility
PayloadUnion typeSpecific;
};
typedef std::map<WebRtc_Word8, Payload*> PayloadTypeMap;
typedef std::map<int8_t, Payload*> PayloadTypeMap;
// Return the current RTP timestamp from the NTP timestamp
// returned by the specified clock.
WebRtc_UWord32 GetCurrentRTP(Clock* clock, WebRtc_UWord32 freq);
uint32_t GetCurrentRTP(Clock* clock, uint32_t freq);
// Return the current RTP absolute timestamp.
WebRtc_UWord32 ConvertNTPTimeToRTP(WebRtc_UWord32 NTPsec,
WebRtc_UWord32 NTPfrac,
WebRtc_UWord32 freq);
uint32_t ConvertNTPTimeToRTP(uint32_t NTPsec,
uint32_t NTPfrac,
uint32_t freq);
// Return the time in milliseconds corresponding to the specified
// NTP timestamp.
WebRtc_UWord32 ConvertNTPTimeToMS(WebRtc_UWord32 NTPsec,
WebRtc_UWord32 NTPfrac);
uint32_t ConvertNTPTimeToMS(uint32_t NTPsec,
uint32_t NTPfrac);
WebRtc_UWord32 pow2(WebRtc_UWord8 exp);
uint32_t pow2(uint8_t exp);
// Returns a pointer to the payload data given a packet.
const WebRtc_UWord8* GetPayloadData(const WebRtcRTPHeader* rtp_header,
const WebRtc_UWord8* packet);
const uint8_t* GetPayloadData(const WebRtcRTPHeader* rtp_header,
const uint8_t* packet);
// Returns payload length given a packet.
WebRtc_UWord16 GetPayloadDataLength(const WebRtcRTPHeader* rtp_header,
const WebRtc_UWord16 packet_length);
uint16_t GetPayloadDataLength(const WebRtcRTPHeader* rtp_header,
const uint16_t packet_length);
// Returns true if |newTimestamp| is older than |existingTimestamp|.
// |wrapped| will be set to true if there has been a wraparound between the
@ -94,38 +94,38 @@ namespace ModuleRTPUtility
bool StringCompare(const char* str1,
const char* str2,
const WebRtc_UWord32 length);
const uint32_t length);
void AssignUWord32ToBuffer(WebRtc_UWord8* dataBuffer, WebRtc_UWord32 value);
void AssignUWord24ToBuffer(WebRtc_UWord8* dataBuffer, WebRtc_UWord32 value);
void AssignUWord16ToBuffer(WebRtc_UWord8* dataBuffer, WebRtc_UWord16 value);
void AssignUWord32ToBuffer(uint8_t* dataBuffer, uint32_t value);
void AssignUWord24ToBuffer(uint8_t* dataBuffer, uint32_t value);
void AssignUWord16ToBuffer(uint8_t* dataBuffer, uint16_t value);
/**
* Converts a network-ordered two-byte input buffer to a host-ordered value.
* \param[in] dataBuffer Network-ordered two-byte buffer to convert.
* \return Host-ordered value.
*/
WebRtc_UWord16 BufferToUWord16(const WebRtc_UWord8* dataBuffer);
uint16_t BufferToUWord16(const uint8_t* dataBuffer);
/**
* Converts a network-ordered three-byte input buffer to a host-ordered value.
* \param[in] dataBuffer Network-ordered three-byte buffer to convert.
* \return Host-ordered value.
*/
WebRtc_UWord32 BufferToUWord24(const WebRtc_UWord8* dataBuffer);
uint32_t BufferToUWord24(const uint8_t* dataBuffer);
/**
* Converts a network-ordered four-byte input buffer to a host-ordered value.
* \param[in] dataBuffer Network-ordered four-byte buffer to convert.
* \return Host-ordered value.
*/
WebRtc_UWord32 BufferToUWord32(const WebRtc_UWord8* dataBuffer);
uint32_t BufferToUWord32(const uint8_t* dataBuffer);
class RTPHeaderParser
{
public:
RTPHeaderParser(const WebRtc_UWord8* rtpData,
const WebRtc_UWord32 rtpDataLength);
RTPHeaderParser(const uint8_t* rtpData,
const uint32_t rtpDataLength);
~RTPHeaderParser();
bool RTCP() const;
@ -136,15 +136,15 @@ namespace ModuleRTPUtility
void ParseOneByteExtensionHeader(
WebRtcRTPHeader& parsedPacket,
const RtpHeaderExtensionMap* ptrExtensionMap,
const WebRtc_UWord8* ptrRTPDataExtensionEnd,
const WebRtc_UWord8* ptr) const;
const uint8_t* ptrRTPDataExtensionEnd,
const uint8_t* ptr) const;
WebRtc_UWord8 ParsePaddingBytes(
const WebRtc_UWord8* ptrRTPDataExtensionEnd,
const WebRtc_UWord8* ptr) const;
uint8_t ParsePaddingBytes(
const uint8_t* ptrRTPDataExtensionEnd,
const uint8_t* ptr) const;
const WebRtc_UWord8* const _ptrRTPDataBegin;
const WebRtc_UWord8* const _ptrRTPDataEnd;
const uint8_t* const _ptrRTPDataBegin;
const uint8_t* const _ptrRTPDataEnd;
};
enum FrameTypes
@ -170,8 +170,8 @@ namespace ModuleRTPUtility
int frameWidth;
int frameHeight;
const WebRtc_UWord8* data;
WebRtc_UWord16 dataLength;
const uint8_t* data;
uint16_t dataLength;
};
union RTPPayloadUnion
@ -193,9 +193,9 @@ namespace ModuleRTPUtility
{
public:
RTPPayloadParser(const RtpVideoCodecTypes payloadType,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadDataLength, // Length w/o padding.
const WebRtc_Word32 id);
const uint8_t* payloadData,
const uint16_t payloadDataLength, // Length w/o padding.
const int32_t id);
~RTPPayloadParser();
@ -207,32 +207,32 @@ namespace ModuleRTPUtility
bool ParseVP8(RTPPayload& parsedPacket) const;
int ParseVP8Extension(RTPPayloadVP8 *vp8,
const WebRtc_UWord8 *dataPtr,
const uint8_t *dataPtr,
int dataLength) const;
int ParseVP8PictureID(RTPPayloadVP8 *vp8,
const WebRtc_UWord8 **dataPtr,
const uint8_t **dataPtr,
int *dataLength,
int *parsedBytes) const;
int ParseVP8Tl0PicIdx(RTPPayloadVP8 *vp8,
const WebRtc_UWord8 **dataPtr,
const uint8_t **dataPtr,
int *dataLength,
int *parsedBytes) const;
int ParseVP8TIDAndKeyIdx(RTPPayloadVP8 *vp8,
const WebRtc_UWord8 **dataPtr,
const uint8_t **dataPtr,
int *dataLength,
int *parsedBytes) const;
int ParseVP8FrameSize(RTPPayload& parsedPacket,
const WebRtc_UWord8 *dataPtr,
const uint8_t *dataPtr,
int dataLength) const;
private:
WebRtc_Word32 _id;
const WebRtc_UWord8* _dataPtr;
const WebRtc_UWord16 _dataLength;
int32_t _id;
const uint8_t* _dataPtr;
const uint16_t _dataLength;
const RtpVideoCodecTypes _videoType;
};

View File

@ -72,7 +72,7 @@ void VerifyExtensions(const RTPPayloadVP8 &header,
}
TEST(ParseVP8Test, BasicHeader) {
WebRtc_UWord8 payload[4] = {0};
uint8_t payload[4] = {0};
payload[0] = 0x14; // Binary 0001 0100; S = 1, PartID = 4.
payload[1] = 0x01; // P frame.
@ -92,7 +92,7 @@ TEST(ParseVP8Test, BasicHeader) {
}
TEST(ParseVP8Test, PictureID) {
WebRtc_UWord8 payload[10] = {0};
uint8_t payload[10] = {0};
payload[0] = 0xA0;
payload[1] = 0x80;
payload[2] = 17;
@ -131,7 +131,7 @@ TEST(ParseVP8Test, PictureID) {
}
TEST(ParseVP8Test, Tl0PicIdx) {
WebRtc_UWord8 payload[13] = {0};
uint8_t payload[13] = {0};
payload[0] = 0x90;
payload[1] = 0x40;
payload[2] = 17;
@ -154,7 +154,7 @@ TEST(ParseVP8Test, Tl0PicIdx) {
}
TEST(ParseVP8Test, TIDAndLayerSync) {
WebRtc_UWord8 payload[10] = {0};
uint8_t payload[10] = {0};
payload[0] = 0x88;
payload[1] = 0x20;
payload[2] = 0x80; // TID(2) + LayerSync(false)
@ -178,7 +178,7 @@ TEST(ParseVP8Test, TIDAndLayerSync) {
}
TEST(ParseVP8Test, KeyIdx) {
WebRtc_UWord8 payload[10] = {0};
uint8_t payload[10] = {0};
payload[0] = 0x88;
payload[1] = 0x10; // K = 1.
payload[2] = 0x11; // KEYIDX = 17 decimal.
@ -201,7 +201,7 @@ TEST(ParseVP8Test, KeyIdx) {
}
TEST(ParseVP8Test, MultipleExtensions) {
WebRtc_UWord8 payload[10] = {0};
uint8_t payload[10] = {0};
payload[0] = 0x88;
payload[1] = 0x80 | 0x40 | 0x20 | 0x10;
payload[2] = 0x80 | 17; // PictureID, high 7 bits.
@ -230,7 +230,7 @@ TEST(ParseVP8Test, MultipleExtensions) {
}
TEST(ParseVP8Test, TooShortHeader) {
WebRtc_UWord8 payload[4] = {0};
uint8_t payload[4] = {0};
payload[0] = 0x88;
payload[1] = 0x80 | 0x40 | 0x20 | 0x10; // All extensions are enabled...
payload[2] = 0x80 | 17; // ... but only 2 bytes PictureID is provided.
@ -243,8 +243,8 @@ TEST(ParseVP8Test, TooShortHeader) {
}
TEST(ParseVP8Test, TestWithPacketizer) {
WebRtc_UWord8 payload[10] = {0};
WebRtc_UWord8 packet[20] = {0};
uint8_t payload[10] = {0};
uint8_t packet[20] = {0};
RTPVideoHeaderVP8 inputHeader;
inputHeader.nonReference = true;
inputHeader.pictureId = 300;

View File

@ -51,12 +51,12 @@ SSRCDatabase::ReturnSSRCDatabase()
StaticInstance(kRelease);
}
WebRtc_UWord32
uint32_t
SSRCDatabase::CreateSSRC()
{
CriticalSectionScoped lock(_critSect);
WebRtc_UWord32 ssrc = GenerateRandom();
uint32_t ssrc = GenerateRandom();
#ifndef WEBRTC_NO_STL
@ -71,8 +71,8 @@ SSRCDatabase::CreateSSRC()
{
// allocate more space
const int newSize = _sizeOfSSRC + 10;
WebRtc_UWord32* tempSSRCVector = new WebRtc_UWord32[newSize];
memcpy(tempSSRCVector, _ssrcVector, _sizeOfSSRC*sizeof(WebRtc_UWord32));
uint32_t* tempSSRCVector = new uint32_t[newSize];
memcpy(tempSSRCVector, _ssrcVector, _sizeOfSSRC*sizeof(uint32_t));
delete [] _ssrcVector;
_ssrcVector = tempSSRCVector;
@ -100,8 +100,8 @@ SSRCDatabase::CreateSSRC()
return ssrc;
}
WebRtc_Word32
SSRCDatabase::RegisterSSRC(const WebRtc_UWord32 ssrc)
int32_t
SSRCDatabase::RegisterSSRC(const uint32_t ssrc)
{
CriticalSectionScoped lock(_critSect);
@ -114,8 +114,8 @@ SSRCDatabase::RegisterSSRC(const WebRtc_UWord32 ssrc)
{
// allocate more space
const int newSize = _sizeOfSSRC + 10;
WebRtc_UWord32* tempSSRCVector = new WebRtc_UWord32[newSize];
memcpy(tempSSRCVector, _ssrcVector, _sizeOfSSRC*sizeof(WebRtc_UWord32));
uint32_t* tempSSRCVector = new uint32_t[newSize];
memcpy(tempSSRCVector, _ssrcVector, _sizeOfSSRC*sizeof(uint32_t));
delete [] _ssrcVector;
_ssrcVector = tempSSRCVector;
@ -140,8 +140,8 @@ SSRCDatabase::RegisterSSRC(const WebRtc_UWord32 ssrc)
return 0;
}
WebRtc_Word32
SSRCDatabase::ReturnSSRC(const WebRtc_UWord32 ssrc)
int32_t
SSRCDatabase::ReturnSSRC(const uint32_t ssrc)
{
CriticalSectionScoped lock(_critSect);
@ -182,7 +182,7 @@ SSRCDatabase::SSRCDatabase()
#ifdef WEBRTC_NO_STL
_sizeOfSSRC = 10;
_numberOfSSRC = 0;
_ssrcVector = new WebRtc_UWord32[10];
_ssrcVector = new uint32_t[10];
#endif
_critSect = CriticalSectionWrapper::CreateCriticalSection();
@ -201,9 +201,9 @@ SSRCDatabase::~SSRCDatabase()
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, -1, "%s deleted", __FUNCTION__);
}
WebRtc_UWord32 SSRCDatabase::GenerateRandom()
uint32_t SSRCDatabase::GenerateRandom()
{
WebRtc_UWord32 ssrc = 0;
uint32_t ssrc = 0;
do
{
ssrc = rand();

View File

@ -27,9 +27,9 @@ public:
static SSRCDatabase* GetSSRCDatabase();
static void ReturnSSRCDatabase();
WebRtc_UWord32 CreateSSRC();
WebRtc_Word32 RegisterSSRC(const WebRtc_UWord32 ssrc);
WebRtc_Word32 ReturnSSRC(const WebRtc_UWord32 ssrc);
uint32_t CreateSSRC();
int32_t RegisterSSRC(const uint32_t ssrc);
int32_t ReturnSSRC(const uint32_t ssrc);
protected:
SSRCDatabase();
@ -44,15 +44,15 @@ private:
CountOperation count_operation);
static SSRCDatabase* StaticInstance(CountOperation count_operation);
WebRtc_UWord32 GenerateRandom();
uint32_t GenerateRandom();
#ifdef WEBRTC_NO_STL
int _numberOfSSRC;
int _sizeOfSSRC;
WebRtc_UWord32* _ssrcVector;
uint32_t* _ssrcVector;
#else
std::map<WebRtc_UWord32, WebRtc_UWord32> _ssrcMap;
std::map<uint32_t, uint32_t> _ssrcMap;
#endif
CriticalSectionWrapper* _critSect;

View File

@ -29,7 +29,7 @@ TMMBRSet::~TMMBRSet()
}
void
TMMBRSet::VerifyAndAllocateSet(WebRtc_UWord32 minimumSize)
TMMBRSet::VerifyAndAllocateSet(uint32_t minimumSize)
{
if(minimumSize > _sizeOfSet)
{
@ -38,7 +38,7 @@ TMMBRSet::VerifyAndAllocateSet(WebRtc_UWord32 minimumSize)
_sizeOfSet = minimumSize;
}
// reset memory
for(WebRtc_UWord32 i = 0; i < _sizeOfSet; i++)
for(uint32_t i = 0; i < _sizeOfSet; i++)
{
_data.at(i).tmmbr = 0;
_data.at(i).packet_oh = 0;
@ -48,7 +48,7 @@ TMMBRSet::VerifyAndAllocateSet(WebRtc_UWord32 minimumSize)
}
void
TMMBRSet::VerifyAndAllocateSetKeepingData(WebRtc_UWord32 minimumSize)
TMMBRSet::VerifyAndAllocateSetKeepingData(uint32_t minimumSize)
{
if(minimumSize > _sizeOfSet)
{
@ -60,9 +60,9 @@ TMMBRSet::VerifyAndAllocateSetKeepingData(WebRtc_UWord32 minimumSize)
}
void TMMBRSet::SetEntry(unsigned int i,
WebRtc_UWord32 tmmbrSet,
WebRtc_UWord32 packetOHSet,
WebRtc_UWord32 ssrcSet) {
uint32_t tmmbrSet,
uint32_t packetOHSet,
uint32_t ssrcSet) {
assert(i < _sizeOfSet);
_data.at(i).tmmbr = tmmbrSet;
_data.at(i).packet_oh = packetOHSet;
@ -72,28 +72,28 @@ void TMMBRSet::SetEntry(unsigned int i,
}
}
void TMMBRSet::AddEntry(WebRtc_UWord32 tmmbrSet,
WebRtc_UWord32 packetOHSet,
WebRtc_UWord32 ssrcSet) {
void TMMBRSet::AddEntry(uint32_t tmmbrSet,
uint32_t packetOHSet,
uint32_t ssrcSet) {
assert(_lengthOfSet < _sizeOfSet);
SetEntry(_lengthOfSet, tmmbrSet, packetOHSet, ssrcSet);
}
void TMMBRSet::RemoveEntry(WebRtc_UWord32 sourceIdx) {
void TMMBRSet::RemoveEntry(uint32_t sourceIdx) {
assert(sourceIdx < _lengthOfSet);
_data.erase(_data.begin() + sourceIdx);
_lengthOfSet--;
_data.resize(_sizeOfSet); // Ensure that size remains the same.
}
void TMMBRSet::SwapEntries(WebRtc_UWord32 i, WebRtc_UWord32 j) {
void TMMBRSet::SwapEntries(uint32_t i, uint32_t j) {
SetElement temp;
temp = _data[i];
_data[i] = _data[j];
_data[j] = temp;
}
void TMMBRSet::ClearEntry(WebRtc_UWord32 idx) {
void TMMBRSet::ClearEntry(uint32_t idx) {
SetEntry(idx, 0, 0, 0);
}
@ -115,7 +115,7 @@ TMMBRHelp::~TMMBRHelp() {
}
TMMBRSet*
TMMBRHelp::VerifyAndAllocateBoundingSet(WebRtc_UWord32 minimumSize)
TMMBRHelp::VerifyAndAllocateBoundingSet(uint32_t minimumSize)
{
CriticalSectionScoped lock(_criticalSection);
@ -138,9 +138,9 @@ TMMBRSet* TMMBRHelp::BoundingSet() {
return &_boundingSet;
}
WebRtc_Word32
int32_t
TMMBRHelp::SetTMMBRBoundingSetToSend(const TMMBRSet* boundingSetToSend,
const WebRtc_UWord32 maxBitrateKbit)
const uint32_t maxBitrateKbit)
{
CriticalSectionScoped lock(_criticalSection);
@ -152,10 +152,10 @@ TMMBRHelp::SetTMMBRBoundingSetToSend(const TMMBRSet* boundingSetToSend,
VerifyAndAllocateBoundingSetToSend(boundingSetToSend->lengthOfSet());
_boundingSetToSend.clearSet();
for (WebRtc_UWord32 i = 0; i < boundingSetToSend->lengthOfSet(); i++)
for (uint32_t i = 0; i < boundingSetToSend->lengthOfSet(); i++)
{
// cap at our configured max bitrate
WebRtc_UWord32 bitrate = boundingSetToSend->Tmmbr(i);
uint32_t bitrate = boundingSetToSend->Tmmbr(i);
if(maxBitrateKbit)
{
// do we have a configured max bitrate?
@ -171,8 +171,8 @@ TMMBRHelp::SetTMMBRBoundingSetToSend(const TMMBRSet* boundingSetToSend,
return 0;
}
WebRtc_Word32
TMMBRHelp::VerifyAndAllocateBoundingSetToSend(WebRtc_UWord32 minimumSize)
int32_t
TMMBRHelp::VerifyAndAllocateBoundingSetToSend(uint32_t minimumSize)
{
CriticalSectionScoped lock(_criticalSection);
@ -181,7 +181,7 @@ TMMBRHelp::VerifyAndAllocateBoundingSetToSend(WebRtc_UWord32 minimumSize)
}
TMMBRSet*
TMMBRHelp::VerifyAndAllocateCandidateSet(WebRtc_UWord32 minimumSize)
TMMBRHelp::VerifyAndAllocateCandidateSet(uint32_t minimumSize)
{
CriticalSectionScoped lock(_criticalSection);
@ -201,7 +201,7 @@ TMMBRHelp::BoundingSetToSend()
return &_boundingSetToSend;
}
WebRtc_Word32
int32_t
TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet)
{
CriticalSectionScoped lock(_criticalSection);
@ -211,7 +211,7 @@ TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet)
candidateSet.VerifyAndAllocateSet(_candidateSet.sizeOfSet());
// TODO(hta) Figure out if this should be lengthOfSet instead.
for (WebRtc_UWord32 i = 0; i < _candidateSet.sizeOfSet(); i++)
for (uint32_t i = 0; i < _candidateSet.sizeOfSet(); i++)
{
if(_candidateSet.Tmmbr(i))
{
@ -229,9 +229,9 @@ TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet)
}
// Number of set candidates
WebRtc_Word32 numSetCandidates = candidateSet.lengthOfSet();
int32_t numSetCandidates = candidateSet.lengthOfSet();
// Find bounding set
WebRtc_UWord32 numBoundingSet = 0;
uint32_t numBoundingSet = 0;
if (numSetCandidates > 0)
{
numBoundingSet = FindTMMBRBoundingSet(numSetCandidates, candidateSet);
@ -245,18 +245,18 @@ TMMBRHelp::FindTMMBRBoundingSet(TMMBRSet*& boundingSet)
}
WebRtc_Word32
TMMBRHelp::FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidateSet)
int32_t
TMMBRHelp::FindTMMBRBoundingSet(int32_t numCandidates, TMMBRSet& candidateSet)
{
CriticalSectionScoped lock(_criticalSection);
WebRtc_UWord32 numBoundingSet = 0;
uint32_t numBoundingSet = 0;
VerifyAndAllocateBoundingSet(candidateSet.sizeOfSet());
if (numCandidates == 1)
{
// TODO(hta): lengthOfSet instead of sizeOfSet?
for (WebRtc_UWord32 i = 0; i < candidateSet.sizeOfSet(); i++)
for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
{
if (candidateSet.Tmmbr(i) > 0)
{
@ -284,15 +284,15 @@ TMMBRHelp::FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidate
}
}
// 2. For tuples with same OH, keep the one w/ the lowest bitrate
for (WebRtc_UWord32 i = 0; i < candidateSet.sizeOfSet(); i++)
for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
{
if (candidateSet.Tmmbr(i) > 0)
{
// get min bitrate for packets w/ same OH
WebRtc_UWord32 currentPacketOH = candidateSet.PacketOH(i);
WebRtc_UWord32 currentMinTMMBR = candidateSet.Tmmbr(i);
WebRtc_UWord32 currentMinIndexTMMBR = i;
for (WebRtc_UWord32 j = i+1; j < candidateSet.sizeOfSet(); j++)
uint32_t currentPacketOH = candidateSet.PacketOH(i);
uint32_t currentMinTMMBR = candidateSet.Tmmbr(i);
uint32_t currentMinIndexTMMBR = i;
for (uint32_t j = i+1; j < candidateSet.sizeOfSet(); j++)
{
if(candidateSet.PacketOH(j) == currentPacketOH)
{
@ -304,7 +304,7 @@ TMMBRHelp::FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidate
}
}
// keep lowest bitrate
for (WebRtc_UWord32 j = 0; j < candidateSet.sizeOfSet(); j++)
for (uint32_t j = 0; j < candidateSet.sizeOfSet(); j++)
{
if(candidateSet.PacketOH(j) == currentPacketOH
&& j != currentMinIndexTMMBR)
@ -316,9 +316,9 @@ TMMBRHelp::FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidate
}
// 3. Select and remove tuple w/ lowest tmmbr.
// (If more than 1, choose the one w/ highest OH).
WebRtc_UWord32 minTMMBR = 0;
WebRtc_UWord32 minIndexTMMBR = 0;
for (WebRtc_UWord32 i = 0; i < candidateSet.sizeOfSet(); i++)
uint32_t minTMMBR = 0;
uint32_t minIndexTMMBR = 0;
for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
{
if (candidateSet.Tmmbr(i) > 0)
{
@ -328,7 +328,7 @@ TMMBRHelp::FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidate
}
}
for (WebRtc_UWord32 i = 0; i < candidateSet.sizeOfSet(); i++)
for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
{
if (candidateSet.Tmmbr(i) > 0 && candidateSet.Tmmbr(i) <= minTMMBR)
{
@ -356,7 +356,7 @@ TMMBRHelp::FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidate
// 4. Discard from candidate list all tuple w/ lower OH
// (next tuple must be steeper)
for (WebRtc_UWord32 i = 0; i < candidateSet.sizeOfSet(); i++)
for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
{
if(candidateSet.Tmmbr(i) > 0
&& candidateSet.PacketOH(i) < _boundingSet.PacketOH(0))
@ -383,7 +383,7 @@ TMMBRHelp::FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidate
if (getNewCandidate)
{
// 5. Remove first remaining tuple from candidate list
for (WebRtc_UWord32 i = 0; i < candidateSet.sizeOfSet(); i++)
for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
{
if (candidateSet.Tmmbr(i) > 0)
{
@ -443,15 +443,15 @@ TMMBRHelp::FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidate
return numBoundingSet;
}
bool TMMBRHelp::IsOwner(const WebRtc_UWord32 ssrc,
const WebRtc_UWord32 length) const {
bool TMMBRHelp::IsOwner(const uint32_t ssrc,
const uint32_t length) const {
CriticalSectionScoped lock(_criticalSection);
if (length == 0) {
// Empty bounding set.
return false;
}
for(WebRtc_UWord32 i = 0;
for(uint32_t i = 0;
(i < length) && (i < _boundingSet.sizeOfSet()); ++i) {
if(_boundingSet.Ssrc(i) == ssrc) {
return true;
@ -460,7 +460,7 @@ bool TMMBRHelp::IsOwner(const WebRtc_UWord32 ssrc,
return false;
}
bool TMMBRHelp::CalcMinBitRate( WebRtc_UWord32* minBitrateKbit) const {
bool TMMBRHelp::CalcMinBitRate( uint32_t* minBitrateKbit) const {
CriticalSectionScoped lock(_criticalSection);
if (_candidateSet.sizeOfSet() == 0) {
@ -469,8 +469,8 @@ bool TMMBRHelp::CalcMinBitRate( WebRtc_UWord32* minBitrateKbit) const {
}
*minBitrateKbit = std::numeric_limits<uint32_t>::max();
for (WebRtc_UWord32 i = 0; i < _candidateSet.lengthOfSet(); ++i) {
WebRtc_UWord32 curNetBitRateKbit = _candidateSet.Tmmbr(i);
for (uint32_t i = 0; i < _candidateSet.lengthOfSet(); ++i) {
uint32_t curNetBitRateKbit = _candidateSet.Tmmbr(i);
if (curNetBitRateKbit < MIN_VIDEO_BW_MANAGEMENT_BITRATE) {
curNetBitRateKbit = MIN_VIDEO_BW_MANAGEMENT_BITRATE;
}

View File

@ -27,56 +27,56 @@ public:
TMMBRSet();
~TMMBRSet();
void VerifyAndAllocateSet(WebRtc_UWord32 minimumSize);
void VerifyAndAllocateSetKeepingData(WebRtc_UWord32 minimumSize);
void VerifyAndAllocateSet(uint32_t minimumSize);
void VerifyAndAllocateSetKeepingData(uint32_t minimumSize);
// Number of valid data items in set.
WebRtc_UWord32 lengthOfSet() const { return _lengthOfSet; }
uint32_t lengthOfSet() const { return _lengthOfSet; }
// Presently allocated max size of set.
WebRtc_UWord32 sizeOfSet() const { return _sizeOfSet; }
uint32_t sizeOfSet() const { return _sizeOfSet; }
void clearSet() {
_lengthOfSet = 0;
}
WebRtc_UWord32 Tmmbr(int i) const {
uint32_t Tmmbr(int i) const {
return _data.at(i).tmmbr;
}
WebRtc_UWord32 PacketOH(int i) const {
uint32_t PacketOH(int i) const {
return _data.at(i).packet_oh;
}
WebRtc_UWord32 Ssrc(int i) const {
uint32_t Ssrc(int i) const {
return _data.at(i).ssrc;
}
void SetEntry(unsigned int i,
WebRtc_UWord32 tmmbrSet,
WebRtc_UWord32 packetOHSet,
WebRtc_UWord32 ssrcSet);
uint32_t tmmbrSet,
uint32_t packetOHSet,
uint32_t ssrcSet);
void AddEntry(WebRtc_UWord32 tmmbrSet,
WebRtc_UWord32 packetOHSet,
WebRtc_UWord32 ssrcSet);
void AddEntry(uint32_t tmmbrSet,
uint32_t packetOHSet,
uint32_t ssrcSet);
// Remove one entry from table, and move all others down.
void RemoveEntry(WebRtc_UWord32 sourceIdx);
void RemoveEntry(uint32_t sourceIdx);
void SwapEntries(WebRtc_UWord32 firstIdx,
WebRtc_UWord32 secondIdx);
void SwapEntries(uint32_t firstIdx,
uint32_t secondIdx);
// Set entry data to zero, but keep it in table.
void ClearEntry(WebRtc_UWord32 idx);
void ClearEntry(uint32_t idx);
private:
class SetElement {
public:
SetElement() : tmmbr(0), packet_oh(0), ssrc(0) {}
WebRtc_UWord32 tmmbr;
WebRtc_UWord32 packet_oh;
WebRtc_UWord32 ssrc;
uint32_t tmmbr;
uint32_t packet_oh;
uint32_t ssrc;
};
std::vector<SetElement> _data;
// Number of places allocated.
WebRtc_UWord32 _sizeOfSet;
uint32_t _sizeOfSet;
// NUmber of places currently in use.
WebRtc_UWord32 _lengthOfSet;
uint32_t _lengthOfSet;
};
class TMMBRHelp
@ -89,21 +89,21 @@ public:
TMMBRSet* CandidateSet();
TMMBRSet* BoundingSetToSend();
TMMBRSet* VerifyAndAllocateCandidateSet(const WebRtc_UWord32 minimumSize);
WebRtc_Word32 FindTMMBRBoundingSet(TMMBRSet*& boundingSet);
WebRtc_Word32 SetTMMBRBoundingSetToSend(
TMMBRSet* VerifyAndAllocateCandidateSet(const uint32_t minimumSize);
int32_t FindTMMBRBoundingSet(TMMBRSet*& boundingSet);
int32_t SetTMMBRBoundingSetToSend(
const TMMBRSet* boundingSetToSend,
const WebRtc_UWord32 maxBitrateKbit);
const uint32_t maxBitrateKbit);
bool IsOwner(const WebRtc_UWord32 ssrc, const WebRtc_UWord32 length) const;
bool IsOwner(const uint32_t ssrc, const uint32_t length) const;
bool CalcMinBitRate(WebRtc_UWord32* minBitrateKbit) const;
bool CalcMinBitRate(uint32_t* minBitrateKbit) const;
protected:
TMMBRSet* VerifyAndAllocateBoundingSet(WebRtc_UWord32 minimumSize);
WebRtc_Word32 VerifyAndAllocateBoundingSetToSend(WebRtc_UWord32 minimumSize);
TMMBRSet* VerifyAndAllocateBoundingSet(uint32_t minimumSize);
int32_t VerifyAndAllocateBoundingSetToSend(uint32_t minimumSize);
WebRtc_Word32 FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidateSet);
int32_t FindTMMBRBoundingSet(int32_t numCandidates, TMMBRSet& candidateSet);
private:
CriticalSectionWrapper* _criticalSection;

View File

@ -38,7 +38,7 @@ BWEConvergenceTestUp::~BWEConvergenceTestUp()
}
int BWEConvergenceTestUp::Init(std::string ip, WebRtc_UWord16 port)
int BWEConvergenceTestUp::Init(std::string ip, uint16_t port)
{
// create the load generator object
const int rtpSampleRate = 90000;

View File

@ -25,7 +25,7 @@ public:
BWEConvergenceTestUp(std::string testName, int startRateKbps, int availBWkbps);
virtual ~BWEConvergenceTestUp();
virtual int Init(std::string ip, WebRtc_UWord16 port);
virtual int Init(std::string ip, uint16_t port);
protected:
virtual bool StoppingCriterionMaster();

View File

@ -35,7 +35,7 @@ BWEStabilityTest::~BWEStabilityTest()
}
int BWEStabilityTest::Init(std::string ip, WebRtc_UWord16 port)
int BWEStabilityTest::Init(std::string ip, uint16_t port)
{
// create the load generator object
const int rtpSampleRate = 90000;

View File

@ -25,7 +25,7 @@ public:
BWEStabilityTest(std::string testName, int rateKbps, int testDurationSeconds);
virtual ~BWEStabilityTest();
virtual int Init(std::string ip, WebRtc_UWord16 port);
virtual int Init(std::string ip, uint16_t port);
virtual void Report(std::fstream &log);
protected:

View File

@ -32,36 +32,36 @@ public:
myTransportCB (RtpRtcp *rtpMod) : _rtpMod(rtpMod) {};
protected:
// Inherited from UdpTransportData
virtual void IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket,
const WebRtc_Word32 rtpPacketLength,
const WebRtc_Word8* fromIP,
const WebRtc_UWord16 fromPort);
virtual void IncomingRTPPacket(const int8_t* incomingRtpPacket,
const int32_t rtpPacketLength,
const int8_t* fromIP,
const uint16_t fromPort);
virtual void IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket,
const WebRtc_Word32 rtcpPacketLength,
const WebRtc_Word8* fromIP,
const WebRtc_UWord16 fromPort);
virtual void IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
const int32_t rtcpPacketLength,
const int8_t* fromIP,
const uint16_t fromPort);
private:
RtpRtcp *_rtpMod;
};
void myTransportCB::IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket,
const WebRtc_Word32 rtpPacketLength,
const WebRtc_Word8* fromIP,
const WebRtc_UWord16 fromPort)
void myTransportCB::IncomingRTPPacket(const int8_t* incomingRtpPacket,
const int32_t rtpPacketLength,
const int8_t* fromIP,
const uint16_t fromPort)
{
printf("Receiving RTP from IP %s, port %u\n", fromIP, fromPort);
_rtpMod->IncomingPacket((WebRtc_UWord8 *) incomingRtpPacket, static_cast<WebRtc_UWord16>(rtpPacketLength));
_rtpMod->IncomingPacket((uint8_t *) incomingRtpPacket, static_cast<uint16_t>(rtpPacketLength));
}
void myTransportCB::IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket,
const WebRtc_Word32 rtcpPacketLength,
const WebRtc_Word8* fromIP,
const WebRtc_UWord16 fromPort)
void myTransportCB::IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
const int32_t rtcpPacketLength,
const int8_t* fromIP,
const uint16_t fromPort)
{
printf("Receiving RTCP from IP %s, port %u\n", fromIP, fromPort);
_rtpMod->IncomingPacket((WebRtc_UWord8 *) incomingRtcpPacket, static_cast<WebRtc_UWord16>(rtcpPacketLength));
_rtpMod->IncomingPacket((uint8_t *) incomingRtcpPacket, static_cast<uint16_t>(rtcpPacketLength));
}
@ -69,7 +69,7 @@ int main(int argc, char* argv[])
{
bool isSender = false;
bool isReceiver = false;
WebRtc_UWord16 port;
uint16_t port;
std::string ip;
TestSenderReceiver *sendrec = new TestSenderReceiver();
TestLoadGenerator *gen;
@ -105,12 +105,12 @@ int main(int argc, char* argv[])
if (isSender)
{
const WebRtc_UWord32 startRateKbps = 1000;
const uint32_t startRateKbps = 1000;
//gen = new CBRGenerator(sendrec, 1000, 500);
gen = new CBRFixFRGenerator(sendrec, startRateKbps, 90000, 30, 0.2);
//gen = new PeriodicKeyFixFRGenerator(sendrec, startRateKbps, 90000, 30, 0.2, 7, 300);
//const WebRtc_UWord16 numFrameRates = 5;
//const WebRtc_UWord8 frameRates[numFrameRates] = {30, 15, 20, 23, 25};
//const uint16_t numFrameRates = 5;
//const uint8_t frameRates[numFrameRates] = {30, 15, 20, 23, 25};
//gen = new CBRVarFRGenerator(sendrec, 1000, frameRates, numFrameRates, 90000, 4.0, 0.1, 0.2);
//gen = new CBRFrameDropGenerator(sendrec, startRateKbps, 90000, 0.2);
sendrec->SetLoadGenerator(gen);
@ -130,7 +130,7 @@ int main(int argc, char* argv[])
delete sendrec;
//WebRtc_UWord8 numberOfSocketThreads = 1;
//uint8_t numberOfSocketThreads = 1;
//UdpTransport* transport = UdpTransport::Create(0, numberOfSocketThreads);
//RtpRtcp* rtp = RtpRtcp::CreateRtpRtcp(1, false);
@ -153,7 +153,7 @@ int main(int argc, char* argv[])
// transport->InitializeReceiveSockets(tp, 10000, "0.0.0.0");
// transport->StartReceiving(500);
// WebRtc_Word8 data[100];
// int8_t data[100];
// for (int i = 0; i < 100; data[i] = i++);
// for (int i = 0; i < 100; i++)
@ -163,11 +163,11 @@ int main(int argc, char* argv[])
// WebRtc_Word32 totTime = 0;
// int32_t totTime = 0;
// while (totTime < 10000)
// {
// transport->Process();
// WebRtc_Word32 wTime = transport->TimeUntilNextProcess();
// int32_t wTime = transport->TimeUntilNextProcess();
// totTime += wTime;
// Sleep(wTime);
// }

View File

@ -235,7 +235,7 @@ bool BWETest::SetMaster(bool isMaster /*= true*/)
}
int BWETest::Init(std::string ip, WebRtc_UWord16 port)
int BWETest::Init(std::string ip, uint16_t port)
{
if (_initialized)
{
@ -403,17 +403,17 @@ void BWETest::Report(std::fstream &log)
// SenderReceiver callback
void BWETest::OnOnNetworkChanged(const WebRtc_UWord32 bitrateTargetBps,
const WebRtc_UWord8 fractionLost,
const WebRtc_UWord16 roundTripTimeMs,
const WebRtc_UWord32 jitterMS,
const WebRtc_UWord16 bwEstimateKbitMin,
const WebRtc_UWord16 bwEstimateKbitMax)
void BWETest::OnOnNetworkChanged(const uint32_t bitrateTargetBps,
const uint8_t fractionLost,
const uint16_t roundTripTimeMs,
const uint32_t jitterMS,
const uint16_t bwEstimateKbitMin,
const uint16_t bwEstimateKbitMax)
{
CriticalSectionScoped cs(_statCritSect);
// bitrate statistics
WebRtc_Word32 newBitrateKbps = bitrateTargetBps/1000;
int32_t newBitrateKbps = bitrateTargetBps/1000;
_rateVecKbps.push_back(newBitrateKbps);
_rttVecMs.push_back(roundTripTimeMs);
@ -421,7 +421,7 @@ void BWETest::OnOnNetworkChanged(const WebRtc_UWord32 bitrateTargetBps,
}
int BWEOneWayTest::Init(std::string ip, WebRtc_UWord16 port)
int BWEOneWayTest::Init(std::string ip, uint16_t port)
{
if (!_master)
@ -442,10 +442,10 @@ bool BWEOneWayTest::Start()
if (!_master)
{
// send one dummy RTP packet to enable RTT measurements
const WebRtc_UWord8 dummy = 0;
const uint8_t dummy = 0;
//_gen->sendPayload(TickTime::MillisecondTimestamp(), &dummy, 0);
_sendrec->SendOutgoingData(
static_cast<WebRtc_UWord32>(TickTime::MillisecondTimestamp()*90),
static_cast<uint32_t>(TickTime::MillisecondTimestamp()*90),
&dummy, 1, webrtc::kVideoFrameDelta);
}

View File

@ -41,7 +41,7 @@ public:
bool SetMaster(bool isMaster = true);
void UseRecvTimeout() { _sendrec->SetPacketTimeout(1000); };
virtual int Init(std::string ip, WebRtc_UWord16 port);
virtual int Init(std::string ip, uint16_t port);
virtual bool Start();
virtual bool Stop();
bool ProcLoop(void);
@ -49,12 +49,12 @@ public:
std::string TestName() { return (_testName); };
// SenderReceiver callback
virtual void OnOnNetworkChanged(const WebRtc_UWord32 bitrateTargetBps,
const WebRtc_UWord8 fractionLost,
const WebRtc_UWord16 roundTripTimeMs,
const WebRtc_UWord32 jitterMS,
const WebRtc_UWord16 bwEstimateKbitMin,
const WebRtc_UWord16 bwEstimateKbitMax);
virtual void OnOnNetworkChanged(const uint32_t bitrateTargetBps,
const uint8_t fractionLost,
const uint16_t roundTripTimeMs,
const uint32_t jitterMS,
const uint16_t bwEstimateKbitMin,
const uint16_t bwEstimateKbitMax);
protected:
@ -72,8 +72,8 @@ protected:
bool _running;
EventWrapper *_eventPtr;
ThreadWrapper* _procThread;
WebRtc_Word64 _startTimeMs;
WebRtc_Word64 _stopTimeMs;
int64_t _startTimeMs;
int64_t _stopTimeMs;
// Statistics, protected by separate CritSect
CriticalSectionWrapper* _statCritSect;
@ -89,7 +89,7 @@ public:
BWEOneWayTest(std::string testName, int startRateKbps) :
BWETest(testName, startRateKbps) {};
virtual int Init(std::string ip, WebRtc_UWord16 port);
virtual int Init(std::string ip, uint16_t port);
virtual bool Start();
protected:

View File

@ -148,7 +148,7 @@ int main(int argc, char* argv[])
{
bool isMaster = false;
WebRtc_UWord16 port;
uint16_t port;
std::string ip;
std::fstream log;
log.open("TestLog.txt", std::fstream::out | std::fstream::app);

View File

@ -38,7 +38,7 @@ BWETwoWayLimitFinding::~BWETwoWayLimitFinding()
}
int BWETwoWayLimitFinding::Init(std::string ip, WebRtc_UWord16 port)
int BWETwoWayLimitFinding::Init(std::string ip, uint16_t port)
{
// create the load generator object
const int rtpSampleRate = 90000;
@ -64,7 +64,7 @@ bool BWETwoWayLimitFinding::StoppingCriterionMaster()
_forwLimitReached = true;
}
WebRtc_Word32 revRateKbps = _sendrec->ReceiveBitrateKbps();
int32_t revRateKbps = _sendrec->ReceiveBitrateKbps();
if (revRateKbps > (0.95 * _incomingAvailBWkbps))
{
_revLimitReached = true;

View File

@ -23,7 +23,7 @@ public:
virtual ~BWETwoWayLimitFinding();
virtual int Init(std::string ip, WebRtc_UWord16 port);
virtual int Init(std::string ip, uint16_t port);
protected:
virtual bool StoppingCriterionMaster();

View File

@ -66,7 +66,7 @@ MatlabLine::~MatlabLine()
void MatlabLine::Append(double x, double y)
{
if (_maxLen > 0 && _xData.size() > static_cast<WebRtc_UWord32>(_maxLen))
if (_maxLen > 0 && _xData.size() > static_cast<uint32_t>(_maxLen))
{
_xData.resize(_maxLen);
_yData.resize(_maxLen);
@ -312,7 +312,7 @@ double MatlabLine::yMax()
MatlabTimeLine::MatlabTimeLine(int horizonSeconds /*= -1*/, const char *plotAttrib /*= NULL*/,
const char *name /*= NULL*/,
WebRtc_Word64 refTimeMs /* = -1*/)
int64_t refTimeMs /* = -1*/)
:
_timeHorizon(horizonSeconds),
MatlabLine(-1, plotAttrib, name) // infinite number of elements
@ -340,7 +340,7 @@ void MatlabTimeLine::PurgeOldData()
- _timeHorizon; // remove data points older than this
std::list<double>::reverse_iterator ritx = _xData.rbegin();
WebRtc_UWord32 removeCount = 0;
uint32_t removeCount = 0;
while (ritx != _xData.rend())
{
if (*ritx >= historyLimit)
@ -366,7 +366,7 @@ void MatlabTimeLine::PurgeOldData()
}
WebRtc_Word64 MatlabTimeLine::GetRefTime()
int64_t MatlabTimeLine::GetRefTime()
{
return(_refTimeMs);
}
@ -433,7 +433,7 @@ int MatlabPlot::AddLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL*/,
int MatlabPlot::AddTimeLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL*/, const char *name /*= NULL*/,
WebRtc_Word64 refTimeMs /*= -1*/)
int64_t refTimeMs /*= -1*/)
{
CriticalSectionScoped cs(_critSect);
@ -1031,7 +1031,7 @@ bool MatlabEngine::PlotThread(void *obj)
// things to plot, we have already accessed what we need in the plot
plot->DonePlotting();
WebRtc_Word64 start = TickTime::MillisecondTimestamp();
int64_t start = TickTime::MillisecondTimestamp();
// plot it
int ret = engEvalString(ep, cmd.str().c_str());
printf("time=%I64i\n", TickTime::MillisecondTimestamp() - start);

View File

@ -74,14 +74,14 @@ class MatlabTimeLine : public MatlabLine
{
public:
MatlabTimeLine(int horizonSeconds = -1, const char *plotAttrib = NULL, const char *name = NULL,
WebRtc_Word64 refTimeMs = -1);
int64_t refTimeMs = -1);
~MatlabTimeLine() {};
void Append(double y);
void PurgeOldData();
WebRtc_Word64 GetRefTime();
int64_t GetRefTime();
private:
WebRtc_Word64 _refTimeMs;
int64_t _refTimeMs;
int _timeHorizon;
};
@ -96,7 +96,7 @@ public:
int AddLine(int maxLen = -1, const char *plotAttrib = NULL, const char *name = NULL);
int AddTimeLine(int maxLen = -1, const char *plotAttrib = NULL, const char *name = NULL,
WebRtc_Word64 refTimeMs = -1);
int64_t refTimeMs = -1);
int GetLineIx(const char *name);
void Append(int lineIndex, double x, double y);
void Append(int lineIndex, double y);
@ -118,8 +118,8 @@ public:
int MakeTrend(const char *sourceName, const char *trendName, double slope, double offset, const char *plotAttrib = NULL);
#ifdef PLOT_TESTING
WebRtc_Word64 _plotStartTime;
WebRtc_Word64 _plotDelay;
int64_t _plotStartTime;
int64_t _plotDelay;
#endif
private:

View File

@ -31,7 +31,7 @@ bool SenderThreadFunction(void *obj)
}
TestLoadGenerator::TestLoadGenerator(TestSenderReceiver *sender, WebRtc_Word32 rtpSampleRate)
TestLoadGenerator::TestLoadGenerator(TestSenderReceiver *sender, int32_t rtpSampleRate)
:
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
_eventPtr(NULL),
@ -53,7 +53,7 @@ TestLoadGenerator::~TestLoadGenerator ()
delete _critSect;
}
WebRtc_Word32 TestLoadGenerator::SetBitrate (WebRtc_Word32 newBitrateKbps)
int32_t TestLoadGenerator::SetBitrate (int32_t newBitrateKbps)
{
CriticalSectionScoped cs(_critSect);
@ -70,7 +70,7 @@ WebRtc_Word32 TestLoadGenerator::SetBitrate (WebRtc_Word32 newBitrateKbps)
}
WebRtc_Word32 TestLoadGenerator::Start (const char *threadName)
int32_t TestLoadGenerator::Start (const char *threadName)
{
CriticalSectionScoped cs(_critSect);
@ -92,7 +92,7 @@ WebRtc_Word32 TestLoadGenerator::Start (const char *threadName)
}
WebRtc_Word32 TestLoadGenerator::Stop ()
int32_t TestLoadGenerator::Stop ()
{
_critSect.Enter();
@ -123,13 +123,13 @@ WebRtc_Word32 TestLoadGenerator::Stop ()
int TestLoadGenerator::generatePayload ()
{
return(generatePayload( static_cast<WebRtc_UWord32>( TickTime::MillisecondTimestamp() * _rtpSampleRate / 1000 )));
return(generatePayload( static_cast<uint32_t>( TickTime::MillisecondTimestamp() * _rtpSampleRate / 1000 )));
}
int TestLoadGenerator::sendPayload (const WebRtc_UWord32 timeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
int TestLoadGenerator::sendPayload (const uint32_t timeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
const webrtc::FrameType frameType /*= webrtc::kVideoFrameDelta*/)
{
@ -137,11 +137,11 @@ int TestLoadGenerator::sendPayload (const WebRtc_UWord32 timeStamp,
}
CBRGenerator::CBRGenerator (TestSenderReceiver *sender, WebRtc_Word32 payloadSizeBytes, WebRtc_Word32 bitrateKbps, WebRtc_Word32 rtpSampleRate)
CBRGenerator::CBRGenerator (TestSenderReceiver *sender, int32_t payloadSizeBytes, int32_t bitrateKbps, int32_t rtpSampleRate)
:
//_eventPtr(NULL),
_payloadSizeBytes(payloadSizeBytes),
_payload(new WebRtc_UWord8[payloadSizeBytes]),
_payload(new uint8_t[payloadSizeBytes]),
TestLoadGenerator(sender, rtpSampleRate)
{
SetBitrate (bitrateKbps);
@ -164,37 +164,37 @@ CBRGenerator::~CBRGenerator ()
bool CBRGenerator::GeneratorLoop ()
{
double periodMs;
WebRtc_Word64 nextSendTime = TickTime::MillisecondTimestamp();
int64_t nextSendTime = TickTime::MillisecondTimestamp();
// no critSect
while (_running)
{
// send data (critSect inside)
generatePayload( static_cast<WebRtc_UWord32>(nextSendTime * _rtpSampleRate / 1000) );
generatePayload( static_cast<uint32_t>(nextSendTime * _rtpSampleRate / 1000) );
// calculate wait time
periodMs = 8.0 * _payloadSizeBytes / ( _bitrateKbps );
nextSendTime = static_cast<WebRtc_Word64>(nextSendTime + periodMs);
nextSendTime = static_cast<int64_t>(nextSendTime + periodMs);
WebRtc_Word32 waitTime = static_cast<WebRtc_Word32>(nextSendTime - TickTime::MillisecondTimestamp());
int32_t waitTime = static_cast<int32_t>(nextSendTime - TickTime::MillisecondTimestamp());
if (waitTime < 0)
{
waitTime = 0;
}
// wait
_eventPtr->Wait(static_cast<WebRtc_Word32>(waitTime));
_eventPtr->Wait(static_cast<int32_t>(waitTime));
}
return true;
}
int CBRGenerator::generatePayload ( WebRtc_UWord32 timestamp )
int CBRGenerator::generatePayload ( uint32_t timestamp )
{
CriticalSectionScoped cs(_critSect);
//WebRtc_UWord8 *payload = new WebRtc_UWord8[_payloadSizeBytes];
//uint8_t *payload = new uint8_t[_payloadSizeBytes];
int ret = sendPayload(timestamp, _payload, _payloadSizeBytes);
@ -207,8 +207,8 @@ int CBRGenerator::generatePayload ( WebRtc_UWord32 timestamp )
/////////////////////
CBRFixFRGenerator::CBRFixFRGenerator (TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps,
WebRtc_Word32 rtpSampleRate, WebRtc_Word32 frameRateFps /*= 30*/,
CBRFixFRGenerator::CBRFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps,
int32_t rtpSampleRate, int32_t frameRateFps /*= 30*/,
double spread /*= 0.0*/)
:
//_eventPtr(NULL),
@ -240,7 +240,7 @@ CBRFixFRGenerator::~CBRFixFRGenerator ()
bool CBRFixFRGenerator::GeneratorLoop ()
{
double periodMs;
WebRtc_Word64 nextSendTime = TickTime::MillisecondTimestamp();
int64_t nextSendTime = TickTime::MillisecondTimestamp();
_critSect.Enter();
@ -271,22 +271,22 @@ bool CBRFixFRGenerator::GeneratorLoop ()
_payload = NULL;
}
_payloadAllocLen = static_cast<WebRtc_Word32>((_payloadSizeBytes * (1 + _spreadFactor) * 3) / 2 + .5); // 50% extra to avoid frequent re-alloc
_payload = new WebRtc_UWord8[_payloadAllocLen];
_payloadAllocLen = static_cast<int32_t>((_payloadSizeBytes * (1 + _spreadFactor) * 3) / 2 + .5); // 50% extra to avoid frequent re-alloc
_payload = new uint8_t[_payloadAllocLen];
}
// send data (critSect inside)
generatePayload( static_cast<WebRtc_UWord32>(nextSendTime * _rtpSampleRate / 1000) );
generatePayload( static_cast<uint32_t>(nextSendTime * _rtpSampleRate / 1000) );
}
_critSect.Leave();
// calculate wait time
periodMs = 1000.0 / _frameRateFps;
nextSendTime = static_cast<WebRtc_Word64>(nextSendTime + periodMs + 0.5);
nextSendTime = static_cast<int64_t>(nextSendTime + periodMs + 0.5);
WebRtc_Word32 waitTime = static_cast<WebRtc_Word32>(nextSendTime - TickTime::MillisecondTimestamp());
int32_t waitTime = static_cast<int32_t>(nextSendTime - TickTime::MillisecondTimestamp());
if (waitTime < 0)
{
waitTime = 0;
@ -298,20 +298,20 @@ bool CBRFixFRGenerator::GeneratorLoop ()
return true;
}
WebRtc_Word32 CBRFixFRGenerator::nextPayloadSize()
int32_t CBRFixFRGenerator::nextPayloadSize()
{
const double periodMs = 1000.0 / _frameRateFps;
return static_cast<WebRtc_Word32>(_bitrateKbps * periodMs / 8 + 0.5);
return static_cast<int32_t>(_bitrateKbps * periodMs / 8 + 0.5);
}
int CBRFixFRGenerator::generatePayload ( WebRtc_UWord32 timestamp )
int CBRFixFRGenerator::generatePayload ( uint32_t timestamp )
{
CriticalSectionScoped cs(_critSect);
double factor = ((double) rand() - RAND_MAX/2) / RAND_MAX; // [-0.5; 0.5]
factor = 1 + 2 * _spreadFactor * factor; // [1 - _spreadFactor ; 1 + _spreadFactor]
WebRtc_Word32 thisPayloadBytes = static_cast<WebRtc_Word32>(_payloadSizeBytes * factor);
int32_t thisPayloadBytes = static_cast<int32_t>(_payloadSizeBytes * factor);
// sanity
if (thisPayloadBytes > _payloadAllocLen)
{
@ -325,9 +325,9 @@ int CBRFixFRGenerator::generatePayload ( WebRtc_UWord32 timestamp )
/////////////////////
PeriodicKeyFixFRGenerator::PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps,
WebRtc_Word32 rtpSampleRate, WebRtc_Word32 frameRateFps /*= 30*/,
double spread /*= 0.0*/, double keyFactor /*= 4.0*/, WebRtc_UWord32 keyPeriod /*= 300*/)
PeriodicKeyFixFRGenerator::PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps,
int32_t rtpSampleRate, int32_t frameRateFps /*= 30*/,
double spread /*= 0.0*/, double keyFactor /*= 4.0*/, uint32_t keyPeriod /*= 300*/)
:
_keyFactor(keyFactor),
_keyPeriod(keyPeriod),
@ -336,15 +336,15 @@ CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, frameRateFps, spread)
{
}
WebRtc_Word32 PeriodicKeyFixFRGenerator::nextPayloadSize()
int32_t PeriodicKeyFixFRGenerator::nextPayloadSize()
{
// calculate payload size for a delta frame
WebRtc_Word32 payloadSizeBytes = static_cast<WebRtc_Word32>(1000 * _bitrateKbps / (8.0 * _frameRateFps * (1.0 + (_keyFactor - 1.0) / _keyPeriod)) + 0.5);
int32_t payloadSizeBytes = static_cast<int32_t>(1000 * _bitrateKbps / (8.0 * _frameRateFps * (1.0 + (_keyFactor - 1.0) / _keyPeriod)) + 0.5);
if (_frameCount % _keyPeriod == 0)
{
// this is a key frame, scale the payload size
payloadSizeBytes = static_cast<WebRtc_Word32>(_keyFactor * _payloadSizeBytes + 0.5);
payloadSizeBytes = static_cast<int32_t>(_keyFactor * _payloadSizeBytes + 0.5);
}
_frameCount++;
@ -353,8 +353,8 @@ WebRtc_Word32 PeriodicKeyFixFRGenerator::nextPayloadSize()
////////////////////
CBRVarFRGenerator::CBRVarFRGenerator(TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps, const WebRtc_UWord8* frameRates,
WebRtc_UWord16 numFrameRates, WebRtc_Word32 rtpSampleRate, double avgFrPeriodMs,
CBRVarFRGenerator::CBRVarFRGenerator(TestSenderReceiver *sender, int32_t bitrateKbps, const uint8_t* frameRates,
uint16_t numFrameRates, int32_t rtpSampleRate, double avgFrPeriodMs,
double frSpreadFactor, double spreadFactor)
:
_avgFrPeriodMs(avgFrPeriodMs),
@ -364,7 +364,7 @@ _numFrameRates(numFrameRates),
_frChangeTimeMs(TickTime::MillisecondTimestamp() + _avgFrPeriodMs),
CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, frameRates[0], spreadFactor)
{
_frameRates = new WebRtc_UWord8[_numFrameRates];
_frameRates = new uint8_t[_numFrameRates];
memcpy(_frameRates, frameRates, _numFrameRates);
}
@ -375,26 +375,26 @@ CBRVarFRGenerator::~CBRVarFRGenerator()
void CBRVarFRGenerator::ChangeFrameRate()
{
const WebRtc_Word64 nowMs = TickTime::MillisecondTimestamp();
const int64_t nowMs = TickTime::MillisecondTimestamp();
if (nowMs < _frChangeTimeMs)
{
return;
}
// Time to change frame rate
WebRtc_UWord16 frIndex = static_cast<WebRtc_UWord16>(static_cast<double>(rand()) / RAND_MAX
uint16_t frIndex = static_cast<uint16_t>(static_cast<double>(rand()) / RAND_MAX
* (_numFrameRates - 1) + 0.5) ;
assert(frIndex < _numFrameRates);
_frameRateFps = _frameRates[frIndex];
// Update the next frame rate change time
double factor = ((double) rand() - RAND_MAX/2) / RAND_MAX; // [-0.5; 0.5]
factor = 1 + 2 * _frSpreadFactor * factor; // [1 - _frSpreadFactor ; 1 + _frSpreadFactor]
_frChangeTimeMs = nowMs + static_cast<WebRtc_Word64>(1000.0 * factor *
_avgFrPeriodMs + 0.5);
_frChangeTimeMs = nowMs + static_cast<int64_t>(1000.0 * factor *
_avgFrPeriodMs + 0.5);
printf("New frame rate: %d\n", _frameRateFps);
}
WebRtc_Word32 CBRVarFRGenerator::nextPayloadSize()
int32_t CBRVarFRGenerator::nextPayloadSize()
{
ChangeFrameRate();
return CBRFixFRGenerator::nextPayloadSize();
@ -402,8 +402,8 @@ WebRtc_Word32 CBRVarFRGenerator::nextPayloadSize()
////////////////////
CBRFrameDropGenerator::CBRFrameDropGenerator(TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps,
WebRtc_Word32 rtpSampleRate, double spreadFactor)
CBRFrameDropGenerator::CBRFrameDropGenerator(TestSenderReceiver *sender, int32_t bitrateKbps,
int32_t rtpSampleRate, double spreadFactor)
:
_accBits(0),
CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, 30, spreadFactor)
@ -414,7 +414,7 @@ CBRFrameDropGenerator::~CBRFrameDropGenerator()
{
}
WebRtc_Word32 CBRFrameDropGenerator::nextPayloadSize()
int32_t CBRFrameDropGenerator::nextPayloadSize()
{
_accBits -= 1000 * _bitrateKbps / _frameRateFps;
if (_accBits < 0)
@ -430,8 +430,8 @@ WebRtc_Word32 CBRFrameDropGenerator::nextPayloadSize()
{
//printf("keep\n");
const double periodMs = 1000.0 / _frameRateFps;
WebRtc_Word32 frameSize = static_cast<WebRtc_Word32>(_bitrateKbps * periodMs / 8 + 0.5);
frameSize = std::max(frameSize, static_cast<WebRtc_Word32>(300 * periodMs / 8 + 0.5));
int32_t frameSize = static_cast<int32_t>(_bitrateKbps * periodMs / 8 + 0.5);
frameSize = std::max(frameSize, static_cast<int32_t>(300 * periodMs / 8 + 0.5));
_accBits += frameSize * 8;
return frameSize;
}

View File

@ -26,85 +26,85 @@ class ThreadWrapper;
class TestLoadGenerator
{
public:
TestLoadGenerator (TestSenderReceiver *sender, WebRtc_Word32 rtpSampleRate = 90000);
TestLoadGenerator (TestSenderReceiver *sender, int32_t rtpSampleRate = 90000);
virtual ~TestLoadGenerator ();
WebRtc_Word32 SetBitrate (WebRtc_Word32 newBitrateKbps);
virtual WebRtc_Word32 Start (const char *threadName = NULL);
virtual WebRtc_Word32 Stop ();
int32_t SetBitrate (int32_t newBitrateKbps);
virtual int32_t Start (const char *threadName = NULL);
virtual int32_t Stop ();
virtual bool GeneratorLoop () = 0;
protected:
virtual int generatePayload ( WebRtc_UWord32 timestamp ) = 0;
virtual int generatePayload ( uint32_t timestamp ) = 0;
int generatePayload ();
int sendPayload (const WebRtc_UWord32 timeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
int sendPayload (const uint32_t timeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
const webrtc::FrameType frameType = webrtc::kVideoFrameDelta);
webrtc::CriticalSectionWrapper* _critSect;
webrtc::EventWrapper *_eventPtr;
webrtc::ThreadWrapper* _genThread;
WebRtc_Word32 _bitrateKbps;
int32_t _bitrateKbps;
TestSenderReceiver *_sender;
bool _running;
WebRtc_Word32 _rtpSampleRate;
int32_t _rtpSampleRate;
};
class CBRGenerator : public TestLoadGenerator
{
public:
CBRGenerator (TestSenderReceiver *sender, WebRtc_Word32 payloadSizeBytes, WebRtc_Word32 bitrateKbps, WebRtc_Word32 rtpSampleRate = 90000);
CBRGenerator (TestSenderReceiver *sender, int32_t payloadSizeBytes, int32_t bitrateKbps, int32_t rtpSampleRate = 90000);
virtual ~CBRGenerator ();
virtual WebRtc_Word32 Start () {return (TestLoadGenerator::Start("CBRGenerator"));};
virtual int32_t Start () {return (TestLoadGenerator::Start("CBRGenerator"));};
virtual bool GeneratorLoop ();
protected:
virtual int generatePayload ( WebRtc_UWord32 timestamp );
virtual int generatePayload ( uint32_t timestamp );
WebRtc_Word32 _payloadSizeBytes;
WebRtc_UWord8 *_payload;
int32_t _payloadSizeBytes;
uint8_t *_payload;
};
class CBRFixFRGenerator : public TestLoadGenerator // constant bitrate and fixed frame rate
{
public:
CBRFixFRGenerator (TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps, WebRtc_Word32 rtpSampleRate = 90000,
WebRtc_Word32 frameRateFps = 30, double spread = 0.0);
CBRFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps, int32_t rtpSampleRate = 90000,
int32_t frameRateFps = 30, double spread = 0.0);
virtual ~CBRFixFRGenerator ();
virtual WebRtc_Word32 Start () {return (TestLoadGenerator::Start("CBRFixFRGenerator"));};
virtual int32_t Start () {return (TestLoadGenerator::Start("CBRFixFRGenerator"));};
virtual bool GeneratorLoop ();
protected:
virtual WebRtc_Word32 nextPayloadSize ();
virtual int generatePayload ( WebRtc_UWord32 timestamp );
virtual int32_t nextPayloadSize ();
virtual int generatePayload ( uint32_t timestamp );
WebRtc_Word32 _payloadSizeBytes;
WebRtc_UWord8 *_payload;
WebRtc_Word32 _payloadAllocLen;
WebRtc_Word32 _frameRateFps;
int32_t _payloadSizeBytes;
uint8_t *_payload;
int32_t _payloadAllocLen;
int32_t _frameRateFps;
double _spreadFactor;
};
class PeriodicKeyFixFRGenerator : public CBRFixFRGenerator // constant bitrate and fixed frame rate with periodically large frames
{
public:
PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps, WebRtc_Word32 rtpSampleRate = 90000,
WebRtc_Word32 frameRateFps = 30, double spread = 0.0, double keyFactor = 4.0, WebRtc_UWord32 keyPeriod = 300);
PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps, int32_t rtpSampleRate = 90000,
int32_t frameRateFps = 30, double spread = 0.0, double keyFactor = 4.0, uint32_t keyPeriod = 300);
virtual ~PeriodicKeyFixFRGenerator () {}
protected:
virtual WebRtc_Word32 nextPayloadSize ();
virtual int32_t nextPayloadSize ();
double _keyFactor;
WebRtc_UWord32 _keyPeriod;
WebRtc_UWord32 _frameCount;
uint32_t _keyPeriod;
uint32_t _frameCount;
};
// Probably better to inherit CBRFixFRGenerator from CBRVarFRGenerator, but since
@ -112,33 +112,33 @@ protected:
class CBRVarFRGenerator : public CBRFixFRGenerator // constant bitrate and variable frame rate
{
public:
CBRVarFRGenerator(TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps, const WebRtc_UWord8* frameRates,
WebRtc_UWord16 numFrameRates, WebRtc_Word32 rtpSampleRate = 90000, double avgFrPeriodMs = 5.0,
CBRVarFRGenerator(TestSenderReceiver *sender, int32_t bitrateKbps, const uint8_t* frameRates,
uint16_t numFrameRates, int32_t rtpSampleRate = 90000, double avgFrPeriodMs = 5.0,
double frSpreadFactor = 0.05, double spreadFactor = 0.0);
~CBRVarFRGenerator();
protected:
virtual void ChangeFrameRate();
virtual WebRtc_Word32 nextPayloadSize ();
virtual int32_t nextPayloadSize ();
double _avgFrPeriodMs;
double _frSpreadFactor;
WebRtc_UWord8* _frameRates;
WebRtc_UWord16 _numFrameRates;
WebRtc_Word64 _frChangeTimeMs;
uint8_t* _frameRates;
uint16_t _numFrameRates;
int64_t _frChangeTimeMs;
};
class CBRFrameDropGenerator : public CBRFixFRGenerator // constant bitrate and variable frame rate
{
public:
CBRFrameDropGenerator(TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps,
WebRtc_Word32 rtpSampleRate = 90000, double spreadFactor = 0.0);
CBRFrameDropGenerator(TestSenderReceiver *sender, int32_t bitrateKbps,
int32_t rtpSampleRate = 90000, double spreadFactor = 0.0);
~CBRFrameDropGenerator();
protected:
virtual WebRtc_Word32 nextPayloadSize();
virtual int32_t nextPayloadSize();
double _accBits;
};

View File

@ -71,7 +71,7 @@ _lastTime(-1)
}
// SocketTransport module
WebRtc_UWord8 numberOfThreads = 1;
uint8_t numberOfThreads = 1;
_transport = UdpTransport::Create(0, numberOfThreads);
if (!_transport)
{
@ -104,9 +104,9 @@ TestSenderReceiver::~TestSenderReceiver (void)
}
WebRtc_Word32 TestSenderReceiver::InitReceiver (const WebRtc_UWord16 rtpPort,
const WebRtc_UWord16 rtcpPort,
const WebRtc_Word8 payloadType /*= 127*/)
int32_t TestSenderReceiver::InitReceiver (const uint16_t rtpPort,
const uint16_t rtcpPort,
const int8_t payloadType /*= 127*/)
{
CriticalSectionScoped cs(_critSect);
@ -153,7 +153,7 @@ WebRtc_Word32 TestSenderReceiver::InitReceiver (const WebRtc_UWord16 rtpPort,
}
WebRtc_Word32 TestSenderReceiver::Start()
int32_t TestSenderReceiver::Start()
{
CriticalSectionScoped cs(_critSect);
@ -191,7 +191,7 @@ WebRtc_Word32 TestSenderReceiver::Start()
}
WebRtc_Word32 TestSenderReceiver::Stop ()
int32_t TestSenderReceiver::Stop ()
{
CriticalSectionScoped cs(_critSect);
@ -232,12 +232,12 @@ bool TestSenderReceiver::ProcLoop(void)
while (_running)
{
// ask RTP/RTCP module for wait time
WebRtc_Word32 rtpWait = _rtp->TimeUntilNextProcess();
int32_t rtpWait = _rtp->TimeUntilNextProcess();
// ask SocketTransport module for wait time
WebRtc_Word32 tpWait = _transport->TimeUntilNextProcess();
int32_t tpWait = _transport->TimeUntilNextProcess();
WebRtc_Word32 minWait = (rtpWait < tpWait) ? rtpWait: tpWait;
int32_t minWait = (rtpWait < tpWait) ? rtpWait: tpWait;
minWait = (minWait > 0) ? minWait : 0;
// wait
_eventPtr->Wait(minWait);
@ -254,23 +254,23 @@ bool TestSenderReceiver::ProcLoop(void)
}
WebRtc_Word32 TestSenderReceiver::ReceiveBitrateKbps ()
int32_t TestSenderReceiver::ReceiveBitrateKbps ()
{
WebRtc_UWord32 bytesSent;
WebRtc_UWord32 packetsSent;
WebRtc_UWord32 bytesReceived;
WebRtc_UWord32 packetsReceived;
uint32_t bytesSent;
uint32_t packetsSent;
uint32_t bytesReceived;
uint32_t packetsReceived;
if (_rtp->DataCountersRTP(&bytesSent, &packetsSent, &bytesReceived, &packetsReceived) == 0)
{
WebRtc_Word64 now = TickTime::MillisecondTimestamp();
WebRtc_Word32 kbps = 0;
int64_t now = TickTime::MillisecondTimestamp();
int32_t kbps = 0;
if (now > _lastTime)
{
if (_lastTime > 0)
{
// 8 * bytes / ms = kbps
kbps = static_cast<WebRtc_Word32>(
kbps = static_cast<int32_t>(
(8 * (bytesReceived - _lastBytesReceived)) / (now - _lastTime));
}
_lastTime = now;
@ -283,13 +283,13 @@ WebRtc_Word32 TestSenderReceiver::ReceiveBitrateKbps ()
}
WebRtc_Word32 TestSenderReceiver::SetPacketTimeout(const WebRtc_UWord32 timeoutMS)
int32_t TestSenderReceiver::SetPacketTimeout(const uint32_t timeoutMS)
{
return (_rtp->SetPacketTimeout(timeoutMS, 0 /* RTCP timeout */));
}
void TestSenderReceiver::OnPacketTimeout(const WebRtc_Word32 id)
void TestSenderReceiver::OnPacketTimeout(const int32_t id)
{
CriticalSectionScoped lock(_critSect);
@ -297,7 +297,7 @@ void TestSenderReceiver::OnPacketTimeout(const WebRtc_Word32 id)
}
void TestSenderReceiver::OnReceivedPacket(const WebRtc_Word32 id,
void TestSenderReceiver::OnReceivedPacket(const int32_t id,
const RtpRtcpPacketType packetType)
{
// do nothing
@ -305,31 +305,31 @@ void TestSenderReceiver::OnReceivedPacket(const WebRtc_Word32 id,
}
WebRtc_Word32 TestSenderReceiver::OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader)
int32_t TestSenderReceiver::OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader)
{
//printf("OnReceivedPayloadData\n");
return (0);
}
void TestSenderReceiver::IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket,
const WebRtc_Word32 rtpPacketLength,
const WebRtc_Word8* fromIP,
const WebRtc_UWord16 fromPort)
void TestSenderReceiver::IncomingRTPPacket(const int8_t* incomingRtpPacket,
const int32_t rtpPacketLength,
const int8_t* fromIP,
const uint16_t fromPort)
{
_rtp->IncomingPacket((WebRtc_UWord8 *) incomingRtpPacket, static_cast<WebRtc_UWord16>(rtpPacketLength));
_rtp->IncomingPacket((uint8_t *) incomingRtpPacket, static_cast<uint16_t>(rtpPacketLength));
}
void TestSenderReceiver::IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket,
const WebRtc_Word32 rtcpPacketLength,
const WebRtc_Word8* fromIP,
const WebRtc_UWord16 fromPort)
void TestSenderReceiver::IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
const int32_t rtcpPacketLength,
const int8_t* fromIP,
const uint16_t fromPort)
{
_rtp->IncomingPacket((WebRtc_UWord8 *) incomingRtcpPacket, static_cast<WebRtc_UWord16>(rtcpPacketLength));
_rtp->IncomingPacket((uint8_t *) incomingRtcpPacket, static_cast<uint16_t>(rtcpPacketLength));
}
@ -339,11 +339,11 @@ void TestSenderReceiver::IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPack
///////////////////
WebRtc_Word32 TestSenderReceiver::InitSender (const WebRtc_UWord32 startBitrateKbps,
const WebRtc_Word8* ipAddr,
const WebRtc_UWord16 rtpPort,
const WebRtc_UWord16 rtcpPort /*= 0*/,
const WebRtc_Word8 payloadType /*= 127*/)
int32_t TestSenderReceiver::InitSender (const uint32_t startBitrateKbps,
const int8_t* ipAddr,
const uint16_t rtpPort,
const uint16_t rtcpPort /*= 0*/,
const int8_t payloadType /*= 127*/)
{
CriticalSectionScoped cs(_critSect);
@ -399,17 +399,17 @@ WebRtc_Word32 TestSenderReceiver::InitSender (const WebRtc_UWord32 startBitrateK
WebRtc_Word32
TestSenderReceiver::SendOutgoingData(const WebRtc_UWord32 timeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
int32_t
TestSenderReceiver::SendOutgoingData(const uint32_t timeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
const webrtc::FrameType frameType /*= webrtc::kVideoFrameDelta*/)
{
return (_rtp->SendOutgoingData(frameType, _payloadType, timeStamp, payloadData, payloadSize));
}
WebRtc_Word32 TestSenderReceiver::SetLoadGenerator(TestLoadGenerator *generator)
int32_t TestSenderReceiver::SetLoadGenerator(TestLoadGenerator *generator)
{
CriticalSectionScoped cs(_critSect);
@ -418,13 +418,13 @@ WebRtc_Word32 TestSenderReceiver::SetLoadGenerator(TestLoadGenerator *generator)
}
void TestSenderReceiver::OnNetworkChanged(const WebRtc_Word32 id,
const WebRtc_UWord32 minBitrateBps,
const WebRtc_UWord32 maxBitrateBps,
const WebRtc_UWord8 fractionLost,
const WebRtc_UWord16 roundTripTimeMs,
const WebRtc_UWord16 bwEstimateKbitMin,
const WebRtc_UWord16 bwEstimateKbitMax)
void TestSenderReceiver::OnNetworkChanged(const int32_t id,
const uint32_t minBitrateBps,
const uint32_t maxBitrateBps,
const uint8_t fractionLost,
const uint16_t roundTripTimeMs,
const uint16_t bwEstimateKbitMin,
const uint16_t bwEstimateKbitMax)
{
if (_loadGenerator)
{

View File

@ -31,11 +31,11 @@ using namespace webrtc;
class SendRecCB
{
public:
virtual void OnOnNetworkChanged(const WebRtc_UWord32 bitrateTarget,
const WebRtc_UWord8 fractionLost,
const WebRtc_UWord16 roundTripTimeMs,
const WebRtc_UWord16 bwEstimateKbitMin,
const WebRtc_UWord16 bwEstimateKbitMax) = 0;
virtual void OnOnNetworkChanged(const uint32_t bitrateTarget,
const uint8_t fractionLost,
const uint16_t roundTripTimeMs,
const uint16_t bwEstimateKbitMin,
const uint16_t bwEstimateKbitMax) = 0;
virtual ~SendRecCB() {};
};
@ -51,99 +51,99 @@ public:
void SetCallback (SendRecCB *cb) { _sendRecCB = cb; };
WebRtc_Word32 Start();
int32_t Start();
WebRtc_Word32 Stop();
int32_t Stop();
bool ProcLoop();
/////////////////////////////////////////////
// Receiver methods
WebRtc_Word32 InitReceiver (const WebRtc_UWord16 rtpPort,
const WebRtc_UWord16 rtcpPort = 0,
const WebRtc_Word8 payloadType = 127);
int32_t InitReceiver (const uint16_t rtpPort,
const uint16_t rtcpPort = 0,
const int8_t payloadType = 127);
WebRtc_Word32 ReceiveBitrateKbps ();
int32_t ReceiveBitrateKbps ();
WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 timeoutMS);
int32_t SetPacketTimeout(const uint32_t timeoutMS);
bool timeOutTriggered () { return (_timeOut); };
// Inherited from RtpFeedback
virtual WebRtc_Word32 OnInitializeDecoder(const WebRtc_Word32 id,
const WebRtc_Word8 payloadType,
const WebRtc_Word8 payloadName[RTP_PAYLOAD_NAME_SIZE],
const WebRtc_UWord32 frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) { return(0);};
virtual int32_t OnInitializeDecoder(const int32_t id,
const int8_t payloadType,
const int8_t payloadName[RTP_PAYLOAD_NAME_SIZE],
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) { return(0);};
virtual void OnPacketTimeout(const WebRtc_Word32 id);
virtual void OnPacketTimeout(const int32_t id);
virtual void OnReceivedPacket(const WebRtc_Word32 id,
virtual void OnReceivedPacket(const int32_t id,
const RtpRtcpPacketType packetType);
virtual void OnPeriodicDeadOrAlive(const WebRtc_Word32 id,
virtual void OnPeriodicDeadOrAlive(const int32_t id,
const RTPAliveType alive) {};
virtual void OnIncomingSSRCChanged( const WebRtc_Word32 id,
const WebRtc_UWord32 SSRC) {};
virtual void OnIncomingSSRCChanged( const int32_t id,
const uint32_t SSRC) {};
virtual void OnIncomingCSRCChanged( const WebRtc_Word32 id,
const WebRtc_UWord32 CSRC,
virtual void OnIncomingCSRCChanged( const int32_t id,
const uint32_t CSRC,
const bool added) {};
// Inherited from RtpData
virtual WebRtc_Word32 OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader);
virtual int32_t OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader);
// Inherited from UdpTransportData
virtual void IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket,
const WebRtc_Word32 rtpPacketLength,
const WebRtc_Word8* fromIP,
const WebRtc_UWord16 fromPort);
virtual void IncomingRTPPacket(const int8_t* incomingRtpPacket,
const int32_t rtpPacketLength,
const int8_t* fromIP,
const uint16_t fromPort);
virtual void IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket,
const WebRtc_Word32 rtcpPacketLength,
const WebRtc_Word8* fromIP,
const WebRtc_UWord16 fromPort);
virtual void IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
const int32_t rtcpPacketLength,
const int8_t* fromIP,
const uint16_t fromPort);
/////////////////////////////////
// Sender methods
WebRtc_Word32 InitSender (const WebRtc_UWord32 startBitrateKbps,
const WebRtc_Word8* ipAddr,
const WebRtc_UWord16 rtpPort,
const WebRtc_UWord16 rtcpPort = 0,
const WebRtc_Word8 payloadType = 127);
int32_t InitSender (const uint32_t startBitrateKbps,
const int8_t* ipAddr,
const uint16_t rtpPort,
const uint16_t rtcpPort = 0,
const int8_t payloadType = 127);
WebRtc_Word32 SendOutgoingData(const WebRtc_UWord32 timeStamp,
const WebRtc_UWord8* payloadData,
const WebRtc_UWord32 payloadSize,
int32_t SendOutgoingData(const uint32_t timeStamp,
const uint8_t* payloadData,
const uint32_t payloadSize,
const webrtc::FrameType frameType = webrtc::kVideoFrameDelta);
WebRtc_Word32 SetLoadGenerator(TestLoadGenerator *generator);
int32_t SetLoadGenerator(TestLoadGenerator *generator);
WebRtc_UWord32 BitrateSent() { return (_rtp->BitrateSent()); };
uint32_t BitrateSent() { return (_rtp->BitrateSent()); };
// Inherited from RtpVideoFeedback
virtual void OnReceivedIntraFrameRequest(const WebRtc_Word32 id,
const WebRtc_UWord8 message = 0) {};
virtual void OnReceivedIntraFrameRequest(const int32_t id,
const uint8_t message = 0) {};
virtual void OnNetworkChanged(const WebRtc_Word32 id,
const WebRtc_UWord32 minBitrateBps,
const WebRtc_UWord32 maxBitrateBps,
const WebRtc_UWord8 fractionLost,
const WebRtc_UWord16 roundTripTimeMs,
const WebRtc_UWord16 bwEstimateKbitMin,
const WebRtc_UWord16 bwEstimateKbitMax);
virtual void OnNetworkChanged(const int32_t id,
const uint32_t minBitrateBps,
const uint32_t maxBitrateBps,
const uint8_t fractionLost,
const uint16_t roundTripTimeMs,
const uint16_t bwEstimateKbitMin,
const uint16_t bwEstimateKbitMax);
private:
RtpRtcp* _rtp;
@ -152,14 +152,14 @@ private:
webrtc::EventWrapper *_eventPtr;
webrtc::ThreadWrapper* _procThread;
bool _running;
WebRtc_Word8 _payloadType;
int8_t _payloadType;
TestLoadGenerator* _loadGenerator;
bool _isSender;
bool _isReceiver;
bool _timeOut;
SendRecCB * _sendRecCB;
WebRtc_UWord32 _lastBytesReceived;
WebRtc_Word64 _lastTime;
uint32_t _lastBytesReceived;
int64_t _lastTime;
};

View File

@ -17,12 +17,12 @@
#include <tchar.h>
#include <windows.h>
WebRtc_UWord32 BitRateBPS(WebRtc_UWord16 x )
uint32_t BitRateBPS(uint16_t x )
{
return (x & 0x3fff) * WebRtc_UWord32(pow(10.0f,(2 + (x >> 14))));
return (x & 0x3fff) * uint32_t(pow(10.0f,(2 + (x >> 14))));
}
WebRtc_UWord16 BitRateBPSInv(WebRtc_UWord32 x )
uint16_t BitRateBPSInv(uint32_t x )
{
// 16383 0x3fff
// 1 638 300 exp 0
@ -32,16 +32,16 @@ WebRtc_UWord16 BitRateBPSInv(WebRtc_UWord32 x )
const float exp = log10(float(x>>14)) - 2;
if(exp < 0.0)
{
return WebRtc_UWord16(x /100);
return uint16_t(x /100);
}else if(exp < 1.0)
{
return 0x4000 + WebRtc_UWord16(x /1000);
return 0x4000 + uint16_t(x /1000);
}else if(exp < 2.0)
{
return 0x8000 + WebRtc_UWord16(x /10000);
return 0x8000 + uint16_t(x /10000);
}else if(exp < 3.0)
{
return 0xC000 + WebRtc_UWord16(x /100000);
return 0xC000 + uint16_t(x /100000);
} else
{
assert(false);
@ -52,7 +52,7 @@ WebRtc_UWord16 BitRateBPSInv(WebRtc_UWord32 x )
int _tmain(int argc, _TCHAR* argv[])
{
WebRtc_UWord8 dataBuffer[128];
uint8_t dataBuffer[128];
BitstreamBuilder builder(dataBuffer, sizeof(dataBuffer));
// test 1 to 4 bits
@ -278,27 +278,27 @@ int _tmain(int argc, _TCHAR* argv[])
BitstreamBuilder builderScalabilityInfo(dataBuffer, sizeof(dataBuffer));
BitstreamParser parserScalabilityInfo(dataBuffer, sizeof(dataBuffer));
const WebRtc_UWord8 numberOfLayers = 4;
const WebRtc_UWord8 layerId[numberOfLayers] = {0,1,2,3};
const WebRtc_UWord8 priorityId[numberOfLayers] = {0,1,2,3};
const WebRtc_UWord8 discardableId[numberOfLayers] = {0,1,1,1};
const uint8_t numberOfLayers = 4;
const uint8_t layerId[numberOfLayers] = {0,1,2,3};
const uint8_t priorityId[numberOfLayers] = {0,1,2,3};
const uint8_t discardableId[numberOfLayers] = {0,1,1,1};
const WebRtc_UWord8 dependencyId[numberOfLayers]= {0,1,1,1};
const WebRtc_UWord8 qualityId[numberOfLayers]= {0,0,0,1};
const WebRtc_UWord8 temporalId[numberOfLayers]= {0,0,1,1};
const uint8_t dependencyId[numberOfLayers]= {0,1,1,1};
const uint8_t qualityId[numberOfLayers]= {0,0,0,1};
const uint8_t temporalId[numberOfLayers]= {0,0,1,1};
const WebRtc_UWord16 avgBitrate[numberOfLayers]= {BitRateBPSInv(100000),
const uint16_t avgBitrate[numberOfLayers]= {BitRateBPSInv(100000),
BitRateBPSInv(200000),
BitRateBPSInv(400000),
BitRateBPSInv(800000)};
// todo which one is the sum?
const WebRtc_UWord16 maxBitrateLayer[numberOfLayers]= {BitRateBPSInv(150000),
const uint16_t maxBitrateLayer[numberOfLayers]= {BitRateBPSInv(150000),
BitRateBPSInv(300000),
BitRateBPSInv(500000),
BitRateBPSInv(900000)};
const WebRtc_UWord16 maxBitrateLayerRepresentation[numberOfLayers] = {BitRateBPSInv(150000),
const uint16_t maxBitrateLayerRepresentation[numberOfLayers] = {BitRateBPSInv(150000),
BitRateBPSInv(450000),
BitRateBPSInv(950000),
BitRateBPSInv(1850000)};
@ -314,7 +314,7 @@ int _tmain(int argc, _TCHAR* argv[])
assert( 18500000 == BitRateBPS(BitRateBPSInv(18500000)));
assert( 185000000 == BitRateBPS(BitRateBPSInv(185000000)));
const WebRtc_UWord16 maxBitrareCalcWindow[numberOfLayers] = {200, 200,200,200};// in 1/100 of second
const uint16_t maxBitrareCalcWindow[numberOfLayers] = {200, 200,200,200};// in 1/100 of second
builderScalabilityInfo.Add1Bit(0); // temporal_id_nesting_flag
builderScalabilityInfo.Add1Bit(0); // priority_layer_info_present_flag
@ -360,11 +360,11 @@ int _tmain(int argc, _TCHAR* argv[])
// Scalability Info parser
parserScalabilityInfo.Get1Bit(); // not used in futher parsing
const WebRtc_UWord8 priority_layer_info_present = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 priority_id_setting_flag = parserScalabilityInfo.Get1Bit();
const uint8_t priority_layer_info_present = parserScalabilityInfo.Get1Bit();
const uint8_t priority_id_setting_flag = parserScalabilityInfo.Get1Bit();
WebRtc_UWord32 numberOfLayersMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 j = 0; j<= numberOfLayersMinusOne; j++)
uint32_t numberOfLayersMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t j = 0; j<= numberOfLayersMinusOne; j++)
{
parserScalabilityInfo.GetUE();
parserScalabilityInfo.Get6Bits();
@ -373,24 +373,24 @@ int _tmain(int argc, _TCHAR* argv[])
parserScalabilityInfo.Get4Bits();
parserScalabilityInfo.Get3Bits();
const WebRtc_UWord8 sub_pic_layer_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 sub_region_layer_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 iroi_division_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 profile_level_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 bitrate_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 frm_rate_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 frm_size_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 layer_dependency_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 parameter_sets_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 bitstream_restriction_info_present_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 exact_inter_layer_pred_flag = parserScalabilityInfo.Get1Bit(); // not used in futher parsing
const uint8_t sub_pic_layer_flag = parserScalabilityInfo.Get1Bit();
const uint8_t sub_region_layer_flag = parserScalabilityInfo.Get1Bit();
const uint8_t iroi_division_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t profile_level_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t bitrate_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t frm_rate_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t frm_size_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t layer_dependency_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t parameter_sets_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t bitstream_restriction_info_present_flag = parserScalabilityInfo.Get1Bit();
const uint8_t exact_inter_layer_pred_flag = parserScalabilityInfo.Get1Bit(); // not used in futher parsing
if(sub_pic_layer_flag || iroi_division_info_present_flag)
{
parserScalabilityInfo.Get1Bit();
}
const WebRtc_UWord8 layer_conversion_flag = parserScalabilityInfo.Get1Bit();
const WebRtc_UWord8 layer_output_flag = parserScalabilityInfo.Get1Bit(); // not used in futher parsing
const uint8_t layer_conversion_flag = parserScalabilityInfo.Get1Bit();
const uint8_t layer_output_flag = parserScalabilityInfo.Get1Bit(); // not used in futher parsing
if(profile_level_info_present_flag)
{
@ -440,8 +440,8 @@ int _tmain(int argc, _TCHAR* argv[])
parserScalabilityInfo.GetUE();
}else
{
const WebRtc_UWord32 numRoisMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k <= numRoisMinusOne; k++)
const uint32_t numRoisMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t k = 0; k <= numRoisMinusOne; k++)
{
parserScalabilityInfo.GetUE();
parserScalabilityInfo.GetUE();
@ -451,8 +451,8 @@ int _tmain(int argc, _TCHAR* argv[])
}
if(layer_dependency_info_present_flag)
{
const WebRtc_UWord32 numDirectlyDependentLayers = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k < numDirectlyDependentLayers; k++)
const uint32_t numDirectlyDependentLayers = parserScalabilityInfo.GetUE();
for(uint32_t k = 0; k < numDirectlyDependentLayers; k++)
{
parserScalabilityInfo.GetUE();
}
@ -462,18 +462,18 @@ int _tmain(int argc, _TCHAR* argv[])
}
if(parameter_sets_info_present_flag)
{
const WebRtc_UWord32 numSeqParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k <= numSeqParameterSetMinusOne; k++)
const uint32_t numSeqParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t k = 0; k <= numSeqParameterSetMinusOne; k++)
{
parserScalabilityInfo.GetUE();
}
const WebRtc_UWord32 numSubsetSeqParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 l = 0; l <= numSubsetSeqParameterSetMinusOne; l++)
const uint32_t numSubsetSeqParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t l = 0; l <= numSubsetSeqParameterSetMinusOne; l++)
{
parserScalabilityInfo.GetUE();
}
const WebRtc_UWord32 numPicParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 m = 0; m <= numPicParameterSetMinusOne; m++)
const uint32_t numPicParameterSetMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t m = 0; m <= numPicParameterSetMinusOne; m++)
{
parserScalabilityInfo.GetUE();
}
@ -494,7 +494,7 @@ int _tmain(int argc, _TCHAR* argv[])
if(layer_conversion_flag)
{
parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k <2;k++)
for(uint32_t k = 0; k <2;k++)
{
if(parserScalabilityInfo.Get1Bit())
{
@ -507,12 +507,12 @@ int _tmain(int argc, _TCHAR* argv[])
}
if(priority_layer_info_present)
{
const WebRtc_UWord32 prNumDidMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 k = 0; k <= prNumDidMinusOne;k++)
const uint32_t prNumDidMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t k = 0; k <= prNumDidMinusOne;k++)
{
parserScalabilityInfo.Get3Bits();
const WebRtc_UWord32 prNumMinusOne = parserScalabilityInfo.GetUE();
for(WebRtc_UWord32 l = 0; l <= prNumMinusOne; l++)
const uint32_t prNumMinusOne = parserScalabilityInfo.GetUE();
for(uint32_t l = 0; l <= prNumMinusOne; l++)
{
parserScalabilityInfo.GetUE();
parserScalabilityInfo.Get24Bits();
@ -523,8 +523,8 @@ int _tmain(int argc, _TCHAR* argv[])
}
if(priority_id_setting_flag)
{
WebRtc_UWord8 priorityIdSettingUri;
WebRtc_UWord32 priorityIdSettingUriIdx = 0;
uint8_t priorityIdSettingUri;
uint32_t priorityIdSettingUriIdx = 0;
do
{
priorityIdSettingUri = parserScalabilityInfo.Get8Bits();

View File

@ -41,10 +41,10 @@ class RtpRtcpAPITest : public ::testing::Test {
int test_id;
RtpRtcp* module;
WebRtc_UWord32 test_ssrc;
WebRtc_UWord32 test_timestamp;
WebRtc_UWord16 test_sequence_number;
WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
uint32_t test_ssrc;
uint32_t test_timestamp;
uint16_t test_sequence_number;
uint32_t test_CSRC[webrtc::kRtpCsrcSize];
SimulatedClock fake_clock;
};
@ -80,7 +80,7 @@ TEST_F(RtpRtcpAPITest, SSRC) {
TEST_F(RtpRtcpAPITest, CSRC) {
EXPECT_EQ(0, module->SetCSRCs(test_CSRC, 2));
WebRtc_UWord32 testOfCSRC[webrtc::kRtpCsrcSize];
uint32_t testOfCSRC[webrtc::kRtpCsrcSize];
EXPECT_EQ(2, module->CSRCs(testOfCSRC));
EXPECT_EQ(test_CSRC[0], testOfCSRC[0]);
EXPECT_EQ(test_CSRC[1], testOfCSRC[1]);

View File

@ -37,13 +37,13 @@ class LoopBackTransport : public webrtc::Transport {
return len;
}
}
if (_rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)data, len) == 0) {
if (_rtpRtcpModule->IncomingPacket((const uint8_t*)data, len) == 0) {
return len;
}
return -1;
}
virtual int SendRTCPPacket(int channel, const void *data, int len) {
if (_rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)data, len) == 0) {
if (_rtpRtcpModule->IncomingPacket((const uint8_t*)data, len) == 0) {
return len;
}
return -1;
@ -58,9 +58,9 @@ class RtpReceiver : public RtpData {
public:
enum { kMaxPayloadSize = 1500 };
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) {
EXPECT_LE(payloadSize, kMaxPayloadSize);
memcpy(_payloadData, payloadData, payloadSize);
@ -69,11 +69,11 @@ class RtpReceiver : public RtpData {
return 0;
}
const WebRtc_UWord8* payload_data() const {
const uint8_t* payload_data() const {
return _payloadData;
}
WebRtc_UWord16 payload_size() const {
uint16_t payload_size() const {
return _payloadSize;
}
@ -82,8 +82,8 @@ class RtpReceiver : public RtpData {
}
private:
WebRtc_UWord8 _payloadData[kMaxPayloadSize];
WebRtc_UWord16 _payloadSize;
uint8_t _payloadData[kMaxPayloadSize];
uint16_t _payloadSize;
webrtc::WebRtcRTPHeader _rtpHeader;
};

View File

@ -24,9 +24,9 @@ using namespace webrtc;
class VerifyingAudioReceiver : public RtpData {
public:
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) {
if (rtpHeader->header.payloadType == 98 ||
rtpHeader->header.payloadType == 99) {
@ -60,44 +60,44 @@ class VerifyingAudioReceiver : public RtpData {
class RTPCallback : public RtpFeedback {
public:
virtual WebRtc_Word32 OnInitializeDecoder(
const WebRtc_Word32 id,
const WebRtc_Word8 payloadType,
virtual int32_t OnInitializeDecoder(
const int32_t id,
const int8_t payloadType,
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const int frequency,
const WebRtc_UWord8 channels,
const WebRtc_UWord32 rate) {
const uint8_t channels,
const uint32_t rate) {
if (payloadType == 96) {
EXPECT_EQ(test_rate, rate) <<
"The rate should be 64K for this payloadType";
}
return 0;
}
virtual void OnPacketTimeout(const WebRtc_Word32 id) {
virtual void OnPacketTimeout(const int32_t id) {
}
virtual void OnReceivedPacket(const WebRtc_Word32 id,
virtual void OnReceivedPacket(const int32_t id,
const RtpRtcpPacketType packetType) {
}
virtual void OnPeriodicDeadOrAlive(const WebRtc_Word32 id,
virtual void OnPeriodicDeadOrAlive(const int32_t id,
const RTPAliveType alive) {
}
virtual void OnIncomingSSRCChanged(const WebRtc_Word32 id,
const WebRtc_UWord32 SSRC) {
virtual void OnIncomingSSRCChanged(const int32_t id,
const uint32_t SSRC) {
}
virtual void OnIncomingCSRCChanged(const WebRtc_Word32 id,
const WebRtc_UWord32 CSRC,
virtual void OnIncomingCSRCChanged(const int32_t id,
const uint32_t CSRC,
const bool added) {
}
};
class AudioFeedback : public RtpAudioFeedback {
virtual void OnReceivedTelephoneEvent(const WebRtc_Word32 id,
const WebRtc_UWord8 event,
virtual void OnReceivedTelephoneEvent(const int32_t id,
const uint8_t event,
const bool end) {
static WebRtc_UWord8 expectedEvent = 0;
static uint8_t expectedEvent = 0;
if (end) {
WebRtc_UWord8 oldEvent = expectedEvent-1;
uint8_t oldEvent = expectedEvent-1;
if (expectedEvent == 32) {
oldEvent = 15;
}
@ -110,10 +110,10 @@ class AudioFeedback : public RtpAudioFeedback {
expectedEvent = 32;
}
}
virtual void OnPlayTelephoneEvent(const WebRtc_Word32 id,
const WebRtc_UWord8 event,
const WebRtc_UWord16 lengthMs,
const WebRtc_UWord8 volume) {
virtual void OnPlayTelephoneEvent(const int32_t id,
const uint8_t event,
const uint16_t lengthMs,
const uint8_t volume) {
};
};
@ -179,10 +179,10 @@ class RtpRtcpAudioTest : public ::testing::Test {
LoopBackTransport* transport2;
AudioFeedback* audioFeedback;
RTPCallback* rtp_callback;
WebRtc_UWord32 test_ssrc;
WebRtc_UWord32 test_timestamp;
WebRtc_UWord16 test_sequence_number;
WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
uint32_t test_ssrc;
uint32_t test_timestamp;
uint16_t test_sequence_number;
uint32_t test_CSRC[webrtc::kRtpCsrcSize];
SimulatedClock fake_clock;
};
@ -214,7 +214,7 @@ TEST_F(RtpRtcpAudioTest, Basic) {
EXPECT_EQ(0, module2->RegisterReceivePayload(voiceCodec));
printf("4\n");
const WebRtc_UWord8 test[5] = "test";
const uint8_t test[5] = "test";
EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
0, -1, test, 4));
@ -243,7 +243,7 @@ TEST_F(RtpRtcpAudioTest, RED) {
memcpy(voiceCodec.plname, "RED", 4);
EXPECT_EQ(0, module1->SetSendREDPayloadType(voiceCodec.pltype));
WebRtc_Word8 red = 0;
int8_t red = 0;
EXPECT_EQ(0, module1->SendREDPayloadType(red));
EXPECT_EQ(voiceCodec.pltype, red);
EXPECT_EQ(0, module1->RegisterReceivePayload(voiceCodec));
@ -251,20 +251,20 @@ TEST_F(RtpRtcpAudioTest, RED) {
RTPFragmentationHeader fragmentation;
fragmentation.fragmentationVectorSize = 2;
fragmentation.fragmentationLength = new WebRtc_UWord32[2];
fragmentation.fragmentationLength = new uint32_t[2];
fragmentation.fragmentationLength[0] = 4;
fragmentation.fragmentationLength[1] = 4;
fragmentation.fragmentationOffset = new WebRtc_UWord32[2];
fragmentation.fragmentationOffset = new uint32_t[2];
fragmentation.fragmentationOffset[0] = 0;
fragmentation.fragmentationOffset[1] = 4;
fragmentation.fragmentationTimeDiff = new WebRtc_UWord16[2];
fragmentation.fragmentationTimeDiff = new uint16_t[2];
fragmentation.fragmentationTimeDiff[0] = 0;
fragmentation.fragmentationTimeDiff[1] = 0;
fragmentation.fragmentationPlType = new WebRtc_UWord8[2];
fragmentation.fragmentationPlType = new uint8_t[2];
fragmentation.fragmentationPlType[0] = 96;
fragmentation.fragmentationPlType[1] = 96;
const WebRtc_UWord8 test[5] = "test";
const uint8_t test[5] = "test";
// Send a RTP packet.
EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech,
96, 160, -1, test, 4,
@ -299,7 +299,7 @@ TEST_F(RtpRtcpAudioTest, DTMF) {
EXPECT_EQ(0, module2->RegisterReceivePayload(voiceCodec));
// Start DTMF test.
WebRtc_UWord32 timeStamp = 160;
uint32_t timeStamp = 160;
// Send a DTMF tone using RFC 2833 (4733).
for (int i = 0; i < 16; i++) {
@ -307,7 +307,7 @@ TEST_F(RtpRtcpAudioTest, DTMF) {
}
timeStamp += 160; // Prepare for next packet.
const WebRtc_UWord8 test[9] = "test";
const uint8_t test[9] = "test";
// Send RTP packets for 16 tones a 160 ms 100ms
// pause between = 2560ms + 1600ms = 4160ms

View File

@ -24,9 +24,9 @@ using namespace webrtc;
const int kVideoNackListSize = 10;
const int kTestId = 123;
const WebRtc_UWord32 kTestSsrc = 3456;
const WebRtc_UWord16 kTestSequenceNumber = 2345;
const WebRtc_UWord32 kTestNumberOfPackets = 450;
const uint32_t kTestSsrc = 3456;
const uint16_t kTestSequenceNumber = 2345;
const uint32_t kTestNumberOfPackets = 450;
const int kTestNumberOfRtxPackets = 49;
class VerifyingNackReceiver : public RtpData
@ -34,9 +34,9 @@ class VerifyingNackReceiver : public RtpData
public:
VerifyingNackReceiver() {}
virtual WebRtc_Word32 OnReceivedPayloadData(
const WebRtc_UWord8* data,
const WebRtc_UWord16 size,
virtual int32_t OnReceivedPayloadData(
const uint8_t* data,
const uint16_t size,
const webrtc::WebRtcRTPHeader* rtp_header) {
EXPECT_EQ(kTestSsrc, rtp_header->header.ssrc);
@ -91,13 +91,13 @@ class NackLoopBackTransport : public webrtc::Transport {
count_ < consecutive_drop_end_) {
return len;
}
if (module_->IncomingPacket((const WebRtc_UWord8*)data, len) == 0) {
if (module_->IncomingPacket((const uint8_t*)data, len) == 0) {
return len;
}
return -1;
}
virtual int SendRTCPPacket(int channel, const void *data, int len) {
if (module_->IncomingPacket((const WebRtc_UWord8*)data, len) == 0) {
if (module_->IncomingPacket((const uint8_t*)data, len) == 0) {
return len;
}
return -1;
@ -171,12 +171,12 @@ class RtpRtcpNackTest : public ::testing::Test {
nack_receiver_->sequence_numbers_.begin();
while (it != nack_receiver_->sequence_numbers_.end()) {
WebRtc_UWord16 sequence_number_1 = *it;
uint16_t sequence_number_1 = *it;
++it;
if (it != nack_receiver_->sequence_numbers_.end()) {
WebRtc_UWord16 sequence_number_2 = *it;
uint16_t sequence_number_2 = *it;
// Add all missing sequence numbers to list
for (WebRtc_UWord16 i = sequence_number_1 + 1; i < sequence_number_2;
for (uint16_t i = sequence_number_1 + 1; i < sequence_number_2;
++i) {
missing_sequence_numbers.push_back(i);
}
@ -203,13 +203,13 @@ class RtpRtcpNackTest : public ::testing::Test {
RtpRtcp* video_module_;
NackLoopBackTransport* transport_;
VerifyingNackReceiver* nack_receiver_;
WebRtc_UWord8 payload_data[65000];
uint8_t payload_data[65000];
int payload_data_length;
SimulatedClock fake_clock;
};
TEST_F(RtpRtcpNackTest, RTCP) {
WebRtc_UWord32 timestamp = 3000;
uint32_t timestamp = 3000;
uint16_t nack_list[kVideoNackListSize];
transport_->DropEveryNthPacket(10);
@ -240,7 +240,7 @@ TEST_F(RtpRtcpNackTest, LongNackList) {
const int kNumPacketsToDrop = 900;
const int kNumFrames = 30;
const int kNumRequiredRtcp = 4;
WebRtc_UWord32 timestamp = 3000;
uint32_t timestamp = 3000;
uint16_t nack_list[kNumPacketsToDrop];
// Disable StorePackets to be able to set a larger packet history.
EXPECT_EQ(0, video_module_->SetStorePacketsStatus(false, 0));

View File

@ -27,20 +27,20 @@ class RtcpCallback : public RtcpFeedback, public RtcpIntraFrameObserver {
void SetModule(RtpRtcp* module) {
_rtpRtcpModule = module;
};
virtual void OnRTCPPacketTimeout(const WebRtc_Word32 id) {
virtual void OnRTCPPacketTimeout(const int32_t id) {
}
virtual void OnLipSyncUpdate(const WebRtc_Word32 id,
const WebRtc_Word32 audioVideoOffset) {
virtual void OnLipSyncUpdate(const int32_t id,
const int32_t audioVideoOffset) {
};
virtual void OnXRVoIPMetricReceived(
const WebRtc_Word32 id,
const int32_t id,
const RTCPVoIPMetric* metric) {
};
virtual void OnApplicationDataReceived(const WebRtc_Word32 id,
const WebRtc_UWord8 subType,
const WebRtc_UWord32 name,
const WebRtc_UWord16 length,
const WebRtc_UWord8* data) {
virtual void OnApplicationDataReceived(const int32_t id,
const uint8_t subType,
const uint32_t name,
const uint16_t length,
const uint8_t* data) {
char print_name[5];
print_name[0] = static_cast<char>(name >> 24);
print_name[1] = static_cast<char>(name >> 16);
@ -50,16 +50,16 @@ class RtcpCallback : public RtcpFeedback, public RtcpIntraFrameObserver {
EXPECT_STRCASEEQ("test", print_name);
};
virtual void OnSendReportReceived(const WebRtc_Word32 id,
const WebRtc_UWord32 senderSSRC,
virtual void OnSendReportReceived(const int32_t id,
const uint32_t senderSSRC,
uint32_t ntp_secs,
uint32_t ntp_frac,
uint32_t timestamp) {
RTCPSenderInfo senderInfo;
EXPECT_EQ(0, _rtpRtcpModule->RemoteRTCPStat(&senderInfo));
};
virtual void OnReceiveReportReceived(const WebRtc_Word32 id,
const WebRtc_UWord32 senderSSRC) {
virtual void OnReceiveReportReceived(const int32_t id,
const uint32_t senderSSRC) {
};
virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) {
};
@ -143,7 +143,7 @@ class RtpRtcpRtcpTest : public ::testing::Test {
// We need to send one RTP packet to get the RTCP packet to be accepted by
// the receiving module.
// send RTP packet with the data "testtest"
const WebRtc_UWord8 test[9] = "testtest";
const uint8_t test[9] = "testtest";
EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
0, -1, test, 8));
}
@ -167,10 +167,10 @@ class RtpRtcpRtcpTest : public ::testing::Test {
RtcpCallback* myRTCPFeedback1;
RtcpCallback* myRTCPFeedback2;
WebRtc_UWord32 test_ssrc;
WebRtc_UWord32 test_timestamp;
WebRtc_UWord16 test_sequence_number;
WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
uint32_t test_ssrc;
uint32_t test_timestamp;
uint16_t test_sequence_number;
uint32_t test_CSRC[webrtc::kRtpCsrcSize];
SimulatedClock fake_clock;
};
@ -180,7 +180,7 @@ TEST_F(RtpRtcpRtcpTest, RTCP_PLI_RPSI) {
}
TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
WebRtc_UWord32 testOfCSRC[webrtc::kRtpCsrcSize];
uint32_t testOfCSRC[webrtc::kRtpCsrcSize];
EXPECT_EQ(2, module2->RemoteCSRCs(testOfCSRC));
EXPECT_EQ(test_CSRC[0], testOfCSRC[0]);
EXPECT_EQ(test_CSRC[1], testOfCSRC[1]);
@ -236,14 +236,14 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
reportBlock.lastSR= 7;
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_CSRC[1], &reportBlock));
WebRtc_UWord32 name = 't' << 24;
uint32_t name = 't' << 24;
name += 'e' << 16;
name += 's' << 8;
name += 't';
EXPECT_EQ(0, module1->SetRTCPApplicationSpecificData(
3,
name,
(const WebRtc_UWord8 *)"test test test test test test test test test"\
(const uint8_t *)"test test test test test test test test test"\
" test test test test test test test test test test test test test"\
" test test test test test test test test test test test test test"\
" test test test test test test test test test test test test test"\
@ -256,10 +256,10 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
fake_clock.AdvanceTimeMilliseconds(100);
module2->Process();
WebRtc_UWord32 receivedNTPsecs = 0;
WebRtc_UWord32 receivedNTPfrac = 0;
WebRtc_UWord32 RTCPArrivalTimeSecs = 0;
WebRtc_UWord32 RTCPArrivalTimeFrac = 0;
uint32_t receivedNTPsecs = 0;
uint32_t receivedNTPfrac = 0;
uint32_t RTCPArrivalTimeSecs = 0;
uint32_t RTCPArrivalTimeFrac = 0;
EXPECT_EQ(0, module2->RemoteNTP(&receivedNTPsecs,
&receivedNTPfrac,
&RTCPArrivalTimeSecs,
@ -281,28 +281,28 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
EXPECT_EQ(test_sequence_number, reportBlockReceived.extendedHighSeqNum);
EXPECT_EQ(0, reportBlockReceived.fractionLost);
EXPECT_EQ(static_cast<WebRtc_UWord32>(0),
EXPECT_EQ(static_cast<uint32_t>(0),
reportBlockReceived.cumulativeLost);
WebRtc_UWord8 fraction_lost = 0; // scale 0 to 255
WebRtc_UWord32 cum_lost = 0; // number of lost packets
WebRtc_UWord32 ext_max = 0; // highest sequence number received
WebRtc_UWord32 jitter = 0;
WebRtc_UWord32 max_jitter = 0;
uint8_t fraction_lost = 0; // scale 0 to 255
uint32_t cum_lost = 0; // number of lost packets
uint32_t ext_max = 0; // highest sequence number received
uint32_t jitter = 0;
uint32_t max_jitter = 0;
EXPECT_EQ(0, module2->StatisticsRTP(&fraction_lost,
&cum_lost,
&ext_max,
&jitter,
&max_jitter));
EXPECT_EQ(0, fraction_lost);
EXPECT_EQ((WebRtc_UWord32)0, cum_lost);
EXPECT_EQ((uint32_t)0, cum_lost);
EXPECT_EQ(test_sequence_number, ext_max);
EXPECT_EQ(reportBlockReceived.jitter, jitter);
WebRtc_UWord16 RTT;
WebRtc_UWord16 avgRTT;
WebRtc_UWord16 minRTT;
WebRtc_UWord16 maxRTT;
uint16_t RTT;
uint16_t avgRTT;
uint16_t minRTT;
uint16_t maxRTT;
// Get RoundTripTime.
EXPECT_EQ(0, module1->RTT(test_ssrc + 1, &RTT, &avgRTT, &minRTT, &maxRTT));

View File

@ -68,24 +68,24 @@ class RtpRtcpVideoTest : public ::testing::Test {
}
}
WebRtc_Word32 BuildRTPheader(WebRtc_UWord8* dataBuffer,
WebRtc_UWord32 timestamp,
WebRtc_UWord32 sequence_number) {
dataBuffer[0] = static_cast<WebRtc_UWord8>(0x80); // version 2
dataBuffer[1] = static_cast<WebRtc_UWord8>(kPayloadType);
int32_t BuildRTPheader(uint8_t* dataBuffer,
uint32_t timestamp,
uint32_t sequence_number) {
dataBuffer[0] = static_cast<uint8_t>(0x80); // version 2
dataBuffer[1] = static_cast<uint8_t>(kPayloadType);
ModuleRTPUtility::AssignUWord16ToBuffer(dataBuffer + 2,
sequence_number);
ModuleRTPUtility::AssignUWord32ToBuffer(dataBuffer + 4, timestamp);
ModuleRTPUtility::AssignUWord32ToBuffer(dataBuffer + 8,
0x1234); // SSRC.
WebRtc_Word32 rtpHeaderLength = 12;
int32_t rtpHeaderLength = 12;
return rtpHeaderLength;
}
int PaddingPacket(uint8_t* buffer,
WebRtc_UWord32 timestamp,
WebRtc_UWord32 sequence_number,
WebRtc_Word32 bytes) {
uint32_t timestamp,
uint32_t sequence_number,
int32_t bytes) {
// Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP.
int max_length = 224;
@ -97,8 +97,8 @@ class RtpRtcpVideoTest : public ::testing::Test {
int header_length = BuildRTPheader(buffer, timestamp,
sequence_number);
buffer[0] |= 0x20; // Set padding bit.
WebRtc_Word32* data =
reinterpret_cast<WebRtc_Word32*>(&(buffer[header_length]));
int32_t* data =
reinterpret_cast<int32_t*>(&(buffer[header_length]));
// Fill data buffer with random data.
for (int j = 0; j < (padding_bytes_in_packet >> 2); j++) {
@ -120,17 +120,17 @@ class RtpRtcpVideoTest : public ::testing::Test {
RtpRtcp* video_module_;
LoopBackTransport* transport_;
RtpReceiver* receiver_;
WebRtc_UWord32 test_ssrc_;
WebRtc_UWord32 test_timestamp_;
WebRtc_UWord16 test_sequence_number_;
WebRtc_UWord8 video_frame_[65000];
uint32_t test_ssrc_;
uint32_t test_timestamp_;
uint16_t test_sequence_number_;
uint8_t video_frame_[65000];
int payload_data_length_;
SimulatedClock fake_clock;
enum { kPayloadType = 100 };
};
TEST_F(RtpRtcpVideoTest, BasicVideo) {
WebRtc_UWord32 timestamp = 3000;
uint32_t timestamp = 3000;
EXPECT_EQ(0, video_module_->SendOutgoingData(kVideoFrameDelta, 123,
timestamp,
timestamp / 90,

View File

@ -34,15 +34,15 @@ using namespace webrtc;
void ReceivePackets(
ForwardErrorCorrection::ReceivedPacketList* toDecodeList,
ForwardErrorCorrection::ReceivedPacketList* receivedPacketList,
WebRtc_UWord32 numPacketsToDecode, float reorderRate, float duplicateRate);
uint32_t numPacketsToDecode, float reorderRate, float duplicateRate);
int main() {
// TODO(marpan): Split this function into subroutines/helper functions.
enum { kMaxNumberMediaPackets = 48 };
enum { kMaxNumberFecPackets = 48 };
const WebRtc_UWord32 kNumMaskBytesL0 = 2;
const WebRtc_UWord32 kNumMaskBytesL1 = 6;
const uint32_t kNumMaskBytesL0 = 2;
const uint32_t kNumMaskBytesL1 = 6;
// FOR UEP
const bool kUseUnequalProtection = true;
@ -58,7 +58,7 @@ int main() {
return -1;
}
WebRtc_UWord32 id = 0;
uint32_t id = 0;
ForwardErrorCorrection fec(id);
ForwardErrorCorrection::PacketList mediaPacketList;
@ -66,18 +66,18 @@ int main() {
ForwardErrorCorrection::ReceivedPacketList toDecodeList;
ForwardErrorCorrection::ReceivedPacketList receivedPacketList;
ForwardErrorCorrection::RecoveredPacketList recoveredPacketList;
std::list<WebRtc_UWord8*> fecMaskList;
std::list<uint8_t*> fecMaskList;
ForwardErrorCorrection::Packet* mediaPacket = NULL;
// Running over only one loss rate to limit execution time.
const float lossRate[] = {0.5f};
const WebRtc_UWord32 lossRateSize = sizeof(lossRate)/sizeof(*lossRate);
const uint32_t lossRateSize = sizeof(lossRate)/sizeof(*lossRate);
const float reorderRate = 0.1f;
const float duplicateRate = 0.1f;
WebRtc_UWord8 mediaLossMask[kMaxNumberMediaPackets];
WebRtc_UWord8 fecLossMask[kMaxNumberFecPackets];
WebRtc_UWord8 fecPacketMasks[kMaxNumberFecPackets][kMaxNumberMediaPackets];
uint8_t mediaLossMask[kMaxNumberMediaPackets];
uint8_t fecLossMask[kMaxNumberFecPackets];
uint8_t fecPacketMasks[kMaxNumberFecPackets][kMaxNumberMediaPackets];
// Seed the random number generator, storing the seed to file in order to
// reproduce past results.
@ -89,48 +89,48 @@ int main() {
fclose(randomSeedFile);
randomSeedFile = NULL;
WebRtc_UWord16 seqNum = static_cast<WebRtc_UWord16>(rand());
WebRtc_UWord32 timeStamp = static_cast<WebRtc_UWord32>(rand());
const WebRtc_UWord32 ssrc = static_cast<WebRtc_UWord32>(rand());
uint16_t seqNum = static_cast<uint16_t>(rand());
uint32_t timeStamp = static_cast<uint32_t>(rand());
const uint32_t ssrc = static_cast<uint32_t>(rand());
// Loop over the mask types: random and bursty.
for (int mask_type_idx = 0; mask_type_idx < kNumFecMaskTypes;
++mask_type_idx) {
for (WebRtc_UWord32 lossRateIdx = 0; lossRateIdx < lossRateSize;
for (uint32_t lossRateIdx = 0; lossRateIdx < lossRateSize;
++lossRateIdx) {
printf("Loss rate: %.2f, Mask type %d \n", lossRate[lossRateIdx],
mask_type_idx);
const WebRtc_UWord32 packetMaskMax = kMaxMediaPackets[mask_type_idx];
WebRtc_UWord8* packetMask =
new WebRtc_UWord8[packetMaskMax * kNumMaskBytesL1];
const uint32_t packetMaskMax = kMaxMediaPackets[mask_type_idx];
uint8_t* packetMask =
new uint8_t[packetMaskMax * kNumMaskBytesL1];
FecMaskType fec_mask_type = kMaskTypes[mask_type_idx];
for (WebRtc_UWord32 numMediaPackets = 1;
for (uint32_t numMediaPackets = 1;
numMediaPackets <= packetMaskMax;
numMediaPackets++) {
internal::PacketMaskTable mask_table(fec_mask_type, numMediaPackets);
for (WebRtc_UWord32 numFecPackets = 1;
for (uint32_t numFecPackets = 1;
numFecPackets <= numMediaPackets &&
numFecPackets <= packetMaskMax;
numFecPackets++) {
// Loop over numImpPackets: usually <= (0.3*numMediaPackets).
// For this test we check up to ~ (0.5*numMediaPackets).
WebRtc_UWord32 maxNumImpPackets = numMediaPackets / 2 + 1;
for (WebRtc_UWord32 numImpPackets = 0;
uint32_t maxNumImpPackets = numMediaPackets / 2 + 1;
for (uint32_t numImpPackets = 0;
numImpPackets <= maxNumImpPackets &&
numImpPackets <= packetMaskMax;
numImpPackets++) {
WebRtc_UWord8 protectionFactor = static_cast<WebRtc_UWord8>
uint8_t protectionFactor = static_cast<uint8_t>
(numFecPackets * 255 / numMediaPackets);
const WebRtc_UWord32 maskBytesPerFecPacket =
const uint32_t maskBytesPerFecPacket =
(numMediaPackets > 16) ? kNumMaskBytesL1 : kNumMaskBytesL0;
memset(packetMask, 0, numMediaPackets * maskBytesPerFecPacket);
@ -151,11 +151,11 @@ int main() {
printf("Packet mask matrix \n");
#endif
for (WebRtc_UWord32 i = 0; i < numFecPackets; i++) {
for (WebRtc_UWord32 j = 0; j < numMediaPackets; j++) {
const WebRtc_UWord8 byteMask =
for (uint32_t i = 0; i < numFecPackets; i++) {
for (uint32_t j = 0; j < numMediaPackets; j++) {
const uint8_t byteMask =
packetMask[i * maskBytesPerFecPacket + j / 8];
const WebRtc_UWord32 bitPosition = (7 - j % 8);
const uint32_t bitPosition = (7 - j % 8);
fecPacketMasks[i][j] =
(byteMask & (1 << bitPosition)) >> bitPosition;
#ifdef VERBOSE_OUTPUT
@ -170,10 +170,10 @@ int main() {
printf("\n");
#endif
// Check for all zero rows or columns: indicates incorrect mask.
WebRtc_UWord32 rowLimit = numMediaPackets;
for (WebRtc_UWord32 i = 0; i < numFecPackets; ++i) {
WebRtc_UWord32 rowSum = 0;
for (WebRtc_UWord32 j = 0; j < rowLimit; ++j) {
uint32_t rowLimit = numMediaPackets;
for (uint32_t i = 0; i < numFecPackets; ++i) {
uint32_t rowSum = 0;
for (uint32_t j = 0; j < rowLimit; ++j) {
rowSum += fecPacketMasks[i][j];
}
if (rowSum == 0) {
@ -181,9 +181,9 @@ int main() {
return -1;
}
}
for (WebRtc_UWord32 j = 0; j < rowLimit; ++j) {
WebRtc_UWord32 columnSum = 0;
for (WebRtc_UWord32 i = 0; i < numFecPackets; ++i) {
for (uint32_t j = 0; j < rowLimit; ++j) {
uint32_t columnSum = 0;
for (uint32_t i = 0; i < numFecPackets; ++i) {
columnSum += fecPacketMasks[i][j];
}
if (columnSum == 0) {
@ -193,19 +193,19 @@ int main() {
}
// Construct media packets.
for (WebRtc_UWord32 i = 0; i < numMediaPackets; ++i) {
for (uint32_t i = 0; i < numMediaPackets; ++i) {
mediaPacket = new ForwardErrorCorrection::Packet;
mediaPacketList.push_back(mediaPacket);
mediaPacket->length =
static_cast<WebRtc_UWord16>((static_cast<float>(rand()) /
static_cast<uint16_t>((static_cast<float>(rand()) /
RAND_MAX) * (IP_PACKET_SIZE - 12 -
28 - ForwardErrorCorrection::PacketOverhead()));
if (mediaPacket->length < 12) {
mediaPacket->length = 12;
}
// Generate random values for the first 2 bytes.
mediaPacket->data[0] = static_cast<WebRtc_UWord8>(rand() % 256);
mediaPacket->data[1] = static_cast<WebRtc_UWord8>(rand() % 256);
mediaPacket->data[0] = static_cast<uint8_t>(rand() % 256);
mediaPacket->data[1] = static_cast<uint8_t>(rand() % 256);
// The first two bits are assumed to be 10 by the
// FEC encoder. In fact the FEC decoder will set the
@ -230,9 +230,9 @@ int main() {
ModuleRTPUtility::AssignUWord32ToBuffer(&mediaPacket->data[8],
ssrc);
// Generate random values for payload
for (WebRtc_Word32 j = 12; j < mediaPacket->length; ++j) {
for (int32_t j = 12; j < mediaPacket->length; ++j) {
mediaPacket->data[j] =
static_cast<WebRtc_UWord8> (rand() % 256);
static_cast<uint8_t> (rand() % 256);
}
seqNum++;
}
@ -249,14 +249,14 @@ int main() {
printf("Error: we requested %u FEC packets, "
"but GenerateFEC() produced %u\n",
numFecPackets,
static_cast<WebRtc_UWord32>(fecPacketList.size()));
static_cast<uint32_t>(fecPacketList.size()));
return -1;
}
memset(mediaLossMask, 0, sizeof(mediaLossMask));
ForwardErrorCorrection::PacketList::iterator
mediaPacketListItem = mediaPacketList.begin();
ForwardErrorCorrection::ReceivedPacket* receivedPacket;
WebRtc_UWord32 mediaPacketIdx = 0;
uint32_t mediaPacketIdx = 0;
while (mediaPacketListItem != mediaPacketList.end()) {
mediaPacket = *mediaPacketListItem;
@ -285,7 +285,7 @@ int main() {
ForwardErrorCorrection::PacketList::iterator
fecPacketListItem = fecPacketList.begin();
ForwardErrorCorrection::Packet* fecPacket;
WebRtc_UWord32 fecPacketIdx = 0;
uint32_t fecPacketIdx = 0;
while (fecPacketListItem != fecPacketList.end()) {
fecPacket = *fecPacketListItem;
const float lossRandomVariable =
@ -315,31 +315,31 @@ int main() {
#ifdef VERBOSE_OUTPUT
printf("Media loss mask:\n");
for (WebRtc_UWord32 i = 0; i < numMediaPackets; i++) {
for (uint32_t i = 0; i < numMediaPackets; i++) {
printf("%u ", mediaLossMask[i]);
}
printf("\n\n");
printf("FEC loss mask:\n");
for (WebRtc_UWord32 i = 0; i < numFecPackets; i++) {
for (uint32_t i = 0; i < numFecPackets; i++) {
printf("%u ", fecLossMask[i]);
}
printf("\n\n");
#endif
std::list<WebRtc_UWord8*>::iterator fecMaskIt = fecMaskList.begin();
WebRtc_UWord8* fecMask;
std::list<uint8_t*>::iterator fecMaskIt = fecMaskList.begin();
uint8_t* fecMask;
while (fecMaskIt != fecMaskList.end()) {
fecMask = *fecMaskIt;
WebRtc_UWord32 hammingDist = 0;
WebRtc_UWord32 recoveryPosition = 0;
for (WebRtc_UWord32 i = 0; i < numMediaPackets; i++) {
uint32_t hammingDist = 0;
uint32_t recoveryPosition = 0;
for (uint32_t i = 0; i < numMediaPackets; i++) {
if (mediaLossMask[i] == 0 && fecMask[i] == 1) {
recoveryPosition = i;
++hammingDist;
}
}
std::list<WebRtc_UWord8*>::iterator itemToDelete = fecMaskIt;
std::list<uint8_t*>::iterator itemToDelete = fecMaskIt;
++fecMaskIt;
if (hammingDist == 1) {
@ -353,7 +353,7 @@ int main() {
}
#ifdef VERBOSE_OUTPUT
printf("Recovery mask:\n");
for (WebRtc_UWord32 i = 0; i < numMediaPackets; ++i) {
for (uint32_t i = 0; i < numMediaPackets; ++i) {
printf("%u ", mediaLossMask[i]);
}
printf("\n\n");
@ -361,7 +361,7 @@ int main() {
// For error-checking frame completion.
bool fecPacketReceived = false;
while (!receivedPacketList.empty()) {
WebRtc_UWord32 numPacketsToDecode = static_cast<WebRtc_UWord32>
uint32_t numPacketsToDecode = static_cast<uint32_t>
((static_cast<float>(rand()) / RAND_MAX) *
receivedPacketList.size() + 0.5);
if (numPacketsToDecode < 1) {
@ -428,7 +428,7 @@ int main() {
if (!recoveredPacketList.empty()) {
printf("Error: excessive number of recovered packets.\n");
printf("\t size is:%u\n",
static_cast<WebRtc_UWord32>(recoveredPacketList.size()));
static_cast<uint32_t>(recoveredPacketList.size()));
return -1;
}
// -- Teardown --
@ -482,12 +482,12 @@ int main() {
void ReceivePackets(
ForwardErrorCorrection::ReceivedPacketList* toDecodeList,
ForwardErrorCorrection::ReceivedPacketList* receivedPacketList,
WebRtc_UWord32 numPacketsToDecode, float reorderRate, float duplicateRate) {
uint32_t numPacketsToDecode, float reorderRate, float duplicateRate) {
assert(toDecodeList->empty());
assert(numPacketsToDecode <= receivedPacketList->size());
ForwardErrorCorrection::ReceivedPacketList::iterator it;
for (WebRtc_UWord32 i = 0; i < numPacketsToDecode; i++) {
for (uint32_t i = 0; i < numPacketsToDecode; i++) {
it = receivedPacketList->begin();
// Reorder packets.
float randomVariable = static_cast<float>(rand()) / RAND_MAX;

View File

@ -25,14 +25,14 @@
const int maxFileLen = 200;
WebRtc_UWord8* dataFile[maxFileLen];
uint8_t* dataFile[maxFileLen];
struct InputSet
{
WebRtc_UWord32 TMMBR;
WebRtc_UWord32 packetOH;
WebRtc_UWord32 SSRC;
uint32_t TMMBR;
uint32_t packetOH;
uint32_t SSRC;
};
const InputSet set0 = {220, 80, 11111}; // bitRate, packetOH, ssrc
@ -48,7 +48,7 @@ const InputSet set00 = { 0, 40, 66666};
WebRtc_Word32 GetFile(char* fileName)
int32_t GetFile(char* fileName)
{
if (!fileName[0])
{
@ -58,7 +58,7 @@ WebRtc_Word32 GetFile(char* fileName)
FILE* openFile = fopen(fileName, "rb");
assert(openFile != NULL);
fseek(openFile, 0, SEEK_END);
int len = (WebRtc_Word16)(ftell(openFile));
int len = (int16_t)(ftell(openFile));
rewind(openFile);
assert(len > 0 && len < maxFileLen);
fread(dataFile, 1, len, openFile);
@ -77,7 +77,7 @@ public:
}
virtual int SendPacket(int channel, const void *data, int len)
{
return _rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)data, len);
return _rtpRtcpModule->IncomingPacket((const uint8_t*)data, len);
}
virtual int SendRTCPPacket(int channel, const void *data, int len)
{
@ -92,10 +92,10 @@ public:
}
// Send in bitrate request
return _rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)dataFile, len);
return _rtpRtcpModule->IncomingPacket((const uint8_t*)dataFile, len);
}
RtpRtcp* _rtpRtcpModule;
WebRtc_UWord32 _cnt;
uint32_t _cnt;
};
@ -109,7 +109,7 @@ public:
}
virtual int SendPacket(int channel, const void *data, int len)
{
return _rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)data, len);
return _rtpRtcpModule->IncomingPacket((const uint8_t*)data, len);
}
virtual int SendRTCPPacket(int channel, const void *data, int len)
{
@ -127,11 +127,11 @@ public:
}
// Send in bitrate request*/
return _rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)dataFile, len);
return _rtpRtcpModule->IncomingPacket((const uint8_t*)dataFile, len);
}
RtpRtcp* _rtpRtcpModule;
WebRtc_UWord32 _cnt;
uint32_t _cnt;
};
class TestRateControl : private RateControlDetector
@ -148,16 +148,16 @@ public:
//Test perfect conditions
// But only one packet per frame
SetLastUsedBitRate(500);
WebRtc_UWord32 rtpTs=1234*90;
WebRtc_UWord32 framePeriod=33; // In Ms
WebRtc_UWord32 rtpDelta=framePeriod*90;
WebRtc_UWord32 netWorkDelay=10;
WebRtc_UWord32 arrivalTime=rtpTs/90+netWorkDelay;
WebRtc_UWord32 newBitRate=0;
for(WebRtc_UWord32 k=0;k<10;k++)
uint32_t rtpTs=1234*90;
uint32_t framePeriod=33; // In Ms
uint32_t rtpDelta=framePeriod*90;
uint32_t netWorkDelay=10;
uint32_t arrivalTime=rtpTs/90+netWorkDelay;
uint32_t newBitRate=0;
for(uint32_t k=0;k<10;k++)
{
// Receive 10 packets
for(WebRtc_UWord32 i=0;i<10;i++)
for(uint32_t i=0;i<10;i++)
{
NotifyNewArrivedPacket(rtpTs,arrivalTime);
rtpTs+=rtpDelta;
@ -175,16 +175,16 @@ public:
std::cout << "Test increasing RTT - No Receive timing changes" << std::endl;
SetLastUsedBitRate(500);
for(WebRtc_UWord32 k=0;k<10;k++)
for(uint32_t k=0;k<10;k++)
{
// Receive 10 packets
for(WebRtc_UWord32 i=0;i<10;i++)
for(uint32_t i=0;i<10;i++)
{
NotifyNewArrivedPacket(rtpTs,arrivalTime);
rtpTs+=rtpDelta;
arrivalTime=rtpTs/90+netWorkDelay;
}
WebRtc_UWord32 rtt=2*netWorkDelay+k*20;
uint32_t rtt=2*netWorkDelay+k*20;
newBitRate=RateControl(rtt);
Sleep(10*framePeriod);
SetLastUsedBitRate(newBitRate);
@ -199,16 +199,16 @@ public:
std::cout << "Test increasing RTT - Changed receive timing" << std::endl;
SetLastUsedBitRate(500);
for(WebRtc_UWord32 k=0;k<10;k++)
for(uint32_t k=0;k<10;k++)
{
// Receive 10 packets
for(WebRtc_UWord32 i=0;i<10;i++)
for(uint32_t i=0;i<10;i++)
{
NotifyNewArrivedPacket(rtpTs,arrivalTime);
rtpTs+=rtpDelta;
arrivalTime=rtpTs/90+netWorkDelay+i+(k*20);
}
WebRtc_UWord32 rtt=2*netWorkDelay+k*20;
uint32_t rtt=2*netWorkDelay+k*20;
newBitRate=RateControl(rtt);
Sleep(10*framePeriod);
SetLastUsedBitRate(newBitRate);
@ -223,9 +223,9 @@ public:
class NULLDataZink: public RtpData
{
virtual WebRtc_Word32 OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader)
virtual int32_t OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader)
{
return 0;
};

View File

@ -24,14 +24,14 @@
const int maxFileLen = 200;
WebRtc_UWord8* dataFile[maxFileLen];
uint8_t* dataFile[maxFileLen];
struct InputSet
{
WebRtc_UWord32 TMMBR;
WebRtc_UWord32 packetOH;
WebRtc_UWord32 SSRC;
uint32_t TMMBR;
uint32_t packetOH;
uint32_t SSRC;
};
const InputSet set0 = {220, 80, 11111}; // bitRate, packetOH, ssrc
@ -56,7 +56,7 @@ void Verify(TMMBRSet* boundingSet, int index, InputSet set)
int ParseRTCPPacket(const void *data, int len, TMMBRSet*& boundingSet)
{
int numItems = -1;
RTCPUtility::RTCPParserV2 rtcpParser((const WebRtc_UWord8*)data, len, true);
RTCPUtility::RTCPParserV2 rtcpParser((const uint8_t*)data, len, true);
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Begin();
while (pktType != RTCPUtility::kRtcpNotValidCode)
{
@ -79,7 +79,7 @@ int ParseRTCPPacket(const void *data, int len, TMMBRSet*& boundingSet)
return numItems;
};
WebRtc_Word32 GetFile(char* fileName)
int32_t GetFile(char* fileName)
{
if (!fileName[0])
{
@ -89,7 +89,7 @@ WebRtc_Word32 GetFile(char* fileName)
FILE* openFile = fopen(fileName, "rb");
assert(openFile != NULL);
fseek(openFile, 0, SEEK_END);
int len = (WebRtc_Word16)(ftell(openFile));
int len = (int16_t)(ftell(openFile));
rewind(openFile);
assert(len > 0 && len < maxFileLen);
fread(dataFile, 1, len, openFile);
@ -109,7 +109,7 @@ public:
}
virtual int SendPacket(int channel, const void *data, int len)
{
if( 0 == _rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)data, len))
if( 0 == _rtpRtcpModule->IncomingPacket((const uint8_t*)data, len))
{
return len;
}
@ -144,14 +144,14 @@ public:
}
// Send in bitrate request
if(_rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)dataFile, len) == 0)
if(_rtpRtcpModule->IncomingPacket((const uint8_t*)dataFile, len) == 0)
{
return len;
}
return -1;
}
RtpRtcp* _rtpRtcpModule;
WebRtc_UWord32 _cnt;
uint32_t _cnt;
};
@ -166,7 +166,7 @@ public:
}
virtual int SendPacket(int channel, const void *data, int len)
{
if(_rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)data, len)== 0)
if(_rtpRtcpModule->IncomingPacket((const uint8_t*)data, len)== 0)
{
return len;
}
@ -330,7 +330,7 @@ public:
}
// Send in bitrate request
if( 0 == _rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)dataFile, len))
if( 0 == _rtpRtcpModule->IncomingPacket((const uint8_t*)dataFile, len))
{
return len;
}
@ -338,7 +338,7 @@ public:
}
RtpRtcp* _rtpRtcpModule;
WebRtc_UWord32 _cnt;
uint32_t _cnt;
};
class TestTMMBR : private TMMBRHelp
@ -363,14 +363,14 @@ public:
TMMBRSet* boundingSetToSend = BoundingSetToSend();
assert(0 == boundingSetToSend->sizeOfSet);
WebRtc_Word32 numBoundingSet = FindTMMBRBoundingSet(boundingSet);
int32_t numBoundingSet = FindTMMBRBoundingSet(boundingSet);
assert(0 == numBoundingSet); // should be empty
assert( 0 == SetTMMBRBoundingSetToSend(NULL,0)); // ok to send empty set
assert( 0 == SetTMMBRBoundingSetToSend(boundingSet,0)); // ok to send empty set
WebRtc_UWord32 minBitrateKbit = 0;
WebRtc_UWord32 maxBitrateKbit = 0;
uint32_t minBitrateKbit = 0;
uint32_t maxBitrateKbit = 0;
assert(-1 == CalcMinMaxBitRate(0, 0, 1, false, minBitrateKbit, maxBitrateKbit)); // no bounding set
// ---------------------------------
@ -918,11 +918,11 @@ public:
class NULLDataZink: public RtpData
{
virtual WebRtc_Word32 OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader,
const WebRtc_UWord8* incomingRtpPacket,
const WebRtc_UWord16 incomingRtpPacketLengt)
virtual int32_t OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader,
const uint8_t* incomingRtpPacket,
const uint16_t incomingRtpPacketLengt)
{
return 0;
};
@ -963,7 +963,7 @@ int _tmain(int argc, _TCHAR* argv[])
// send a RTP packet with SSRC 11111 to get 11111 as the received SSRC
assert(0 == rtpRtcpModuleVideo->SetSSRC(11111));
const WebRtc_UWord8 testStream[9] = "testtest";
const uint8_t testStream[9] = "testtest";
assert(0 == rtpRtcpModuleVideo->RegisterIncomingDataCallback(new NULLDataZink())); // needed to avoid error from parsing the incoming stream
assert(0 == rtpRtcpModuleVideo->SendOutgoingData(webrtc::kVideoFrameKey,96, 0, testStream, 8));