aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-12-20 13:07:02 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-12-20 13:07:02 +0000
commitbe3c78074ebefa914ddaaed7fe175b2cdda3aad3 (patch)
tree837b83b927428cf5737bb9d5fe34d3c5f4f82187 /channel.c
parentcabac00beeb882f9cdbb3d8375dd1215face1b27 (diff)
Major peformance improvements to meetme
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7547 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rw-r--r--channel.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/channel.c b/channel.c
index e573e855e..078b9e541 100644
--- a/channel.c
+++ b/channel.c
@@ -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);