diff options
author | Mark Spencer <markster@digium.com> | 2005-12-20 13:07:02 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2005-12-20 13:07:02 +0000 |
commit | d6b8ce392180cf2a2e348619f56c4139b3a55862 (patch) | |
tree | 837b83b927428cf5737bb9d5fe34d3c5f4f82187 /channel.c | |
parent | 74460d2e8b2363bb002087c8e916287f9855ab8b (diff) |
Major peformance improvements to meetme
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7547 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channel.c')
-rw-r--r-- | channel.c | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -1773,7 +1773,7 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd) return 0; /* Time is up */ } -struct ast_frame *ast_read(struct ast_channel *chan) +static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) { struct ast_frame *f = NULL; int blah; @@ -1897,7 +1897,10 @@ struct ast_frame *ast_read(struct ast_channel *chan) if (f && (f->frametype == AST_FRAME_VOICE)) { - if (!(f->subclass & chan->nativeformats)) { + if (dropaudio) { + ast_frfree(f); + f = &null_frame; + } else if (!(f->subclass & chan->nativeformats)) { /* This frame can't be from the current native formats -- drop it on the floor */ ast_log(LOG_NOTICE, "Dropping incompatible voice frame on %s of format %s since our native format has changed to %s\n", chan->name, ast_getformatname(f->subclass), ast_getformatname(chan->nativeformats)); @@ -1998,6 +2001,16 @@ struct ast_frame *ast_read(struct ast_channel *chan) return f; } +struct ast_frame *ast_read(struct ast_channel *chan) +{ + return __ast_read(chan, 0); +} + +struct ast_frame *ast_read_noaudio(struct ast_channel *chan) +{ + return __ast_read(chan, 1); +} + int ast_indicate(struct ast_channel *chan, int condition) { int res = -1; @@ -2247,7 +2260,12 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) break; default: if (chan->tech->write) { - f = (chan->writetrans) ? ast_translate(chan->writetrans, fr, 0) : fr; + /* Bypass translator if we're writing format in the raw write format. This + allows mixing of native / non-native formats */ + if (fr->subclass == chan->rawwriteformat) + f = fr; + else + f = (chan->writetrans) ? ast_translate(chan->writetrans, fr, 0) : fr; if (f) { if (f->frametype == AST_FRAME_VOICE && chan->spies) queue_frame_to_spies(chan, f, SPY_WRITE); |