# 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

  • Audio codec,with opus、PCMU、PCMA、G729、G722、AAC、AMR、AMR-WB、iLBC

  • The priority of consultation is arranged in order, and each codec is separated by “;”, pay attention to case

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

  • Audio red anti-loss pakage increases payload bit rate when it opens

  • Close enhanced anti-pakage ability to save bit rate and reduce power consumption

  • Usuallyly choose open in unstable network

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

  • If the noise at the receiving end is loud, increase the noise suppression level at the transmitting end

  • If the sound at the receiving end is low, and the suppression level can be reduced or the suppression can be turned off without affecting the sound quality

audioQosAgc

bool

Automatic gain control of sound at the sender

audioQosVad

bool

Silence detection

Video Parameters

Parameters

Type

Description

videoEnableCodecs

NSString

  • Video codec, with H264-SVC, VP8, VP9, H264, H265, H263

  • The priority of consultation are arrangeded in order

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

  • The initial video bit rate kb; the initial bit rate affects the definition of the video at the beginning

  • The initial code rate is set to high to reach the required code rate faster, but the initial code rate must be within the range of ars

  • The range of 720p ars is generally between 30kbps~4235.4kbps bitrate; the range of 1080p ars is generally between 30kbps~7471.8kbps bitrate

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

  • Video supports rfc 2198 voice fec-red. Setting the parameter videoRedFec to true can increase the audio and video anti-loss ability, which is displayed by doubling the payload code rate without increasing the header.

  • For example, after Opus 55kbps doubles the bit rate, the final bit rate reaches 90kbps=55+35;

  • After Opus 10kbps doubles the bit rate, the final bit rate reaches 16kbps=10+6

videoRecvFullScreen

bool

Affect the local video request resolution, the default setting is true

Assumption
    1. The default request on this end is 640*360 resolution

    1. The local screen resolution is 360*360

  • true:the requested resolution will be adjusted to 360*360

  • false: the request is still 640*360

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;