[asterisk-commits] coreyfarrell: branch group/media_formats-reviewed-trunk r417422 - in /team/gr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 26 14:06:52 CDT 2014


Author: coreyfarrell
Date: Thu Jun 26 14:06:42 2014
New Revision: 417422

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=417422
Log:
Remove ast_format_copy, directly ao2_bump and ao2_replace

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

Modified:
    team/group/media_formats-reviewed-trunk/addons/chan_mobile.c
    team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c
    team/group/media_formats-reviewed-trunk/apps/app_amd.c
    team/group/media_formats-reviewed-trunk/apps/app_chanspy.c
    team/group/media_formats-reviewed-trunk/apps/app_dahdibarge.c
    team/group/media_formats-reviewed-trunk/apps/app_dictate.c
    team/group/media_formats-reviewed-trunk/apps/app_fax.c
    team/group/media_formats-reviewed-trunk/apps/app_festival.c
    team/group/media_formats-reviewed-trunk/apps/app_ices.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_record.c
    team/group/media_formats-reviewed-trunk/apps/app_sms.c
    team/group/media_formats-reviewed-trunk/apps/app_speech_utils.c
    team/group/media_formats-reviewed-trunk/apps/app_talkdetect.c
    team/group/media_formats-reviewed-trunk/apps/app_test.c
    team/group/media_formats-reviewed-trunk/apps/app_waitforsilence.c
    team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.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_oss.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/ex_adpcm.h
    team/group/media_formats-reviewed-trunk/codecs/ex_alaw.h
    team/group/media_formats-reviewed-trunk/codecs/ex_g722.h
    team/group/media_formats-reviewed-trunk/codecs/ex_g726.h
    team/group/media_formats-reviewed-trunk/codecs/ex_gsm.h
    team/group/media_formats-reviewed-trunk/codecs/ex_ilbc.h
    team/group/media_formats-reviewed-trunk/codecs/ex_lpc10.h
    team/group/media_formats-reviewed-trunk/codecs/ex_speex.h
    team/group/media_formats-reviewed-trunk/codecs/ex_ulaw.h
    team/group/media_formats-reviewed-trunk/include/asterisk/format.h
    team/group/media_formats-reviewed-trunk/include/asterisk/slin.h
    team/group/media_formats-reviewed-trunk/main/abstract_jb.c
    team/group/media_formats-reviewed-trunk/main/app.c
    team/group/media_formats-reviewed-trunk/main/audiohook.c
    team/group/media_formats-reviewed-trunk/main/bridge_channel.c
    team/group/media_formats-reviewed-trunk/main/channel.c
    team/group/media_formats-reviewed-trunk/main/file.c
    team/group/media_formats-reviewed-trunk/main/frame.c
    team/group/media_formats-reviewed-trunk/main/indications.c
    team/group/media_formats-reviewed-trunk/main/rtp_engine.c
    team/group/media_formats-reviewed-trunk/main/slinfactory.c
    team/group/media_formats-reviewed-trunk/main/smoother.c
    team/group/media_formats-reviewed-trunk/main/translate.c
    team/group/media_formats-reviewed-trunk/res/res_adsi.c
    team/group/media_formats-reviewed-trunk/res/res_agi.c
    team/group/media_formats-reviewed-trunk/res/res_fax.c
    team/group/media_formats-reviewed-trunk/res/res_musiconhold.c
    team/group/media_formats-reviewed-trunk/res/res_rtp_asterisk.c
    team/group/media_formats-reviewed-trunk/res/res_speech.c
    team/group/media_formats-reviewed-trunk/tests/test_core_format.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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/addons/chan_mobile.c (original)
+++ team/group/media_formats-reviewed-trunk/addons/chan_mobile.c Thu Jun 26 14:06:42 2014
@@ -1115,7 +1115,7 @@
 
 	memset(&pvt->fr, 0x00, sizeof(struct ast_frame));
 	pvt->fr.frametype = AST_FRAME_VOICE;
