diff --git a/webrtc/modules/audio_coding/codecs/g711/g711_interface.c b/webrtc/modules/audio_coding/codecs/g711/g711_interface.c index 9ef7884c5..087e3e11c 100644 --- a/webrtc/modules/audio_coding/codecs/g711/g711_interface.c +++ b/webrtc/modules/audio_coding/codecs/g711/g711_interface.c @@ -31,7 +31,7 @@ int16_t WebRtcG711_EncodeA(void* state, for (n = 0; n < len; n++) { tempVal = (uint16_t) linear_to_alaw(speechIn[n]); -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN if ((n & 0x1) == 1) { encoded[n >> 1] |= ((uint16_t) tempVal); } else { @@ -69,7 +69,7 @@ int16_t WebRtcG711_EncodeU(void* state, for (n = 0; n < len; n++) { tempVal = (uint16_t) linear_to_ulaw(speechIn[n]); -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN if ((n & 0x1) == 1) { encoded[n >> 1] |= ((uint16_t) tempVal); } else { @@ -103,7 +103,7 @@ int16_t WebRtcG711_DecodeA(void* state, } for (n = 0; n < len; n++) { -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN if ((n & 0x1) == 1) { tempVal = ((uint16_t) encoded[n >> 1] & 0xFF); } else { @@ -140,7 +140,7 @@ int16_t WebRtcG711_DecodeU(void* state, } for (n = 0; n < len; n++) { -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN if ((n & 0x1) == 1) { tempVal = ((uint16_t) encoded[n >> 1] & 0xFF); } else { diff --git a/webrtc/modules/audio_coding/codecs/ilbc/decode.c b/webrtc/modules/audio_coding/codecs/ilbc/decode.c index 5da968543..febd4ceb0 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/decode.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/decode.c @@ -28,7 +28,7 @@ #include "decode_residual.h" #include "unpack_bits.h" #include "hp_output.h" -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN #include "swap_bytes.h" #endif @@ -54,7 +54,7 @@ void WebRtcIlbcfix_DecodeImpl( int16_t PLCresidual[BLOCKL_MAX + LPC_FILTERORDER]; int16_t syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)]; int16_t PLClpc[LPC_FILTERORDER + 1]; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN uint16_t swapped[NO_OF_WORDS_30MS]; #endif iLBC_bits *iLBCbits_inst = (iLBC_bits*)PLCresidual; @@ -68,7 +68,7 @@ void WebRtcIlbcfix_DecodeImpl( /* Unpacketize bits into parameters */ -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN WebRtcIlbcfix_SwapBytes(bytes, iLBCdec_inst->no_of_words, swapped); last_bit = WebRtcIlbcfix_UnpackBits(swapped, iLBCbits_inst, iLBCdec_inst->mode); #else diff --git a/webrtc/modules/audio_coding/codecs/ilbc/encode.c b/webrtc/modules/audio_coding/codecs/ilbc/encode.c index 75d1672b8..2f899a53b 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/encode.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/encode.c @@ -32,7 +32,7 @@ #include "unpack_bits.h" #include "index_conv_dec.h" #endif -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN #include "swap_bytes.h" #endif @@ -489,7 +489,7 @@ void WebRtcIlbcfix_EncodeImpl( WebRtcIlbcfix_PackBits(bytes, iLBCbits_inst, iLBCenc_inst->mode); #endif -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN /* Swap bytes for LITTLE ENDIAN since the packbits() function assumes BIG_ENDIAN machine */ #ifdef SPLIT_10MS diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c index 945475f80..8baa30738 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c @@ -327,7 +327,7 @@ int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, { ISACFIX_SubStruct *ISAC_inst; int16_t stream_len; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif @@ -352,7 +352,7 @@ int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, /* convert from bytes to int16_t */ -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0;k<(stream_len+1)>>1;k++) { encoded[k] = (int16_t)( ( (uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8 ) | (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8)); @@ -442,7 +442,7 @@ int16_t WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct *ISAC_main_inst, /* convert from bytes to int16_t */ -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0;k<(stream_len+1)>>1;k++) { encoded[k] = (int16_t)(((uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8) | (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8)); @@ -485,7 +485,7 @@ int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst, { ISACFIX_SubStruct *ISAC_inst; int16_t stream_len; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif @@ -507,7 +507,7 @@ int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst, return -1; } -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0;k<(stream_len+1)>>1;k++) { encoded[k] = (int16_t)( ( (uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8 ) | (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8)); @@ -588,7 +588,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst, ISACFIX_SubStruct *ISAC_inst; Bitstr_dec streamdata; uint16_t partOfStream[5]; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t err; @@ -621,7 +621,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst, streamdata.stream_index = 0; streamdata.full = 1; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0; k<5; k++) { streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); } @@ -676,7 +676,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst, ISACFIX_SubStruct *ISAC_inst; Bitstr_dec streamdata; uint16_t partOfStream[5]; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t err; @@ -709,7 +709,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst, streamdata.stream_index = 0; streamdata.full = 1; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0; k<5; k++) { streamdata.stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); } @@ -765,7 +765,7 @@ int16_t WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst, /* number of samples (480 or 960), output from decoder */ /* that were actually used in the encoder/decoder (determined on the fly) */ int16_t number_of_samples; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t declen = 0; @@ -793,7 +793,7 @@ int16_t WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst, (ISAC_inst->ISACdec_obj.bitstr_obj).stream = (uint16_t *)encoded; /* convert bitstream from int16_t to bytes */ -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0; k<(len>>1); k++) { (ISAC_inst->ISACdec_obj.bitstr_obj).stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); } @@ -868,7 +868,7 @@ int16_t WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, /* twice the number of samples (480 or 960), output from decoder */ /* that were actually used in the encoder/decoder (determined on the fly) */ int16_t number_of_samples; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t declen = 0; @@ -894,7 +894,7 @@ int16_t WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, (ISAC_inst->ISACdec_obj.bitstr_obj).stream = (uint16_t *)encoded; /* convert bitstream from int16_t to bytes */ -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0; k<(len>>1); k++) { (ISAC_inst->ISACdec_obj.bitstr_obj).stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); } @@ -1267,7 +1267,7 @@ int16_t WebRtcIsacfix_ReadFrameLen(const int16_t* encoded, { Bitstr_dec streamdata; uint16_t partOfStream[5]; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t err; @@ -1280,7 +1280,7 @@ int16_t WebRtcIsacfix_ReadFrameLen(const int16_t* encoded, streamdata.stream_index = 0; streamdata.full = 1; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0; k<5; k++) { streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); } @@ -1316,7 +1316,7 @@ int16_t WebRtcIsacfix_ReadBwIndex(const int16_t* encoded, { Bitstr_dec streamdata; uint16_t partOfStream[5]; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t err; @@ -1329,7 +1329,7 @@ int16_t WebRtcIsacfix_ReadBwIndex(const int16_t* encoded, streamdata.stream_index = 0; streamdata.full = 1; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k=0; k<5; k++) { streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); } diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c index 1e9027200..f3f1650b4 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c @@ -742,7 +742,7 @@ int16_t WebRtcIsac_Encode(ISACStruct* ISAC_main_inst, WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])), streamLenUB + garbageLen, &crc); -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) { ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] = (uint8_t)((crc >> (24 - k * 8)) & 0xFF); @@ -805,7 +805,7 @@ int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst, int32_t currentBN; uint8_t* encodedPtrUW8 = (uint8_t*)encoded; uint32_t crc; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int16_t k; #endif ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; @@ -896,7 +896,7 @@ int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst, WebRtcIsac_GetCrc((int16_t*)(&(encodedPtrUW8[streamLenLB + 1])), streamLenUB, &crc); -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) { encodedPtrUW8[totalStreamLen - LEN_CHECK_SUM_WORD8 + k] = (uint8_t)((crc >> (24 - k * 8)) & 0xFF); @@ -1008,7 +1008,7 @@ int16_t WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst, uint32_t arr_ts) { ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; Bitstr streamdata; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t err; @@ -1029,7 +1029,7 @@ int16_t WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst, WebRtcIsac_ResetBitstream(&(streamdata)); -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k = 0; k < 10; k++) { streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >> ((k & 1) << 3)) & 0xFF); @@ -1741,14 +1741,14 @@ int16_t WebRtcIsac_UpdateUplinkBw(ISACStruct* ISAC_main_inst, int16_t WebRtcIsac_ReadBwIndex(const int16_t* encoded, int16_t* bweIndex) { Bitstr streamdata; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t err; WebRtcIsac_ResetBitstream(&(streamdata)); -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k = 0; k < 10; k++) { streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >> ((k & 1) << 3)) & 0xFF); @@ -1790,7 +1790,7 @@ int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst, const int16_t* encoded, int16_t* frameLength) { Bitstr streamdata; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif int16_t err; @@ -1798,7 +1798,7 @@ int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst, WebRtcIsac_ResetBitstream(&(streamdata)); -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k = 0; k < 10; k++) { streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >> ((k & 1) << 3)) & 0xFF); @@ -2108,7 +2108,7 @@ int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst, int16_t totalLenUB; uint8_t* ptrEncodedUW8 = (uint8_t*)encoded; ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN int k; #endif @@ -2164,7 +2164,7 @@ int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst, WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])), streamLenUB, &crc); -#ifndef WEBRTC_BIG_ENDIAN +#ifndef WEBRTC_ARCH_BIG_ENDIAN for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) { ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] = (uint8_t)((crc >> (24 - k * 8)) & 0xFF); diff --git a/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.c b/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.c index 04814b767..34aadc3f2 100644 --- a/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.c +++ b/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.c @@ -15,7 +15,7 @@ #include "typedefs.h" -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN #include "signal_processing_library.h" #endif @@ -29,7 +29,7 @@ int16_t WebRtcPcm16b_EncodeW16(int16_t *speechIn16b, int16_t len, int16_t *speechOut16b) { -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN WEBRTC_SPL_MEMCPY_W16(speechOut16b, speechIn16b, len); #else int i; @@ -68,7 +68,7 @@ int16_t WebRtcPcm16b_DecodeW16(void *inst, int16_t *speechOut16b, int16_t* speechType) { -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN WEBRTC_SPL_MEMCPY_W8(speechOut16b, speechIn16b, ((len*sizeof(int16_t)+1)>>1)); #else int i; diff --git a/webrtc/modules/audio_coding/neteq/dtmf_buffer.c b/webrtc/modules/audio_coding/neteq/dtmf_buffer.c index 9e3212646..1788635c7 100644 --- a/webrtc/modules/audio_coding/neteq/dtmf_buffer.c +++ b/webrtc/modules/audio_coding/neteq/dtmf_buffer.c @@ -93,7 +93,7 @@ int16_t WebRtcNetEQ_DtmfInsertEvent(dtmf_inst_t *DTMFdec_inst, if (len == 4) { EventStart = encoded; -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN value=((*EventStart)>>8); endEvent=((*EventStart)&0x80)>>7; Volume=((*EventStart)&0x3F); diff --git a/webrtc/modules/audio_coding/neteq/rtp.c b/webrtc/modules/audio_coding/neteq/rtp.c index f23f3512b..6ab5944b5 100644 --- a/webrtc/modules/audio_coding/neteq/rtp.c +++ b/webrtc/modules/audio_coding/neteq/rtp.c @@ -31,7 +31,7 @@ int WebRtcNetEQ_RTPPayloadInfo(int16_t* pw16_Datagram, int i_DatagramLen, return RTP_TOO_SHORT_PACKET; } -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN 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 */ @@ -62,7 +62,7 @@ int WebRtcNetEQ_RTPPayloadInfo(int16_t* pw16_Datagram, int i_DatagramLen, i_padlength = ((pw16_Datagram[(i_DatagramLen >> 1) - 1]) & 0xFF); } } -#else /* WEBRTC_LITTLE_ENDIAN */ +#else /* WEBRTC_ARCH_LITTLE_ENDIAN */ 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 */ @@ -126,7 +126,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads, int i_discardedBlockLength = 0; int singlePayload = 0; -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN if ((pw16_data[0] & 0x8000) == 0) { /* Only one payload in this packet*/ @@ -155,7 +155,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads, ((((uint16_t)pw16_data[1]) & 0xFC00) >> 10); i_blockLength = (((uint16_t)pw16_data[1]) & 0x3FF); } -#else /* WEBRTC_LITTLE_ENDIAN */ +#else /* WEBRTC_ARCH_LITTLE_ENDIAN */ if ((pw16_data[0] & 0x80) == 0) { /* Only one payload in this packet */ diff --git a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc index b3d87c67e..caa1efed8 100644 --- a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc @@ -1177,7 +1177,7 @@ int32_t AudioDeviceLinuxALSA::InitPlayout() _playoutFramesIn10MS = _playoutFreq/100; if ((errVal = LATE(snd_pcm_set_params)( _handlePlayout, -#if defined(WEBRTC_BIG_ENDIAN) +#if defined(WEBRTC_ARCH_BIG_ENDIAN) SND_PCM_FORMAT_S16_BE, #else SND_PCM_FORMAT_S16_LE, //format @@ -1333,7 +1333,7 @@ int32_t AudioDeviceLinuxALSA::InitRecording() _recordingFramesIn10MS = _recordingFreq/100; if ((errVal = LATE(snd_pcm_set_params)(_handleRecord, -#if defined(WEBRTC_BIG_ENDIAN) +#if defined(WEBRTC_ARCH_BIG_ENDIAN) SND_PCM_FORMAT_S16_BE, //format #else SND_PCM_FORMAT_S16_LE, //format @@ -1352,7 +1352,7 @@ int32_t AudioDeviceLinuxALSA::InitRecording() _recChannels = 1; if ((errVal = LATE(snd_pcm_set_params)(_handleRecord, -#if defined(WEBRTC_BIG_ENDIAN) +#if defined(WEBRTC_ARCH_BIG_ENDIAN) SND_PCM_FORMAT_S16_BE, //format #else SND_PCM_FORMAT_S16_LE, //format diff --git a/webrtc/modules/audio_device/mac/audio_device_mac.cc b/webrtc/modules/audio_device/mac/audio_device_mac.cc index 9da188013..b07c94dd1 100644 --- a/webrtc/modules/audio_device/mac/audio_device_mac.cc +++ b/webrtc/modules/audio_device/mac/audio_device_mac.cc @@ -97,7 +97,7 @@ void AudioDeviceMac::logCAMsg(const TraceLevel level, assert(msg != NULL); assert(err != NULL); -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN WEBRTC_TRACE(level, module, id, "%s: %.4s", msg, err); #else // We need to flip the characters in this case. @@ -1457,7 +1457,7 @@ int32_t AudioDeviceMac::InitPlayout() _outDesiredFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN _outDesiredFormat.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; #endif _outDesiredFormat.mFormatID = kAudioFormatLinearPCM; @@ -1681,7 +1681,7 @@ int32_t AudioDeviceMac::InitRecording() _inDesiredFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN _inDesiredFormat.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; #endif _inDesiredFormat.mFormatID = kAudioFormatLinearPCM; diff --git a/webrtc/modules/audio_device/mac/audio_mixer_manager_mac.cc b/webrtc/modules/audio_device/mac/audio_mixer_manager_mac.cc index 08e419750..952dc11d8 100644 --- a/webrtc/modules/audio_device/mac/audio_mixer_manager_mac.cc +++ b/webrtc/modules/audio_device/mac/audio_mixer_manager_mac.cc @@ -1154,7 +1154,7 @@ void AudioMixerManagerMac::logCAMsg(const TraceLevel level, assert(msg != NULL); assert(err != NULL); -#ifdef WEBRTC_BIG_ENDIAN +#ifdef WEBRTC_ARCH_BIG_ENDIAN WEBRTC_TRACE(level, module, id, "%s: %.4s", msg, err); #else // We need to flip the characters in this case. diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index edf20bc2f..b33049e48 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -638,7 +638,7 @@ int AudioProcessingImpl::WriteMessageToDebugFile() { if (size <= 0) { return kUnspecifiedError; } -#if defined(WEBRTC_BIG_ENDIAN) +#if defined(WEBRTC_ARCH_BIG_ENDIAN) // TODO(ajm): Use little-endian "on the wire". For the moment, we can be // pretty safe in assuming little-endian. #endif diff --git a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc index bc0be8b34..f50b20a44 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc @@ -125,16 +125,12 @@ bool StringCompare(const char* str1, const char* str2, } #endif -#if !defined(WEBRTC_LITTLE_ENDIAN) && !defined(WEBRTC_BIG_ENDIAN) -#error Either WEBRTC_LITTLE_ENDIAN or WEBRTC_BIG_ENDIAN must be defined -#endif - /* for RTP/RTCP All integer fields are carried in network byte order, that is, most significant byte (octet) first. AKA big-endian. */ void AssignUWord32ToBuffer(uint8_t* dataBuffer, uint32_t value) { -#if defined(WEBRTC_LITTLE_ENDIAN) +#if defined(WEBRTC_ARCH_LITTLE_ENDIAN) dataBuffer[0] = static_cast(value >> 24); dataBuffer[1] = static_cast(value >> 16); dataBuffer[2] = static_cast(value >> 8); @@ -146,7 +142,7 @@ void AssignUWord32ToBuffer(uint8_t* dataBuffer, uint32_t value) { } void AssignUWord24ToBuffer(uint8_t* dataBuffer, uint32_t value) { -#if defined(WEBRTC_LITTLE_ENDIAN) +#if defined(WEBRTC_ARCH_LITTLE_ENDIAN) dataBuffer[0] = static_cast(value >> 16); dataBuffer[1] = static_cast(value >> 8); dataBuffer[2] = static_cast(value); @@ -158,7 +154,7 @@ void AssignUWord24ToBuffer(uint8_t* dataBuffer, uint32_t value) { } void AssignUWord16ToBuffer(uint8_t* dataBuffer, uint16_t value) { -#if defined(WEBRTC_LITTLE_ENDIAN) +#if defined(WEBRTC_ARCH_LITTLE_ENDIAN) dataBuffer[0] = static_cast(value >> 8); dataBuffer[1] = static_cast(value); #else @@ -168,7 +164,7 @@ void AssignUWord16ToBuffer(uint8_t* dataBuffer, uint16_t value) { } uint16_t BufferToUWord16(const uint8_t* dataBuffer) { -#if defined(WEBRTC_LITTLE_ENDIAN) +#if defined(WEBRTC_ARCH_LITTLE_ENDIAN) return (dataBuffer[0] << 8) + dataBuffer[1]; #else return *reinterpret_cast(dataBuffer); @@ -180,7 +176,7 @@ uint32_t BufferToUWord24(const uint8_t* dataBuffer) { } uint32_t BufferToUWord32(const uint8_t* dataBuffer) { -#if defined(WEBRTC_LITTLE_ENDIAN) +#if defined(WEBRTC_ARCH_LITTLE_ENDIAN) return (dataBuffer[0] << 24) + (dataBuffer[1] << 16) + (dataBuffer[2] << 8) + dataBuffer[3]; #else diff --git a/webrtc/modules/utility/source/rtp_dump_impl.cc b/webrtc/modules/utility/source/rtp_dump_impl.cc index 1f8715dfa..39316f478 100644 --- a/webrtc/modules/utility/source/rtp_dump_impl.cc +++ b/webrtc/modules/utility/source/rtp_dump_impl.cc @@ -245,37 +245,25 @@ inline uint32_t RtpDumpImpl::GetTimeInMS() const gettimeofday(&tv, &tz); val = tv.tv_sec * 1000 + tv.tv_usec / 1000; return val; -#else - #error Either _WIN32 or LINUX or WEBRTC_MAC has to be defined! - assert(false); - return 0; #endif } inline uint32_t RtpDumpImpl::RtpDumpHtonl(uint32_t x) const { -#if defined(WEBRTC_BIG_ENDIAN) +#if defined(WEBRTC_ARCH_BIG_ENDIAN) return x; -#elif defined(WEBRTC_LITTLE_ENDIAN) +#elif defined(WEBRTC_ARCH_LITTLE_ENDIAN) return (x >> 24) + ((((x >> 16) & 0xFF) << 8) + ((((x >> 8) & 0xFF) << 16) + ((x & 0xFF) << 24))); -#else -#error Either WEBRTC_BIG_ENDIAN or WEBRTC_LITTLE_ENDIAN has to be defined! - assert(false); - return 0; #endif } inline uint16_t RtpDumpImpl::RtpDumpHtons(uint16_t x) const { -#if defined(WEBRTC_BIG_ENDIAN) +#if defined(WEBRTC_ARCH_BIG_ENDIAN) return x; -#elif defined(WEBRTC_LITTLE_ENDIAN) +#elif defined(WEBRTC_ARCH_LITTLE_ENDIAN) return (x >> 8) + ((x & 0xFF) << 8); -#else - #error Either WEBRTC_BIG_ENDIAN or WEBRTC_LITTLE_ENDIAN has to be defined! - assert(false); - return 0; #endif } } // namespace webrtc diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h index 37c8fc9ce..e15bb1b3d 100644 --- a/webrtc/typedefs.h +++ b/webrtc/typedefs.h @@ -25,38 +25,37 @@ // http://msdn.microsoft.com/en-us/library/b0084kay.aspx // http://www.agner.org/optimize/calling_conventions.pdf // or with gcc, run: "echo | gcc -E -dM -" -// TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN. #if defined(_M_X64) || defined(__x86_64__) #define WEBRTC_ARCH_X86_FAMILY #define WEBRTC_ARCH_X86_64 #define WEBRTC_ARCH_64_BITS #define WEBRTC_ARCH_LITTLE_ENDIAN -#define WEBRTC_LITTLE_ENDIAN #elif defined(_M_IX86) || defined(__i386__) #define WEBRTC_ARCH_X86_FAMILY #define WEBRTC_ARCH_X86 #define WEBRTC_ARCH_32_BITS #define WEBRTC_ARCH_LITTLE_ENDIAN -#define WEBRTC_LITTLE_ENDIAN #elif defined(__ARMEL__) -// TODO(andrew): We'd prefer to control platform defines here, but this is +// TODO(ajm): We'd prefer to control platform defines here, but this is // currently provided by the Android makefiles. Commented to avoid duplicate // definition warnings. //#define WEBRTC_ARCH_ARM -// TODO(andrew): Chromium uses the following two defines. Should we switch? +// TODO(ajm): Chromium uses the following two defines. Should we switch? //#define WEBRTC_ARCH_ARM_FAMILY //#define WEBRTC_ARCH_ARMEL #define WEBRTC_ARCH_32_BITS #define WEBRTC_ARCH_LITTLE_ENDIAN -#define WEBRTC_LITTLE_ENDIAN #elif defined(__MIPSEL__) #define WEBRTC_ARCH_32_BITS #define WEBRTC_ARCH_LITTLE_ENDIAN -#define WEBRTC_LITTLE_ENDIAN #else #error Please add support for your architecture in typedefs.h #endif +#if !(defined(WEBRTC_ARCH_LITTLE_ENDIAN) ^ defined(WEBRTC_ARCH_BIG_ENDIAN)) +#error Define either WEBRTC_ARCH_LITTLE_ENDIAN or WEBRTC_ARCH_BIG_ENDIAN +#endif + #if defined(__SSE2__) || defined(_MSC_VER) #define WEBRTC_USE_SSE2 #endif