[Bug 20772] Clarify StreamedMedia interface
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Fri Mar 20 19:25:49 CET 2009
http://bugs.freedesktop.org/show_bug.cgi?id=20772
--- Comment #2 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2009-03-20 11:25:48 PST ---
Implementation note: because I specified SDC to be emitted *immediately* before
SA, you only have to remember the direction that was in the last SDC signal.
Something like this:
static void
my_channel_ui_init (...)
{
...
/* there is no invalid stream ID, so we can't easily distinguish between
* initial values for these, and having been given those values in the SDC
* signal - but when a stream is created, it has these values unless we're
* told otherwise, so that's no problem */
self->priv->next_stream_id = 0;
self->priv->next_stream_direction = TP_MEDIA_STREAM_DIRECTION_RECEIVE;
self->priv->next_stream_pending_send = TP_MEDIA_STREAM_PENDING_LOCAL_SEND;
}
static void
stream_direction_changed_cb (TpChannel *channel,
guint id,
guint direction,
guint pending_send,
...)
{
stream = g_hash_table_lookup (self->priv->streams, GUINT_TO_POINTER (id));
if (stream == NULL)
{
/* not created yet - we should get StreamAdded next */
self->priv->next_stream_id = id;
self->priv->next_stream_direction = direction;
self->priv->next_stream_pending_send = pending_send;
return;
}
/* else continue as before */
...
}
static void
stream_added_cb (TpChannel *channel,
guint id,
guint media_type,
...)
{
TpMediaStreamDirection direction = TP_MEDIA_STREAM_DIRECTION_RECEIVE;
TpMediaStreamPendingSend pending_send = TP_MEDIA_STREAM_PENDING_LOCAL_SEND;
if (id == self->priv->next_stream_id)
{
/* we've just been told the direction for this one */
direction = self->priv->next_stream_direction;
pending_send = self->priv->next_stream_pending_send;
}
add_stream (..., direction, pending_send,
TP_MEDIA_STREAM_STATE_DISCONNECTED, ...);
...
}
--
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list