-	pvt->fr.subclass.format = ast_format_copy(DEVICE_FRAME_FORMAT);
+	pvt->fr.subclass.format = ao2_bump(DEVICE_FRAME_FORMAT);
 	pvt->fr.src = "Mobile";
 	pvt->fr.offset = AST_FRIENDLY_OFFSET;
 	pvt->fr.mallocd = 0;

Modified: team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c (original)
+++ team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c Thu Jun 26 14:06:42 2014
@@ -1523,8 +1523,7 @@
 
 	ast_mutex_lock(&p->lock);
 
-	ao2_cleanup(p->writeformat);
-	p->writeformat = ast_format_copy(fmt);
+	ao2_replace(p->writeformat, fmt);
 
 	if (p->owner) {
 		struct ast_format_cap *caps;
@@ -1596,8 +1595,7 @@
 
 	ast_mutex_lock(&p->lock);
 
-	ao2_cleanup(p->readformat);
-	p->readformat = ast_format_copy(fmt);
+	ao2_replace(p->readformat, fmt);
 
 	if (p->owner) {
 		struct ast_format_cap *caps;

Modified: team/group/media_formats-reviewed-trunk/apps/app_amd.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_amd.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_amd.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_amd.c Thu Jun 26 14:06:42 2014
@@ -255,7 +255,7 @@
 				minimumWordLength, betweenWordsSilence, maximumNumberOfWords, silenceThreshold, maximumWordLength);
 
 	/* Set read format to signed linear so we get signed linear frames in */
-	readFormat = ast_format_copy(ast_channel_readformat(chan));
+	readFormat = ao2_bump(ast_channel_readformat(chan));
 	if (ast_set_read_format(chan, ast_format_slin) < 0 ) {
 		ast_log(LOG_WARNING, "AMD: Channel [%s]. Unable to set to linear mode, giving up\n", ast_channel_name(chan));
 		pbx_builtin_setvar_helper(chan , "AMDSTATUS", "");

Modified: team/group/media_formats-reviewed-trunk/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_chanspy.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_chanspy.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_chanspy.c Thu Jun 26 14:06:42 2014
@@ -1255,7 +1255,7 @@
 		ast_clear_flag(&flags, AST_FLAGS_ALL);
 	}
 
-	oldwf = ast_format_copy(ast_channel_writeformat(chan));
+	oldwf = ao2_bump(ast_channel_writeformat(chan));
 	if (ast_set_write_format(chan, ast_format_slin) < 0) {
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 		return -1;
@@ -1379,7 +1379,7 @@
 		ast_clear_flag(&flags, AST_FLAGS_ALL);
 	}
 
-	oldwf = ast_format_copy(ast_channel_writeformat(chan));
+	oldwf = ao2_bump(ast_channel_writeformat(chan));
 	if (ast_set_write_format(chan, ast_format_slin) < 0) {
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 		return -1;
@@ -1430,7 +1430,7 @@
 	ast_set_flag(&flags, OPTION_DTMF_CYCLE);
 	ast_set_flag(&flags, OPTION_DAHDI_SCAN);
 
-	oldwf = ast_format_copy(ast_channel_writeformat(chan));
+	oldwf = ao2_bump(ast_channel_writeformat(chan));
 	if (ast_set_write_format(chan, ast_format_slin) < 0) {
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 		ao2_cleanup(oldwf);

Modified: team/group/media_formats-reviewed-trunk/apps/app_dahdibarge.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_dahdibarge.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_dahdibarge.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_dahdibarge.c Thu Jun 26 14:06:42 2014
@@ -231,7 +231,7 @@
 			if (res > 0) {
 				memset(&fr, 0, sizeof(fr));
 				fr.frametype = AST_FRAME_VOICE;
-				fr.subclass.format = ast_format_copy(ast_format_ulaw);
+				fr.subclass.format = ao2_bump(ast_format_ulaw);
 				fr.datalen = res;
 				fr.samples = res;
 				fr.data.ptr = buf;

Modified: team/group/media_formats-reviewed-trunk/apps/app_dictate.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_dictate.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_dictate.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_dictate.c Thu Jun 26 14:06:42 2014
@@ -126,7 +126,7 @@
 	if (args.argc > 1 && args.filename) {
 		filename = args.filename;
 	}
-	oldr = ast_format_copy(ast_channel_readformat(chan));
+	oldr = ao2_bump(ast_channel_readformat(chan));
 	if ((res = ast_set_read_format(chan, ast_format_slin)) < 0) {
 		ast_log(LOG_WARNING, "Unable to set to linear mode.\n");
 		ao2_cleanup(oldr);

Modified: team/group/media_formats-reviewed-trunk/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_fax.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_fax.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_fax.c Thu Jun 26 14:06:42 2014
@@ -459,14 +459,14 @@
         t30state = &fax.t30_state;
 #endif
 
-    original_read_fmt = ast_format_copy(ast_channel_readformat(s->chan));
+    original_read_fmt = ao2_bump(ast_channel_readformat(s->chan));
 	res = ast_set_read_format(s->chan, ast_format_slin);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Unable to set to linear read mode, giving up\n");
 		goto done;
 	}
 
-	original_write_fmt = ast_format_copy(ast_channel_writeformat(s->chan));
+	original_write_fmt = ao2_bump(ast_channel_writeformat(s->chan));
 	res = ast_set_write_format(s->chan, ast_format_slin);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Unable to set to linear write mode, giving up\n");

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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_festival.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_festival.c Thu Jun 26 14:06:42 2014
@@ -199,7 +199,7 @@
 	ast_stopstream(chan);
 	ast_indicate(chan, -1);
 	
-	owriteformat = ast_format_copy(ast_channel_writeformat(chan));
+	owriteformat = ao2_bump(ast_channel_writeformat(chan));
 	res = ast_set_write_format(chan, ast_format_slin);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
@@ -208,7 +208,7 @@
 	}
 
 	myf.f.frametype = AST_FRAME_VOICE;
-	myf.f.subclass.format = ast_format_copy(ast_format_slin);
+	myf.f.subclass.format = ao2_bump(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_ices.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_ices.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_ices.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_ices.c Thu Jun 26 14:06:42 2014
@@ -145,7 +145,7 @@
 		return -1;
 	}
 
-	oreadformat = ast_format_copy(ast_channel_readformat(chan));
+	oreadformat = ao2_bump(ast_channel_readformat(chan));
 	res = ast_set_read_format(chan, ast_format_slin);
 	if (res < 0) {
 		close(fds[0]);

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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_milliwatt.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_milliwatt.c Thu Jun 26 14:06:42 2014
@@ -87,7 +87,7 @@
 		.src = __FUNCTION__,
 	};
 
-	wf.subclass.format = ast_format_copy(ast_format_ulaw);
+	wf.subclass.format = ao2_bump(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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_mp3.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_mp3.c Thu Jun 26 14:06:42 2014
@@ -168,7 +168,7 @@
 	
 	ast_stopstream(chan);
 
-	owriteformat = ast_format_copy(ast_channel_writeformat(chan));
+	owriteformat = ao2_bump(ast_channel_writeformat(chan));
 	res = ast_set_write_format(chan, ast_format_slin);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
@@ -176,7 +176,7 @@
 	}
 
 	myf.f.frametype = AST_FRAME_VOICE;
-	myf.f.subclass.format = ast_format_copy(ast_format_slin);
+	myf.f.subclass.format = ao2_bump(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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_nbscat.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_nbscat.c Thu Jun 26 14:06:42 2014
@@ -132,7 +132,7 @@
 	
 	ast_stopstream(chan);
 
-	owriteformat = ast_format_copy(ast_channel_writeformat(chan));
+	owriteformat = ao2_bump(ast_channel_writeformat(chan));
 	res = ast_set_write_format(chan, ast_format_slin);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
@@ -141,7 +141,7 @@
 	}
 
 	myf.f.frametype = AST_FRAME_VOICE;
-	myf.f.subclass.format = ast_format_copy(ast_format_slin);
+	myf.f.subclass.format = ao2_bump(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_record.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_record.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_record.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_record.c Thu Jun 26 14:06:42 2014
@@ -330,7 +330,7 @@
 	/* The end of beep code.  Now the recording starts */
 
 	if (silence > 0) {
-		rfmt = ast_format_copy(ast_channel_readformat(chan));
+		rfmt = ao2_bump(ast_channel_readformat(chan));
 		res = ast_set_read_format(chan, ast_format_slin);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");

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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_sms.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_sms.c Thu Jun 26 14:06:42 2014
@@ -1611,7 +1611,7 @@
 	buf = ast_alloca(len);
 
 	f.frametype = AST_FRAME_VOICE;
-	f.subclass.format = ast_format_copy(__OUT_FMT);
+	f.subclass.format = ao2_bump(__OUT_FMT);
 	f.datalen = samples * sizeof(*buf);
 	f.offset = AST_FRIENDLY_OFFSET;
 	f.mallocd = 0;

Modified: team/group/media_formats-reviewed-trunk/apps/app_speech_utils.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_speech_utils.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_speech_utils.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_speech_utils.c Thu Jun 26 14:06:42 2014
@@ -703,7 +703,7 @@
 	}
 
 	/* Record old read format */
-	oldreadformat = ast_format_copy(ast_channel_readformat(chan));
+	oldreadformat = ao2_bump(ast_channel_readformat(chan));
 
 	/* Change read format to be signed linear */
 	if (ast_set_read_format(chan, speech->format))

Modified: team/group/media_formats-reviewed-trunk/apps/app_talkdetect.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_talkdetect.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_talkdetect.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_talkdetect.c Thu Jun 26 14:06:42 2014
@@ -132,7 +132,7 @@
 			}
 		}
 
-		origrformat = ast_format_copy(ast_channel_readformat(chan));
+		origrformat = ao2_bump(ast_channel_readformat(chan));
 		if ((ast_set_read_format(chan, ast_format_slin))) {
 			ast_log(LOG_WARNING, "Unable to set read format to linear!\n");
 			res = -1;

Modified: team/group/media_formats-reviewed-trunk/apps/app_test.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_test.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_test.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_test.c Thu Jun 26 14:06:42 2014
@@ -94,7 +94,7 @@
 	struct ast_frame *f;
 	struct ast_format *rformat;
 
-	rformat = ast_format_copy(ast_channel_readformat(chan));
+	rformat = ao2_bump(ast_channel_readformat(chan));
 	if (ast_set_read_format(chan, ast_format_slin)) {
 		ast_log(LOG_NOTICE, "Unable to set to linear mode!\n");
 		ao2_cleanup(rformat);

Modified: team/group/media_formats-reviewed-trunk/apps/app_waitforsilence.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_waitforsilence.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_waitforsilence.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_waitforsilence.c Thu Jun 26 14:06:42 2014
@@ -139,7 +139,7 @@
 	int (*ast_dsp_func)(struct ast_dsp*, struct ast_frame*, int*) =
 				wait_for_silence ? ast_dsp_silence : ast_dsp_noise;
 
-	rfmt = ast_format_copy(ast_channel_readformat(chan));
+	rfmt = ao2_bump(ast_channel_readformat(chan));
 	if ((res = ast_set_read_format(chan, ast_format_slin)) < 0) {
 		ast_log(LOG_WARNING, "Unable to set channel to linear mode, giving up\n");
 		return -1;

Modified: team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c (original)
+++ team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c Thu Jun 26 14:06:42 2014
@@ -180,7 +180,7 @@
 	if (!(entry = ast_calloc(1, sizeof(*entry)))) {
 		return NULL;
 	}
-	entry->dst_format = ast_format_copy(dst);
+	entry->dst_format = ao2_bump(dst);
 	return entry;
 }
 
@@ -291,8 +291,7 @@
 			entry->out_frame = ast_translate(entry->trans_pvt, &sc->write_frame, 0);
 		}
 		if (entry->out_frame && (entry->out_frame->datalen < MAX_DATALEN)) {
-			ao2_cleanup(sc->write_frame.subclass.format);
-			sc->write_frame.subclass.format = ast_format_copy(entry->out_frame->subclass.format);
+			ao2_replace(sc->write_frame.subclass.format, entry->out_frame->subclass.format);
 			memcpy(sc->final_buf, entry->out_frame->data.ptr, entry->out_frame->datalen);
 			sc->write_frame.datalen = entry->out_frame->datalen;
 			sc->write_frame.samples = entry->out_frame->samples;
@@ -940,9 +939,9 @@
 			ast_mutex_lock(&sc->lock);
 
 			/* Make SLINEAR write frame from local buffer */
+			/* BUGBUG: use ast_format_cmp ? */
 			if (sc->write_frame.subclass.format != cur_slin) {
-				ao2_cleanup(sc->write_frame.subclass.format);
-				sc->write_frame.subclass.format = ast_format_copy(cur_slin);
+				ao2_replace(sc->write_frame.subclass.format, cur_slin);
 			}
 			sc->write_frame.datalen = softmix_datalen;
 			sc->write_frame.samples = softmix_samples;

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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_alsa.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_alsa.c Thu Jun 26 14:06:42 2014
@@ -512,7 +512,7 @@
 		}
 
 		f.frametype = AST_FRAME_VOICE;
-		f.subclass.format = ast_format_copy(ast_format_slin);
+		f.subclass.format = ao2_bump(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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c Thu Jun 26 14:06:42 2014
@@ -8489,7 +8489,7 @@
 	}
 
 	p->subs[idx].f.frametype = AST_FRAME_VOICE;
-	p->subs[idx].f.subclass.format = ast_format_copy(ast_channel_rawreadformat(ast));
+	p->subs[idx].f.subclass.format = ao2_bump(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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_misdn.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_misdn.c Thu Jun 26 14:06:42 2014
@@ -7434,7 +7434,7 @@
 	}
 
 	tmp->frame.frametype = AST_FRAME_VOICE;
-	tmp->frame.subclass.format = ast_format_copy(ast_format_alaw);
+	tmp->frame.subclass.format = ao2_bump(ast_format_alaw);
 	tmp->frame.datalen = len;
 	tmp->frame.samples = len;
 	tmp->frame.mallocd = 0;

Modified: team/group/media_formats-reviewed-trunk/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_oss.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_oss.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_oss.c Thu Jun 26 14:06:42 2014
@@ -727,7 +727,7 @@
 		return f;
 	/* ok we can build and deliver the frame to the caller */
 	f->frametype = AST_FRAME_VOICE;
-	f->subclass.format = ast_format_copy(ast_format_slin);
+	f->subclass.format = ao2_bump(ast_format_slin);
 	f->samples = FRAME_SIZE;
 	f->datalen = FRAME_SIZE * 2;
 	f->data.ptr = o->oss_read_buf + AST_FRIENDLY_OFFSET;

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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_phone.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_phone.c Thu Jun 26 14:06:42 2014
@@ -413,8 +413,7 @@
 		/* Prefer g729 */
 		ioctl(p->fd, PHONE_REC_STOP);
 		if (!p->lastinput || (ast_format_cmp(p->lastinput, ast_format_g729) != AST_FORMAT_CMP_EQUAL)) {
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_format_g729);
+			ao2_replace(p->lastinput, ast_format_g729);
 			if (ioctl(p->fd, PHONE_REC_CODEC, G729)) {
 				ast_log(LOG_WARNING, "Failed to set codec to g729\n");
 				return -1;
@@ -423,8 +422,7 @@
 	} else if (ast_format_cmp(ast_channel_rawreadformat(ast), ast_format_g723) == AST_FORMAT_CMP_EQUAL) {
 		ioctl(p->fd, PHONE_REC_STOP);
 		if (!p->lastinput || (ast_format_cmp(p->lastinput, ast_format_g723) != AST_FORMAT_CMP_EQUAL)) {
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_format_g723);
+			ao2_replace(p->lastinput, ast_format_g723);
 			if (ioctl(p->fd, PHONE_REC_CODEC, G723_63)) {
 				ast_log(LOG_WARNING, "Failed to set codec to g723.1\n");
 				return -1;
@@ -433,8 +431,7 @@
 	} else if (ast_format_cmp(ast_channel_rawreadformat(ast), ast_format_slin) == AST_FORMAT_CMP_EQUAL) {
 		ioctl(p->fd, PHONE_REC_STOP);
 		if (!p->lastinput || (ast_format_cmp(p->lastinput, ast_format_slin) != AST_FORMAT_CMP_EQUAL)) {
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_format_slin);
+			ao2_replace(p->lastinput, ast_format_slin);
 			if (ioctl(p->fd, PHONE_REC_CODEC, LINEAR16)) {
 				ast_log(LOG_WARNING, "Failed to set codec to signed linear 16\n");
 				return -1;
@@ -443,8 +440,7 @@
 	} else if (ast_format_cmp(ast_channel_rawreadformat(ast), ast_format_ulaw) == AST_FORMAT_CMP_EQUAL) {
 		ioctl(p->fd, PHONE_REC_STOP);
 		if (!p->lastinput || (ast_format_cmp(p->lastinput, ast_format_ulaw) != AST_FORMAT_CMP_EQUAL)) {
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_format_ulaw);
+			ao2_replace(p->lastinput, ast_format_ulaw);
 			if (ioctl(p->fd, PHONE_REC_CODEC, ULAW)) {
 				ast_log(LOG_WARNING, "Failed to set codec to uLaw\n");
 				return -1;
@@ -453,8 +449,7 @@
 	} else if (p->mode == MODE_FXS) {
 		ioctl(p->fd, PHONE_REC_STOP);
 		if (!p->lastinput || (ast_format_cmp(p->lastinput, ast_channel_rawreadformat(ast)) == AST_FORMAT_CMP_NOT_EQUAL)) {
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_channel_rawreadformat(ast));
+			ao2_replace(p->lastinput, ast_channel_rawreadformat(ast));
 			if (ioctl(p->fd, PHONE_REC_CODEC, ast_channel_rawreadformat(ast))) {
 				ast_log(LOG_WARNING, "Failed to set codec to %s\n", 
 					ast_format_get_name(ast_channel_rawreadformat(ast)));
@@ -616,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 = ast_format_copy(p->lastinput);
+	p->fr.subclass.format = ao2_bump(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)
@@ -705,10 +700,8 @@
 				ast_log(LOG_WARNING, "Unable to set G729 mode\n");
 				return -1;
 			}
-			ao2_cleanup(p->lastformat);
-			p->lastformat = ast_format_copy(ast_format_g729);
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_format_g729);
+			ao2_replace(p->lastformat, ast_format_g729);
+			ao2_replace(p->lastinput, ast_format_g729);
 			/* Reset output buffer */
 			p->obuflen = 0;
 			codecset = 1;
@@ -730,10 +723,8 @@
 				ast_log(LOG_WARNING, "Unable to set G723.1 mode\n");
 				return -1;
 			}
-			ao2_cleanup(p->lastformat);
-			p->lastformat = ast_format_copy(ast_format_g723);
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_format_g723);
+			ao2_replace(p->lastformat, ast_format_g723);
+			ao2_replace(p->lastinput, ast_format_g723);
 			/* Reset output buffer */
 			p->obuflen = 0;
 			codecset = 1;
@@ -755,10 +746,8 @@
 				ast_log(LOG_WARNING, "Unable to set 16-bit linear mode\n");
 				return -1;
 			}
-			ao2_cleanup(p->lastformat);
-			p->lastformat = ast_format_copy(ast_format_slin);
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_format_slin);
+			ao2_replace(p->lastformat, ast_format_slin);
+			ao2_replace(p->lastinput, ast_format_slin);
 			codecset = 1;
 			/* Reset output buffer */
 			p->obuflen = 0;
@@ -776,10 +765,8 @@
 				ast_log(LOG_WARNING, "Unable to set uLaw mode\n");
 				return -1;
 			}
-			ao2_cleanup(p->lastformat);
-			p->lastformat = ast_format_copy(ast_format_ulaw);
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(ast_format_ulaw);
+			ao2_replace(p->lastformat, ast_format_ulaw);
+			ao2_replace(p->lastinput, ast_format_ulaw);
 			codecset = 1;
 			/* Reset output buffer */
 			p->obuflen = 0;
@@ -799,10 +786,8 @@
 					ast_format_get_name(frame->subclass.format));
 				return -1;
 			}
