智慧服务,成就美好体验 项目咨询

主页 > 服务与支持 > 开发平台 > 客户端SDK参考 > iOS Native SDK > 会议 获取信号和质量数据

入门使用

获取信号和质量数据

更新时间:2019-11-20

获取信号和质量数据

描述

用户正在通话中或者会议中,用户可以获取当前呼叫的信号强度和质量数据信息,如果在当前正在主动共享或观看共享,用户还能获取共享的质量数据信息。

前提条件

用户正在通话中或者会议中。

业务流程

图1 获取信号和质量数据流程

  1. SDK向UI上报事件TSDK_E_CALL_EVT_STATISTIC_INFO,通知事件携带参数callid标识本次呼叫,信号强度和音视频质量数据,音视频质量数据对应的事件数据结构TSDK_S_CALL_STATISTIC_INFO包含音频和视频呼叫质量信息。UI获取到事件内容后,刷新显示。
    说明: 

    TSDK_E_CALL_EVT_STATISTIC_INFO事件每5秒上报一次,若UI需要更高频率获取音视频质量数据,可以调用tsdk_get_call_statistic_info()接口获取。

    代码示例:

    //c code
    case TSDK_E_CALL_EVT_STATISTIC_INFO:
    {
         handle_call_statistic_info(param1, param2, (TSDK_S_CALL_STATISTIC_INFO *)data);
         break;
    }
     
  2. 如果在当前正在主动共享或观看共享,UI可以调用tsdk_get_share_statistic_info()接口获取共享质量数据,传入参数conf_handle标识本次会议句柄,返回参数数据结构TSDK_S_SHARE_STATISTIC_INFO包含共享质量数据。

    代码示例:

    //c code
    - (VideoStreamInfo *)getSignalDataInfo
    {
        TSDK_S_SHARE_STATISTIC_INFO share_statistic_info;
        memset(&share_statistic_info, 0, sizeof(TSDK_S_SHARE_STATISTIC_INFO));
        tsdk_get_share_statistic_info(_confHandle, &share_statistic_info);
    
        VideoStreamInfo *videoStreamInfo = [[VideoStreamInfo alloc] init];
        videoStreamInfo.sendBitRate = share_statistic_info.send_bit_rate;
        videoStreamInfo.sendFrameSize = [NSString stringWithFormat:@"%u*%u",share_statistic_info.send_frame_size_width,share_statistic_info.send_frame_size_height];
        videoStreamInfo.sendFrameRate = share_statistic_info.send_frame_rate;
        videoStreamInfo.sendLossFraction = share_statistic_info.send_pkt_loss;
        videoStreamInfo.sendDelay = share_statistic_info.send_rtt;
        videoStreamInfo.sendJitter = share_statistic_info.send_jitter;
        videoStreamInfo.recvBitRate = share_statistic_info.recv_bit_rate;
        videoStreamInfo.recvFrameSize = [NSString stringWithFormat:@"%u*%u",share_statistic_info.recv_frame_size_width,share_statistic_info.recv_frame_size_height];
        videoStreamInfo.recvLossFraction = share_statistic_info.recv_pkt_loss;
        videoStreamInfo.recvFrameRate = share_statistic_info.recv_frame_rate;
        videoStreamInfo.recvDelay = share_statistic_info.recv_rtt;
        videoStreamInfo.recvJitter = share_statistic_info.recv_jitter;
    
        return videoStreamInfo;
    }