From ce9088d8978fdd457158ec0ea4c8e11e10b2960f Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Mon, 31 Jul 2006 15:19:36 +0000 Subject: - Added iLBC codec (experimental) with the following features: - configurable default decoder mode (20 or 30), - encoder mode follows the mode specified in SDP fmtp from the remote's SDP, - silence detector uses pjmedia's, - PLC uses iLBC's PLC, - perceptual enhancement (penh) is configurable via codec param, as usual. - iLBC mode is configurable in pjsua with --ilbc-mode option. - Added packet lost simulation in pjmedia's UDP transport and in pjsua (with --rx-drop-pct and --tx-drop-pct options). - Increase default buffer count in DirectSound to 32 frames to make it more resilient to CPU disruption. - Specify and parse fmtp mode in SDP for codecs that need it. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@637 74dad513-b988-da41-8d7b-12977e46ad98 --- pjmedia/include/pjmedia-codec.h | 1 + pjmedia/include/pjmedia-codec/config.h | 8 ++++++++ pjmedia/include/pjmedia-codec/types.h | 3 ++- pjmedia/include/pjmedia/codec.h | 4 ++-- pjmedia/include/pjmedia/errno.h | 10 ++++++++++ pjmedia/include/pjmedia/transport_udp.h | 22 ++++++++++++++++++++++ 6 files changed, 45 insertions(+), 3 deletions(-) (limited to 'pjmedia/include') diff --git a/pjmedia/include/pjmedia-codec.h b/pjmedia/include/pjmedia-codec.h index 3658cb10..f220fd1f 100644 --- a/pjmedia/include/pjmedia-codec.h +++ b/pjmedia/include/pjmedia-codec.h @@ -27,6 +27,7 @@ #include #include #include +#include #endif /* __PJMEDIA_CODEC_PJMEDIA_CODEC_H__ */ diff --git a/pjmedia/include/pjmedia-codec/config.h b/pjmedia/include/pjmedia-codec/config.h index 2006528d..85bd7785 100644 --- a/pjmedia/include/pjmedia-codec/config.h +++ b/pjmedia/include/pjmedia-codec/config.h @@ -46,5 +46,13 @@ #endif +/** + * Unless specified otherwise, iLBC codec is included by default. + */ +#ifndef PJMEDIA_HAS_ILBC_CODEC +# define PJMEDIA_HAS_ILBC_CODEC 1 +#endif + + #endif /* __PJMEDIA_CODEC_CONFIG_H__ */ diff --git a/pjmedia/include/pjmedia-codec/types.h b/pjmedia/include/pjmedia-codec/types.h index a738fb68..18c7bfab 100644 --- a/pjmedia/include/pjmedia-codec/types.h +++ b/pjmedia/include/pjmedia-codec/types.h @@ -48,7 +48,8 @@ enum PJMEDIA_RTP_PT_L16_32KHZ_MONO, /**< L16 @ 32KHz, mono */ PJMEDIA_RTP_PT_L16_32KHZ_STEREO, /**< L16 @ 32KHz, stereo */ PJMEDIA_RTP_PT_L16_48KHZ_MONO, /**< L16 @ 48KHz, mono */ - PJMEDIA_RTP_PT_L16_48KHZ_STEREO /**< L16 @ 48KHz, stereo */ + PJMEDIA_RTP_PT_L16_48KHZ_STEREO, /**< L16 @ 48KHz, stereo */ + PJMEDIA_RTP_PT_ILBC /**< iLBC (13.3/15.2Kbps) */ }; diff --git a/pjmedia/include/pjmedia/codec.h b/pjmedia/include/pjmedia/codec.h index 844f8865..dd611f2f 100644 --- a/pjmedia/include/pjmedia/codec.h +++ b/pjmedia/include/pjmedia/codec.h @@ -271,11 +271,11 @@ typedef struct pjmedia_codec_param pj_uint8_t frm_per_pkt; /**< Number of frames per packet. */ unsigned vad:1; /**< Voice Activity Detector. */ unsigned cng:1; /**< Comfort Noise Generator. */ - unsigned lpf:1; /**< Low pass filter */ - unsigned hpf:1; /**< High pass filter */ unsigned penh:1; /**< Perceptual Enhancement */ unsigned plc:1; /**< Packet loss concealment */ unsigned reserved:1; /**< Reserved, must be zero. */ + pj_uint8_t enc_fmtp_mode; /**< Mode param in fmtp (def:0) */ + pj_uint8_t dec_fmtp_mode; /**< Mode param in fmtp (def:0) */ } setting; } pjmedia_codec_param; diff --git a/pjmedia/include/pjmedia/errno.h b/pjmedia/include/pjmedia/errno.h index c9c6bae2..03608f9f 100644 --- a/pjmedia/include/pjmedia/errno.h +++ b/pjmedia/include/pjmedia/errno.h @@ -298,6 +298,16 @@ PJ_BEGIN_DECL * Invalid codec frame length. */ #define PJMEDIA_CODEC_EFRMINLEN (PJMEDIA_ERRNO_START+84) /* 220084 */ +/** + * @hideinitializer + * Invalid PCM frame length. + */ +#define PJMEDIA_CODEC_EPCMFRMINLEN (PJMEDIA_ERRNO_START+85) /* 220085 */ +/** + * @hideinitializer + * Invalid mode. + */ +#define PJMEDIA_CODEC_EINMODE (PJMEDIA_ERRNO_START+86) /* 220086 */ /************************************************************ diff --git a/pjmedia/include/pjmedia/transport_udp.h b/pjmedia/include/pjmedia/transport_udp.h index 860ea7e3..5a348d32 100644 --- a/pjmedia/include/pjmedia/transport_udp.h +++ b/pjmedia/include/pjmedia/transport_udp.h @@ -143,9 +143,31 @@ PJ_DECL(pj_status_t) pjmedia_transport_udp_attach(pjmedia_endpt *endpt, pjmedia_transport **p_tp); +/** + * Simulate packet lost in the specified direction (for testing purposes). + * When enabled, the transport will randomly drop packets to the specified + * direction. + * + * @param tp The UDP media transport. + * @param dir Media direction to which packets will be randomly dropped. + * @param pct_lost Percent lost (0-100). Set to zero to disable packet + * lost simulation. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_transport_udp_simulate_lost(pjmedia_transport *tp, + pjmedia_dir dir, + unsigned pct_lost); + + + /** * Close UDP transport. Application can also use the "destroy" member of * media transport interface to close the UDP transport. + * + * @param tp The UDP media transport. + * + * @return PJ_SUCCESS on success. */ PJ_DECL(pj_status_t) pjmedia_transport_udp_close(pjmedia_transport *tp); -- cgit v1.2.3