WebRtcG722_Decode: Input array should be const uint8_t[]
BUG=909 R=henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/38799004 Cr-Commit-Position: refs/heads/master@{#8224} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8224 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
026b892e72
commit
a1dfbf1e5c
@ -86,7 +86,7 @@ int16_t WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst)
|
||||
}
|
||||
|
||||
int16_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
|
||||
int16_t *encoded,
|
||||
const uint8_t *encoded,
|
||||
int16_t len,
|
||||
int16_t *decoded,
|
||||
int16_t *speechType)
|
||||
@ -94,7 +94,7 @@ int16_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
|
||||
// Decode the G.722 encoder stream
|
||||
*speechType=G722_WEBRTC_SPEECH;
|
||||
return WebRtc_g722_decode((G722DecoderState*) G722dec_inst,
|
||||
decoded, (uint8_t*) encoded, len);
|
||||
decoded, encoded, len);
|
||||
}
|
||||
|
||||
int16_t WebRtcG722_Version(char *versionStr, short len)
|
||||
|
@ -168,7 +168,7 @@ int16_t WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst);
|
||||
*/
|
||||
|
||||
int16_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
|
||||
int16_t *encoded,
|
||||
const uint8_t* encoded,
|
||||
int16_t len,
|
||||
int16_t *decoded,
|
||||
int16_t *speechType);
|
||||
|
@ -124,9 +124,8 @@ int main(int argc, char* argv[])
|
||||
|
||||
/* G.722 encoding + decoding */
|
||||
stream_len = WebRtcG722_Encode((G722EncInst *)G722enc_inst, shortdata, framelength, streamdata);
|
||||
err = WebRtcG722_Decode(G722dec_inst,
|
||||
reinterpret_cast<int16_t*>(streamdata),
|
||||
stream_len, decoded, speechType);
|
||||
err = WebRtcG722_Decode(G722dec_inst, streamdata, stream_len, decoded,
|
||||
speechType);
|
||||
|
||||
/* Stop clock after call to encoder and decoder */
|
||||
runtime += (double)((clock()/(double)CLOCKS_PER_SEC_G722)-starttime);
|
||||
|
@ -140,10 +140,9 @@ AudioDecoderG722::~AudioDecoderG722() {
|
||||
int AudioDecoderG722::Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type) {
|
||||
int16_t temp_type = 1; // Default is speech.
|
||||
int16_t ret = WebRtcG722_Decode(
|
||||
dec_state_,
|
||||
const_cast<int16_t*>(reinterpret_cast<const int16_t*>(encoded)),
|
||||
static_cast<int16_t>(encoded_len), decoded, &temp_type);
|
||||
int16_t ret =
|
||||
WebRtcG722_Decode(dec_state_, encoded, static_cast<int16_t>(encoded_len),
|
||||
decoded, &temp_type);
|
||||
*speech_type = ConvertSpeechType(temp_type);
|
||||
return ret;
|
||||
}
|
||||
@ -176,16 +175,15 @@ int AudioDecoderG722Stereo::Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
uint8_t* encoded_deinterleaved = new uint8_t[encoded_len];
|
||||
SplitStereoPacket(encoded, encoded_len, encoded_deinterleaved);
|
||||
// Decode left and right.
|
||||
int16_t ret = WebRtcG722_Decode(
|
||||
dec_state_left_,
|
||||
reinterpret_cast<int16_t*>(encoded_deinterleaved),
|
||||
static_cast<int16_t>(encoded_len / 2), decoded, &temp_type);
|
||||
int16_t ret = WebRtcG722_Decode(dec_state_left_, encoded_deinterleaved,
|
||||
static_cast<int16_t>(encoded_len / 2),
|
||||
decoded, &temp_type);
|
||||
if (ret >= 0) {
|
||||
int decoded_len = ret;
|
||||
ret = WebRtcG722_Decode(
|
||||
dec_state_right_,
|
||||
reinterpret_cast<int16_t*>(&encoded_deinterleaved[encoded_len / 2]),
|
||||
static_cast<int16_t>(encoded_len / 2), &decoded[decoded_len], &temp_type);
|
||||
ret = WebRtcG722_Decode(dec_state_right_,
|
||||
&encoded_deinterleaved[encoded_len / 2],
|
||||
static_cast<int16_t>(encoded_len / 2),
|
||||
&decoded[decoded_len], &temp_type);
|
||||
if (ret == decoded_len) {
|
||||
decoded_len += ret;
|
||||
// Interleave output.
|
||||
|
Loading…
x
Reference in New Issue
Block a user