static FsParticipant * fs_rtp_conference_new_participant (FsConference *conf, GError **error) { FsRtpConference *self = FS_RTP_CONFERENCE (conf); FsParticipant *new_participant = NULL; if (!self->rtpbin) { g_set_error (error, FS_ERROR, FS_ERROR_CONSTRUCTION, "Could not create Rtpbin"); return NULL; } new_participant = FS_PARTICIPANT_CAST (fs_rtp_participant_new ()); GST_OBJECT_LOCK (self); self->priv->participants = g_list_append (self->priv->participants, new_participant); GST_OBJECT_UNLOCK (self); g_object_weak_ref (G_OBJECT (new_participant), _remove_participant, self); return new_participant; }
static FsParticipant * fs_rtp_conference_new_participant (FsBaseConference *conf, gchar *cname, GError **error) { FsRtpConference *self = FS_RTP_CONFERENCE (conf); FsParticipant *new_participant = NULL; GList *item = NULL; if (!self->gstrtpbin) { g_set_error (error, FS_ERROR, FS_ERROR_CONSTRUCTION, "Could not create GstRtpBin"); return NULL; } if (!cname) { g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS, "Invalid NULL cname"); return NULL; } GST_OBJECT_LOCK (self); for (item = g_list_first (self->priv->participants); item; item = g_list_next (item)) { gchar *lcname; g_object_get (item->data, "cname", &lcname, NULL); if (!strcmp (lcname, cname)) { g_free (lcname); break; } g_free (lcname); } GST_OBJECT_UNLOCK (self); if (item) { g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS, "There is already a participant with this cname"); return NULL; } new_participant = FS_PARTICIPANT_CAST (fs_rtp_participant_new (cname)); GST_OBJECT_LOCK (self); self->priv->participants = g_list_append (self->priv->participants, new_participant); GST_OBJECT_UNLOCK (self); g_object_weak_ref (G_OBJECT (new_participant), _remove_participant, self); return new_participant; }