HomeiOS Developmentgoal c - Crash app on video name utilizing PJSIP in ios

goal c – Crash app on video name utilizing PJSIP in ios


When I’m utilizing pod ‘pjsip’,’2.8.0′ then the video name is working superb on My Mac(Designed for iPhone) however when I’m attempting to make a video name on a actual iPhone system crash the app.

libsp.dylib`spd_checkin_socket.chilly.1:
    0x1f9211364 <+0>:  adrp   x8, 150347
    0x1f9211368 <+4>:  adrp   x9, 0
    0x1f921136c <+8>:  add    x9, x9, #0xa3f            ; "Linked towards fashionable SDK, VOIP socket is not going to wake. Use Native Push Connectivity as a substitute"
    0x1f9211370 <+12>: str    x9, [x8, #0xd80]
->  0x1f9211374 <+16>: brk    #0x1

And once I improve pod pjsip, ‘2.9.0’ then it really works on an actual system however the video will not be coming clear. I configured the codec however once more blur video is coming.

    func intislizePJSIP(){
        /* Create pjsua */
        var standing: pj_status_t;
        standing = pjsua_create();
        if (standing != PJ_SUCCESS.rawValue) {
            NSLog("Failed creating pjsua");
        }
        /* Init configs */
        var cfg = pjsua_config();
        var log_cfg = pjsua_logging_config();
        var media_cfg = pjsua_media_config();
        pjsua_config_default(&cfg);
        pjsua_logging_config_default(&log_cfg);
        pjsua_media_config_default(&media_cfg);
        /* Initialize software callbacks */
        cfg.cb.on_call_state = on_call_state;
        cfg.cb.on_call_media_state = on_call_media_state;
        cfg.cb.on_incoming_call = on_incoming_call;
     
        /* Init pjsua */
        standing = pjsua_init(&cfg, &log_cfg, &media_cfg);
     
     
        
        /* Create transport */
        var transport_id = pjsua_transport_id();
        var tcp_cfg = pjsua_transport_config();
        pjsua_transport_config_default(&tcp_cfg);
        tcp_cfg.port = 5060;
     
        standing = pjsua_transport_create(PJSIP_TRANSPORT_UDP,
                                     &tcp_cfg, &transport_id);
        standing = pjsua_transport_create(PJSIP_TRANSPORT_TCP,
                                        &tcp_cfg, &transport_id);
     
     
        /* Init account config */
        let id = strdup(userdomain);
        let username = strdup(userName);
        let passwd = strdup(password);
        let realm = strdup("*");
        let registrar = strdup(area);
    
        var acc_cfg = pjsua_acc_config();
        pjsua_acc_config_default(&acc_cfg);
        acc_cfg.id = pj_str(id);
        acc_cfg.cred_count = 1;
        acc_cfg.cred_info.0.username = pj_str(username);
        acc_cfg.cred_info.0.realm = pj_str(realm);
        acc_cfg.cred_info.0.information = pj_str(passwd);
        acc_cfg.reg_uri = pj_str(registrar);
     
         acc_cfg.vid_in_auto_show = pj_bool_t(PJ_TRUE.rawValue)
         acc_cfg.vid_out_auto_transmit = pj_bool_t(PJ_TRUE.rawValue)

   videoQuality()
     
        /* Add account */
        pjsua_acc_add(&acc_cfg, pj_bool_t(PJ_TRUE.rawValue), nil);
        /* Free strings */
        free(id); free(username); free(passwd); free(realm);
        free(registrar);
     
        /* Begin pjsua */
        standing = pjsua_start();
    }
    
    
    
    
       personal func on_call_state(call_id: pjsua_call_id, e: UnsafeMutablePointer<pjsip_event>?) {
           var ci = pjsua_call_info();
           pjsua_call_get_info(call_id, &ci);
           if (ci.state == PJSIP_INV_STATE_DISCONNECTED) {
               /* UIView replace have to be finished in the principle thread */
               DispatchQueue.important.sync {
                   AppDelegate.Shared.vinfo.vid_win = nil;
               }
           }
       }
       personal func tupleToArray<Tuple, Worth>(tuple: Tuple) -> [Value] {
           let tupleMirror = Mirror(reflecting: tuple)
           return tupleMirror.kids.compactMap { (baby: Mirror.Baby) -> Worth? in
               return baby.worth as? Worth
           }
       }
       personal func on_call_media_state(call_id: pjsua_call_id) {
           var ci = pjsua_call_info();
           pjsua_call_get_info(call_id, &ci);
           for mi in 0...ci.media_cnt {
               let media: [pjsua_call_media_info] = tupleToArray(tuple: ci.media);
               if (media[Int(mi)].standing == PJSUA_CALL_MEDIA_ACTIVE ||
                   media[Int(mi)].standing == PJSUA_CALL_MEDIA_REMOTE_HOLD)
               {
                   swap (media[Int(mi)].sort) {
                   case PJMEDIA_TYPE_AUDIO:
                       var call_conf_slot: pjsua_conf_port_id;
                       call_conf_slot = media[Int(mi)].stream.aud.conf_slot;
                       pjsua_conf_connect(call_conf_slot, 0);
                       pjsua_conf_connect(0, call_conf_slot);
                       break;
               
                   case PJMEDIA_TYPE_VIDEO:
                       let wid = media[Int(mi)].stream.vid.win_in;
                       var wi = pjsua_vid_win_info();
                           
                       if (pjsua_vid_win_get_info(wid, &wi) == PJ_SUCCESS.rawValue) {
                           
                           let vid_win:UIView =
                           Unmanaged<UIView>.fromOpaque(wi.hwnd.information.ios.window).takeUnretainedValue();
                           /* UIView replace have to be finished in the principle thread */
                           DispatchQueue.important.sync {
                               AppDelegate.Shared.vinfo.vid_win = vid_win;
                           }
                       }
                       break;
                   
                   default:
                       break;
                   }
               }
           }
       }
    
    
    func on_incoming_call(acc_id: pjsua_acc_id, call_id: pjsua_call_id, rdata: UnsafeMutablePointer<pjsip_rx_data>?) {
        var ci = pjsua_call_info()
        var choose = pjsua_call_setting()
        pjsua_call_setting_default(&choose)
        var p_param = pjsua_vid_preview_param()
        pjsua_vid_preview_param_default(&p_param)
        
        p_param.present = pj_bool_t(PJ_TRUE.rawValue)
        choose.aud_cnt = 1 // Variety of simultaneous audio calls
        choose.vid_cnt = 1 // Variety of simultaneous video calls
    
        pjsua_call_get_info(call_id, &ci) // Retrieve name data
    
        if ci.remote_info.ptr != nil {
            if let callerNumber = String(cString: ci.remote_contact.ptr) as String? {
                NotificationCenter.default.publish(title: Notification.Title("IncomingCall"), object: callerNumber)
                // Assuming currentCallId is a worldwide variable
                pjsua_call_answer(call_id, 200, nil, nil)
            }
        } else {
            print("Distant information pointer is NULL")
        }
        
    func videoQuality(){
        let codec = strdup("H264, 4")
        var codec_id:pj_str_t = pj_str(codec);
        var param = pjmedia_vid_codec_param()
        pjsua_vid_codec_get_param(&codec_id, &param)
    
        /* Sending 1280 x 720 */
        param.enc_fmt.det.vid.measurement.w = 640; //1280
        param.enc_fmt.det.vid.measurement.h = 480; //720
    
        param.dec_fmt.det.vid.measurement.w = 640; //1280
        param.dec_fmt.det.vid.measurement.h = 480; //720
    
        /* Sending @30fps */
        param.enc_fmt.det.vid.fps.num   = 15;
        param.enc_fmt.det.vid.fps.denum = 1;
    
        param.dec_fmt.det.vid.fps.num   = 30;
        param.dec_fmt.det.vid.fps.denum = 1;
    
        /* Bitrate vary most well-liked: 512-1024kbps */
        param.enc_fmt.det.vid.avg_bps = 512000;
        param.enc_fmt.det.vid.max_bps = 1024000;
    
        param.dec_fmt.det.vid.avg_bps = 512000;
        param.dec_fmt.det.vid.max_bps = 1024000;
    
        /* 3000/(1.001*2) fps for CIF */
        let cif = strdup("CIF")
        let two = strdup("1")
        param.dec_fmtp.param.1.title = pj_str(cif);
        param.dec_fmtp.param.1.val = pj_str(two);
    
        /* 3000/(1.001*1) fps for QCIF */
        let qcif = strdup("QCIF")
        let one = strdup("1")
        param.dec_fmtp.param.0.title = pj_str(qcif);
        param.dec_fmtp.param.0.val = pj_str(one);
    
        /* Can obtain as much as 1280×720 @30fps */
        let profile = strdup("profile-level-id")
        let xxxxx = strdup("xxxx1f")
        param.dec_fmtp.param.0.title = pj_str(profile);
        param.dec_fmtp.param.0.val = pj_str(xxxxx);
    
        /* H263 particular most bitrate 512kbps */
        let maxBR = strdup("MaxBR")
        let charge = strdup("5120")
        param.dec_fmtp.param.0.title = pj_str(maxBR);
        param.dec_fmtp.param.0.val = pj_str(charge); /* = max_bps / 100 */
    
        param.ignore_fmtp =  pj_bool_t(PJ_TRUE.rawValue);
    
        pjsua_vid_codec_set_param(&codec_id, &param)
    }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments