Merged revisions 378783,378789-378790 via svnmerge from

file:///srv/subversion/repos/asterisk/trunk

................
  r378783 | dlee | 2013-01-09 14:30:33 -0600 (Wed, 09 Jan 2013) | 14 lines
  
  Fix end condition in ast_rtp_lookup_mime_multiple2.
  
  The erroneous end condition would never include the AST_RTP_CISCO_DTMF flag
  in the debug output.
  
  (closes issue ASTERISK-20772)
  Reported by: Xavier Hienne
  ........
  
  Merged revisions 378776 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 378780 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r378789 | rmudgett | 2013-01-09 14:56:23 -0600 (Wed, 09 Jan 2013) | 4 lines
  
  * Found some more places to use ast_channel_lock_both().
  
  * Minor optimization in ast_rtp_instance_early_bridge().
................
  r378790 | rmudgett | 2013-01-09 15:14:39 -0600 (Wed, 09 Jan 2013) | 4 lines
  
  * Whitespace changes.
  
  * Made ast_test_init() match its prototype.
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Automerge script
2013-01-09 21:21:11 +00:00
parent 2ba33b4c3a
commit 613b972cc5
4 changed files with 25 additions and 52 deletions

View File

@@ -35,7 +35,7 @@
#include "asterisk/strings.h"
#endif
/*!
/*!
\page AstUnitTestAPI Asterisk Unit Test API
@@ -57,7 +57,7 @@
\code
AST_TEST_DEFINE(sample_test_cb) \\The name of the callback function
{ \\The the function's body
{ \\The the function's body
switch (cmd) {
case TEST_INIT:
info->name = "sample_test";
@@ -86,7 +86,7 @@
Details of the test execution, especially failure details, should be provided
by using the ast_test_status_update() function.
\subsection RegisterTest Register a Test
\subsection RegisterTest Register a Test
Register the test using the AST_TEST_REGISTER macro.
@@ -148,9 +148,8 @@
* \returns 0 on success
* \returns any other value on failure
*/
int __ast_test_suite_event_notify(const char *file, const char *func, int line,
const char *state, const char *fmt, ...)
__attribute__((format(printf, 5, 6)));
int __ast_test_suite_event_notify(const char *file, const char *func, int line, const char *state, const char *fmt, ...)
__attribute__((format(printf, 5, 6)));
/*!
* \brief Notifies the test suite of a failed assert on an expression
@@ -165,8 +164,7 @@ int __ast_test_suite_event_notify(const char *file, const char *func, int line,
* \returns 0 on success
* \returns any other value on failure
*/
int __ast_test_suite_assert_notify(const char *file, const char *func, int line,
const char *exp);
int __ast_test_suite_assert_notify(const char *file, const char *func, int line, const char *exp);
/*!
* \ref __ast_test_suite_event_notify()
@@ -234,7 +232,7 @@ struct ast_test_info {
* \retval AST_TEST_FAIL for failure
*/
typedef enum ast_test_result_state (ast_test_cb_t)(struct ast_test_info *info,
enum ast_test_command cmd, struct ast_test *test);
enum ast_test_command cmd, struct ast_test *test);
/*!
* \brief unregisters a test with the test framework
@@ -275,9 +273,8 @@ void ast_test_debug(struct ast_test *test, const char *fmt, ...) __attribute__((
* \retval 0 success
* \retval -1 failure
*/
int __ast_test_status_update(const char *file, const char *func, int line,
struct ast_test *test, const char *fmt, ...)
__attribute__((format(printf, 5, 6)));
int __ast_test_status_update(const char *file, const char *func, int line, struct ast_test *test, const char *fmt, ...)
__attribute__((format(printf, 5, 6)));
/*!
* \ref __ast_test_status_update()

View File

@@ -849,7 +849,7 @@ char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, struct ast_format_cap *
} else {
int x;
ast_str_append(&buf, 0, "0x%x (", (unsigned int) rtp_capability);
for (x = 1; x < AST_RTP_MAX; x <<= 1) {
for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
if (rtp_capability & x) {
name = ast_rtp_lookup_mime_subtype2(asterisk_format, NULL, x, options);
ast_str_append(&buf, 0, "%s|", name);
@@ -1467,12 +1467,7 @@ enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct as
}
/* Lock both channels so we can look for the glue that binds them together */
ast_channel_lock(c0);
while (ast_channel_trylock(c1)) {
ast_channel_unlock(c0);
usleep(1);
ast_channel_lock(c0);
}
ast_channel_lock_both(c0, c1);
/* Ensure neither channel got hungup during lock avoidance */
if (ast_check_hangup(c0) || ast_check_hangup(c1)) {
@@ -1548,7 +1543,9 @@ enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct as
}
/* If we have gotten to a local bridge make sure that both sides have the same local bridge callback and that they are DTMF compatible */
if ((audio_glue0_res == AST_RTP_GLUE_RESULT_LOCAL || audio_glue1_res == AST_RTP_GLUE_RESULT_LOCAL) && ((instance0->engine->local_bridge != instance1->engine->local_bridge) || (instance0->engine->dtmf_compatible && !instance0->engine->dtmf_compatible(c0, instance0, c1, instance1)))) {
if ((audio_glue0_res == AST_RTP_GLUE_RESULT_LOCAL || audio_glue1_res == AST_RTP_GLUE_RESULT_LOCAL)
&& (instance0->engine->local_bridge != instance1->engine->local_bridge
|| (instance0->engine->dtmf_compatible && !instance0->engine->dtmf_compatible(c0, instance0, c1, instance1)))) {
res = AST_BRIDGE_FAILED_NOWARN;
goto done;
}
@@ -1712,26 +1709,16 @@ int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1
enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
struct ast_format_cap *cap0 = ast_format_cap_alloc_nolock();
struct ast_format_cap *cap1 = ast_format_cap_alloc_nolock();
int res = 0;
/* If there is no second channel just immediately bail out, we are of no use in that scenario */
if (!c1) {
if (!c1 || !cap1 || !cap0) {
ast_format_cap_destroy(cap0);
ast_format_cap_destroy(cap1);
return -1;
}
/* Lock both channels so we can look for the glue that binds them together */
ast_channel_lock(c0);
while (ast_channel_trylock(c1)) {
ast_channel_unlock(c0);
usleep(1);
ast_channel_lock(c0);
}
if (!cap1 || !cap0) {
goto done;
}
ast_channel_lock_both(c0, c1);
/* Grab glue that binds each channel to something using the RTP engine */
if (!(glue0 = ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) || !(glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type))) {
@@ -1774,8 +1761,6 @@ int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1
ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>");
}
res = 0;
done:
ast_channel_unlock(c0);
ast_channel_unlock(c1);
@@ -1790,11 +1775,9 @@ done:
unref_instance_cond(&tinstance0);
unref_instance_cond(&tinstance1);
if (!res) {
ast_debug(1, "Setting early bridge SDP of '%s' with that of '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>");
}
ast_debug(1, "Setting early bridge SDP of '%s' with that of '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>");
return res;
return 0;
}
int ast_rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations)

