當前位置: 首頁>>代碼示例>>Java>>正文


Java SipCallSessionImpl.setMediaHasVideo方法代碼示例

本文整理匯總了Java中com.csipsimple.service.impl.SipCallSessionImpl.setMediaHasVideo方法的典型用法代碼示例。如果您正苦於以下問題:Java SipCallSessionImpl.setMediaHasVideo方法的具體用法?Java SipCallSessionImpl.setMediaHasVideo怎麽用?Java SipCallSessionImpl.setMediaHasVideo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.csipsimple.service.impl.SipCallSessionImpl的用法示例。


在下文中一共展示了SipCallSessionImpl.setMediaHasVideo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateSessionFromPj

import com.csipsimple.service.impl.SipCallSessionImpl; //導入方法依賴的package包/類
/**
 * Update the call session infos
 * 
 * @param session The session to update (input/output). Must have a correct
 *            call id set
 * @param service PjSipService Sip service to retrieve pjsip accounts infos
 * @throws SameThreadException
 */
public static void updateSessionFromPj(SipCallSessionImpl session, pjsip_event e, Context context)
        throws SameThreadException {
    Log.d(THIS_FILE, "Update call " + session.getCallId());
    pjsua_call_info pjInfo = new pjsua_call_info();
    int status = pjsua.call_get_info(session.getCallId(), pjInfo);

    if (status == pjsua.PJ_SUCCESS) {
        // Transform pjInfo into CallSession object
        updateSession(session, pjInfo, context);
        
        // Update state here because we have pjsip_event here and can get q.850 state
        if(e != null) {
            // Status code
            int status_code = pjsua.get_event_status_code(e);
            if(status_code == 0) {
                try {
                    status_code = pjInfo.getLast_status().swigValue();
                } catch (IllegalArgumentException err) {
                    // The status code does not exist in enum ignore it
                }
            }
            session.setLastStatusCode(status_code);
            Log.d(THIS_FILE, "Last status code is " + status_code);
            // TODO - get comment from q.850 state as well
            String status_text = PjSipService.pjStrToString(pjInfo.getLast_status_text());
            session.setLastStatusComment(status_text);
            
            // Reason code
            int reason_code = pjsua.get_event_reason_code(e);
            if (reason_code != 0) {
                session.setLastReasonCode(reason_code);
            }
        }
        
        // And now, about secure information
        session.setSignalisationSecure(pjsua.call_secure_sig_level(session.getCallId()));
        String secureInfo = PjSipService.pjStrToString(pjsua.call_secure_media_info(session
                .getCallId()));
        session.setMediaSecureInfo(secureInfo);
        session.setMediaSecure(!TextUtils.isEmpty(secureInfo));
        zrtp_state_info zrtpInfo = pjsua.jzrtp_getInfoFromCall(session.getCallId());
        session.setZrtpSASVerified(zrtpInfo.getSas_verified() == pjsuaConstants.PJ_TRUE);
        session.setHasZrtp(zrtpInfo.getSecure() == pjsuaConstants.PJ_TRUE);

        // About video info
        int vidStreamIdx = pjsua.call_get_vid_stream_idx(session.getCallId());
        if(vidStreamIdx >= 0) {
             int hasVid = pjsua.call_vid_stream_is_running(session.getCallId(), vidStreamIdx, pjmedia_dir.PJMEDIA_DIR_DECODING);
             session.setMediaHasVideo((hasVid == pjsuaConstants.PJ_TRUE));
        }
        

    } else {
        Log.d(THIS_FILE,
                "Call info from does not exists in stack anymore - assume it has been disconnected");
        session.setCallState(pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED.swigValue());
    }
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:67,代碼來源:PjSipCalls.java


注:本文中的com.csipsimple.service.impl.SipCallSessionImpl.setMediaHasVideo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。