Fixing some inconsistencies in WebRTC audio coding module. I've added setup information for all codecs which are not part of WebRTC, but possible to hook in.

Please help me review.
Henrik: review neteq_defines.h
Turaj: review all files, but the one Henrik reviews.
Zakk: FYI only.
Review URL: http://webrtc-codereview.appspot.com/138004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@505 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tina.legrand@webrtc.org 2011-09-01 07:47:31 +00:00
parent d9e11b429e
commit 84519ec0a2
21 changed files with 621 additions and 333 deletions

View File

@ -273,15 +273,23 @@
#define NETEQ_PCM16B_CODEC
#define NETEQ_G711_CODEC
#define NETEQ_ILBC_CODEC
#define NETEQ_AMR_CODEC
#define NETEQ_G729_CODEC
#define NETEQ_GSMFR_CODEC
/* Wideband codecs */
#define NETEQ_WIDEBAND
#define NETEQ_ISAC_CODEC
#define NETEQ_G722_CODEC
#define NETEQ_G722_1_CODEC
#define NETEQ_G729_1_CODEC
#define NETEQ_AMRWB_CODEC
#define NETEQ_SPEEX_CODEC
/* Super wideband 32kHz codecs */
#define NETEQ_ISAC_SWB_CODEC
#define NETEQ_32KHZ_WIDEBAND
#define NETEQ_G722_1C_CODEC
#endif

View File

