[svn-commits] rmudgett: trunk r420993 - in /trunk: ./ main/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Aug 14 11:01:45 CDT 2014
Author: rmudgett
Date: Thu Aug 14 11:01:39 2014
New Revision: 420993
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=420993
Log:
channel_internal_api.c: Replace some code with ao2_replace().
Use ao2_replace() instead of ao2_cleanup(); ao2_bump().
ao2_replace() has the advantange of not altering the ref count if the
replaced pointer is the same.
Review: https://reviewboard.asterisk.org/r/3904/
........
Merged revisions 420992 from http://svn.asterisk.org/svn/asterisk/branches/13
Modified:
trunk/ (props changed)
trunk/main/channel.c
trunk/main/channel_internal_api.c
Propchange: trunk/
------------------------------------------------------------------------------
--- branch-13-merged (original)
+++ branch-13-merged Thu Aug 14 11:01:39 2014
@@ -1,1 +1,1 @@
-/branches/13:1-420494,420514,420534,420536,420538,420562,420577,420592,420609,420624,420639,420657,420717,420742,420758,420779,420796,420803,420808,420837,420856,420879,420881,420899,420919,420940,420950,420957
+/branches/13:1-420494,420514,420534,420536,420538,420562,420577,420592,420609,420624,420639,420657,420717,420742,420758,420779,420796,420803,420808,420837,420856,420879,420881,420899,420919,420940,420950,420957,420992
Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=420993&r1=420992&r2=420993
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu Aug 14 11:01:39 2014
@@ -6244,8 +6244,7 @@
ast_format_get_sample_rate(best_src_fmt) : ast_format_get_sample_rate(best_dst_fmt);
/* pick the best signed linear format based upon what preserves the sample rate the best. */
- ao2_ref(best_src_fmt, -1);
- best_src_fmt = ao2_bump(ast_format_cache_get_slin_by_rate(best_sample_rate));
+ ao2_replace(best_src_fmt, ast_format_cache_get_slin_by_rate(best_sample_rate));
}
}
Modified: trunk/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel_internal_api.c?view=diff&rev=420993&r1=420992&r2=420993
==============================================================================
--- trunk/main/channel_internal_api.c (original)
+++ trunk/main/channel_internal_api.c Thu Aug 14 11:01:39 2014
@@ -196,9 +196,9 @@
int alertpipe[2];
struct ast_format_cap *nativeformats; /*!< Kinds of data this channel can natively handle */
struct ast_format *readformat; /*!< Requested read format (after translation) */
- struct ast_format *writeformat; /*!< Requested write format (after translation) */
+ struct ast_format *writeformat; /*!< Requested write format (before translation) */
struct ast_format *rawreadformat; /*!< Raw read format (before translation) */
- struct ast_format *rawwriteformat; /*!< Raw write format (before translation) */
+ struct ast_format *rawwriteformat; /*!< Raw write format (after translation) */
unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
#ifdef HAVE_EPOLL
int epfd;
@@ -828,8 +828,7 @@
}
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
{
- ao2_cleanup(chan->nativeformats);
- chan->nativeformats = ao2_bump(value);
+ ao2_replace(chan->nativeformats, value);
}
struct ast_framehook_list *ast_channel_framehooks(const struct ast_channel *chan)
{
@@ -954,28 +953,23 @@
}
void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format)
{
- ao2_cleanup(chan->oldwriteformat);
- chan->oldwriteformat = ao2_bump(format);
+ ao2_replace(chan->oldwriteformat, format);
}
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
{
- ao2_cleanup(chan->rawreadformat);
- chan->rawreadformat = ao2_bump(format);
+ ao2_replace(chan->rawreadformat, format);
}
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
{
- ao2_cleanup(chan->rawwriteformat);
- chan->rawwriteformat = ao2_bump(format);
+ ao2_replace(chan->rawwriteformat, format);
}
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
{
- ao2_cleanup(chan->readformat);
- chan->readformat = ao2_bump(format);
+ ao2_replace(chan->readformat, format);
}
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
{
- ao2_cleanup(chan->writeformat);
- chan->writeformat = ao2_bump(format);
+ ao2_replace(chan->writeformat, format);
}
struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan)
{
More information about the svn-commits
mailing list