コード例 #1
0
ファイル: lp_inc.c プロジェクト: ACSOFTWARE/domophone-android
extern "C" jstring Java_com_acsoftware_android_domophone_LibLP_nPayloadTypeToString(JNIEnv*  env, jobject  thiz, jlong ptr) {
        PayloadType* pt = (PayloadType*)ptr;
        char* value = ms_strdup_printf("[%s] clock [%i], bitrate [%i]"
                                                                        ,payload_type_get_mime(pt)
                                                                        ,payload_type_get_rate(pt)
                                                                        ,payload_type_get_bitrate(pt));
        jstring jvalue =env->NewStringUTF(value);
        ms_free(value);
        return jvalue;
}
コード例 #2
0
void CallStatsModel::updateStats(LinphoneCall *call)
{
    if (!call) {
        return;
    }

    float quality = linphone_call_get_current_quality(call);
    if (quality >= 4) {
        _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_4.png";
    } else if (quality >= 3) {
        _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_3.png";
    } else if (quality >= 2) {
        _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_2.png";
    } else if (quality >= 1) {
        _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_1.png";
    } else {
        _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_0.png";
    }

    const LinphoneCallParams *params = linphone_call_get_current_params(call);
    if (!params) {
        return;
    }

    LinphoneMediaEncryption encryption = linphone_call_params_get_media_encryption(params);
    _currentCallSecurityIcon = "/images/statusbar/security_ko.png";
    if (encryption == LinphoneMediaEncryptionSRTP || encryption == LinphoneMediaEncryptionDTLS) {
        _currentCallSecurityIcon = "/images/statusbar/security_ok.png";
    } else if (encryption == LinphoneMediaEncryptionZRTP) {
        _callSecurityToken = tr("ZRTP token is %1.\r\nYou should only accept if you have the same token as your correspondent.").arg(linphone_call_get_authentication_token(call));

        bool isAuthTokenVerified = linphone_call_get_authentication_token_verified(call);
        if (isAuthTokenVerified) {
            _currentCallSecurityIcon = "/images/statusbar/security_ok.png";
        } else {
            _currentCallSecurityIcon = "/images/statusbar/security_pending.png";
        }
        emit zrtpUpdated();
    }

    const LinphoneCallStats *audioStats = linphone_call_get_audio_stats(call);
    if (audioStats) {
        _iceStatus = IceStateToString(linphone_call_stats_get_ice_state(audioStats));
        _downloadAudioBandwidth = QString("<html>&#x2193; %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_download_bandwidth(audioStats)));
        _uploadAudioBandwidth = QString("<html>&#x2191; %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_upload_bandwidth(audioStats)));
    }

    const LinphonePayloadType *audioPayload = linphone_call_params_get_used_audio_codec(params);
    if (audioPayload) {
        _audioCodec = QString(linphone_payload_type_get_mime_type(audioPayload)) + "/" +  QString::number(payload_type_get_rate(audioPayload)) + "/" + QString::number(linphone_payload_type_get_channels(audioPayload));
    }

    if (linphone_call_params_video_enabled(params)) {
        const LinphoneCallStats *videoStats = linphone_call_get_video_stats(call);
        if (videoStats) {
            _downloadVideoBandwidth = QString("<html>&#x2193; %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_download_bandwidth(videoStats)));
            _uploadVideoBandwidth = QString("<html>&#x2191; %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_upload_bandwidth(videoStats)));
        }

        const LinphonePayloadType *videoPayload = linphone_call_params_get_used_video_codec(params);
        if (videoPayload) {
            _videoCodec = QString(linphone_payload_type_get_mime_type(videoPayload));
        }

        MSVideoSize sentVideoSize = linphone_call_params_get_sent_video_size(params);
        float framerate = linphone_call_params_get_sent_framerate(params);
        _sentVideoSize = QString("%1x%2 @ %3 fps").arg(QString::number(sentVideoSize.width), QString::number(sentVideoSize.height), QString::number((int)framerate));

        MSVideoSize receivedVideoSize = linphone_call_params_get_received_video_size(params);
        framerate = linphone_call_params_get_received_framerate(params);
        _receivedVideoSize = QString("%1x%2 @ %3 fps").arg(QString::number(receivedVideoSize.width), QString::number(receivedVideoSize.height), QString::number((int)framerate));
    }

    emit statsUpdated();
}