summaryrefslogtreecommitdiff
path: root/telepathy-glib/base-media-call-stream.c
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2012-01-20 15:25:41 -0500
committerOlivier CrĂȘte <olivier.crete@collabora.com>2012-01-20 16:33:58 -0500
commit043c11f87a0a36c5b0e9189022837f2459e1e6f6 (patch)
tree10553e2ff9d6f4d594cfec732c763d9be9c2ccbc /telepathy-glib/base-media-call-stream.c
parent777052913570724fb438130eb3cd86a5ada9669e (diff)
downloadtelepathy-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/base-media-call-stream.c')
-rw-r--r--telepathy-glib/base-media-call-stream.c53
1 files changed, 17 insertions, 36 deletions
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);
}