From 988d451bfb7c095a883cd17dba252f3ca0776b0b Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Fri, 29 Jan 2010 15:51:09 +0000 Subject: Ticket #1028: - Updated codecs docs, more detail info about codec settings. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3083 74dad513-b988-da41-8d7b-12977e46ad98 --- pjmedia/include/pjmedia-codec/g722.h | 17 +- pjmedia/include/pjmedia-codec/g7221.h | 74 +++++--- pjmedia/include/pjmedia-codec/gsm.h | 17 +- pjmedia/include/pjmedia-codec/ilbc.h | 45 ++++- pjmedia/include/pjmedia-codec/ipp_codecs.h | 255 +++++++++++++++++++++++++++- pjmedia/include/pjmedia-codec/l16.h | 16 +- pjmedia/include/pjmedia-codec/passthrough.h | 183 +++++++++++++++++++- pjmedia/include/pjmedia-codec/speex.h | 31 +++- pjmedia/include/pjmedia/g711.h | 23 ++- 9 files changed, 622 insertions(+), 39 deletions(-) diff --git a/pjmedia/include/pjmedia-codec/g722.h b/pjmedia/include/pjmedia-codec/g722.h index 328356e0..71a5bb5b 100644 --- a/pjmedia/include/pjmedia-codec/g722.h +++ b/pjmedia/include/pjmedia-codec/g722.h @@ -33,12 +33,27 @@ * @brief Implementation of G.722 Codec * @{ * - * This section describes functions to register and register G.722 codec + * This section describes functions to initialize and register G.722 codec * factory to the codec manager. After the codec factory has been registered, * application can use @ref PJMEDIA_CODEC API to manipulate the codec. * + * The G.722 implementation uses 16-bit PCM with sampling rate 16000Hz and + * 20ms frame length resulting in 64kbps bitrate. + * * The G.722 codec implementation is provided as part of pjmedia-codec * library, and does not depend on external G.722 codec implementation. + * + * \section codec_setting Codec Settings + * + * \subsection general_setting General Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsection specific_setting Codec Specific Settings + * + * Currently none. */ PJ_BEGIN_DECL diff --git a/pjmedia/include/pjmedia-codec/g7221.h b/pjmedia/include/pjmedia-codec/g7221.h index ba66c229..9785b44a 100644 --- a/pjmedia/include/pjmedia-codec/g7221.h +++ b/pjmedia/include/pjmedia-codec/g7221.h @@ -28,41 +28,71 @@ #include /** - * @defgroup PJMED_G7221_CODEC G722.1 Codec + * @defgroup PJMED_G7221_CODEC G.722.1 Codec (Siren7/Siren14) * @ingroup PJMEDIA_CODEC_CODECS - * @brief Implementation of G722.1 codec + * @brief Implementation of G.722.1 codec * @{ * - * G722.1 licensed from PolycomŽ - * G722.1 Annex C licensed from PolycomŽ + * G.722.1 licensed from PolycomŽ
+ * G.722.1 Annex C licensed from PolycomŽ * - * This section describes functions to register and register G722.1 codec + * This section describes functions to initialize and register G.722.1 codec * factory to the codec manager. After the codec factory has been registered, * application can use @ref PJMEDIA_CODEC API to manipulate the codec. * * PJMEDIA G722.1 codec implementation is based on ITU-T Recommendation * G.722.1 (05/2005) C fixed point implementation including its Annex C. * - * G722.1 is a low complexity codec that supports for 7kHz and 14kHz bandwidth - * audio signals working at bitrates ranging from 16kbps to 48kbps. It may be + * G.722.1 is a low complexity codec that supports 7kHz and 14kHz audio + * bandwidth working at bitrates ranging from 16kbps to 48kbps. It may be * used with speech or music inputs. * - * The codec implementation supports for standard and non-standard bitrates. - * By default, the standard bitrates are enabled upon initialization, i.e.: - * - 24kbps and 32kbps for audio bandwidth 7 kHz (16kHz sampling rate), - * - 24kbps, 32kbps, and 48kbps for audio bandwidth 14 kHz (32kHz sampling - * rate). - * The usage of non-standard bitrates must follow this requirements: - * - for sampling rate 16kHz: 16000 to 32000 bps, it must be a multiple of 400 - * - for sampling rate 32kHz: 24000 to 48000 bps, it must be a multiple of 400 - * Note that currently it is only up to two non-standard modes can be enabled - * at one time. + * + * \section codec_setting Codec Settings + * + * \subsection general_setting General Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsection specific_setting Codec Specific Settings + * + * The following settings are applicable for this codec. + * + * \subsubsection bitrate Bitrate + * + * The codec implementation supports standard and non-standard bitrates. + * Use #pjmedia_codec_g7221_set_mode() to enable or disable the bitrates. + * + * By default, only standard bitrates are enabled upon initialization: + * - for 7kHz audio bandwidth (16kHz sampling rate): 24kbps and 32kbps, + * - for 14kHz audio bandwidth (32kHz sampling rate): 24kbps, 32kbps, and + * 48kbps. + * + * The usage of non-standard bitrates must follow these requirements: + * - for 7kHz audio bandwidth (16kHz sampling rate): 16000 to 32000 bps, + * multiplication of 400 + * - for 14kHz audio bandwidth (32kHz sampling rate): 24000 to 48000 bps, + * multiplication of 400 + * + * \note + * Currently only up to two non-standard modes can be enabled. + * + * \remark + * There is a flaw in the codec manager as currently it could not + * differentiate G.722.1 codecs by bitrates, hence invoking + * #pjmedia_codec_mgr_set_default_param() may only affect a G.722.1 codec + * with the highest priority (or first index found in codec enumeration + * when they have same priority) and invoking + * #pjmedia_codec_mgr_set_codec_priority() will set priority of all G.722.1 + * codecs with sampling rate as specified. */ PJ_BEGIN_DECL /** - * Initialize and register G722.1 codec factory to pjmedia endpoint. + * Initialize and register G.722.1 codec factory to pjmedia endpoint. * * @param endpt The pjmedia endpoint. * @@ -72,13 +102,13 @@ PJ_DECL(pj_status_t) pjmedia_codec_g7221_init( pjmedia_endpt *endpt ); /** - * Enable and disable G722.1 mode. By default, the standard modes are + * Enable and disable G.722.1 mode. By default, the standard modes are * enabled upon initialization, i.e.: * - sampling rate 16kHz, bitrate 24kbps and 32kbps. * - sampling rate 32kHz, bitrate 24kbps, 32kbps, and 48kbps. * This function can also be used for enabling non-standard modes. - * Note that currently it is only up to two non-standard modes can be - * enabled at one time. + * Note that currently only up to two non-standard modes can be enabled + * at one time. * * @param sample_rate PCM sampling rate, in Hz, valid values are only * 16000 and 32000. @@ -110,7 +140,7 @@ PJ_DECL(pj_status_t) pjmedia_codec_g7221_set_pcm_shift(int val); /** - * Unregister G722.1 codecs factory from pjmedia endpoint. + * Unregister G.722.1 codecs factory from pjmedia endpoint. * * @return PJ_SUCCESS on success. */ diff --git a/pjmedia/include/pjmedia-codec/gsm.h b/pjmedia/include/pjmedia-codec/gsm.h index 1851aa3f..537c5fd5 100644 --- a/pjmedia/include/pjmedia-codec/gsm.h +++ b/pjmedia/include/pjmedia-codec/gsm.h @@ -33,9 +33,24 @@ * @brief Implementation of GSM FR based on GSM 06.10 library * @{ * - * This section describes functions to register and register GSM codec + * This section describes functions to initialize and register GSM codec * factory to the codec manager. After the codec factory has been registered, * application can use @ref PJMEDIA_CODEC API to manipulate the codec. + * + * The GSM codec supports 16-bit PCM with sampling rate of 8000Hz resulting + * in 13.2kbps bitrate. + * + * \section codec_setting Codec Settings + * + * \subsection general_setting General Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsection specific_setting Codec Specific Settings + * + * Currently none. */ PJ_BEGIN_DECL diff --git a/pjmedia/include/pjmedia-codec/ilbc.h b/pjmedia/include/pjmedia-codec/ilbc.h index 9e4b2d82..494899f1 100644 --- a/pjmedia/include/pjmedia-codec/ilbc.h +++ b/pjmedia/include/pjmedia-codec/ilbc.h @@ -33,9 +33,52 @@ * @brief Implementation of iLBC Codec * @{ * - * This section describes functions to register and register iLBC codec + * This section describes functions to initialize and register iLBC codec * factory to the codec manager. After the codec factory has been registered, * application can use @ref PJMEDIA_CODEC API to manipulate the codec. + * + * The iLBC codec is developed by Global IP Solutions (GIPS), formerly + * Global IP Sound. The iLBC offers low bitrate and graceful audio quality + * degradation on frame losses. + * + * The iLBC codec supports 16-bit PCM audio signal with sampling rate of + * 8000Hz operating at two modes: 20ms and 30ms frame length modes, resulting + * in bitrates of 15.2kbps for 20ms mode and 13.33kbps for 30ms mode. + * + * + * \section codec_setting Codec Settings + * + * \subsection general_setting General Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsection specific_setting Codec Specific Settings + * + * The following settings are applicable for this codec. + * + * \subsubsection mode Mode + * + * The default mode should be set upon initialization, see + * #pjmedia_codec_ilbc_init(). After the codec is initialized, the default + * mode can be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, iLBC mode can be set by specifying SDP + * format parameter "mode" in the SDP "a=fmtp" attribute for decoding + * direction. Valid values are "20" and "30" (for 20ms and 30ms mode + * respectively). + * + * Here is an example to set up #pjmedia_codec_param to use mode 20ms: + * \code + pjmedia_codec_param param; + ... + // setting iLBC mode in SDP + param.setting.dec_fmtp.cnt = 1; + param.setting.dec_fmtp.param[0].name = pj_str("mode"); + param.setting.dec_fmtp.param[0].val = pj_str("20"); + ... + \endcode */ PJ_BEGIN_DECL diff --git a/pjmedia/include/pjmedia-codec/ipp_codecs.h b/pjmedia/include/pjmedia-codec/ipp_codecs.h index 16459b3b..98eb8a87 100644 --- a/pjmedia/include/pjmedia-codec/ipp_codecs.h +++ b/pjmedia/include/pjmedia-codec/ipp_codecs.h @@ -33,11 +33,260 @@ * @brief Implementation of IPP codecs * @{ * - * This section describes functions to register and register IPP codec + * This section describes functions to initialize and register IPP codec * factory to the codec manager. After the codec factory has been registered, * application can use @ref PJMEDIA_CODEC API to manipulate the codec. - * This codec factory contains various codecs, e.g: G.729, G.723.1, G.726, - * G.728, G.722.1, AMR. + * + * This codec factory contains various codecs, i.e: G.729, G.723.1, G.726, + * G.728, G.722.1, AMR, and AMR-WB. + * + * + * \section pjmedia_codec_ipp_g729 IPP G.729 + * + * IPP G.729 is compliant with ITU-T G.729 and Annexes A, B, C, C+, D, + * E, I specifications. However, currently the pjmedia implementation is + * using Annexes A and B only. + * + * IPP G.729 supports 16-bit PCM audio signal with sampling rate 8000Hz, + * frame length 10ms, and resulting in bitrate 8000bps (annexes D and E + * introduce bitrates 6400bps and 11800bps). + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * Note that G.729 VAD status should be signalled in SDP, see more + * description below. + * + * \subsubsection annexb Annex B + * + * The capability of VAD/DTX is specified in Annex B. + * + * By default, Annex B is enabled. This default setting of Annex B can + * be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, Annex B is configured via VAD setting and + * format parameter "annexb" in the SDP "a=fmtp" attribute in + * decoding fmtp field. Valid values are "yes" and "no", + * the implementation default is "yes". When this parameter is omitted + * in the SDP, the value will be "yes" (RFC 4856 Section 2.1.9). + * + * Here is an example of modifying default setting of Annex B to + * be disabled using #pjmedia_codec_mgr_set_default_param(): + \code + pjmedia_codec_param param; + + pjmedia_codec_mgr_get_default_param(.., ¶m); + ... + // Set VAD + param.setting.vad = 0; + // Set SDP format parameter + param.setting.dec_fmtp.cnt = 1; + param.setting.dec_fmtp.param[0].name = pj_str("annexb"); + param.setting.dec_fmtp.param[0].val = pj_str("no"); + ... + pjmedia_codec_mgr_set_default_param(.., ¶m); + \endcode + * + * \note + * The difference of Annex B status in SDP offer/answer may be considered as + * incompatible codec in SDP negotiation. + * + * + * \section pjmedia_codec_ipp_g7231 IPP G.723.1 + * + * IPP G.723.1 speech codec is compliant with ITU-T G.723.1 and Annex A + * specifications. + * + * IPP G.723.1 supports 16-bit PCM audio signal with sampling rate 8000Hz, + * frame length 30ms, and resulting in bitrates 5300bps and 6300bps. + * + * By default, pjmedia implementation uses encoding bitrate of 6300bps. + * The bitrate is signalled in-band in G.723.1 frames and interoperable. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * + * \section pjmedia_codec_ipp_g726 IPP G.726 + * + * IPP G.726 is compliant with ITU-T G.726 and G.726 Annex A specifications. + * + * IPP G.726 supports 16-bit PCM audio signal with sampling rate 8000Hz, + * 10ms frame length and producing 16kbps, 24kbps, 32kbps, 48kbps bitrates. + * The bitrate is specified explicitly in its encoding name, i.e: G726-16, + * G726-24, G726-32, G726-48. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * + * \section pjmedia_codec_ipp_g728 IPP G.728 + * + * IPP G.728 is compliant with ITU-T G.728 with I, G, H Appendixes + * specifications for Low-Delay CELP coder. + * + * IPP G.728 supports 16-bit PCM audio signal with sampling rate 8000Hz, + * 20ms frame length and producing 9.6kbps, 12.8kbps, and 16kbps bitrates. + * + * The pjmedia implementation currently uses 16kbps bitrate only. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * + * \section pjmedia_codec_ipp_g7221 IPP G.722.1 + * + * The pjmedia implementation of IPP G.722.1 supports 16-bit PCM audio + * signal with sampling rate 16000Hz, 20ms frame length and producing + * 16kbps, 24kbps, and 32kbps bitrates. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsubsection bitrate Bitrate + * + * The codec implementation supports only standard bitrates, i.e: + * 24kbps and 32kbps. Both are enabled by default. + * + * \remark + * There is a flaw in the codec manager as currently it could not + * differentiate G.722.1 codecs by bitrates, hence invoking + * #pjmedia_codec_mgr_set_default_param() may only affect a G.722.1 codec + * with the highest priority (or first index found in codec enumeration + * when they have same priority) and invoking + * #pjmedia_codec_mgr_set_codec_priority() will set priority of all G.722.1 + * codecs with sampling rate as specified. + * + * + * \section pjmedia_codec_ipp_amr IPP AMR + * + * The IPP AMR is compliant with GSM06.90-94 specifications for GSM Adaptive + * Multi-Rate codec. + * + * IPP AMR supports 16-bit PCM audio signal with sampling rate 8000Hz, + * 20ms frame length and producing various bitrates that ranges from 4.75kbps + * to 12.2kbps. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsubsection bitrate Bitrate + * + * By default, encoding bitrate is 7400bps. This default setting can be + * modified using #pjmedia_codec_mgr_set_default_param() by specifying + * prefered AMR bitrate in field info::avg_bps of + * #pjmedia_codec_param. Valid bitrates could be seen in + * #pjmedia_codec_amrnb_bitrates. + * + * \subsubsection payload_format Payload Format + * + * There are two AMR payload format types, bandwidth-efficient and + * octet-aligned. Default setting is using octet-aligned. This default payload + * format can be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, payload format can be set by specifying SDP + * format parameters "octet-align" in the SDP "a=fmtp" attribute for + * decoding direction. Valid values are "0" (for bandwidth efficient mode) + * and "1" (for octet-aligned mode). + * + * \subsubsection mode_set Mode-Set + * + * Mode-set is used for restricting AMR modes in decoding direction. + * + * By default, no mode-set restriction applied. This default setting can be + * be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, mode-set could be specified via format parameters + * "mode-set" in the SDP "a=fmtp" attribute for decoding direction. Valid + * value is a comma separated list of modes from the set 0 - 7, e.g: + * "4,5,6,7". When this parameter is omitted, no mode-set restrictions applied. + * + * Here is an example of modifying AMR default codec param: + \code + pjmedia_codec_param param; + + pjmedia_codec_mgr_get_default_param(.., ¶m); + ... + // set default encoding bitrate to the highest 12.2kbps + param.info.avg_bps = 12200; + + // restrict decoding bitrate to 10.2kbps and 12.2kbps only + param.setting.dec_fmtp.param[0].name = pj_str("mode-set"); + param.setting.dec_fmtp.param[0].val = pj_str("6,7"); + + // also set to use bandwidth-efficient payload format + param.setting.dec_fmtp.param[1].name = pj_str("octet-align"); + param.setting.dec_fmtp.param[1].val = pj_str("0"); + + param.setting.dec_fmtp.cnt = 2; + ... + pjmedia_codec_mgr_set_default_param(.., ¶m); + \endcode + * + * + * \section pjmedia_codec_ipp_amrwb IPP AMR-WB + * + * The IPP AMR-WB is compliant with 3GPP TS 26.190-192, 194, 201 + * specifications for Adaptive Multi-Rate WideBand codec. + * + * IPP AMR-WB supports 16-bit PCM audio signal with sampling rate 16000Hz, + * 20ms frame length and producing various bitrates. Valid bitrates could be + * seen in #pjmedia_codec_amrwb_bitrates. The pjmedia implementation default + * bitrate is 15850bps. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsubsection bitrate Bitrate + * + * By default, encoding bitrate is 15850bps. This default setting can be + * modified using #pjmedia_codec_mgr_set_default_param() by specifying + * prefered AMR bitrate in field info::avg_bps of + * #pjmedia_codec_param. + * + * \subsubsection payload_format Payload Format + * + * There are two AMR payload format types, bandwidth-efficient and + * octet-aligned. Default setting is using octet-aligned. This default payload + * format can be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, payload format can be set by specifying SDP + * format parameters "octet-align" in the SDP "a=fmtp" attribute for + * decoding direction. Valid values are "0" (for bandwidth efficient mode) + * and "1" (for octet-aligned mode). + * + * \subsubsection mode_set Mode-Set + * + * Mode-set is used for restricting AMR modes in decoding direction. + * + * By default, no mode-set restriction applied. This default setting can be + * be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, mode-set could be specified via format parameters + * "mode-set" in the SDP "a=fmtp" attribute for decoding direction. Valid + * value is a comma separated list of modes from the set 0 - 7, e.g: + * "4,5,6,7". When this parameter is omitted, no mode-set restrictions applied. */ PJ_BEGIN_DECL diff --git a/pjmedia/include/pjmedia-codec/l16.h b/pjmedia/include/pjmedia-codec/l16.h index 44503c03..295f6be1 100644 --- a/pjmedia/include/pjmedia-codec/l16.h +++ b/pjmedia/include/pjmedia-codec/l16.h @@ -26,16 +26,28 @@ /** * @defgroup PJMED_L16 L16 Codec Family * @ingroup PJMEDIA_CODEC_CODECS - * @brief PCM/16bit/linear codecs + * @brief Implementation of PCM/16bit/linear codecs * @{ * - * This section describes functions to register and register L16 codec + * This section describes functions to initialize and register L16 codec * factory to the codec manager. After the codec factory has been registered, * application can use @ref PJMEDIA_CODEC API to manipulate the codec. * * Note that the L16 codec factory registers several (about fourteen!) * L16 codec types to codec manager (different combinations of clock * rate and number of channels). + * + * \section codec_setting Codec Settings + * + * \subsection general_setting General Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsection specific_setting Codec Specific Settings + * + * Currently none. */ PJ_BEGIN_DECL diff --git a/pjmedia/include/pjmedia-codec/passthrough.h b/pjmedia/include/pjmedia-codec/passthrough.h index 7a47af1a..828f5d65 100644 --- a/pjmedia/include/pjmedia-codec/passthrough.h +++ b/pjmedia/include/pjmedia-codec/passthrough.h @@ -33,17 +33,188 @@ * @brief Implementation of passthrough codecs * @{ * - * This section describes functions to register and register passthrough + * This section describes functions to initialize and register passthrough * codecs factory to the codec manager. After the codec factory has been * registered, application can use @ref PJMEDIA_CODEC API to manipulate - * the codec. This codec factory contains various codecs, e.g: G.729, iLBC, - * AMR, and G.711. + * the codec. * - * Passthrough codecs are codecs wrapper that does not perform encoding - * or decoding, it just pack and parse encoded audio data from/into RTP + * Passthrough codecs are codecs wrapper that does NOT perform encoding + * or decoding, it just PACK and PARSE encoded audio data from/into RTP * payload. This will accomodate pjmedia ports which work with encoded * audio data, e.g: encoded audio files, sound device with capability * of playing/recording encoded audio data. + * + * This codec factory contains various codecs, i.e: G.729, iLBC, + * AMR, and G.711. + * + * + * \section pjmedia_codec_passthrough_g729 Passthrough G.729 + * + * G.729 supports 16-bit PCM audio signal with sampling rate 8000Hz, + * frame length 10ms, and resulting in bitrate 8000bps. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * Note that G.729 VAD status should be signalled in SDP, see more + * description below. + * + * \subsubsection annexb Annex B + * + * The capability of VAD/DTX is specified in Annex B. + * + * By default, Annex B is enabled. This default setting of Annex B can + * be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, Annex B is configured via VAD setting and + * format parameter "annexb" in the SDP "a=fmtp" attribute in + * decoding fmtp field. Valid values are "yes" and "no", + * the implementation default is "yes". When this parameter is omitted + * in the SDP, the value will be "yes" (RFC 4856 Section 2.1.9). + * + * Here is an example of modifying default setting of Annex B to + * be disabled using #pjmedia_codec_mgr_set_default_param(): + \code + pjmedia_codec_param param; + + pjmedia_codec_mgr_get_default_param(.., ¶m); + ... + // Set VAD + param.setting.vad = 0; + // Set SDP format parameter + param.setting.dec_fmtp.cnt = 1; + param.setting.dec_fmtp.param[0].name = pj_str("annexb"); + param.setting.dec_fmtp.param[0].val = pj_str("no"); + ... + pjmedia_codec_mgr_set_default_param(.., ¶m); + \endcode + * + * \note + * The difference of Annex B status in SDP offer/answer may be considered as + * incompatible codec in SDP negotiation. + * + * + * \section pjmedia_codec_passthrough_ilbc Passthrough iLBC + * + * The iLBC codec is developed by Global IP Solutions (GIPS), formerly + * Global IP Sound. The iLBC offers low bitrate and graceful audio quality + * degradation on frame losses. + * + * The iLBC codec supports 16-bit PCM audio signal with sampling rate of + * 8000Hz operating at two modes: 20ms and 30ms frame length modes, resulting + * in bitrates of 15.2kbps for 20ms mode and 13.33kbps for 30ms mode. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsubsection mode Mode + * + * The default mode should be set upon initialization, see + * #pjmedia_codec_passthrough_init2(). After the codec is initialized, the + * default mode can be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, iLBC mode can be set by specifying SDP + * format parameter "mode" in the SDP "a=fmtp" attribute for decoding + * direction. Valid values are "20" and "30" (for 20ms and 30ms mode + * respectively). + * + * Here is an example to set up #pjmedia_codec_param to use mode 20ms: + * \code + pjmedia_codec_param param; + ... + // setting iLBC mode in SDP + param.setting.dec_fmtp.cnt = 1; + param.setting.dec_fmtp.param[0].name = pj_str("mode"); + param.setting.dec_fmtp.param[0].val = pj_str("20"); + ... + \endcode + * + * + * \section pjmedia_codec_passthrough_amr Passthrough AMR + * + * IPP AMR supports 16-bit PCM audio signal with sampling rate 8000Hz, + * 20ms frame length and producing various bitrates that ranges from 4.75kbps + * to 12.2kbps. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsubsection bitrate Bitrate + * + * By default, encoding bitrate is 7400bps. This default setting can be + * modified using #pjmedia_codec_mgr_set_default_param() by specifying + * prefered AMR bitrate in field info::avg_bps of + * #pjmedia_codec_param. Valid bitrates could be seen in + * #pjmedia_codec_amrnb_bitrates. + * + * \subsubsection payload_format Payload Format + * + * There are two AMR payload format types, bandwidth-efficient and + * octet-aligned. Default setting is using octet-aligned. This default payload + * format can be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, payload format can be set by specifying SDP + * format parameters "octet-align" in the SDP "a=fmtp" attribute for + * decoding direction. Valid values are "0" (for bandwidth efficient mode) + * and "1" (for octet-aligned mode). + * + * \subsubsection mode_set Mode-Set + * + * Mode-set is used for restricting AMR modes in decoding direction. + * + * By default, no mode-set restriction applied. This default setting can be + * be modified using #pjmedia_codec_mgr_set_default_param(). + * + * In #pjmedia_codec_param, mode-set could be specified via format parameters + * "mode-set" in the SDP "a=fmtp" attribute for decoding direction. Valid + * value is a comma separated list of modes from the set 0 - 7, e.g: + * "4,5,6,7". When this parameter is omitted, no mode-set restrictions applied. + * + * Here is an example of modifying AMR default codec param: + \code + pjmedia_codec_param param; + + pjmedia_codec_mgr_get_default_param(.., ¶m); + ... + // set default encoding bitrate to the highest 12.2kbps + param.info.avg_bps = 12200; + + // restrict decoding bitrate to 10.2kbps and 12.2kbps only + param.setting.dec_fmtp.param[0].name = pj_str("mode-set"); + param.setting.dec_fmtp.param[0].val = pj_str("6,7"); + + // also set to use bandwidth-efficient payload format + param.setting.dec_fmtp.param[1].name = pj_str("octet-align"); + param.setting.dec_fmtp.param[1].val = pj_str("0"); + + param.setting.dec_fmtp.cnt = 2; + ... + pjmedia_codec_mgr_set_default_param(.., ¶m); + \endcode + * + * + * \section pjmedia_codec_passthrough_g711 Passthrough G.711 + * + * The G.711 is an ultra low complexity codecs and in trade-off it results + * in high bitrate, i.e: 64kbps for 16-bit PCM with sampling rate 8000Hz. + * + * The factory contains two main compression algorithms, PCMU/u-Law and + * PCMA/A-Law. + * + * \subsection codec_setting Codec Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. */ PJ_BEGIN_DECL @@ -78,7 +249,7 @@ PJ_DECL(pj_status_t) pjmedia_codec_passthrough_init( pjmedia_endpt *endpt ); * with only specified encoding formats enabled. * * @param endpt The pjmedia endpoint. - * @param setting The settings, see @pjmedia_codec_passthrough_setting. + * @param setting The settings. * * @return PJ_SUCCESS on success. */ diff --git a/pjmedia/include/pjmedia-codec/speex.h b/pjmedia/include/pjmedia-codec/speex.h index 22402e5e..c47fe618 100644 --- a/pjmedia/include/pjmedia-codec/speex.h +++ b/pjmedia/include/pjmedia-codec/speex.h @@ -33,14 +33,43 @@ * @brief Implementation of Speex codecs (narrow/wide/ultrawide-band). * @{ * - * This section describes functions to register and register speex codec + * This section describes functions to initialize and register speex codec * factory to the codec manager. After the codec factory has been registered, * application can use @ref PJMEDIA_CODEC API to manipulate the codec. * + * The Speex codec uses multiple bit rates, and supports ultra-wideband + * (32 kHz sampling rate), wideband (16 kHz sampling rate) and narrowband + * (telephone quality, 8 kHz sampling rate) + * * By default, the speex codec factory registers three Speex codecs: * "speex/8000" narrowband codec, "speex/16000" wideband codec, and * "speex/32000" ultra-wideband codec. This behavior can be changed by * specifying #pjmedia_speex_options flags during initialization. + * + * + * \section codec_setting Codec Settings + * + * \subsection general_setting General Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsection specific_setting Codec Specific Settings + * + * The following settings are applicable for this codec. + * + * \subsubsection quality_vs_complexity Quality vs Complexity + * + * The Speex codec quality versus computational complexity and bandwidth + * requirement can be adjusted by modifying the quality and complexity + * setting, by calling #pjmedia_codec_speex_set_param(). The RFC 5574 + * Section 5 shows the relationship between quality setting and the + * resulting bitrate. + * + * The default setting of quality is specified in + * #PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY. And the default setting of + * complexity is specified in #PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY. */ PJ_BEGIN_DECL diff --git a/pjmedia/include/pjmedia/g711.h b/pjmedia/include/pjmedia/g711.h index 2e7fcf1f..cdbe5a3e 100644 --- a/pjmedia/include/pjmedia/g711.h +++ b/pjmedia/include/pjmedia/g711.h @@ -28,13 +28,32 @@ #include /** - * @defgroup PJMED_G711 G711 G.711 Codec + * @defgroup PJMED_G711 G.711 Codec * @ingroup PJMEDIA_CODEC_CODECS * @brief Standard G.711/PCMA and PCMU codec. * @{ - * This section describes functions to register and register G.711 codec + * + * This section describes functions to initialize and register G.711 codec * factory to the codec manager. After the codec factory has been registered, * application can use @ref PJMEDIA_CODEC API to manipulate the codec. + * + * The G.711 is an ultra low complexity codecs and in trade-off it results + * in high bitrate, i.e: 64kbps for 16-bit PCM with sampling rate 8000Hz. + * + * The factory contains two main compression algorithms, PCMU/u-Law and + * PCMA/A-Law. + * + * \section codec_setting Codec Settings + * + * \subsection general_setting General Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsection specific_setting Codec Specific Settings + * + * Currently none. */ PJ_BEGIN_DECL -- cgit v1.2.3