From 2e07cafedaa0144bf4fa271592db5de486bfe482 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Thu, 13 May 2010 23:16:32 +0200 Subject: [PATCH] audio: uploaded patches for third party libs Added libnice and libpurple patch files here to have them all at one place. Added readme containing short description and report of their status in upstream. --- contrib/media-patches/README.txt | 27 +++ .../libnice-Compatibility-with-OC2007-R2.patch | 195 +++++++++++++++++++++ contrib/media-patches/oc-disable-encryption.reg | Bin 0 -> 282 bytes .../purple_media_get_active_candidates.patch | 48 +++++ .../purple_mime_document_parsen.patch | 61 +++++++ 5 files changed, 331 insertions(+) create mode 100644 contrib/media-patches/README.txt create mode 100644 contrib/media-patches/libnice-Compatibility-with-OC2007-R2.patch create mode 100644 contrib/media-patches/oc-disable-encryption.reg create mode 100644 contrib/media-patches/purple_media_get_active_candidates.patch create mode 100644 contrib/media-patches/purple_mime_document_parsen.patch diff --git a/contrib/media-patches/README.txt b/contrib/media-patches/README.txt new file mode 100644 index 00000000..a088ad79 --- /dev/null +++ b/contrib/media-patches/README.txt @@ -0,0 +1,27 @@ +To enable experimental voice support in SIPE (on non-Windows platforms only): + +- apply patches in this directory to libnice and libpurple +- rebuild libgstfarsight with changed libnice headers +- compile SIPE source, check that voice support is enabled in configure output +- when making a call with Office Communicator 2007 R2 peer, change to peer's + registry is needed to allow unencrypted media transfer, use the attached .reg file +- now you can try to make a voice call + +STATUS OF PATCHES IN UPSTREAM +============================= + +purple_mime_document_parsen.patch + - reported to libpurple developers as ticket http://developer.pidgin.im/ticket/11598 + +purple_media_get_active_candidates.patch + - reported to libpurple developers as ticket http://developer.pidgin.im/ticket/11830 + - should be included in version 2.8.0 + +libnice-Compatibility-with-OC2007-R2.patch + - some customizations stil needed, will check this and send to upstream asap + + +Biggest show stopper now is a lack of SRTP (encrypted transfer) in Farsight library, +requiring Office Communicator users to change their registry settings as a +workaround is unacceptable. According to FS website, someone is working on +this, but no results are available so far. diff --git a/contrib/media-patches/libnice-Compatibility-with-OC2007-R2.patch b/contrib/media-patches/libnice-Compatibility-with-OC2007-R2.patch new file mode 100644 index 00000000..c7deb55d --- /dev/null +++ b/contrib/media-patches/libnice-Compatibility-with-OC2007-R2.patch @@ -0,0 +1,195 @@ +From b4f47a693e6359741965a78f40b1044458370038 Mon Sep 17 00:00:00 2001 +From: Jakub Adam +Date: Sun, 28 Mar 2010 14:53:43 +0200 +Subject: [PATCH] Compatibility with OC2007 R2 + +--- + agent/agent.c | 5 ++++- + agent/agent.h | 3 ++- + agent/conncheck.c | 12 ++++++++---- + stun/stunmessage.h | 4 +++- + stun/usages/ice.c | 29 +++++++++++++++++++++++++++-- + stun/usages/ice.h | 5 +++-- + 6 files changed, 47 insertions(+), 11 deletions(-) + +diff --git a/agent/agent.c b/agent/agent.c +index 19d52fa..e6c46a9 100644 +--- a/agent/agent.c ++++ b/agent/agent.c +@@ -149,6 +149,8 @@ agent_to_ice_compatibility (NiceAgent *agent) + STUN_USAGE_ICE_COMPATIBILITY_GOOGLE : + agent->compatibility == NICE_COMPATIBILITY_MSN ? + STUN_USAGE_ICE_COMPATIBILITY_MSN : ++ agent->compatibility == NICE_COMPATIBILITY_OC2007R2 ? ++ STUN_USAGE_ICE_COMPATIBILITY_OC2007R2 : + STUN_USAGE_ICE_COMPATIBILITY_DRAFT19; + } + +@@ -833,7 +835,8 @@ nice_agent_set_property ( + STUN_COMPATIBILITY_RFC3489, + STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS | + STUN_AGENT_USAGE_FORCE_VALIDATER); +- } else if (agent->compatibility == NICE_COMPATIBILITY_WLM2009) { ++ } else if (agent->compatibility == NICE_COMPATIBILITY_WLM2009 || ++ agent->compatibility == NICE_COMPATIBILITY_OC2007R2) { + stun_agent_init (&agent->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES, + STUN_COMPATIBILITY_WLM2009, + STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS | +diff --git a/agent/agent.h b/agent/agent.h +index 922a935..8bc6acb 100644 +--- a/agent/agent.h ++++ b/agent/agent.h +@@ -224,7 +224,8 @@ typedef enum + NICE_COMPATIBILITY_GOOGLE, + NICE_COMPATIBILITY_MSN, + NICE_COMPATIBILITY_WLM2009, +- NICE_COMPATIBILITY_LAST = NICE_COMPATIBILITY_WLM2009 ++ NICE_COMPATIBILITY_OC2007R2, ++ NICE_COMPATIBILITY_LAST = NICE_COMPATIBILITY_OC2007R2 + } NiceCompatibility; + + /** +diff --git a/agent/conncheck.c b/agent/conncheck.c +index 28d4f07..ee72f71 100644 +--- a/agent/conncheck.c ++++ b/agent/conncheck.c +@@ -599,7 +599,8 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) + uname, uname_len, password, password_len, + agent->controlling_mode, agent->controlling_mode, priority, + agent->tie_breaker, +- agent_to_ice_compatibility (agent)); ++ agent_to_ice_compatibility (agent), ++ NULL); + + nice_debug ("Agent %p: conncheck created %d - %p", + agent, buf_len, p->keepalive.stun_message.buffer); +@@ -1460,7 +1461,8 @@ size_t priv_gen_username (NiceAgent *agent, guint component_id, + len++; + memcpy (dest + len, local, local_len); + len += local_len; +- } else if (agent->compatibility == NICE_COMPATIBILITY_WLM2009 && ++ } else if ((agent->compatibility == NICE_COMPATIBILITY_WLM2009 || ++ agent->compatibility == NICE_COMPATIBILITY_OC2007R2) && + dest_len >= remote_len + local_len + 4 ) { + memcpy (dest, remote, remote_len); + len += remote_len; +@@ -1661,7 +1663,8 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) + uname, uname_len, password, password_len, + cand_use, controlling, priority, + agent->tie_breaker, +- agent_to_ice_compatibility (agent)); ++ agent_to_ice_compatibility (agent), ++ pair->foundation); + + nice_debug ("Agent %p: conncheck created %d - %p", agent, buffer_len, pair->stun_message.buffer); + +@@ -1794,7 +1797,8 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, + * aggressive nomination mode, send a new triggered + * check to nominate the pair */ + if ((agent->compatibility == NICE_COMPATIBILITY_DRAFT19 || +- agent->compatibility == NICE_COMPATIBILITY_WLM2009) && ++ agent->compatibility == NICE_COMPATIBILITY_WLM2009 || ++ agent->compatibility == NICE_COMPATIBILITY_OC2007R2) && + agent->controlling_mode) + priv_conn_check_initiate (agent, p); + } +diff --git a/stun/stunmessage.h b/stun/stunmessage.h +index b9291b2..d35196f 100644 +--- a/stun/stunmessage.h ++++ b/stun/stunmessage.h +@@ -288,7 +288,9 @@ typedef enum + STUN_ATTRIBUTE_FINGERPRINT=0x8028, /* RFC5389 */ + STUN_ATTRIBUTE_ICE_CONTROLLED=0x8029, /* ICE-19 */ + STUN_ATTRIBUTE_ICE_CONTROLLING=0x802A, /* ICE-19 */ +- /* 0x802B-0xFFFF */ /* reserved */ ++ /* 0x802B-0x8053 */ /* reserved */ ++ STUN_ATTRIBUTE_CANDIDATE_IDENTIFIER=0x8054 /* MS-ICE2 */ ++ /* 0x8055-0xFFFF */ /* reserved */ + } StunAttribute; + + +diff --git a/stun/usages/ice.c b/stun/usages/ice.c +index 5977296..174184d 100644 +--- a/stun/usages/ice.c ++++ b/stun/usages/ice.c +@@ -42,6 +42,7 @@ + + #include + #include ++#include + + #ifdef _WIN32 + #include +@@ -64,13 +65,15 @@ stun_usage_ice_conncheck_create (StunAgent *agent, StunMessage *msg, + const uint8_t *username, const size_t username_len, + const uint8_t *password, const size_t password_len, + bool cand_use, bool controlling, uint32_t priority, +- uint64_t tie, StunUsageIceCompatibility compatibility) ++ uint64_t tie, StunUsageIceCompatibility compatibility, ++ const char *candidate_identifier) + { + StunMessageReturn val; + + stun_agent_init_request (agent, msg, buffer, buffer_len, STUN_BINDING); + +- if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_DRAFT19) { ++ if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_DRAFT19 || ++ compatibility == STUN_USAGE_ICE_COMPATIBILITY_OC2007R2) { + if (cand_use) + { + val = stun_message_append_flag (msg, STUN_ATTRIBUTE_USE_CANDIDATE); +@@ -97,6 +100,28 @@ stun_usage_ice_conncheck_create (StunAgent *agent, StunMessage *msg, + return 0; + } + ++ if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_OC2007R2) { ++ size_t identifier_len = strlen(candidate_identifier); ++ size_t buffer_len = identifier_len; ++ int modulo4 = identifier_len % 4; ++ uint8_t* buf; ++ ++ if (modulo4) ++ buffer_len += 4 - modulo4; ++ ++ buf = malloc(buffer_len); ++ memset(buf, 0, buffer_len); ++ memcpy(buf, candidate_identifier, identifier_len); ++ ++ val = stun_message_append_bytes (msg, STUN_ATTRIBUTE_CANDIDATE_IDENTIFIER, ++ buf, buffer_len); ++ ++ free(buf); ++ ++ if (val != STUN_MESSAGE_RETURN_SUCCESS) ++ return 0; ++ } ++ + return stun_agent_finish_message (agent, msg, password, password_len); + + } +diff --git a/stun/usages/ice.h b/stun/usages/ice.h +index 9fe8ea2..ad2cbe2 100644 +--- a/stun/usages/ice.h ++++ b/stun/usages/ice.h +@@ -72,6 +72,7 @@ typedef enum { + STUN_USAGE_ICE_COMPATIBILITY_DRAFT19, + STUN_USAGE_ICE_COMPATIBILITY_GOOGLE, + STUN_USAGE_ICE_COMPATIBILITY_MSN, ++ STUN_USAGE_ICE_COMPATIBILITY_OC2007R2, + } StunUsageIceCompatibility; + + +@@ -137,8 +138,8 @@ stun_usage_ice_conncheck_create (StunAgent *agent, StunMessage *msg, + const uint8_t *username, const size_t username_len, + const uint8_t *password, const size_t password_len, + bool cand_use, bool controlling, uint32_t priority, +- uint64_t tie, StunUsageIceCompatibility compatibility); +- ++ uint64_t tie, StunUsageIceCompatibility compatibility, ++ const char *candidate_identifier); + + /** + * stun_usage_ice_conncheck_process: +-- +1.7.0 + diff --git a/contrib/media-patches/oc-disable-encryption.reg b/contrib/media-patches/oc-disable-encryption.reg new file mode 100644 index 0000000000000000000000000000000000000000..9b70468a31f36aa4cddede1bf8ac2e7f1f9261f7 GIT binary patch literal 282 zcwR-1Q44}V5QOJB=s$=*AVTOR=pjT1q6o_(GD6fsC@-{-{(SXyNwMtR&CKrH?(4Zx zp;DQQ8r5JwdcZ0wYPt}xcKtyIcCy; as?=_ArS3bis}cJ&wky-n&i)VYx5pdAd@x@C literal 0 HcwPel00001 diff --git a/contrib/media-patches/purple_media_get_active_candidates.patch b/contrib/media-patches/purple_media_get_active_candidates.patch new file mode 100644 index 00000000..e507c919 --- /dev/null +++ b/contrib/media-patches/purple_media_get_active_candidates.patch @@ -0,0 +1,48 @@ +diff -ru pidgin-2.6.5/libpurple/media.c pidgin-2.6.5-patched/libpurple/media.c +--- pidgin-2.6.5/libpurple/media.c 2010-05-13 21:56:23.151991938 +0200 ++++ pidgin-2.6.5-patched/libpurple/media.c 2010-05-13 22:06:00.455752108 +0200 +@@ -2966,12 +2966,6 @@ + #endif + } + +-#if 0 +-/* +- * These two functions aren't being used and I'd rather not lock in the API +- * until they are needed. If they ever are. +- */ +- + GList * + purple_media_get_active_local_candidates(PurpleMedia *media, + const gchar *sess_id, const gchar *participant) +@@ -3001,7 +2995,6 @@ + return NULL; + #endif + } +-#endif + + gboolean + purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, +diff -ru pidgin-2.6.5/libpurple/media.h pidgin-2.6.5-patched/libpurple/media.h +--- pidgin-2.6.5/libpurple/media.h 2010-05-13 21:56:23.151991938 +0200 ++++ pidgin-2.6.5-patched/libpurple/media.h 2010-05-13 22:03:20.495755295 +0200 +@@ -520,12 +520,6 @@ + const gchar *sess_id, + const gchar *participant); + +-#if 0 +-/* +- * These two functions aren't being used and I'd rather not lock in the API +- * until they are needed. If they ever are. +- */ +- + /** + * Gets the active local candidates for the stream. + * +@@ -551,7 +545,6 @@ + */ + GList *purple_media_get_active_remote_candidates(PurpleMedia *media, + const gchar *sess_id, const gchar *participant); +-#endif + + /** + * Sets remote candidates from the stream. diff --git a/contrib/media-patches/purple_mime_document_parsen.patch b/contrib/media-patches/purple_mime_document_parsen.patch new file mode 100644 index 00000000..f7bdee80 --- /dev/null +++ b/contrib/media-patches/purple_mime_document_parsen.patch @@ -0,0 +1,61 @@ +--- workspace/pidgin/libpurple/mime.c 2010-03-27 20:11:19.456986210 +0100 ++++ src/pidgin-2.6.5/libpurple/mime.c 2010-03-28 15:56:46.300983807 +0200 +@@ -436,6 +436,43 @@ + g_free(bnd); + } + ++static char * ++parse_boundary(const char* ct) ++{ ++ const char BOUNDARY[] = "boundary="; ++ char *boundary_begin = g_strrstr(ct, BOUNDARY); ++ char *boundary_end; ++ gboolean has_quotes = FALSE; ++ ++ if (!boundary_begin) ++ return NULL; ++ ++ boundary_begin += sizeof(BOUNDARY) - 1; ++ ++ if (*boundary_begin == '"') { ++ has_quotes = TRUE; ++ ++boundary_begin; ++ } ++ ++ if (has_quotes) ++ boundary_end = strchr(boundary_begin, '"'); ++ else { ++ boundary_end = strchr(boundary_begin, ' '); ++ if (!boundary_end) { ++ boundary_end = strchr(boundary_begin, ';'); ++ if (!boundary_end) ++ boundary_end = boundary_begin + strlen(boundary_begin); ++ } ++ } ++ ++ if (!boundary_end) ++ return NULL; ++ ++ char *bnd = g_malloc0(boundary_end - boundary_begin + 1); ++ memcpy(bnd, boundary_begin, boundary_end - boundary_begin); ++ ++ return bnd; ++} + + PurpleMimeDocument * + purple_mime_document_parsen(const char *buf, gsize len) +@@ -457,9 +494,10 @@ + { + const char *ct = fields_get(&doc->fields, "content-type"); + if(ct && purple_str_has_prefix(ct, "multipart")) { +- char *bd = strrchr(ct, '='); +- if(bd++) { ++ char *bd = parse_boundary(ct); ++ if(bd) { + doc_parts_load(doc, bd, b, n); ++ g_free(bd); + } + } + } + + -- 2.11.4.GIT