-			ao2_cleanup(p->lastformat);
-			p->lastformat = ast_format_copy(frame->subclass.format);
-			ao2_cleanup(p->lastinput);
-			p->lastinput = ast_format_copy(frame->subclass.format);
+			ao2_replace(p->lastformat, frame->subclass.format);
+			ao2_replace(p->lastinput, frame->subclass.format);
 			codecset = 1;
 			/* Reset output buffer */
 			p->obuflen = 0;

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=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/codec_dahdi.c (original)
+++ team/group/media_formats-reviewed-trunk/codecs/codec_dahdi.c Thu Jun 26 14:06:42 2014
@@ -505,7 +505,7 @@
 	dahdip->fmts.dstfmt = ast_format_compatibility_codec2bitfield(dst_codec);
 
 	pvt->f.frametype = AST_FRAME_VOICE;
-	pvt->f.subclass.format = ast_format_copy(dahdi_format_to_cached(dahdip->fmts.dstfmt));
+	pvt->f.subclass.format = ao2_bump(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/ex_adpcm.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_adpcm.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_adpcm.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_adpcm.h Thu Jun 26 14:06:42 2014
@@ -27,7 +27,7 @@
 		.data.ptr = ex_adpcm,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_adpcm);
+	f.subclass.format = ao2_bump(ast_format_adpcm);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/codecs/ex_alaw.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_alaw.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_alaw.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_alaw.h Thu Jun 26 14:06:42 2014
@@ -31,6 +31,6 @@
 		.src = __PRETTY_FUNCTION__,
 		.data.ptr = ex_alaw,
 	};
