]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
codecs: Remove test-law.
authorAlexander Traud <pabstraud@compuserve.com>
Tue, 1 Dec 2020 14:11:58 +0000 (15:11 +0100)
committerJoshua Colp <jcolp@sangoma.com>
Mon, 4 Jan 2021 11:00:58 +0000 (05:00 -0600)
This was dead code, test code introduced with Asterisk 13. This was
found while analyzing ASTERISK_28416 and ASTERISK_29185. This change
partly fixes, not closes those two issues.

Change-Id: I42d0daa37f6f334c7d86672f06f085858a3f3940

channels/iax2/codec_pref.c
channels/iax2/format_compatibility.c
codecs/codec_ulaw.c
include/asterisk/format_cache.h
include/asterisk/format_compatibility.h
main/codec_builtin.c
main/format_cache.c
main/format_compatibility.c

index 7811ca86b2103ef79d01c4e71668aaed76a5f2a8..684f921a524c2a7131be66fe09eb0eee106bd00d 100644 (file)
@@ -348,7 +348,7 @@ static const uint64_t iax2_supported_formats[] = {
        AST_FORMAT_T140,
        AST_FORMAT_SIREN7,
        AST_FORMAT_SIREN14,
-       AST_FORMAT_TESTLAW,
+       0, /* reserved; was AST_FORMAT_TESTLAW */
        AST_FORMAT_G719,
        0, /* Place holder */
        0, /* Place holder */
index 1543792a9d74d01ce9022aaa42fec725ef956ac3..2325dd83e75c9c0137ba5fd20f89bf7c89955550 100644 (file)
@@ -91,7 +91,6 @@ uint64_t iax2_format_compatibility_best(uint64_t formats)
                AST_FORMAT_G719,
                AST_FORMAT_SIREN14,
                AST_FORMAT_SIREN7,
-               AST_FORMAT_TESTLAW,
                /*! G.722 is better then all below, but not as common as the above... so give ulaw and alaw priority */
                AST_FORMAT_G722,
                /*! Okay, well, signed linear is easy to translate into other stuff */
index 609d06d60dfc2e3dbc53e093a822dcaaee6599c1..00a0916ae502c186585cc529613892a55c8930fa 100644 (file)
@@ -97,25 +97,6 @@ static struct ast_translator ulawtolin = {
        .buf_size = BUFFER_SAMPLES * 2,
 };
 
-static struct ast_translator testlawtolin = {
-       .name = "testlawtolin",
-       .src_codec = {
-               .name = "testlaw",
-               .type = AST_MEDIA_TYPE_AUDIO,
-               .sample_rate = 8000,
-       },
-       .dst_codec = {
-               .name = "slin",
-               .type = AST_MEDIA_TYPE_AUDIO,
-               .sample_rate = 8000,
-       },
-       .format = "slin",
-       .framein = ulawtolin_framein,
-       .sample = ulaw_sample,
-       .buffer_samples = BUFFER_SAMPLES,
-       .buf_size = BUFFER_SAMPLES * 2,
-};
-
 /*!
  * \brief The complete translator for LinToulaw.
  */
@@ -139,33 +120,12 @@ static struct ast_translator lintoulaw = {
        .buffer_samples = BUFFER_SAMPLES,
 };
 
-static struct ast_translator lintotestlaw = {
-       .name = "lintotestlaw",
-       .src_codec = {
-               .name = "slin",
-               .type = AST_MEDIA_TYPE_AUDIO,
-               .sample_rate = 8000,
-       },
-       .dst_codec = {
-               .name = "testlaw",
-               .type = AST_MEDIA_TYPE_AUDIO,
-               .sample_rate = 8000,
-       },
-       .format = "testlaw",
-       .framein = lintoulaw_framein,
-       .sample = slin8_sample,
-       .buf_size = BUFFER_SAMPLES,
-       .buffer_samples = BUFFER_SAMPLES,
-};
-
 static int unload_module(void)
 {
        int res;
 
        res = ast_unregister_translator(&lintoulaw);
        res |= ast_unregister_translator(&ulawtolin);
-       res |= ast_unregister_translator(&testlawtolin);
-       res |= ast_unregister_translator(&lintotestlaw);
 
        return res;
 }
@@ -176,8 +136,6 @@ static int load_module(void)
 
        res = ast_register_translator(&ulawtolin);
        res |= ast_register_translator(&lintoulaw);
-       res |= ast_register_translator(&lintotestlaw);
-       res |= ast_register_translator(&testlawtolin);
 
        if (res) {
                unload_module();
index 7dc0276de4fd4e4d2cb056e56641845d55591ed8..33033da62c42ef7bc152dfc85c6be6905764ee50 100644 (file)
@@ -83,11 +83,6 @@ extern struct ast_format *ast_format_ulaw;
  */
 extern struct ast_format *ast_format_alaw;
 
-/*!
- * \brief Built-in cached testlaw format.
- */
-extern struct ast_format *ast_format_testlaw;
-
 /*!
  * \brief Built-in cached gsm format.
  */
index 0420ec69d9773428397108910f1212fa9270027f..e6a99b3cc8ad42fa37bc39f747490687a59cbca6 100644 (file)
@@ -72,7 +72,7 @@ struct ast_codec;
 /*! Opus audio (8kHz, 16kHz, 24kHz, 48Khz) */
 #define AST_FORMAT_OPUS (1ULL << 34)
 /*! Raw testing-law data (G.711) */
-#define AST_FORMAT_TESTLAW (1ULL << 47)
+/* #define AST_FORMAT_TESTLAW (1ULL << 47) */
 /*! H.261 Video */
 #define AST_FORMAT_H261 (1ULL << 18)
 /*! H.263 Video */
index ce65754fe449b5d50c8730a30a8e94cb5afee632..c1ae685b18288a075ecdb93548168a99ea44817b 100644 (file)
@@ -702,20 +702,6 @@ static struct ast_codec siren14 = {
        .get_length = siren14_length,
 };
 
-static struct ast_codec testlaw = {
-       .name = "testlaw",
-       .description = "G.711 test-law",
-       .type = AST_MEDIA_TYPE_AUDIO,
-       .sample_rate = 8000,
-       .minimum_ms = 10,
-       .maximum_ms = 150,
-       .default_ms = 20,
-       .minimum_bytes = 80,
-       .samples_count = ulaw_samples,
-       .get_length = ulaw_length,
-       .smooth = 1,
-};
-
 static int g719_samples(struct ast_frame *frame)
 {
        return (int) frame->datalen * ((float) 48000 / 8000);
@@ -969,7 +955,6 @@ int ast_codec_builtin_init(void)
        res |= CODEC_REGISTER_AND_CACHE(g722);
        res |= CODEC_REGISTER_AND_CACHE(siren7);
        res |= CODEC_REGISTER_AND_CACHE(siren14);
-       res |= CODEC_REGISTER_AND_CACHE(testlaw);
        res |= CODEC_REGISTER_AND_CACHE(g719);
        res |= CODEC_REGISTER_AND_CACHE(opus);
        res |= CODEC_REGISTER_AND_CACHE(jpeg);
index 3ce8ee02bc88825c8431e04cb610870a1f153b6a..f1a7fdac07aced908ef281932360c9f808af46c6 100644 (file)
@@ -90,11 +90,6 @@ struct ast_format *ast_format_ulaw;
  */
 struct ast_format *ast_format_alaw;
 
-/*!
- * \brief Built-in cached testlaw format.
- */
-struct ast_format *ast_format_testlaw;
-
 /*!
  * \brief Built-in cached gsm format.
  */
@@ -343,7 +338,6 @@ static void format_cache_shutdown(void)
        ao2_replace(ast_format_g722, NULL);
        ao2_replace(ast_format_siren7, NULL);
        ao2_replace(ast_format_siren14, NULL);
-       ao2_replace(ast_format_testlaw, NULL);
        ao2_replace(ast_format_g719, NULL);
        ao2_replace(ast_format_opus, NULL);
        ao2_replace(ast_format_codec2, NULL);
@@ -434,8 +428,6 @@ static void set_cached_format(const char *name, struct ast_format *format)
                ao2_replace(ast_format_siren7, format);
        } else if (!strcmp(name, "siren14")) {
                ao2_replace(ast_format_siren14, format);
-       } else if (!strcmp(name, "testlaw")) {
-               ao2_replace(ast_format_testlaw, format);
        } else if (!strcmp(name, "g719")) {
                ao2_replace(ast_format_g719, format);
        } else if (!strcmp(name, "opus")) {
index 706e1b25819d2e21818211ee61776e4e2dd84361..7f2faa735c03a7f635b35be878bf65743f6232b4 100644 (file)
@@ -76,8 +76,6 @@ uint64_t ast_format_compatibility_format2bitfield(const struct ast_format *forma
                return AST_FORMAT_SPEEX16;
        } else if (ast_format_cmp(format, ast_format_opus) == AST_FORMAT_CMP_EQUAL) {
                return AST_FORMAT_OPUS;
-       } else if (ast_format_cmp(format, ast_format_testlaw) == AST_FORMAT_CMP_EQUAL) {
-               return AST_FORMAT_TESTLAW;
        } else if (ast_format_cmp(format, ast_format_h261) == AST_FORMAT_CMP_EQUAL) {
                return AST_FORMAT_H261;
        } else if (ast_format_cmp(format, ast_format_h263) == AST_FORMAT_CMP_EQUAL) {
@@ -143,8 +141,6 @@ uint64_t ast_format_compatibility_codec2bitfield(const struct ast_codec *codec)
                return AST_FORMAT_SPEEX16;
        } else if (codec->id == ast_format_get_codec_id(ast_format_opus)) {
                return AST_FORMAT_OPUS;
-       } else if (codec->id == ast_format_get_codec_id(ast_format_testlaw)) {
-               return AST_FORMAT_TESTLAW;
        } else if (codec->id == ast_format_get_codec_id(ast_format_h261)) {
                return AST_FORMAT_H261;
        } else if (codec->id == ast_format_get_codec_id(ast_format_h263)) {
@@ -230,9 +226,6 @@ struct ast_format *ast_format_compatibility_bitfield2format(uint64_t bitfield)
        /*! Opus audio (8kHz, 16kHz, 24kHz, 48Khz) */
        case AST_FORMAT_OPUS:
                return ast_format_opus;
-       /*! Raw mu-law data (G.711) */
-       case AST_FORMAT_TESTLAW:
-               return ast_format_testlaw;
 
        /*! H.261 Video */
        case AST_FORMAT_H261: