summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2008-08-26 16:51:28 +0000
committerNanang Izzuddin <nanang@teluu.com>2008-08-26 16:51:28 +0000
commit8f801ac496cf978d41daf150c9d9b492b78cebac (patch)
treed9e33eee205b6c5110a077e9828e51c94b5011c5 /pjsip
parent472c21109bff70d66f59bd113b4031fde29a8a86 (diff)
Ticket #602:
- Introduced new API pjmedia_rtp_session_init2() to enable intializing RTP session with non-default initial settings - Updated stream so it can be created with non-default initial RTP settings. - Updated pjsua-lib to make sure RTP timestamp and sequence contigue when stream session is restarted. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2241 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua_internal.h7
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c3
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c26
3 files changed, 36 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h
index 5d7ff8f4..3839fa8f 100644
--- a/pjsip/include/pjsua-lib/pjsua_internal.h
+++ b/pjsip/include/pjsua-lib/pjsua_internal.h
@@ -66,6 +66,13 @@ typedef struct pjsua_call
pjmedia_session *session; /**< The media session. */
int audio_idx; /**< Index of m=audio in SDP. */
pj_uint32_t ssrc; /**< RTP SSRC */
+ pj_uint32_t rtp_tx_ts; /**< Initial RTP timestamp for sender. */
+ pj_uint16_t rtp_tx_seq;/**< Initial RTP sequence for sender. */
+ pj_uint8_t rtp_tx_seq_ts_set;
+ /**< Bitmask flags if initial RTP sequence
+ and/or timestamp for sender are set.
+ bit 0/LSB : sequence flag
+ bit 1 : timestamp flag */
int conf_slot; /**< Slot # in conference bridge. */
pjsip_evsub *xfer_sub; /**< Xfer server subscription, if this
call was triggered by xfer. */
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 114da50d..737cc017 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -105,6 +105,9 @@ static void reset_call(pjsua_call_id id)
call->session = NULL;
call->audio_idx = -1;
call->ssrc = pj_rand();
+ call->rtp_tx_seq = 0;
+ call->rtp_tx_ts = 0;
+ call->rtp_tx_seq_ts_set = 0;
call->xfer_sub = NULL;
call->last_code = (pjsip_status_code) 0;
call->conf_slot = PJSUA_INVALID_ID;
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index 69314d30..6b0d2f63 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -1158,6 +1158,23 @@ static void stop_media_session(pjsua_call_id call_id)
}
if (call->session) {
+ pjmedia_rtcp_stat stat;
+
+ if (pjmedia_session_get_stream_stat(call->session,
+ call->audio_idx,
+ &stat) == PJ_SUCCESS)
+ {
+ /* Save RTP timestamp & sequence, so when media session is
+ * restarted, those values will be restored as the initial
+ * RTP timestamp & sequence of the new media session. So in
+ * the same call session, RTP timestamp and sequence are
+ * guaranteed to be contigue.
+ */
+ call->rtp_tx_seq_ts_set = 1 | (1 << 1);
+ call->rtp_tx_seq = stat.rtp_tx_last_seq;
+ call->rtp_tx_ts = stat.rtp_tx_last_ts;
+ }
+
if (pjsua_var.ua_cfg.cb.on_stream_destroyed) {
pjsua_var.ua_cfg.cb.on_stream_destroyed(call_id, call->session, 0);
}
@@ -1322,6 +1339,15 @@ pj_status_t pjsua_media_channel_update(pjsua_call_id call_id,
/* Set SSRC */
si->ssrc = call->ssrc;
+ /* Set RTP timestamp & sequence, normally these value are intialized
+ * automatically when stream session created, but for some cases (e.g:
+ * call reinvite, call update) timestamp and sequence need to be kept
+ * contigue.
+ */
+ si->rtp_ts = call->rtp_tx_ts;
+ si->rtp_seq = call->rtp_tx_seq;
+ si->rtp_seq_ts_set = call->rtp_tx_seq_ts_set;
+
/* Create session based on session info. */
status = pjmedia_session_create( pjsua_var.med_endpt, &sess_info,
&call->med_tp,