Mercurial > pidgin
changeset 27884:f5580e1ca4b1
Fix unidirectional media sessions and add a colorspace before the video sink.
author | maiku@pidgin.im |
---|---|
date | Thu, 13 Aug 2009 04:55:29 +0000 |
parents | 359800ae7d17 |
children | f77978e6968e |
files | libpurple/media.c libpurple/mediamanager.c libpurple/protocols/jabber/jingle/rtp.c |
diffstat | 3 files changed, 52 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/media.c Wed Aug 12 10:04:54 2009 +0000 +++ b/libpurple/media.c Thu Aug 13 04:55:29 2009 +0000 @@ -2617,26 +2617,27 @@ 0, PURPLE_MEDIA_STATE_NEW, session->id, NULL); - session_type = purple_media_from_fs(media_type, - FS_DIRECTION_SEND); - src = purple_media_manager_get_element( - media->priv->manager, session_type, - media, session->id, who); - if (!GST_IS_ELEMENT(src)) { - purple_debug_error("media", - "Error creating src for session %s\n", - session->id); - purple_media_end(media, session->id, NULL); - return FALSE; + if (type_direction & FS_DIRECTION_SEND) { + session_type = purple_media_from_fs(media_type, + FS_DIRECTION_SEND); + src = purple_media_manager_get_element( + media->priv->manager, session_type, + media, session->id, who); + if (!GST_IS_ELEMENT(src)) { + purple_debug_error("media", + "Error creating src for session %s\n", + session->id); + purple_media_end(media, session->id, NULL); + return FALSE; + } + + purple_media_set_src(media, session->id, src); + gst_element_set_state(session->src, GST_STATE_PLAYING); + purple_media_manager_create_output_window( + media->priv->manager, + session->media, + session->id, NULL); } - - purple_media_set_src(media, session->id, src); - gst_element_set_state(session->src, GST_STATE_PLAYING); - - purple_media_manager_create_output_window( - media->priv->manager, - session->media, - session->id, NULL); } if (!(participant = purple_media_add_participant(media, who))) { @@ -3002,14 +3003,23 @@ if (session == NULL) return FALSE; - - g_object_get(session->session, "codecs-ready", &ret, NULL); + if (session->type & (PURPLE_MEDIA_SEND_AUDIO | + PURPLE_MEDIA_SEND_VIDEO)) + g_object_get(session->session, + "codecs-ready", &ret, NULL); + else + ret = TRUE; } else { GList *values = g_hash_table_get_values(media->priv->sessions); for (; values; values = g_list_delete_link(values, values)) { PurpleMediaSession *session = values->data; - g_object_get(session->session, - "codecs-ready", &ret, NULL); + if (session->type & (PURPLE_MEDIA_SEND_AUDIO | + PURPLE_MEDIA_SEND_VIDEO)) + g_object_get(session->session, + "codecs-ready", &ret, NULL); + else + ret = TRUE; + if (ret == FALSE) break; }
--- a/libpurple/mediamanager.c Wed Aug 12 10:04:54 2009 +0000 +++ b/libpurple/mediamanager.c Thu Aug 13 04:55:29 2009 +0000 @@ -714,7 +714,7 @@ (participant == ow->participant)) && !strcmp(session_id, ow->session_id)) { GstBus *bus; - GstElement *queue; + GstElement *queue, *colorspace; GstElement *tee = purple_media_get_tee(media, session_id, participant); @@ -723,6 +723,8 @@ queue = gst_element_factory_make( "queue", NULL); + colorspace = gst_element_factory_make( + "ffmpegcolorspace", NULL); ow->sink = purple_media_manager_get_element( manager, PURPLE_MEDIA_RECV_VIDEO, ow->media, ow->session_id, @@ -743,7 +745,7 @@ } gst_bin_add_many(GST_BIN(GST_ELEMENT_PARENT(tee)), - queue, ow->sink, NULL); + queue, colorspace, ow->sink, NULL); bus = gst_pipeline_get_bus(GST_PIPELINE( manager->priv->pipeline)); @@ -752,8 +754,10 @@ gst_object_unref(bus); gst_element_set_state(ow->sink, GST_STATE_PLAYING); + gst_element_set_state(colorspace, GST_STATE_PLAYING); gst_element_set_state(queue, GST_STATE_PLAYING); - gst_element_link(queue, ow->sink); + gst_element_link(colorspace, ow->sink); + gst_element_link(queue, colorspace); gst_element_link(tee, queue); } } @@ -822,8 +826,14 @@ GstPad *pad = gst_element_get_static_pad( output_window->sink, "sink"); GstPad *peer = gst_pad_get_peer(pad); - GstElement *queue = GST_ELEMENT_PARENT(peer); + GstElement *colorspace = GST_ELEMENT_PARENT(peer), *queue; gst_object_unref(pad); + gst_object_unref(peer); + pad = gst_element_get_static_pad(colorspace, "sink"); + peer = gst_pad_get_peer(pad); + queue = GST_ELEMENT_PARENT(peer); + gst_object_unref(pad); + gst_object_unref(peer); pad = gst_element_get_static_pad(queue, "sink"); peer = gst_pad_get_peer(pad); gst_object_unref(pad); @@ -832,6 +842,9 @@ gst_element_set_locked_state(queue, TRUE); gst_element_set_state(queue, GST_STATE_NULL); gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(queue)), queue); + gst_element_set_locked_state(colorspace, TRUE); + gst_element_set_state(colorspace, GST_STATE_NULL); + gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(colorspace)), colorspace); gst_element_set_locked_state(output_window->sink, TRUE); gst_element_set_state(output_window->sink, GST_STATE_NULL); gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(output_window->sink)),
--- a/libpurple/protocols/jabber/jingle/rtp.c Wed Aug 12 10:04:54 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rtp.c Thu Aug 13 04:55:29 2009 +0000 @@ -589,8 +589,8 @@ if (!strcmp(senders, "both")) type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO : PURPLE_MEDIA_VIDEO; - else if (!strcmp(senders, "initiator") - && jingle_session_is_initiator(session)) + else if ((strcmp(senders, "initiator") == 0) == + jingle_session_is_initiator(session)) type = is_audio == TRUE ? PURPLE_MEDIA_SEND_AUDIO : PURPLE_MEDIA_SEND_VIDEO; else