[asterisk-commits] kpfleming: branch 1.4 r49465 -
/branches/1.4/channels/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jan 4 11:31:56 MST 2007
Author: kpfleming
Date: Thu Jan 4 12:31:55 2007
New Revision: 49465
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49465
Log:
only do IAX2 frame caching for voice and video frames
Modified:
branches/1.4/channels/chan_iax2.c
branches/1.4/channels/iax2-parser.c
branches/1.4/channels/iax2-parser.h
Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=49465&r1=49464&r2=49465
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Thu Jan 4 12:31:55 2007
@@ -1094,7 +1094,7 @@
static struct iax_frame *iaxfrdup2(struct iax_frame *fr)
{
- struct iax_frame *new = iax_frame_new(DIRECTION_INGRESS, fr->af.datalen);
+ struct iax_frame *new = iax_frame_new(DIRECTION_INGRESS, fr->af.datalen, fr->cacheable);
if (new) {
size_t mallocd_datalen = new->mallocd_datalen;
memcpy(new, fr, sizeof(*new));
@@ -3832,7 +3832,7 @@
if (now) {
fr = &frb.fr2;
} else
- fr = iax_frame_new(DIRECTION_OUTGRESS, ast_test_flag(pvt, IAX_ENCRYPTED) ? f->datalen + 32 : f->datalen);
+ fr = iax_frame_new(DIRECTION_OUTGRESS, ast_test_flag(pvt, IAX_ENCRYPTED) ? f->datalen + 32 : f->datalen, (f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_VIDEO));
if (!fr) {
ast_log(LOG_WARNING, "Out of memory\n");
return -1;
Modified: branches/1.4/channels/iax2-parser.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/iax2-parser.c?view=diff&rev=49465&r1=49464&r2=49465
==============================================================================
--- branches/1.4/channels/iax2-parser.c (original)
+++ branches/1.4/channels/iax2-parser.c Thu Jan 4 12:31:55 2007
@@ -939,7 +939,7 @@
}
}
-struct iax_frame *iax_frame_new(int direction, int datalen)
+struct iax_frame *iax_frame_new(int direction, int datalen, unsigned int cacheable)
{
struct iax_frame *fr = NULL;
@@ -969,6 +969,7 @@
fr->direction = direction;
fr->retrans = -1;
+ fr->cacheable = cacheable;
if (fr->direction == DIRECTION_INGRESS)
ast_atomic_fetchadd_int(&iframes, 1);
@@ -996,7 +997,7 @@
ast_atomic_fetchadd_int(&frames, -1);
#if !defined(LOW_MEMORY)
- if (!(iax_frames = ast_threadstorage_get(&frame_cache, sizeof(*iax_frames)))) {
+ if (!fr->cacheable || !(iax_frames = ast_threadstorage_get(&frame_cache, sizeof(*iax_frames)))) {
free(fr);
return;
}
Modified: branches/1.4/channels/iax2-parser.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/iax2-parser.h?view=diff&rev=49465&r1=49464&r2=49465
==============================================================================
--- branches/1.4/channels/iax2-parser.h (original)
+++ branches/1.4/channels/iax2-parser.h Thu Jan 4 12:31:55 2007
@@ -101,19 +101,21 @@
/* How long to wait before retrying */
int retrytime;
/* Are we received out of order? */
- int outoforder;
+ unsigned int outoforder:1;
/* Have we been sent at all yet? */
- int sentyet;
+ unsigned int sentyet:1;
+ /* Non-zero if should be sent to transfer peer */
+ unsigned int transfer:1;
+ /* Non-zero if this is the final message */
+ unsigned int final:1;
+ /* Ingress or outgres */
+ unsigned int direction:2;
+ /* Can this frame be cached? */
+ unsigned int cacheable:1;
/* Outgoing Packet sequence number */
int oseqno;
/* Next expected incoming packet sequence number */
int iseqno;
- /* Non-zero if should be sent to transfer peer */
- int transfer;
- /* Non-zero if this is the final message */
- int final;
- /* Ingress or outgres */
- int direction;
/* Retransmission ID */
int retrans;
/* Easy linking */
@@ -153,6 +155,6 @@
int iax_get_oframes(void);
void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f);
-struct iax_frame *iax_frame_new(int direction, int datalen);
+struct iax_frame *iax_frame_new(int direction, int datalen, unsigned int cacheable);
void iax_frame_free(struct iax_frame *fr);
#endif
More information about the asterisk-commits
mailing list