Audio MediaCodec codec wrapper for Android.
This codec wrapper contains varius codecs: i.e: AMR and AMR-WB.
MediaCodec AMRNB/AMR-WB
MediaCodec 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.
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 MediaCodec doesn't provide internal VAD/PLC feature, they will be provided by PJMEDIA instead.
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.
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).
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:
...
param.info.avg_bps = 12200;
...
pjmedia_codec_mgr_set_default_param(.., ¶m);
pj_str_t pj_str(char *str)
◆ pjmedia_codec_and_media_aud_init()
Initialize and register Android audio MediaCodec factory to pjmedia endpoint.
- Parameters
-
endpt | The pjmedia endpoint. |
- Returns
- PJ_SUCCESS on success.
◆ pjmedia_codec_and_media_aud_deinit()
pj_status_t pjmedia_codec_and_media_aud_deinit |
( |
void |
| ) |
|
Unregister Android audio MediaCodec factory from pjmedia endpoint and deinitialize the codec library.
- Returns
- PJ_SUCCESS on success.
References PJ_END_DECL.