-	f.subclass.format = ast_format_copy(ast_format_alaw);
+	f.subclass.format = ao2_bump(ast_format_alaw);
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/codecs/ex_g722.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_g722.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_g722.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_g722.h Thu Jun 26 14:06:42 2014
@@ -42,7 +42,7 @@
 		.data.ptr = ex_g722,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_slin);
+	f.subclass.format = ao2_bump(ast_format_slin);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/codecs/ex_g726.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_g726.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_g726.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_g726.h Thu Jun 26 14:06:42 2014
@@ -27,7 +27,7 @@
 		.data.ptr = ex_g726,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_g726);
+	f.subclass.format = ao2_bump(ast_format_g726);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/codecs/ex_gsm.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_gsm.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_gsm.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_gsm.h Thu Jun 26 14:06:42 2014
@@ -27,7 +27,7 @@
 		.data.ptr = ex_gsm,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_gsm);
+	f.subclass.format = ao2_bump(ast_format_gsm);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/codecs/ex_ilbc.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_ilbc.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_ilbc.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_ilbc.h Thu Jun 26 14:06:42 2014
@@ -28,7 +28,7 @@
 		.data.ptr = ex_ilbc,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_ilbc);
+	f.subclass.format = ao2_bump(ast_format_ilbc);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/codecs/ex_lpc10.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_lpc10.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_lpc10.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_lpc10.h Thu Jun 26 14:06:42 2014
@@ -25,7 +25,7 @@
 		.data.ptr = ex_lpc10,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_lpc10);
