WebRtc_Word32 => int32_t etc. in audio_coding/
BUG=314 Review URL: https://webrtc-codereview.appspot.com/1271006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3789 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "neteq_error_codes.h"
|
||||
|
||||
int WebRtcNetEQ_RTPPayloadInfo(WebRtc_Word16* pw16_Datagram, int i_DatagramLen,
|
||||
int WebRtcNetEQ_RTPPayloadInfo(int16_t* pw16_Datagram, int i_DatagramLen,
|
||||
RTPPacket_t* RTPheader)
|
||||
{
|
||||
int i_P, i_X, i_CC, i_startPosition;
|
||||
@@ -32,20 +32,20 @@ int WebRtcNetEQ_RTPPayloadInfo(WebRtc_Word16* pw16_Datagram, int i_DatagramLen,
|
||||
}
|
||||
|
||||
#ifdef WEBRTC_BIG_ENDIAN
|
||||
i_IPver = (((WebRtc_UWord16) (pw16_Datagram[0] & 0xC000)) >> 14); /* Extract the version */
|
||||
i_P = (((WebRtc_UWord16) (pw16_Datagram[0] & 0x2000)) >> 13); /* Extract the P bit */
|
||||
i_X = (((WebRtc_UWord16) (pw16_Datagram[0] & 0x1000)) >> 12); /* Extract the X bit */
|
||||
i_CC = ((WebRtc_UWord16) (pw16_Datagram[0] >> 8) & 0xF); /* Get the CC number */
|
||||
i_IPver = (((uint16_t) (pw16_Datagram[0] & 0xC000)) >> 14); /* Extract the version */
|
||||
i_P = (((uint16_t) (pw16_Datagram[0] & 0x2000)) >> 13); /* Extract the P bit */
|
||||
i_X = (((uint16_t) (pw16_Datagram[0] & 0x1000)) >> 12); /* Extract the X bit */
|
||||
i_CC = ((uint16_t) (pw16_Datagram[0] >> 8) & 0xF); /* Get the CC number */
|
||||
RTPheader->payloadType = pw16_Datagram[0] & 0x7F; /* Get the coder type */
|
||||
RTPheader->seqNumber = pw16_Datagram[1]; /* Get the sequence number */
|
||||
RTPheader->timeStamp = ((((WebRtc_UWord32) ((WebRtc_UWord16) pw16_Datagram[2])) << 16)
|
||||
| (WebRtc_UWord16) (pw16_Datagram[3])); /* Get timestamp */
|
||||
RTPheader->ssrc = (((WebRtc_UWord32) pw16_Datagram[4]) << 16)
|
||||
+ (((WebRtc_UWord32) pw16_Datagram[5])); /* Get the SSRC */
|
||||
RTPheader->timeStamp = ((((uint32_t) ((uint16_t) pw16_Datagram[2])) << 16)
|
||||
| (uint16_t) (pw16_Datagram[3])); /* Get timestamp */
|
||||
RTPheader->ssrc = (((uint32_t) pw16_Datagram[4]) << 16)
|
||||
+ (((uint32_t) pw16_Datagram[5])); /* Get the SSRC */
|
||||
|
||||
if (i_X == 1)
|
||||
{
|
||||
/* Extension header exists. Find out how many WebRtc_Word32 it consists of. */
|
||||
/* Extension header exists. Find out how many int32_t it consists of. */
|
||||
i_extlength = pw16_Datagram[7 + 2 * i_CC];
|
||||
}
|
||||
if (i_P == 1)
|
||||
@@ -54,7 +54,7 @@ int WebRtcNetEQ_RTPPayloadInfo(WebRtc_Word16* pw16_Datagram, int i_DatagramLen,
|
||||
if (i_DatagramLen & 0x1)
|
||||
{
|
||||
/* odd number of bytes => last byte in higher byte */
|
||||
i_padlength = (((WebRtc_UWord16) pw16_Datagram[i_DatagramLen >> 1]) >> 8);
|
||||
i_padlength = (((uint16_t) pw16_Datagram[i_DatagramLen >> 1]) >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -63,27 +63,27 @@ int WebRtcNetEQ_RTPPayloadInfo(WebRtc_Word16* pw16_Datagram, int i_DatagramLen,
|
||||
}
|
||||
}
|
||||
#else /* WEBRTC_LITTLE_ENDIAN */
|
||||
i_IPver = (((WebRtc_UWord16) (pw16_Datagram[0] & 0xC0)) >> 6); /* Extract the IP version */
|
||||
i_P = (((WebRtc_UWord16) (pw16_Datagram[0] & 0x20)) >> 5); /* Extract the P bit */
|
||||
i_X = (((WebRtc_UWord16) (pw16_Datagram[0] & 0x10)) >> 4); /* Extract the X bit */
|
||||
i_CC = (WebRtc_UWord16) (pw16_Datagram[0] & 0xF); /* Get the CC number */
|
||||
i_IPver = (((uint16_t) (pw16_Datagram[0] & 0xC0)) >> 6); /* Extract the IP version */
|
||||
i_P = (((uint16_t) (pw16_Datagram[0] & 0x20)) >> 5); /* Extract the P bit */
|
||||
i_X = (((uint16_t) (pw16_Datagram[0] & 0x10)) >> 4); /* Extract the X bit */
|
||||
i_CC = (uint16_t) (pw16_Datagram[0] & 0xF); /* Get the CC number */
|
||||
RTPheader->payloadType = (pw16_Datagram[0] >> 8) & 0x7F; /* Get the coder type */
|
||||
RTPheader->seqNumber = (((((WebRtc_UWord16) pw16_Datagram[1]) >> 8) & 0xFF)
|
||||
| (((WebRtc_UWord16) (pw16_Datagram[1] & 0xFF)) << 8)); /* Get the packet number */
|
||||
RTPheader->timeStamp = ((((WebRtc_UWord16) pw16_Datagram[2]) & 0xFF) << 24)
|
||||
| ((((WebRtc_UWord16) pw16_Datagram[2]) & 0xFF00) << 8)
|
||||
| ((((WebRtc_UWord16) pw16_Datagram[3]) >> 8) & 0xFF)
|
||||
| ((((WebRtc_UWord16) pw16_Datagram[3]) & 0xFF) << 8); /* Get timestamp */
|
||||
RTPheader->ssrc = ((((WebRtc_UWord16) pw16_Datagram[4]) & 0xFF) << 24)
|
||||
| ((((WebRtc_UWord16) pw16_Datagram[4]) & 0xFF00) << 8)
|
||||
| ((((WebRtc_UWord16) pw16_Datagram[5]) >> 8) & 0xFF)
|
||||
| ((((WebRtc_UWord16) pw16_Datagram[5]) & 0xFF) << 8); /* Get the SSRC */
|
||||
RTPheader->seqNumber = (((((uint16_t) pw16_Datagram[1]) >> 8) & 0xFF)
|
||||
| (((uint16_t) (pw16_Datagram[1] & 0xFF)) << 8)); /* Get the packet number */
|
||||
RTPheader->timeStamp = ((((uint16_t) pw16_Datagram[2]) & 0xFF) << 24)
|
||||
| ((((uint16_t) pw16_Datagram[2]) & 0xFF00) << 8)
|
||||
| ((((uint16_t) pw16_Datagram[3]) >> 8) & 0xFF)
|
||||
| ((((uint16_t) pw16_Datagram[3]) & 0xFF) << 8); /* Get timestamp */
|
||||
RTPheader->ssrc = ((((uint16_t) pw16_Datagram[4]) & 0xFF) << 24)
|
||||
| ((((uint16_t) pw16_Datagram[4]) & 0xFF00) << 8)
|
||||
| ((((uint16_t) pw16_Datagram[5]) >> 8) & 0xFF)
|
||||
| ((((uint16_t) pw16_Datagram[5]) & 0xFF) << 8); /* Get the SSRC */
|
||||
|
||||
if (i_X == 1)
|
||||
{
|
||||
/* Extension header exists. Find out how many WebRtc_Word32 it consists of. */
|
||||
i_extlength = (((((WebRtc_UWord16) pw16_Datagram[7 + 2 * i_CC]) >> 8) & 0xFF)
|
||||
| (((WebRtc_UWord16) (pw16_Datagram[7 + 2 * i_CC] & 0xFF)) << 8));
|
||||
/* Extension header exists. Find out how many int32_t it consists of. */
|
||||
i_extlength = (((((uint16_t) pw16_Datagram[7 + 2 * i_CC]) >> 8) & 0xFF)
|
||||
| (((uint16_t) (pw16_Datagram[7 + 2 * i_CC] & 0xFF)) << 8));
|
||||
}
|
||||
if (i_P == 1)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ int WebRtcNetEQ_RTPPayloadInfo(WebRtc_Word16* pw16_Datagram, int i_DatagramLen,
|
||||
else
|
||||
{
|
||||
/* even number of bytes => last byte in lower byte */
|
||||
i_padlength = (((WebRtc_UWord16) pw16_Datagram[(i_DatagramLen >> 1) - 1]) >> 8);
|
||||
i_padlength = (((uint16_t) pw16_Datagram[(i_DatagramLen >> 1) - 1]) >> 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -120,8 +120,8 @@ int WebRtcNetEQ_RTPPayloadInfo(WebRtc_Word16* pw16_Datagram, int i_DatagramLen,
|
||||
int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
|
||||
int *i_No_Of_Payloads)
|
||||
{
|
||||
const WebRtc_Word16 *pw16_data = RTPheader[0]->payload; /* Pointer to the data */
|
||||
WebRtc_UWord16 uw16_offsetTimeStamp = 65535, uw16_secondPayload = 65535;
|
||||
const int16_t *pw16_data = RTPheader[0]->payload; /* Pointer to the data */
|
||||
uint16_t uw16_offsetTimeStamp = 65535, uw16_secondPayload = 65535;
|
||||
int i_blockLength, i_k;
|
||||
int i_discardedBlockLength = 0;
|
||||
int singlePayload = 0;
|
||||
@@ -133,7 +133,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
|
||||
singlePayload = 1;
|
||||
/* set the blocklength to -4 to deduce the non-existent 4-byte RED header */
|
||||
i_blockLength = -4;
|
||||
RTPheader[0]->payloadType = ((((WebRtc_UWord16)pw16_data[0]) & 0x7F00) >> 8);
|
||||
RTPheader[0]->payloadType = ((((uint16_t)pw16_data[0]) & 0x7F00) >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -141,7 +141,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
|
||||
while (((pw16_data[2] & 0x8000) != 0) &&
|
||||
(pw16_data<((RTPheader[0]->payload)+((RTPheader[0]->payloadLen+1)>>1))))
|
||||
{
|
||||
i_discardedBlockLength += (4+(((WebRtc_UWord16)pw16_data[1]) & 0x3FF));
|
||||
i_discardedBlockLength += (4+(((uint16_t)pw16_data[1]) & 0x3FF));
|
||||
pw16_data+=2;
|
||||
}
|
||||
if (pw16_data>=(RTPheader[0]->payload+((RTPheader[0]->payloadLen+1)>>1)))
|
||||
@@ -149,11 +149,11 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
|
||||
return RED_SPLIT_ERROR2; /* Error, we are outside the packet */
|
||||
}
|
||||
singlePayload = 0; /* the packet contains more than one payload */
|
||||
uw16_secondPayload = ((((WebRtc_UWord16)pw16_data[0]) & 0x7F00) >> 8);
|
||||
RTPheader[0]->payloadType = ((((WebRtc_UWord16)pw16_data[2]) & 0x7F00) >> 8);
|
||||
uw16_offsetTimeStamp = ((((WebRtc_UWord16)pw16_data[0]) & 0xFF) << 6) +
|
||||
((((WebRtc_UWord16)pw16_data[1]) & 0xFC00) >> 10);
|
||||
i_blockLength = (((WebRtc_UWord16)pw16_data[1]) & 0x3FF);
|
||||
uw16_secondPayload = ((((uint16_t)pw16_data[0]) & 0x7F00) >> 8);
|
||||
RTPheader[0]->payloadType = ((((uint16_t)pw16_data[2]) & 0x7F00) >> 8);
|
||||
uw16_offsetTimeStamp = ((((uint16_t)pw16_data[0]) & 0xFF) << 6) +
|
||||
((((uint16_t)pw16_data[1]) & 0xFC00) >> 10);
|
||||
i_blockLength = (((uint16_t)pw16_data[1]) & 0x3FF);
|
||||
}
|
||||
#else /* WEBRTC_LITTLE_ENDIAN */
|
||||
if ((pw16_data[0] & 0x80) == 0)
|
||||
@@ -162,7 +162,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
|
||||
singlePayload = 1;
|
||||
/* set the blocklength to -4 to deduce the non-existent 4-byte RED header */
|
||||
i_blockLength = -4;
|
||||
RTPheader[0]->payloadType = (((WebRtc_UWord16) pw16_data[0]) & 0x7F);
|
||||
RTPheader[0]->payloadType = (((uint16_t) pw16_data[0]) & 0x7F);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -170,8 +170,8 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
|
||||
while (((pw16_data[2] & 0x80) != 0) && (pw16_data < ((RTPheader[0]->payload)
|
||||
+ ((RTPheader[0]->payloadLen + 1) >> 1))))
|
||||
{
|
||||
i_discardedBlockLength += (4 + ((((WebRtc_UWord16) pw16_data[1]) & 0x3) << 8)
|
||||
+ ((((WebRtc_UWord16) pw16_data[1]) & 0xFF00) >> 8));
|
||||
i_discardedBlockLength += (4 + ((((uint16_t) pw16_data[1]) & 0x3) << 8)
|
||||
+ ((((uint16_t) pw16_data[1]) & 0xFF00) >> 8));
|
||||
pw16_data += 2;
|
||||
}
|
||||
if (pw16_data >= (RTPheader[0]->payload + ((RTPheader[0]->payloadLen + 1) >> 1)))
|
||||
@@ -179,12 +179,12 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
|
||||
return RED_SPLIT_ERROR2; /* Error, we are outside the packet */;
|
||||
}
|
||||
singlePayload = 0; /* the packet contains more than one payload */
|
||||
uw16_secondPayload = (((WebRtc_UWord16) pw16_data[0]) & 0x7F);
|
||||
RTPheader[0]->payloadType = (((WebRtc_UWord16) pw16_data[2]) & 0x7F);
|
||||
uw16_offsetTimeStamp = ((((WebRtc_UWord16) pw16_data[0]) & 0xFF00) >> 2)
|
||||
+ ((((WebRtc_UWord16) pw16_data[1]) & 0xFC) >> 2);
|
||||
i_blockLength = ((((WebRtc_UWord16) pw16_data[1]) & 0x3) << 8)
|
||||
+ ((((WebRtc_UWord16) pw16_data[1]) & 0xFF00) >> 8);
|
||||
uw16_secondPayload = (((uint16_t) pw16_data[0]) & 0x7F);
|
||||
RTPheader[0]->payloadType = (((uint16_t) pw16_data[2]) & 0x7F);
|
||||
uw16_offsetTimeStamp = ((((uint16_t) pw16_data[0]) & 0xFF00) >> 2)
|
||||
+ ((((uint16_t) pw16_data[1]) & 0xFC) >> 2);
|
||||
i_blockLength = ((((uint16_t) pw16_data[1]) & 0x3) << 8)
|
||||
+ ((((uint16_t) pw16_data[1]) & 0xFF00) >> 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user