Changeset 5878
- Timestamp:
- Sep 4, 2018 3:12:58 PM (6 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua2/config.hpp
r4704 r5878 40 40 #endif 41 41 42 /** 43 * Maximum buffer length to print SDP content for SdpSession. Set this to 0 44 * if the printed SDP is not needed. 45 */ 46 #ifndef PJSUA2_MAX_SDP_BUF_LEN 47 # define PJSUA2_MAX_SDP_BUF_LEN 1024 48 #endif 42 49 43 50 /** -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5871 r5878 1359 1359 */ 1360 1360 static void sort_media2(const pjsua_call_media *call_med, 1361 pj_bool_t check_tp, 1361 1362 unsigned call_med_cnt, 1362 1363 pjmedia_type type, … … 1387 1388 1388 1389 /* Is it active? */ 1389 if ( !call_med[i].tp) {1390 if (check_tp && !call_med[i].tp) { 1390 1391 score[i] -= 10; 1391 1392 } … … 2047 2048 * Otherwise, apply media count from the call setting directly. 2048 2049 */ 2049 if (reinit && (call->opt.flag & PJSUA_CALL_REINIT_MEDIA) == 0) { 2050 if (reinit) { 2051 pj_bool_t sort_check_tp; 2052 2053 /* Media sorting below will check transport, i.e: media without 2054 * transport will have lower priority. If PJSUA_CALL_REINIT_MEDIA 2055 * is set, we must not check transport. 2056 */ 2057 sort_check_tp = !(call->opt.flag & PJSUA_CALL_REINIT_MEDIA); 2050 2058 2051 2059 /* We are sending reoffer, check media count for each media type 2052 2060 * from the existing call media list. 2053 2061 */ 2054 sort_media2(call->media_prov, call->med_prov_cnt,2062 sort_media2(call->media_prov, sort_check_tp, call->med_prov_cnt, 2055 2063 PJMEDIA_TYPE_AUDIO, maudidx, &maudcnt, &mtotaudcnt); 2056 2064 … … 2058 2066 //pj_assert(maudcnt > 0); 2059 2067 2060 sort_media2(call->media_prov, call->med_prov_cnt,2068 sort_media2(call->media_prov, sort_check_tp, call->med_prov_cnt, 2061 2069 PJMEDIA_TYPE_VIDEO, mvididx, &mvidcnt, &mtotvidcnt); 2062 2070 … … 2088 2096 } 2089 2097 mvidcnt = call->opt.vid_cnt; 2098 2099 /* In case of media reinit, 'med_prov_cnt' may be decreased 2100 * because the new call->opt says so. As media count should 2101 * never decrease, we should verify 'med_prov_cnt' to be 2102 * at least equal to 'med_cnt' (see also #1987). 2103 */ 2104 if ((call->opt.flag & PJSUA_CALL_REINIT_MEDIA) && 2105 call->med_prov_cnt < call->med_cnt) 2106 { 2107 call->med_prov_cnt = call->med_cnt; 2108 } 2090 2109 2091 2110 } else { … … 2113 2132 } 2114 2133 #endif 2115 }2116 2117 /* In case of media reinit, 'med_prov_cnt' may be decreased2118 * because the new call->opt says so. As media count should2119 * never decrease, we should verify 'med_prov_cnt' to be2120 * at least equal to 'med_cnt' (see also #1987).2121 */2122 if (reinit && (call->opt.flag & PJSUA_CALL_REINIT_MEDIA) &&2123 call->med_prov_cnt < call->med_cnt)2124 {2125 call->med_prov_cnt = call->med_cnt;2126 2134 } 2127 2135 } -
pjproject/trunk/pjsip/src/pjsua2/call.cpp
r5877 r5878 30 30 /////////////////////////////////////////////////////////////////////////////// 31 31 32 #define SDP_BUFFER_SIZE 102433 32 34 33 MathStat::MathStat() … … 111 110 void SdpSession::fromPj(const pjmedia_sdp_session &sdp) 112 111 { 113 char buf[SDP_BUFFER_SIZE]; 112 #if PJSUA2_MAX_SDP_BUF_LEN 113 char buf[PJSUA2_MAX_SDP_BUF_LEN]; 114 114 int len; 115 115 116 116 len = pjmedia_sdp_print(&sdp, buf, sizeof(buf)); 117 117 wholeSdp = (len > -1? string(buf, len): ""); 118 #else 119 wholeSdp = ""; 120 #endif 118 121 pjSdpSession = (void *)&sdp; 119 122 } … … 168 171 */ 169 172 void setPortId(int id); 173 174 /** 175 * Destructor 176 */ 177 virtual ~CallAudioMedia(); 170 178 }; 171 179 … … 174 182 { 175 183 this->id = pid; 184 } 185 186 CallAudioMedia::~CallAudioMedia() 187 { 188 id = PJSUA_INVALID_ID; 176 189 } 177 190 … … 419 432 p_reason = (reason.slen == 0? NULL: &reason); 420 433 421 if (sdp_str == "") { 422 sdp = NULL; 423 } else { 434 sdp = NULL; 435 if (sdp_str != "") { 424 436 pj_str_t dup_pj_sdp; 425 437 pj_str_t pj_sdp_str = {(char*)sdp_str.c_str(), 426 438 (pj_ssize_t)sdp_str.size()}; 439 pj_status_t status; 427 440 428 441 pj_strdup(pool, &dup_pj_sdp, &pj_sdp_str); 429 pjmedia_sdp_parse(pool, dup_pj_sdp.ptr, 430 dup_pj_sdp.slen, &sdp); 442 status = pjmedia_sdp_parse(pool, dup_pj_sdp.ptr, 443 dup_pj_sdp.slen, &sdp); 444 if (status != PJ_SUCCESS) { 445 PJ_PERROR(4,(THIS_FILE, status, 446 "Failed to parse SDP for call param")); 447 } 431 448 } 432 449 } … … 753 770 754 771 if (pjsua_call_get_info(id, &pj_ci) == PJ_SUCCESS) { 772 if (medias.size()) { 773 /* Clear medias. */ 774 for (mi = 0; mi < medias.size(); mi++) { 775 if (medias[mi]) 776 delete medias[mi]; 777 } 778 medias.clear(); 779 } 780 755 781 for (mi = 0; mi < pj_ci.media_cnt; mi++) { 756 782 if (mi >= medias.size()) { -
pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
r5834 r5878 1076 1076 pj_str_t new_sdp_str = {(char*)prm.sdp.wholeSdp.c_str(), 1077 1077 (pj_ssize_t)prm.sdp.wholeSdp.size()}; 1078 pj_status_t status; 1078 1079 1079 1080 pj_strdup(pool, &dup_new_sdp, &new_sdp_str); 1080 pjmedia_sdp_parse(pool, dup_new_sdp.ptr, 1081 dup_new_sdp.slen, &new_sdp); 1082 pj_memcpy(sdp, new_sdp, sizeof(*sdp)); 1081 status = pjmedia_sdp_parse(pool, dup_new_sdp.ptr, 1082 dup_new_sdp.slen, &new_sdp); 1083 if (status != PJ_SUCCESS) { 1084 PJ_PERROR(4,(THIS_FILE, status, 1085 "Failed to parse the modified SDP")); 1086 } else { 1087 pj_memcpy(sdp, new_sdp, sizeof(*sdp)); 1088 } 1083 1089 } 1084 1090 }
Note: See TracChangeset
for help on using the changeset viewer.