[farsight2/master] Act on gathering-done signal
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:26:13 PST 2008
---
transmitters/nice/fs-nice-stream-transmitter.c | 30 ++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/transmitters/nice/fs-nice-stream-transmitter.c b/transmitters/nice/fs-nice-stream-transmitter.c
index fd73ff4..9f50ac2 100644
--- a/transmitters/nice/fs-nice-stream-transmitter.c
+++ b/transmitters/nice/fs-nice-stream-transmitter.c
@@ -87,6 +87,10 @@ struct _FsNiceStreamTransmitterPrivate
gboolean controlling_mode;
GMutex *mutex;
+
+ /* Everything below is protected by the mutex */
+
+ gboolean gathered;
};
#define FS_NICE_STREAM_TRANSMITTER_GET_PRIVATE(o) \
@@ -598,6 +602,32 @@ fs_nice_stream_transmitter_new_candidate (FsNiceStreamTransmitter *self,
void
fs_nice_stream_transmitter_gathering_done (FsNiceStreamTransmitter *self)
{
+ GSList *candidates, *item;
+
+ FS_NICE_STREAM_TRANSMITTER_LOCK (self);
+ if (self->priv->gathered)
+ {
+ FS_NICE_STREAM_TRANSMITTER_UNLOCK (self);
+ return;
+ }
+ self->priv->gathered = TRUE;
+ FS_NICE_STREAM_TRANSMITTER_UNLOCK (self);
+
+ candidates = nice_agent_get_local_candidates (
+ self->priv->transmitter->agent,
+ self->priv->stream_id, component_id);
+
+ for (item = candidates; item; item = g_slist_next (item))
+ {
+ NiceCandidate *candidate = item->data;
+ FsCandidate *fscandidate;
+
+ fscandidate = nice_candidate_to_fs_candidate (candidate);
+ g_signal_emit_by_name (self, "new-local-candidate", fscandidate);
+ fs_candidate_destroy (fscandidate);
+ }
+
+ g_signal_emit_by_name (self, "local-candidates-prepared");
}
--
1.5.6.5
More information about the farsight-commits
mailing list