summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-06-25 13:27:02 +0000
committerBenny Prijono <bennylp@teluu.com>2009-06-25 13:27:02 +0000
commit1028a42bfdd13453b39c3a19ebc59959df565bec (patch)
treee3c61d6e88949e0711963da9d30b751d817829e7
parentd749012c94efaf397371b2294618465ec00fea08 (diff)
Ticket #773 (mixed fixes): backported changes from #772:
- from r2566: bug in pjsua application when reading the URL from the buddy list, causing corrupt/invalid URI to be returned. Thanks Robert Cichielo for the report. - from r2577: Updated floating point version of math statistic to return the rounded mean value. - from r2586: Updated stream_destroy() to call jbuf_destroy(). - from r2604: Changed var 'test' (in sdp_neg_test.c) from a global var to static var, since there was naming conflict with libg7221codec. git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.0@2818 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib/include/pj/math.h4
-rw-r--r--pjmedia/src/pjmedia/stream.c4
-rw-r--r--pjmedia/src/test/sdp_neg_test.c2
-rw-r--r--pjsip-apps/src/pjsua/pjsua_app.c22
4 files changed, 22 insertions, 10 deletions
diff --git a/pjlib/include/pj/math.h b/pjlib/include/pj/math.h
index 9df5eeb2..8d202dbf 100644
--- a/pjlib/include/pj/math.h
+++ b/pjlib/include/pj/math.h
@@ -140,7 +140,9 @@ PJ_INLINE(void) pj_math_stat_update(pj_math_stat *stat, int val)
#if PJ_HAS_FLOATING_POINT
delta = val - stat->fmean_;
stat->fmean_ += delta/stat->n;
- stat->mean = (int) stat->fmean_;
+
+ /* Return mean value with 'rounding' */
+ stat->mean = (int) (stat->fmean_ + 0.5);
stat->m2_ += (int)(delta * (val-stat->fmean_));
#else
diff --git a/pjmedia/src/pjmedia/stream.c b/pjmedia/src/pjmedia/stream.c
index 51d5edb5..4c174c88 100644
--- a/pjmedia/src/pjmedia/stream.c
+++ b/pjmedia/src/pjmedia/stream.c
@@ -1884,6 +1884,10 @@ PJ_DEF(pj_status_t) pjmedia_stream_destroy( pjmedia_stream *stream )
stream->jb_mutex = NULL;
}
+ /* Destroy jitter buffer */
+ if (stream->jb)
+ pjmedia_jbuf_destroy(stream->jb);
+
return PJ_SUCCESS;
}
diff --git a/pjmedia/src/test/sdp_neg_test.c b/pjmedia/src/test/sdp_neg_test.c
index 521fbf2d..53cc35d7 100644
--- a/pjmedia/src/test/sdp_neg_test.c
+++ b/pjmedia/src/test/sdp_neg_test.c
@@ -39,7 +39,7 @@ struct offer_answer
char *sdp3; /* local active media local answer */
};
-struct test
+static struct test
{
const char *title;
unsigned offer_answer_count;
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c
index 7caf8c2a..96ea1d83 100644
--- a/pjsip-apps/src/pjsua/pjsua_app.c
+++ b/pjsip-apps/src/pjsua/pjsua_app.c
@@ -3131,14 +3131,16 @@ void console_app_main(const pj_str_t *uri_to_call)
} else {
pjsua_buddy_info binfo;
pjsua_buddy_get_info(result.nb_result-1, &binfo);
- uri = binfo.uri.ptr;
+ tmp.ptr = buf;
+ pj_strncpy(&tmp, &binfo.uri, sizeof(buf));
}
} else if (result.uri_result) {
- uri = result.uri_result;
+ tmp = pj_str(result.uri_result);
+ } else {
+ tmp.slen = 0;
}
- tmp = pj_str(uri);
pjsua_call_make_call( current_acc, &tmp, 0, NULL, NULL, NULL);
break;
@@ -3162,15 +3164,15 @@ void console_app_main(const pj_str_t *uri_to_call)
continue;
}
pjsua_buddy_get_info(result.nb_result-1, &binfo);
- uri = binfo.uri.ptr;
+ tmp.ptr = buf;
+ pj_strncpy(&tmp, &binfo.uri, sizeof(buf));
} else {
- uri = result.uri_result;
+ tmp = pj_str(result.uri_result);
}
for (i=0; i<my_atoi(menuin); ++i) {
pj_status_t status;
- tmp = pj_str(uri);
status = pjsua_call_make_call(current_acc, &tmp, 0, NULL,
NULL, NULL);
if (status != PJ_SUCCESS)
@@ -3208,7 +3210,9 @@ void console_app_main(const pj_str_t *uri_to_call)
} else {
pjsua_buddy_info binfo;
pjsua_buddy_get_info(result.nb_result-1, &binfo);
- uri = binfo.uri.ptr;
+ tmp.ptr = buf;
+ pj_strncpy_with_null(&tmp, &binfo.uri, sizeof(buf));
+ uri = buf;
}
} else if (result.uri_result) {
@@ -3771,7 +3775,9 @@ void console_app_main(const pj_str_t *uri_to_call)
} else {
pjsua_buddy_info binfo;
pjsua_buddy_get_info(result.nb_result-1, &binfo);
- uri = binfo.uri.ptr;
+ tmp.ptr = buf;
+ pj_strncpy_with_null(&tmp, &binfo.uri, sizeof(buf));
+ uri = buf;
}
} else if (result.uri_result) {