codecs: Add Codec 2 mode 2400.

ASTERISK-26217 #close

Change-Id: I1e45d8084683fab5f2b272bf35f4a149cea8b8d6
This commit is contained in:
Alexander Traud
2016-07-19 20:14:21 +02:00
parent 943bb48b59
commit 2e79f52d71
10 changed files with 446 additions and 1 deletions

View File

@@ -107,6 +107,30 @@ static struct ast_codec g723 = {
.get_length = g723_length,
};
static int codec2_samples(struct ast_frame *frame)
{
return 160 * (frame->datalen / 6);
}
static int codec2_length(unsigned int samples)
{
return (samples / 160) * 6;
}
static struct ast_codec codec2 = {
.name = "codec2",
.description = "Codec 2",
.type = AST_MEDIA_TYPE_AUDIO,
.sample_rate = 8000,
.minimum_ms = 20,
.maximum_ms = 300,
.default_ms = 20,
.minimum_bytes = 6,
.samples_count = codec2_samples,
.get_length = codec2_length,
.smooth = 1,
};
static int none_samples(struct ast_frame *frame)
{
return frame->datalen;
@@ -863,6 +887,7 @@ int ast_codec_builtin_init(void)
{
int res = 0;
res |= CODEC_REGISTER_AND_CACHE(codec2);
res |= CODEC_REGISTER_AND_CACHE(g723);
res |= CODEC_REGISTER_AND_CACHE(ulaw);
res |= CODEC_REGISTER_AND_CACHE(alaw);