mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 11:32:25 +00:00
Remove unnecessary code relating to PLC.
The logic for handling generic PLC is now handled in ast_write in channel.c instead of in translation code. Review: https://reviewboard.asterisk.org/r/683/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267492 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -293,7 +293,6 @@ static struct ast_translator adpcmtolin = {
|
||||
.desc_size = sizeof(struct adpcm_decoder_pvt),
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
.buf_size = BUFFER_SAMPLES * 2,
|
||||
.plc_samples = 160,
|
||||
};
|
||||
|
||||
static struct ast_translator lintoadpcm = {
|
||||
@@ -308,28 +307,9 @@ static struct ast_translator lintoadpcm = {
|
||||
.buf_size = BUFFER_SAMPLES/ 2, /* 2 samples per byte */
|
||||
};
|
||||
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
struct ast_variable *var;
|
||||
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
||||
return 0;
|
||||
for (var = ast_variable_browse(cfg, "plc"); var ; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
adpcmtolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "codec_adpcm: %susing generic PLC\n", adpcmtolin.useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief standard module glue */
|
||||
static int reload(void)
|
||||
{
|
||||
if (parse_config(1))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -347,8 +327,6 @@ static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
res = ast_register_translator(&adpcmtolin);
|
||||
if (!res)
|
||||
res = ast_register_translator(&lintoadpcm);
|
||||
|
||||
@@ -79,7 +79,6 @@ static struct ast_translator alawtolin = {
|
||||
.sample = alaw_sample,
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
.buf_size = BUFFER_SAMPLES * 2,
|
||||
.plc_samples = 160,
|
||||
};
|
||||
|
||||
static struct ast_translator lintoalaw = {
|
||||
@@ -92,29 +91,10 @@ static struct ast_translator lintoalaw = {
|
||||
.buf_size = BUFFER_SAMPLES,
|
||||
};
|
||||
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
||||
return 0;
|
||||
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
alawtolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "codec_alaw: %susing generic PLC\n", alawtolin.useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief standard module stuff */
|
||||
|
||||
static int reload(void)
|
||||
{
|
||||
if (parse_config(1))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -132,8 +112,6 @@ static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
res = ast_register_translator(&alawtolin);
|
||||
if (!res)
|
||||
res = ast_register_translator(&lintoalaw);
|
||||
|
||||
@@ -56,8 +56,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#define G723_SAMPLES 240
|
||||
#define G729_SAMPLES 160
|
||||
|
||||
static unsigned int global_useplc = 0;
|
||||
|
||||
static struct channel_usage {
|
||||
int total;
|
||||
int encoders;
|
||||
@@ -489,29 +487,14 @@ static int register_translator(int dst, int src)
|
||||
if (is_encoder(zt)) {
|
||||
zt->t.framein = dahdi_encoder_framein;
|
||||
zt->t.frameout = dahdi_encoder_frameout;
|
||||
#if 0
|
||||
zt->t.buffer_samples = 0;
|
||||
#endif
|
||||
} else {
|
||||
zt->t.framein = dahdi_decoder_framein;
|
||||
zt->t.frameout = dahdi_decoder_frameout;
|
||||
#if 0
|
||||
if (AST_FORMAT_G723_1 == zt->t.srcfmt) {
|
||||
zt->t.plc_samples = G723_SAMPLES;
|
||||
} else {
|
||||
zt->t.plc_samples = G729_SAMPLES;
|
||||
}
|
||||
zt->t.buffer_samples = zt->t.plc_samples * 8;
|
||||
#endif
|
||||
}
|
||||
zt->t.destroy = dahdi_destroy;
|
||||
zt->t.buffer_samples = 0;
|
||||
zt->t.newpvt = dahdi_new;
|
||||
zt->t.sample = fakesrc_sample;
|
||||
#if 0
|
||||
zt->t.useplc = global_useplc;
|
||||
#endif
|
||||
zt->t.useplc = 0;
|
||||
zt->t.native_plc = 0;
|
||||
|
||||
zt->t.desc_size = sizeof(struct codec_dahdi_pvt);
|
||||
@@ -563,27 +546,6 @@ static void unregister_translators(void)
|
||||
AST_LIST_UNLOCK(&translators);
|
||||
}
|
||||
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
|
||||
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
||||
return 0;
|
||||
|
||||
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
global_useplc = ast_true(var->value);
|
||||
ast_verb(3, "codec_dahdi: %susing generic PLC\n",
|
||||
global_useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void build_translators(struct format_map *map, unsigned int dstfmts, unsigned int srcfmts)
|
||||
{
|
||||
unsigned int src, dst;
|
||||
@@ -660,14 +622,6 @@ static int reload(void)
|
||||
{
|
||||
struct translator *cur;
|
||||
|
||||
if (parse_config(1))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
|
||||
AST_LIST_LOCK(&translators);
|
||||
AST_LIST_TRAVERSE(&translators, cur, entry)
|
||||
cur->t.useplc = global_useplc;
|
||||
AST_LIST_UNLOCK(&translators);
|
||||
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -682,8 +636,6 @@ static int unload_module(void)
|
||||
static int load_module(void)
|
||||
{
|
||||
ast_ulaw_init();
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
find_transcoders();
|
||||
ast_cli_register_multiple(cli, ARRAY_LEN(cli));
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
|
||||
@@ -142,7 +142,6 @@ static struct ast_translator g722tolin = {
|
||||
.desc_size = sizeof(struct g722_decoder_pvt),
|
||||
.buffer_samples = BUFFER_SAMPLES / sizeof(int16_t),
|
||||
.buf_size = BUFFER_SAMPLES,
|
||||
.plc_samples = 160,
|
||||
};
|
||||
|
||||
static struct ast_translator lintog722 = {
|
||||
@@ -167,7 +166,6 @@ static struct ast_translator g722tolin16 = {
|
||||
.desc_size = sizeof(struct g722_decoder_pvt),
|
||||
.buffer_samples = BUFFER_SAMPLES / sizeof(int16_t),
|
||||
.buf_size = BUFFER_SAMPLES,
|
||||
.plc_samples = 160,
|
||||
};
|
||||
|
||||
static struct ast_translator lin16tog722 = {
|
||||
@@ -182,29 +180,8 @@ static struct ast_translator lin16tog722 = {
|
||||
.buf_size = BUFFER_SAMPLES,
|
||||
};
|
||||
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
|
||||
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
||||
return 0;
|
||||
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
g722tolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "codec_g722: %susing generic PLC\n",
|
||||
g722tolin.useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reload(void)
|
||||
{
|
||||
if (parse_config(1))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -224,9 +201,6 @@ static int load_module(void)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
|
||||
res |= ast_register_translator(&g722tolin);
|
||||
res |= ast_register_translator(&lintog722);
|
||||
res |= ast_register_translator(&g722tolin16);
|
||||
|
||||
@@ -779,7 +779,6 @@ static struct ast_translator g726tolin = {
|
||||
.desc_size = sizeof(struct g726_coder_pvt),
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
.buf_size = BUFFER_SAMPLES * 2,
|
||||
.plc_samples = 160,
|
||||
};
|
||||
|
||||
static struct ast_translator lintog726 = {
|
||||
@@ -804,7 +803,6 @@ static struct ast_translator g726aal2tolin = {
|
||||
.desc_size = sizeof(struct g726_coder_pvt),
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
.buf_size = BUFFER_SAMPLES * 2,
|
||||
.plc_samples = 160,
|
||||
};
|
||||
|
||||
static struct ast_translator lintog726aal2 = {
|
||||
@@ -819,29 +817,8 @@ static struct ast_translator lintog726aal2 = {
|
||||
.buf_size = BUFFER_SAMPLES / 2,
|
||||
};
|
||||
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
|
||||
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
||||
return 0;
|
||||
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
g726tolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "codec_g726: %susing generic PLC\n",
|
||||
g726tolin.useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reload(void)
|
||||
{
|
||||
if (parse_config(1))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -862,10 +839,6 @@ static int load_module(void)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
|
||||
res |= ast_register_translator(&g726tolin);
|
||||
res |= ast_register_translator(&lintog726);
|
||||
|
||||
|
||||
@@ -177,7 +177,6 @@ static struct ast_translator gsmtolin = {
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
.buf_size = BUFFER_SAMPLES * 2,
|
||||
.desc_size = sizeof (struct gsm_translator_pvt ),
|
||||
.plc_samples = GSM_SAMPLES,
|
||||
};
|
||||
|
||||
static struct ast_translator lintogsm = {
|
||||
@@ -193,30 +192,9 @@ static struct ast_translator lintogsm = {
|
||||
.buf_size = (BUFFER_SAMPLES * GSM_FRAME_LEN + GSM_SAMPLES - 1)/GSM_SAMPLES,
|
||||
};
|
||||
|
||||
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
||||
return 0;
|
||||
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
gsmtolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "codec_gsm: %susing generic PLC\n", gsmtolin.useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief standard module glue */
|
||||
static int reload(void)
|
||||
{
|
||||
if (parse_config(1)) {
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -235,8 +213,6 @@ static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
res = ast_register_translator(&gsmtolin);
|
||||
if (!res)
|
||||
res=ast_register_translator(&lintogsm);
|
||||
|
||||
@@ -201,7 +201,6 @@ static struct ast_translator lpc10tolin = {
|
||||
.sample = lpc10_sample,
|
||||
.desc_size = sizeof(struct lpc10_coder_pvt),
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
.plc_samples = LPC10_SAMPLES_PER_FRAME,
|
||||
.buf_size = BUFFER_SAMPLES * 2,
|
||||
};
|
||||
|
||||
@@ -219,28 +218,8 @@ static struct ast_translator lintolpc10 = {
|
||||
.buf_size = LPC10_BYTES_IN_COMPRESSED_FRAME * (1 + BUFFER_SAMPLES / LPC10_SAMPLES_PER_FRAME),
|
||||
};
|
||||
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
||||
return 0;
|
||||
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
lpc10tolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "codec_lpc10: %susing generic PLC\n",
|
||||
lpc10tolin.useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reload(void)
|
||||
{
|
||||
if (parse_config(1))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -259,8 +238,6 @@ static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
res = ast_register_translator(&lpc10tolin);
|
||||
if (!res)
|
||||
res = ast_register_translator(&lintolpc10);
|
||||
|
||||
@@ -84,7 +84,6 @@ static struct ast_translator ulawtolin = {
|
||||
.sample = ulaw_sample,
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
.buf_size = BUFFER_SAMPLES * 2,
|
||||
.plc_samples = 160,
|
||||
};
|
||||
|
||||
static struct ast_translator testlawtolin = {
|
||||
@@ -95,7 +94,6 @@ static struct ast_translator testlawtolin = {
|
||||
.sample = ulaw_sample,
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
.buf_size = BUFFER_SAMPLES * 2,
|
||||
.plc_samples = 160,
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -122,27 +120,8 @@ static struct ast_translator lintotestlaw = {
|
||||
.buffer_samples = BUFFER_SAMPLES,
|
||||
};
|
||||
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
|
||||
return 0;
|
||||
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
ulawtolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "codec_ulaw: %susing generic PLC\n", ulawtolin.useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reload(void)
|
||||
{
|
||||
if (parse_config(1))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -162,8 +141,6 @@ static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
res = ast_register_translator(&ulawtolin);
|
||||
if (!res) {
|
||||
res = ast_register_translator(&lintoulaw);
|
||||
|
||||
Reference in New Issue
Block a user