From abaa5b63aa5f5abdf4b29a07383971a0393bb363 Mon Sep 17 00:00:00 2001
From: smorlat <smorlat@3f6dc0c8-ddfe-455d-9043-3cd528dc4637>
Date: Wed, 6 May 2009 15:29:53 +0000
Subject: [PATCH] fixes enable H263 old on windows.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@463 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
---
 linphone/coreapi/linphonecore.c               | 27 ++++++++++++++-----
 linphone/coreapi/sipsetup.c                   |  2 +-
 linphone/mediastreamer2/acinclude.m4          |  2 +-
 .../build/win32native/alldescs.h              |  4 +++
 linphone/mediastreamer2/configure.ac          |  4 +++
 linphone/mediastreamer2/src/videoout.c        | 11 ++++++--
 6 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c
index 682a5c44fe..01819f3b27 100644
--- a/linphone/coreapi/linphonecore.c
+++ b/linphone/coreapi/linphonecore.c
@@ -643,18 +643,19 @@ const char * linphone_core_get_version(void){
 static PayloadType * payload_type_h264_packetization_mode_1=NULL;
 static PayloadType * linphone_h263_1998=NULL;
 static PayloadType * linphone_mp4v_es=NULL;
+static PayloadType * linphone_h263_old=NULL;
 #endif
 
 void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path, void * userdata)
 {
 	memset (lc, 0, sizeof (LinphoneCore));
 	lc->data=userdata;
-	
+
 	memcpy(&lc->vtable,vtable,sizeof(LinphoneCoreVTable));
 
-        gstate_initialize(lc);
-        gstate_new_state(lc, GSTATE_POWER_STARTUP, NULL);
-        
+	gstate_initialize(lc);
+	gstate_new_state(lc, GSTATE_POWER_STARTUP, NULL);
+	
 	ortp_init();
 	rtp_profile_set_payload(&av_profile,115,&payload_type_lpc1015);
 	rtp_profile_set_payload(&av_profile,110,&payload_type_speex_nb);
@@ -670,6 +671,10 @@ void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, co
 	payload_type_set_recv_fmtp(linphone_h263_1998,"CIF=1;QCIF=1");
 	rtp_profile_set_payload(&av_profile,98,linphone_h263_1998);
 
+	linphone_h263_old=payload_type_clone(&payload_type_h263);
+    payload_type_set_recv_fmtp(linphone_h263_old,"QCIF=2");
+    rtp_profile_set_payload(&av_profile,34,linphone_h263_old);
+
 	linphone_mp4v_es=payload_type_clone(&payload_type_mp4v);
 	payload_type_set_recv_fmtp(linphone_mp4v_es,"profile-level-id=3");
 	rtp_profile_set_payload(&av_profile,99,linphone_mp4v_es);
@@ -778,7 +783,9 @@ void linphone_core_get_local_ip(LinphoneCore *lc, const char *dest, char *result
 		strncpy(result,lc->sip_conf.ipv6_enabled ? "::1" : "127.0.0.1",LINPHONE_IPADDR_SIZE);
 		ms_error("Could not find default routable ip address !"); 
 	}	
+	/*
 	eXosip_masquerade_contact(NULL,0);
+	*/
 }
 
 const char *linphone_core_get_primary_contact(LinphoneCore *lc)
@@ -2050,14 +2057,22 @@ static void apply_nat_settings(LinphoneCore *lc){
 
 	if (lc->net_conf.firewall_policy==LINPHONE_POLICY_USE_NAT_ADDRESS){
 		if (tmp!=NULL){
-			if (!lc->net_conf.nat_sdp_only)
+			if (!lc->net_conf.nat_sdp_only){
+				eXosip_set_option(EXOSIP_OPT_SET_IPV4_FOR_GATEWAY,tmp);
+				/* the following does not work in all cases */
+				/*
 				eXosip_masquerade_contact(tmp,lc->sip_conf.sip_port);
+				*/
+			}
 			ms_free(tmp);
 		}
-		else 
+		else{
+			eXosip_set_option(EXOSIP_OPT_SET_IPV4_FOR_GATEWAY,NULL);
 			eXosip_masquerade_contact("",0);
+		}
 	}
 	else {
+		eXosip_set_option(EXOSIP_OPT_SET_IPV4_FOR_GATEWAY,NULL);
 		eXosip_masquerade_contact("",0);	
 	}
 }
