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
diff --git a/webrtc/modules/audio_coding/codecs/g722/g722_interface.c b/webrtc/modules/audio_coding/codecs/g722/g722_interface.c
index 9a67d88..d06c588 100644
--- a/webrtc/modules/audio_coding/codecs/g722/g722_interface.c
+++ b/webrtc/modules/audio_coding/codecs/g722/g722_interface.c
@@ -86,7 +86,7 @@
}
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 @@
// 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)
diff --git a/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h b/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h
index 8c9571a..d4b3567 100644
--- a/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h
+++ b/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h
@@ -168,7 +168,7 @@
*/
int16_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
- int16_t *encoded,
+ const uint8_t* encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType);
diff --git a/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc b/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc
index 65919a1..6d0c432 100644
--- a/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc
+++ b/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc
@@ -124,9 +124,8 @@
/* 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);
diff --git a/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
index b8c5976..9ea2429 100644
--- a/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
@@ -140,10 +140,9 @@
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 @@
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.