[asterisk-commits] mjordan: branch group/media_formats-reviewed-trunk r418349 - in /team/group/m...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 10 13:33:14 CDT 2014


Author: mjordan
Date: Thu Jul 10 13:33:07 2014
New Revision: 418349

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418349
Log:
Remove ref bumps on a number of static frames

A first pass on removing ao2_bumps on formats assigned to statically allocated
frames. With this + opticron's previous patch, I could get a file played back
to a Local channel without crashing.

Review: https://reviewboard.asterisk.org/r/3739/


Modified:
    team/group/media_formats-reviewed-trunk/addons/chan_mobile.c
    team/group/media_formats-reviewed-trunk/apps/app_festival.c
    team/group/media_formats-reviewed-trunk/apps/app_jack.c
    team/group/media_formats-reviewed-trunk/apps/app_milliwatt.c
    team/group/media_formats-reviewed-trunk/apps/app_mp3.c
    team/group/media_formats-reviewed-trunk/apps/app_nbscat.c
    team/group/media_formats-reviewed-trunk/apps/app_sms.c
    team/group/media_formats-reviewed-trunk/channels/chan_alsa.c
    team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c
    team/group/media_formats-reviewed-trunk/channels/chan_misdn.c
    team/group/media_formats-reviewed-trunk/channels/chan_phone.c
    team/group/media_formats-reviewed-trunk/codecs/codec_dahdi.c
    team/group/media_formats-reviewed-trunk/codecs/codec_resample.c

Modified: team/group/media_formats-reviewed-trunk/addons/chan_mobile.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/addons/chan_mobile.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/addons/chan_mobile.c (original)
+++ team/group/media_formats-reviewed-trunk/addons/chan_mobile.c Thu Jul 10 13:33:07 2014
@@ -1115,7 +1115,7 @@
 
 	memset(&pvt->fr, 0x00, sizeof(struct ast_frame));
 	pvt->fr.frametype = AST_FRAME_VOICE;
-	pvt->fr.subclass.format = ao2_bump(DEVICE_FRAME_FORMAT);
+	pvt->fr.subclass.format = DEVICE_FRAME_FORMAT;
 	pvt->fr.src = "Mobile";
 	pvt->fr.offset = AST_FRIENDLY_OFFSET;
 	pvt->fr.mallocd = 0;
@@ -1130,7 +1130,6 @@
 			pvt->sco_socket = -1;
 			ast_channel_set_fd(ast, 0, -1);
 		}
-		ao2_ref(pvt->fr.subclass.format, -1);
 		goto e_return;
 	}
 

Modified: team/group/media_formats-reviewed-trunk/apps/app_festival.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_festival.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_festival.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_festival.c Thu Jul 10 13:33:07 2014
@@ -208,7 +208,7 @@
 	}
 
 	myf.f.frametype = AST_FRAME_VOICE;
-	myf.f.subclass.format = ao2_bump(ast_format_slin);
+	myf.f.subclass.format = ast_format_slin;
 	myf.f.offset = AST_FRIENDLY_OFFSET;
 	myf.f.src = __PRETTY_FUNCTION__;
 	myf.f.data.ptr = myf.frdata;

Modified: team/group/media_formats-reviewed-trunk/apps/app_jack.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_jack.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_jack.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_jack.c Thu Jul 10 13:33:07 2014
@@ -382,6 +382,7 @@
 	if (jack_data->has_audiohook)
 		ast_audiohook_destroy(&jack_data->audiohook);
 
+	ao2_cleanup(jack_data->audiohook_format);
 	ast_string_field_free_memory(jack_data);
 
 	ast_free(jack_data);
@@ -395,7 +396,6 @@
 	jack_status_t status = 0;
 	jack_options_t jack_options = JackNullOption;
 
-	struct ast_format *format_slin;
 	unsigned int channel_rate;
 
 	unsigned int ringbuffer_size;