diff --git a/linphone/coreapi/sipsetup.c b/linphone/coreapi/sipsetup.c
index 250d71eb3b..14c0160cf0 100644
--- a/linphone/coreapi/sipsetup.c
+++ b/linphone/coreapi/sipsetup.c
@@ -77,7 +77,7 @@ void sip_setup_unregister_all(void){
 	for(elem=registered_sip_setups;elem!=NULL;elem=elem->next){
 		SipSetup *ss=(SipSetup*)elem->data;
 		if (ss->initialized){
-			ss->exit();
+			if (ss->exit) ss->exit();
 			ss->initialized=FALSE;
 		}
 	}
diff --git a/linphone/mediastreamer2/acinclude.m4 b/linphone/mediastreamer2/acinclude.m4
index 2f922f31a2..00266d14f0 100644
--- a/linphone/mediastreamer2/acinclude.m4
+++ b/linphone/mediastreamer2/acinclude.m4
@@ -96,7 +96,7 @@ AC_DEFUN([MS_CHECK_VIDEO],[
 		dnl # include "swscale.h" // private linhone swscale.h
 		dnl #endif
 		CPPFLAGS_save=$CPPFLAGS
-		CPPFLAGS="SWSCALE_CFLAGS $CPPFLAGS"
+		CPPFLAGS="$SWSCALE_CFLAGS $CPPFLAGS"
 		AC_CHECK_HEADERS(libswscale/swscale.h)
 		CPPFLAGS=$CPPFLAGS_save
 
diff --git a/linphone/mediastreamer2/build/win32native/alldescs.h b/linphone/mediastreamer2/build/win32native/alldescs.h
index 9eafe2f840..e76c612a24 100755
--- a/linphone/mediastreamer2/build/win32native/alldescs.h
+++ b/linphone/mediastreamer2/build/win32native/alldescs.h
@@ -21,6 +21,8 @@ extern MSFilterDesc ms_v4w_desc;
 extern MSFilterDesc ms_video_out_desc;
 extern MSFilterDesc ms_h263_enc_desc;
 extern MSFilterDesc ms_h263_dec_desc;
+extern MSFilterDesc ms_h263_old_enc_desc;
+extern MSFilterDesc ms_h263_old_dec_desc;
 extern MSFilterDesc ms_mpeg4_enc_desc;
 extern MSFilterDesc ms_mpeg4_dec_desc;
 extern MSFilterDesc ms_snow_enc_desc;
@@ -56,6 +58,8 @@ MSFilterDesc * ms_filter_descs[]={
 &ms_conf_desc,
 &ms_v4w_desc,
 &ms_video_out_desc,
+&ms_h263_old_enc_desc,
+&ms_h263_old_dec_desc,
 &ms_h263_enc_desc,
 &ms_h263_dec_desc,
 &ms_mpeg4_enc_desc,
diff --git a/linphone/mediastreamer2/configure.ac b/linphone/mediastreamer2/configure.ac
index 654633b39d..ce50cbe3a7 100644
--- a/linphone/mediastreamer2/configure.ac
+++ b/linphone/mediastreamer2/configure.ac
@@ -447,6 +447,10 @@ fi
 dnl check various things
 AC_FUNC_ALLOCA
 
+if test "x${prefix}" = "xNONE"; then
+	prefix=${ac_default_prefix}
+fi
+
 dnl define path of plugins:
 AC_DEFINE_UNQUOTED(PACKAGE_PLUGINS_DIR, "${prefix}/lib/mediastreamer/plugins" ,[path of plugins])
 PACKAGE_PLUGINS_DIR="${prefix}/lib/mediastreamer/plugins"
diff --git a/linphone/mediastreamer2/src/videoout.c b/linphone/mediastreamer2/src/videoout.c
index 1b018b1c67..8d1c572d86 100644
--- a/linphone/mediastreamer2/src/videoout.c
+++ b/linphone/mediastreamer2/src/videoout.c
@@ -212,6 +212,8 @@ static bool_t sdl_poll_event(MSDisplay *obj, MSDisplayEvent *ev){
 
 static void sdl_display_uninit(MSDisplay *obj){
 	SDL_Overlay *lay=(SDL_Overlay*)obj->data;
+	SDL_Event event;
+	int i;
 	if (lay==NULL)
 		return;
 	if (lay!=NULL)
@@ -220,6 +222,9 @@ static void sdl_display_uninit(MSDisplay *obj){
 		SDL_FreeSurface(sdl_screen);
 		sdl_screen=NULL;
 	}
+	/*purge the event queue before leaving*/
+	for(i=0;SDL_PollEvent(&event) && i<100;++i){
+	}
 	sdl_show_window(FALSE);
 }
 
@@ -689,8 +694,10 @@ static int video_out_handle_resizing(MSFilter *f, void *data){
 				sz.width=ev.w;
 				sz.height=ev.h;
 				ms_filter_lock(f);
-				set_vsize(s,&sz);
-				s->ready=FALSE;
+				if (s->ready){
+					set_vsize(s,&sz);
+					s->ready=FALSE;
+				}
 				ms_filter_unlock(f);
 			}
 		}
-- 
GitLab