summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2010-09-20 06:13:02 +0000
committerNanang Izzuddin <nanang@teluu.com>2010-09-20 06:13:02 +0000
commit5af236a408105e4a2e4e47f4271afab7c137c31b (patch)
tree7bb254ba645dda789fff7474116919e9d4b76939 /pjmedia
parent060d04b12449532413d95cbff97c966e7f768d08 (diff)
Closed #1129:
- Added run-time configuration for activating/deactivating stream keep-alive (non-codec-VAD mechanism), also added this config to account settings. - Fixed bug wrong session info pointer "si" in pjsua_media_channel_update() when call audio index is not zero. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3313 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/docs/doxygen.cfg3
-rw-r--r--pjmedia/include/pjmedia/stream.h6
-rw-r--r--pjmedia/src/pjmedia/stream.c11
3 files changed, 18 insertions, 2 deletions
diff --git a/pjmedia/docs/doxygen.cfg b/pjmedia/docs/doxygen.cfg
index 28d4d5e8..ecd5f275 100644
--- a/pjmedia/docs/doxygen.cfg
+++ b/pjmedia/docs/doxygen.cfg
@@ -853,7 +853,8 @@ PREDEFINED = PJ_DECL(x)=x PJ_DEF(x)=x PJ_IDECL(x)=x \
PJ_HAS_SEMAPHORE=1 \
PJ_HAS_EVENT_OBJ=1 \
PJ_HAS_TCP=1 \
- PJMEDIA_HAS_SRTP=1
+ PJMEDIA_HAS_SRTP=1 \
+ PJMEDIA_STREAM_ENABLE_KA=1
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
diff --git a/pjmedia/include/pjmedia/stream.h b/pjmedia/include/pjmedia/stream.h
index 84f6b1de..c45201ec 100644
--- a/pjmedia/include/pjmedia/stream.h
+++ b/pjmedia/include/pjmedia/stream.h
@@ -127,6 +127,12 @@ struct pjmedia_stream_info
int jb_max_pre; /**< Jitter buffer maximum prefetch
delay in msec (-1 for default). */
int jb_max; /**< Jitter buffer max delay in msec. */
+
+#if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0
+ pj_bool_t use_ka; /**< Stream keep-alive and NAT hole punch
+ (see @ref PJMEDIA_STREAM_ENABLE_KA)
+ is enabled? */
+#endif
};
diff --git a/pjmedia/src/pjmedia/stream.c b/pjmedia/src/pjmedia/stream.c
index 4436da51..8bb5fc1a 100644
--- a/pjmedia/src/pjmedia/stream.c
+++ b/pjmedia/src/pjmedia/stream.c
@@ -197,6 +197,9 @@ struct pjmedia_stream
#endif
#if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0
+ pj_bool_t use_ka; /**< Stream keep-alive with non-
+ codec-VAD mechanism is
+ enabled? */
pj_timestamp last_frm_ts_sent; /**< Timestamp of last sending
packet */
#endif
@@ -1123,6 +1126,7 @@ static pj_status_t put_frame_imp( pjmedia_port *port,
/* If the interval since last sending packet is greater than
* PJMEDIA_STREAM_KA_INTERVAL, send keep-alive packet.
*/
+ if (stream->use_ka)
{
pj_uint32_t dtx_duration;
@@ -1973,6 +1977,10 @@ PJ_DEF(pj_status_t) pjmedia_stream_create( pjmedia_endpt *endpt,
stream->last_dtmf = -1;
stream->jb_last_frm = PJMEDIA_JB_NORMAL_FRAME;
+#if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0
+ stream->use_ka = info->use_ka;
+#endif
+
/* Build random RTCP CNAME. CNAME has user@host format */
stream->cname.ptr = p = (char*) pj_pool_alloc(pool, 20);
pj_create_random_string(p, 5);
@@ -2284,7 +2292,8 @@ PJ_DEF(pj_status_t) pjmedia_stream_create( pjmedia_endpt *endpt,
#if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0
/* NAT hole punching by sending KA packet via RTP transport. */
- send_keep_alive_packet(stream);
+ if (stream->use_ka)
+ send_keep_alive_packet(stream);
#endif
#if TRACE_JB