diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-31 17:18:58 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-31 17:18:58 +0000 |
commit | b55d2bd3eaca8d5775ab0e8db5b85fa3f1066ce1 (patch) | |
tree | 5d573d837383e784c67dabc01fcfad5e8aec9801 /channels | |
parent | d00a87e2dcf7407f81d62d682474784cedb5a141 (diff) |
define a global null_frame object so when queueing a null frame, you don't
have to allocate one on the stack
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9001 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_agent.c | 10 | ||||
-rw-r--r-- | channels/chan_features.c | 3 | ||||
-rw-r--r-- | channels/chan_h323.c | 5 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 3 | ||||
-rw-r--r-- | channels/chan_sip.c | 7 |
5 files changed, 11 insertions, 17 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 3299aa02e..e99a6f483 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -438,7 +438,6 @@ static struct ast_frame *agent_read(struct ast_channel *ast) { struct agent_pvt *p = ast->tech_pvt; struct ast_frame *f = NULL; - static struct ast_frame null_frame = { AST_FRAME_NULL, }; static struct ast_frame answer_frame = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER }; const char *status; ast_mutex_lock(&p->lock); @@ -448,7 +447,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast) p->chan->fdno = (ast->fdno == AST_AGENT_FD) ? AST_TIMING_FD : ast->fdno; f = ast_read(p->chan); } else - f = &null_frame; + f = &ast_null_frame; if (!f) { /* If there's a channel, hang it up (if it's on a callback) make it NULL */ if (p->chan) { @@ -486,7 +485,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast) ast_verbose(VERBOSE_PREFIX_3 "%s answered, waiting for '#' to acknowledge\n", p->chan->name); /* Don't pass answer along */ ast_frfree(f); - f = &null_frame; + f = &ast_null_frame; } else { p->acknowledged = 1; /* Use the builtin answer frame for the @@ -513,7 +512,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast) /* don't pass voice until the call is acknowledged */ if (!p->acknowledged) { ast_frfree(f); - f = &null_frame; + f = &ast_null_frame; } break; } @@ -899,7 +898,6 @@ static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct static struct ast_channel *agent_new(struct agent_pvt *p, int state) { struct ast_channel *tmp; - struct ast_frame null_frame = { AST_FRAME_NULL }; #if 0 if (!p->chan) { ast_log(LOG_WARNING, "No channel? :(\n"); @@ -950,7 +948,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state) if( ast_mutex_trylock(&p->app_lock) ) { if (p->chan) { - ast_queue_frame(p->chan, &null_frame); + ast_queue_frame(p->chan, &ast_null_frame); ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */ ast_mutex_lock(&p->app_lock); ast_mutex_lock(&p->lock); diff --git a/channels/chan_features.c b/channels/chan_features.c index 7eef2e990..5f6ff2ca6 100644 --- a/channels/chan_features.c +++ b/channels/chan_features.c @@ -241,12 +241,11 @@ static int features_answer(struct ast_channel *ast) static struct ast_frame *features_read(struct ast_channel *ast) { - static struct ast_frame null_frame = { AST_FRAME_NULL, }; struct feature_pvt *p = ast->tech_pvt; struct ast_frame *f; int x; - f = &null_frame; + f = &ast_null_frame; ast_mutex_lock(&p->lock); x = indexof(p, ast, 0); if (!x && p->subchan) { diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 43d7a2414..a4a9459b1 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -543,7 +543,6 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *pvt) { /* Retrieve audio/etc from channel. Assumes pvt->lock is already held. */ struct ast_frame *f; - static struct ast_frame null_frame = { AST_FRAME_NULL, }; /* Only apply it for the first packet, we just need the correct ip/port */ if (pvt->options.nat) { @@ -554,7 +553,7 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *pvt) f = ast_rtp_read(pvt->rtp); /* Don't send RFC2833 if we're not supposed to */ if (f && (f->frametype == AST_FRAME_DTMF) && !(pvt->options.dtmfmode & H323_DTMF_RFC2833)) { - return &null_frame; + return &ast_null_frame; } if (pvt->owner) { /* We already hold the channel lock */ @@ -563,7 +562,7 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *pvt) /* Try to avoid deadlock */ if (ast_mutex_trylock(&pvt->owner->lock)) { ast_log(LOG_NOTICE, "Format changed but channel is locked. Ignoring frame...\n"); - return &null_frame; + return &ast_null_frame; } ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass); pvt->owner->nativeformats = f->subclass; diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 845cfa9a1..65f614580 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1219,12 +1219,11 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub) { /* Retrieve audio/etc from channel. Assumes sub->lock is already held. */ struct ast_frame *f; - static struct ast_frame null_frame = { AST_FRAME_NULL, }; f = ast_rtp_read(sub->rtp); /* Don't send RFC2833 if we're not supposed to */ if (f && (f->frametype == AST_FRAME_DTMF) && !(sub->parent->dtmfmode & MGCP_DTMF_RFC2833)) - return &null_frame; + return &ast_null_frame; if (sub->owner) { /* We already hold the channel lock */ if (f->frametype == AST_FRAME_VOICE) { diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d0a8ed24b..3a1b36b1d 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3051,11 +3051,10 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p { /* Retrieve audio/etc from channel. Assumes p->lock is already held. */ struct ast_frame *f; - static struct ast_frame null_frame = { AST_FRAME_NULL, }; if (!p->rtp) { /* We have no RTP allocated for this channel */ - return &null_frame; + return &ast_null_frame; } switch(ast->fdno) { @@ -3072,11 +3071,11 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p f = ast_rtcp_read(p->vrtp); /* RTCP Control Channel for video */ break; default: - f = &null_frame; + f = &ast_null_frame; } /* Don't forward RFC2833 if we're not supposed to */ if (f && (f->frametype == AST_FRAME_DTMF) && (ast_test_flag(p, SIP_DTMF) != SIP_DTMF_RFC2833)) - return &null_frame; + return &ast_null_frame; if (p->owner) { /* We already hold the channel lock */ |