@@ -405,9 +405,7 @@
 	*/
 	channel_rate = ast_format_get_sample_rate(ast_channel_readformat(chan));
 	jack_data->audiohook_format = ast_format_cache_get_slin_by_rate(channel_rate);
-
-	format_slin = ao2_bump(jack_data->audiohook_format_id);
-	jack_data->audiohook_rate = ast_format_get_sample_rate(&format_slin);
+	jack_data->audiohook_rate = ast_format_get_sample_rate(jack_data->audiohook_format);
 
 	/* Guessing frame->datalen assuming a ptime of 20ms */
 	jack_data->frame_datalen = jack_data->audiohook_rate / 50;
@@ -415,7 +413,7 @@
 	ringbuffer_size = jack_data->frame_datalen * RINGBUFFER_FRAME_CAPACITY;
 
 	ast_debug(1, "Audiohook parameters: slin-format:%s, rate:%d, frame-len:%d, ringbuffer_size: %d\n",
-	    ast_format_get_name(format_slin), jack_data->audiohook_rate, jack_data->frame_datalen, ringbuffer_size);
+	    ast_format_get_name(jack_data->audiohook_format), jack_data->audiohook_rate, jack_data->frame_datalen, ringbuffer_size);
 
 	if (!ast_strlen_zero(jack_data->client_name)) {
 		client_name = jack_data->client_name;

Modified: team/group/media_formats-reviewed-trunk/apps/app_milliwatt.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_milliwatt.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_milliwatt.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_milliwatt.c Thu Jul 10 13:33:07 2014
@@ -87,7 +87,7 @@
 		.src = __FUNCTION__,
 	};
 
