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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,38 +32,38 @@ public:
void AddVoIPMetric(const RTCPVoIPMetric* metric); void AddVoIPMetric(const RTCPVoIPMetric* metric);
void AddApplicationData(const WebRtc_UWord8* data, void AddApplicationData(const uint8_t* data,
const WebRtc_UWord16 size); const uint16_t size);
void AddNACKPacket(const WebRtc_UWord16 packetID); void AddNACKPacket(const uint16_t packetID);
void ResetNACKPacketIdArray(); void ResetNACKPacketIdArray();
void AddReportInfo(const WebRtc_UWord8 fractionLost, void AddReportInfo(const uint8_t fractionLost,
const WebRtc_UWord16 rtt, const uint16_t rtt,
const WebRtc_UWord32 extendedHighSeqNum, const uint32_t extendedHighSeqNum,
const WebRtc_UWord32 jitter); const uint32_t jitter);
WebRtc_UWord32 rtcpPacketTypeFlags; // RTCPPacketTypeFlags bit field uint32_t rtcpPacketTypeFlags; // RTCPPacketTypeFlags bit field
WebRtc_UWord32 remoteSSRC; uint32_t remoteSSRC;
std::list<uint16_t> nackSequenceNumbers; std::list<uint16_t> nackSequenceNumbers;
WebRtc_UWord8 applicationSubType; uint8_t applicationSubType;
WebRtc_UWord32 applicationName; uint32_t applicationName;
WebRtc_UWord8* applicationData; uint8_t* applicationData;
WebRtc_UWord16 applicationLength; uint16_t applicationLength;
bool reportBlock; bool reportBlock;
WebRtc_UWord8 fractionLost; uint8_t fractionLost;
WebRtc_UWord16 roundTripTime; uint16_t roundTripTime;
WebRtc_UWord32 lastReceivedExtendedHighSeqNum; uint32_t lastReceivedExtendedHighSeqNum;
WebRtc_UWord32 jitter; uint32_t jitter;
WebRtc_UWord32 interArrivalJitter; uint32_t interArrivalJitter;
WebRtc_UWord8 sliPictureId; uint8_t sliPictureId;
WebRtc_UWord64 rpsiPictureId; uint64_t rpsiPictureId;
WebRtc_UWord32 receiverEstimatedMaxBitrate; uint32_t receiverEstimatedMaxBitrate;
uint32_t ntp_secs; uint32_t ntp_secs;
uint32_t ntp_frac; uint32_t ntp_frac;
@@ -84,14 +84,14 @@ public:
// Statistics // Statistics
RTCPReportBlock remoteReceiveBlock; RTCPReportBlock remoteReceiveBlock;
WebRtc_UWord32 remoteMaxJitter; uint32_t remoteMaxJitter;
// RTT // RTT
WebRtc_UWord16 RTT; uint16_t RTT;
WebRtc_UWord16 minRTT; uint16_t minRTT;
WebRtc_UWord16 maxRTT; uint16_t maxRTT;
WebRtc_UWord16 avgRTT; uint16_t avgRTT;
WebRtc_UWord32 numAverageCalcs; uint32_t numAverageCalcs;
}; };
class RTCPReceiveInformation class RTCPReceiveInformation
@@ -100,24 +100,24 @@ public:
RTCPReceiveInformation(); RTCPReceiveInformation();
~RTCPReceiveInformation(); ~RTCPReceiveInformation();
void VerifyAndAllocateBoundingSet(const WebRtc_UWord32 minimumSize); void VerifyAndAllocateBoundingSet(const uint32_t minimumSize);
void VerifyAndAllocateTMMBRSet(const WebRtc_UWord32 minimumSize); void VerifyAndAllocateTMMBRSet(const uint32_t minimumSize);
void InsertTMMBRItem(const WebRtc_UWord32 senderSSRC, void InsertTMMBRItem(const uint32_t senderSSRC,
const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem, const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem,
const WebRtc_Word64 currentTimeMS); const int64_t currentTimeMS);
// get // get
WebRtc_Word32 GetTMMBRSet(const WebRtc_UWord32 sourceIdx, int32_t GetTMMBRSet(const uint32_t sourceIdx,
const WebRtc_UWord32 targetIdx, const uint32_t targetIdx,
TMMBRSet* candidateSet, TMMBRSet* candidateSet,
const WebRtc_Word64 currentTimeMS); const int64_t currentTimeMS);
WebRtc_Word64 lastTimeReceived; int64_t lastTimeReceived;
// FIR // FIR
WebRtc_Word32 lastFIRSequenceNumber; int32_t lastFIRSequenceNumber;
WebRtc_Word64 lastFIRRequest; int64_t lastFIRRequest;
// TMMBN // TMMBN
TMMBRSet TmmbnBoundingSet; TMMBRSet TmmbnBoundingSet;
@@ -127,7 +127,7 @@ public:
bool readyForDelete; bool readyForDelete;
private: private:
std::vector<WebRtc_Word64> _tmmbrSetTimeouts; std::vector<int64_t> _tmmbrSetTimeouts;
}; };
} // end namespace RTCPHelp } // 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); EXPECT_LT(pos_, kMaxPacketSize - 1);
buffer_[pos_] = byte; buffer_[pos_] = byte;
++ pos_; ++ pos_;
} }
void Add16(WebRtc_UWord16 word) { void Add16(uint16_t word) {
Add8(word >> 8); Add8(word >> 8);
Add8(word & 0xFF); Add8(word & 0xFF);
} }
void Add32(WebRtc_UWord32 word) { void Add32(uint32_t word) {
Add8(word >> 24); Add8(word >> 24);
Add8((word >> 16) & 0xFF); Add8((word >> 16) & 0xFF);
Add8((word >> 8) & 0xFF); Add8((word >> 8) & 0xFF);
Add8(word & 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(upper_half);
Add32(lower_half); Add32(lower_half);
} }
@@ -76,14 +76,14 @@ class PacketBuilder {
void AddTmmbrBandwidth(int mantissa, int exponent, int overhead) { void AddTmmbrBandwidth(int mantissa, int exponent, int overhead) {
// 6 bits exponent, 17 bits mantissa, 9 bits overhead. // 6 bits exponent, 17 bits mantissa, 9 bits overhead.
WebRtc_UWord32 word = 0; uint32_t word = 0;
word |= (exponent << 26); word |= (exponent << 26);
word |= ((mantissa & 0x1FFFF) << 9); word |= ((mantissa & 0x1FFFF) << 9);
word |= (overhead & 0x1FF); word |= (overhead & 0x1FF);
Add32(word); Add32(word);
} }
void AddSrPacket(WebRtc_UWord32 sender_ssrc) { void AddSrPacket(uint32_t sender_ssrc) {
AddRtcpHeader(200, 0); AddRtcpHeader(200, 0);
Add32(sender_ssrc); Add32(sender_ssrc);
Add64(0x10203, 0x4050607); // NTP timestamp Add64(0x10203, 0x4050607); // NTP timestamp
@@ -92,8 +92,8 @@ class PacketBuilder {
Add32(0); // Sender's octet count Add32(0); // Sender's octet count
} }
void AddRrPacket(WebRtc_UWord32 sender_ssrc, WebRtc_UWord32 rtp_ssrc, void AddRrPacket(uint32_t sender_ssrc, uint32_t rtp_ssrc,
WebRtc_UWord32 extended_max) { uint32_t extended_max) {
AddRtcpHeader(201, 1); AddRtcpHeader(201, 1);
Add32(sender_ssrc); Add32(sender_ssrc);
Add32(rtp_ssrc); Add32(rtp_ssrc);
@@ -104,7 +104,7 @@ class PacketBuilder {
Add32(0); // Delay since last SR. Add32(0); // Delay since last SR.
} }
const WebRtc_UWord8* packet() { const uint8_t* packet() {
PatchLengthField(); PatchLengthField();
return buffer_; return buffer_;
} }
@@ -131,7 +131,7 @@ class PacketBuilder {
// Where the length field of the current packet is. // Where the length field of the current packet is.
// Note that 0 is not a legal value, so is used for "uninitialized". // Note that 0 is not a legal value, so is used for "uninitialized".
int pos_of_len_; int pos_of_len_;
WebRtc_UWord8 buffer_[kMaxPacketSize]; uint8_t buffer_[kMaxPacketSize];
}; };
// This test transport verifies that no functions get called. // This test transport verifies that no functions get called.
@@ -155,8 +155,8 @@ class TestTransport : public Transport,
return 0; return 0;
} }
virtual int OnReceivedPayloadData(const WebRtc_UWord8* payloadData, virtual int OnReceivedPayloadData(const uint8_t* payloadData,
const WebRtc_UWord16 payloadSize, const uint16_t payloadSize,
const WebRtcRTPHeader* rtpHeader) { const WebRtcRTPHeader* rtpHeader) {
ADD_FAILURE(); ADD_FAILURE();
return 0; return 0;
@@ -196,8 +196,8 @@ class RtcpReceiverTest : public ::testing::Test {
// Injects an RTCP packet into the receiver. // Injects an RTCP packet into the receiver.
// Returns 0 for OK, non-0 for failure. // Returns 0 for OK, non-0 for failure.
int InjectRtcpPacket(const WebRtc_UWord8* packet, int InjectRtcpPacket(const uint8_t* packet,
WebRtc_UWord16 packet_len) { uint16_t packet_len) {
RTCPUtility::RTCPParserV2 rtcpParser(packet, RTCPUtility::RTCPParserV2 rtcpParser(packet,
packet_len, packet_len,
true); // Allow non-compound RTCP true); // Allow non-compound RTCP
@@ -243,13 +243,13 @@ class RtcpReceiverTest : public ::testing::Test {
TEST_F(RtcpReceiverTest, BrokenPacketIsIgnored) { 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(0, InjectRtcpPacket(bad_packet, sizeof(bad_packet)));
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags);
} }
TEST_F(RtcpReceiverTest, InjectSrPacket) { TEST_F(RtcpReceiverTest, InjectSrPacket) {
const WebRtc_UWord32 kSenderSsrc = 0x10203; const uint32_t kSenderSsrc = 0x10203;
PacketBuilder p; PacketBuilder p;
p.AddSrPacket(kSenderSsrc); p.AddSrPacket(kSenderSsrc);
EXPECT_EQ(0, InjectRtcpPacket(p.packet(), p.length())); EXPECT_EQ(0, InjectRtcpPacket(p.packet(), p.length()));
@@ -326,9 +326,9 @@ TEST_F(RtcpReceiverTest, TmmbrReceivedWithNoIncomingPacket) {
} }
TEST_F(RtcpReceiverTest, TmmbrPacketAccepted) { TEST_F(RtcpReceiverTest, TmmbrPacketAccepted) {
const WebRtc_UWord32 kMediaFlowSsrc = 0x2040608; const uint32_t kMediaFlowSsrc = 0x2040608;
const WebRtc_UWord32 kSenderSsrc = 0x10203; const uint32_t kSenderSsrc = 0x10203;
const WebRtc_UWord32 kMediaRecipientSsrc = 0x101; const uint32_t kMediaRecipientSsrc = 0x101;
rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above. rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above.
PacketBuilder p; PacketBuilder p;
@@ -350,10 +350,10 @@ TEST_F(RtcpReceiverTest, TmmbrPacketAccepted) {
} }
TEST_F(RtcpReceiverTest, TmmbrPacketNotForUsIgnored) { TEST_F(RtcpReceiverTest, TmmbrPacketNotForUsIgnored) {
const WebRtc_UWord32 kMediaFlowSsrc = 0x2040608; const uint32_t kMediaFlowSsrc = 0x2040608;
const WebRtc_UWord32 kSenderSsrc = 0x10203; const uint32_t kSenderSsrc = 0x10203;
const WebRtc_UWord32 kMediaRecipientSsrc = 0x101; const uint32_t kMediaRecipientSsrc = 0x101;
const WebRtc_UWord32 kOtherMediaFlowSsrc = 0x9999; const uint32_t kOtherMediaFlowSsrc = 0x9999;
PacketBuilder p; PacketBuilder p;
p.AddSrPacket(kSenderSsrc); p.AddSrPacket(kSenderSsrc);
@@ -370,9 +370,9 @@ TEST_F(RtcpReceiverTest, TmmbrPacketNotForUsIgnored) {
} }
TEST_F(RtcpReceiverTest, TmmbrPacketZeroRateIgnored) { TEST_F(RtcpReceiverTest, TmmbrPacketZeroRateIgnored) {
const WebRtc_UWord32 kMediaFlowSsrc = 0x2040608; const uint32_t kMediaFlowSsrc = 0x2040608;
const WebRtc_UWord32 kSenderSsrc = 0x10203; const uint32_t kSenderSsrc = 0x10203;
const WebRtc_UWord32 kMediaRecipientSsrc = 0x101; const uint32_t kMediaRecipientSsrc = 0x101;
rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above. rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above.
PacketBuilder p; PacketBuilder p;
@@ -389,14 +389,14 @@ TEST_F(RtcpReceiverTest, TmmbrPacketZeroRateIgnored) {
} }
TEST_F(RtcpReceiverTest, TmmbrThreeConstraintsTimeOut) { TEST_F(RtcpReceiverTest, TmmbrThreeConstraintsTimeOut) {
const WebRtc_UWord32 kMediaFlowSsrc = 0x2040608; const uint32_t kMediaFlowSsrc = 0x2040608;
const WebRtc_UWord32 kSenderSsrc = 0x10203; const uint32_t kSenderSsrc = 0x10203;
const WebRtc_UWord32 kMediaRecipientSsrc = 0x101; const uint32_t kMediaRecipientSsrc = 0x101;
rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above. rtcp_receiver_->SetSSRC(kMediaFlowSsrc); // Matches "media source" above.
// Inject 3 packets "from" kMediaRecipientSsrc, Ssrc+1, Ssrc+2. // Inject 3 packets "from" kMediaRecipientSsrc, Ssrc+1, Ssrc+2.
// The times of arrival are starttime + 0, starttime + 5 and starttime + 10. // 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) { ssrc < kMediaRecipientSsrc+3; ++ssrc) {
PacketBuilder p; PacketBuilder p;
p.AddSrPacket(kSenderSsrc); p.AddSrPacket(kSenderSsrc);

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -48,8 +48,8 @@ class RtpFormatVp8 {
public: public:
// Initialize with payload from encoder and fragmentation info. // Initialize with payload from encoder and fragmentation info.
// The payload_data must be exactly one encoded VP8 frame. // The payload_data must be exactly one encoded VP8 frame.
RtpFormatVp8(const WebRtc_UWord8* payload_data, RtpFormatVp8(const uint8_t* payload_data,
WebRtc_UWord32 payload_size, uint32_t payload_size,
const RTPVideoHeaderVP8& hdr_info, const RTPVideoHeaderVP8& hdr_info,
int max_payload_len, int max_payload_len,
const RTPFragmentationHeader& fragmentation, const RTPFragmentationHeader& fragmentation,
@@ -57,8 +57,8 @@ class RtpFormatVp8 {
// Initialize without fragmentation info. Mode kEqualSize will be used. // Initialize without fragmentation info. Mode kEqualSize will be used.
// The payload_data must be exactly one encoded VP8 frame. // The payload_data must be exactly one encoded VP8 frame.
RtpFormatVp8(const WebRtc_UWord8* payload_data, RtpFormatVp8(const uint8_t* payload_data,
WebRtc_UWord32 payload_size, uint32_t payload_size,
const RTPVideoHeaderVP8& hdr_info, const RTPVideoHeaderVP8& hdr_info,
int max_payload_len); int max_payload_len);
@@ -73,7 +73,7 @@ class RtpFormatVp8 {
// the first payload byte in the packet is taken, with the first partition // the first payload byte in the packet is taken, with the first partition
// having index 0; returns negative on error. // having index 0; returns negative on error.
// For the kEqualSize mode: returns 0 on success, return 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, int* bytes_to_send,
bool* last_packet); bool* last_packet);
@@ -139,35 +139,35 @@ class RtpFormatVp8 {
// The info in packet_info determines which part of the payload is written // The info in packet_info determines which part of the payload is written
// and what to write in the header fields. // and what to write in the header fields.
int WriteHeaderAndPayload(const InfoStruct& packet_info, int WriteHeaderAndPayload(const InfoStruct& packet_info,
WebRtc_UWord8* buffer, uint8_t* buffer,
int buffer_length) const; int buffer_length) const;
// Write the X field and the appropriate extension fields to buffer. // Write the X field and the appropriate extension fields to buffer.
// The function returns the extension length (including X field), or -1 // The function returns the extension length (including X field), or -1
// on error. // 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 // 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. // 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; int buffer_length, int* extension_length) const;
// Set the L bit in the x_field, and write Tl0PicIdx to the appropriate // 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. // 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; 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 // 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, // appropriate position in buffer. The function returns 0 on success,
// -1 otherwise. // -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; int buffer_length, int* extension_length) const;
// Write the PictureID from codec_specific_info_ to buffer. One or two // Write the PictureID from codec_specific_info_ to buffer. One or two
// bytes are written, depending on magnitude of PictureID. The function // bytes are written, depending on magnitude of PictureID. The function
// returns the number of bytes written. // 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 // Calculate and return length (octets) of the variable header fields in
// the next header (i.e., header length in addition to vp8_header_bytes_). // the next header (i.e., header length in addition to vp8_header_bytes_).
@@ -184,7 +184,7 @@ class RtpFormatVp8 {
bool TL0PicIdxFieldPresent() const; bool TL0PicIdxFieldPresent() const;
bool PictureIdPresent() const { return (PictureIdLength() > 0); } bool PictureIdPresent() const { return (PictureIdLength() > 0); }
const WebRtc_UWord8* payload_data_; const uint8_t* payload_data_;
const int payload_size_; const int payload_size_;
RTPFragmentationHeader part_info_; RTPFragmentationHeader part_info_;
const int vp8_fixed_payload_descriptor_bytes_; // Length of VP8 payload 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]; payload_size_ += partition_sizes[p];
} }
buffer_size_ = payload_size_ + 6; // Add space for payload descriptor. buffer_size_ = payload_size_ + 6; // Add space for payload descriptor.
payload_data_ = new WebRtc_UWord8[payload_size_]; payload_data_ = new uint8_t[payload_size_];
buffer_ = new WebRtc_UWord8[buffer_size_]; buffer_ = new uint8_t[buffer_size_];
int j = 0; int j = 0;
// Loop through the partitions again. // Loop through the partitions again.
for (int p = 0; p < num_partitions; ++p) { for (int p = 0; p < num_partitions; ++p) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -92,7 +92,7 @@ TEST_F(RtpSenderTest, RegisterRtpHeaderExtension) {
} }
TEST_F(RtpSenderTest, BuildRTPPacket) { TEST_F(RtpSenderTest, BuildRTPPacket) {
WebRtc_Word32 length = rtp_sender_->BuildRTPheader(packet_, int32_t length = rtp_sender_->BuildRTPheader(packet_,
kPayload, kPayload,
kMarkerBit, kMarkerBit,
kTimestamp); kTimestamp);
@@ -117,7 +117,7 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithTransmissionOffsetExtension) {
EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kTimeOffset)); EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kTimeOffset));
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId)); EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId));
WebRtc_Word32 length = rtp_sender_->BuildRTPheader(packet_, int32_t length = rtp_sender_->BuildRTPheader(packet_,
kPayload, kPayload,
kMarkerBit, kMarkerBit,
kTimestamp); kTimestamp);
@@ -152,7 +152,7 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kNegTimeOffset)); EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kNegTimeOffset));
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId)); EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId));
WebRtc_Word32 length = rtp_sender_->BuildRTPheader(packet_, int32_t length = rtp_sender_->BuildRTPheader(packet_,
kPayload, kPayload,
kMarkerBit, kMarkerBit,
kTimestamp); kTimestamp);
@@ -174,7 +174,7 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
} }
TEST_F(RtpSenderTest, NoTrafficSmoothing) { TEST_F(RtpSenderTest, NoTrafficSmoothing) {
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_, int32_t rtp_length = rtp_sender_->BuildRTPheader(packet_,
kPayload, kPayload,
kMarkerBit, kMarkerBit,
kTimestamp); kTimestamp);
@@ -194,7 +194,7 @@ TEST_F(RtpSenderTest, DISABLED_TrafficSmoothing) {
rtp_sender_->SetStorePacketsStatus(true, 10); rtp_sender_->SetStorePacketsStatus(true, 10);
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId)); EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kType, kId));
rtp_sender_->SetTargetSendBitrate(300000); rtp_sender_->SetTargetSendBitrate(300000);
WebRtc_Word32 rtp_length = rtp_sender_->BuildRTPheader(packet_, int32_t rtp_length = rtp_sender_->BuildRTPheader(packet_,
kPayload, kPayload,
kMarkerBit, kMarkerBit,
kTimestamp); kTimestamp);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -25,7 +25,7 @@ public:
BWEConvergenceTestUp(std::string testName, int startRateKbps, int availBWkbps); BWEConvergenceTestUp(std::string testName, int startRateKbps, int availBWkbps);
virtual ~BWEConvergenceTestUp(); virtual ~BWEConvergenceTestUp();
virtual int Init(std::string ip, WebRtc_UWord16 port); virtual int Init(std::string ip, uint16_t port);
protected: protected:
virtual bool StoppingCriterionMaster(); 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 // create the load generator object
const int rtpSampleRate = 90000; const int rtpSampleRate = 90000;

