Remove the useless dummy state parameter to WebRtcG711_*
R=henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/27029004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7609 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -82,8 +82,7 @@ bool AudioEncoderPcm::Encode(uint32_t timestamp,
|
||||
int16_t AudioEncoderPcmA::EncodeCall(const int16_t* audio,
|
||||
size_t input_len,
|
||||
uint8_t* encoded) {
|
||||
return WebRtcG711_EncodeA(NULL,
|
||||
const_cast<int16_t*>(audio),
|
||||
return WebRtcG711_EncodeA(const_cast<int16_t*>(audio),
|
||||
static_cast<int16_t>(input_len),
|
||||
reinterpret_cast<int16_t*>(encoded));
|
||||
}
|
||||
@ -91,8 +90,7 @@ int16_t AudioEncoderPcmA::EncodeCall(const int16_t* audio,
|
||||
int16_t AudioEncoderPcmU::EncodeCall(const int16_t* audio,
|
||||
size_t input_len,
|
||||
uint8_t* encoded) {
|
||||
return WebRtcG711_EncodeU(NULL,
|
||||
const_cast<int16_t*>(audio),
|
||||
return WebRtcG711_EncodeU(const_cast<int16_t*>(audio),
|
||||
static_cast<int16_t>(input_len),
|
||||
reinterpret_cast<int16_t*>(encoded));
|
||||
}
|
||||
|
||||
@ -12,16 +12,12 @@
|
||||
#include "g711_interface.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
int16_t WebRtcG711_EncodeA(void* state,
|
||||
int16_t* speechIn,
|
||||
int16_t WebRtcG711_EncodeA(int16_t* speechIn,
|
||||
int16_t len,
|
||||
int16_t* encoded) {
|
||||
int n;
|
||||
uint16_t tempVal, tempVal2;
|
||||
|
||||
// Set and discard to avoid getting warnings
|
||||
(void)(state = NULL);
|
||||
|
||||
// Sanity check of input length
|
||||
if (len < 0) {
|
||||
return (-1);
|
||||
@ -50,16 +46,12 @@ int16_t WebRtcG711_EncodeA(void* state,
|
||||
return (len);
|
||||
}
|
||||
|
||||
int16_t WebRtcG711_EncodeU(void* state,
|
||||
int16_t* speechIn,
|
||||
int16_t WebRtcG711_EncodeU(int16_t* speechIn,
|
||||
int16_t len,
|
||||
int16_t* encoded) {
|
||||
int n;
|
||||
uint16_t tempVal;
|
||||
|
||||
// Set and discard to avoid getting warnings
|
||||
(void)(state = NULL);
|
||||
|
||||
// Sanity check of input length
|
||||
if (len < 0) {
|
||||
return (-1);
|
||||
@ -86,17 +78,13 @@ int16_t WebRtcG711_EncodeU(void* state,
|
||||
return (len);
|
||||
}
|
||||
|
||||
int16_t WebRtcG711_DecodeA(void* state,
|
||||
int16_t* encoded,
|
||||
int16_t WebRtcG711_DecodeA(int16_t* encoded,
|
||||
int16_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType) {
|
||||
int n;
|
||||
uint16_t tempVal;
|
||||
|
||||
// Set and discard to avoid getting warnings
|
||||
(void)(state = NULL);
|
||||
|
||||
// Sanity check of input length
|
||||
if (len < 0) {
|
||||
return (-1);
|
||||
@ -123,17 +111,13 @@ int16_t WebRtcG711_DecodeA(void* state,
|
||||
return (len);
|
||||
}
|
||||
|
||||
int16_t WebRtcG711_DecodeU(void* state,
|
||||
int16_t* encoded,
|
||||
int16_t WebRtcG711_DecodeU(int16_t* encoded,
|
||||
int16_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType) {
|
||||
int n;
|
||||
uint16_t tempVal;
|
||||
|
||||
// Set and discard to avoid getting warnings
|
||||
(void)(state = NULL);
|
||||
|
||||
// Sanity check of input length
|
||||
if (len < 0) {
|
||||
return (-1);
|
||||
@ -160,10 +144,8 @@ int16_t WebRtcG711_DecodeU(void* state,
|
||||
return (len);
|
||||
}
|
||||
|
||||
int WebRtcG711_DurationEst(void* state,
|
||||
const uint8_t* payload,
|
||||
int WebRtcG711_DurationEst(const uint8_t* payload,
|
||||
int payload_length_bytes) {
|
||||
(void) state;
|
||||
(void) payload;
|
||||
/* G.711 is one byte per sample, so we can just return the number of bytes. */
|
||||
return payload_length_bytes;
|
||||
|
||||
@ -28,8 +28,6 @@ extern "C" {
|
||||
* Input speech length has be of any length.
|
||||
*
|
||||
* Input:
|
||||
* - state : Dummy state to make this codec look more like
|
||||
* other codecs
|
||||
* - speechIn : Input speech vector
|
||||
* - len : Samples in speechIn
|
||||
*
|
||||
@ -40,8 +38,7 @@ extern "C" {
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcG711_EncodeA(void* state,
|
||||
int16_t* speechIn,
|
||||
int16_t WebRtcG711_EncodeA(int16_t* speechIn,
|
||||
int16_t len,
|
||||
int16_t* encoded);
|
||||
|
||||
@ -52,8 +49,6 @@ int16_t WebRtcG711_EncodeA(void* state,
|
||||
* Input speech length has be of any length.
|
||||
*
|
||||
* Input:
|
||||
* - state : Dummy state to make this codec look more like
|
||||
* other codecs
|
||||
* - speechIn : Input speech vector
|
||||
* - len : Samples in speechIn
|
||||
*
|
||||
@ -64,8 +59,7 @@ int16_t WebRtcG711_EncodeA(void* state,
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcG711_EncodeU(void* state,
|
||||
int16_t* speechIn,
|
||||
int16_t WebRtcG711_EncodeU(int16_t* speechIn,
|
||||
int16_t len,
|
||||
int16_t* encoded);
|
||||
|
||||
@ -75,8 +69,6 @@ int16_t WebRtcG711_EncodeU(void* state,
|
||||
* This function decodes a packet G711 A-law frame.
|
||||
*
|
||||
* Input:
|
||||
* - state : Dummy state to make this codec look more like
|
||||
* other codecs
|
||||
* - encoded : Encoded data
|
||||
* - len : Bytes in encoded vector
|
||||
*
|
||||
@ -90,8 +82,7 @@ int16_t WebRtcG711_EncodeU(void* state,
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcG711_DecodeA(void* state,
|
||||
int16_t* encoded,
|
||||
int16_t WebRtcG711_DecodeA(int16_t* encoded,
|
||||
int16_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType);
|
||||
@ -102,8 +93,6 @@ int16_t WebRtcG711_DecodeA(void* state,
|
||||
* This function decodes a packet G711 U-law frame.
|
||||
*
|
||||
* Input:
|
||||
* - state : Dummy state to make this codec look more like
|
||||
* other codecs
|
||||
* - encoded : Encoded data
|
||||
* - len : Bytes in encoded vector
|
||||
*
|
||||
@ -117,8 +106,7 @@ int16_t WebRtcG711_DecodeA(void* state,
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcG711_DecodeU(void* state,
|
||||
int16_t* encoded,
|
||||
int16_t WebRtcG711_DecodeU(int16_t* encoded,
|
||||
int16_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType);
|
||||
@ -129,8 +117,6 @@ int16_t WebRtcG711_DecodeU(void* state,
|
||||
* This function estimates the duration of a G711 packet in samples.
|
||||
*
|
||||
* Input:
|
||||
* - state : Dummy state to make this codec look more like
|
||||
* other codecs
|
||||
* - payload : Encoded data
|
||||
* - payloadLengthBytes : Bytes in encoded vector
|
||||
*
|
||||
@ -139,8 +125,7 @@ int16_t WebRtcG711_DecodeU(void* state,
|
||||
* byte per sample.
|
||||
*/
|
||||
|
||||
int WebRtcG711_DurationEst(void* state,
|
||||
const uint8_t* payload,
|
||||
int WebRtcG711_DurationEst(const uint8_t* payload,
|
||||
int payload_length_bytes);
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
@ -127,7 +127,7 @@ int main(int argc, char* argv[]) {
|
||||
/* G.711 encoding */
|
||||
if (!strcmp(law, "A")) {
|
||||
/* A-law encoding */
|
||||
stream_len = WebRtcG711_EncodeA(NULL, shortdata, framelength, streamdata);
|
||||
stream_len = WebRtcG711_EncodeA(shortdata, framelength, streamdata);
|
||||
if (argc == 6) {
|
||||
/* Write bits to file */
|
||||
if (fwrite(streamdata, sizeof(unsigned char), stream_len, bitp) !=
|
||||
@ -135,11 +135,11 @@ int main(int argc, char* argv[]) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
err = WebRtcG711_DecodeA(NULL, streamdata, stream_len, decoded,
|
||||
err = WebRtcG711_DecodeA(streamdata, stream_len, decoded,
|
||||
speechType);
|
||||
} else if (!strcmp(law, "u")) {
|
||||
/* u-law encoding */
|
||||
stream_len = WebRtcG711_EncodeU(NULL, shortdata, framelength, streamdata);
|
||||
stream_len = WebRtcG711_EncodeU(shortdata, framelength, streamdata);
|
||||
if (argc == 6) {
|
||||
/* Write bits to file */
|
||||
if (fwrite(streamdata, sizeof(unsigned char), stream_len, bitp) !=
|
||||
@ -147,8 +147,7 @@ int main(int argc, char* argv[]) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
err = WebRtcG711_DecodeU(NULL, streamdata, stream_len, decoded,
|
||||
speechType);
|
||||
err = WebRtcG711_DecodeU(streamdata, stream_len, decoded, speechType);
|
||||
} else {
|
||||
printf("Wrong law mode\n");
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user