- Timestamp:
- Dec 28, 2016 3:40:07 AM (8 years ago)
- Location:
- pjproject/branches/projects/uwp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/uwp
- Property svn:mergeinfo changed
/pjproject/trunk (added) merged: 5209,5212-5234,5237-5253,5255,5257-5292,5294-5297,5299-5332,5334-5394,5396-5438,5440-5469,5471-5496,5498-5510
- Property svn:mergeinfo changed
-
pjproject/branches/projects/uwp/pjmedia/src/pjmedia/stream_info.c
r4930 r5513 34 34 static const pj_str_t ID_TELEPHONE_EVENT = { "telephone-event", 15 }; 35 35 36 static void get_opus_channels_and_clock_rate(const pjmedia_codec_fmtp *enc_fmtp, 37 const pjmedia_codec_fmtp *dec_fmtp, 38 unsigned *channel_cnt, 39 unsigned *clock_rate) 40 { 41 unsigned i; 42 unsigned enc_channel_cnt = 0, local_channel_cnt = 0; 43 unsigned enc_clock_rate = 0, local_clock_rate = 0; 44 45 for (i = 0; i < dec_fmtp->cnt; ++i) { 46 if (!pj_stricmp2(&dec_fmtp->param[i].name, "sprop-maxcapturerate")) { 47 local_clock_rate = (unsigned)pj_strtoul(&dec_fmtp->param[i].val); 48 } else if (!pj_stricmp2(&dec_fmtp->param[i].name, "sprop-stereo")) { 49 local_channel_cnt = (unsigned)pj_strtoul(&dec_fmtp->param[i].val); 50 local_channel_cnt = (local_channel_cnt > 0) ? 2 : 1; 51 } 52 } 53 if (!local_clock_rate) local_clock_rate = *clock_rate; 54 if (!local_channel_cnt) local_channel_cnt = *channel_cnt; 55 56 for (i = 0; i < enc_fmtp->cnt; ++i) { 57 if (!pj_stricmp2(&enc_fmtp->param[i].name, "maxplaybackrate")) { 58 enc_clock_rate = (unsigned)pj_strtoul(&enc_fmtp->param[i].val); 59 } else if (!pj_stricmp2(&enc_fmtp->param[i].name, "stereo")) { 60 enc_channel_cnt = (unsigned)pj_strtoul(&enc_fmtp->param[i].val); 61 enc_channel_cnt = (enc_channel_cnt > 0) ? 2 : 1; 62 } 63 } 64 /* The default is a standard mono session with 48000 Hz clock rate 65 * (RFC 7587, section 7) 66 */ 67 if (!enc_clock_rate) enc_clock_rate = 48000; 68 if (!enc_channel_cnt) enc_channel_cnt = 1; 69 70 *clock_rate = (enc_clock_rate < local_clock_rate) ? enc_clock_rate : 71 local_clock_rate; 72 73 *channel_cnt = (enc_channel_cnt < local_channel_cnt) ? enc_channel_cnt : 74 local_channel_cnt; 75 } 76 36 77 /* 37 78 * Internal function for collecting codec info and param from the SDP media. … … 219 260 &si->param->setting.dec_fmtp); 220 261 262 if (!pj_stricmp2(&si->fmt.encoding_name, "opus")) { 263 get_opus_channels_and_clock_rate(&si->param->setting.enc_fmtp, 264 &si->param->setting.dec_fmtp, 265 &si->fmt.channel_cnt, 266 &si->fmt.clock_rate); 267 } 268 269 221 270 /* Get the remote ptime for our encoder. */ 222 271 attr = pjmedia_sdp_attr_find2(rem_m->attr_count, rem_m->attr, … … 428 477 } 429 478 430 /* Local and remote address family must match */ 431 if (local_af != rem_af) 432 return PJ_EAFNOTSUP; 479 /* Local and remote address family must match, except when ICE is used 480 * by both sides (see also ticket #1952). 481 */ 482 if (local_af != rem_af) { 483 const pj_str_t STR_ICE_CAND = { "candidate", 9 }; 484 if (pjmedia_sdp_media_find_attr(rem_m, &STR_ICE_CAND, NULL)==NULL || 485 pjmedia_sdp_media_find_attr(local_m, &STR_ICE_CAND, NULL)==NULL) 486 { 487 return PJ_EAFNOTSUP; 488 } 489 } 433 490 434 491 /* Media direction: */
Note: See TracChangeset
for help on using the changeset viewer.