[farsight2/master] Return FsRtpStream construction errors

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:19:41 PST 2008


---
 gst/fsrtpconference/fs-rtp-session.c |    2 +-
 gst/fsrtpconference/fs-rtp-stream.c  |   32 ++++++++++++++++++++------------
 gst/fsrtpconference/fs-rtp-stream.h  |    3 ++-
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index fdb6d7d..b549d9d 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -636,7 +636,7 @@ fs_rtp_session_new_stream (FsSession *session, FsParticipant *participant,
     return NULL;
 
   new_stream = FS_STREAM_CAST (fs_rtp_stream_new (self, rtpparticipant,
-      direction, st));
+      direction, st, error));
 
   return new_stream;
 }
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index ad68f8f..7bf23bd 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -67,6 +67,8 @@ struct _FsRtpStreamPrivate
 
   FsStreamDirection direction;
 
+  GError *construction_error;
+
   gboolean disposed;
 };
 
@@ -320,11 +322,8 @@ fs_rtp_stream_constructed (GObject *object)
   FsRtpStream *self = FS_RTP_STREAM_CAST (object);
 
   if (!self->priv->stream_transmitter) {
-    /* FIXME
-    g_error_new (FS_ERROR,
-      FS_ERROR_CONSTRUCTION,
-      "The Stream Transmitter has not been set");
-    */
+    self->priv->construction_error = g_error_new (FS_ERROR,
+      FS_ERROR_CONSTRUCTION, "The Stream Transmitter has not been set");
     return;
   }
 
@@ -462,14 +461,23 @@ FsRtpStream *
 fs_rtp_stream_new (FsRtpSession *session,
                    FsRtpParticipant *participant,
                    FsStreamDirection direction,
-                   FsStreamTransmitter *stream_transmitter)
+                   FsStreamTransmitter *stream_transmitter,
+                   GError **error)
 {
-  return g_object_new (FS_TYPE_RTP_STREAM,
-                       "session", session,
-                       "participant", participant,
-                       "direction", direction,
-                       "stream-transmitter", stream_transmitter,
-                       NULL);
+  FsRtpStream *self = g_object_new (FS_TYPE_RTP_STREAM,
+    "session", session,
+    "participant", participant,
+    "direction", direction,
+    "stream-transmitter", stream_transmitter,
+    NULL);
+
+  if (self->priv->construction_error) {
+    g_propagate_error (error, self->priv->construction_error);
+    g_object_unref (self);
+    return NULL;
+  }
+
+  return self;
 }
 
 
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index c265f17..9f3addf 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -73,7 +73,8 @@ GType fs_rtp_stream_get_type (void);
 FsRtpStream *fs_rtp_stream_new (FsRtpSession *session,
                                 FsRtpParticipant *participant,
                                 FsStreamDirection direction,
-                                FsStreamTransmitter *stream_transmitter);
+                                FsStreamTransmitter *stream_transmitter,
+                                GError **error);
 
 void fs_rtp_stream_new_recv_pad (FsRtpStream *stream, GstPad *pad, guint pt);
 
-- 
1.5.6.5




More information about the farsight-commits mailing list