summaryrefslogtreecommitdiff
path: root/telepathy-farstream
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2011-11-08 18:03:02 -0500
committerXavier Claessens <xclaesse@gmail.com>2011-11-28 16:08:13 +0100
commita4d0638f123d2752e56174632f89bd1a62087665 (patch)
tree1035b360a612f5cce969d0ef6d518fea4092115b /telepathy-farstream
parent7ee4b200763bbdab315fa796e31c8c7e9bf8774d (diff)
downloadtelepathy-farstream-a4d0638f123d2752e56174632f89bd1a62087665.tar.gz
Simplify tf_content_error by removing useless parameters
Diffstat (limited to 'telepathy-farstream')
-rw-r--r--telepathy-farstream/call-content.c106
-rw-r--r--telepathy-farstream/content-priv.h2
-rw-r--r--telepathy-farstream/content.c20
-rw-r--r--telepathy-farstream/content.h6
-rw-r--r--telepathy-farstream/media-signalling-content.c16
5 files changed, 79 insertions, 71 deletions
diff --git a/telepathy-farstream/call-content.c b/telepathy-farstream/call-content.c
index 07d32f1..519bfc2 100644
--- a/telepathy-farstream/call-content.c
+++ b/telepathy-farstream/call-content.c
@@ -183,12 +183,21 @@ static void src_pad_added (FsStream *fsstream, GstPad *pad, FsCodec *codec,
static GstIterator * tf_call_content_iterate_src_pads (TfContent *content,
guint *handles, guint handle_count);
-static void tf_call_content_error (TfContent *content,
+static void tf_call_content_error (TfCallContent *self,
+ TpCallStateChangeReason reason,
+ const gchar *detailed_reason,
+ const gchar *message_format,
+ ...) G_GNUC_PRINTF (4, 5);
+static void tf_call_content_error_literal (TfCallContent *self,
TpCallStateChangeReason reason,
const gchar *detailed_reason,
const gchar *message);
static void
+tf_call_content_error_impl (TfContent *content,
+ const gchar *message);
+
+static void
tf_call_content_class_init (TfCallContentClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -196,7 +205,7 @@ tf_call_content_class_init (TfCallContentClass *klass)
content_class->iterate_src_pads = tf_call_content_iterate_src_pads;
- content_class->content_error = tf_call_content_error;
+ content_class->content_error = tf_call_content_error_impl;
object_class->dispose = tf_call_content_dispose;
object_class->finalize = tf_call_content_finalize;
@@ -396,7 +405,7 @@ create_stream (TfCallContent *self, gchar *stream_path)
if (error)
{
/* TODO: Use per-stream errors */
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
"Error creating the stream object: %s", error->message);
@@ -570,7 +579,7 @@ on_content_dtmf_change_requested (TpProxy *proxy,
case TP_SENDING_STATE_PENDING_STOP_SENDING:
if (self->dtmf_sending_state != TP_SENDING_STATE_SENDING)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Tried to stop a %u DTMF event while state is %d",
@@ -583,7 +592,7 @@ on_content_dtmf_change_requested (TpProxy *proxy,
}
else
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
"Could not stop DTMF event %d", arg_Event);
@@ -595,7 +604,7 @@ on_content_dtmf_change_requested (TpProxy *proxy,
case TP_SENDING_STATE_PENDING_SEND:
if (self->dtmf_sending_state != TP_SENDING_STATE_NONE)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Tried to start a new DTMF event %u while %d is already playing",
@@ -611,7 +620,7 @@ on_content_dtmf_change_requested (TpProxy *proxy,
}
else
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
"Could not start DTMF event %d", arg_Event);
@@ -621,7 +630,7 @@ on_content_dtmf_change_requested (TpProxy *proxy,
}
break;
default:
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Invalid State %d in DTMFChangeRequested signal for event %d",
@@ -706,7 +715,7 @@ process_media_description (TfCallContent *self,
if (!tp_dbus_check_valid_object_path (media_description_objpath, &error))
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, TP_ERROR_STR_CONFUSED,
"Invalid MediaDescription path: %s", error->message);
g_clear_error (&error);
@@ -718,7 +727,7 @@ process_media_description (TfCallContent *self,
if (!codecs)
{
- tf_content_error_literal (TF_CONTENT (self),
+ tf_call_content_error_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, TP_ERROR_STR_CONFUSED,
"MediaDescription does not contain codecs");
g_clear_error (&error);
@@ -948,7 +957,7 @@ got_content_media_properties (TpProxy *proxy, GHashTable *properties,
if (error != NULL)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
"Error getting the Content's media properties: %s", error->message);
@@ -974,7 +983,7 @@ got_content_media_properties (TpProxy *proxy, GHashTable *properties,
conference_type = "raw";
break;
default:
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_MEDIA_ERROR,
TP_ERROR_STR_MEDIA_UNSUPPORTED_TYPE,
"Could not create FsConference for type %d", packetization);
@@ -989,7 +998,7 @@ got_content_media_properties (TpProxy *proxy, GHashTable *properties,
conference_type);
if (!self->fsconference)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_MEDIA_ERROR,
TP_ERROR_STR_MEDIA_UNSUPPORTED_TYPE,
"Could not create FsConference for type %s", conference_type);
@@ -1005,7 +1014,7 @@ got_content_media_properties (TpProxy *proxy, GHashTable *properties,
if (!self->fssession)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_MEDIA_ERROR,
TP_ERROR_STR_MEDIA_UNSUPPORTED_TYPE,
"Could not create FsSession: %s", myerror->message);
@@ -1078,7 +1087,7 @@ got_content_media_properties (TpProxy *proxy, GHashTable *properties,
return;
invalid_property:
- tf_content_error_literal (TF_CONTENT (self),
+ tf_call_content_error_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error getting the Content's properties: invalid type");
@@ -1110,7 +1119,7 @@ setup_content_media_properties (TfCallContent *self,
return;
connect_failed:
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error getting the Content's VideoControl properties: %s",
@@ -1166,7 +1175,7 @@ got_content_video_control_properties (TpProxy *proxy, GHashTable *properties,
if (error)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error getting the Content's VideoControl properties: %s",
@@ -1185,7 +1194,7 @@ got_content_video_control_properties (TpProxy *proxy, GHashTable *properties,
if (properties == NULL)
{
- tf_content_error_literal (TF_CONTENT (self),
+ tf_call_content_error_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error getting the Content's VideoControl properties: "
@@ -1279,7 +1288,7 @@ setup_content_video_control (TfCallContent *self,
return;
connect_failed:
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error getting the Content's VideoControl properties: %s",
@@ -1336,7 +1345,7 @@ got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
if (error)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error getting the Content's properties: %s", error->message);
@@ -1358,7 +1367,7 @@ got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
if (!out_Properties)
{
- tf_content_error_literal (TF_CONTENT (self),
+ tf_call_content_error_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error getting the Content's properties: there are none");
@@ -1373,7 +1382,7 @@ got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
if (interfaces == NULL)
{
- tf_content_error_literal (TF_CONTENT (self),
+ tf_call_content_error_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Content does not have the Interfaces property, "
@@ -1399,7 +1408,7 @@ got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
if (!got_media_interface)
{
- tf_content_error_literal (TF_CONTENT (self),
+ tf_call_content_error_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Content does not have the media interface,"
@@ -1438,7 +1447,7 @@ got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
if (myerror)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error connectiong to NewCodecMediaDescription signal: %s",
@@ -1458,7 +1467,7 @@ got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
return;
invalid_property:
- tf_content_error_literal (TF_CONTENT (self),
+ tf_call_content_error_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, TP_ERROR_STR_CONFUSED,
"Error getting the Content's properties: invalid type");
g_simple_async_result_set_error (res, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
@@ -1530,7 +1539,7 @@ tf_call_content_init_async (GAsyncInitable *initable,
G_OBJECT (self), &myerror);
if (myerror)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, TP_ERROR_STR_CONFUSED,
"Error connectiong to StreamAdded signal: %s", myerror->message);
g_simple_async_report_gerror_in_idle (G_OBJECT (self), callback,
@@ -1543,7 +1552,7 @@ tf_call_content_init_async (GAsyncInitable *initable,
G_OBJECT (self), &myerror);
if (myerror)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, TP_ERROR_STR_CONFUSED,
"Error connectiong to StreamRemoved signal: %s", myerror->message);
g_simple_async_report_gerror_in_idle (G_OBJECT (self), callback,
@@ -1855,7 +1864,7 @@ tf_call_content_dtmf_started (TfCallContent *self, FsDTMFMethod method,
{
if (volume != DTMF_TONE_VOLUME)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
"DTMF volume is %d, while we use %d", volume, DTMF_TONE_VOLUME);
@@ -1864,7 +1873,7 @@ tf_call_content_dtmf_started (TfCallContent *self, FsDTMFMethod method,
if (self->dtmf_sending_state != TP_SENDING_STATE_PENDING_SEND)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
"Farstream started a DTMFevent, but we were in the %d state",
@@ -1874,7 +1883,7 @@ tf_call_content_dtmf_started (TfCallContent *self, FsDTMFMethod method,
if (self->current_dtmf_event != event)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
"Farstream started the wrong dtmf event, got %d but "
@@ -1893,7 +1902,7 @@ tf_call_content_dtmf_stopped (TfCallContent *self, FsDTMFMethod method)
{
if (self->dtmf_sending_state != TP_SENDING_STATE_PENDING_STOP_SENDING)
{
- tf_content_error (TF_CONTENT (self),
+ tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
"Farstream stopped a DTMFevent, but we were in the %d state",
@@ -1947,7 +1956,7 @@ tf_call_content_bus_message (TfCallContent *content,
enumvalue->value_nick, error_no, error_msg);
g_type_class_unref (enumclass);
- tf_content_error_literal (TF_CONTENT (content),
+ tf_call_content_error_literal (content,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_MEDIA_STREAMING_ERROR, error_msg);
}
@@ -2003,14 +2012,32 @@ tf_call_content_bus_message (TfCallContent *content,
return ret;
}
+
static void
-tf_call_content_error (TfContent *content,
+tf_call_content_error (TfCallContent *self,
TpCallStateChangeReason reason,
const gchar *detailed_reason,
- const gchar *message)
+ const gchar *message_format,
+ ...)
{
- TfCallContent *self = TF_CALL_CONTENT (content);
+ gchar *message;
+ va_list valist;
+
+ va_start (valist, message_format);
+ message = g_strdup_vprintf (message_format, valist);
+ va_end (valist);
+
+ tf_call_content_error_literal (self, reason, detailed_reason, message);
+ g_free (message);
+}
+
+static void
+tf_call_content_error_literal (TfCallContent *self,
+ TpCallStateChangeReason reason,
+ const gchar *detailed_reason,
+ const gchar *message)
+{
g_warning ("%s", message);
tp_cli_call_content_interface_media_call_fail (
self->proxy, -1,
@@ -2019,6 +2046,15 @@ tf_call_content_error (TfContent *content,
}
+static void
+tf_call_content_error_impl (TfContent *content,
+ const gchar *message)
+{
+ tf_call_content_error_literal (TF_CALL_CONTENT (content),
+ TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
+ TP_ERROR_STR_MEDIA_STREAMING_ERROR, message);
+}
+
static FsStream *
tf_call_content_get_existing_fsstream_by_handle (TfCallContent *content,
diff --git a/telepathy-farstream/content-priv.h b/telepathy-farstream/content-priv.h
index 0f27b51..167ef56 100644
--- a/telepathy-farstream/content-priv.h
+++ b/telepathy-farstream/content-priv.h
@@ -19,8 +19,6 @@ struct _TfContentClass{
GObjectClass parent_class;
void (*content_error) (TfContent *content,
- TpCallStateChangeReason reason,
- const gchar *detailed_reason,
const gchar *message);
GstIterator * (*iterate_src_pads) (TfContent *content, guint *handle,
diff --git a/telepathy-farstream/content.c b/telepathy-farstream/content.c
index 5c8f7fc..d86c6c3 100644
--- a/telepathy-farstream/content.c
+++ b/telepathy-farstream/content.c
@@ -303,24 +303,20 @@ _tf_content_emit_src_pad_added (TfContent *self, guint handle,
/**
* tf_content_error_literal:
* @content: a #TfContent
- * @reason: the reason
- * @detailed_reason: The detailled error (as a DBus name)
* @message: error Message
*
- * Send an error to the Content to the CM, the effect is most likely that the
- * content will be removed.
+ * Send a fatal streaming error to the Content to the CM, the effect is most
+ * likely that the content will be removed.
*/
void
tf_content_error_literal (TfContent *content,
- TpCallStateChangeReason reason,
- const gchar *detailed_reason,
const gchar *message)
{
TfContentClass *klass = TF_CONTENT_GET_CLASS (content);
if (klass->content_error)
- klass->content_error (content, reason, detailed_reason, message);
+ klass->content_error (content, message);
else
GST_WARNING ("content_error not defined in class: %s", message);
}
@@ -328,19 +324,15 @@ tf_content_error_literal (TfContent *content,
/**
* tf_content_error:
* @content: a #TfContent
- * @reason: the reason
- * @detailed_reason: The detailled error (as a DBus name)
* @message_format: error Message with printf style formatting
* @...: Parameters to insert into the @message_format string
*
- * Send an error to the Content to the CM, the effect is most likely that the
- * content will be removed.
+ * Send a fatal streaming error to the Content to the CM, the effect is most
+ * likely that the content will be removed.
*/
void
tf_content_error (TfContent *content,
- TpCallStateChangeReason reason,
- const gchar *detailed_reason,
const gchar *message_format,
...)
{
@@ -351,7 +343,7 @@ tf_content_error (TfContent *content,
message = g_strdup_vprintf (message_format, valist);
va_end (valist);
- tf_content_error_literal (content, reason, detailed_reason, message);
+ tf_content_error_literal (content, message);
g_free (message);
}
diff --git a/telepathy-farstream/content.h b/telepathy-farstream/content.h
index 0b38a99..aabfdff 100644
--- a/telepathy-farstream/content.h
+++ b/telepathy-farstream/content.h
@@ -48,14 +48,10 @@ typedef struct _TfContentClass TfContentClass;
GType tf_content_get_type (void);
void tf_content_error_literal (TfContent *content,
- TpCallStateChangeReason reason,
- const gchar *detailed_reason,
const gchar *message);
void tf_content_error (TfContent *content,
- TpCallStateChangeReason reason,
- const gchar *detailed_reason,
- const gchar *message_format, ...) G_GNUC_PRINTF (4, 5);
+ const gchar *message_format, ...) G_GNUC_PRINTF (2, 3);
GstIterator *tf_content_iterate_src_pads (TfContent *content,
guint *handles, guint handle_count);
diff --git a/telepathy-farstream/media-signalling-content.c b/telepathy-farstream/media-signalling-content.c
index 072c642..8f8fead 100644
--- a/telepathy-farstream/media-signalling-content.c
+++ b/telepathy-farstream/media-signalling-content.c
@@ -86,8 +86,6 @@ tf_media_signalling_content_get_property (GObject *object,
GParamSpec *pspec);
static void tf_media_signalling_content_error (TfContent *content,
- TpCallStateChangeReason reason,
- const gchar *detailed_reason,
const gchar *message);
static GstIterator * tf_media_signalling_content_iterate_src_pads (
@@ -286,23 +284,11 @@ restart_source (TfStream *stream, TfMediaSignallingContent *self)
static void
tf_media_signalling_content_error (TfContent *content,
- TpCallStateChangeReason reason,
- const gchar *detailed_reason,
const gchar *message)
{
TfMediaSignallingContent *self = TF_MEDIA_SIGNALLING_CONTENT (content);
- TpMediaStreamError stream_error;
- switch (reason)
- {
- case TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR:
- stream_error = TP_MEDIA_STREAM_ERROR_MEDIA_ERROR;
- break;
- default:
- stream_error = TP_MEDIA_STREAM_ERROR_UNKNOWN;
- }
-
- tf_stream_error (self->stream, stream_error, message);
+ tf_stream_error (self->stream, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR, message);
}
static GstIterator *