View File

@@ -121,8 +121,7 @@ void ast_test_debug(struct ast_test *test, const char *fmt, ...)
ast_free(buf);
}
int __ast_test_status_update(const char *file, const char *func, int line,
struct ast_test *test, const char *fmt, ...)
int __ast_test_status_update(const char *file, const char *func, int line, struct ast_test *test, const char *fmt, ...)
{
struct ast_str *buf = NULL;
va_list ap;
@@ -911,8 +910,7 @@ static struct ast_cli_entry test_cli[] = {
AST_CLI_DEFINE(test_cli_generate_results, "generate test results to file"),
};
int __ast_test_suite_event_notify(const char *file, const char *func, int line,
const char *state, const char *fmt, ...)
int __ast_test_suite_event_notify(const char *file, const char *func, int line, const char *state, const char *fmt, ...)
{
struct ast_str *buf = NULL;
va_list ap;
@@ -930,7 +928,8 @@ int __ast_test_suite_event_notify(const char *file, const char *func, int line,
"State: %s\r\n"
"AppFile: %s\r\n"
"AppFunction: %s\r\n"
"AppLine: %d\r\n%s\r\n",
"AppLine: %d\r\n"
"%s\r\n",
state, file, func, line, ast_str_buffer(buf));
ast_free(buf);
@@ -938,8 +937,7 @@ int __ast_test_suite_event_notify(const char *file, const char *func, int line,
return 0;
}
int __ast_test_suite_assert_notify(const char *file, const char *func, int line,
const char *exp)
int __ast_test_suite_assert_notify(const char *file, const char *func, int line, const char *exp)
{
manager_event(EVENT_FLAG_TEST, "TestEvent",
"Type: Assert\r\n"
@@ -954,7 +952,7 @@ int __ast_test_suite_assert_notify(const char *file, const char *func, int line,
#endif /* TEST_FRAMEWORK */
int ast_test_init()
int ast_test_init(void)
{
#ifdef TEST_FRAMEWORK
/* Register cli commands */

View File

@@ -1206,12 +1206,7 @@ int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
void *pvt1;
int to;
ast_channel_lock(c0);
while (ast_channel_trylock(c1)) {
ast_channel_unlock(c0);
usleep(1);
ast_channel_lock(c0);
}
ast_channel_lock_both(c0, c1);
pr0 = get_proto(c0);
pr1 = get_proto(c1);
if (!pr0) {