View File

@@ -25,7 +25,7 @@ public:
BWEStabilityTest(std::string testName, int rateKbps, int testDurationSeconds); BWEStabilityTest(std::string testName, int rateKbps, int testDurationSeconds);
virtual ~BWEStabilityTest(); 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); virtual void Report(std::fstream &log);
protected: protected:

View File

@@ -32,36 +32,36 @@ public:
myTransportCB (RtpRtcp *rtpMod) : _rtpMod(rtpMod) {}; myTransportCB (RtpRtcp *rtpMod) : _rtpMod(rtpMod) {};
protected: protected:
// Inherited from UdpTransportData // Inherited from UdpTransportData
virtual void IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket, virtual void IncomingRTPPacket(const int8_t* incomingRtpPacket,
const WebRtc_Word32 rtpPacketLength, const int32_t rtpPacketLength,
const WebRtc_Word8* fromIP, const int8_t* fromIP,
const WebRtc_UWord16 fromPort); const uint16_t fromPort);
virtual void IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket, virtual void IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
const WebRtc_Word32 rtcpPacketLength, const int32_t rtcpPacketLength,
const WebRtc_Word8* fromIP, const int8_t* fromIP,
const WebRtc_UWord16 fromPort); const uint16_t fromPort);
private: private:
RtpRtcp *_rtpMod; RtpRtcp *_rtpMod;
}; };
void myTransportCB::IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket, void myTransportCB::IncomingRTPPacket(const int8_t* incomingRtpPacket,
const WebRtc_Word32 rtpPacketLength, const int32_t rtpPacketLength,
const WebRtc_Word8* fromIP, const int8_t* fromIP,
const WebRtc_UWord16 fromPort) const uint16_t fromPort)
{ {
printf("Receiving RTP from IP %s, port %u\n", fromIP, 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, void myTransportCB::IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
const WebRtc_Word32 rtcpPacketLength, const int32_t rtcpPacketLength,
const WebRtc_Word8* fromIP, const int8_t* fromIP,
const WebRtc_UWord16 fromPort) const uint16_t fromPort)
{ {
printf("Receiving RTCP from IP %s, port %u\n", fromIP, 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 isSender = false;
bool isReceiver = false; bool isReceiver = false;
WebRtc_UWord16 port; uint16_t port;
std::string ip; std::string ip;
TestSenderReceiver *sendrec = new TestSenderReceiver(); TestSenderReceiver *sendrec = new TestSenderReceiver();
TestLoadGenerator *gen; TestLoadGenerator *gen;
@@ -105,12 +105,12 @@ int main(int argc, char* argv[])
if (isSender) if (isSender)
{ {
const WebRtc_UWord32 startRateKbps = 1000; const uint32_t startRateKbps = 1000;
//gen = new CBRGenerator(sendrec, 1000, 500); //gen = new CBRGenerator(sendrec, 1000, 500);
gen = new CBRFixFRGenerator(sendrec, startRateKbps, 90000, 30, 0.2); gen = new CBRFixFRGenerator(sendrec, startRateKbps, 90000, 30, 0.2);
//gen = new PeriodicKeyFixFRGenerator(sendrec, startRateKbps, 90000, 30, 0.2, 7, 300); //gen = new PeriodicKeyFixFRGenerator(sendrec, startRateKbps, 90000, 30, 0.2, 7, 300);
//const WebRtc_UWord16 numFrameRates = 5; //const uint16_t numFrameRates = 5;
//const WebRtc_UWord8 frameRates[numFrameRates] = {30, 15, 20, 23, 25}; //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 CBRVarFRGenerator(sendrec, 1000, frameRates, numFrameRates, 90000, 4.0, 0.1, 0.2);
//gen = new CBRFrameDropGenerator(sendrec, startRateKbps, 90000, 0.2); //gen = new CBRFrameDropGenerator(sendrec, startRateKbps, 90000, 0.2);
sendrec->SetLoadGenerator(gen); sendrec->SetLoadGenerator(gen);
@@ -130,7 +130,7 @@ int main(int argc, char* argv[])
delete sendrec; delete sendrec;
//WebRtc_UWord8 numberOfSocketThreads = 1; //uint8_t numberOfSocketThreads = 1;
//UdpTransport* transport = UdpTransport::Create(0, numberOfSocketThreads); //UdpTransport* transport = UdpTransport::Create(0, numberOfSocketThreads);
//RtpRtcp* rtp = RtpRtcp::CreateRtpRtcp(1, false); //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->InitializeReceiveSockets(tp, 10000, "0.0.0.0");
// transport->StartReceiving(500); // 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; data[i] = i++);
// for (int i = 0; i < 100; 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) // while (totTime < 10000)
// { // {
// transport->Process(); // transport->Process();
// WebRtc_Word32 wTime = transport->TimeUntilNextProcess(); // int32_t wTime = transport->TimeUntilNextProcess();
// totTime += wTime; // totTime += wTime;
// Sleep(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) if (_initialized)
{ {
@@ -403,17 +403,17 @@ void BWETest::Report(std::fstream &log)
// SenderReceiver callback // SenderReceiver callback
void BWETest::OnOnNetworkChanged(const WebRtc_UWord32 bitrateTargetBps, void BWETest::OnOnNetworkChanged(const uint32_t bitrateTargetBps,
const WebRtc_UWord8 fractionLost, const uint8_t fractionLost,
const WebRtc_UWord16 roundTripTimeMs, const uint16_t roundTripTimeMs,
const WebRtc_UWord32 jitterMS, const uint32_t jitterMS,
const WebRtc_UWord16 bwEstimateKbitMin, const uint16_t bwEstimateKbitMin,
const WebRtc_UWord16 bwEstimateKbitMax) const uint16_t bwEstimateKbitMax)
{ {
CriticalSectionScoped cs(_statCritSect); CriticalSectionScoped cs(_statCritSect);
// bitrate statistics // bitrate statistics
WebRtc_Word32 newBitrateKbps = bitrateTargetBps/1000; int32_t newBitrateKbps = bitrateTargetBps/1000;
_rateVecKbps.push_back(newBitrateKbps); _rateVecKbps.push_back(newBitrateKbps);
_rttVecMs.push_back(roundTripTimeMs); _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) if (!_master)
@@ -442,10 +442,10 @@ bool BWEOneWayTest::Start()
if (!_master) if (!_master)
{ {
// send one dummy RTP packet to enable RTT measurements // 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); //_gen->sendPayload(TickTime::MillisecondTimestamp(), &dummy, 0);
_sendrec->SendOutgoingData( _sendrec->SendOutgoingData(
static_cast<WebRtc_UWord32>(TickTime::MillisecondTimestamp()*90), static_cast<uint32_t>(TickTime::MillisecondTimestamp()*90),
&dummy, 1, webrtc::kVideoFrameDelta); &dummy, 1, webrtc::kVideoFrameDelta);
} }

View File

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

View File

@@ -148,7 +148,7 @@ int main(int argc, char* argv[])
{ {
bool isMaster = false; bool isMaster = false;
WebRtc_UWord16 port; uint16_t port;
std::string ip; std::string ip;
std::fstream log; std::fstream log;
log.open("TestLog.txt", std::fstream::out | std::fstream::app); 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 // create the load generator object
const int rtpSampleRate = 90000; const int rtpSampleRate = 90000;
@@ -64,7 +64,7 @@ bool BWETwoWayLimitFinding::StoppingCriterionMaster()
_forwLimitReached = true; _forwLimitReached = true;
} }
WebRtc_Word32 revRateKbps = _sendrec->ReceiveBitrateKbps(); int32_t revRateKbps = _sendrec->ReceiveBitrateKbps();
if (revRateKbps > (0.95 * _incomingAvailBWkbps)) if (revRateKbps > (0.95 * _incomingAvailBWkbps))
{ {
_revLimitReached = true; _revLimitReached = true;

View File

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

View File

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

View File

@@ -74,14 +74,14 @@ class MatlabTimeLine : public MatlabLine
{ {
public: public:
MatlabTimeLine(int horizonSeconds = -1, const char *plotAttrib = NULL, const char *name = NULL, MatlabTimeLine(int horizonSeconds = -1, const char *plotAttrib = NULL, const char *name = NULL,
WebRtc_Word64 refTimeMs = -1); int64_t refTimeMs = -1);
~MatlabTimeLine() {}; ~MatlabTimeLine() {};
void Append(double y); void Append(double y);
void PurgeOldData(); void PurgeOldData();
WebRtc_Word64 GetRefTime(); int64_t GetRefTime();
private: private:
WebRtc_Word64 _refTimeMs; int64_t _refTimeMs;
int _timeHorizon; int _timeHorizon;
}; };
@@ -96,7 +96,7 @@ public:
int AddLine(int maxLen = -1, const char *plotAttrib = NULL, const char *name = NULL); 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, 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); int GetLineIx(const char *name);
void Append(int lineIndex, double x, double y); void Append(int lineIndex, double x, double y);
void Append(int lineIndex, 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); int MakeTrend(const char *sourceName, const char *trendName, double slope, double offset, const char *plotAttrib = NULL);
#ifdef PLOT_TESTING #ifdef PLOT_TESTING
WebRtc_Word64 _plotStartTime; int64_t _plotStartTime;
WebRtc_Word64 _plotDelay; int64_t _plotDelay;
#endif #endif
private: 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()), _critSect(CriticalSectionWrapper::CreateCriticalSection()),
_eventPtr(NULL), _eventPtr(NULL),
@@ -53,7 +53,7 @@ TestLoadGenerator::~TestLoadGenerator ()
delete _critSect; delete _critSect;
} }
WebRtc_Word32 TestLoadGenerator::SetBitrate (WebRtc_Word32 newBitrateKbps) int32_t TestLoadGenerator::SetBitrate (int32_t newBitrateKbps)
{ {
CriticalSectionScoped cs(_critSect); 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); CriticalSectionScoped cs(_critSect);
@@ -92,7 +92,7 @@ WebRtc_Word32 TestLoadGenerator::Start (const char *threadName)
} }
WebRtc_Word32 TestLoadGenerator::Stop () int32_t TestLoadGenerator::Stop ()
{ {
_critSect.Enter(); _critSect.Enter();
@@ -123,13 +123,13 @@ WebRtc_Word32 TestLoadGenerator::Stop ()
int TestLoadGenerator::generatePayload () 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, int TestLoadGenerator::sendPayload (const uint32_t timeStamp,
const WebRtc_UWord8* payloadData, const uint8_t* payloadData,
const WebRtc_UWord32 payloadSize, const uint32_t payloadSize,
const webrtc::FrameType frameType /*= webrtc::kVideoFrameDelta*/) 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), //_eventPtr(NULL),
_payloadSizeBytes(payloadSizeBytes), _payloadSizeBytes(payloadSizeBytes),
_payload(new WebRtc_UWord8[payloadSizeBytes]), _payload(new uint8_t[payloadSizeBytes]),
TestLoadGenerator(sender, rtpSampleRate) TestLoadGenerator(sender, rtpSampleRate)
{ {
SetBitrate (bitrateKbps); SetBitrate (bitrateKbps);
@@ -164,37 +164,37 @@ CBRGenerator::~CBRGenerator ()
bool CBRGenerator::GeneratorLoop () bool CBRGenerator::GeneratorLoop ()
{ {
double periodMs; double periodMs;
WebRtc_Word64 nextSendTime = TickTime::MillisecondTimestamp(); int64_t nextSendTime = TickTime::MillisecondTimestamp();
// no critSect // no critSect
while (_running) while (_running)
{ {
// send data (critSect inside) // send data (critSect inside)
generatePayload( static_cast<WebRtc_UWord32>(nextSendTime * _rtpSampleRate / 1000) ); generatePayload( static_cast<uint32_t>(nextSendTime * _rtpSampleRate / 1000) );
// calculate wait time // calculate wait time
periodMs = 8.0 * _payloadSizeBytes / ( _bitrateKbps ); 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) if (waitTime < 0)
{ {
waitTime = 0; waitTime = 0;
} }
// wait // wait
_eventPtr->Wait(static_cast<WebRtc_Word32>(waitTime)); _eventPtr->Wait(static_cast<int32_t>(waitTime));
} }
return true; return true;
} }
int CBRGenerator::generatePayload ( WebRtc_UWord32 timestamp ) int CBRGenerator::generatePayload ( uint32_t timestamp )
{ {
CriticalSectionScoped cs(_critSect); CriticalSectionScoped cs(_critSect);
//WebRtc_UWord8 *payload = new WebRtc_UWord8[_payloadSizeBytes]; //uint8_t *payload = new uint8_t[_payloadSizeBytes];
int ret = sendPayload(timestamp, _payload, _payloadSizeBytes); int ret = sendPayload(timestamp, _payload, _payloadSizeBytes);
@@ -207,8 +207,8 @@ int CBRGenerator::generatePayload ( WebRtc_UWord32 timestamp )
///////////////////// /////////////////////
CBRFixFRGenerator::CBRFixFRGenerator (TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps, CBRFixFRGenerator::CBRFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps,
WebRtc_Word32 rtpSampleRate, WebRtc_Word32 frameRateFps /*= 30*/, int32_t rtpSampleRate, int32_t frameRateFps /*= 30*/,
double spread /*= 0.0*/) double spread /*= 0.0*/)
: :
//_eventPtr(NULL), //_eventPtr(NULL),
@@ -240,7 +240,7 @@ CBRFixFRGenerator::~CBRFixFRGenerator ()
bool CBRFixFRGenerator::GeneratorLoop () bool CBRFixFRGenerator::GeneratorLoop ()
{ {
double periodMs; double periodMs;
WebRtc_Word64 nextSendTime = TickTime::MillisecondTimestamp(); int64_t nextSendTime = TickTime::MillisecondTimestamp();
_critSect.Enter(); _critSect.Enter();
@@ -271,22 +271,22 @@ bool CBRFixFRGenerator::GeneratorLoop ()
_payload = NULL; _payload = NULL;
} }
_payloadAllocLen = static_cast<WebRtc_Word32>((_payloadSizeBytes * (1 + _spreadFactor) * 3) / 2 + .5); // 50% extra to avoid frequent re-alloc _payloadAllocLen = static_cast<int32_t>((_payloadSizeBytes * (1 + _spreadFactor) * 3) / 2 + .5); // 50% extra to avoid frequent re-alloc
_payload = new WebRtc_UWord8[_payloadAllocLen]; _payload = new uint8_t[_payloadAllocLen];
} }
// send data (critSect inside) // send data (critSect inside)
generatePayload( static_cast<WebRtc_UWord32>(nextSendTime * _rtpSampleRate / 1000) ); generatePayload( static_cast<uint32_t>(nextSendTime * _rtpSampleRate / 1000) );
} }
_critSect.Leave(); _critSect.Leave();
// calculate wait time // calculate wait time
periodMs = 1000.0 / _frameRateFps; 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) if (waitTime < 0)
{ {
waitTime = 0; waitTime = 0;
@@ -298,20 +298,20 @@ bool CBRFixFRGenerator::GeneratorLoop ()
return true; return true;
} }
WebRtc_Word32 CBRFixFRGenerator::nextPayloadSize() int32_t CBRFixFRGenerator::nextPayloadSize()
{ {
const double periodMs = 1000.0 / _frameRateFps; 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); CriticalSectionScoped cs(_critSect);
double factor = ((double) rand() - RAND_MAX/2) / RAND_MAX; // [-0.5; 0.5] double factor = ((double) rand() - RAND_MAX/2) / RAND_MAX; // [-0.5; 0.5]
factor = 1 + 2 * _spreadFactor * factor; // [1 - _spreadFactor ; 1 + _spreadFactor] 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 // sanity
if (thisPayloadBytes > _payloadAllocLen) if (thisPayloadBytes > _payloadAllocLen)
{ {
@@ -325,9 +325,9 @@ int CBRFixFRGenerator::generatePayload ( WebRtc_UWord32 timestamp )
///////////////////// /////////////////////
PeriodicKeyFixFRGenerator::PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps, PeriodicKeyFixFRGenerator::PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps,
WebRtc_Word32 rtpSampleRate, WebRtc_Word32 frameRateFps /*= 30*/, int32_t rtpSampleRate, int32_t frameRateFps /*= 30*/,
double spread /*= 0.0*/, double keyFactor /*= 4.0*/, WebRtc_UWord32 keyPeriod /*= 300*/) double spread /*= 0.0*/, double keyFactor /*= 4.0*/, uint32_t keyPeriod /*= 300*/)
: :
_keyFactor(keyFactor), _keyFactor(keyFactor),
_keyPeriod(keyPeriod), _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 // 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) if (_frameCount % _keyPeriod == 0)
{ {
// this is a key frame, scale the payload size // 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++; _frameCount++;
@@ -353,8 +353,8 @@ WebRtc_Word32 PeriodicKeyFixFRGenerator::nextPayloadSize()
//////////////////// ////////////////////
CBRVarFRGenerator::CBRVarFRGenerator(TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps, const WebRtc_UWord8* frameRates, CBRVarFRGenerator::CBRVarFRGenerator(TestSenderReceiver *sender, int32_t bitrateKbps, const uint8_t* frameRates,
WebRtc_UWord16 numFrameRates, WebRtc_Word32 rtpSampleRate, double avgFrPeriodMs, uint16_t numFrameRates, int32_t rtpSampleRate, double avgFrPeriodMs,
double frSpreadFactor, double spreadFactor) double frSpreadFactor, double spreadFactor)
: :
_avgFrPeriodMs(avgFrPeriodMs), _avgFrPeriodMs(avgFrPeriodMs),
@@ -364,7 +364,7 @@ _numFrameRates(numFrameRates),
_frChangeTimeMs(TickTime::MillisecondTimestamp() + _avgFrPeriodMs), _frChangeTimeMs(TickTime::MillisecondTimestamp() + _avgFrPeriodMs),
CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, frameRates[0], spreadFactor) CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, frameRates[0], spreadFactor)
{ {
_frameRates = new WebRtc_UWord8[_numFrameRates]; _frameRates = new uint8_t[_numFrameRates];
memcpy(_frameRates, frameRates, _numFrameRates); memcpy(_frameRates, frameRates, _numFrameRates);
} }
@@ -375,26 +375,26 @@ CBRVarFRGenerator::~CBRVarFRGenerator()
void CBRVarFRGenerator::ChangeFrameRate() void CBRVarFRGenerator::ChangeFrameRate()
{ {
const WebRtc_Word64 nowMs = TickTime::MillisecondTimestamp(); const int64_t nowMs = TickTime::MillisecondTimestamp();
if (nowMs < _frChangeTimeMs) if (nowMs < _frChangeTimeMs)
{ {
return; return;
} }
// Time to change frame rate // 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) ; * (_numFrameRates - 1) + 0.5) ;
assert(frIndex < _numFrameRates); assert(frIndex < _numFrameRates);
_frameRateFps = _frameRates[frIndex]; _frameRateFps = _frameRates[frIndex];
// Update the next frame rate change time // Update the next frame rate change time
double factor = ((double) rand() - RAND_MAX/2) / RAND_MAX; // [-0.5; 0.5] double factor = ((double) rand() - RAND_MAX/2) / RAND_MAX; // [-0.5; 0.5]
factor = 1 + 2 * _frSpreadFactor * factor; // [1 - _frSpreadFactor ; 1 + _frSpreadFactor] factor = 1 + 2 * _frSpreadFactor * factor; // [1 - _frSpreadFactor ; 1 + _frSpreadFactor]
_frChangeTimeMs = nowMs + static_cast<WebRtc_Word64>(1000.0 * factor * _frChangeTimeMs = nowMs + static_cast<int64_t>(1000.0 * factor *
_avgFrPeriodMs + 0.5); _avgFrPeriodMs + 0.5);
printf("New frame rate: %d\n", _frameRateFps); printf("New frame rate: %d\n", _frameRateFps);
} }
WebRtc_Word32 CBRVarFRGenerator::nextPayloadSize() int32_t CBRVarFRGenerator::nextPayloadSize()
{ {
ChangeFrameRate(); ChangeFrameRate();
return CBRFixFRGenerator::nextPayloadSize(); return CBRFixFRGenerator::nextPayloadSize();
@@ -402,8 +402,8 @@ WebRtc_Word32 CBRVarFRGenerator::nextPayloadSize()
//////////////////// ////////////////////
CBRFrameDropGenerator::CBRFrameDropGenerator(TestSenderReceiver *sender, WebRtc_Word32 bitrateKbps, CBRFrameDropGenerator::CBRFrameDropGenerator(TestSenderReceiver *sender, int32_t bitrateKbps,
WebRtc_Word32 rtpSampleRate, double spreadFactor) int32_t rtpSampleRate, double spreadFactor)
: :
_accBits(0), _accBits(0),
CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, 30, spreadFactor) CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, 30, spreadFactor)
@@ -414,7 +414,7 @@ CBRFrameDropGenerator::~CBRFrameDropGenerator()
{ {
} }
WebRtc_Word32 CBRFrameDropGenerator::nextPayloadSize() int32_t CBRFrameDropGenerator::nextPayloadSize()
{ {
_accBits -= 1000 * _bitrateKbps / _frameRateFps; _accBits -= 1000 * _bitrateKbps / _frameRateFps;
if (_accBits < 0) if (_accBits < 0)
@@ -430,8 +430,8 @@ WebRtc_Word32 CBRFrameDropGenerator::nextPayloadSize()
{ {
//printf("keep\n"); //printf("keep\n");
const double periodMs = 1000.0 / _frameRateFps; const double periodMs = 1000.0 / _frameRateFps;
WebRtc_Word32 frameSize = static_cast<WebRtc_Word32>(_bitrateKbps * periodMs / 8 + 0.5); int32_t frameSize = static_cast<int32_t>(_bitrateKbps * periodMs / 8 + 0.5);
frameSize = std::max(frameSize, static_cast<WebRtc_Word32>(300 * periodMs / 8 + 0.5)); frameSize = std::max(frameSize, static_cast<int32_t>(300 * periodMs / 8 + 0.5));
_accBits += frameSize * 8; _accBits += frameSize * 8;
return frameSize; return frameSize;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -27,20 +27,20 @@ class RtcpCallback : public RtcpFeedback, public RtcpIntraFrameObserver {
void SetModule(RtpRtcp* module) { void SetModule(RtpRtcp* module) {
_rtpRtcpModule = module; _rtpRtcpModule = module;
}; };
virtual void OnRTCPPacketTimeout(const WebRtc_Word32 id) { virtual void OnRTCPPacketTimeout(const int32_t id) {
} }
virtual void OnLipSyncUpdate(const WebRtc_Word32 id, virtual void OnLipSyncUpdate(const int32_t id,
const WebRtc_Word32 audioVideoOffset) { const int32_t audioVideoOffset) {
}; };
virtual void OnXRVoIPMetricReceived( virtual void OnXRVoIPMetricReceived(
const WebRtc_Word32 id, const int32_t id,
const RTCPVoIPMetric* metric) { const RTCPVoIPMetric* metric) {
}; };
virtual void OnApplicationDataReceived(const WebRtc_Word32 id, virtual void OnApplicationDataReceived(const int32_t id,
const WebRtc_UWord8 subType, const uint8_t subType,
const WebRtc_UWord32 name, const uint32_t name,
const WebRtc_UWord16 length, const uint16_t length,
const WebRtc_UWord8* data) { const uint8_t* data) {
char print_name[5]; char print_name[5];
print_name[0] = static_cast<char>(name >> 24); print_name[0] = static_cast<char>(name >> 24);
print_name[1] = static_cast<char>(name >> 16); print_name[1] = static_cast<char>(name >> 16);
@@ -50,16 +50,16 @@ class RtcpCallback : public RtcpFeedback, public RtcpIntraFrameObserver {
EXPECT_STRCASEEQ("test", print_name); EXPECT_STRCASEEQ("test", print_name);
}; };
virtual void OnSendReportReceived(const WebRtc_Word32 id, virtual void OnSendReportReceived(const int32_t id,
const WebRtc_UWord32 senderSSRC, const uint32_t senderSSRC,
uint32_t ntp_secs, uint32_t ntp_secs,
uint32_t ntp_frac, uint32_t ntp_frac,
uint32_t timestamp) { uint32_t timestamp) {
RTCPSenderInfo senderInfo; RTCPSenderInfo senderInfo;
EXPECT_EQ(0, _rtpRtcpModule->RemoteRTCPStat(&senderInfo)); EXPECT_EQ(0, _rtpRtcpModule->RemoteRTCPStat(&senderInfo));
}; };
virtual void OnReceiveReportReceived(const WebRtc_Word32 id, virtual void OnReceiveReportReceived(const int32_t id,
const WebRtc_UWord32 senderSSRC) { const uint32_t senderSSRC) {
}; };
virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) { 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 // We need to send one RTP packet to get the RTCP packet to be accepted by
// the receiving module. // the receiving module.
// send RTP packet with the data "testtest" // 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, EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
0, -1, test, 8)); 0, -1, test, 8));
} }
@@ -167,10 +167,10 @@ class RtpRtcpRtcpTest : public ::testing::Test {
RtcpCallback* myRTCPFeedback1; RtcpCallback* myRTCPFeedback1;
RtcpCallback* myRTCPFeedback2; RtcpCallback* myRTCPFeedback2;
WebRtc_UWord32 test_ssrc; uint32_t test_ssrc;
WebRtc_UWord32 test_timestamp; uint32_t test_timestamp;
WebRtc_UWord16 test_sequence_number; uint16_t test_sequence_number;
WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize]; uint32_t test_CSRC[webrtc::kRtpCsrcSize];
SimulatedClock fake_clock; SimulatedClock fake_clock;
}; };
@@ -180,7 +180,7 @@ TEST_F(RtpRtcpRtcpTest, RTCP_PLI_RPSI) {
} }
TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) { TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
WebRtc_UWord32 testOfCSRC[webrtc::kRtpCsrcSize]; uint32_t testOfCSRC[webrtc::kRtpCsrcSize];
EXPECT_EQ(2, module2->RemoteCSRCs(testOfCSRC)); EXPECT_EQ(2, module2->RemoteCSRCs(testOfCSRC));
EXPECT_EQ(test_CSRC[0], testOfCSRC[0]); EXPECT_EQ(test_CSRC[0], testOfCSRC[0]);
EXPECT_EQ(test_CSRC[1], testOfCSRC[1]); EXPECT_EQ(test_CSRC[1], testOfCSRC[1]);
@@ -236,14 +236,14 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
reportBlock.lastSR= 7; reportBlock.lastSR= 7;
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_CSRC[1], &reportBlock)); EXPECT_EQ(0, module1->AddRTCPReportBlock(test_CSRC[1], &reportBlock));
WebRtc_UWord32 name = 't' << 24; uint32_t name = 't' << 24;
name += 'e' << 16; name += 'e' << 16;
name += 's' << 8; name += 's' << 8;
name += 't'; name += 't';
EXPECT_EQ(0, module1->SetRTCPApplicationSpecificData( EXPECT_EQ(0, module1->SetRTCPApplicationSpecificData(
3, 3,
name, 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"\ " 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); fake_clock.AdvanceTimeMilliseconds(100);
module2->Process(); module2->Process();
WebRtc_UWord32 receivedNTPsecs = 0; uint32_t receivedNTPsecs = 0;
WebRtc_UWord32 receivedNTPfrac = 0; uint32_t receivedNTPfrac = 0;
WebRtc_UWord32 RTCPArrivalTimeSecs = 0; uint32_t RTCPArrivalTimeSecs = 0;
WebRtc_UWord32 RTCPArrivalTimeFrac = 0; uint32_t RTCPArrivalTimeFrac = 0;
EXPECT_EQ(0, module2->RemoteNTP(&receivedNTPsecs, EXPECT_EQ(0, module2->RemoteNTP(&receivedNTPsecs,
&receivedNTPfrac, &receivedNTPfrac,
&RTCPArrivalTimeSecs, &RTCPArrivalTimeSecs,
@@ -281,28 +281,28 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
EXPECT_EQ(test_sequence_number, reportBlockReceived.extendedHighSeqNum); EXPECT_EQ(test_sequence_number, reportBlockReceived.extendedHighSeqNum);
EXPECT_EQ(0, reportBlockReceived.fractionLost); EXPECT_EQ(0, reportBlockReceived.fractionLost);
EXPECT_EQ(static_cast<WebRtc_UWord32>(0), EXPECT_EQ(static_cast<uint32_t>(0),
reportBlockReceived.cumulativeLost); reportBlockReceived.cumulativeLost);
WebRtc_UWord8 fraction_lost = 0; // scale 0 to 255 uint8_t fraction_lost = 0; // scale 0 to 255
WebRtc_UWord32 cum_lost = 0; // number of lost packets uint32_t cum_lost = 0; // number of lost packets
WebRtc_UWord32 ext_max = 0; // highest sequence number received uint32_t ext_max = 0; // highest sequence number received
WebRtc_UWord32 jitter = 0; uint32_t jitter = 0;
WebRtc_UWord32 max_jitter = 0; uint32_t max_jitter = 0;
EXPECT_EQ(0, module2->StatisticsRTP(&fraction_lost, EXPECT_EQ(0, module2->StatisticsRTP(&fraction_lost,
&cum_lost, &cum_lost,
&ext_max, &ext_max,
&jitter, &jitter,
&max_jitter)); &max_jitter));
EXPECT_EQ(0, fraction_lost); 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(test_sequence_number, ext_max);
EXPECT_EQ(reportBlockReceived.jitter, jitter); EXPECT_EQ(reportBlockReceived.jitter, jitter);
WebRtc_UWord16 RTT; uint16_t RTT;
WebRtc_UWord16 avgRTT; uint16_t avgRTT;
WebRtc_UWord16 minRTT; uint16_t minRTT;
WebRtc_UWord16 maxRTT; uint16_t maxRTT;
// Get RoundTripTime. // Get RoundTripTime.
EXPECT_EQ(0, module1->RTT(test_ssrc + 1, &RTT, &avgRTT, &minRTT, &maxRTT)); 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, int32_t BuildRTPheader(uint8_t* dataBuffer,
WebRtc_UWord32 timestamp, uint32_t timestamp,
WebRtc_UWord32 sequence_number) { uint32_t sequence_number) {
dataBuffer[0] = static_cast<WebRtc_UWord8>(0x80); // version 2 dataBuffer[0] = static_cast<uint8_t>(0x80); // version 2
dataBuffer[1] = static_cast<WebRtc_UWord8>(kPayloadType); dataBuffer[1] = static_cast<uint8_t>(kPayloadType);
ModuleRTPUtility::AssignUWord16ToBuffer(dataBuffer + 2, ModuleRTPUtility::AssignUWord16ToBuffer(dataBuffer + 2,
sequence_number); sequence_number);
ModuleRTPUtility::AssignUWord32ToBuffer(dataBuffer + 4, timestamp); ModuleRTPUtility::AssignUWord32ToBuffer(dataBuffer + 4, timestamp);
ModuleRTPUtility::AssignUWord32ToBuffer(dataBuffer + 8, ModuleRTPUtility::AssignUWord32ToBuffer(dataBuffer + 8,
0x1234); // SSRC. 0x1234); // SSRC.
WebRtc_Word32 rtpHeaderLength = 12; int32_t rtpHeaderLength = 12;
return rtpHeaderLength; return rtpHeaderLength;
} }
int PaddingPacket(uint8_t* buffer, int PaddingPacket(uint8_t* buffer,
WebRtc_UWord32 timestamp, uint32_t timestamp,
WebRtc_UWord32 sequence_number, uint32_t sequence_number,
WebRtc_Word32 bytes) { int32_t bytes) {
// Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP. // Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP.
int max_length = 224; int max_length = 224;
@@ -97,8 +97,8 @@ class RtpRtcpVideoTest : public ::testing::Test {
int header_length = BuildRTPheader(buffer, timestamp, int header_length = BuildRTPheader(buffer, timestamp,
sequence_number); sequence_number);
buffer[0] |= 0x20; // Set padding bit. buffer[0] |= 0x20; // Set padding bit.
WebRtc_Word32* data = int32_t* data =
reinterpret_cast<WebRtc_Word32*>(&(buffer[header_length])); reinterpret_cast<int32_t*>(&(buffer[header_length]));
// Fill data buffer with random data. // Fill data buffer with random data.
for (int j = 0; j < (padding_bytes_in_packet >> 2); j++) { for (int j = 0; j < (padding_bytes_in_packet >> 2); j++) {
@@ -120,17 +120,17 @@ class RtpRtcpVideoTest : public ::testing::Test {
RtpRtcp* video_module_; RtpRtcp* video_module_;
LoopBackTransport* transport_; LoopBackTransport* transport_;
RtpReceiver* receiver_; RtpReceiver* receiver_;
WebRtc_UWord32 test_ssrc_; uint32_t test_ssrc_;
WebRtc_UWord32 test_timestamp_; uint32_t test_timestamp_;
WebRtc_UWord16 test_sequence_number_; uint16_t test_sequence_number_;
WebRtc_UWord8 video_frame_[65000]; uint8_t video_frame_[65000];
int payload_data_length_; int payload_data_length_;
SimulatedClock fake_clock; SimulatedClock fake_clock;
enum { kPayloadType = 100 }; enum { kPayloadType = 100 };
}; };
TEST_F(RtpRtcpVideoTest, BasicVideo) { TEST_F(RtpRtcpVideoTest, BasicVideo) {
WebRtc_UWord32 timestamp = 3000; uint32_t timestamp = 3000;
EXPECT_EQ(0, video_module_->SendOutgoingData(kVideoFrameDelta, 123, EXPECT_EQ(0, video_module_->SendOutgoingData(kVideoFrameDelta, 123,
timestamp, timestamp,
timestamp / 90, timestamp / 90,

View File

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

View File

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

View File

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