# Smart hardware
# Set Media Parameters
Before initiating a call, you can select different media parameter configuration modes according to the device type to achieve high-quality audio and video call effects.
Juphoon provides different media configuration modes for developers to choose according to different scenarios, and opens media setting parameters for developers to set flexibly. Details are as follows:
/// 360P
JCCallMediaConfigMode360P,
/// 720P
JCCallMediaConfigMode720P,
/// Smart hardware scenarios, such as calling with a watch, etc.
JCCallMediaConfigModeIntelligentHardware,
Choose one of the phone calls; Smart hardware calls generally select JCCallMediaConfigModeIntelligentHardware mode.
Before initiating a call, developers can select a media configuration mode according to the specific scenario and generate configuration parameters through the following interface:
/// Create configuration parameters according to modes
/// @param mode mode
+(JCCallMediaConfig* __nonnull)generateByMode:(JCCallMediaConfigMode)mode;
After generating the configuration parameters, call the mediaConfig property in JCCall to set:
JCManager.shared.call.mediaConfig = [JCCallMediaConfig generateByMode:JCCallMediaConfigModeIntelligentHardware];
Among them, the media parameters of the three modes are set as follows:
1、JCCallMediaConfigMode360P mode parameters
Parameters | Description |
---|---|
audioAecMode | JCCallAecModeFDE |
audioArsEnable | Open |
audioArsBitrateMin | 20 |
audioArsBitrateMax | 76 |
audioRed | Open |
audioRxAnr | Open |
audioRtx | Open |
audioRxAgc | Open |
audioQosAec | Open |
audioQosAnr | Open |
audioQosAgc | Open |
audioQosVad | Open |
videoResolutionRecvWidth | 640 |
videoResolutionRecvHeight | 360 |
videoResolutionSendWidth | 640 |
videoResolutionSendHeight | 360 |
videoBitrate | 100 |
videoSendFramerate | 30 |
videoArsEnable | Open |
videoArsBitrateMin | 30kpbs |
videoArsBitrateMax | 800kbps |
videoArsFramerateMin | 0 |
videoArsFramerateMax | 30 |
videoRedFec | Open |
videoRecvFullScreen | Open |
videoSmallNalu | Open |
videoResolutionControl | Open |
2、JCCallMediaConfigMode720P
Parameters | Description |
---|---|
audioAecMode | JCCallAecModeFDE |
audioArsEnable | Open |
audioArsBitrateMin | 20 |
audioArsBitrateMax | 76 |
audioRed | Open |
audioRxAnr | Close |
audioRtx | Open |
audioRxAgc | Close |
audioQosAec | Open |
audioQosAnr | Open |
audioQosAgc | Open |
audioQosVad | Open |
videoResolutionRecvWidth | 1280 |
videoResolutionRecvHeight | 720 |
videoResolutionSendWidth | 1280 |
videoResolutionSendHeight | 720 |
videoBitrate | 100 |
videoSendFramerate | 30 |
videoArsEnable | Open |
videoArsBitrateMin | 30kpbs |
videoArsBitrateMax | 2100kbps |
videoArsFramerateMin | 0 |
videoArsFramerateMax | 30 |
videoRedFec; | Open |
videoRecvFullScreen | Open |
videoSmallNalu | Open |
videoResolutionControl | Open |
3、JCCallMediaConfigModeIntelligentHardware
Parameters | Description |
---|---|
audioAecMode | JCCallAecModeFDE |
audioArsEnable | Open |
audioArsBitrateMin | 5 |
audioArsBitrateMax | 20 |
audioRed | Open |
audioRxAnr | Close |
audioRtx | Open |
audioRxAgc | Close |
audioQosAec | Open |
audioQosAnr | Open |
audioQosAgc | Open |
audioQosVad | Open |
videoResolutionRecvWidth; | Depending on the specific situation, the watch is usually 128*128 |
videoResolutionRecvHeight; | Depending on the specific situation, the watch is usually 128*128 |
videoResolutionSendWidth; | Depending on the specific situation, the watch is usually 640*360 |
videoResolutionSendHeight; | Depending on the specific situation, the watch is usually 640*360 |
videoBitrate | 30 |
videoSendFramerate | 15 |
videoArsEnable | Open |
videoArsBitrateMin | Depending on the specific situation, the watch uses 128*128 15 frames 10kpbs |
videoArsBitrateMax | Depending on the specific situation, the watch uses 128*128 15 frames 75kpbs |
videoArsFramerateMin | 0 |
videoArsFramerateMax | 15 |
videoRedFec | Open |
videoRecvFullScreen | Open |
videoSmallNalu | Open |
videoResolutionControl | Open |
In addition to choosing the media configuration mode provided by Juphoon, developers can also customize the media parameters according to the corresponding attributes to meet the needs of different scenarios. The media parameters include audio and video parameters. The instructions are as follows:
Audio Parameters
Parameters | Type | Description |
---|---|---|
audioEnableCodecs | NSString |
|
audioAecEnable | bool | Turn on/off echo concellation |
audioAecMode | JCCallAecMode | Echo cancellation mode; refer to JCCallAecMode enumeration value for details |
audioArsEnable | bool | Turn on/off audio ars |
audioArsBitrateMin | int | Audio minimum bit rate,kb |
audioArsBitrateMax | int | Audio maximum bit rate,kb |
audioRed | bool |
|
audioRxAnr | bool | Generally, the noise suppression can be turned off to reduce the sound dsp processing and reduce the power consumption when the sound quality of the receiving end is good |
audioRtx | bool | RTX retransmission, used together with FEC and NACK, reduces power consumption; and usually choose open when the network is unstable |
audioRxAgc | bool | Automatic gain control of sound in the receiving end sound; if the receiving end sound is too loud or too low, you can try to open |
audioQosAec | bool | Echo cancellation |
audioQosAnr | bool |
|
audioQosAgc | bool | Automatic gain control of sound at the sender |
audioQosVad | bool | Silence detection |
Video Parameters
Parameters | Type | Description |
---|---|---|
videoEnableCodecs | NSString |
|
videoResolutionRecvWidth | int | The width of video receiving |
videoResolutionRecvHeight | int | The height of video receiving |
videoResolutionSendWidth | int | The width of video sending |
videoResolutionSendHeight | int | The heigh of video sending |
videoBitrate | int |
|
videoSendFramerate | int | Send frame rate |
videoArsEnable | bool | Turn on/off video ars, that is, automatic video rate control. After turning on, it can ensure the smooth transmission of the coded stream and the full utilization of the channel bandwidth |
videoArsBitrateMin | int | Video minimum bit rate,kb |
videoArsBitrateMax | int | Video maximum bit rate,kb |
videoArsFramerateMin | int | Video minimum frame rate,kb |
videoArsFramerateMax | int | Video maximum frame rate,kb |
videoRedFec | bool |
|
videoRecvFullScreen | bool | Affect the local video request resolution, the default setting is true
|
videoSmallNalu | bool | The video data is packaged in SmallNalu mode, and a package contains more data, which reduces the bit rate of the header, thereby reducing power consumption |
videoResolutionControl | bool | Resolution control; open to change the resolution with network fluctuations and close to fix the resolution |
Among them,AecMode has folowing values:
// Acoustic echo cancellation. Support calls in the hands-free state, which is effective for models with better performance such as iOS and Windows.
public static final int AEC_MODE_AEC = MtcCallDb.EN_MTC_EC_AEC;
// Use the acoustic echo cancellation function provided by the operating system to support calls in the hands-free state. It is valid for most branded phones such as iOS and Android, but some models may not be valid.
public static final int AEC_MODE_OS = MtcCallDb.EN_MTC_EC_OS;
// Acoustic echo suppression, and echo suppression is achieved through half-duplex, usually not recommended.
public static final int AEC_MODE_AES = MtcCallDb.EN_MTC_EC_AES;
// Software adaptive acoustic echo cancellation is effective for most models. But the calculation is slightly larger than that of AEC. SDE tracking delay accuracy is high, FDE can adapt to larger delays.
public static final int AEC_MODE_FDE = MtcCallDb.EN_MTC_EC_AEC_FDE;
// Software adaptive acoustic echo cancellation is effective for most models. But the calculation is slightly larger than that of AEC. SDE tracking delay accuracy is high, FDE can adapt to larger delays.
public static final int AEC_MODE_SDE = MtcCallDb.EN_MTC_EC_AEC_SDE;
Developers can configure by themselves in accordance with specific needs.
Sample code:
//Audio parameters
JCCallMediaConfig* mediaConfig = [JCCallMediaConfig new];
mediaConfig.audioEnableCodecs = @"opus";
mediaConfig.audioAecMode = JCCallAecModeFDE;
mediaConfig.audioArsEnable = true;
mediaConfig.audioArsBitrateMax = 20;
mediaConfig.audioArsBitrateMin = 5;
mediaConfig.audioRed = true;
mediaConfig.audioRxAnr = false;
mediaConfig.audioRtx = true;
mediaConfig.audioRxAgc = false;
mediaConfig.audioQosAec = true;
mediaConfig.audioQosAnr = true;
mediaConfig.audioQosAgc = true;
mediaConfig.audioQosVad = true;
//Video parameters
mediaConfig.videoEnableCodecs = @"H264";
mediaConfig.videoResolutionRecvWidth = 128;
mediaConfig.videoResolutionRecvHeight = 128;
mediaConfig.videoResolutionSendWidth = 640;
mediaConfig.videoResolutionSendHeight = 360;
mediaConfig.videoBitrate = 30;
mediaConfig.videoSendFramerate = 15;
mediaConfig.videoArsEnable = true;
mediaConfig.videoArsBitrateMax = 75;
mediaConfig.videoArsBitrateMin = 10;
mediaConfig.videoArsFramerateMax = 15;
mediaConfig.videoArsFramerateMin = 0;
mediaConfig.videoRedFec = true;
mediaConfig.videoRecvFullScreen = true;
mediaConfig.videoSmallNalu = true;
mediaConfig.videoResolutionControl = true;
JCManager.shared.call.mediaConfig = mediaConfig;