summaryrefslogtreecommitdiff
path: root/pjmedia/src/pjmedia-codec
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2010-01-26 18:54:28 +0000
committerBenny Prijono <bennylp@teluu.com>2010-01-26 18:54:28 +0000
commit6aa10eba562b5a3ace76f7ec00bee782906c652c (patch)
treed131441c36d73326757ab869ec54ae6c879c2319 /pjmedia/src/pjmedia-codec
parent5900f75534e21f750e370ec230aec3d6cd58b850 (diff)
Undo r3074 for ticket #1028 as it is missing updated codec.h hence causing build errors (thanks Michael Bradley Jr for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3075 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src/pjmedia-codec')
-rw-r--r--pjmedia/src/pjmedia-codec/ipp_codecs.c3
-rw-r--r--pjmedia/src/pjmedia-codec/passthrough.c61
2 files changed, 2 insertions, 62 deletions
diff --git a/pjmedia/src/pjmedia-codec/ipp_codecs.c b/pjmedia/src/pjmedia-codec/ipp_codecs.c
index a8b73180..aaf1142f 100644
--- a/pjmedia/src/pjmedia-codec/ipp_codecs.c
+++ b/pjmedia/src/pjmedia-codec/ipp_codecs.c
@@ -1195,9 +1195,6 @@ static pj_status_t ipp_codec_open( pjmedia_codec *codec,
(s->enc_setting.amr_nb?"":"-WB"),
s->enc_mode,
codec_data->info->params.modes.bitrate));
-
- /* Return back bitrate info to application */
- attr->info.avg_bps = codec_data->info->params.modes.bitrate;
}
#endif
diff --git a/pjmedia/src/pjmedia-codec/passthrough.c b/pjmedia/src/pjmedia-codec/passthrough.c
index f6a6e119..06e4de69 100644
--- a/pjmedia/src/pjmedia-codec/passthrough.c
+++ b/pjmedia/src/pjmedia-codec/passthrough.c
@@ -24,7 +24,6 @@
#include <pjmedia/port.h>
#include <pj/assert.h>
#include <pj/log.h>
-#include <pj/math.h>
#include <pj/pool.h>
#include <pj/string.h>
#include <pj/os.h>
@@ -681,18 +680,13 @@ static pj_status_t codec_open( pjmedia_codec *codec,
if (desc->pt == PJMEDIA_RTP_PT_AMR || desc->pt == PJMEDIA_RTP_PT_AMRWB) {
amr_settings_t *s;
pj_uint8_t octet_align = 0;
- pj_int8_t enc_mode;
-
- enc_mode = pjmedia_codec_amr_get_mode(attr->info.avg_bps);
- pj_assert(enc_mode >= 0 && enc_mode <= 8);
+ const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11};
/* Fetch octet-align setting. It should be fine to fetch only
* the decoder, since encoder & decoder must use the same setting
* (RFC 4867 section 8.3.1).
*/
for (i = 0; i < attr->setting.dec_fmtp.cnt; ++i) {
- const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11};
-
if (pj_stricmp(&attr->setting.dec_fmtp.param[i].name,
&STR_FMTP_OCTET_ALIGN) == 0)
{
@@ -702,56 +696,10 @@ static pj_status_t codec_open( pjmedia_codec *codec,
}
}
- for (i = 0; i < attr->setting.enc_fmtp.cnt; ++i) {
- /* mode-set, encoding mode is chosen based on local default mode
- * setting:
- * - if local default mode is included in the mode-set, use it
- * - otherwise, find the closest mode to local default mode;
- * if there are two closest modes, prefer to use the higher
- * one, e.g: local default mode is 4, the mode-set param
- * contains '2,3,5,6', then 5 will be chosen.
- */
- const pj_str_t STR_FMTP_MODE_SET = {"mode-set", 8};
-
- if (pj_stricmp(&attr->setting.enc_fmtp.param[i].name,
- &STR_FMTP_MODE_SET) == 0)
- {
- const char *p;
- pj_size_t l;
- pj_int8_t diff = 99;
-
- p = pj_strbuf(&attr->setting.enc_fmtp.param[i].val);
- l = pj_strlen(&attr->setting.enc_fmtp.param[i].val);
-
- while (l--) {
- if ((desc->pt==PJMEDIA_RTP_PT_AMR && *p>='0' && *p<='7') ||
- (desc->pt==PJMEDIA_RTP_PT_AMRWB && *p>='0' && *p<='8'))
- {
- pj_int8_t tmp = (pj_int8_t)(*p - '0' - enc_mode);
-
- if (PJ_ABS(diff) > PJ_ABS(tmp) ||
- (PJ_ABS(diff) == PJ_ABS(tmp) && tmp > diff))
- {
- diff = tmp;
- if (diff == 0) break;
- }
- }
- ++p;
- }
-
- if (diff == 99)
- return PJMEDIA_CODEC_EFAILED;
-
- enc_mode = (pj_int8_t)(enc_mode + diff);
-
- break;
- }
- }
-
s = PJ_POOL_ZALLOC_T(pool, amr_settings_t);
codec_data->codec_setting = s;
- s->enc_mode = enc_mode;
+ s->enc_mode = pjmedia_codec_amr_get_mode(desc->def_bitrate);
if (s->enc_mode < 0)
return PJMEDIA_CODEC_EINMODE;
@@ -767,11 +715,6 @@ static pj_status_t codec_open( pjmedia_codec *codec,
s->dec_setting.reorder = PJ_FALSE; /* Note this! passthrough codec
doesn't do sensitivity bits
reordering */
-
- /* Return back bitrate info to application */
- attr->info.avg_bps = s->enc_setting.amr_nb?
- pjmedia_codec_amrnb_bitrates[s->enc_mode]:
- pjmedia_codec_amrwb_bitrates[s->enc_mode];
}
#endif