summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-02-20 10:51:16 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-02-20 10:51:16 +0100
commitb40042c598476bc14f578b1d121c14eb9da59c3e (patch)
tree94fb05b3fa40a82fc0f05748c02b6977ce5dde4c
parent2aff6d0ac4102835c5e125850eef6062011d910d (diff)
parent7a0e8d7f6edf24c96857a72af39940b555a1cf8c (diff)
Merge remote-tracking branch 'tester/call1-addcontent-direction' into call1call1
Conflicts: tests/twisted/jingle/call-dtmf.py
-rw-r--r--src/call-channel.c31
-rw-r--r--src/call-member-content.c3
-rw-r--r--src/call-member.c7
-rw-r--r--src/call-member.h1
-rw-r--r--src/call-muc-channel.c17
-rw-r--r--src/gtalk-file-collection.c4
-rw-r--r--src/jingle-session.c17
-rw-r--r--src/jingle-session.h1
-rw-r--r--src/media-channel.c2
-rw-r--r--tests/twisted/constants.py9
-rw-r--r--tests/twisted/jingle/call-basics.py3
-rw-r--r--tests/twisted/jingle/call-content-adding-removal.py6
-rw-r--r--tests/twisted/jingle/call-hold-av.py1
13 files changed, 80 insertions, 22 deletions
diff --git a/src/call-channel.c b/src/call-channel.c
index 566aa8473..20847f528 100644
--- a/src/call-channel.c
+++ b/src/call-channel.c
@@ -63,6 +63,7 @@ static TpBaseCallContent * call_channel_add_content (
TpBaseCallChannel *base,
const gchar *name,
TpMediaStreamType type,
+ TpMediaStreamDirection initial_direction,
GError **error);
static void call_channel_hold_state_changed (TpBaseMediaCallChannel *self,
TpLocalHoldState hold_state, TpLocalHoldStateReason hold_state_reason);
@@ -653,14 +654,42 @@ static TpBaseCallContent *
call_channel_add_content (TpBaseCallChannel *base,
const gchar *name,
TpMediaStreamType type,
+ TpMediaStreamDirection initial_direction,
GError **error)
{
GabbleCallChannel *self = GABBLE_CALL_CHANNEL (base);
GabbleCallContent *content = NULL;
GabbleCallMemberContent *mcontent;
+ JingleContentSenders senders;
+ gboolean initiated_by_us;
+
+ if (initial_direction == TP_MEDIA_STREAM_DIRECTION_NONE)
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "Jingle can not do contents with direction = NONE");
+ return NULL;
+ }
+
+ g_object_get (self->priv->session, "local-initiator", &initiated_by_us,
+ NULL);
+
+ switch (initial_direction)
+ {
+ case TP_MEDIA_STREAM_DIRECTION_SEND:
+ senders = initiated_by_us ?
+ JINGLE_CONTENT_SENDERS_INITIATOR : JINGLE_CONTENT_SENDERS_RESPONDER;
+ break;
+ case TP_MEDIA_STREAM_DIRECTION_RECEIVE:
+ senders = initiated_by_us ?
+ JINGLE_CONTENT_SENDERS_RESPONDER : JINGLE_CONTENT_SENDERS_INITIATOR;
+ break;
+ default:
+ case TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL:
+ senders = JINGLE_CONTENT_SENDERS_BOTH;
+ }
mcontent = gabble_call_member_create_content (self->priv->member, name,
- jingle_media_type_from_tp (type), error);
+ jingle_media_type_from_tp (type), senders, error);
if (mcontent != NULL)
{
diff --git a/src/call-member-content.c b/src/call-member-content.c
index ae8552c85..7d9f099aa 100644
--- a/src/call-member-content.c
+++ b/src/call-member-content.c
@@ -180,7 +180,8 @@ gabble_call_member_content_add_to_session (GabbleCallMemberContent *self)
content_ns, transport_ns);
content = gabble_jingle_session_add_content (session,
- priv->media_type, priv->name, content_ns, transport_ns);
+ priv->media_type, JINGLE_CONTENT_SENDERS_BOTH,
+ priv->name, content_ns, transport_ns);
gabble_call_member_content_set_jingle_content (self, content);
}
diff --git a/src/call-member.c b/src/call-member.c
index 2765449a3..148bfb752 100644
--- a/src/call-member.c
+++ b/src/call-member.c
@@ -439,6 +439,7 @@ GabbleCallMemberContent *
gabble_call_member_create_content (GabbleCallMember *self,
const gchar *name,
JingleMediaType mtype,
+ JingleContentSenders senders,
GError **error)
{
GabbleCallMemberPrivate *priv = self->priv;
@@ -473,7 +474,7 @@ gabble_call_member_create_content (GabbleCallMember *self,
content_ns, priv->transport_ns);
c = gabble_jingle_session_add_content (priv->session,
- mtype, name, content_ns, priv->transport_ns);
+ mtype, senders, name, content_ns, priv->transport_ns);
g_assert (c != NULL);
@@ -563,11 +564,11 @@ gabble_call_member_start_session (GabbleCallMember *self,
if (audio_name != NULL)
gabble_call_member_create_content (self, audio_name,
- JINGLE_MEDIA_TYPE_AUDIO, NULL);
+ JINGLE_MEDIA_TYPE_AUDIO, JINGLE_CONTENT_SENDERS_BOTH, NULL);
if (video_name != NULL)
gabble_call_member_create_content (self, video_name,
- JINGLE_MEDIA_TYPE_VIDEO, NULL);
+ JINGLE_MEDIA_TYPE_VIDEO, JINGLE_CONTENT_SENDERS_BOTH, NULL);
return TRUE;
}
diff --git a/src/call-member.h b/src/call-member.h
index 8a0e2bbdf..5554a9ec0 100644
--- a/src/call-member.h
+++ b/src/call-member.h
@@ -85,6 +85,7 @@ GabbleCallMemberContent * gabble_call_member_create_content (
GabbleCallMember *self,
const gchar *name,
JingleMediaType mtype,
+ JingleContentSenders senders,
GError **error);
gboolean gabble_call_member_start_session (GabbleCallMember *self,
diff --git a/src/call-muc-channel.c b/src/call-muc-channel.c
index 5b516d721..bc4db2c73 100644
--- a/src/call-muc-channel.c
+++ b/src/call-muc-channel.c
@@ -45,6 +45,7 @@ static TpBaseCallContent * call_muc_channel_add_content (
TpBaseCallChannel *base,
const gchar *name,
TpMediaStreamType type,
+ TpMediaStreamDirection initial_direction,
GError **error);
static void call_muc_channel_hangup (
TpBaseCallChannel *base,
@@ -1148,11 +1149,27 @@ static TpBaseCallContent *
call_muc_channel_add_content (TpBaseCallChannel *base,
const gchar *name,
TpMediaStreamType type,
+ TpMediaStreamDirection initial_direction,
GError **error)
{
GabbleCallMucChannel *self = GABBLE_CALL_MUC_CHANNEL (base);
GabbleCallContent *content;
+ if (initial_direction == TP_MEDIA_STREAM_DIRECTION_NONE)
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "Jingle can not do contents with direction = NONE");
+ return NULL;
+ }
+
+ if (initial_direction != TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL)
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
+ "Adding un-directional contents is not supported"
+ " in MUC channels");
+ return NULL;
+ }
+
content = gabble_base_call_channel_add_content (
GABBLE_BASE_CALL_CHANNEL (base),
name, jingle_media_type_from_tp (type),
diff --git a/src/gtalk-file-collection.c b/src/gtalk-file-collection.c
index ffc40d580..9318692a2 100644
--- a/src/gtalk-file-collection.c
+++ b/src/gtalk-file-collection.c
@@ -1462,8 +1462,8 @@ gtalk_file_collection_new (GabbleFileTransferChannel *channel,
NULL);
content = gabble_jingle_session_add_content (session,
- JINGLE_MEDIA_TYPE_NONE, "share", NS_GOOGLE_SESSION_SHARE,
- NS_GOOGLE_TRANSPORT_P2P);
+ JINGLE_MEDIA_TYPE_NONE, JINGLE_CONTENT_SENDERS_BOTH, "share",
+ NS_GOOGLE_SESSION_SHARE, NS_GOOGLE_TRANSPORT_P2P);
if (content == NULL)
{
diff --git a/src/jingle-session.c b/src/jingle-session.c
index 48abde2eb..c2f98137e 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -801,7 +801,8 @@ fire_idle_content_reject (GabbleJingleSession *sess, const gchar *name,
static GabbleJingleContent *
create_content (GabbleJingleSession *sess, GType content_type,
- JingleMediaType type, const gchar *content_ns, const gchar *transport_ns,
+ JingleMediaType type, JingleContentSenders senders,
+ const gchar *content_ns, const gchar *transport_ns,
const gchar *name, WockyNode *content_node, GError **error)
{
GabbleJingleSessionPrivate *priv = sess->priv;
@@ -821,7 +822,7 @@ create_content (GabbleJingleSession *sess, GType content_type,
"media-type", type,
"name", name,
"disposition", "session",
- "senders", JINGLE_CONTENT_SENDERS_BOTH,
+ "senders", senders,
NULL);
g_signal_connect (c, "ready",
@@ -909,7 +910,8 @@ _each_content_add (GabbleJingleSession *sess, GabbleJingleContent *c,
}
create_content (sess, content_type, JINGLE_MEDIA_TYPE_NONE,
- content_ns, NULL, NULL, content_node, error);
+ JINGLE_CONTENT_SENDERS_BOTH, content_ns, NULL, NULL, content_node,
+ error);
}
static void
@@ -1019,12 +1021,14 @@ on_session_initiate (GabbleJingleSession *sess, WockyNode *node,
content_type = gabble_jingle_factory_lookup_content_type (
priv->conn->jingle_factory, content_ns);
create_content (sess, content_type, JINGLE_MEDIA_TYPE_VIDEO,
- NS_GOOGLE_SESSION_VIDEO, NULL, "video", node, error);
+ JINGLE_CONTENT_SENDERS_BOTH, NS_GOOGLE_SESSION_VIDEO, NULL,
+ "video", node, error);
content_type = gabble_jingle_factory_lookup_content_type (
priv->conn->jingle_factory, NS_GOOGLE_SESSION_PHONE);
create_content (sess, content_type, JINGLE_MEDIA_TYPE_AUDIO,
- NS_GOOGLE_SESSION_PHONE, NULL, "audio", node, error);
+ JINGLE_CONTENT_SENDERS_BOTH, NS_GOOGLE_SESSION_PHONE, NULL,
+ "audio", node, error);
}
else
{
@@ -2189,6 +2193,7 @@ gabble_jingle_session_remove_content (GabbleJingleSession *sess,
GabbleJingleContent *
gabble_jingle_session_add_content (GabbleJingleSession *sess,
JingleMediaType mtype,
+ JingleContentSenders senders,
const gchar *name,
const gchar *content_ns,
const gchar *transport_ns)
@@ -2218,7 +2223,7 @@ gabble_jingle_session_add_content (GabbleJingleSession *sess,
g_assert (content_type != 0);
- c = create_content (sess, content_type, mtype,
+ c = create_content (sess, content_type, mtype, senders,
content_ns, transport_ns, cname, NULL, NULL);
/* The new content better have ended up in the set we thought it would... */
diff --git a/src/jingle-session.h b/src/jingle-session.h
index 44ba3b34d..c0a70801d 100644
--- a/src/jingle-session.h
+++ b/src/jingle-session.h
@@ -93,6 +93,7 @@ void gabble_jingle_session_remove_content (GabbleJingleSession *sess,
GabbleJingleContent *
gabble_jingle_session_add_content (GabbleJingleSession *sess,
JingleMediaType mtype,
+ JingleContentSenders senders,
const char *name,
const gchar *content_ns,
const gchar *transport_ns);
diff --git a/src/media-channel.c b/src/media-channel.c
index d57ed4012..3e2b77f74 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -1760,7 +1760,7 @@ _gabble_media_channel_request_contents (GabbleMediaChannel *chan,
c = gabble_jingle_session_add_content (priv->session,
media_type == TP_MEDIA_STREAM_TYPE_AUDIO ?
JINGLE_MEDIA_TYPE_AUDIO : JINGLE_MEDIA_TYPE_VIDEO,
- NULL, content_ns, transport_ns);
+ JINGLE_CONTENT_SENDERS_BOTH, NULL, content_ns, transport_ns);
/* The stream is created in "new-content" callback, and appended to
* priv->streams. This is now guaranteed to happen asynchronously (adding
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index aa4fa78d9..e6db3a6f5 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -113,11 +113,10 @@ CALL_STATE_ACTIVE = 5
CALL_STATE_ENDED = 6
CALL_FLAG_LOCALLY_HELD = 1
-CALL_FLAG_LOCALLY_MUTED = 2
-CALL_FLAG_LOCALLY_RINGING = 4
-CALL_FLAG_LOCALLY_QUEUED = 8
-CALL_FLAG_FORWARDED = 16
-CALL_FLAG_CLEARING = 32
+CALL_FLAG_LOCALLY_RINGING = 2
+CALL_FLAG_LOCALLY_QUEUED = 4
+CALL_FLAG_FORWARDED = 8
+CALL_FLAG_CLEARING = 16
CALL_MEMBER_FLAG_RINGING = 1
CALL_MEMBER_FLAG_HELD = 2
diff --git a/tests/twisted/jingle/call-basics.py b/tests/twisted/jingle/call-basics.py
index 58020a53a..cdfecafd1 100644
--- a/tests/twisted/jingle/call-basics.py
+++ b/tests/twisted/jingle/call-basics.py
@@ -69,7 +69,8 @@ class CallBasicsTest(CallTest):
def test_content_addition(self):
path = self.chan.AddContent("Webcam", cs.CALL_MEDIA_TYPE_VIDEO,
- dbus_interface=cs.CHANNEL_TYPE_CALL)
+ cs.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL,
+ dbus_interface=cs.CHANNEL_TYPE_CALL)
content = self.bus.get_object(self.conn.bus_name, path)
content_properties = content.GetAll(cs.CALL_CONTENT,
dbus_interface=dbus.PROPERTIES_IFACE)
diff --git a/tests/twisted/jingle/call-content-adding-removal.py b/tests/twisted/jingle/call-content-adding-removal.py
index c5d9579bf..d36bdbaa5 100644
--- a/tests/twisted/jingle/call-content-adding-removal.py
+++ b/tests/twisted/jingle/call-content-adding-removal.py
@@ -48,8 +48,10 @@ class CallContentAddingRemovalTest(CallTest):
self.stream.send(make_result_iq(self.stream, e.stanza))
# Actually, we *do* want video!
- content_path = self.chan.AddContent("video1", cs.CALL_MEDIA_TYPE_VIDEO,
- dbus_interface=cs.CHANNEL_TYPE_CALL);
+ content_path = self.chan.AddContent(
+ "video1", cs.CALL_MEDIA_TYPE_VIDEO,
+ cs.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL,
+ dbus_interface=cs.CHANNEL_TYPE_CALL);
self.q.expect('dbus-signal', signal='ContentAdded')
self.store_content(content_path, initial=False)
diff --git a/tests/twisted/jingle/call-hold-av.py b/tests/twisted/jingle/call-hold-av.py
index 4cd079e16..ae27ee997 100644
--- a/tests/twisted/jingle/call-hold-av.py
+++ b/tests/twisted/jingle/call-hold-av.py
@@ -38,6 +38,7 @@ class CallHoldAVTest(CallTest):
content_path = chan.AddContent('added_audio',
cs.MEDIA_STREAM_TYPE_AUDIO,
+ cs.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL,
dbus_interface=cs.CHANNEL_TYPE_CALL)
q.expect ('dbus-signal', signal='ContentAdded')