Mercurial > pidgin
comparison libpurple/media.c @ 28247:bc87a89e4401
merge of '9ce1a7ac92f523b7b5b9983746ae57ee1fac1a67'
and 'ebf771e2c74addf4821a643a9c9179f4adc67c3b'
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Tue, 08 Sep 2009 02:23:49 +0000 |
parents | 614a40c68b88 |
children | bb06f05c7159 196e4c5b2043 |
comparison
equal
deleted
inserted
replaced
28238:1f0b2af9e2b8 | 28247:bc87a89e4401 |
---|---|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 * GNU General Public License for more details. | 20 * GNU General Public License for more details. |
21 * | 21 * |
22 * You should have received a copy of the GNU General Public License | 22 * You should have received a copy of the GNU General Public License |
23 * along with this program; if not, write to the Free Software | 23 * along with this program; if not, write to the Free Software |
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
25 */ | 25 */ |
26 | 26 |
27 #include <string.h> | 27 #include <string.h> |
28 | 28 |
29 #include "internal.h" | 29 #include "internal.h" |
2044 | 2044 |
2045 if (gst_structure_has_name(msg->structure, "farsight-error")) { | 2045 if (gst_structure_has_name(msg->structure, "farsight-error")) { |
2046 FsError error_no; | 2046 FsError error_no; |
2047 gst_structure_get_enum(msg->structure, "error-no", | 2047 gst_structure_get_enum(msg->structure, "error-no", |
2048 FS_TYPE_ERROR, (gint*)&error_no); | 2048 FS_TYPE_ERROR, (gint*)&error_no); |
2049 /* | 2049 switch (error_no) { |
2050 * Unknown CName is only a problem for the | 2050 case FS_ERROR_NO_CODECS: |
2051 * multicast transmitter which isn't used. | 2051 purple_media_error(media, _("No codecs found. Install some GStreamer codecs found in GStreamer plugins packages.")); |
2052 */ | 2052 purple_media_end(media, NULL, NULL); |
2053 if (error_no != FS_ERROR_UNKNOWN_CNAME) | 2053 break; |
2054 purple_debug_error("media", "farsight-error: %i: %s\n", error_no, | 2054 case FS_ERROR_NO_CODECS_LEFT: |
2055 gst_structure_get_string(msg->structure, "error-msg")); | 2055 purple_media_error(media, _("No codecs left. Your codec preferences in fs-codecs.conf are too strict.")); |
2056 purple_media_end(media, NULL, NULL); | |
2057 break; | |
2058 case FS_ERROR_UNKNOWN_CNAME: | |
2059 /* | |
2060 * Unknown CName is only a problem for the | |
2061 * multicast transmitter which isn't used. | |
2062 * It is also deprecated. | |
2063 */ | |
2064 break; | |
2065 default: | |
2066 purple_debug_error("media", "farsight-error: %i: %s\n", error_no, | |
2067 gst_structure_get_string(msg->structure, "error-msg")); | |
2068 break; | |
2069 } | |
2070 | |
2071 if (FS_ERROR_IS_FATAL(error_no)) { | |
2072 purple_media_error(media, _("A non-recoverable Farsight2 error has occurred.")); | |
2073 purple_media_end(media, NULL, NULL); | |
2074 } | |
2056 } else if (gst_structure_has_name(msg->structure, | 2075 } else if (gst_structure_has_name(msg->structure, |
2057 "farsight-new-local-candidate")) { | 2076 "farsight-new-local-candidate")) { |
2058 FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream")); | 2077 FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream")); |
2059 FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "candidate")); | 2078 FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "candidate")); |
2060 PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream); | 2079 PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream); |
2127 } | 2146 } |
2128 } | 2147 } |
2129 } | 2148 } |
2130 break; | 2149 break; |
2131 } | 2150 } |
2151 case GST_MESSAGE_ERROR: { | |
2152 GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg)); | |
2153 GstElement *lastElement = NULL; | |
2154 while (!GST_IS_PIPELINE(element)) { | |
2155 if (element == media->priv->confbin) { | |
2156 purple_media_error(media, _("Conference error.")); | |
2157 purple_media_end(media, NULL, NULL); | |
2158 break; | |
2159 } | |
2160 lastElement = element; | |
2161 element = GST_ELEMENT_PARENT(element); | |
2162 } | |
2163 if (GST_IS_PIPELINE(element)) { | |
2164 GList *sessions = g_hash_table_get_values(media->priv->sessions); | |
2165 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { | |
2166 PurpleMediaSession *session = sessions->data; | |
2167 | |
2168 if (session->src == lastElement) { | |
2169 if (session->type & PURPLE_MEDIA_AUDIO) | |
2170 purple_media_error(media, _("Error with your microphone.")); | |
2171 else | |
2172 purple_media_error(media, _("Error with your webcam.")); | |
2173 purple_media_end(media, NULL, NULL); | |
2174 break; | |
2175 } | |
2176 } | |
2177 g_list_free(sessions); | |
2178 } | |
2179 } | |
2132 default: | 2180 default: |
2133 break; | 2181 break; |
2134 } | 2182 } |
2135 | 2183 |
2136 return TRUE; | 2184 return TRUE; |
2228 PurpleMediaStream *stream = streams->data; | 2276 PurpleMediaStream *stream = streams->data; |
2229 g_object_set(G_OBJECT(stream->stream), "direction", | 2277 g_object_set(G_OBJECT(stream->stream), "direction", |
2230 purple_media_to_fs_stream_direction( | 2278 purple_media_to_fs_stream_direction( |
2231 stream->session->type), NULL); | 2279 stream->session->type), NULL); |
2232 stream->accepted = TRUE; | 2280 stream->accepted = TRUE; |
2281 | |
2282 if (stream->remote_candidates != NULL) { | |
2283 GError *err = NULL; | |
2284 fs_stream_set_remote_candidates(stream->stream, | |
2285 stream->remote_candidates, &err); | |
2286 | |
2287 if (err) { | |
2288 purple_debug_error("media", "Error adding remote" | |
2289 " candidates: %s\n", err->message); | |
2290 g_error_free(err); | |
2291 } | |
2292 } | |
2233 } | 2293 } |
2234 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE || | 2294 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE || |
2235 type == PURPLE_MEDIA_INFO_UNMUTE)) { | 2295 type == PURPLE_MEDIA_INFO_UNMUTE)) { |
2236 GList *sessions; | 2296 GList *sessions; |
2237 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE); | 2297 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE); |
2539 | 2599 |
2540 session->session = fs_conference_new_session( | 2600 session->session = fs_conference_new_session( |
2541 media->priv->conference, media_type, &err); | 2601 media->priv->conference, media_type, &err); |
2542 | 2602 |
2543 if (err != NULL) { | 2603 if (err != NULL) { |
2544 purple_media_error(media, "Error creating session: %s\n", err->message); | 2604 purple_media_error(media, _("Error creating session: %s"), err->message); |
2545 g_error_free(err); | 2605 g_error_free(err); |
2546 g_free(session); | 2606 g_free(session); |
2547 return FALSE; | 2607 return FALSE; |
2548 } | 2608 } |
2549 | 2609 |
2728 participant, type_direction & | 2788 participant, type_direction & |
2729 FS_DIRECTION_RECV, transmitter, | 2789 FS_DIRECTION_RECV, transmitter, |
2730 num_params, params, &err); | 2790 num_params, params, &err); |
2731 } | 2791 } |
2732 | 2792 |
2733 if (err) { | 2793 if (fsstream == NULL) { |
2734 purple_debug_error("media", "Error creating stream: %s\n", | 2794 purple_debug_error("media", |
2735 err->message); | 2795 "Error creating stream: %s\n", |
2736 g_error_free(err); | 2796 err && err->message ? |
2797 err->message : "NULL"); | |
2798 if (err) | |
2799 g_error_free(err); | |
2737 g_object_unref(participant); | 2800 g_object_unref(participant); |
2738 g_hash_table_remove(media->priv->participants, who); | 2801 g_hash_table_remove(media->priv->participants, who); |
2739 purple_media_remove_session(media, session); | 2802 purple_media_remove_session(media, session); |
2740 g_free(session); | 2803 g_free(session); |
2741 return FALSE; | 2804 return FALSE; |
2850 } | 2913 } |
2851 | 2914 |
2852 stream->remote_candidates = g_list_concat(stream->remote_candidates, | 2915 stream->remote_candidates = g_list_concat(stream->remote_candidates, |
2853 purple_media_candidate_list_to_fs(remote_candidates)); | 2916 purple_media_candidate_list_to_fs(remote_candidates)); |
2854 | 2917 |
2855 fs_stream_set_remote_candidates(stream->stream, | 2918 if (stream->accepted == TRUE) { |
2856 stream->remote_candidates, &err); | 2919 fs_stream_set_remote_candidates(stream->stream, |
2857 | 2920 stream->remote_candidates, &err); |
2858 if (err) { | 2921 |
2859 purple_debug_error("media", "Error adding remote" | 2922 if (err) { |
2860 " candidates: %s\n", err->message); | 2923 purple_debug_error("media", "Error adding remote" |
2861 g_error_free(err); | 2924 " candidates: %s\n", err->message); |
2925 g_error_free(err); | |
2926 } | |
2862 } | 2927 } |
2863 #endif | 2928 #endif |
2864 } | 2929 } |
2865 | 2930 |
2866 #if 0 | 2931 #if 0 |