Search code examples
iosvideopjsip

How to get video window from call on caller side in iOS?


enter image description hereI am trying to make video calling functional with pjsip. I am using vialerSipLib demo app for this.

Here is the scenario i am trying.

Calling from phoneA to phoneB. Audio is working for both incoming and outgoing calls. But the problem is, video is working on phoneB(ReceiverSide) but I'm unable to get the video on phoneA(CallerSide). Here is my account configuration for video call.

I am using codec H264 for video calling.

acc_cfg.vid_in_auto_show = PJ_TRUE;
acc_cfg.vid_out_auto_transmit = PJ_TRUE;

acc_cfg.vid_wnd_flags = PJMEDIA_VID_DEV_WND_BORDER | PJMEDIA_VID_DEV_WND_RESIZABLE;
acc_cfg.vid_cap_dev = PJMEDIA_VID_DEFAULT_CAPTURE_DEV;
acc_cfg.vid_rend_dev = PJMEDIA_VID_DEFAULT_RENDER_DEV;
acc_cfg.reg_retry_interval = 300;
acc_cfg.reg_first_retry_interval = 30;

Here is how i am getting the video window using callid. There is a black window appeared. Or is there any way to check if the ci.media array has valid video?

- (void) displayWindowWithVoid: (UIView *) parent call:(VSLCall *)call {

int vid_idx;
pjsua_vid_win_id wid;

vid_idx = pjsua_call_get_vid_stream_idx((int)call.callId);
if (vid_idx >= 0) {
    pjsua_call_info ci;

    pjsua_call_get_info((int)call.callId, &ci);
    wid = ci.media[vid_idx].stream.vid.win_in;

    ci.setting.vid_cnt = 1;

    pjsua_vid_win_info wi;
    if (pjsua_vid_win_get_info(wid, &wi) == PJ_SUCCESS) {

        pjsua_vid_win_set_show(wid, true);
        UIView *view = (__bridge UIView *)wi.hwnd.info.ios.window;
         [parent addSubview:view];
    }
}   }

If any one can tell me a client for video calling so i can test the behaviour. Either its the issue on app side or server side. Any help or suggestion will be highly appreciated.


Solution

  • I got it working. Posting this answer as this might be helpful for any other and can save much of his time.

    You must be changing your video formats

    pjmedia_vid_codec_param param;
    pjsua_vid_codec_get_param(&videoCodecInfo[i].codec_id, &param);
    param.ignore_fmtp = PJ_TRUE;
    
    param.enc_fmt.det.vid.size.w = 1280;
    param.enc_fmt.det.vid.size.h = 720;
    param.enc_fmt.det.vid.fps.num = 30;
    param.enc_fmt.det.vid.fps.denum = 1;
    param.dec_fmt.det.vid.size.w = 1280;
    param.dec_fmt.det.vid.size.h = 720;
    

    Might be what exactly format your server support may be helping you. If you need any more help. Please let me know