summaryrefslogtreecommitdiff
path: root/rakia
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2012-02-23 19:24:24 -0500
committerOlivier CrĂȘte <olivier.crete@collabora.com>2012-02-23 19:24:59 -0500
commit86ded282b0416ab12583e1da0d21670aac632b6d (patch)
tree2c0300611f920cc683e212dcca11211adb06553f /rakia
parent92a846c32180c0ce51a4862b80b5159261d45b98 (diff)
Make it possible to remove a content from a connected call
Diffstat (limited to 'rakia')
-rw-r--r--rakia/call-content.c24
-rw-r--r--rakia/sip-media.c61
-rw-r--r--rakia/sip-session.c13
3 files changed, 62 insertions, 36 deletions
diff --git a/rakia/call-content.c b/rakia/call-content.c
index 20a18ec..6031601 100644
--- a/rakia/call-content.c
+++ b/rakia/call-content.c
@@ -188,9 +188,16 @@ rakia_call_content_deinit (TpBaseCallContent *base)
{
RakiaCallContent *self = RAKIA_CALL_CONTENT (base);
RakiaCallContentPrivate *priv = self->priv;
+ RakiaSipSession *session;
+
+ session = rakia_sip_media_get_session (priv->media);
+
+ /* If the media was removed, it means it's by user request, so we must
+ * do a re-invite
+ */
+ if (rakia_sip_session_remove_media (session, priv->media, 0, NULL))
+ rakia_sip_session_media_changed (session);
- rakia_sip_session_remove_media (rakia_sip_media_get_session (priv->media),
- priv->media, 0, NULL );
tp_clear_object (&priv->stream);
tp_clear_object (&priv->channel);
@@ -371,9 +378,18 @@ rakia_call_content_add_stream (RakiaCallContent *self)
if (rakia_sip_media_get_requested_direction (priv->media) &
RAKIA_DIRECTION_SEND)
- local_sending_state = TP_SENDING_STATE_PENDING_SEND;
+ {
+ if (!tp_base_call_channel_is_accepted (
+ TP_BASE_CALL_CHANNEL (priv->channel)) &&
+ !tp_base_channel_is_requested (TP_BASE_CHANNEL (priv->channel)))
+ local_sending_state = TP_SENDING_STATE_PENDING_SEND;
+ else
+ local_sending_state = TP_SENDING_STATE_SENDING;
+ }
else
- local_sending_state = TP_SENDING_STATE_NONE;
+ {
+ local_sending_state = TP_SENDING_STATE_NONE;
+ }
if (rakia_sip_media_get_requested_direction (priv->media) &
diff --git a/rakia/sip-media.c b/rakia/sip-media.c
index 37cb0ad..2fe0cae 100644
--- a/rakia/sip-media.c
+++ b/rakia/sip-media.c
@@ -907,22 +907,30 @@ rakia_sip_media_set_remote_media (RakiaSipMedia *media,
/* Make sure we stop sending before we use the new set of codecs
* intended for the new connection */
if (codecs_changed)
- priv->push_candidates_on_new_codecs = TRUE;
+ {
+ priv->push_candidates_on_new_codecs = TRUE;
+ if (priv->remote_candidates != NULL)
+ {
+ g_ptr_array_unref (priv->remote_candidates);
+ priv->remote_candidates = NULL;
+ g_signal_emit (media, signals[SIG_REMOTE_CANDIDATES_UPDATED], 0);
+ }
+ }
else
- push_remote_candidates (media);
+ {
+ push_remote_candidates (media);
+ }
}
if (codecs_changed)
{
- if (!priv->codec_intersect_pending)
- {
- priv->codec_intersect_pending = TRUE;
- push_remote_codecs (media);
- }
+ if (authoritative)
+ priv->codec_intersect_pending = TRUE;
+
+ if (priv->remote_codec_offer == NULL)
+ push_remote_codecs (media);
else
- {
- priv->push_remote_codecs_pending = TRUE;
- }
+ priv->push_remote_codecs_pending = TRUE;
}
/* TODO: this will go to session change commit code */
@@ -972,19 +980,14 @@ rakia_sip_media_take_local_codecs (RakiaSipMedia *self, GPtrArray *local_codecs)
g_ptr_array_unref (priv->local_codecs);
priv->local_codecs = local_codecs;
- MEDIA_DEBUG (self, "New local codecs intersect_pending: %d "
- "push_candidates: %d candidates_prepared: %d",
- priv->codec_intersect_pending, priv->push_candidates_on_new_codecs,
- priv->local_candidates_prepared);
-
-
if (priv->push_remote_codecs_pending)
{
priv->push_remote_codecs_pending = FALSE;
push_remote_codecs (self);
}
- else if (priv->codec_intersect_pending)
+ else
{
+
if (priv->push_candidates_on_new_codecs)
{
/* Push the new candidates now that we have new codecs */
@@ -992,18 +995,22 @@ rakia_sip_media_take_local_codecs (RakiaSipMedia *self, GPtrArray *local_codecs)
push_remote_candidates (self);
}
- priv->codec_intersect_pending = FALSE;
- if (rakia_sip_media_is_ready (self))
+ if (priv->codec_intersect_pending)
{
- g_signal_emit (self, signals[SIG_LOCAL_NEGOTIATION_COMPLETE], 0,
- TRUE);
- g_ptr_array_unref (priv->remote_codec_offer);
- priv->remote_codec_offer = NULL;
+
+ priv->codec_intersect_pending = FALSE;
+ if (rakia_sip_media_is_ready (self))
+ {
+ g_signal_emit (self, signals[SIG_LOCAL_NEGOTIATION_COMPLETE], 0,
+ TRUE);
+ g_ptr_array_unref (priv->remote_codec_offer);
+ priv->remote_codec_offer = NULL;
+ }
+ }
+ else
+ {
+ rakia_sip_media_local_updated (self);
}
- }
- else
- {
- rakia_sip_media_local_updated (self);
}
}
diff --git a/rakia/sip-session.c b/rakia/sip-session.c
index 57d0045..44e8f4b 100644
--- a/rakia/sip-session.c
+++ b/rakia/sip-session.c
@@ -85,12 +85,12 @@ static const char *const session_states[NUM_RAKIA_SIP_SESSION_STATES] =
};
#define SESSION_DEBUG(session, format, ...) \
- rakia_log (DEBUG_FLAG, G_LOG_LEVEL_DEBUG, "session [%-17s]: " format, \
- session_states[(session)->priv->state],##__VA_ARGS__)
+ rakia_log (DEBUG_FLAG, G_LOG_LEVEL_DEBUG, "%s [%-17s]: " format, \
+ G_STRFUNC, session_states[(session)->priv->state],##__VA_ARGS__)
#define SESSION_MESSAGE(session, format, ...) \
- rakia_log (DEBUG_FLAG, G_LOG_LEVEL_MESSAGE, "session [%-17s]: " format, \
- session_states[(session)->priv->state],##__VA_ARGS__)
+ rakia_log (DEBUG_FLAG, G_LOG_LEVEL_MESSAGE, "%s [%-17s]: " format, \
+ G_STRFUNC, session_states[(session)->priv->state],##__VA_ARGS__)
#else /* !ENABLE_DEBUG */
@@ -845,6 +845,9 @@ rakia_sip_session_media_changed (RakiaSipSession *self)
else
priv->pending_offer = TRUE;
break;
+ case RAKIA_SIP_SESSION_STATE_ENDED:
+ /* We've already ended the call, ignore any change request */
+ break;
default:
g_assert_not_reached();
}
@@ -1104,6 +1107,7 @@ priv_session_invite (RakiaSipSession *session, gboolean reinvite)
SOATAG_USER_SDP_STR(priv->local_sdp),
SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE),
SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL),
+ SOATAG_ORDERED_USER(1),
NUTAG_AUTOANSWER(0),
TAG_IF(reinvite,
NUTAG_INVITE_TIMER (RAKIA_REINVITE_TIMEOUT)),
@@ -1137,7 +1141,6 @@ priv_session_respond (RakiaSipSession *session)
priv->local_sdp = g_string_free (user_sdp, FALSE);
}
-
/* We need to be prepared to receive media right after the
* answer is sent, so we must set the streams to playing */
g_signal_emit (session, signals[SIG_START_RECEIVING], 0);