- Timestamp:
- Apr 10, 2011 11:26:41 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_stream.c
r3500 r3513 119 119 unsigned frame_ts_len; /**< Frame length in timestamp. */ 120 120 121 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)122 pj_uint32_t rtcp_xr_last_tx; /**< RTCP XR tx time123 in timestamp. */124 pj_uint32_t rtcp_xr_interval; /**< Interval, in timestamp. */125 pj_sockaddr rtcp_xr_dest; /**< Additional remote RTCP XR126 dest. If sin_family is127 zero, it will be ignored*/128 unsigned rtcp_xr_dest_len; /**< Length of RTCP XR dest129 address */130 #endif131 132 121 #if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0 133 122 pj_bool_t use_ka; /**< Stream keep-alive with non- … … 403 392 stream->rtcp_last_tx = timestamp; 404 393 } 405 406 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)407 if (stream->rtcp.xr_enabled) {408 409 if (stream->rtcp_xr_last_tx == 0) {410 411 stream->rtcp_xr_last_tx = timestamp;412 413 } else if (timestamp - stream->rtcp_xr_last_tx >=414 stream->rtcp_xr_interval)415 {416 int i;417 pjmedia_jb_state jb_state;418 void *rtcp_pkt;419 int len;420 421 /* Update RTCP XR with current JB states */422 pjmedia_jbuf_get_state(stream->jb, &jb_state);423 424 i = jb_state.avg_delay;425 pjmedia_rtcp_xr_update_info(&stream->rtcp.xr_session,426 PJMEDIA_RTCP_XR_INFO_JB_NOM,427 i);428 429 i = jb_state.max_delay;430 pjmedia_rtcp_xr_update_info(&stream->rtcp.xr_session,431 PJMEDIA_RTCP_XR_INFO_JB_MAX,432 i);433 434 /* Build RTCP XR packet */435 pjmedia_rtcp_build_rtcp_xr(&stream->rtcp.xr_session, 0,436 &rtcp_pkt, &len);437 438 /* Send the RTCP XR to remote address */439 pjmedia_transport_send_rtcp(stream->transport, rtcp_pkt, len);440 441 /* Send the RTCP XR to third-party destination if specified */442 if (stream->rtcp_xr_dest_len) {443 pjmedia_transport_send_rtcp2(stream->transport,444 &stream->rtcp_xr_dest,445 stream->rtcp_xr_dest_len,446 rtcp_pkt, len);447 }448 449 /* Update last tx RTCP XR */450 stream->rtcp_xr_last_tx = timestamp;451 }452 }453 #endif454 394 } 455 395 … … 773 713 /* Update RTP timestamp */ 774 714 pjmedia_rtp_encode_rtp(&channel->rtp, channel->pt, 1, 0, 775 rtp_ts_len, &rtphdr, &rtphdrlen);715 rtp_ts_len, (const void**)&rtphdr, &rtphdrlen); 776 716 return status; 777 717 } … … 797 737 /* Update RTP timestamp */ 798 738 pjmedia_rtp_encode_rtp(&channel->rtp, channel->pt, 1, 0, 799 rtp_ts_len, &rtphdr, &rtphdrlen); 739 rtp_ts_len, (const void**)&rtphdr, 740 &rtphdrlen); 800 741 return status; 801 742 } … … 923 864 * the payload (no buffer and memcpy needed), just as we need. 924 865 */ 925 pjmedia_jbuf_peek_frame(stream->jb, i, &p,866 pjmedia_jbuf_peek_frame(stream->jb, i, (const void**)&p, 926 867 &psize, &ptype, NULL, NULL, NULL); 927 868 … … 1424 1365 PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL); 1425 1366 1426 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)1427 /* Send RTCP XR on stream destroy */1428 if (stream->rtcp.xr_enabled) {1429 int i;1430 pjmedia_jb_state jb_state;1431 void *rtcp_pkt;1432 int len;1433 1434 /* Update RTCP XR with current JB states */1435 pjmedia_jbuf_get_state(stream->jb, &jb_state);1436 1437 i = jb_state.avg_delay;1438 pjmedia_rtcp_xr_update_info(&stream->rtcp.xr_session,1439 PJMEDIA_RTCP_XR_INFO_JB_NOM,1440 i);1441 1442 i = jb_state.max_delay;1443 pjmedia_rtcp_xr_update_info(&stream->rtcp.xr_session,1444 PJMEDIA_RTCP_XR_INFO_JB_MAX,1445 i);1446 1447 /* Build RTCP XR packet */1448 pjmedia_rtcp_build_rtcp_xr(&stream->rtcp.xr_session, 0,1449 &rtcp_pkt, &len);1450 1451 /* Send the RTCP XR to remote address */1452 pjmedia_transport_send_rtcp(stream->transport, rtcp_pkt, len);1453 1454 /* Send the RTCP XR to third-party destination if specified */1455 if (stream->rtcp_xr_dest_len) {1456 pjmedia_transport_send_rtcp2(stream->transport,1457 &stream->rtcp_xr_dest,1458 stream->rtcp_xr_dest_len,1459 rtcp_pkt, len);1460 }1461 }1462 #endif1463 1464 1367 /* Send RTCP BYE */ 1465 1368 if (stream->enc && stream->transport) { … … 1576 1479 } 1577 1480 1578 1579 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)1580 /*1581 * Get stream extended statistics.1582 */1583 PJ_DEF(pj_status_t) pjmedia_stream_get_stat_xr(1584 const pjmedia_vid_stream *stream,1585 pjmedia_rtcp_xr_stat *stat)1586 {1587 PJ_ASSERT_RETURN(stream && stat, PJ_EINVAL);1588 1589 if (stream->rtcp.xr_enabled) {1590 pj_memcpy(stat, &stream->rtcp.xr_session.stat,1591 sizeof(pjmedia_rtcp_xr_stat));1592 return PJ_SUCCESS;1593 }1594 return PJ_ENOTFOUND;1595 }1596 #endif1597 1481 1598 1482 /* … … 1844 1728 1845 1729 pj_bzero(si, sizeof(*si)); 1846 1847 #if PJMEDIA_HAS_RTCP_XR && PJMEDIA_STREAM_ENABLE_XR1848 /* Set default RTCP XR enabled/disabled */1849 si->rtcp_xr_enabled = PJ_TRUE;1850 #endif1851 1730 1852 1731 /* Media type: */
Note: See TracChangeset
for help on using the changeset viewer.