summaryrefslogtreecommitdiff
path: root/include/asterisk/frame.h
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-08-29 20:50:36 +0000
committerRussell Bryant <russell@russellbryant.com>2006-08-29 20:50:36 +0000
commitf7e7161607512ae516d4a3976048e2f0d29e5449 (patch)
tree0f3fc04bcb07ac328d54ffb2fed0333dfffb44de /include/asterisk/frame.h
parentd22476348a5f38ddb6eab59fa743c7f67eb5710f (diff)
Merge team/russell/frame_caching
There are some situations in Asterisk where ast_frame and/or iax_frame structures are rapidly allocatted and freed (at least 50 times per second for one call). This code significantly improves the performance of ast_frame_header_new(), ast_frdup(), ast_frfree(), iax_frame_new(), and iax_frame_free() by keeping a thread-local cache of these structures and using frames from the cache whenever possible instead of calling malloc/free every time. This commit also converts the ast_frame and iax_frame structures to use the linked list macros. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41278 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/frame.h')
-rw-r--r--include/asterisk/frame.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index 35cd30ac6..0c9c651d2 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -32,6 +32,7 @@ extern "C" {
#include <sys/types.h>
#include <sys/time.h>
#include "asterisk/endian.h"
+#include "asterisk/linkedlists.h"
struct ast_codec_pref {
char order[32];
@@ -97,6 +98,8 @@ struct ast_frame {
int samples;
/*! Was the data malloc'd? i.e. should we free it when we discard the frame? */
int mallocd;
+ /*! The number of bytes allocated for a malloc'd frame header */
+ size_t mallocd_hdr_len;
/*! How many bytes exist _before_ "data" that can be used if needed */
int offset;
/*! Optional source of frame for debugging */
@@ -105,10 +108,8 @@ struct ast_frame {
void *data;
/*! Global delivery time */
struct timeval delivery;
- /*! Next/Prev for linking stand alone frames */
- struct ast_frame *prev;
- /*! Next/Prev for linking stand alone frames */
- struct ast_frame *next;
+ /*! For placing in a linked list */
+ AST_LIST_ENTRY(ast_frame) frame_list;
/*! Timing data flag */
int has_timing_info;
/*! Timestamp in milliseconds */