[Telepathy-commits] [telepathy-gabble/master] GabbleMediaStream: ask the content what its media type is, rather than relying on Channel to do it
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Feb 26 05:28:58 PST 2009
---
src/media-channel.c | 2 +-
src/media-stream.c | 31 +++++++++++++++++--------------
src/media-stream.h | 3 +--
3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/media-channel.c b/src/media-channel.c
index 9a67f8f..ef26e74 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -2367,7 +2367,7 @@ create_stream_from_content (GabbleMediaChannel *chan, GabbleJingleContent *c)
g_object_get (chan,
"nat-traversal", &nat_traversal,
NULL);
- stream = gabble_media_stream_new (object_path, c, name, id, mtype,
+ stream = gabble_media_stream_new (object_path, c, name, id,
nat_traversal, locally_created);
g_free (nat_traversal);
diff --git a/src/media-stream.c b/src/media-stream.c
index 2d179c7..758c2b2 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -157,7 +157,6 @@ gabble_media_stream_new (const gchar *object_path,
GabbleJingleContent *content,
const gchar *name,
guint id,
- TpMediaStreamType mtype,
const gchar *nat_traversal,
gboolean created_locally)
{
@@ -168,7 +167,6 @@ gabble_media_stream_new (const gchar *object_path,
"content", content,
"name", name,
"id", id,
- "media-type", mtype,
"nat-traversal", nat_traversal,
"created-locally", created_locally,
NULL);
@@ -376,9 +374,6 @@ gabble_media_stream_set_property (GObject *object,
case PROP_ID:
priv->id = g_value_get_uint (value);
break;
- case PROP_MEDIA_TYPE:
- priv->media_type = g_value_get_uint (value);
- break;
case PROP_CONNECTION_STATE:
DEBUG ("stream %s connection state %d",
stream->name, stream->connection_state);
@@ -403,6 +398,19 @@ gabble_media_stream_set_property (GObject *object,
priv->content = g_value_get_object (value);
+ {
+ guint jtype;
+
+ g_object_get (priv->content,
+ "media-type", &jtype,
+ NULL);
+
+ if (jtype == JINGLE_MEDIA_TYPE_VIDEO)
+ priv->media_type = TP_MEDIA_STREAM_TYPE_VIDEO;
+ else
+ priv->media_type = TP_MEDIA_STREAM_TYPE_AUDIO;
+ }
+
DEBUG ("%p: connecting to content %p signals", stream, priv->content);
g_signal_connect (priv->content, "new-candidates",
(GCallback) new_remote_candidates_cb, stream);
@@ -485,15 +493,10 @@ gabble_media_stream_class_init (GabbleMediaStreamClass *gabble_media_stream_clas
g_object_class_install_property (object_class, PROP_ID, param_spec);
param_spec = g_param_spec_uint ("media-type", "Stream media type",
- "A constant indicating which media type the "
- "stream carries.",
- TP_MEDIA_STREAM_TYPE_AUDIO,
- TP_MEDIA_STREAM_TYPE_VIDEO,
- TP_MEDIA_STREAM_TYPE_AUDIO,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_BLURB);
+ "A constant indicating which media type the stream carries.",
+ TP_MEDIA_STREAM_TYPE_AUDIO, TP_MEDIA_STREAM_TYPE_VIDEO,
+ TP_MEDIA_STREAM_TYPE_AUDIO,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_MEDIA_TYPE, param_spec);
param_spec = g_param_spec_uint ("connection-state", "Stream connection state",
diff --git a/src/media-stream.h b/src/media-stream.h
index 85292ce..9469da7 100644
--- a/src/media-stream.h
+++ b/src/media-stream.h
@@ -96,8 +96,7 @@ void gabble_media_stream_accept_pending_local_send (GabbleMediaStream *stream);
GabbleMediaStream *gabble_media_stream_new (const gchar *object_path,
GabbleJingleContent *content, const gchar *name, guint id,
- TpMediaStreamType mtype, const gchar *nat_traversal,
- gboolean created_locally);
+ const gchar *nat_traversal, gboolean created_locally);
G_END_DECLS
--
1.5.6.5
More information about the telepathy-commits
mailing list