diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2015-04-09 08:15:48 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2015-04-09 08:15:48 +0000 |
commit | 564387c6b1d1ff9651241238dcdeedc0d658ecd5 (patch) | |
tree | 1de7f09a9e9f5951f796817384c12883175151db /pjmedia | |
parent | ca570849230de7a8785c8437ab0d4f9e2359f7b4 (diff) |
Re #1794:
- Updated G7221, the bitrate can also be set via param.info.avg_bps, this is applicable only when param.setting.dec_fmtp doesn't contain bitrate info.
- Fixed failing codec vector test in pjmedia-test due to wrong G7221 bitrate setting.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5058 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/include/pjmedia-codec/g7221.h | 3 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/g7221.c | 5 | ||||
-rw-r--r-- | pjmedia/src/test/codec_vectors.c | 16 |
3 files changed, 23 insertions, 1 deletions
diff --git a/pjmedia/include/pjmedia-codec/g7221.h b/pjmedia/include/pjmedia-codec/g7221.h index 16a5e038..c3f6ed36 100644 --- a/pjmedia/include/pjmedia-codec/g7221.h +++ b/pjmedia/include/pjmedia-codec/g7221.h @@ -76,6 +76,9 @@ * - for 14kHz audio bandwidth (32kHz sampling rate): 24000 to 48000 bps, * multiplication of 400 * + * The bitrate is set via <tt>param.setting.dec_fmtp</tt>, if it does not + * contain bitrate info, the codec will check <tt>param.info.avg_bps</tt>. + * * \note * Currently only up to two non-standard modes can be enabled. * diff --git a/pjmedia/src/pjmedia-codec/g7221.c b/pjmedia/src/pjmedia-codec/g7221.c index 8fa9efbd..2b9f1db7 100644 --- a/pjmedia/src/pjmedia-codec/g7221.c +++ b/pjmedia/src/pjmedia-codec/g7221.c @@ -678,7 +678,10 @@ static pj_status_t codec_open( pjmedia_codec *codec, fmtp_bitrate = (pj_uint16_t)pj_strtoul(&fmtp->param[tmp].val); } - /* Validation mode first! */ + if (fmtp_bitrate == 0) + fmtp_bitrate = attr->info.avg_bps; + + /* Validate bitrate */ if (!fmtp_bitrate || !validate_mode(attr->info.clock_rate, fmtp_bitrate)) return PJMEDIA_CODEC_EINMODE; diff --git a/pjmedia/src/test/codec_vectors.c b/pjmedia/src/test/codec_vectors.c index 4aa21301..bce41545 100644 --- a/pjmedia/src/test/codec_vectors.c +++ b/pjmedia/src/test/codec_vectors.c @@ -74,6 +74,14 @@ static int codec_test_encode(pjmedia_codec_mgr *mgr, codec_param.info.avg_bps = bitrate; codec_param.setting.vad = 0; + /* For G7221, the bitrate is set via param.setting.dec_fmtp, if it has + * no info about bitrate, the codec will check info.avg_bps. So, let's + * just clear the SDP fmtp. + */ + if (pj_ansi_strstr(codec_name, "G7221/")) { + codec_param.setting.dec_fmtp.cnt = 0; + } + status = pjmedia_codec_init(codec, pool); if (status != PJ_SUCCESS) { rc = -60; @@ -325,6 +333,14 @@ static int codec_test_decode(pjmedia_codec_mgr *mgr, codec_param.info.avg_bps = bitrate; codec_param.setting.vad = 0; + /* For G7221, the bitrate is set via param.setting.dec_fmtp, if it has + * no info about bitrate, the codec will check info.avg_bps. So, let's + * just clear the SDP fmtp. + */ + if (pj_ansi_strstr(codec_name, "G7221/")) { + codec_param.setting.dec_fmtp.cnt = 0; + } + status = pjmedia_codec_init(codec, pool); if (status != PJ_SUCCESS) { rc = -60; |