Implementation of SILK codecs (narrow/medium/wide/superwide-band).

This section describes functions to initialize and register SILK codec factory to the codec manager. After the codec factory has been registered, application can use Codec Framework API to manipulate the codec.

The SILK codec uses multiple bit rates, and supports super wideband (24 kHz sampling rate), wideband (16 kHz sampling rate), medium (12kHz sampling rate), and narrowband (telephone quality, 8 kHz sampling rate).

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 SILK codec quality versus computational complexity and bandwidth requirement can be adjusted by modifying the quality and complexity setting, by calling pjmedia_codec_silk_set_config().

The default setting of quality is specified in PJMEDIA_CODEC_SILK_DEFAULT_QUALITY. And the default setting of complexity is specified in PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY.


pj_status_t pjmedia_codec_silk_init(pjmedia_endpt *endpt)

Initialize and register SILK codec factory to pjmedia endpoint. By default, only narrowband (8kHz sampling rate) and wideband (16kHz sampling rate) will be enabled. Quality and complexity for those sampling rate modes will be set to the default values (see PJMEDIA_CODEC_SILK_DEFAULT_QUALITY and PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY), application may modify these settings via pjmedia_codec_silk_set_config().


endpt – The pjmedia endpoint.


PJ_SUCCESS on success.

pj_status_t pjmedia_codec_silk_set_config(unsigned clock_rate, const pjmedia_codec_silk_setting *opt)

Change the configuration setting of the SILK codec for the specified clock rate.

  • clock_rate – PCM sampling rate, in Hz, valid values are 8000, 12000, 16000 and 24000.

  • opt – The setting to be applied for the specified clock rate.


PJ_SUCCESS on success.

pj_status_t pjmedia_codec_silk_deinit(void)

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


PJ_SUCCESS on success.

struct pjmedia_codec_silk_setting

Public Members

pj_bool_t enabled


int quality

Encoding quality, or use -1 for default (

int complexity

Encoding complexity, or use -1 for default (