- 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.c
r5187 r5513 23 23 #include <pjmedia/rtcp.h> 24 24 #include <pjmedia/jbuf.h> 25 #include <pjmedia/stream_common.h>26 25 #include <pj/array.h> 27 26 #include <pj/assert.h> … … 441 440 /* Send RTCP */ 442 441 send_rtcp(stream, PJ_TRUE, PJ_FALSE, PJ_FALSE); 442 443 /* Update stats in case the stream is paused */ 444 stream->rtcp.stat.rtp_tx_last_seq = pj_ntohs(stream->enc->rtp.out_hdr.seq); 443 445 444 446 #elif PJMEDIA_STREAM_ENABLE_KA == PJMEDIA_STREAM_KA_USER … … 1567 1569 1568 1570 /* Ignore unknown event. */ 1571 #if defined(PJMEDIA_HAS_DTMF_FLASH) && PJMEDIA_HAS_DTMF_FLASH!= 0 1569 1572 if (event->event > 16) { 1573 #else 1574 if (event->event > 15) { 1575 #endif 1570 1576 PJ_LOG(5,(stream->port.info.name.ptr, 1571 1577 "Ignored RTP pkt with bad DTMF event %d", … … 1629 1635 if (bytes_read < 0) { 1630 1636 status = (pj_status_t)-bytes_read; 1637 if (status == PJ_STATUS_FROM_OS(OSERR_EWOULDBLOCK)) { 1638 return; 1639 } 1631 1640 if (stream->rtp_rx_last_err != status) { 1632 1641 char errmsg[PJ_ERR_MSG_SIZE]; … … 1895 1904 /* Check for errors */ 1896 1905 if (bytes_read < 0) { 1897 LOGERR_((stream->port.info.name.ptr, "RTCP recv() error", 1898 (pj_status_t)-bytes_read)); 1906 if (bytes_read != -PJ_STATUS_FROM_OS(OSERR_EWOULDBLOCK)) { 1907 LOGERR_((stream->port.info.name.ptr, "RTCP recv() error", 1908 (pj_status_t)-bytes_read)); 1909 } 1899 1910 return; 1900 1911 } … … 1994 2005 char *p; 1995 2006 pj_status_t status; 2007 pjmedia_transport_attach_param att_param; 1996 2008 1997 2009 PJ_ASSERT_RETURN(endpt && info && p_stream, PJ_EINVAL); … … 2105 2117 2106 2118 /* Open the codec. */ 2119 2120 /* The clock rate for Opus codec is not static, 2121 * it's negotiated in the SDP. 2122 */ 2123 if (!pj_stricmp2(&info->fmt.encoding_name, "opus")) { 2124 stream->codec_param.info.clock_rate = info->fmt.clock_rate; 2125 stream->codec_param.info.channel_cnt = info->fmt.channel_cnt; 2126 } 2127 2107 2128 status = pjmedia_codec_open(stream->codec, &stream->codec_param); 2108 2129 if (status != PJ_SUCCESS) … … 2219 2240 /* RTP clock rate = 1/2 real clock rate */ 2220 2241 stream->rtp_tx_ts_len_per_pkt >>= 1; 2242 } else if (!pj_stricmp2(&info->fmt.encoding_name, "opus")) { 2243 unsigned opus_ts_modifier = 48000 / afd->clock_rate; 2244 stream->rtp_rx_check_cnt = 0; 2245 stream->has_g722_mpeg_bug = PJ_TRUE; 2246 stream->rtp_tx_ts_len_per_pkt *= opus_ts_modifier; 2247 stream->rtp_rx_ts_len_per_frame *= opus_ts_modifier; 2221 2248 } 2222 2249 #endif … … 2320 2347 2321 2348 stream->out_rtcp_pkt = pj_pool_alloc(pool, stream->out_rtcp_pkt_size); 2349 att_param.stream = stream; 2350 att_param.media_type = PJMEDIA_TYPE_AUDIO; 2351 att_param.user_data = stream; 2352 pj_sockaddr_cp(&att_param.rem_addr, &info->rem_addr); 2353 pj_sockaddr_cp(&att_param.rem_rtcp, &info->rem_rtcp); 2354 att_param.addr_len = pj_sockaddr_get_len(&info->rem_addr); 2355 att_param.rtp_cb = &on_rx_rtp; 2356 att_param.rtcp_cb = &on_rx_rtcp; 2322 2357 2323 2358 /* Only attach transport when stream is ready. */ 2324 status = pjmedia_transport_attach(tp, stream, &info->rem_addr, 2325 &info->rem_rtcp, 2326 pj_sockaddr_get_len(&info->rem_addr), 2327 &on_rx_rtp, &on_rx_rtcp); 2359 status = pjmedia_transport_attach2(tp, &att_param); 2328 2360 if (status != PJ_SUCCESS) 2329 2361 goto err_cleanup; … … 2767 2799 pt = 11; 2768 2800 } 2801 #if defined(PJMEDIA_HAS_DTMF_FLASH) && PJMEDIA_HAS_DTMF_FLASH!= 0 2769 2802 else if (dig == 'r') 2770 2803 { 2771 2804 pt = 16; 2772 2805 } 2806 #endif 2773 2807 else 2774 2808 { … … 2889 2923 return PJ_SUCCESS; 2890 2924 } 2925 2926 2927 /** 2928 * Get RTP session information from stream. 2929 */ 2930 PJ_DEF(pj_status_t) 2931 pjmedia_stream_get_rtp_session_info(pjmedia_stream *stream, 2932 pjmedia_stream_rtp_sess_info *session_info) 2933 { 2934 session_info->rx_rtp = &stream->dec->rtp; 2935 session_info->tx_rtp = &stream->enc->rtp; 2936 session_info->rtcp = &stream->rtcp; 2937 return PJ_SUCCESS; 2938 }
Note: See TracChangeset
for help on using the changeset viewer.