summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-04-29 08:23:37 +0000
committerBenny Prijono <bennylp@teluu.com>2006-04-29 08:23:37 +0000
commitfacbd77aee687ac9d282597e415bab3d0df8d181 (patch)
tree4a5b14ba019df47b0d94086023baf5c307806412
parentcf86859ba01403735bdeb660dad2a660d3ce65ea (diff)
Fixed bugs in codec priority sorting
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@421 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/include/pjmedia/codec.h10
-rw-r--r--pjmedia/src/pjmedia/endpoint.c26
2 files changed, 29 insertions, 7 deletions
diff --git a/pjmedia/include/pjmedia/codec.h b/pjmedia/include/pjmedia/codec.h
index fbef4175..04bf449e 100644
--- a/pjmedia/include/pjmedia/codec.h
+++ b/pjmedia/include/pjmedia/codec.h
@@ -387,26 +387,26 @@ enum pjmedia_codec_priority
* highest place in the order, and will change the priority
* of previously highest priority codec to NEXT_HIGHER.
*/
- PJMEDIA_CODEC_PRIO_HIGHEST,
+ PJMEDIA_CODEC_PRIO_HIGHEST = 16,
/**
* This priority will put the codec as the next codec after
* codecs with this same priority.
*/
- PJMEDIA_CODEC_PRIO_NEXT_HIGHER,
+ PJMEDIA_CODEC_PRIO_NEXT_HIGHER = 12,
/**
* This is the initial codec priority when it is registered to
* codec manager by codec factory.
*/
- PJMEDIA_CODEC_PRIO_NORMAL,
+ PJMEDIA_CODEC_PRIO_NORMAL = 8,
/**
* This priority makes the codec the lowest in the order.
* The last codec specified with this priority will be put
* in the last place in the order.
*/
- PJMEDIA_CODEC_PRIO_LOWEST,
+ PJMEDIA_CODEC_PRIO_LOWEST = 4,
/**
* This priority will prevent the codec from being listed in the
@@ -415,7 +415,7 @@ enum pjmedia_codec_priority
* be listed by #pjmedia_codec_mgr_enum_codecs() and other codec
* query functions.
*/
- PJMEDIA_CODEC_PRIO_DISABLED,
+ PJMEDIA_CODEC_PRIO_DISABLED = 0,
};
diff --git a/pjmedia/src/pjmedia/endpoint.c b/pjmedia/src/pjmedia/endpoint.c
index 4bfdccd8..0685c3d9 100644
--- a/pjmedia/src/pjmedia/endpoint.c
+++ b/pjmedia/src/pjmedia/endpoint.c
@@ -406,6 +406,26 @@ PJ_DEF(pj_status_t) pjmedia_endpt_create_sdp( pjmedia_endpt *endpt,
}
+
+#if PJ_LOG_MAX_LEVEL >= 3
+static const char *good_number(char *buf, pj_int32_t val)
+{
+ if (val < 1000) {
+ pj_ansi_sprintf(buf, "%d", val);
+ } else if (val < 1000000) {
+ pj_ansi_sprintf(buf, "%d.%dK",
+ val / 1000,
+ (val % 1000) / 100);
+ } else {
+ pj_ansi_sprintf(buf, "%d.%02dM",
+ val / 1000000,
+ (val % 1000000) / 10000);
+ }
+
+ return buf;
+}
+#endif
+
PJ_DEF(pj_status_t) pjmedia_endpt_dump(pjmedia_endpt *endpt)
{
@@ -427,6 +447,7 @@ PJ_DEF(pj_status_t) pjmedia_endpt_dump(pjmedia_endpt *endpt)
for (i=0; i<count; ++i) {
const char *type;
pjmedia_codec_param param;
+ char bps[16];
switch (codec_info[i].type) {
case PJMEDIA_TYPE_AUDIO:
@@ -445,13 +466,14 @@ PJ_DEF(pj_status_t) pjmedia_endpt_dump(pjmedia_endpt *endpt)
}
PJ_LOG(3,(THIS_FILE,
- " %s codec #%2d: pt=%d (%.*s @%dKHz/%d, %d bps, ptime=%d ms, vad=%d, cng=%d)",
+ " %s codec #%2d: pt=%d (%.*s @%dKHz/%d, %sbps, ptime=%d ms, vad=%d, cng=%d)",
type, i, codec_info[i].pt,
(int)codec_info[i].encoding_name.slen,
codec_info[i].encoding_name.ptr,
codec_info[i].clock_rate/1000,
codec_info[i].channel_cnt,
- param.avg_bps, param.ptime,
+ good_number(bps, param.avg_bps),
+ param.ptime,
param.vad,
param.cng));
}