[telepathy-stream-engine/master] Implement new error numbers

Olivier Crête olivier.crete at collabora.co.uk
Mon Oct 19 06:18:04 PDT 2009


---
 configure.ac             |    2 +-
 src/audiostream.c        |    5 ++---
 src/stream-engine-main.c |    3 ++-
 src/tp-stream-engine.c   |   21 +++++++++++----------
 src/videostream.c        |    3 +--
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4ecbb4c..5859694 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,7 @@ AC_SUBST(DBUS_SERVICES_DIR)
 AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [DBus services directory])
 
 dnl Check for Telepathy libraries
-PKG_CHECK_MODULES([TELEPATHY], [telepathy-glib >= 0.7.20])
+PKG_CHECK_MODULES([TELEPATHY], [telepathy-glib >= 0.7.34])
 
 AC_SUBST(TELEPATHY_CFLAGS)
 AC_SUBST(TELEPATHY_LIBS)
diff --git a/src/audiostream.c b/src/audiostream.c
index 1d48c2b..7bcd580 100644
--- a/src/audiostream.c
+++ b/src/audiostream.c
@@ -432,10 +432,9 @@ src_pad_added_idle_error (gpointer user_data)
 {
   TpStreamEngineAudioStream *self = TP_STREAM_ENGINE_AUDIO_STREAM (user_data);
 
-  tf_stream_error (self->priv->stream, 0,
+  tf_stream_error (self->priv->stream, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR,
       "Error setting up audio reception");
 
-
   g_mutex_lock (self->priv->mutex);
   self->priv->error_idle_id = 0;
   g_mutex_unlock (self->priv->mutex);
@@ -587,7 +586,7 @@ tp_stream_engine_audio_stream_set_playing (TpStreamEngineAudioStream *self,
         ret = gst_element_set_state (self->priv->srcbin, GST_STATE_READY);
 
       if (ret == GST_STATE_CHANGE_FAILURE)
-        tf_stream_error (self->priv->stream, 0,
+        tf_stream_error (self->priv->stream, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR,
             "Error re-starting the audio srouce");
     }
   else
diff --git a/src/stream-engine-main.c b/src/stream-engine-main.c
index 7fdd349..dafd8bd 100644
--- a/src/stream-engine-main.c
+++ b/src/stream-engine-main.c
@@ -153,7 +153,8 @@ dsp_crashed (gpointer dummy)
 {
   if (stream_engine)
   {
-    tp_stream_engine_error (stream_engine, 0, "DSP Crash");
+    tp_stream_engine_error (stream_engine, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR,
+        "DSP Crash");
     g_object_unref (stream_engine);
     g_main_loop_quit (mainloop);
   }
diff --git a/src/tp-stream-engine.c b/src/tp-stream-engine.c
index 02c4271..dd30bc9 100644
--- a/src/tp-stream-engine.c
+++ b/src/tp-stream-engine.c
@@ -802,7 +802,7 @@ channel_stream_created (TfChannel *chan G_GNUC_UNUSED,
 
       if (!audiostream)
         {
-          tf_stream_error (stream, TP_MEDIA_STREAM_ERROR_UNKNOWN,
+          tf_stream_error (stream, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR,
               "Could not create audio stream");
           g_warning ("Could not create audio stream: %s", error->message);
           return;
@@ -850,7 +850,7 @@ channel_stream_created (TfChannel *chan G_GNUC_UNUSED,
       if (!videostream)
         {
           g_warning ("Could not create video stream: %s", error->message);
-          tf_stream_error (stream, TP_MEDIA_STREAM_ERROR_UNKNOWN,
+          tf_stream_error (stream, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR,
               "Could not create video stream");
           gst_element_release_request_pad (self->priv->videotee, pad);
           return;
@@ -966,17 +966,18 @@ error_one_stream (TfChannel *chan G_GNUC_UNUSED,
     TfStream *stream,
     gpointer user_data)
 {
-  const gchar *message = (const gchar *) user_data;
+  GError *error = user_data;
 
-  tf_stream_error (stream, TP_MEDIA_STREAM_ERROR_UNKNOWN,
-      message);
+  tf_stream_error (stream, error->code, error->message);
 }
 
 
 static void
-error_all_streams (TpStreamEngine *self, const gchar *message)
+error_all_streams (TpStreamEngine *self, TpMediaStreamError error,
+    gchar *message)
 {
   guint i;
+  GError gerror = {0, error, message};
 
   g_debug ("Closing all streams");
 
@@ -984,8 +985,7 @@ error_all_streams (TpStreamEngine *self, const gchar *message)
     {
       TfChannel *channel = g_ptr_array_index (self->priv->channels,
           i);
-      tf_channel_foreach_stream (channel,
-          error_one_stream, (gpointer) message);
+      tf_channel_foreach_stream (channel, error_one_stream, &gerror);
     }
 }
 
@@ -1067,7 +1067,8 @@ restart_pipeline (gpointer data)
 
   if (self->priv->failcount > 5)
     {
-      error_all_streams (self, "Could not restart the pipeline after an error");
+      error_all_streams (self, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR,
+          "Could not restart the pipeline after an error");
       g_error ("Failed five times to restart the pipeline after an error");
       return FALSE;
     }
@@ -1106,7 +1107,7 @@ bus_async_handler (GstBus *bus G_GNUC_UNUSED,
         gst_message_parse_error (message, &error, &error_string);
 
 
-        //error_all_streams (engine, error->message);
+        //error_all_streams (engine, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR, error->message);
 
         g_warning ("%s: got error from %s: %s: %s (%d %d), stopping pipeline",
             G_STRFUNC, name, error->message, error_string,
diff --git a/src/videostream.c b/src/videostream.c
index 27e32b9..a0af58a 100644
--- a/src/videostream.c
+++ b/src/videostream.c
@@ -469,10 +469,9 @@ src_pad_added_idle_error (gpointer user_data)
 {
   TpStreamEngineVideoStream *self = TP_STREAM_ENGINE_VIDEO_STREAM (user_data);
 
-  tf_stream_error (self->priv->stream, 0,
+  tf_stream_error (self->priv->stream, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR,
       "Error setting up video reception");
 
-
   g_mutex_lock (self->priv->mutex);
   self->priv->error_idle_id = 0;
   g_mutex_unlock (self->priv->mutex);
-- 
1.5.6.5




More information about the telepathy-commits mailing list