summaryrefslogtreecommitdiff
path: root/main/frame.c
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-11-14 07:13:54 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-11-14 07:13:54 -0600
commit2c9c99b427b50894555029592d15f66b28b8e1e5 (patch)
tree23683a43da1b04a8eebeb0fe2a06d703a51a45b7 /main/frame.c
parentbb0d22edaa3e7f3b873ec7c9ec8bcd4aaee4114f (diff)
parentcb63ade61128834d9eb14bffc993174057a966d3 (diff)
Merge "core: Add cache_media_frames debugging option." into 15
Diffstat (limited to 'main/frame.c')
-rw-r--r--main/frame.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/main/frame.c b/main/frame.c
index 8a151eff8..dd47f42d0 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -120,14 +120,18 @@ static void __frame_free(struct ast_frame *fr, int cache)
return;
#if !defined(LOW_MEMORY)
- if (cache && fr->mallocd == AST_MALLOCD_HDR) {
+ if (fr->mallocd == AST_MALLOCD_HDR
+ && cache
+ && ast_opt_cache_media_frames) {
/* Cool, only the header is malloc'd, let's just cache those for now
* to keep things simple... */
struct ast_frame_cache *frames;
- if ((frames = ast_threadstorage_get(&frame_cache, sizeof(*frames))) &&
- (frames->size < FRAME_CACHE_MAX_SIZE)) {
- if ((fr->frametype == AST_FRAME_VOICE) || (fr->frametype == AST_FRAME_VIDEO) ||
- (fr->frametype == AST_FRAME_IMAGE)) {
+
+ frames = ast_threadstorage_get(&frame_cache, sizeof(*frames));
+ if (frames && frames->size < FRAME_CACHE_MAX_SIZE) {
+ if (fr->frametype == AST_FRAME_VOICE
+ || fr->frametype == AST_FRAME_VIDEO
+ || fr->frametype == AST_FRAME_IMAGE) {
ao2_cleanup(fr->subclass.format);
}
@@ -147,8 +151,9 @@ static void __frame_free(struct ast_frame *fr, int cache)
ast_free((void *) fr->src);
}
if (fr->mallocd & AST_MALLOCD_HDR) {
- if ((fr->frametype == AST_FRAME_VOICE) || (fr->frametype == AST_FRAME_VIDEO) ||
- (fr->frametype == AST_FRAME_IMAGE)) {
+ if (fr->frametype == AST_FRAME_VOICE
+ || fr->frametype == AST_FRAME_VIDEO
+ || fr->frametype == AST_FRAME_IMAGE) {
ao2_cleanup(fr->subclass.format);
}