+	f.subclass.format = ao2_bump(ast_format_lpc10);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/codecs/ex_speex.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_speex.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_speex.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_speex.h Thu Jun 26 14:06:42 2014
@@ -27,7 +27,7 @@
 		.data.ptr = ex_speex,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_speex);
+	f.subclass.format = ao2_bump(ast_format_speex);
 
 	return &f;
 }
@@ -59,7 +59,7 @@
 		.data.ptr = ex_speex16,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_speex16);
+	f.subclass.format = ao2_bump(ast_format_speex16);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/codecs/ex_ulaw.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/codecs/ex_ulaw.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/codecs/ex_ulaw.h (original)
+++ team/group/media_formats-reviewed-trunk/codecs/ex_ulaw.h Thu Jun 26 14:06:42 2014
@@ -32,7 +32,7 @@
 		.data.ptr = ex_ulaw,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_ulaw);
+	f.subclass.format = ao2_bump(ast_format_ulaw);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/include/asterisk/format.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/include/asterisk/format.h (original)
+++ team/group/media_formats-reviewed-trunk/include/asterisk/format.h Thu Jun 26 14:06:42 2014
@@ -166,13 +166,6 @@
 struct ast_format *ast_format_joint(const struct ast_format *format1, const struct ast_format *format2);
 
 /*!
- * \brief Copy a media format
- *
- * \note The returned format must be treated as immutable.
- */
-#define ast_format_copy(format) ao2_bump(format)
-
-/*!
  * \brief Set an attribute on a format to a specific value
  *
  * \param format The format to set the attribute on

Modified: team/group/media_formats-reviewed-trunk/include/asterisk/slin.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/include/asterisk/slin.h?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/include/asterisk/slin.h (original)
+++ team/group/media_formats-reviewed-trunk/include/asterisk/slin.h Thu Jun 26 14:06:42 2014
@@ -70,7 +70,7 @@
 		.data.ptr = ex_slin8,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_slin);
+	f.subclass.format = ao2_bump(ast_format_slin);
 
 	return &f;
 }
@@ -87,7 +87,7 @@
 		.data.ptr = ex_slin16,
 	};
 
-	f.subclass.format = ast_format_copy(ast_format_slin16);
+	f.subclass.format = ao2_bump(ast_format_slin16);
 
 	return &f;
 }

Modified: team/group/media_formats-reviewed-trunk/main/abstract_jb.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/main/abstract_jb.c?view=diff&rev=417422&r1=417421&r2=417422
==============================================================================
--- team/group/media_formats-reviewed-trunk/main/abstract_jb.c (original)
+++ team/group/media_formats-reviewed-trunk/main/abstract_jb.c Thu Jun 26 14:06:42 2014
@@ -371,8 +371,7 @@
 		case AST_JB_IMPL_DROP:
 			jb_framelog("\tJB_GET {now=%ld}: %s frame with ts=%ld and len=%ld\n",
 				now, jb_get_actions[res], f->ts, f->len);
-			ao2_ref(jb->last_format, -1);
-			jb->last_format = ast_format_copy(f->subclass.format);
+			ao2_replace(jb->last_format, f->subclass.format);
 			ast_frfree(f);
 			break;
 		case AST_JB_IMPL_INTERP:
@@ -438,7 +437,7 @@
 	jb->next = jbimpl->next(jbobj);
 
 	/* Init last format for a first time. */
-	jb->last_format = ast_format_copy(frr->subclass.format);
+	jb->last_format = ao2_bump(frr->subclass.format);
 
 	/* Create a frame log file */
 	if (ast_test_flag(jbconf, AST_JB_LOG)) {
@@ -913,7 +912,7 @@
 		}
 
 		jbframe = ast_frisolate(frame);
-		framedata->last_format = ast_format_copy(frame->subclass.format);
+		ao2_replace(framedata->last_format, frame->subclass.format);
 
 		if (frame->len && (frame->len != framedata->timer_interval)) {

[... 620 lines stripped ...]



More information about the asterisk-commits mailing list