diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2012-01-20 15:25:41 -0500 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2012-01-20 16:33:58 -0500 |
commit | 043c11f87a0a36c5b0e9189022837f2459e1e6f6 (patch) | |
tree | 10553e2ff9d6f4d594cfec732c763d9be9c2ccbc /telepathy-glib | |
parent | 777052913570724fb438130eb3cd86a5ada9669e (diff) | |
download | telepathy-glib-043c11f87a0a36c5b0e9189022837f2459e1e6f6.tar.gz |
Fix local hold state stransition for call channel
Call channel should go to pending hold state until all the streams are
no longer pending stop (the one that didn't failed). Also, the transition
from pending stop to started is impossible.
Diffstat (limited to 'telepathy-glib')
-rw-r--r-- | telepathy-glib/base-media-call-channel.c | 13 | ||||
-rw-r--r-- | telepathy-glib/base-media-call-stream.c | 53 |
2 files changed, 23 insertions, 43 deletions
diff --git a/telepathy-glib/base-media-call-channel.c b/telepathy-glib/base-media-call-channel.c index 795a5bded..b3dfc667d 100644 --- a/telepathy-glib/base-media-call-channel.c +++ b/telepathy-glib/base-media-call-channel.c @@ -468,14 +468,9 @@ hold_change_failed (TpBaseMediaCallChannel *self) TpBaseCallChannel *bcc = TP_BASE_CALL_CHANNEL (self); GList *l, *l2; - if (self->priv->hold_state == TP_LOCAL_HOLD_STATE_PENDING_HOLD) + if (self->priv->hold_state == TP_LOCAL_HOLD_STATE_PENDING_UNHOLD) { - set_hold_state (self, TP_LOCAL_HOLD_STATE_UNHELD, - TP_LOCAL_HOLD_STATE_REASON_RESOURCE_NOT_AVAILABLE); - } - else if (self->priv->hold_state == TP_LOCAL_HOLD_STATE_PENDING_UNHOLD) - { - set_hold_state (self, TP_LOCAL_HOLD_STATE_HELD, + set_hold_state (self, TP_LOCAL_HOLD_STATE_PENDING_HOLD, TP_LOCAL_HOLD_STATE_REASON_RESOURCE_NOT_AVAILABLE); } @@ -490,6 +485,10 @@ hold_change_failed (TpBaseMediaCallChannel *self) tp_base_media_call_stream_update_sending_state (stream); } } + + /* Ensure we escape channel pending state if there is no more pending stream state + * change. */ + update_hold_state (self); } static void diff --git a/telepathy-glib/base-media-call-stream.c b/telepathy-glib/base-media-call-stream.c index ee9fa83e2..059c85c69 100644 --- a/telepathy-glib/base-media-call-stream.c +++ b/telepathy-glib/base-media-call-stream.c @@ -1091,22 +1091,11 @@ tp_base_media_call_stream_report_sending_failure ( TpBaseCallChannel *channel = _tp_base_call_stream_get_channel ( TP_BASE_CALL_STREAM (self)); - switch (self->priv->sending_state) - { - case TP_STREAM_FLOW_STATE_PENDING_START: - self->priv->sending_state = TP_STREAM_FLOW_STATE_STOPPED; - break; - case TP_STREAM_FLOW_STATE_PENDING_STOP: - self->priv->sending_state = TP_STREAM_FLOW_STATE_STARTED; - break; - default: - { - GError e = {TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, - "The Sending state was not in a pending state"}; - dbus_g_method_return_error (context, &e); - return; - } - } + if (self->priv->sending_state == TP_STREAM_FLOW_STATE_STOPPED) + goto done; + + self->priv->sending_state = TP_STREAM_FLOW_STATE_STOPPED; + g_object_notify (G_OBJECT (self), "sending-state"); if (channel != NULL && TP_IS_BASE_MEDIA_CALL_CHANNEL (channel)) _tp_base_media_call_channel_streams_sending_state_changed ( @@ -1118,6 +1107,8 @@ tp_base_media_call_stream_report_sending_failure ( tp_svc_call_stream_interface_media_emit_sending_state_changed (self, self->priv->sending_state); + +done: tp_svc_call_stream_interface_media_return_from_report_sending_failure ( context); } @@ -1184,26 +1175,14 @@ tp_base_media_call_stream_report_receiving_failure ( TpBaseCallChannel *channel = _tp_base_call_stream_get_channel ( TP_BASE_CALL_STREAM (self)); - switch (self->priv->receiving_state) - { - case TP_STREAM_FLOW_STATE_PENDING_START: - /* Clear all receving requests, we can't receive */ - tp_intset_clear (self->priv->receiving_requests); - self->priv->receiving_state = TP_STREAM_FLOW_STATE_STOPPED; - g_object_notify (G_OBJECT (self), "receiving-state"); - break; - case TP_STREAM_FLOW_STATE_PENDING_STOP: - self->priv->receiving_state = TP_STREAM_FLOW_STATE_STARTED; - g_object_notify (G_OBJECT (self), "receiving-state"); - break; - default: - { - GError e = {TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, - "The Receiving state was not in a pending state"}; - dbus_g_method_return_error (context, &e); - return; - } - } + /* Clear all receving requests, we can't receive */ + tp_intset_clear (self->priv->receiving_requests); + + if (self->priv->receiving_state == TP_STREAM_FLOW_STATE_STOPPED) + goto done; + + self->priv->receiving_state = TP_STREAM_FLOW_STATE_STOPPED; + g_object_notify (G_OBJECT (self), "receiving-state"); if (channel != NULL && TP_IS_BASE_MEDIA_CALL_CHANNEL (channel)) _tp_base_media_call_channel_streams_receiving_state_changed ( @@ -1215,6 +1194,8 @@ tp_base_media_call_stream_report_receiving_failure ( tp_svc_call_stream_interface_media_emit_receiving_state_changed (self, self->priv->receiving_state); + +done: tp_svc_call_stream_interface_media_return_from_report_receiving_failure ( context); } |