summaryrefslogtreecommitdiff
path: root/pjmedia/src/pjmedia-codec/passthrough.c
diff options
context:
space:
mode:
Diffstat (limited to 'pjmedia/src/pjmedia-codec/passthrough.c')
-rw-r--r--pjmedia/src/pjmedia-codec/passthrough.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/pjmedia/src/pjmedia-codec/passthrough.c b/pjmedia/src/pjmedia-codec/passthrough.c
index 8fdd8271..ef34bd19 100644
--- a/pjmedia/src/pjmedia-codec/passthrough.c
+++ b/pjmedia/src/pjmedia-codec/passthrough.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <pjmedia-codec/passthrough.h>
+#include <pjmedia-codec/amr_sdp_match.h>
#include <pjmedia/codec.h>
#include <pjmedia/errno.h>
#include <pjmedia/endpoint.h>
@@ -316,6 +317,7 @@ static pj_status_t parse_amr(codec_private_t *codec_data, void *pkt,
PJ_DEF(pj_status_t) pjmedia_codec_passthrough_init( pjmedia_endpt *endpt )
{
pjmedia_codec_mgr *codec_mgr;
+ pj_str_t codec_name;
pj_status_t status;
if (codec_factory.pool != NULL) {
@@ -346,6 +348,19 @@ PJ_DEF(pj_status_t) pjmedia_codec_passthrough_init( pjmedia_endpt *endpt )
goto on_error;
}
+ /* Register format match callback. */
+#if PJMEDIA_HAS_PASSTROUGH_CODEC_AMR
+ pj_cstr(&codec_name, "AMR");
+ status = pjmedia_sdp_neg_register_fmt_match_cb(
+ &codec_name,
+ &pjmedia_codec_amr_match_sdp);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+#endif
+
+ /* Suppress compile warning */
+ PJ_UNUSED_ARG(codec_name);
+
/* Register codec factory to endpoint. */
status = pjmedia_codec_mgr_register_factory(codec_mgr,
&codec_factory.base);
@@ -382,7 +397,7 @@ PJ_DEF(pj_status_t) pjmedia_codec_passthrough_init2(
unsigned j;
for (j = 0; j < setting->fmt_cnt && !enabled; ++j) {
- if (codec_desc[i].fmt_id == setting->fmts[j].id)
+ if ((pj_uint32_t)codec_desc[i].fmt_id == setting->fmts[j].id)
enabled = PJ_TRUE;
}