Group PJMED_SPEEX

group PJMED_SPEEX

Implementation of Speex codecs (narrow/wide/ultrawide-band).

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 Codec Framework 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.

Codec Settings

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.

Codec Specific Settings

The following settings are applicable for this codec.

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.

Enums

enum pjmedia_speex_options

Bitmask options to be passed during Speex codec factory initialization.

Values:

enumerator PJMEDIA_SPEEX_NO_NB

Disable narrowband mode.

enumerator PJMEDIA_SPEEX_NO_WB

Disable wideband mode.

enumerator PJMEDIA_SPEEX_NO_UWB

Disable ultra-wideband mode.

Functions

pj_status_t pjmedia_codec_speex_init(pjmedia_endpt *endpt, unsigned options, int quality, int complexity)

Initialize and register Speex codec factory to pjmedia endpoint.

See

PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY).

See

PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY).

Parameters
  • endpt – The pjmedia endpoint.

  • options – Bitmask of pjmedia_speex_options (default=0).

  • quality – Specify encoding quality, or use -1 for default (

  • complexity – Specify encoding complexity , or use -1 for default (

Returns

PJ_SUCCESS on success.

pj_status_t pjmedia_codec_speex_init_default(pjmedia_endpt *endpt)

Initialize Speex codec factory using default settings and register to pjmedia endpoint.

Parameters

endpt – The pjmedia endpoint.

Returns

PJ_SUCCESS on success.

pj_status_t pjmedia_codec_speex_set_param(unsigned clock_rate, int quality, int complexity)

Change the settings of Speex codec.

See

PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY).

See

PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY).

Parameters
  • clock_rate – Clock rate of Speex mode to be set.

  • quality – Specify encoding quality, or use -1 for default (

  • complexity – Specify encoding complexity , or use -1 for default (

Returns

PJ_SUCCESS on success.

pj_status_t pjmedia_codec_speex_deinit(void)

Unregister Speex codec factory from pjmedia endpoint and deinitialize the Speex codec library.

Returns

PJ_SUCCESS on success.