[farsight2/master] Use g_set_error instead of g_error_new when appropriate
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:19:26 PST 2008
---
gst-libs/gst/farsight/fs-base-conference.c | 4 ++--
gst/fsrtpconference/fs-rtp-session.c | 5 ++---
gst/fsrtpconference/fs-rtp-stream.c | 2 ++
transmitters/rawudp/fs-rawudp-stream-transmitter.c | 8 ++++----
transmitters/rawudp/fs-rawudp-transmitter.c | 10 +++++-----
5 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/gst-libs/gst/farsight/fs-base-conference.c b/gst-libs/gst/farsight/fs-base-conference.c
index 14f74fc..25963c6 100644
--- a/gst-libs/gst/farsight/fs-base-conference.c
+++ b/gst-libs/gst/farsight/fs-base-conference.c
@@ -257,8 +257,8 @@ fs_base_conference_new_session (FsConference *conf,
base_conf);
} else {
GST_WARNING_OBJECT (conf, "new_session not defined in element");
- *error = g_error_new (FS_SESSION_ERROR,
- FS_SESSION_ERROR_CONSTRUCTION, "new_session not defined in element");
+ g_set_error (error, FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
+ "new_session not defined in element");
}
return new_session;
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index da34a68..d77e062 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -578,8 +578,7 @@ fs_rtp_session_new_stream (FsSession *session, FsParticipant *participant,
FsStream *new_stream = NULL;
if (!FS_IS_RTP_PARTICIPANT (participant)) {
- *error = g_error_new (FS_STREAM_ERROR,
- FS_STREAM_ERROR_INVALID_ARGUMENTS,
+ g_set_error (error, FS_STREAM_ERROR, FS_STREAM_ERROR_INVALID_ARGUMENTS,
"You have to provide a participant of type RTP");
return NULL;
}
@@ -668,7 +667,7 @@ fs_rtp_session_new (FsMediaType media_type, FsRtpConference *conference,
NULL);
if (session->priv->construction_error) {
- *error = session->priv->construction_error;
+ g_propagate_error (error, session->priv->construction_error);
g_object_unref (session);
return NULL;
}
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 0267d9a..35f60ea 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -320,9 +320,11 @@ fs_rtp_stream_constructed (GObject *object)
FsRtpStream *self = FS_RTP_STREAM_CAST (object);
if (!self->priv->stream_transmitter) {
+ /* FIXME
g_error_new (FS_STREAM_ERROR,
FS_STREAM_ERROR_CONSTRUCTION,
"The Stream Transmitter has not been set");
+ */
return;
}
diff --git a/transmitters/rawudp/fs-rawudp-stream-transmitter.c b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
index 17bc5fb..5591c64 100644
--- a/transmitters/rawudp/fs-rawudp-stream-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
@@ -287,7 +287,7 @@ fs_rawudp_stream_transmitter_build (FsRawUdpStreamTransmitter *self,
FsCandidate *candidate = item->data;
if (candidate->proto != FS_NETWORK_PROTOCOL_UDP) {
- *error = g_error_new (FS_STREAM_ERROR, FS_STREAM_ERROR_INVALID_ARGUMENTS,
+ g_set_error (error, FS_STREAM_ERROR, FS_STREAM_ERROR_INVALID_ARGUMENTS,
"You set prefered candidate of a type %d that is not"
" FS_NETWORK_PROTOCOL_UDP",
candidate->proto);
@@ -297,7 +297,7 @@ fs_rawudp_stream_transmitter_build (FsRawUdpStreamTransmitter *self,
switch (candidate->component_id) {
case 1: /* RTP */
if (ip) {
- *error = g_error_new (FS_STREAM_ERROR,
+ g_set_error (error, FS_STREAM_ERROR,
FS_STREAM_ERROR_INVALID_ARGUMENTS,
"You set more than one candidate for component 1");
return FALSE;
@@ -307,7 +307,7 @@ fs_rawudp_stream_transmitter_build (FsRawUdpStreamTransmitter *self,
break;
case 2: /* RTCP */
if (rtcp_ip) {
- *error = g_error_new (FS_STREAM_ERROR,
+ g_set_error (error, FS_STREAM_ERROR,
FS_STREAM_ERROR_INVALID_ARGUMENTS,
"You set more than one candidate for component 2");
return FALSE;
@@ -316,7 +316,7 @@ fs_rawudp_stream_transmitter_build (FsRawUdpStreamTransmitter *self,
rtcp_port = candidate->port;
break;
default:
- *error = g_error_new (FS_STREAM_ERROR, FS_STREAM_ERROR_INVALID_ARGUMENTS,
+ g_set_error (error, FS_STREAM_ERROR, FS_STREAM_ERROR_INVALID_ARGUMENTS,
"Only components 1 and 2 are supported, %d isnt",
candidate->component_id);
return FALSE;
diff --git a/transmitters/rawudp/fs-rawudp-transmitter.c b/transmitters/rawudp/fs-rawudp-transmitter.c
index c4057b8..e84918f 100644
--- a/transmitters/rawudp/fs-rawudp-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-transmitter.c
@@ -474,7 +474,7 @@ _create_sinksource (gchar *elementname, GstBin *bin,
elem = gst_element_factory_make (elementname, NULL);
if (!elem) {
- *error = g_error_new (FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
+ g_set_error (error, FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
"Could not create the %s element", elementname);
return NULL;
}
@@ -485,7 +485,7 @@ _create_sinksource (gchar *elementname, GstBin *bin,
NULL);
if (!gst_bin_add (bin, elem)) {
- *error = g_error_new (FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
+ g_set_error (error, FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
"Could not add the udpsrc element to the gst sink");
gst_object_unref (elem);
return NULL;
@@ -497,7 +497,7 @@ _create_sinksource (gchar *elementname, GstBin *bin,
*requested_pad = gst_element_get_request_pad (teefunnel, "src%d");
if (!*requested_pad) {
- *error = g_error_new (FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
+ g_set_error (error, FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
"Could not get the %s request pad from the %s",
(direction == GST_PAD_SINK) ? "sink" : "src",
(direction == GST_PAD_SINK) ? "tee" : "funnel");
@@ -515,13 +515,13 @@ _create_sinksource (gchar *elementname, GstBin *bin,
ret = gst_pad_link (ourpad, *requested_pad);
if (GST_PAD_LINK_FAILED(ret)) {
- *error = g_error_new (FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
+ g_set_error (error, FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
"Could not link the new element %s (%d)", elementname, ret);
goto error;
}
if (!gst_element_sync_state_with_parent (elem)) {
- *error = g_error_new (FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
+ g_set_error (error, FS_SESSION_ERROR, FS_SESSION_ERROR_CONSTRUCTION,
"Could not sync the state of the new %s with its parent",
elementname);
goto error;
--
1.5.6.5
More information about the farsight-commits
mailing list