@ -18,13 +18,32 @@
#include "webrtc_neteq_help_macros.h"
#ifdef WEBRTC_CODEC_AMR
// NOTE! GSM AMR is not included in the open-source package. Modify this file or your codec
// API to match the function call and name of used AMR API file.
// #include "amr_interface.h"
// NOTE! GSM AMR is not included in the open-source package. A wrapper is
// needed with interface file named as below. The API should match the one
// below.
//
// int16_t WebRtcAmr_CreateEnc(AMR_encinst_t_** encInst);
// int16_t WebRtcAmr_CreateDec(AMR_decinst_t_** decInst);
// int16_t WebRtcAmr_FreeEnc(AMR_encinst_t_* encInst);
// int16_t WebRtcAmr_FreeDec(AMR_decinst_t_* decInst);
// int16_t WebRtcAmr_Encode(AMR_encinst_t_* encInst,
// int16_t* input,
// int16_t len,
// int16_t*output,
// int16_t mode);
// int16_t WebRtcAmr_EncoderInit(AMR_encinst_t_* encInst,
// int16_t dtxMode);
// int16_t WebRtcAmr_EncodeBitmode(AMR_encinst_t_* encInst,
// ACMAMRPackingFormat format);
// int16_t WebRtcAmr_Decode(AMR_decinst_t_* decInst);
// int16_t WebRtcAmr_DecodePlc(AMR_decinst_t_* decInst);
// int16_t WebRtcAmr_DecoderInit(AMR_decinst_t_* decInst);
// int16_t WebRtcAmr_DecodeBitmode(AMR_decinst_t_* decInst,
// ACMAMRPackingFormat format);
#include "amr_interface.h"
#endif
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_AMR
ACMAMR::ACMAMR(WebRtc_Word16 /* codecID */)
@ -186,7 +205,6 @@ ACMAMR::UnregisterFromNetEqSafe(
#else //===================== Actual Implementation =======================
#define WEBRTC_AMR_MR475 0
#define WEBRTC_AMR_MR515 1
#define WEBRTC_AMR_MR59 2
@ -196,26 +214,6 @@ ACMAMR::UnregisterFromNetEqSafe(
#define WEBRTC_AMR_MR102 6
#define WEBRTC_AMR_MR122 7
// Remove when integrating a real GSM AMR wrapper
extern WebRtc_Word16 WebRtcAmr_CreateEnc(AMR_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcAmr_CreateDec(AMR_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcAmr_FreeEnc(AMR_encinst_t_* encInst);
extern WebRtc_Word16 WebRtcAmr_FreeDec(AMR_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcAmr_Encode(AMR_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 len,
WebRtc_Word16*output,
WebRtc_Word16 mode);
extern WebRtc_Word16 WebRtcAmr_EncoderInit(AMR_encinst_t_* encInst,
WebRtc_Word16 dtxMode);
extern WebRtc_Word16 WebRtcAmr_EncodeBitmode(AMR_encinst_t_* encInst,
ACMAMRPackingFormat format);
extern WebRtc_Word16 WebRtcAmr_Decode(AMR_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcAmr_DecodePlc(AMR_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcAmr_DecoderInit(AMR_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcAmr_DecodeBitmode(AMR_decinst_t_* decInst,
ACMAMRPackingFormat format);
ACMAMR::ACMAMR(WebRtc_Word16 codecID):
_encoderInstPtr(NULL),
_decoderInstPtr(NULL),

View File

@ -17,8 +17,7 @@
struct AMR_encinst_t_;
struct AMR_decinst_t_;
namespace webrtc
{
namespace webrtc {
enum ACMAMRPackingFormat;

View File

@ -18,13 +18,29 @@
#include "webrtc_neteq_help_macros.h"
#ifdef WEBRTC_CODEC_AMRWB
// NOTE! GSM AMR-wb is not included in the open-source package. Modify this file or your
// codec API to match the function call and name of used AMR-wb API file.
// #include "amrwb_interface.h"
// NOTE! GSM AMR-wb is not included in the open-source package. A wrapper is
// needed with interface file named as below. The API should match the one
// below.
//
// int16_t WebRtcAmrWb_CreateEnc(AMRWB_encinst_t_** encInst);
// int16_t WebRtcAmrWb_CreateDec(AMRWB_decinst_t_** decInst);
// int16_t WebRtcAmrWb_FreeEnc(AMRWB_encinst_t_* encInst);
// int16_t WebRtcAmrWb_FreeDec(AMRWB_decinst_t_* decInst);
// int16_t WebRtcAmrWb_Encode(AMRWB_encinst_t_* encInst, int16_t* input,
// int16_t len, int16_t*output, int16_t mode);
// int16_t WebRtcAmrWb_EncoderInit(AMRWB_encinst_t_* encInst,
// int16_t dtxMode);
// int16_t WebRtcAmrWb_EncodeBitmode(AMRWB_encinst_t_* encInst,
// ACMAMRPackingFormat format);
// int16_t WebRtcAmrWb_Decode(AMRWB_decinst_t_* decInst);
// int16_t WebRtcAmrWb_DecodePlc(AMRWB_decinst_t_* decInst);
// int16_t WebRtcAmrWb_DecoderInit(AMRWB_decinst_t_* decInst);
// int16_t WebRtcAmrWb_DecodeBitmode(AMRWB_decinst_t_* decInst,
// ACMAMRPackingFormat format);
#include "amrwb_interface.h"
#endif
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_AMRWB
ACMAMRwb::ACMAMRwb(WebRtc_Word16 /* codecID*/)
@ -182,27 +198,6 @@ ACMAMRwb::UnregisterFromNetEqSafe(
#define AMRWB_MODE_23k 7
#define AMRWB_MODE_24k 8
// Remove when integrating a real GSM AMR wrapper
extern WebRtc_Word16 WebRtcAmrWb_CreateEnc(AMRWB_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcAmrWb_CreateDec(AMRWB_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcAmrWb_FreeEnc(AMRWB_encinst_t_* encInst);
extern WebRtc_Word16 WebRtcAmrWb_FreeDec(AMRWB_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcAmrWb_Encode(AMRWB_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 len,
WebRtc_Word16*output,
WebRtc_Word16 mode);
extern WebRtc_Word16 WebRtcAmrWb_EncoderInit(AMRWB_encinst_t_* encInst,
WebRtc_Word16 dtxMode);
extern WebRtc_Word16 WebRtcAmrWb_EncodeBitmode(AMRWB_encinst_t_* encInst,
ACMAMRPackingFormat format);
extern WebRtc_Word16 WebRtcAmrWb_Decode(AMRWB_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcAmrWb_DecodePlc(AMRWB_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcAmrWb_DecoderInit(AMRWB_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcAmrWb_DecodeBitmode(AMRWB_decinst_t_* decInst,
ACMAMRPackingFormat format);
ACMAMRwb::ACMAMRwb(WebRtc_Word16 codecID):
_encoderInstPtr(NULL),
_decoderInstPtr(NULL),

View File

@ -17,8 +17,7 @@
struct AMRWB_encinst_t_;
struct AMRWB_decinst_t_;
namespace webrtc
{
namespace webrtc {
enum ACMAMRPackingFormat;

View File

@ -14,7 +14,7 @@
*/
// TODO(tlegrand): Change constant input pointers in all functions to constant
// references, where appripriate.
// references, where appropriate.
#include "acm_codec_database.h"
#include <stdio.h>
@ -23,22 +23,15 @@
#include "trace.h"
// Includes needed to get version info and to create the codecs.
// G.711, PCM mu-law and A-law.
#include "acm_pcma.h"
#include "acm_pcmu.h"
#include "g711_interface.h"
#include "webrtc_neteq.h"
#include "webrtc_cng.h"
// CNG.
#include "acm_cng.h"
#ifdef WEBRTC_CODEC_AVT
#include "acm_dtmf_playout.h"
#endif
#ifdef WEBRTC_CODEC_RED
#include "acm_red.h"
#endif
#ifdef WEBRTC_CODEC_ILBC
#include "acm_ilbc.h"
#include "ilbc.h"
#endif
#include "webrtc_cng.h"
// NetEQ.
#include "webrtc_neteq.h"
#ifdef WEBRTC_CODEC_ISAC
#include "acm_isac.h"
#include "acm_isac_macros.h"
@ -53,10 +46,44 @@
#include "pcm16b.h"
#include "acm_pcm16b.h"
#endif
#ifdef WEBRTC_CODEC_ILBC
#include "acm_ilbc.h"
#include "ilbc.h"
#endif
#ifdef WEBRTC_CODEC_AMR
#include "acm_amr.h"
#endif
#ifdef WEBRTC_CODEC_AMRWB
#include "acm_amrwb.h"
#endif
#ifdef WEBRTC_CODEC_G722
#include "acm_g722.h"
#include "g722_interface.h"
#endif
#ifdef WEBRTC_CODEC_G722_1
#include "acm_g7221.h"
#endif
#ifdef WEBRTC_CODEC_G722_1C
#include "acm_g7221c.h"
#endif
#ifdef WEBRTC_CODEC_G729
#include "acm_g729.h"
#endif
#ifdef WEBRTC_CODEC_G729_1
#include "acm_g7291.h"
#endif
#ifdef WEBRTC_CODEC_GSMFR
#include "acm_gsmfr.h"
#endif
#ifdef WEBRTC_CODEC_SPEEX
#include "acm_speex.h"
#endif
#ifdef WEBRTC_CODEC_AVT
#include "acm_dtmf_playout.h"
#endif
#ifdef WEBRTC_CODEC_RED
#include "acm_red.h"
#endif
namespace webrtc {
@ -93,8 +120,37 @@ const CodecInst ACMCodecDB::database_[] = {
#ifdef WEBRTC_CODEC_ILBC
{102, "ILBC", 8000, 240, 1, 13300},
#endif
#ifdef WEBRTC_CODEC_AMR
{kDynamicPayloadtypes[count_database++], "AMR", 8000, 160, 1, 12200},
#endif
#ifdef WEBRTC_CODEC_AMRWB
{kDynamicPayloadtypes[count_database++], "AMR-WB", 16000, 320, 1, 20000},
#endif
#ifdef WEBRTC_CODEC_G722
{9, "G722", 16000, 320, 1, 64000},
#endif
#ifdef WEBRTC_CODEC_G722_1
{kDynamicPayloadtypes[count_database++], "G7221", 16000, 320, 1, 32000},
{kDynamicPayloadtypes[count_database++], "G7221", 16000, 320, 1, 24000},
{kDynamicPayloadtypes[count_database++], "G7221", 16000, 320, 1, 16000},
#endif
#ifdef WEBRTC_CODEC_G722_1C
{kDynamicPayloadtypes[count_database++], "G7221", 32000, 640, 1, 48000},
{kDynamicPayloadtypes[count_database++], "G7221", 32000, 640, 1, 32000},
{kDynamicPayloadtypes[count_database++], "G7221", 32000, 640, 1, 24000},
#endif
#ifdef WEBRTC_CODEC_G729
{18, "G729", 8000, 240, 1, 8000},
#endif
#ifdef WEBRTC_CODEC_G729_1
{kDynamicPayloadtypes[count_database++], "G7291", 16000, 320, 1, 32000},
#endif
#ifdef WEBRTC_CODEC_GSMFR
{3, "GSM", 8000, 160, 1, 13200},
#endif
#ifdef WEBRTC_CODEC_SPEEX
{kDynamicPayloadtypes[count_database++], "speex", 8000, 160, 1, 11000},
{kDynamicPayloadtypes[count_database++], "speex", 16000, 320, 1, 22000},
#endif
// Comfort noise for three different sampling frequencies.
{13, "CN", 8000, 240, 1, 0},
@ -132,8 +188,37 @@ const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = {
#ifdef WEBRTC_CODEC_ILBC
{4, {160, 240, 320, 480}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_AMR
{3, {160, 320, 480}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_AMRWB
{3, {320, 640, 960}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_G722
{6, {160, 320, 480, 640, 800, 960}, 0, 2},
#endif
#ifdef WEBRTC_CODEC_G722_1
{1, {320}, 320, 2},
{1, {320}, 320, 2},
{1, {320}, 320, 2},
#endif
#ifdef WEBRTC_CODEC_G722_1C
{1, {640}, 640, 2},
{1, {640}, 640, 2},
{1, {640}, 640, 2},
#endif
#ifdef WEBRTC_CODEC_G729
{6, {80, 160, 240, 320, 400, 480}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_G729_1
{3, {320, 640, 960}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_GSMFR
{3, {160, 320, 480}, 160, 1},
#endif
#ifdef WEBRTC_CODEC_SPEEX
{3, {160, 320, 480}, 0, 1},
{3, {320, 640, 960}, 0, 1},
#endif
// Comfort noise for three different sampling frequencies.
{1, {240}, 240, 1},
@ -162,6 +247,7 @@ WebRtcNetEQDecoder ACMCodecDB::neteq_decoders_[] = {
kDecoderPCM16Bwb,
kDecoderPCM16Bswb32kHz,
#endif
// G.711, PCM mu-las and A-law.
kDecoderPCMu,
kDecoderPCMa,
#ifdef WEBRTC_CODEC_ILBC
@ -189,6 +275,9 @@ WebRtcNetEQDecoder ACMCodecDB::neteq_decoders_[] = {
#ifdef WEBRTC_CODEC_G729
kDecoderG729,
#endif
#ifdef WEBRTC_CODEC_G729_1
kDecoderG729_1,
#endif
#ifdef WEBRTC_CODEC_GSMFR
kDecoderGSMFR,
#endif
@ -196,6 +285,7 @@ WebRtcNetEQDecoder ACMCodecDB::neteq_decoders_[] = {
kDecoderSPEEX_8,
kDecoderSPEEX_16,
#endif
// Comfort noise for three different sampling frequencies.
kDecoderCNG,
kDecoderCNG,
kDecoderCNG,
@ -362,6 +452,18 @@ int ACMCodecDB::CodecNumber(const CodecInst* codec_inst, int* mirror_id) {
} else if (STR_CASE_CMP("ilbc", codec_inst->plname) == 0) {
return IsILBCRateValid(codec_inst->rate, codec_inst->pacsize)
? codec_number : kInvalidRate;
} else if (STR_CASE_CMP("amr", codec_inst->plname) == 0) {
return IsAMRRateValid(codec_inst->rate)
? codec_number : kInvalidRate;
} else if (STR_CASE_CMP("amr-wb", codec_inst->plname) == 0) {
return IsAMRwbRateValid(codec_inst->rate)
? codec_number : kInvalidRate;
} else if (STR_CASE_CMP("g7291", codec_inst->plname) == 0) {
return IsG7291RateValid(codec_inst->rate)
? codec_number : kInvalidRate;
} else if (STR_CASE_CMP("speex", codec_inst->plname) == 0) {
return IsSpeexRateValid(codec_inst->rate)
? codec_number : kInvalidRate;
}
return IsRateValid(codec_number, codec_inst->rate) ?
@ -468,12 +570,44 @@ int ACMCodecDB::CodecsVersion(char* version, size_t* remaining_buffer_bytes,
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "\n", remaining_size);
#endif
#ifdef WEBRTC_CODEC_AMR
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "AMR\t\tX.X.X\n", remaining_size);
#endif
#ifdef WEBRTC_CODEC_AMRWB
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "AMR-WB\t\tX.X.X\n", remaining_size);
#endif
#ifdef WEBRTC_CODEC_G722
remaining_size = kVersionBufferSize - strlen(versions_buffer);
WebRtcG722_Version(version_num_buf, kTemporaryBufferSize);
strncat(versions_buffer, "G.722\t\t", remaining_size);
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, version_num_buf, remaining_size);
#endif
#ifdef WEBRTC_CODEC_G722_1
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "G.722.1\t\tX.X.X\n", remaining_size);
#endif
#ifdef WEBRTC_CODEC_G722_1C
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "G.722.1C\tX.X.X\n", remaining_size);
#endif
#ifdef WEBRTC_CODEC_G729
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "G.729\t\tX.X.X\n", remaining_size);
#endif
#ifdef WEBRTC_CODEC_G729_1
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "G.729.1\t\tX.X.X\n", remaining_size);
#endif
#ifdef WEBRTC_CODEC_GSMFR
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "GSM-FR\t\tX.X.X\n", remaining_size);
#endif
#ifdef WEBRTC_CODEC_SPEEX
remaining_size = kVersionBufferSize - strlen(versions_buffer);
strncat(versions_buffer, "Speex\t\tX.X.X\n", remaining_size);
#endif
remaining_size = kVersionBufferSize - strlen(versions_buffer);
WebRtcCng_Version(version_num_buf);
@ -518,10 +652,114 @@ ACMGenericCodec* ACMCodecDB::CreateCodecInstance(const CodecInst* codec_inst) {
} else if (!STR_CASE_CMP(codec_inst->plname, "ILBC")) {
#ifdef WEBRTC_CODEC_ILBC
return new ACMILBC(kILBC);
#endif
} else if (!STR_CASE_CMP(codec_inst->plname, "AMR")) {
#ifdef WEBRTC_CODEC_AMR
return new ACMAMR(kGSMAMR);
#endif
} else if (!STR_CASE_CMP(codec_inst->plname, "AMR-WB")) {
#ifdef WEBRTC_CODEC_AMRWB
return new ACMAMRwb(kGSMAMRWB);
#endif
} else if (!STR_CASE_CMP(codec_inst->plname, "G722")) {
#ifdef WEBRTC_CODEC_G722
return new ACMG722(kG722);
#endif
} else if (!STR_CASE_CMP(codec_inst->plname, "G7221")) {
switch (codec_inst->plfreq) {
case 16000: {
#ifdef WEBRTC_CODEC_G722_1
int codec_id;
switch (codec_inst->rate) {
case 16000 : {
codec_id = kG722_1_16;
break;
}
case 24000 : {
codec_id = kG722_1_24;
break;
}
case 32000 : {
codec_id = kG722_1_32;
break;
}
default: {
return NULL;
}
return new ACMG722_1(codec_id);
}
#endif
}
case 32000: {
#ifdef WEBRTC_CODEC_G722_1C
int codec_id;
switch (codec_inst->rate) {
case 24000 : {
codec_id = kG722_1C_24;
break;
}
case 32000 : {
codec_id = kG722_1C_32;
break;
}
case 48000 : {
codec_id = kG722_1C_48;
break;
}
default: {
return NULL;
}
return new ACMG722_1C(codec_id);
}
#endif
}
}
} else if (!STR_CASE_CMP(codec_inst->plname, "CN")) {
// For CN we need to check sampling frequency to know what codec to create.
int codec_id;
switch (codec_inst->plfreq) {
case 8000: {
codec_id = kCNNB;
break;
}
case 16000: {
codec_id = kCNWB;
break;
}
case 32000: {
codec_id = kCNSWB;
break;
}
default: {
return NULL;
}
}
return new ACMCNG(codec_id);
} else if (!STR_CASE_CMP(codec_inst->plname, "G729")) {
#ifdef WEBRTC_CODEC_G729
return new ACMG729(kG729);
#endif
} else if (!STR_CASE_CMP(codec_inst->plname, "G7291")) {
#ifdef WEBRTC_CODEC_G729_1
return new ACMG729_1(kG729_1);
#endif
} else if (!STR_CASE_CMP(codec_inst->plname, "speex")) {
#ifdef WEBRTC_CODEC_SPEEX
int codec_id;
switch (codec_inst->plfreq) {
case 8000: {
codec_id = kSPEEX8;
break;
}
case 16000: {
codec_id = kSPEEX16;
break;
}
default: {
return NULL;
}
}
return new ACMSPEEX(codec_id);
#endif
} else if (!STR_CASE_CMP(codec_inst->plname, "CN")) {
// For CN we need to check sampling frequency to know what codec to create.
@ -610,6 +848,76 @@ bool ACMCodecDB::IsILBCRateValid(int rate, int frame_size_samples) {
}
}
// Check if the bitrate is valid for the GSM-AMR.
bool ACMCodecDB::IsAMRRateValid(int rate) {
switch (rate) {
case 4750:
case 5150:
case 5900:
case 6700:
case 7400:
case 7950:
case 10200:
case 12200: {
return true;
}
default: {
return false;
}
}
}
// Check if the bitrate is valid for GSM-AMR-WB.
bool ACMCodecDB::IsAMRwbRateValid(int rate) {
switch (rate) {
case 7000:
case 9000:
case 12000:
case 14000:
case 16000:
case 18000:
case 20000:
case 23000:
case 24000: {
return true;
}
default: {
return false;
}
}
}
// Check if the bitrate is valid for G.729.1.
bool ACMCodecDB::IsG7291RateValid(int rate) {
switch (rate) {
case 8000:
case 12000:
case 14000:
case 16000:
case 18000:
case 20000:
case 22000:
case 24000:
case 26000:
case 28000:
case 30000:
case 32000: {
return true;
}
default: {
return false;
}
}
}
// Checks if the bitrate is valid for Speex.
bool ACMCodecDB::IsSpeexRateValid(int rate) {
if (rate > 2000) {
return true;
} else {
return false;
}
}
// Checks if the payload type is in the valid range.
bool ACMCodecDB::ValidPayloadType(int payload_type) {
if ((payload_type < 0) || (payload_type > 127)) {

View File

@ -67,6 +67,9 @@ class ACMCodecDB {
#ifdef WEBRTC_CODEC_G729
, kG729
#endif
#ifdef WEBRTC_CODEC_G729_1
, kG729_1
#endif
#ifdef WEBRTC_CODEC_GSMFR
, kGSMFR
#endif
@ -125,6 +128,9 @@ class ACMCodecDB {
#ifndef WEBRTC_CODEC_G729
enum {kG729 = -1};
#endif
#ifndef WEBRTC_CODEC_G729_1
enum {kG729_1 = -1};
#endif
#ifndef WEBRTC_CODEC_GSMFR
enum {kGSMFR = -1};
#endif
@ -266,6 +272,10 @@ class ACMCodecDB {
static bool IsRateValid(int codec_id, int rate);
static bool IsISACRateValid(int rate);
static bool IsILBCRateValid(int rate, int frame_size_samples);
static bool IsAMRRateValid(int rate);
static bool IsAMRwbRateValid(int rate);
static bool IsG7291RateValid(int rate);
static bool IsSpeexRateValid(int rate);
// Check if the payload type is valid, meaning that it is in the valid range
// of 0 to 127.

View File

@ -8,16 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "acm_g722.h"
#include "acm_codec_database.h"
#include "acm_common_defs.h"
#include "acm_g722.h"
#include "acm_neteq.h"
#include "trace.h"
#include "webrtc_neteq.h"
#include "webrtc_neteq_help_macros.h"
#include "g722_interface.h"
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_G722

View File

@ -16,8 +16,7 @@
typedef struct WebRtcG722EncInst G722EncInst;
typedef struct WebRtcG722DecInst G722DecInst;
namespace webrtc
{
namespace webrtc {
// forward declaration
struct ACMG722EncStr;

View File

@ -8,22 +8,79 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "acm_g7221.h"
#include "acm_codec_database.h"
#include "acm_common_defs.h"
#include "acm_g7221.h"
#include "acm_neteq.h"
#include "trace.h"
#include "webrtc_neteq.h"
#include "webrtc_neteq_help_macros.h"
#ifdef WEBRTC_CODEC_G722_1
// NOTE! G.722.1 is not included in the open-source package. Modify this file or your codec
// API to match the function call and name of used G.722.1 API file.
// #include "g7221_interface.h"
// NOTE! G.722.1 is not included in the open-source package. A wrapper is
// needed with interface file named as below. The API should match the one
// below.
//
// int16_t WebRtcG7221_CreateEnc16(G722_1_16_encinst_t_** encInst);
// int16_t WebRtcG7221_CreateEnc24(G722_1_24_encinst_t_** encInst);
// int16_t WebRtcG7221_CreateEnc32(G722_1_32_encinst_t_** encInst);
// int16_t WebRtcG7221_CreateDec16(G722_1_16_decinst_t_** decInst);
// int16_t WebRtcG7221_CreateDec24(G722_1_24_decinst_t_** decInst);
// int16_t WebRtcG7221_CreateDec32(G722_1_32_decinst_t_** decInst);
//
// int16_t WebRtcG7221_FreeEnc16(G722_1_16_encinst_t_** encInst);
// int16_t WebRtcG7221_FreeEnc24(G722_1_24_encinst_t_** encInst);
// int16_t WebRtcG7221_FreeEnc32(G722_1_32_encinst_t_** encInst);
// int16_t WebRtcG7221_FreeDec16(G722_1_16_decinst_t_** decInst);
// int16_t WebRtcG7221_FreeDec24(G722_1_24_decinst_t_** decInst);
// int16_t WebRtcG7221_FreeDec32(G722_1_32_decinst_t_** decInst);
//
// int16_t WebRtcG7221_EncoderInit16(G722_1_16_encinst_t_* encInst);
// int16_t WebRtcG7221_EncoderInit24(G722_1_24_encinst_t_* encInst);
// int16_t WebRtcG7221_EncoderInit32(G722_1_32_encinst_t_* encInst);
// int16_t WebRtcG7221_DecoderInit16(G722_1_16_decinst_t_* decInst);
// int16_t WebRtcG7221_DecoderInit24(G722_1_24_decinst_t_* decInst);
// int16_t WebRtcG7221_DecoderInit32(G722_1_32_decinst_t_* decInst);
//
// int16_t WebRtcG7221_Encode16(G722_1_16_encinst_t_* encInst,
// int16_t* input,
// int16_t len,
// int16_t* output);
// int16_t WebRtcG7221_Encode24(G722_1_24_encinst_t_* encInst,
// int16_t* input,
// int16_t len,
// int16_t* output);
// int16_t WebRtcG7221_Encode32(G722_1_32_encinst_t_* encInst,
// int16_t* input,
// int16_t len,
// int16_t* output);
//
// int16_t WebRtcG7221_Decode16(G722_1_16_decinst_t_* decInst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
// int16_t WebRtcG7221_Decode24(G722_1_24_decinst_t_* decInst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
// int16_t WebRtcG7221_Decode32(G722_1_32_decinst_t_* decInst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
//
// int16_t WebRtcG7221_DecodePlc16(G722_1_16_decinst_t_* decInst,
// int16_t* output,
// int16_t nrLostFrames);
// int16_t WebRtcG7221_DecodePlc24(G722_1_24_decinst_t_* decInst,
// int16_t* output,
// int16_t nrLostFrames);
// int16_t WebRtcG7221_DecodePlc32(G722_1_32_decinst_t_* decInst,
// int16_t* output,
// int16_t nrLostFrames);
#include "g7221_interface.h"
#endif
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_G722_1
@ -138,67 +195,6 @@ ACMG722_1::UnregisterFromNetEqSafe(
#else //===================== Actual Implementation =======================
// Remove when integrating a real G.722.1 wrapper
struct G722_1_Inst_t_;
extern WebRtc_Word16 WebRtcG7221_CreateEnc16(G722_1_16_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221_CreateEnc24(G722_1_24_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221_CreateEnc32(G722_1_32_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221_CreateDec16(G722_1_16_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221_CreateDec24(G722_1_24_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221_CreateDec32(G722_1_32_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221_FreeEnc16(G722_1_16_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221_FreeEnc24(G722_1_24_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221_FreeEnc32(G722_1_32_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221_FreeDec16(G722_1_16_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221_FreeDec24(G722_1_24_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221_FreeDec32(G722_1_32_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221_EncoderInit16(G722_1_16_encinst_t_* encInst);
extern WebRtc_Word16 WebRtcG7221_EncoderInit24(G722_1_24_encinst_t_* encInst);
extern WebRtc_Word16 WebRtcG7221_EncoderInit32(G722_1_32_encinst_t_* encInst);
extern WebRtc_Word16 WebRtcG7221_DecoderInit16(G722_1_16_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcG7221_DecoderInit24(G722_1_24_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcG7221_DecoderInit32(G722_1_32_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcG7221_Encode16(G722_1_16_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221_Encode24(G722_1_24_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221_Encode32(G722_1_32_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221_Decode16(G722_1_16_decinst_t_* decInst,
WebRtc_Word16* bitstream,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221_Decode24(G722_1_24_decinst_t_* decInst,
WebRtc_Word16* bitstream,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221_Decode32(G722_1_32_decinst_t_* decInst,
WebRtc_Word16* bitstream,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221_DecodePlc16(G722_1_16_decinst_t_* decInst,
WebRtc_Word16* output,
WebRtc_Word16 nrLostFrames);
extern WebRtc_Word16 WebRtcG7221_DecodePlc24(G722_1_24_decinst_t_* decInst,
WebRtc_Word16* output,
WebRtc_Word16 nrLostFrames);
extern WebRtc_Word16 WebRtcG7221_DecodePlc32(G722_1_32_decinst_t_* decInst,
WebRtc_Word16* output,
WebRtc_Word16 nrLostFrames);
ACMG722_1::ACMG722_1(
WebRtc_Word16 codecID):
_encoderInstPtr(NULL),
@ -215,15 +211,15 @@ _decoderInst24Ptr(NULL),
_decoderInst32Ptr(NULL)
{
_codecID = codecID;
if(_codecID == ACMCodecDB::g722_1_16)
if(_codecID == ACMCodecDB::kG722_1_16)
{
_operationalRate = 16000;
}
else if(_codecID == ACMCodecDB::g722_1_24)
else if(_codecID == ACMCodecDB::kG722_1_24)
{
_operationalRate = 24000;
}
else if(_codecID == ACMCodecDB::g722_1_32)
else if(_codecID == ACMCodecDB::kG722_1_32)
{
_operationalRate = 32000;
}
@ -242,7 +238,7 @@ ACMG722_1::~ACMG722_1()
_encoderInstPtr = NULL;
}
if(_encoderInstPtrRight != NULL)
{
{Inst
delete _encoderInstPtrRight;
_encoderInstPtrRight = NULL;
}
@ -308,7 +304,7 @@ ACMG722_1::InternalEncode(
switch(_operationalRate)
{
case 16000:
{
{Inst
lenInBytes = WebRtcG7221_Encode16(_encoderInst16Ptr,
leftChannel, 320, &outB[0]);
if (_noChannels == 2)
@ -407,7 +403,7 @@ ACMG722_1::InternalInitEncoder(
}
default:
{
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
WEBRTC_TRACE(webrtc::kTraceError,Inst webrtc::kTraceAudioCoding, _uniqueID,
"InternalInitEncoder: Wrong rate for G722_1.");
return -1;
break;

View File

@ -13,21 +13,16 @@
#include "acm_generic_codec.h"
namespace webrtc
{
// forward declaration
struct G722_1_16_encinst_t_;
struct G722_1_16_decinst_t_;
struct G722_1_24_encinst_t_;
struct G722_1_24_decinst_t_;
struct G722_1_32_encinst_t_;
struct G722_1_32_decinst_t_;
struct G722_1_Inst_t_;
namespace webrtc {
class ACMG722_1 : public ACMGenericCodec
{

View File

@ -8,22 +8,79 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "acm_g7221c.h"
#include "acm_codec_database.h"
#include "acm_common_defs.h"
#include "acm_g7221c.h"
#include "acm_neteq.h"
#include "webrtc_neteq.h"
#include "webrtc_neteq_help_macros.h"
#include "trace.h"
#ifdef WEBRTC_CODEC_G722_1C
// NOTE! G.722.1C is not included in the open-source package. Modify this file or your
// codec API to match the function call and name of used G.722.1C API file.
// #include "g7221C_interface.h"
// NOTE! G.722.1C is not included in the open-source package. A wrapper is
// needed with interface file named as below. The API should match the one
// below.
//
// int16_t WebRtcG7221C_CreateEnc24(G722_1C_24_encinst_t_** encInst);
// int16_t WebRtcG7221C_CreateEnc32(G722_1C_32_encinst_t_** encInst);
// int16_t WebRtcG7221C_CreateEnc48(G722_1C_48_encinst_t_** encInst);
// int16_t WebRtcG7221C_CreateDec24(G722_1C_24_decinst_t_** decInst);
// int16_t WebRtcG7221C_CreateDec32(G722_1C_32_decinst_t_** decInst);
// int16_t WebRtcG7221C_CreateDec48(G722_1C_48_decinst_t_** decInst);
//
// int16_t WebRtcG7221C_FreeEnc24(G722_1C_24_encinst_t_** encInst);
// int16_t WebRtcG7221C_FreeEnc32(G722_1C_32_encinst_t_** encInst);
// int16_t WebRtcG7221C_FreeEnc48(G722_1C_48_encinst_t_** encInst);
// int16_t WebRtcG7221C_FreeDec24(G722_1C_24_decinst_t_** decInst);
// int16_t WebRtcG7221C_FreeDec32(G722_1C_32_decinst_t_** decInst);
// int16_t WebRtcG7221C_FreeDec48(G722_1C_48_decinst_t_** decInst);
//
// int16_t WebRtcG7221C_EncoderInit24(G722_1C_24_encinst_t_* encInst);
// int16_t WebRtcG7221C_EncoderInit32(G722_1C_32_encinst_t_* encInst);
// int16_t WebRtcG7221C_EncoderInit48(G722_1C_48_encinst_t_* encInst);
// int16_t WebRtcG7221C_DecoderInit24(G722_1C_24_decinst_t_* decInst);
// int16_t WebRtcG7221C_DecoderInit32(G722_1C_32_decinst_t_* decInst);
// int16_t WebRtcG7221C_DecoderInit48(G722_1C_48_decinst_t_* decInst);
//
// int16_t WebRtcG7221C_Encode24(G722_1C_24_encinst_t_* encInst,
// int16_t* input,
// int16_t len,
// int16_t* output);
// int16_t WebRtcG7221C_Encode32(G722_1C_32_encinst_t_* encInst,
// int16_t* input,
// int16_t len,
// int16_t* output);
// int16_t WebRtcG7221C_Encode48(G722_1C_48_encinst_t_* encInst,
// int16_t* input,
// int16_t len,
// int16_t* output);
//
// int16_t WebRtcG7221C_Decode24(G722_1C_24_decinst_t_* decInst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
// int16_t WebRtcG7221C_Decode32(G722_1C_32_decinst_t_* decInst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
// int16_t WebRtcG7221C_Decode48(G722_1C_48_decinst_t_* decInst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
//
// int16_t WebRtcG7221C_DecodePlc24(G722_1C_24_decinst_t_* decInst,
// int16_t* output,
// int16_t nrLostFrames);
// int16_t WebRtcG7221C_DecodePlc32(G722_1C_32_decinst_t_* decInst,
// int16_t* output,
// int16_t nrLostFrames);
// int16_t WebRtcG7221C_DecodePlc48(G722_1C_48_decinst_t_* decInst,
// int16_t* output,
// int16_t nrLostFrames);
#include "g7221c_interface.h"
#endif
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_G722_1C
@ -137,67 +194,6 @@ ACMG722_1C::UnregisterFromNetEqSafe(
#else //===================== Actual Implementation =======================
// Remove when integrating a real G,722.1 wrapper
struct G722_1_Inst_t_;
extern WebRtc_Word16 WebRtcG7221C_CreateEnc24(G722_1C_24_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221C_CreateEnc32(G722_1C_32_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221C_CreateEnc48(G722_1C_48_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221C_CreateDec24(G722_1C_24_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221C_CreateDec32(G722_1C_32_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221C_CreateDec48(G722_1C_48_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221C_FreeEnc24(G722_1C_24_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221C_FreeEnc32(G722_1C_32_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221C_FreeEnc48(G722_1C_48_encinst_t_** encInst);
extern WebRtc_Word16 WebRtcG7221C_FreeDec24(G722_1C_24_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221C_FreeDec32(G722_1C_32_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221C_FreeDec48(G722_1C_48_decinst_t_** decInst);
extern WebRtc_Word16 WebRtcG7221C_EncoderInit24(G722_1C_24_encinst_t_* encInst);
extern WebRtc_Word16 WebRtcG7221C_EncoderInit32(G722_1C_32_encinst_t_* encInst);
extern WebRtc_Word16 WebRtcG7221C_EncoderInit48(G722_1C_48_encinst_t_* encInst);
extern WebRtc_Word16 WebRtcG7221C_DecoderInit24(G722_1C_24_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcG7221C_DecoderInit32(G722_1C_32_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcG7221C_DecoderInit48(G722_1C_48_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcG7221C_Encode24(G722_1C_24_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221C_Encode32(G722_1C_32_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221C_Encode48(G722_1C_48_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221C_Decode24(G722_1C_24_decinst_t_* decInst,
WebRtc_Word16* bitstream,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221C_Decode32(G722_1C_32_decinst_t_* decInst,
WebRtc_Word16* bitstream,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221C_Decode48(G722_1C_48_decinst_t_* decInst,
WebRtc_Word16* bitstream,
WebRtc_Word16 len,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG7221C_DecodePlc24(G722_1C_24_decinst_t_* decInst,
WebRtc_Word16* output,
WebRtc_Word16 nrLostFrames);
extern WebRtc_Word16 WebRtcG7221C_DecodePlc32(G722_1C_32_decinst_t_* decInst,
WebRtc_Word16* output,
WebRtc_Word16 nrLostFrames);
extern WebRtc_Word16 WebRtcG7221C_DecodePlc48(G722_1C_48_decinst_t_* decInst,
WebRtc_Word16* output,
WebRtc_Word16 nrLostFrames);
ACMG722_1C::ACMG722_1C(
WebRtc_Word16 codecID):
@ -215,15 +211,15 @@ _decoderInst32Ptr(NULL),
_decoderInst48Ptr(NULL)
{
_codecID = codecID;
if(_codecID == ACMCodecDB::g722_1C_24)
if(_codecID == ACMCodecDB::kG722_1C_24)
{
_operationalRate = 24000;
}
else if(_codecID == ACMCodecDB::g722_1C_32)
else if(_codecID == ACMCodecDB::kG722_1C_32)
{
_operationalRate = 32000;
}
else if(_codecID == ACMCodecDB::g722_1C_48)
else if(_codecID == ACMCodecDB::kG722_1C_48)
{
_operationalRate = 48000;
}

View File

@ -13,21 +13,16 @@
#include "acm_generic_codec.h"
namespace webrtc
{
// forward declaration
struct G722_1C_24_encinst_t_;
struct G722_1C_24_decinst_t_;
struct G722_1C_32_encinst_t_;
struct G722_1C_32_decinst_t_;
struct G722_1C_48_encinst_t_;
struct G722_1C_48_decinst_t_;
struct G722_1_Inst_t_;
namespace webrtc {
class ACMG722_1C : public ACMGenericCodec
{

View File

@ -8,21 +8,33 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "acm_common_defs.h"
#include "acm_g729.h"
#include "acm_common_defs.h"
#include "acm_neteq.h"
#include "trace.h"
#include "webrtc_neteq.h"
#include "webrtc_neteq_help_macros.h"
#ifdef WEBRTC_CODEC_G729
// NOTE! G.729 is not included in the open-source package. Modify this file or your codec
// API to match the function call and name of used G.729 API file.
// #include "g729_interface.h"
// NOTE! G.729 is not included in the open-source package. A wrapper is
// needed with interface file named as below. The API should match the one
// below.
//
// int16_t WebRtcG729_CreateEnc(G729_encinst_t_** inst);
// int16_t WebRtcG729_CreateDec(G729_decinst_t_** inst);
// int16_t WebRtcG729_FreeEnc(G729_encinst_t_* inst);
// int16_t WebRtcG729_FreeDec(G729_decinst_t_* inst);
// int16_t WebRtcG729_Encode(G729_encinst_t_* encInst, int16_t* input,
// int16_t len, int16_t* output);
// int16_t WebRtcG729_EncoderInit(G729_encinst_t_* encInst, int16_t mode);
// int16_t WebRtcG729_Decode(G729_decinst_t_* decInst);
// int16_t WebRtcG729_DecodeBwe(G729_decinst_t_* decInst, int16_t* input);
// int16_t WebRtcG729_DecodePlc(G729_decinst_t_* decInst);
// int16_t WebRtcG729_DecoderInit(G729_decinst_t_* decInst);
#include "g729_interface.h"
#endif
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_G729
@ -167,20 +179,6 @@ ACMG729::UnregisterFromNetEqSafe(
#else //===================== Actual Implementation =======================
// Remove when integrating a real GSM FR wrapper
extern WebRtc_Word16 WebRtcG729_CreateEnc(G729_encinst_t_** inst);
extern WebRtc_Word16 WebRtcG729_CreateDec(G729_decinst_t_** inst);
extern WebRtc_Word16 WebRtcG729_FreeEnc(G729_encinst_t_* inst);
extern WebRtc_Word16 WebRtcG729_FreeDec(G729_decinst_t_* inst);
extern WebRtc_Word16 WebRtcG729_Encode(G729_encinst_t_* encInst, WebRtc_Word16* input,
WebRtc_Word16 len, WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcG729_EncoderInit(G729_encinst_t_* encInst, WebRtc_Word16 mode);
extern WebRtc_Word16 WebRtcG729_Decode(G729_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcG729_DecodeBwe(G729_decinst_t_* decInst, WebRtc_Word16* input);
extern WebRtc_Word16 WebRtcG729_DecodePlc(G729_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcG729_DecoderInit(G729_decinst_t_* decInst);
ACMG729::ACMG729(
WebRtc_Word16 codecID):
_encoderInstPtr(NULL),

View File

@ -17,8 +17,7 @@
struct G729_encinst_t_;
struct G729_decinst_t_;
namespace webrtc
{
namespace webrtc {
class ACMG729 : public ACMGenericCodec
{

View File

@ -8,21 +8,33 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "acm_common_defs.h"
#include "acm_g7291.h"
#include "acm_common_defs.h"
#include "acm_neteq.h"
#include "trace.h"
#include "webrtc_neteq.h"
#include "webrtc_neteq_help_macros.h"
#ifdef WEBRTC_CODEC_G729_1
// NOTE! G.729.1 is not included in the open-source package. Modify this file or your codec
// API to match the function call and name of used G.729.1 API file.
// #include "g7291_interface.h"
// NOTE! G.729.1 is not included in the open-source package. A wrapper is
// needed with interface file named as below. The API should match the one
// below.
//
// int16_t WebRtcG7291_Create(G729_1_inst_t_** inst);
// int16_t WebRtcG7291_Free(G729_1_inst_t_* inst);
// int16_t WebRtcG7291_Encode(G729_1_inst_t_* encInst, int16_t* input,
// int16_t* output, int16_t myRate,
// int16_t nrFrames);
// int16_t WebRtcG7291_EncoderInit(G729_1_inst_t_* encInst, int16_t myRate,
// int16_t flag8kHz, int16_t flagG729mode);
// int16_t WebRtcG7291_Decode(G729_1_inst_t_* decInst);
// int16_t WebRtcG7291_DecodeBwe(G729_1_inst_t_* decInst, int16_t* input);
// int16_t WebRtcG7291_DecodePlc(G729_1_inst_t_* decInst);
// int16_t WebRtcG7291_DecoderInit(G729_1_inst_t_* decInst);
#include "g7291_interface.h"
#endif
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_G729_1
@ -145,24 +157,7 @@ ACMG729_1::SetBitRateSafe(
#else //===================== Actual Implementation =======================
// Remove when integrating a real GSM AMR wrapper
struct G729_1_inst_t_;
extern WebRtc_Word16 WebRtcG7291_Create(G729_1_inst_t_** inst);
extern WebRtc_Word16 WebRtcG7291_Free(G729_1_inst_t_* inst);
extern WebRtc_Word16 WebRtcG7291_Encode(G729_1_inst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16* output,
WebRtc_Word16 myRate,
WebRtc_Word16 nrFrames);
extern WebRtc_Word16 WebRtcG7291_EncoderInit(G729_1_inst_t_* encInst,
WebRtc_Word16 myRate,
WebRtc_Word16 flag8kHz,
WebRtc_Word16 flagG729mode);
extern WebRtc_Word16 WebRtcG7291_Decode(G729_1_inst_t_* decInst);
extern WebRtc_Word16 WebRtcG7291_DecodeBwe(G729_1_inst_t_* decInst, WebRtc_Word16* input);
extern WebRtc_Word16 WebRtcG7291_DecodePlc(G729_1_inst_t_* decInst);
extern WebRtc_Word16 WebRtcG7291_DecoderInit(G729_1_inst_t_* decInst);
ACMG729_1::ACMG729_1(
WebRtc_Word16 codecID):
@ -206,7 +201,6 @@ ACMG729_1::InternalEncode(
// Initialize before entering the loop
WebRtc_Word16 noEncodedSamples = 0;
WebRtc_Word16 tmpLenByte = 0;
*bitStreamLenByte = 0;
WebRtc_Word16 byteLengthFrame = 0;
@ -413,8 +407,10 @@ WebRtc_Word16
ACMG729_1::SetBitRateSafe(
const WebRtc_Word32 rate)
{
//allowed rates: { 8000, 12000, 14000, 16000, 18000, 20000,
//allowed rates: { 8000, 12000, 14000, 16000, 18000, 20000,
// 22000, 24000, 26000, 28000, 30000, 32000};
// TODO(tlegrand): This check exists in one other place two. Should be
// possible to reuse code.
switch(rate)
{
case 8000:

View File

@ -13,13 +13,12 @@
#include "acm_generic_codec.h"
namespace webrtc
{
// forward declaration
struct G729_1_inst_t_;
struct G729_1_inst_t_;
namespace webrtc {
class ACMG729_1: public ACMGenericCodec
{
public:

View File

@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "acm_gsmfr.h"
#include "acm_common_defs.h"
#include "acm_gsmfr.h"
#include "acm_neteq.h"
@ -16,13 +17,25 @@
#include "webrtc_neteq_help_macros.h"
#ifdef WEBRTC_CODEC_GSMFR
// NOTE! GSM-FR is not included in the open-source package. Modify this file or your codec
// API to match the function call and name of used GSM-FR API file.
// #include "gsmfr_interface.h"
// NOTE! GSM-FR is not included in the open-source package. A wrapper is
// needed with interface file named as below. The API should match the one
// below.
//
// int16_t WebRtcGSMFR_CreateEnc(GSMFR_encinst_t_** inst);
// int16_t WebRtcGSMFR_CreateDec(GSMFR_decinst_t_** inst);
// int16_t WebRtcGSMFR_FreeEnc(GSMFR_encinst_t_* inst);
// int16_t WebRtcGSMFR_FreeDec(GSMFR_decinst_t_* inst);
// int16_t WebRtcGSMFR_Encode(GSMFR_encinst_t_* encInst, int16_t* input,
// int16_t len, int16_t* output);
// int16_t WebRtcGSMFR_EncoderInit(GSMFR_encinst_t_* encInst, int16_t mode);
// int16_t WebRtcGSMFR_Decode(GSMFR_decinst_t_* decInst);
// int16_t WebRtcGSMFR_DecodeBwe(GSMFR_decinst_t_* decInst, int16_t* input);
// int16_t WebRtcGSMFR_DecodePlc(GSMFR_decinst_t_* decInst);
// int16_t WebRtcGSMFR_DecoderInit(GSMFR_decinst_t_* decInst);
#include "gsmfr_interface.h"
#endif
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_GSMFR
@ -153,19 +166,6 @@ ACMGSMFR::UnregisterFromNetEqSafe(
#else //===================== Actual Implementation =======================
// Remove when integrating a real GSM FR wrapper
extern WebRtc_Word16 WebRtcGSMFR_CreateEnc(GSMFR_encinst_t_** inst);
extern WebRtc_Word16 WebRtcGSMFR_CreateDec(GSMFR_decinst_t_** inst);
extern WebRtc_Word16 WebRtcGSMFR_FreeEnc(GSMFR_encinst_t_* inst);
extern WebRtc_Word16 WebRtcGSMFR_FreeDec(GSMFR_decinst_t_* inst);
extern WebRtc_Word16 WebRtcGSMFR_Encode(GSMFR_encinst_t_* encInst, WebRtc_Word16* input,
WebRtc_Word16 len, WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcGSMFR_EncoderInit(GSMFR_encinst_t_* encInst, WebRtc_Word16 mode);
extern WebRtc_Word16 WebRtcGSMFR_Decode(GSMFR_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcGSMFR_DecodeBwe(GSMFR_decinst_t_* decInst, WebRtc_Word16* input);
extern WebRtc_Word16 WebRtcGSMFR_DecodePlc(GSMFR_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcGSMFR_DecoderInit(GSMFR_decinst_t_* decInst);
ACMGSMFR::ACMGSMFR(
WebRtc_Word16 codecID):
_encoderInstPtr(NULL),

View File

@ -13,13 +13,12 @@
#include "acm_generic_codec.h"
namespace webrtc
{
// forward declaration
struct GSMFR_encinst_t_;
struct GSMFR_decinst_t_;
namespace webrtc {
class ACMGSMFR : public ACMGenericCodec
{
public:

View File

@ -8,23 +8,44 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "acm_speex.h"
#include "acm_codec_database.h"
#include "acm_common_defs.h"
#include "acm_neteq.h"
#include "acm_speex.h"
#include "trace.h"
#include "webrtc_neteq.h"
#include "webrtc_neteq_help_macros.h"
#ifdef WEBRTC_CODEC_SPEEX
// NOTE! Speex is not included in the open-source package. Modify this file or your codec
// API to match the function call and name of used Speex API file.
// #include "speex_interface.h"
// NOTE! Speex is not included in the open-source package. A wrapper is
// needed with interface file named as below. The API should match the one
// below.
//
// int16_t WebRtcSpeex_CreateEnc(SPEEX_encinst_t **SPEEXenc_inst,
// int32_t fs);
// int16_t WebRtcSpeex_FreeEnc(SPEEX_encinst_t *SPEEXenc_inst);
// int16_t WebRtcSpeex_CreateDec(SPEEX_decinst_t **SPEEXdec_inst,
// int32_t fs,
// int16_t enh_enabled);
// int16_t WebRtcSpeex_FreeDec(SPEEX_decinst_t *SPEEXdec_inst);
// int16_t WebRtcSpeex_Encode(SPEEX_encinst_t *SPEEXenc_inst,
// int16_t *speechIn,
// int32_t rate);
// int16_t WebRtcSpeex_EncoderInit(SPEEX_encinst_t *SPEEXenc_inst,
// int16_t vbr, int16_t complexity,
// int16_t vad_enable);
// int16_t WebRtcSpeex_GetBitstream(SPEEX_encinst_t *SPEEXenc_inst,
// int16_t *encoded);
// int16_t WebRtcSpeex_DecodePlc(SPEEX_decinst_t *SPEEXdec_inst,
// int16_t *decoded, int16_t noOfLostFrames);
// int16_t WebRtcSpeex_Decode(SPEEX_decinst_t *SPEEXdec_inst,
// int16_t *encoded, int16_t len,
// int16_t *decoded, int16_t *speechType);
// int16_t WebRtcSpeex_DecoderInit(SPEEX_decinst_t *SPEEXdec_inst);
#include "speex_interface.h"
#endif
namespace webrtc
{
namespace webrtc {
#ifndef WEBRTC_CODEC_SPEEX
ACMSPEEX::ACMSPEEX(WebRtc_Word16 /* codecID*/)
@ -166,27 +187,6 @@ ACMSPEEX::SetComplMode(
#else //===================== Actual Implementation =======================
// Remove when integrating a real Speex wrapper
extern WebRtc_Word16 WebRtcSpeex_CreateEnc(SPEEX_encinst_t_** inst,
WebRtc_Word16 samplFreq);
extern WebRtc_Word16 WebRtcSpeex_CreateDec(SPEEX_decinst_t_** inst,
WebRtc_Word16 samplFreq,
WebRtc_Word16 mode);
extern WebRtc_Word16 WebRtcSpeex_FreeEnc(SPEEX_encinst_t_* inst);
extern WebRtc_Word16 WebRtcSpeex_FreeDec(SPEEX_decinst_t_* inst);
extern WebRtc_Word16 WebRtcSpeex_Encode(SPEEX_encinst_t_* encInst,
WebRtc_Word16* input,
WebRtc_Word16 rate);
extern WebRtc_Word16 WebRtcSpeex_EncoderInit(SPEEX_encinst_t_* encInst,
WebRtc_Word16 samplFreq,
WebRtc_Word16 mode,
WebRtc_Word16 vbrFlag);
extern WebRtc_Word16 WebRtcSpeex_GetBitstream(SPEEX_encinst_t_* encInst,
WebRtc_Word16* output);
extern WebRtc_Word16 WebRtcSpeex_Decode(SPEEX_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcSpeex_DecodePlc(SPEEX_decinst_t_* decInst);
extern WebRtc_Word16 WebRtcSpeex_DecoderInit(SPEEX_decinst_t_* decInst);
ACMSPEEX::ACMSPEEX(WebRtc_Word16 codecID):
_encoderInstPtr(NULL),
_decoderInstPtr(NULL)
@ -194,13 +194,13 @@ _decoderInstPtr(NULL)
_codecID = codecID;
// Set sampling frequency, frame size and rate Speex
if(_codecID == ACMCodecDB::speex8)
if(_codecID == ACMCodecDB::kSPEEX8)
{
_samplingFrequency = 8000;
_samplesIn20MsAudio = 160;
_encodingRate = 11000;
}
else if(_codecID == ACMCodecDB::speex16)
else if(_codecID == ACMCodecDB::kSPEEX16)
{
_samplingFrequency = 16000;
_samplesIn20MsAudio = 320;

View File

@ -13,13 +13,12 @@
#include "acm_generic_codec.h"
namespace webrtc
{
// forward declaration
struct SPEEX_encinst_t_;
struct SPEEX_decinst_t_;
namespace webrtc {
class ACMSPEEX : public ACMGenericCodec
{
public: