From a4dda1c0484cf4b7a8435662642b546c70f88aad Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 16 Mar 2011 13:21:07 +0100 Subject: [PATCH 1/5] don't set sendrecv (it is the default) --- README.macos | 10 ++++++++++ coreapi/sal_eXosip2_sdp.c | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.macos b/README.macos index 6d3851503..9531aca95 100644 --- a/README.macos +++ b/README.macos @@ -30,5 +30,15 @@ Steps: * install to /opt/local sudo make install +********************* +Using gtk-osx (jhbuild environnment) + +After installing jhbuild and get gtk built, + +$ jhbuild shell + +$ PKG_CONFIG_PATH=/Users/smorlat/gtk/inst/lib/pkgconfig:/opt/local/lib/pkgconfig/ ./configure --disable-video --disable-gtk_ui --disable-strict + + diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 70443c722..d6e671b86 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -231,7 +231,8 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription } switch(desc->dir){ case SalStreamSendRecv: - dir="sendrecv"; + /*dir="sendrecv";*/ + dir=NULL; break; case SalStreamRecvOnly: dir="recvonly"; @@ -243,7 +244,7 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription dir="inactive"; break; } - sdp_message_a_attribute_add (msg, lineno, osip_strdup (dir),NULL); + if (dir) sdp_message_a_attribute_add (msg, lineno, osip_strdup (dir),NULL); } sdp_message_t *media_description_to_sdp(const SalMediaDescription *desc){ From 800c9a97b11d2a07b1e67ad5158e7a4c85001a7b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 16 Mar 2011 17:37:30 +0100 Subject: [PATCH 2/5] reduce sdp size (exceeds ethernet mtu!) --- coreapi/linphonecall.c | 2 +- coreapi/linphonecore.c | 9 +++++++-- coreapi/sal_eXosip2_sdp.c | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 899cb66cb..9a21ca65b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -110,7 +110,7 @@ void update_local_media_description(LinphoneCore *lc, LinphoneCall *call, SalMed } SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call){ - unsigned int id=rand(); + unsigned int id=rand() & 0xfff; return _create_local_media_description(lc,call,id,id); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 062e345b0..36e42b1f2 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -658,6 +658,7 @@ static const char *codec_pref_order[]={ "theora", "H263-1998", "H263", + "x-snow", NULL, }; @@ -692,7 +693,10 @@ static MSList *add_missing_codecs(SalStreamType mtype, MSList *l){ } if (pt && ms_filter_codec_supported(pt->mime_type)){ if (ms_list_find(l,pt)==NULL){ - payload_type_set_flag(pt,PAYLOAD_TYPE_ENABLED); + /*do not enable old or experimental codecs by default*/ + if (strcasecmp(pt->mime_type,"H263")!=0 && strcasecmp(pt->mime_type,"x-snow")!=0){ + payload_type_set_flag(pt,PAYLOAD_TYPE_ENABLED); + } ms_message("Adding new codec %s/%i with fmtp %s", pt->mime_type,pt->clock_rate,pt->recv_fmtp ? pt->recv_fmtp : ""); l=ms_list_insert_sorted(l,pt,(int (*)(const void *, const void *))codec_compare); @@ -959,7 +963,8 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta linphone_core_assign_payload_type(&payload_type_mp4v,99,"profile-level-id=3"); linphone_core_assign_payload_type(&payload_type_x_snow,100,NULL); linphone_core_assign_payload_type(&payload_type_h264,102,"profile-level-id=428014"); - linphone_core_assign_payload_type(&payload_type_h264,103,"packetization-mode=1;profile-level-id=428014"); + /* due to limited space in SDP, we have to disable this h264 line which is normally no more necessary */ + /* linphone_core_assign_payload_type(&payload_type_h264,103,"packetization-mode=1;profile-level-id=428014");*/ #endif ms_init(); diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index d6e671b86..fcf06f425 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -141,7 +141,7 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) osip_strdup (sessid), osip_strdup (sessver), osip_strdup ("IN"), inet6 ? osip_strdup("IP6") : osip_strdup ("IP4"), osip_strdup (desc->addr)); - sdp_message_s_name_set (local, osip_strdup ("A conversation")); + sdp_message_s_name_set (local, osip_strdup ("Talk")); if(!sal_media_description_has_dir (desc,SalStreamSendOnly)) { sdp_message_c_connection_add (local, -1, @@ -166,7 +166,7 @@ static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt) { char attr[256]; sdp_message_m_payload_add (msg,line, int_2char (payload_type_get_number(pt))); - if (pt->channels>0) + if (pt->channels>1) snprintf (attr,sizeof(attr),"%i %s/%i/%i", payload_type_get_number(pt), pt->mime_type, pt->clock_rate,pt->channels); else From ddac754cae92e277b6d2f1150aa01cae39a28caf Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 16 Mar 2011 22:25:26 +0100 Subject: [PATCH 3/5] use line parameter of contact as set by eXosip, in order to match the contact lines in the 200 Ok of registers --- coreapi/sal_eXosip2.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 6f2fd8bb1..38638716e 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1846,12 +1846,32 @@ int sal_iterate(Sal *sal){ return 0; } +static void register_set_contact(osip_message_t *msg, const char *contact){ + osip_uri_param_t *param = NULL; + osip_contact_t *ct=NULL; + char *line=NULL; + /*we get the line parameter choosed by exosip, and add it to our own contact*/ + osip_message_get_contact(msg,0,&ct); + if (ct!=NULL){ + osip_uri_uparam_get_byname(ct->url, "line", ¶m); + if (param && param->gvalue) + line=osip_strdup(param->gvalue); + } + _osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free); + osip_message_set_contact(msg,contact); + osip_message_get_contact(msg,0,&ct); + osip_uri_uparam_add(ct->url,osip_strdup("line"),line); +} + int sal_register(SalOp *h, const char *proxy, const char *from, int expires){ osip_message_t *msg; + const char *contact=sal_op_get_contact(h); + sal_op_set_route(h,proxy); if (h->rid==-1){ eXosip_lock(); - h->rid=eXosip_register_build_initial_register(from,proxy,sal_op_get_contact(h),expires,&msg); + h->rid=eXosip_register_build_initial_register(from,proxy,NULL,expires,&msg); + if (contact) register_set_contact(msg,contact); sal_add_register(h->base.root,h); }else{ eXosip_lock(); From a38580d3d44c3e1599a67ead76395c4bde22aa0e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 17 Mar 2011 10:55:39 +0100 Subject: [PATCH 4/5] save more space in SDP by not setting rtpmap for well known payload types --- coreapi/sal_eXosip2_sdp.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index fcf06f425..82e1fb509 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -161,19 +161,32 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) } +static bool_t is_known_rtpmap(const PayloadType *pt){ + switch(payload_type_get_number(pt)){ + case 0: + case 8: + case 3: + case 34: + return TRUE; + } + return FALSE; +} -static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt) +static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt, bool_t strip_well_known_rtpmaps) { char attr[256]; sdp_message_m_payload_add (msg,line, int_2char (payload_type_get_number(pt))); - if (pt->channels>1) - snprintf (attr,sizeof(attr),"%i %s/%i/%i", payload_type_get_number(pt), - pt->mime_type, pt->clock_rate,pt->channels); - else - snprintf (attr,sizeof(attr),"%i %s/%i", payload_type_get_number(pt), - pt->mime_type, pt->clock_rate); - sdp_message_a_attribute_add (msg, line, - osip_strdup ("rtpmap"), osip_strdup(attr)); + + if (!strip_well_known_rtpmaps || !is_known_rtpmap(pt)){ + if (pt->channels>1) + snprintf (attr,sizeof(attr),"%i %s/%i/%i", payload_type_get_number(pt), + pt->mime_type, pt->clock_rate,pt->channels); + else + snprintf (attr,sizeof(attr),"%i %s/%i", payload_type_get_number(pt), + pt->mime_type, pt->clock_rate); + sdp_message_a_attribute_add (msg, line, + osip_strdup ("rtpmap"), osip_strdup(attr)); + } if (pt->recv_fmtp != NULL) { @@ -190,6 +203,7 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription const char *addr; const char *dir="sendrecv"; int port; + bool_t strip_well_known_rtpmaps; switch (desc->type) { case SalAudio: @@ -226,8 +240,9 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription int_2char(desc->bandwidth)); if (desc->ptime>0) sdp_message_a_attribute_add(msg,lineno,osip_strdup("ptime"), int_2char(desc->ptime)); + strip_well_known_rtpmaps=ms_list_size(desc->payloads)>5; for(elem=desc->payloads;elem!=NULL;elem=elem->next){ - add_payload(msg, lineno, (PayloadType*)elem->data); + add_payload(msg, lineno, (PayloadType*)elem->data,strip_well_known_rtpmaps); } switch(desc->dir){ case SalStreamSendRecv: From c1a5f64157d652eb7aa9454dbc8b616bdb9c5b5b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 17 Mar 2011 21:55:26 +0100 Subject: [PATCH 5/5] limit the size of the log window --- gtk/logging.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gtk/logging.c b/gtk/logging.c index 4b3af6638..522308068 100644 --- a/gtk/logging.c +++ b/gtk/logging.c @@ -29,6 +29,8 @@ static GtkWidget *log_window=NULL; static GStaticMutex log_mutex=G_STATIC_MUTEX_INIT; static GList *log_queue=NULL; +#define LOG_MAX_CHARS 1000000 /*1 mega bytes of traces*/ + typedef struct _LinphoneGtkLog{ OrtpLogLevel lev; gchar *msg; @@ -275,6 +277,7 @@ static void linphone_gtk_display_log(OrtpLogLevel lev, const char *msg){ default: g_error("Bad level !"); } + gtk_text_buffer_get_end_iter(b,&iter); off=gtk_text_iter_get_offset(&iter); gtk_text_buffer_insert(b,&iter,lname,-1); @@ -288,8 +291,18 @@ static void linphone_gtk_display_log(OrtpLogLevel lev, const char *msg){ gtk_text_buffer_get_iter_at_offset(b,&begin,off); if (lev==ORTP_ERROR || lev==ORTP_FATAL) gtk_text_buffer_apply_tag_by_name(b,"red",&begin,&iter); else if (lev==ORTP_WARNING) gtk_text_buffer_apply_tag_by_name(b,"orange",&begin,&iter); + /* gtk_text_buffer_get_end_iter(b,&iter); - //gtk_text_view_scroll_to_iter(v,&iter,0,FALSE,0,0); + gtk_text_view_scroll_to_iter(v,&iter,0,FALSE,0,0); + */ + while(gtk_text_buffer_get_char_count(b)>LOG_MAX_CHARS){ + GtkTextIter iter_line_after; + gtk_text_buffer_get_start_iter(b,&iter); + iter_line_after=iter; + if (gtk_text_iter_forward_line(&iter_line_after)){ + gtk_text_buffer_delete(b,&iter,&iter_line_after); + } + } } gboolean linphone_gtk_check_logs(){