Changeset 5918 for pjproject


Ignore:
Timestamp:
Dec 4, 2018 2:16:47 AM (7 months ago)
Author:
ming
Message:

Fixed #2165: Support video only call in pjsua

Location:
pjproject/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r5834 r5918  
    294294 
    295295    /* Start ringback */ 
    296     ring_start(call_id); 
     296    if (call_info.rem_aud_cnt) 
     297        ring_start(call_id); 
    297298     
    298299    if (app_config.auto_answer > 0) { 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r5899 r5918  
    47244724    pj_str_t            last_status_text; 
    47254725 
    4726     /** Media status of the first audio stream. */ 
     4726    /** Media status of the default audio stream. Default audio stream  
     4727     *  is chosen according to this priority: 
     4728     *  1. enabled, i.e: SDP media port not zero 
     4729     *  2. transport protocol in the SDP matching account config's 
     4730     *     secure media transport usage (\a use_srtp field). 
     4731     *  3. active, i.e: SDP media direction is not "inactive" 
     4732     *  4. media order (according to the SDP). 
     4733     */ 
    47274734    pjsua_call_media_status media_status; 
    47284735 
    4729     /** Media direction of the first audio stream. */ 
     4736    /** Media direction of the default audio stream. 
     4737     *  See \a media_status above on how the default is chosen. 
     4738     */ 
    47304739    pjmedia_dir         media_dir; 
    47314740 
    4732     /** The conference port number for the first audio stream. */ 
     4741    /** The conference port number for the default audio stream. 
     4742     *  See \a media_status above on how the default is chosen. 
     4743     */ 
    47334744    pjsua_conf_port_id  conf_slot; 
    47344745 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c

    r5842 r5918  
    7878 
    7979    call = &pjsua_var.calls[call_id]; 
    80     port_id = call->media[call->audio_idx].strm.a.conf_slot; 
     80    if (call->audio_idx >= 0) 
     81        port_id = call->media[call->audio_idx].strm.a.conf_slot; 
    8182 
    8283on_return: 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r5892 r5918  
    788788    PJSUA_LOCK(); 
    789789 
     790    acc = &pjsua_var.acc[acc_id]; 
     791    if (!acc->valid) { 
     792        pjsua_perror(THIS_FILE, "Unable to make call because account " 
     793                     "is not valid", PJ_EINVALIDOP); 
     794        status = PJ_EINVALIDOP; 
     795        goto on_error; 
     796    } 
     797 
     798    /* Find free call slot. */ 
     799    call_id = alloc_call_id(); 
     800 
     801    if (call_id == PJSUA_INVALID_ID) { 
     802        pjsua_perror(THIS_FILE, "Error making call", PJ_ETOOMANY); 
     803        status = PJ_ETOOMANY; 
     804        goto on_error; 
     805    } 
     806 
     807    /* Clear call descriptor */ 
     808    reset_call(call_id); 
     809 
     810    call = &pjsua_var.calls[call_id]; 
     811 
     812    /* Associate session with account */ 
     813    call->acc_id = acc_id; 
     814    call->call_hold_type = acc->cfg.call_hold_type; 
     815 
     816    /* Generate per-session RTCP CNAME, according to RFC 7022. */ 
     817    pj_create_random_string(call->cname_buf, call->cname.slen); 
     818 
     819    /* Apply call setting */ 
     820    status = apply_call_setting(call, opt, NULL); 
     821    if (status != PJ_SUCCESS) { 
     822        pjsua_perror(THIS_FILE, "Failed to apply call setting", status); 
     823        goto on_error; 
     824    } 
     825     
    790826    /* Create sound port if none is instantiated, to check if sound device 
    791827     * can be used. But only do this with the conference bridge, as with 
     
    794830     */ 
    795831    if (!pjsua_var.is_mswitch && pjsua_var.snd_port==NULL && 
    796         pjsua_var.null_snd==NULL && !pjsua_var.no_snd) 
     832        pjsua_var.null_snd==NULL && !pjsua_var.no_snd && call->opt.aud_cnt > 0) 
    797833    { 
    798834        status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev); 
     
    801837    } 
    802838 
    803     acc = &pjsua_var.acc[acc_id]; 
    804     if (!acc->valid) { 
    805         pjsua_perror(THIS_FILE, "Unable to make call because account " 
    806                      "is not valid", PJ_EINVALIDOP); 
    807         status = PJ_EINVALIDOP; 
    808         goto on_error; 
    809     } 
    810  
    811     /* Find free call slot. */ 
    812     call_id = alloc_call_id(); 
    813  
    814     if (call_id == PJSUA_INVALID_ID) { 
    815         pjsua_perror(THIS_FILE, "Error making call", PJ_ETOOMANY); 
    816         status = PJ_ETOOMANY; 
    817         goto on_error; 
    818     } 
    819  
    820     /* Clear call descriptor */ 
    821     reset_call(call_id); 
    822  
    823     call = &pjsua_var.calls[call_id]; 
    824  
    825     /* Associate session with account */ 
    826     call->acc_id = acc_id; 
    827     call->call_hold_type = acc->cfg.call_hold_type; 
    828  
    829     /* Generate per-session RTCP CNAME, according to RFC 7022. */ 
    830     pj_create_random_string(call->cname_buf, call->cname.slen); 
    831  
    832     /* Apply call setting */ 
    833     status = apply_call_setting(call, opt, NULL); 
    834     if (status != PJ_SUCCESS) { 
    835         pjsua_perror(THIS_FILE, "Failed to apply call setting", status); 
    836         goto on_error; 
    837     } 
    838      
    839839    /* Create temporary pool */ 
    840840    tmp_pool = pjsua_pool_create("tmpcall10", 512, 256); 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r5914 r5918  
    12471247 
    12481248/* Go through the list of media in the SDP, find acceptable media, and 
    1249  * sort them based on the "quality" of the media, and store the indexes 
    1250  * in the specified array. Media with the best quality will be listed 
    1251  * first in the array. The quality factors considered currently is 
    1252  * encryption. 
     1249 * sort them based on the below criteria, and store the indexes 
     1250 * in the specified array. The criteria is as follows: 
     1251 * 1. enabled, i.e: SDP media port not zero 
     1252 * 2. transport protocol in the SDP matching account config's 
     1253 *    secure media transport usage (\a use_srtp field). 
     1254 * 3. active, i.e: SDP media direction is not "inactive" 
     1255 * 4. media order (according to the SDP). 
    12531256 */ 
    12541257static void sort_media(const pjmedia_sdp_session *sdp, 
     
    20142017        sort_media(rem_sdp, &STR_AUDIO, acc->cfg.use_srtp, 
    20152018                   maudidx, &maudcnt, &mtotaudcnt); 
    2016         if (maudcnt==0) { 
    2017             /* Expecting audio in the offer */ 
    2018             if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 
    2019             status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE_HERE); 
    2020             goto on_error; 
    2021         } 
    20222019 
    20232020#if PJMEDIA_HAS_VIDEO 
     
    20282025        PJ_UNUSED_ARG(STR_VIDEO); 
    20292026#endif 
     2027 
     2028        if (maudcnt + mvidcnt == 0) { 
     2029            /* Expecting audio or video in the offer */ 
     2030            if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 
     2031            status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE_HERE); 
     2032            goto on_error; 
     2033        } 
    20302034 
    20312035        /* Update media count only when remote add any media, this media count 
     
    22312235    } 
    22322236 
    2233     call->audio_idx = maudidx[0]; 
    2234  
    2235     PJ_LOG(4,(THIS_FILE, "Media index %d selected for audio call %d", 
    2236               call->audio_idx, call->index)); 
     2237    if (maudcnt > 0) { 
     2238        call->audio_idx = maudidx[0]; 
     2239 
     2240        PJ_LOG(4,(THIS_FILE, "Media index %d selected for audio call %d", 
     2241                  call->audio_idx, call->index)); 
     2242    } else { 
     2243        call->audio_idx = -1; 
     2244    } 
    22372245 
    22382246    if (pending_med_tp) { 
Note: See TracChangeset for help on using the changeset viewer.