-	wf.subclass.format = ao2_bump(ast_format_ulaw);
+	wf.subclass.format = ast_format_ulaw;
 	wf.data.ptr = buf + AST_FRIENDLY_OFFSET;
 
 	/* Instead of len, use samples, because channel.c generator_force

Modified: team/group/media_formats-reviewed-trunk/apps/app_mp3.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_mp3.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_mp3.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_mp3.c Thu Jul 10 13:33:07 2014
@@ -176,7 +176,7 @@
 	}
 
 	myf.f.frametype = AST_FRAME_VOICE;
-	myf.f.subclass.format = ao2_bump(ast_format_slin);
+	myf.f.subclass.format = ast_format_slin;
 	myf.f.mallocd = 0;
 	myf.f.offset = AST_FRIENDLY_OFFSET;
 	myf.f.src = __PRETTY_FUNCTION__;

Modified: team/group/media_formats-reviewed-trunk/apps/app_nbscat.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_nbscat.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_nbscat.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_nbscat.c Thu Jul 10 13:33:07 2014
@@ -141,7 +141,7 @@
 	}
 
 	myf.f.frametype = AST_FRAME_VOICE;
-	myf.f.subclass.format = ao2_bump(ast_format_slin);
+	myf.f.subclass.format = ast_format_slin;
 	myf.f.mallocd = 0;
 	myf.f.offset = AST_FRIENDLY_OFFSET;
 	myf.f.src = __PRETTY_FUNCTION__;

Modified: team/group/media_formats-reviewed-trunk/apps/app_sms.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_sms.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_sms.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_sms.c Thu Jul 10 13:33:07 2014
@@ -1611,7 +1611,7 @@
 	buf = ast_alloca(len);
 
 	f.frametype = AST_FRAME_VOICE;
-	f.subclass.format = ao2_bump(__OUT_FMT);
+	f.subclass.format = __OUT_FMT;
 	f.datalen = samples * sizeof(*buf);
 	f.offset = AST_FRIENDLY_OFFSET;
 	f.mallocd = 0;

Modified: team/group/media_formats-reviewed-trunk/channels/chan_alsa.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_alsa.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_alsa.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_alsa.c Thu Jul 10 13:33:07 2014
@@ -512,7 +512,7 @@
 		}
 
 		f.frametype = AST_FRAME_VOICE;
-		f.subclass.format = ao2_bump(ast_format_slin);
+		f.subclass.format = ast_format_slin;
 		f.samples = FRAME_SIZE;
 		f.datalen = FRAME_SIZE * 2;
 		f.data.ptr = buf;

Modified: team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c Thu Jul 10 13:33:07 2014
@@ -8604,7 +8604,7 @@
 	}
 
 	p->subs[idx].f.frametype = AST_FRAME_VOICE;
-	p->subs[idx].f.subclass.format = ao2_bump(ast_channel_rawreadformat(ast));
+	p->subs[idx].f.subclass.format = ast_channel_rawreadformat(ast);
 	p->subs[idx].f.samples = READ_SIZE;
 	p->subs[idx].f.mallocd = 0;
 	p->subs[idx].f.offset = AST_FRIENDLY_OFFSET;

Modified: team/group/media_formats-reviewed-trunk/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_misdn.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_misdn.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_misdn.c Thu Jul 10 13:33:07 2014
@@ -7434,7 +7434,7 @@
 	}
 
 	tmp->frame.frametype = AST_FRAME_VOICE;
-	tmp->frame.subclass.format = ao2_bump(ast_format_alaw);
+	tmp->frame.subclass.format = ast_format_alaw;
 	tmp->frame.datalen = len;
 	tmp->frame.samples = len;
 	tmp->frame.mallocd = 0;

Modified: team/group/media_formats-reviewed-trunk/channels/chan_phone.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_phone.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_phone.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_phone.c Thu Jul 10 13:33:07 2014
@@ -611,7 +611,7 @@
 	p->fr.frametype = ast_format_get_type(p->lastinput) == AST_MEDIA_TYPE_AUDIO ?
 		AST_FRAME_VOICE : ast_format_get_type(p->lastinput) == AST_MEDIA_TYPE_IMAGE ?
 		AST_FRAME_IMAGE : AST_FRAME_VIDEO;
-	p->fr.subclass.format = ao2_bump(p->lastinput);
+	p->fr.subclass.format = p->lastinput;
 	p->fr.offset = AST_FRIENDLY_OFFSET;
 	/* Byteswap from little-endian to native-endian */
 	if (ast_format_cmp(p->fr.subclass.format, ast_format_slin) == AST_FORMAT_CMP_EQUAL)

Modified: team/group/media_formats-reviewed-trunk/codecs/codec_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/codec_dahdi.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/codec_dahdi.c (original)
+++ team/group/media_formats-reviewed-trunk/codecs/codec_dahdi.c Thu Jul 10 13:33:07 2014
@@ -505,7 +505,7 @@
 	dahdip->fmts.dstfmt = ast_format_compatibility_codec2bitfield(dst_codec);
 
 	pvt->f.frametype = AST_FRAME_VOICE;
-	pvt->f.subclass.format = ao2_bump(dahdi_format_to_cached(dahdip->fmts.dstfmt));
+	pvt->f.subclass.format = dahdi_format_to_cached(dahdip->fmts.dstfmt);
 	pvt->f.mallocd = 0;
 	pvt->f.offset = AST_FRIENDLY_OFFSET;
 	pvt->f.src = pvt->t->name;

Modified: team/group/media_formats-reviewed-trunk/codecs/codec_resample.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/codec_resample.c?view=diff&rev=418349&r1=418348&r2=418349
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/codec_resample.c (original)
+++ team/group/media_formats-reviewed-trunk/codecs/codec_resample.c Thu Jul 10 13:33:07 2014
@@ -106,6 +106,8 @@
 static void resamp_destroy(struct ast_trans_pvt *pvt)
 {
 	SpeexResamplerState *resamp_pvt = pvt->pvt;
+
+	ao2_cleanup(pvt->f.subclass.format);
 	speex_resampler_destroy(resamp_pvt);
 }
 




More information about the asterisk-commits mailing list