diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2009-04-01 19:06:52 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2009-04-02 17:40:01 +0100 |
commit | a3da933ca1be890b7629b792822cd79fdf1743df (patch) | |
tree | 53906ada5df1209b2a05ffb53de127c8b9f4317c /src/media-stream.c | |
parent | 985818c705c808046cc4de026b510871158326c0 (diff) |
Emit SetStreamSending when peer [un]holds
Diffstat (limited to 'src/media-stream.c')
-rw-r--r-- | src/media-stream.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/media-stream.c b/src/media-stream.c index b39758bd3..d0b94c5d6 100644 --- a/src/media-stream.c +++ b/src/media-stream.c @@ -128,6 +128,8 @@ struct _GabbleMediaStreamPrivate /* GPtrArray(GHashTable(string => GValue)) */ GPtrArray *relay_info; + gboolean on_hold; + /* These are really booleans, but gboolean is signed. Thanks, GLib */ unsigned closed:1; unsigned dispose_has_run:1; @@ -150,6 +152,8 @@ static void content_state_changed_cb (GabbleJingleContent *c, GParamSpec *pspec, GabbleMediaStream *stream); static void content_senders_changed_cb (GabbleJingleContent *c, GParamSpec *pspec, GabbleMediaStream *stream); +static void remote_state_changed_cb (GabbleJingleMediaRtp *rtp, + GParamSpec *pspec, GabbleMediaStream *stream); static void content_removed_cb (GabbleJingleContent *content, GabbleMediaStream *stream); static void update_direction (GabbleMediaStream *stream, GabbleJingleContent *c); @@ -457,6 +461,9 @@ gabble_media_stream_set_property (GObject *object, gabble_signal_connect_weak (priv->content, "notify::senders", (GCallback) content_senders_changed_cb, object); + gabble_signal_connect_weak (priv->content, "notify::remote-state", + (GCallback) remote_state_changed_cb, object); + gabble_signal_connect_weak (priv->content, "removed", (GCallback) content_removed_cb, object); break; @@ -1561,6 +1568,7 @@ static void push_sending (GabbleMediaStream *stream) { GabbleMediaStreamPrivate *priv; + gboolean emit; g_assert (GABBLE_IS_MEDIA_STREAM (stream)); @@ -1569,11 +1577,13 @@ push_sending (GabbleMediaStream *stream) if (!priv->ready) return; - DEBUG ("stream %s emitting SetStreamSending(%s)", - stream->name, priv->sending ? "true" : "false"); + emit = (priv->sending && !(priv->on_hold)); + DEBUG ("stream %s emitting SetStreamSending(%s); sending=%s, on_hold=%s", + stream->name, emit ? "true" : "false", priv->sending ? "true" : "false", + priv->on_hold ? "true" : "false"); tp_svc_media_stream_handler_emit_set_stream_sending ( - stream, priv->sending); + stream, emit); } static void @@ -1639,6 +1649,21 @@ content_senders_changed_cb (GabbleJingleContent *c, } static void +remote_state_changed_cb (GabbleJingleMediaRtp *rtp, + GParamSpec *pspec, + GabbleMediaStream *stream) +{ + GabbleMediaStreamPrivate *priv = stream->priv; + JingleRtpRemoteState state = gabble_jingle_media_rtp_get_remote_state (rtp); + gboolean old_hold = priv->on_hold; + + priv->on_hold = (state == JINGLE_RTP_REMOTE_STATE_HOLD); + + if (old_hold != priv->on_hold) + push_sending (stream); +} + +static void content_removed_cb (GabbleJingleContent *content, GabbleMediaStream *stream) { _gabble_media_stream_close (stream); |