Some WebRtcIsac_* and WebRtcIsacfix_* functions: type encoded stream as uint8[]
The affected functions are WebRtcIsacfix_ReadFrameLen WebRtcIsacfix_GetNewBitStream WebRtcIsacfix_ReadBwIndex and WebRtcIsac_ReadFrameLen WebRtcIsac_GetNewBitStream WebRtcIsac_ReadBwIndex WebRtcIsac_GetRedPayload BUG=909 R=aluebs@webrtc.org, henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/22979004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7429 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -357,7 +357,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int16_t WebRtcIsacfix_ReadFrameLen(const int16_t* encoded,
|
int16_t WebRtcIsacfix_ReadFrameLen(const uint8_t* encoded,
|
||||||
int encoded_len_bytes,
|
int encoded_len_bytes,
|
||||||
int16_t* frameLength);
|
int16_t* frameLength);
|
||||||
|
|
||||||
@@ -557,7 +557,7 @@ extern "C" {
|
|||||||
int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
|
int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
|
||||||
int16_t bweIndex,
|
int16_t bweIndex,
|
||||||
float scale,
|
float scale,
|
||||||
int16_t *encoded);
|
uint8_t* encoded);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -608,7 +608,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int16_t WebRtcIsacfix_ReadBwIndex(const int16_t* encoded,
|
int16_t WebRtcIsacfix_ReadBwIndex(const uint8_t* encoded,
|
||||||
int encoded_len_bytes,
|
int encoded_len_bytes,
|
||||||
int16_t* rateIndex);
|
int16_t* rateIndex);
|
||||||
|
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ int16_t WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct *ISAC_main_inst,
|
|||||||
int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
|
int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
|
||||||
int16_t bweIndex,
|
int16_t bweIndex,
|
||||||
float scale,
|
float scale,
|
||||||
int16_t *encoded)
|
uint8_t* encoded)
|
||||||
{
|
{
|
||||||
ISACFIX_SubStruct *ISAC_inst;
|
ISACFIX_SubStruct *ISAC_inst;
|
||||||
int16_t stream_len;
|
int16_t stream_len;
|
||||||
@@ -564,8 +564,9 @@ int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
|
|||||||
|
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
for (k=0;k<(stream_len+1)>>1;k++) {
|
for (k=0;k<(stream_len+1)>>1;k++) {
|
||||||
encoded[k] = (int16_t)( ( (uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8 )
|
((int16_t*)encoded)[k] = (int16_t)(
|
||||||
| (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8));
|
((uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8) |
|
||||||
|
(((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -1315,7 +1316,7 @@ int16_t WebRtcIsacfix_UpdateUplinkBw(ISACFIX_MainStruct* ISAC_main_inst,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int16_t WebRtcIsacfix_ReadFrameLen(const int16_t* encoded,
|
int16_t WebRtcIsacfix_ReadFrameLen(const uint8_t* encoded,
|
||||||
int encoded_len_bytes,
|
int encoded_len_bytes,
|
||||||
int16_t* frameLength)
|
int16_t* frameLength)
|
||||||
{
|
{
|
||||||
@@ -1334,7 +1335,8 @@ int16_t WebRtcIsacfix_ReadFrameLen(const int16_t* encoded,
|
|||||||
|
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
for (k = 0; k < kRequiredEncodedLenBytes / 2; k++) {
|
for (k = 0; k < kRequiredEncodedLenBytes / 2; k++) {
|
||||||
streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8));
|
uint16_t ek = ((uint16_t*)encoded)[k];
|
||||||
|
streamdata.stream[k] = (uint16_t)((ek >> 8) | ((ek & 0xff) << 8));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
memcpy(streamdata.stream, encoded, kRequiredEncodedLenBytes);
|
memcpy(streamdata.stream, encoded, kRequiredEncodedLenBytes);
|
||||||
@@ -1363,7 +1365,7 @@ int16_t WebRtcIsacfix_ReadFrameLen(const int16_t* encoded,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int16_t WebRtcIsacfix_ReadBwIndex(const int16_t* encoded,
|
int16_t WebRtcIsacfix_ReadBwIndex(const uint8_t* encoded,
|
||||||
int encoded_len_bytes,
|
int encoded_len_bytes,
|
||||||
int16_t* rateIndex)
|
int16_t* rateIndex)
|
||||||
{
|
{
|
||||||
@@ -1382,7 +1384,8 @@ int16_t WebRtcIsacfix_ReadBwIndex(const int16_t* encoded,
|
|||||||
|
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
for (k = 0; k < kRequiredEncodedLenBytes / 2; k++) {
|
for (k = 0; k < kRequiredEncodedLenBytes / 2; k++) {
|
||||||
streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8));
|
uint16_t ek = ((uint16_t*)encoded)[k];
|
||||||
|
streamdata.stream[k] = (uint16_t)((ek >> 8) | ((ek & 0xff) << 8));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
memcpy(streamdata.stream, encoded, kRequiredEncodedLenBytes);
|
memcpy(streamdata.stream, encoded, kRequiredEncodedLenBytes);
|
||||||
|
|||||||
@@ -572,12 +572,14 @@ int main(int argc, char* argv[])
|
|||||||
if (stream_len>0) {
|
if (stream_len>0) {
|
||||||
if (testCE == 1) {
|
if (testCE == 1) {
|
||||||
err = WebRtcIsacfix_ReadBwIndex(
|
err = WebRtcIsacfix_ReadBwIndex(
|
||||||
(int16_t*)streamdata, stream_len, &bwe);
|
reinterpret_cast<const uint8_t*>(streamdata),
|
||||||
|
stream_len,
|
||||||
|
&bwe);
|
||||||
stream_len = WebRtcIsacfix_GetNewBitStream(
|
stream_len = WebRtcIsacfix_GetNewBitStream(
|
||||||
ISAC_main_inst,
|
ISAC_main_inst,
|
||||||
bwe,
|
bwe,
|
||||||
scale,
|
scale,
|
||||||
(int16_t*)streamdata);
|
reinterpret_cast<uint8_t*>(streamdata));
|
||||||
} else if (testCE == 2) {
|
} else if (testCE == 2) {
|
||||||
/* transcode function not supported */
|
/* transcode function not supported */
|
||||||
} else if (testCE == 3) {
|
} else if (testCE == 3) {
|
||||||
@@ -742,7 +744,7 @@ int main(int argc, char* argv[])
|
|||||||
short FL;
|
short FL;
|
||||||
/* Call getFramelen, only used here for function test */
|
/* Call getFramelen, only used here for function test */
|
||||||
err = WebRtcIsacfix_ReadFrameLen(
|
err = WebRtcIsacfix_ReadFrameLen(
|
||||||
(int16_t*)streamdata, stream_len, &FL);
|
reinterpret_cast<const uint8_t*>(streamdata), stream_len, &FL);
|
||||||
declen = WebRtcIsacfix_Decode( ISAC_main_inst, streamdata, stream_len,
|
declen = WebRtcIsacfix_Decode( ISAC_main_inst, streamdata, stream_len,
|
||||||
decoded, speechType );
|
decoded, speechType );
|
||||||
/* Error check */
|
/* Error check */
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ extern "C" {
|
|||||||
|
|
||||||
int16_t WebRtcIsac_ReadFrameLen(
|
int16_t WebRtcIsac_ReadFrameLen(
|
||||||
ISACStruct* ISAC_main_inst,
|
ISACStruct* ISAC_main_inst,
|
||||||
const int16_t* encoded,
|
const uint8_t* encoded,
|
||||||
int16_t* frameLength);
|
int16_t* frameLength);
|
||||||
|
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ extern "C" {
|
|||||||
int16_t bweIndex,
|
int16_t bweIndex,
|
||||||
int16_t jitterInfo,
|
int16_t jitterInfo,
|
||||||
int32_t rate,
|
int32_t rate,
|
||||||
int16_t* encoded,
|
uint8_t* encoded,
|
||||||
int16_t isRCU);
|
int16_t isRCU);
|
||||||
|
|
||||||
|
|
||||||
@@ -631,7 +631,7 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int16_t WebRtcIsac_ReadBwIndex(
|
int16_t WebRtcIsac_ReadBwIndex(
|
||||||
const int16_t* encoded,
|
const uint8_t* encoded,
|
||||||
int16_t* bweIndex);
|
int16_t* bweIndex);
|
||||||
|
|
||||||
|
|
||||||
@@ -679,7 +679,7 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
int16_t WebRtcIsac_GetRedPayload(
|
int16_t WebRtcIsac_GetRedPayload(
|
||||||
ISACStruct* ISAC_main_inst,
|
ISACStruct* ISAC_main_inst,
|
||||||
int16_t* encoded);
|
uint8_t* encoded);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -786,7 +786,7 @@ int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
|||||||
int16_t bweIndex,
|
int16_t bweIndex,
|
||||||
int16_t jitterInfo,
|
int16_t jitterInfo,
|
||||||
int32_t rate,
|
int32_t rate,
|
||||||
int16_t* encoded,
|
uint8_t* encoded,
|
||||||
int16_t isRCU) {
|
int16_t isRCU) {
|
||||||
Bitstr iSACBitStreamInst; /* Local struct for bitstream handling */
|
Bitstr iSACBitStreamInst; /* Local struct for bitstream handling */
|
||||||
int16_t streamLenLB;
|
int16_t streamLenLB;
|
||||||
@@ -799,7 +799,6 @@ int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
|||||||
double rateLB;
|
double rateLB;
|
||||||
double rateUB;
|
double rateUB;
|
||||||
int32_t currentBN;
|
int32_t currentBN;
|
||||||
uint8_t* encodedPtrUW8 = (uint8_t*)encoded;
|
|
||||||
uint32_t crc;
|
uint32_t crc;
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
int16_t k;
|
int16_t k;
|
||||||
@@ -885,20 +884,20 @@ int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
totalStreamLen = streamLenLB + streamLenUB + 1 + LEN_CHECK_SUM_WORD8;
|
totalStreamLen = streamLenLB + streamLenUB + 1 + LEN_CHECK_SUM_WORD8;
|
||||||
encodedPtrUW8[streamLenLB] = streamLenUB + 1 + LEN_CHECK_SUM_WORD8;
|
encoded[streamLenLB] = streamLenUB + 1 + LEN_CHECK_SUM_WORD8;
|
||||||
|
|
||||||
memcpy(&encodedPtrUW8[streamLenLB + 1], iSACBitStreamInst.stream,
|
memcpy(&encoded[streamLenLB + 1], iSACBitStreamInst.stream,
|
||||||
streamLenUB);
|
streamLenUB);
|
||||||
|
|
||||||
WebRtcIsac_GetCrc((int16_t*)(&(encodedPtrUW8[streamLenLB + 1])),
|
WebRtcIsac_GetCrc((int16_t*)(&(encoded[streamLenLB + 1])),
|
||||||
streamLenUB, &crc);
|
streamLenUB, &crc);
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
|
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
|
||||||
encodedPtrUW8[totalStreamLen - LEN_CHECK_SUM_WORD8 + k] =
|
encoded[totalStreamLen - LEN_CHECK_SUM_WORD8 + k] =
|
||||||
(uint8_t)((crc >> (24 - k * 8)) & 0xFF);
|
(uint8_t)((crc >> (24 - k * 8)) & 0xFF);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
memcpy(&encodedPtrUW8[streamLenLB + streamLenUB + 1], &crc,
|
memcpy(&encoded[streamLenLB + streamLenUB + 1], &crc,
|
||||||
LEN_CHECK_SUM_WORD8);
|
LEN_CHECK_SUM_WORD8);
|
||||||
#endif
|
#endif
|
||||||
return totalStreamLen;
|
return totalStreamLen;
|
||||||
@@ -1734,7 +1733,7 @@ int16_t WebRtcIsac_UpdateUplinkBw(ISACStruct* ISAC_main_inst,
|
|||||||
* - bweIndex : Bandwidth estimate in bit-stream
|
* - bweIndex : Bandwidth estimate in bit-stream
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int16_t WebRtcIsac_ReadBwIndex(const int16_t* encoded,
|
int16_t WebRtcIsac_ReadBwIndex(const uint8_t* encoded,
|
||||||
int16_t* bweIndex) {
|
int16_t* bweIndex) {
|
||||||
Bitstr streamdata;
|
Bitstr streamdata;
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
@@ -1746,8 +1745,8 @@ int16_t WebRtcIsac_ReadBwIndex(const int16_t* encoded,
|
|||||||
|
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
for (k = 0; k < 10; k++) {
|
for (k = 0; k < 10; k++) {
|
||||||
streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >>
|
int16_t ek2 = ((const int16_t*)encoded)[k >> 1];
|
||||||
((k & 1) << 3)) & 0xFF);
|
streamdata.stream[k] = (uint8_t)((ek2 >> ((k & 1) << 3)) & 0xff);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
memcpy(streamdata.stream, encoded, 10);
|
memcpy(streamdata.stream, encoded, 10);
|
||||||
@@ -1783,7 +1782,7 @@ int16_t WebRtcIsac_ReadBwIndex(const int16_t* encoded,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
|
int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
|
||||||
const int16_t* encoded,
|
const uint8_t* encoded,
|
||||||
int16_t* frameLength) {
|
int16_t* frameLength) {
|
||||||
Bitstr streamdata;
|
Bitstr streamdata;
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
@@ -1796,8 +1795,8 @@ int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
|
|||||||
|
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
for (k = 0; k < 10; k++) {
|
for (k = 0; k < 10; k++) {
|
||||||
streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >>
|
int16_t ek2 = ((const int16_t*)encoded)[k >> 1];
|
||||||
((k & 1) << 3)) & 0xFF);
|
streamdata.stream[k] = (uint8_t)((ek2 >> ((k & 1) << 3)) & 0xff);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
memcpy(streamdata.stream, encoded, 10);
|
memcpy(streamdata.stream, encoded, 10);
|
||||||
@@ -2096,13 +2095,12 @@ int16_t WebRtcIsac_SetMaxRate(ISACStruct* ISAC_main_inst,
|
|||||||
* : -1 - Error
|
* : -1 - Error
|
||||||
*/
|
*/
|
||||||
int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
|
int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
|
||||||
int16_t* encoded) {
|
uint8_t* encoded) {
|
||||||
Bitstr iSACBitStreamInst;
|
Bitstr iSACBitStreamInst;
|
||||||
int16_t streamLenLB;
|
int16_t streamLenLB;
|
||||||
int16_t streamLenUB;
|
int16_t streamLenUB;
|
||||||
int16_t streamLen;
|
int16_t streamLen;
|
||||||
int16_t totalLenUB;
|
int16_t totalLenUB;
|
||||||
uint8_t* ptrEncodedUW8 = (uint8_t*)encoded;
|
|
||||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
int k;
|
int k;
|
||||||
@@ -2125,7 +2123,7 @@ int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* convert from bytes to int16_t. */
|
/* convert from bytes to int16_t. */
|
||||||
memcpy(ptrEncodedUW8, iSACBitStreamInst.stream, streamLenLB);
|
memcpy(encoded, iSACBitStreamInst.stream, streamLenLB);
|
||||||
streamLen = streamLenLB;
|
streamLen = streamLenLB;
|
||||||
if (instISAC->bandwidthKHz == isac8kHz) {
|
if (instISAC->bandwidthKHz == isac8kHz) {
|
||||||
return streamLenLB;
|
return streamLenLB;
|
||||||
@@ -2154,19 +2152,19 @@ int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
|
|||||||
(streamLenUB > 0)) {
|
(streamLenUB > 0)) {
|
||||||
uint32_t crc;
|
uint32_t crc;
|
||||||
streamLen += totalLenUB;
|
streamLen += totalLenUB;
|
||||||
ptrEncodedUW8[streamLenLB] = (uint8_t)totalLenUB;
|
encoded[streamLenLB] = (uint8_t)totalLenUB;
|
||||||
memcpy(&ptrEncodedUW8[streamLenLB + 1], iSACBitStreamInst.stream,
|
memcpy(&encoded[streamLenLB + 1], iSACBitStreamInst.stream,
|
||||||
streamLenUB);
|
streamLenUB);
|
||||||
|
|
||||||
WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])),
|
WebRtcIsac_GetCrc((int16_t*)(&(encoded[streamLenLB + 1])),
|
||||||
streamLenUB, &crc);
|
streamLenUB, &crc);
|
||||||
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
#ifndef WEBRTC_ARCH_BIG_ENDIAN
|
||||||
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
|
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
|
||||||
ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] =
|
encoded[streamLen - LEN_CHECK_SUM_WORD8 + k] =
|
||||||
(uint8_t)((crc >> (24 - k * 8)) & 0xFF);
|
(uint8_t)((crc >> (24 - k * 8)) & 0xFF);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
memcpy(&ptrEncodedUW8[streamLenLB + streamLenUB + 1], &crc,
|
memcpy(&encoded[streamLenLB + streamLenUB + 1], &crc,
|
||||||
LEN_CHECK_SUM_WORD8);
|
LEN_CHECK_SUM_WORD8);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -687,8 +687,12 @@ int main(int argc, char* argv[])
|
|||||||
/************************* Main Transcoding stream *******************************/
|
/************************* Main Transcoding stream *******************************/
|
||||||
WebRtcIsac_GetDownLinkBwIndex(ISAC_main_inst, &bnIdxTC, &jitterInfoTC);
|
WebRtcIsac_GetDownLinkBwIndex(ISAC_main_inst, &bnIdxTC, &jitterInfoTC);
|
||||||
streamLenTransCoding = WebRtcIsac_GetNewBitStream(
|
streamLenTransCoding = WebRtcIsac_GetNewBitStream(
|
||||||
ISAC_main_inst, bnIdxTC, jitterInfoTC, rateTransCoding,
|
ISAC_main_inst,
|
||||||
(int16_t*)streamDataTransCoding, false);
|
bnIdxTC,
|
||||||
|
jitterInfoTC,
|
||||||
|
rateTransCoding,
|
||||||
|
reinterpret_cast<uint8_t*>(streamDataTransCoding),
|
||||||
|
false);
|
||||||
if(streamLenTransCoding < 0)
|
if(streamLenTransCoding < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error in trans-coding\n");
|
fprintf(stderr, "Error in trans-coding\n");
|
||||||
@@ -714,9 +718,10 @@ int main(int argc, char* argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcIsac_ReadBwIndex((int16_t*)streamDataTransCoding, &indexStream);
|
WebRtcIsac_ReadBwIndex(reinterpret_cast<const uint8_t*>(
|
||||||
if(indexStream != bnIdxTC)
|
streamDataTransCoding),
|
||||||
{
|
&indexStream);
|
||||||
|
if (indexStream != bnIdxTC) {
|
||||||
fprintf(stderr, "Error in inserting Bandwidth index into transcoding stream.\n");
|
fprintf(stderr, "Error in inserting Bandwidth index into transcoding stream.\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@@ -780,14 +785,18 @@ int main(int argc, char* argv[])
|
|||||||
// RED.
|
// RED.
|
||||||
if(lostFrame)
|
if(lostFrame)
|
||||||
{
|
{
|
||||||
stream_len = WebRtcIsac_GetRedPayload(ISAC_main_inst,
|
stream_len = WebRtcIsac_GetRedPayload(
|
||||||
(int16_t*)streamdata);
|
ISAC_main_inst, reinterpret_cast<uint8_t*>(streamdata));
|
||||||
|
|
||||||
if(doTransCoding)
|
if(doTransCoding)
|
||||||
{
|
{
|
||||||
streamLenTransCoding = WebRtcIsac_GetNewBitStream(
|
streamLenTransCoding = WebRtcIsac_GetNewBitStream(
|
||||||
ISAC_main_inst, bnIdxTC, jitterInfoTC, rateTransCoding,
|
ISAC_main_inst,
|
||||||
(int16_t*)streamDataTransCoding, true);
|
bnIdxTC,
|
||||||
|
jitterInfoTC,
|
||||||
|
rateTransCoding,
|
||||||
|
reinterpret_cast<uint8_t*>(streamDataTransCoding),
|
||||||
|
true);
|
||||||
if(streamLenTransCoding < 0)
|
if(streamLenTransCoding < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error in RED trans-coding\n");
|
fprintf(stderr, "Error in RED trans-coding\n");
|
||||||
@@ -872,8 +881,10 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Call getFramelen, only used here for function test */
|
/* Call getFramelen, only used here for function test */
|
||||||
err = WebRtcIsac_ReadFrameLen(ISAC_main_inst,
|
err = WebRtcIsac_ReadFrameLen(
|
||||||
(int16_t*)streamdata, &FL);
|
ISAC_main_inst,
|
||||||
|
reinterpret_cast<const uint8_t*>(streamdata),
|
||||||
|
&FL);
|
||||||
if(err < 0)
|
if(err < 0)
|
||||||
{
|
{
|
||||||
/* exit if returned with error */
|
/* exit if returned with error */
|
||||||
|
|||||||
@@ -287,8 +287,10 @@ int main(int argc, char* argv[])
|
|||||||
(uint8_t*)bitStream);
|
(uint8_t*)bitStream);
|
||||||
int16_t ggg;
|
int16_t ggg;
|
||||||
if (streamLen > 0) {
|
if (streamLen > 0) {
|
||||||
if(( WebRtcIsac_ReadFrameLen(codecInstance[receiverIdx],
|
if ((WebRtcIsac_ReadFrameLen(
|
||||||
(short *) bitStream, &ggg))<0)
|
codecInstance[receiverIdx],
|
||||||
|
reinterpret_cast<const uint8_t*>(bitStream),
|
||||||
|
&ggg)) < 0)
|
||||||
printf("ERROR\n");
|
printf("ERROR\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -395,7 +395,8 @@ valid values are 8 and 16.\n", sampFreqKHz);
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rcuStreamLen = WebRtcIsac_GetRedPayload(ISAC_main_inst, (int16_t*)payloadRCU);
|
rcuStreamLen = WebRtcIsac_GetRedPayload(
|
||||||
|
ISAC_main_inst, (uint8_t*)payloadRCU);
|
||||||
|
|
||||||
get_arrival_time(cur_framesmpls, stream_len, bottleneck, &packetData,
|
get_arrival_time(cur_framesmpls, stream_len, bottleneck, &packetData,
|
||||||
sampFreqKHz * 1000, sampFreqKHz * 1000);
|
sampFreqKHz * 1000, sampFreqKHz * 1000);
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ static int16_t ACMISACFixGetNewBitstream(ACM_ISAC_STRUCT* inst,
|
|||||||
int16_t bwe_index,
|
int16_t bwe_index,
|
||||||
int16_t /* jitter_index */,
|
int16_t /* jitter_index */,
|
||||||
int32_t rate,
|
int32_t rate,
|
||||||
int16_t* bitstream,
|
uint8_t* bitstream,
|
||||||
bool is_red) {
|
bool is_red) {
|
||||||
if (is_red) {
|
if (is_red) {
|
||||||
// RED not supported with iSACFIX
|
// RED not supported with iSACFIX
|
||||||
@@ -437,7 +437,7 @@ int16_t ACMISAC::Transcode(uint8_t* bitstream,
|
|||||||
|
|
||||||
*bitstream_len_byte = ACM_ISAC_GETNEWBITSTREAM(
|
*bitstream_len_byte = ACM_ISAC_GETNEWBITSTREAM(
|
||||||
codec_inst_ptr_->inst, q_bwe, jitter_info, rate,
|
codec_inst_ptr_->inst, q_bwe, jitter_info, rate,
|
||||||
reinterpret_cast<int16_t*>(bitstream), (is_red) ? 1 : 0);
|
bitstream, (is_red) ? 1 : 0);
|
||||||
|
|
||||||
if (*bitstream_len_byte < 0) {
|
if (*bitstream_len_byte < 0) {
|
||||||
// error happened
|
// error happened
|
||||||
@@ -591,9 +591,7 @@ int32_t ACMISAC::GetRedPayloadSafe(
|
|||||||
#else
|
#else
|
||||||
uint8_t* red_payload, int16_t* payload_bytes) {
|
uint8_t* red_payload, int16_t* payload_bytes) {
|
||||||
CriticalSectionScoped lock(codec_inst_crit_sect_.get());
|
CriticalSectionScoped lock(codec_inst_crit_sect_.get());
|
||||||
int16_t bytes =
|
int16_t bytes = WebRtcIsac_GetRedPayload(codec_inst_ptr_->inst, red_payload);
|
||||||
WebRtcIsac_GetRedPayload(
|
|
||||||
codec_inst_ptr_->inst, reinterpret_cast<int16_t*>(red_payload));
|
|
||||||
if (bytes < 0) {
|
if (bytes < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ int main(int argc, char* argv[])
|
|||||||
uint32_t red_TS[2] = {0};
|
uint32_t red_TS[2] = {0};
|
||||||
uint16_t red_len[2] = {0};
|
uint16_t red_len[2] = {0};
|
||||||
int RTPheaderLen=12;
|
int RTPheaderLen=12;
|
||||||
unsigned char red_data[8000];
|
uint8_t red_data[8000];
|
||||||
#ifdef INSERT_OLD_PACKETS
|
#ifdef INSERT_OLD_PACKETS
|
||||||
uint16_t old_length, old_plen;
|
uint16_t old_length, old_plen;
|
||||||
int old_enc_len;
|
int old_enc_len;
|
||||||
@@ -755,7 +755,8 @@ int main(int argc, char* argv[])
|
|||||||
if(usedCodec==webrtc::kDecoderISAC)
|
if(usedCodec==webrtc::kDecoderISAC)
|
||||||
{
|
{
|
||||||
assert(!usingStereo); // Cannot handle stereo yet
|
assert(!usingStereo); // Cannot handle stereo yet
|
||||||
red_len[0] = WebRtcIsac_GetRedPayload(ISAC_inst[0], (int16_t*)red_data);
|
red_len[0] =
|
||||||
|
WebRtcIsac_GetRedPayload(ISAC_inst[0], red_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user