summaryrefslogtreecommitdiff
path: root/pjmedia/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-03-30 07:10:13 +0000
committerBenny Prijono <bennylp@teluu.com>2012-03-30 07:10:13 +0000
commit6b4964727bffb379aca9601e1cf69051ccbf600c (patch)
tree1d9739ea8b3b5e0421f1d99b39e798b1514fb644 /pjmedia/include
parent85ac546acb235df62169c4ad317da74a62e56a88 (diff)
Re #1474: Merged all changes from 1.12 - HEAD (from the 1.x branch)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3999 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r--pjmedia/include/pjmedia/config.h28
-rw-r--r--pjmedia/include/pjmedia/endpoint.h23
-rw-r--r--pjmedia/include/pjmedia/rtcp.h121
-rw-r--r--pjmedia/include/pjmedia/rtcp_xr.h14
-rw-r--r--pjmedia/include/pjmedia/transport_srtp.h6
5 files changed, 141 insertions, 51 deletions
diff --git a/pjmedia/include/pjmedia/config.h b/pjmedia/include/pjmedia/config.h
index e8e7f807..76b8fc84 100644
--- a/pjmedia/include/pjmedia/config.h
+++ b/pjmedia/include/pjmedia/config.h
@@ -453,6 +453,19 @@
# define PJMEDIA_RTCP_STAT_HAS_RAW_JITTER 0
#endif
+/**
+ * Specify the factor with wich RTCP RTT statistics should be normalized
+ * if exceptionally high. For e.g. mobile networks with potentially large
+ * fluctuations, this might be unwanted.
+ *
+ * Use (0) to disable this feature.
+ *
+ * Default: 3.
+ */
+#ifndef PJMEDIA_RTCP_NORMALIZE_FACTOR
+# define PJMEDIA_RTCP_NORMALIZE_FACTOR 3
+#endif
+
/**
* Specify whether RTCP statistics includes IP Delay Variation statistics.
@@ -476,7 +489,7 @@
* if it is enabled on run-time on per stream basis. See
* PJMEDIA_STREAM_ENABLE_XR setting for more info.
*
- * Default: 1 (yes).
+ * Default: 0 (no).
*/
#ifndef PJMEDIA_HAS_RTCP_XR
# define PJMEDIA_HAS_RTCP_XR 0
@@ -494,6 +507,19 @@
# define PJMEDIA_STREAM_ENABLE_XR 0
#endif
+
+/**
+ * Specify the buffer length for storing any received RTCP SDES text
+ * in a stream session. Usually RTCP contains only the mandatory SDES
+ * field, i.e: CNAME.
+ *
+ * Default: 64 bytes.
+ */
+#ifndef PJMEDIA_RTCP_RX_SDES_BUF_LEN
+# define PJMEDIA_RTCP_RX_SDES_BUF_LEN 64
+#endif
+
+
/**
* Specify how long (in miliseconds) the stream should suspend the
* silence detector/voice activity detector (VAD) during the initial
diff --git a/pjmedia/include/pjmedia/endpoint.h b/pjmedia/include/pjmedia/endpoint.h
index 9956b95f..0e5debb8 100644
--- a/pjmedia/include/pjmedia/endpoint.h
+++ b/pjmedia/include/pjmedia/endpoint.h
@@ -61,6 +61,12 @@ typedef enum pjmedia_endpt_flag
/**
+ * Type of callback to register to pjmedia_endpt_atexit().
+ */
+typedef void (*pjmedia_endpt_exit_callback)(pjmedia_endpt *endpt);
+
+
+/**
* Create an instance of media endpoint.
*
* @param pf Pool factory, which will be used by the media endpoint
@@ -260,6 +266,23 @@ PJ_DECL(pj_status_t) pjmedia_endpt_create_video_sdp(pjmedia_endpt *endpt,
PJ_DECL(pj_status_t) pjmedia_endpt_dump(pjmedia_endpt *endpt);
+/**
+ * Register cleanup function to be called by media endpoint when
+ * #pjmedia_endpt_destroy() is called. Note that application should not
+ * use or access any endpoint resource (such as pool, ioqueue) from within
+ * the callback as such resource may have been released when the callback
+ * function is invoked.
+ *
+ * @param endpt The media endpoint.
+ * @param func The function to be registered.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_endpt_atexit(pjmedia_endpt *endpt,
+ pjmedia_endpt_exit_callback func);
+
+
+
PJ_END_DECL
diff --git a/pjmedia/include/pjmedia/rtcp.h b/pjmedia/include/pjmedia/rtcp.h
index 259d3483..9fc53657 100644
--- a/pjmedia/include/pjmedia/rtcp.h
+++ b/pjmedia/include/pjmedia/rtcp.h
@@ -54,29 +54,26 @@ PJ_BEGIN_DECL
* #pjmedia_stream_get_stat() function.
*/
+
#pragma pack(1)
/**
* RTCP sender report.
*/
-struct pjmedia_rtcp_sr
+typedef struct pjmedia_rtcp_sr
{
pj_uint32_t ntp_sec; /**< NTP time, seconds part. */
pj_uint32_t ntp_frac; /**< NTP time, fractions part. */
pj_uint32_t rtp_ts; /**< RTP timestamp. */
pj_uint32_t sender_pcount; /**< Sender packet cound. */
pj_uint32_t sender_bcount; /**< Sender octet/bytes count. */
-};
+} pjmedia_rtcp_sr;
-/**
- * @see pjmedia_rtcp_sr
- */
-typedef struct pjmedia_rtcp_sr pjmedia_rtcp_sr;
/**
* RTCP receiver report.
*/
-struct pjmedia_rtcp_rr
+typedef struct pjmedia_rtcp_rr
{
pj_uint32_t ssrc; /**< SSRC identification. */
#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
@@ -94,18 +91,13 @@ struct pjmedia_rtcp_rr
pj_uint32_t jitter; /**< Jitter. */
pj_uint32_t lsr; /**< Last SR. */
pj_uint32_t dlsr; /**< Delay since last SR. */
-};
-
-/**
- * @see pjmedia_rtcp_rr
- */
-typedef struct pjmedia_rtcp_rr pjmedia_rtcp_rr;
+} pjmedia_rtcp_rr;
/**
* RTCP common header.
*/
-struct pjmedia_rtcp_common
+typedef struct pjmedia_rtcp_common
{
#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
unsigned version:2; /**< packet type */
@@ -120,12 +112,8 @@ struct pjmedia_rtcp_common
#endif
unsigned length:16; /**< packet length */
pj_uint32_t ssrc; /**< SSRC identification */
-};
+} pjmedia_rtcp_common;
-/**
- * @see pjmedia_rtcp_common
- */
-typedef struct pjmedia_rtcp_common pjmedia_rtcp_common;
/**
* This structure declares default RTCP packet (SR) that is sent by pjmedia.
@@ -153,25 +141,34 @@ typedef struct pjmedia_rtcp_rr_pkt
/**
- * NTP time representation.
+ * RTCP SDES structure.
*/
-struct pjmedia_rtcp_ntp_rec
+typedef struct pjmedia_rtcp_sdes
{
- pj_uint32_t hi; /**< High order 32-bit part. */
- pj_uint32_t lo; /**< Lo order 32-bit part. */
-};
+ pj_str_t cname; /**< RTCP SDES type CNAME. */
+ pj_str_t name; /**< RTCP SDES type NAME. */
+ pj_str_t email; /**< RTCP SDES type EMAIL. */
+ pj_str_t phone; /**< RTCP SDES type PHONE. */
+ pj_str_t loc; /**< RTCP SDES type LOC. */
+ pj_str_t tool; /**< RTCP SDES type TOOL. */
+ pj_str_t note; /**< RTCP SDES type NOTE. */
+} pjmedia_rtcp_sdes;
+
/**
- * @see pjmedia_rtcp_ntp_rec
+ * NTP time representation.
*/
-typedef struct pjmedia_rtcp_ntp_rec pjmedia_rtcp_ntp_rec;
-
+typedef struct pjmedia_rtcp_ntp_rec
+{
+ pj_uint32_t hi; /**< High order 32-bit part. */
+ pj_uint32_t lo; /**< Lo order 32-bit part. */
+} pjmedia_rtcp_ntp_rec;
/**
* Unidirectional RTP stream statistics.
*/
-struct pjmedia_rtcp_stream_stat
+typedef struct pjmedia_rtcp_stream_stat
{
pj_time_val update; /**< Time of last update. */
unsigned update_cnt; /**< Number of updates (to calculate avg) */
@@ -190,20 +187,14 @@ struct pjmedia_rtcp_stream_stat
} loss_type; /**< Types of loss detected. */
pj_math_stat jitter; /**< Jitter statistics (in usec) */
-};
-
-
-/**
- * @see pjmedia_rtcp_stream_stat
- */
-typedef struct pjmedia_rtcp_stream_stat pjmedia_rtcp_stream_stat;
+} pjmedia_rtcp_stream_stat;
/**
* Bidirectional RTP stream statistics.
*/
-struct pjmedia_rtcp_stat
+typedef struct pjmedia_rtcp_stat
{
pj_time_val start; /**< Time when session was created */
@@ -226,20 +217,19 @@ struct pjmedia_rtcp_stat
receiving direction
(in usec). */
#endif
-};
+ pjmedia_rtcp_sdes peer_sdes; /**< Peer SDES. */
+ char peer_sdes_buf_[PJMEDIA_RTCP_RX_SDES_BUF_LEN];
+ /**< Peer SDES buffer. */
-/**
- * @see pjmedia_rtcp_stat
- */
-typedef struct pjmedia_rtcp_stat pjmedia_rtcp_stat;
+} pjmedia_rtcp_stat;
/**
* RTCP session is used to monitor the RTP session of one endpoint. There
* should only be one RTCP session for a bidirectional RTP streams.
*/
-struct pjmedia_rtcp_session
+typedef struct pjmedia_rtcp_session
{
char *name; /**< Name identification. */
pjmedia_rtcp_sr_pkt rtcp_sr_pkt;/**< Cached RTCP SR packet. */
@@ -278,12 +268,7 @@ struct pjmedia_rtcp_session
*/
pjmedia_rtcp_xr_session xr_session;
#endif
-};
-
-/**
- * @see pjmedia_rtcp_session
- */
-typedef struct pjmedia_rtcp_session pjmedia_rtcp_session;
+} pjmedia_rtcp_session;
/**
@@ -439,6 +424,46 @@ PJ_DECL(void) pjmedia_rtcp_build_rtcp( pjmedia_rtcp_session *session,
/**
+ * Build an RTCP SDES (source description) packet. This packet can be
+ * appended to other RTCP packets, e.g: RTCP RR/SR, to compose a compound
+ * RTCP packet.
+ *
+ * @param session The RTCP session.
+ * @param buf The buffer to receive RTCP SDES packet.
+ * @param length On input, it will contain the buffer length.
+ * On output, it will contain the generated RTCP SDES
+ * packet length.
+ * @param sdes The source description, see #pjmedia_rtcp_sdes.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_rtcp_build_rtcp_sdes(
+ pjmedia_rtcp_session *session,
+ void *buf,
+ pj_size_t *length,
+ const pjmedia_rtcp_sdes *sdes);
+
+/**
+ * Build an RTCP BYE packet. This packet can be appended to other RTCP
+ * packets, e.g: RTCP RR/SR, to compose a compound RTCP packet.
+ *
+ * @param session The RTCP session.
+ * @param buf The buffer to receive RTCP BYE packet.
+ * @param length On input, it will contain the buffer length.
+ * On output, it will contain the generated RTCP BYE
+ * packet length.
+ * @param reason Optional, the BYE reason.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_rtcp_build_rtcp_bye(
+ pjmedia_rtcp_session *session,
+ void *buf,
+ pj_size_t *length,
+ const pj_str_t *reason);
+
+
+/**
* Call this function if RTCP XR needs to be enabled/disabled in the
* RTCP session.
*
diff --git a/pjmedia/include/pjmedia/rtcp_xr.h b/pjmedia/include/pjmedia/rtcp_xr.h
index e44bf1b1..fb204852 100644
--- a/pjmedia/include/pjmedia/rtcp_xr.h
+++ b/pjmedia/include/pjmedia/rtcp_xr.h
@@ -200,6 +200,17 @@ typedef struct pjmedia_rtcp_xr_rb_voip_mtc
jitter buffer */
} pjmedia_rtcp_xr_rb_voip_mtc;
+
+/**
+ * Constant of RTCP-XR content size.
+ */
+#define PJMEDIA_RTCP_XR_BUF_SIZE \
+ sizeof(pjmedia_rtcp_xr_rb_rr_time) + \
+ sizeof(pjmedia_rtcp_xr_rb_dlrr) + \
+ sizeof(pjmedia_rtcp_xr_rb_stats) + \
+ sizeof(pjmedia_rtcp_xr_rb_voip_mtc)
+
+
/**
* This structure declares RTCP XR (Extended Report) packet.
*/
@@ -221,7 +232,8 @@ typedef struct pjmedia_rtcp_xr_pkt
pj_uint32_t ssrc; /**< SSRC identification */
} common;
- pj_int8_t buf[PJMEDIA_MAX_MTU];/**< Content buffer */
+ pj_int8_t buf[PJMEDIA_RTCP_XR_BUF_SIZE];
+ /**< Content buffer */
} pjmedia_rtcp_xr_pkt;
#pragma pack()
diff --git a/pjmedia/include/pjmedia/transport_srtp.h b/pjmedia/include/pjmedia/transport_srtp.h
index 3a4820e8..910ec1d0 100644
--- a/pjmedia/include/pjmedia/transport_srtp.h
+++ b/pjmedia/include/pjmedia/transport_srtp.h
@@ -200,8 +200,12 @@ typedef struct pjmedia_srtp_info
* will also invoke this function. This function will also register SRTP
* library deinitialization to #pj_atexit(), so the deinitialization
* of SRTP library will be performed automatically by PJLIB destructor.
+ *
+ * @param endpt The media endpoint instance.
+ *
+ * @return PJ_SUCCESS on success.
*/
-PJ_DECL(pj_status_t) pjmedia_srtp_init_lib(void);
+PJ_DECL(pj_status_t) pjmedia_srtp_init_lib(pjmedia_endpt *endpt);
/**