summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2011-02-22 23:04:49 +0000
committerDavid Vossel <dvossel@digium.com>2011-02-22 23:04:49 +0000
commitd760e81f37b231a99865a40f67838c51079ed4f8 (patch)
treeb061487de973558358757bd1b6e457aaccf41638 /funcs
parent736133f874f270be81810c2c1fb36c47e6a479bf (diff)
Media Project Phase2: SILK 8khz-24khz, SLINEAR 8khz-192khz, SPEEX 32khz, hd audio ConfBridge, and other stuff
-Functional changes 1. Dynamic global format list build by codecs defined in codecs.conf 2. SILK 8khz, 12khz, 16khz, and 24khz with custom attributes defined in codecs.conf 3. Negotiation of SILK attributes in chan_sip. 4. SPEEX 32khz with translation 5. SLINEAR 8khz, 12khz, 24khz, 32khz, 44.1khz, 48khz, 96khz, 192khz with translation using codec_resample.c 6. Various changes to RTP code required to properly handle the dynamic format list and formats with attributes. 7. ConfBridge now dynamically jumps to the best possible sample rate. This allows for conferences to take advantage of HD audio (Which sounds awesome) 8. Audiohooks are no longer limited to 8khz audio, and most effects have been updated to take advantage of this such as Volume, DENOISE, PITCH_SHIFT. 9. codec_resample now uses its own code rather than depending on libresample. -Organizational changes Global format list is moved from frame.c to format.c Various format specific functions moved from frame.c to format.c Review: https://reviewboard.asterisk.org/r/1104/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@308582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_pitchshift.c5
-rw-r--r--funcs/func_speex.c10
-rw-r--r--funcs/func_volume.c2
3 files changed, 9 insertions, 8 deletions
diff --git a/funcs/func_pitchshift.c b/funcs/func_pitchshift.c
index 36fa2f6c4..b14894712 100644
--- a/funcs/func_pitchshift.c
+++ b/funcs/func_pitchshift.c
@@ -170,8 +170,7 @@ static int pitchshift_cb(struct ast_audiohook *audiohook, struct ast_channel *ch
}
if ((audiohook->status == AST_AUDIOHOOK_STATUS_DONE) ||
(f->frametype != AST_FRAME_VOICE) ||
- ((f->subclass.format.id != AST_FORMAT_SLINEAR) &&
- (f->subclass.format.id != AST_FORMAT_SLINEAR16))) {
+ !(ast_format_is_slinear(&f->subclass.format))) {
return -1;
}
@@ -209,7 +208,7 @@ static int pitchshift_helper(struct ast_channel *chan, const char *cmd, char *da
return 0;
}
- ast_audiohook_init(&shift->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "pitch_shift");
+ ast_audiohook_init(&shift->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "pitch_shift", AST_AUDIOHOOK_MANIPULATE_ALL_RATES);
shift->audiohook.manipulate_callback = pitchshift_cb;
datastore->data = shift;
new = 1;
diff --git a/funcs/func_speex.c b/funcs/func_speex.c
index 4b8b3a3d6..51cea99e1 100644
--- a/funcs/func_speex.c
+++ b/funcs/func_speex.c
@@ -105,6 +105,7 @@ struct speex_direction_info {
struct speex_info {
struct ast_audiohook audiohook;
+ int lastrate;
struct speex_direction_info *tx, *rx;
};
@@ -163,12 +164,13 @@ static int speex_callback(struct ast_audiohook *audiohook, struct ast_channel *c
return -1;
}
- if (sdi->samples != frame->samples) {
+ if ((sdi->samples != frame->samples) || (ast_format_rate(&frame->subclass.format) != si->lastrate)) {
+ si->lastrate = ast_format_rate(&frame->subclass.format);
if (sdi->state) {
speex_preprocess_state_destroy(sdi->state);
}
- if (!(sdi->state = speex_preprocess_state_init((sdi->samples = frame->samples), 8000))) {
+ if (!(sdi->state = speex_preprocess_state_init((sdi->samples = frame->samples), si->lastrate))) {
return -1;
}
@@ -212,9 +214,9 @@ static int speex_write(struct ast_channel *chan, const char *cmd, char *data, co
return 0;
}
- ast_audiohook_init(&si->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "speex");
+ ast_audiohook_init(&si->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "speex", AST_AUDIOHOOK_MANIPULATE_ALL_RATES);
si->audiohook.manipulate_callback = speex_callback;
-
+ si->lastrate = 8000;
is_new = 1;
} else {
ast_channel_unlock(chan);
diff --git a/funcs/func_volume.c b/funcs/func_volume.c
index 88153f603..e94a4edc7 100644
--- a/funcs/func_volume.c
+++ b/funcs/func_volume.c
@@ -132,7 +132,7 @@ static int volume_write(struct ast_channel *chan, const char *cmd, char *data, c
ast_datastore_free(datastore);
return 0;
}
- ast_audiohook_init(&vi->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "Volume");
+ ast_audiohook_init(&vi->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "Volume", AST_AUDIOHOOK_MANIPULATE_ALL_RATES);
vi->audiohook.manipulate_callback = volume_callback;
ast_set_flag(&vi->audiohook, AST_AUDIOHOOK_WANTS_DTMF);
is_new = 1;