From cb424561404f671fb4642fac21189859d516d5f8 Mon Sep 17 00:00:00 2001 From: jehan Date: Mon, 18 Jan 2010 18:04:25 +0100 Subject: [PATCH 001/769] initial commit --- LinphoneAuthInfo.java | 23 ++++++++++++ LinphoneCore.java | 68 ++++++++++++++++++++++++++++++++++++ LinphoneCoreException.java | 42 ++++++++++++++++++++++ LinphoneCoreFactory.java | 43 +++++++++++++++++++++++ LinphoneCoreImpl.java | 63 +++++++++++++++++++++++++++++++++ LinphoneCoreListener.java | 49 ++++++++++++++++++++++++++ LinphoneProxyConfig.java | 25 +++++++++++++ LinphoneProxyConfigImpl.java | 54 ++++++++++++++++++++++++++++ 8 files changed, 367 insertions(+) create mode 100644 LinphoneAuthInfo.java create mode 100644 LinphoneCore.java create mode 100644 LinphoneCoreException.java create mode 100644 LinphoneCoreFactory.java create mode 100644 LinphoneCoreImpl.java create mode 100644 LinphoneCoreListener.java create mode 100644 LinphoneProxyConfig.java create mode 100644 LinphoneProxyConfigImpl.java diff --git a/LinphoneAuthInfo.java b/LinphoneAuthInfo.java new file mode 100644 index 000000000..0b8865f42 --- /dev/null +++ b/LinphoneAuthInfo.java @@ -0,0 +1,23 @@ +/* +LinphoneAuthInfo.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +public interface LinphoneAuthInfo { + +} diff --git a/LinphoneCore.java b/LinphoneCore.java new file mode 100644 index 000000000..f10cf0df3 --- /dev/null +++ b/LinphoneCore.java @@ -0,0 +1,68 @@ +/* +LinphoneCore.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.io.File; +import java.net.URI; + +public interface LinphoneCore { + /* + * linphone core states + */ + interface GeneralState { + /* states for GSTATE_GROUP_POWER */ + static int GSTATE_POWER_OFF =0; /* initial state */ + static int GSTATE_POWER_STARTUP=1; + static int GSTATE_POWER_ON=2; + static int GSTATE_POWER_SHUTDOWN=3; + /* states for GSTATE_GROUP_REG */ + static int GSTATE_REG_NONE=10; /* initial state */ + static int GSTATE_REG_OK=11; + static int GSTATE_REG_FAILED=12; + /* states for GSTATE_GROUP_CALL */ + static int GSTATE_CALL_IDLE=20; /* initial state */ + static int GSTATE_CALL_OUT_INVITE=21; + static int GSTATE_CALL_OUT_CONNECTED=22; + static int GSTATE_CALL_IN_INVITE=23; + static int GSTATE_CALL_IN_CONNECTED=24; + static int GSTATE_CALL_END=25; + static int GSTATE_CALL_ERROR=26; + static int GSTATE_INVALID=27; + /** + * get new state {@link: } + */ + public int getNewState(); +} + + + public LinphoneProxyConfig createProxyConfig(URI identity,URI proxy,URI route); + + public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg); + + /** + * @return null if no default proxyconfig + */ + public LinphoneProxyConfig getDefaultProxyConfig(); + + void addAuthInfo(LinphoneAuthInfo info); + + public void invite(String url); + + public void iterate(); +} diff --git a/LinphoneCoreException.java b/LinphoneCoreException.java new file mode 100644 index 000000000..069e114a0 --- /dev/null +++ b/LinphoneCoreException.java @@ -0,0 +1,42 @@ +/* +LinphoneCoreException.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +public class LinphoneCoreException extends Exception { + + public LinphoneCoreException() { + // TODO Auto-generated constructor stub + } + + public LinphoneCoreException(String detailMessage) { + super(detailMessage); + // TODO Auto-generated constructor stub + } + + public LinphoneCoreException(Throwable throwable) { + super(throwable); + // TODO Auto-generated constructor stub + } + + public LinphoneCoreException(String detailMessage, Throwable throwable) { + super(detailMessage, throwable); + // TODO Auto-generated constructor stub + } + +} diff --git a/LinphoneCoreFactory.java b/LinphoneCoreFactory.java new file mode 100644 index 000000000..6a8c69493 --- /dev/null +++ b/LinphoneCoreFactory.java @@ -0,0 +1,43 @@ +/* +LinphoneCoreFactory.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.io.File; + +public class LinphoneCoreFactory { + static { + System.loadLibrary("liblinphone"); + } + static LinphoneCoreFactory theLinphoneCoreFactory = new LinphoneCoreFactory(); + + public static LinphoneCoreFactory instance() { + + return theLinphoneCoreFactory; + } + public LinphoneAuthInfo createAuthInfo(String username,String password) { + throw new RuntimeException("Not Implemented yet"); + } + + public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) { + throw new RuntimeException("Not Implemented yet"); + } + + + +} diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java new file mode 100644 index 000000000..958a66b9a --- /dev/null +++ b/LinphoneCoreImpl.java @@ -0,0 +1,63 @@ +/* +LinphoneCoreImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.io.File; +import java.io.IOException; +import java.net.URI; + +public class LinphoneCoreImpl implements LinphoneCore { + + private final LinphoneCoreListener mListener; + private final long nativePtr; + private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); + private native void iterate(long nativePtr); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { + mListener=listener; + nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); + } + + public void addAuthInfo(LinphoneAuthInfo info) { + // TODO Auto-generated method stub + + } + + public LinphoneProxyConfig createProxyConfig(URI identity, URI proxy,URI route) { + return new LinphoneProxyConfigImpl(identity, proxy, route); + } + + public LinphoneProxyConfig getDefaultProxyConfig() { + // TODO Auto-generated method stub + return null; + } + + public void invite(String url) { + // TODO Auto-generated method stub + } + + public void iterate() { + iterate(nativePtr); + } + + public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { + // TODO Auto-generated method stub + + } + +} diff --git a/LinphoneCoreListener.java b/LinphoneCoreListener.java new file mode 100644 index 000000000..e8a0279f3 --- /dev/null +++ b/LinphoneCoreListener.java @@ -0,0 +1,49 @@ +/* +LinphoneCoreListener.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + + + +public interface LinphoneCoreListener { + + /**< Notifies the application that it should show up + * @return */ + public void show(LinphoneCore lc); + /**< Notifies incoming calls + * @return */ + public void inviteReceived(LinphoneCore lc,String from); + /**< Notify calls terminated by far end + * @return */ + public void byeReceived(LinphoneCore lc,String from); + /**< Ask the application some authentication information + * @return */ + public void authInfoRequested(LinphoneCore lc,String realm,String username); + /**< Callback that notifies various events with human readable text. + * @return */ + public void displayStatus(LinphoneCore lc,String message);; + /**< Callback to display a message to the user + * @return */ + public void displayMessage(LinphoneCore lc,String message); + /** Callback to display a warning to the user + * @return */ + public void displayWarning(LinphoneCore lc,String message); + /**< State notification callback + * @return */ + public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state); +} diff --git a/LinphoneProxyConfig.java b/LinphoneProxyConfig.java new file mode 100644 index 000000000..fb8b68eb3 --- /dev/null +++ b/LinphoneProxyConfig.java @@ -0,0 +1,25 @@ +/* +LinphoneProxyConfig.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +public interface LinphoneProxyConfig { + + void enableRegister(boolean value); + +} diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java new file mode 100644 index 000000000..84e470045 --- /dev/null +++ b/LinphoneProxyConfigImpl.java @@ -0,0 +1,54 @@ +/* +LinphoneProxyConfigImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.net.URI; + + +public class LinphoneProxyConfigImpl implements LinphoneProxyConfig { + + final long nativePtr; + protected LinphoneProxyConfigImpl(URI identity,URI proxy,URI route) { + nativePtr = createAndAdd(); + edit(nativePtr); + setIdentity(nativePtr,identity.getScheme()+":"+identity.getHost()); + done(nativePtr); + } + + protected void finalize() throws Throwable { + deleteNative(nativePtr); + } + private native long createAndAdd(); + private native long deleteNative(long ptr); + + private native void edit(long ptr); + private native void done(long ptr); + + private native void setIdentity(long ptr,String identity); + /*private native void setProxy(long ptr,String identity);*/ + + private native void enableRegister(long ptr,boolean value); + + public void enableRegister(boolean value) { + edit(nativePtr); + enableRegister(nativePtr,value); + done(nativePtr); + } + +} From 135fac65cf96ecb9325bcb4c74a3890ab0059885 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 21 Jan 2010 17:31:28 +0100 Subject: [PATCH 002/769] first succesfull register --- LinphoneAuthInfo.java | 2 ++ LinphoneAuthInfoImpl.java | 13 +++++++++++++ LinphoneCore.java | 13 ++++++++++--- LinphoneCoreException.java | 1 + LinphoneCoreFactory.java | 9 +++++---- LinphoneCoreImpl.java | 28 +++++++++++++++++----------- LinphoneProxyConfig.java | 1 + LinphoneProxyConfigImpl.java | 33 +++++++++++++++++---------------- 8 files changed, 66 insertions(+), 34 deletions(-) create mode 100644 LinphoneAuthInfoImpl.java diff --git a/LinphoneAuthInfo.java b/LinphoneAuthInfo.java index 0b8865f42..2a5dbaf2d 100644 --- a/LinphoneAuthInfo.java +++ b/LinphoneAuthInfo.java @@ -21,3 +21,5 @@ package org.linphone.core; public interface LinphoneAuthInfo { } + + diff --git a/LinphoneAuthInfoImpl.java b/LinphoneAuthInfoImpl.java new file mode 100644 index 000000000..15a064ec9 --- /dev/null +++ b/LinphoneAuthInfoImpl.java @@ -0,0 +1,13 @@ +package org.linphone.core; + +class LinphoneAuthInfoImpl implements LinphoneAuthInfo { + protected final long nativePtr; + private native long newLinphoneAuthInfo(String username, String userid, String passwd, String ha1,String realm); + private native void delete(long ptr); + protected LinphoneAuthInfoImpl(String username,String password) { + nativePtr = newLinphoneAuthInfo(username,null,password,null,null); + } + protected void finalize() throws Throwable { + delete(nativePtr); + } +} diff --git a/LinphoneCore.java b/LinphoneCore.java index f10cf0df3..8dccff830 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -18,8 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; -import java.io.File; -import java.net.URI; + public interface LinphoneCore { /* @@ -51,8 +50,16 @@ public interface LinphoneCore { } - public LinphoneProxyConfig createProxyConfig(URI identity,URI proxy,URI route); + /** + * @param identity sip uri sip:jehan@linphone.org + * @param proxy sip uri (sip:linphone.org) + * @param route optionnal sip usi (sip:linphone.org) + * @return + */ + public LinphoneProxyConfig createProxyConfig(String identity,String proxy,String route) throws LinphoneCoreException; + public void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException; + public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg); /** diff --git a/LinphoneCoreException.java b/LinphoneCoreException.java index 069e114a0..abec2943e 100644 --- a/LinphoneCoreException.java +++ b/LinphoneCoreException.java @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +@SuppressWarnings("serial") public class LinphoneCoreException extends Exception { public LinphoneCoreException() { diff --git a/LinphoneCoreFactory.java b/LinphoneCoreFactory.java index 6a8c69493..265ba65dd 100644 --- a/LinphoneCoreFactory.java +++ b/LinphoneCoreFactory.java @@ -19,10 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone.core; import java.io.File; +import java.io.IOException; public class LinphoneCoreFactory { static { - System.loadLibrary("liblinphone"); + System.loadLibrary("linphone"); } static LinphoneCoreFactory theLinphoneCoreFactory = new LinphoneCoreFactory(); @@ -31,11 +32,11 @@ public class LinphoneCoreFactory { return theLinphoneCoreFactory; } public LinphoneAuthInfo createAuthInfo(String username,String password) { - throw new RuntimeException("Not Implemented yet"); + return new LinphoneAuthInfoImpl(username,password) ; } - public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) { - throw new RuntimeException("Not Implemented yet"); + public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { + return new LinphoneCoreImpl(listener,userConfig,factoryConfig,userdata); } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 958a66b9a..f922cef08 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,35 +20,36 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.net.URI; -public class LinphoneCoreImpl implements LinphoneCore { + +class LinphoneCoreImpl implements LinphoneCore { private final LinphoneCoreListener mListener; private final long nativePtr; private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); private native void iterate(long nativePtr); + private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr); + private native int addProxyConfig(long nativePtr,long proxyCfgNativePtr); + private native void addAuthInfo(long nativePtr,long authInfoNativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); } public void addAuthInfo(LinphoneAuthInfo info) { - // TODO Auto-generated method stub - + addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr); } - public LinphoneProxyConfig createProxyConfig(URI identity, URI proxy,URI route) { + public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route) throws LinphoneCoreException { return new LinphoneProxyConfigImpl(identity, proxy, route); } public LinphoneProxyConfig getDefaultProxyConfig() { - // TODO Auto-generated method stub - return null; + throw new RuntimeException("not implemenetd yet"); } public void invite(String url) { - // TODO Auto-generated method stub + throw new RuntimeException("not implemenetd yet"); } public void iterate() { @@ -56,8 +57,13 @@ public class LinphoneCoreImpl implements LinphoneCore { } public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { - // TODO Auto-generated method stub - + setDefaultProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr); } - + public void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ + if (addProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) { + throw new LinphoneCoreException("bad proxy config"); + } + } + + } diff --git a/LinphoneProxyConfig.java b/LinphoneProxyConfig.java index fb8b68eb3..b4b5fd8b8 100644 --- a/LinphoneProxyConfig.java +++ b/LinphoneProxyConfig.java @@ -22,4 +22,5 @@ public interface LinphoneProxyConfig { void enableRegister(boolean value); + } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 84e470045..0fa1a85b7 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -18,37 +18,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; -import java.net.URI; -public class LinphoneProxyConfigImpl implements LinphoneProxyConfig { - final long nativePtr; - protected LinphoneProxyConfigImpl(URI identity,URI proxy,URI route) { - nativePtr = createAndAdd(); - edit(nativePtr); - setIdentity(nativePtr,identity.getScheme()+":"+identity.getHost()); - done(nativePtr); +class LinphoneProxyConfigImpl implements LinphoneProxyConfig { + + protected final long nativePtr; + protected LinphoneProxyConfigImpl(String identity,String proxy,String route) throws LinphoneCoreException { + nativePtr = newLinphoneProxyConfig(); + setIdentity(nativePtr,identity); + if (setProxy(nativePtr,proxy)!=0) { + throw new LinphoneCoreException("Bad proxy address ["+proxy+"]"); + } } protected void finalize() throws Throwable { - deleteNative(nativePtr); + delete(nativePtr); } - private native long createAndAdd(); - private native long deleteNative(long ptr); + private native long newLinphoneProxyConfig(); + private native void delete(long ptr); - private native void edit(long ptr); - private native void done(long ptr); + //private native void edit(long ptr); + //private native void done(long ptr); private native void setIdentity(long ptr,String identity); - /*private native void setProxy(long ptr,String identity);*/ + private native int setProxy(long ptr,String proxy); private native void enableRegister(long ptr,boolean value); public void enableRegister(boolean value) { - edit(nativePtr); + //edit(nativePtr); enableRegister(nativePtr,value); - done(nativePtr); + //done(nativePtr); } } From b99a6532195bdb0aa13826dcc0d12e9253a47b0a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 27 Jan 2010 17:49:01 +0100 Subject: [PATCH 003/769] test outgoing calls --- LinphoneCore.java | 51 ++++++++++++++++++++++----------------- LinphoneCoreImpl.java | 5 ++-- LinphoneCoreListener.java | 8 +++--- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/LinphoneCore.java b/LinphoneCore.java index 8dccff830..8df865468 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -24,30 +24,37 @@ public interface LinphoneCore { /* * linphone core states */ - interface GeneralState { + public enum GeneralState { /* states for GSTATE_GROUP_POWER */ - static int GSTATE_POWER_OFF =0; /* initial state */ - static int GSTATE_POWER_STARTUP=1; - static int GSTATE_POWER_ON=2; - static int GSTATE_POWER_SHUTDOWN=3; + GSTATE_POWER_OFF(0), /* initial state */ + GSTATE_POWER_STARTUP(1), + GSTATE_POWER_ON(2), + GSTATE_POWER_SHUTDOWN(3), /* states for GSTATE_GROUP_REG */ - static int GSTATE_REG_NONE=10; /* initial state */ - static int GSTATE_REG_OK=11; - static int GSTATE_REG_FAILED=12; + GSTATE_REG_NONE(10), /* initial state */ + GSTATE_REG_OK(11), + GSTATE_REG_FAILED(12), /* states for GSTATE_GROUP_CALL */ - static int GSTATE_CALL_IDLE=20; /* initial state */ - static int GSTATE_CALL_OUT_INVITE=21; - static int GSTATE_CALL_OUT_CONNECTED=22; - static int GSTATE_CALL_IN_INVITE=23; - static int GSTATE_CALL_IN_CONNECTED=24; - static int GSTATE_CALL_END=25; - static int GSTATE_CALL_ERROR=26; - static int GSTATE_INVALID=27; - /** - * get new state {@link: } - */ - public int getNewState(); -} + GSTATE_CALL_IDLE(20), /* initial state */ + GSTATE_CALL_OUT_INVITE(21), + GSTATE_CALL_OUT_CONNECTED(22), + GSTATE_CALL_IN_INVITE(23), + GSTATE_CALL_IN_CONNECTED(24), + GSTATE_CALL_END(25), + GSTATE_CALL_ERROR(26), + GSTATE_INVALID(27); + private final int mValue; + + GeneralState(int value) { + mValue = value; + } + public static GeneralState fromInt(int value) { + for (GeneralState state: GeneralState.values()) { + if (state.mValue == value) return state; + } + throw new RuntimeException("sate not found ["+value+"]"); + } + } /** @@ -69,7 +76,7 @@ public interface LinphoneCore { void addAuthInfo(LinphoneAuthInfo info); - public void invite(String url); + public void invite(String uri); public void iterate(); } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index f922cef08..444091ac8 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -31,6 +31,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr); private native int addProxyConfig(long nativePtr,long proxyCfgNativePtr); private native void addAuthInfo(long nativePtr,long authInfoNativePtr); + private native void invite(long nativePtr,String uri); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -48,8 +49,8 @@ class LinphoneCoreImpl implements LinphoneCore { throw new RuntimeException("not implemenetd yet"); } - public void invite(String url) { - throw new RuntimeException("not implemenetd yet"); + public void invite(String uri) { + invite(nativePtr,uri); } public void iterate() { diff --git a/LinphoneCoreListener.java b/LinphoneCoreListener.java index e8a0279f3..f48f8a9eb 100644 --- a/LinphoneCoreListener.java +++ b/LinphoneCoreListener.java @@ -36,14 +36,16 @@ public interface LinphoneCoreListener { public void authInfoRequested(LinphoneCore lc,String realm,String username); /**< Callback that notifies various events with human readable text. * @return */ - public void displayStatus(LinphoneCore lc,String message);; + public void displayStatus(LinphoneCore lc,String message); /**< Callback to display a message to the user * @return */ public void displayMessage(LinphoneCore lc,String message); /** Callback to display a warning to the user * @return */ public void displayWarning(LinphoneCore lc,String message); - /**< State notification callback - * @return */ + /** State notification callback + * @param state LinphoneCore.GeneralState + * @return + * */ public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state); } From f91275deffac99a67ba5969b433fcaa6219b117f Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 5 Feb 2010 17:49:43 +0100 Subject: [PATCH 004/769] -phone view -settings --- LinphoneCore.java | 16 ++++++++++--- LinphoneCoreImpl.java | 23 +++++++++++++++--- LinphoneProxyConfig.java | 26 +++++++++++++++++++- LinphoneProxyConfigImpl.java | 46 +++++++++++++++++++++++++++--------- 4 files changed, 93 insertions(+), 18 deletions(-) diff --git a/LinphoneCore.java b/LinphoneCore.java index 8df865468..4e608452c 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -61,18 +61,28 @@ public interface LinphoneCore { * @param identity sip uri sip:jehan@linphone.org * @param proxy sip uri (sip:linphone.org) * @param route optionnal sip usi (sip:linphone.org) + * @param register should be initiated * @return */ - public LinphoneProxyConfig createProxyConfig(String identity,String proxy,String route) throws LinphoneCoreException; + public LinphoneProxyConfig createProxyConfig(String identity,String proxy,String route,boolean enableRegister) throws LinphoneCoreException; + /** + * clear all added proxy config + */ + public void clearProxyConfigs(); public void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException; public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg); /** - * @return null if no default proxyconfig + * @return null if no default proxy config */ - public LinphoneProxyConfig getDefaultProxyConfig(); + public LinphoneProxyConfig getDefaultProxyConfig() ; + + /** + * clear all the added auth info + */ + void clearAuthInfos(); void addAuthInfo(LinphoneAuthInfo info); diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 444091ac8..2cc292911 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -28,8 +28,13 @@ class LinphoneCoreImpl implements LinphoneCore { private final long nativePtr; private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); private native void iterate(long nativePtr); + private native long getDefaultProxyConfig(long nativePtr); + private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr); private native int addProxyConfig(long nativePtr,long proxyCfgNativePtr); + private native void clearAuthInfos(long nativePtr); + + private native void clearProxyConfigs(long nativePtr); private native void addAuthInfo(long nativePtr,long authInfoNativePtr); private native void invite(long nativePtr,String uri); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -41,12 +46,17 @@ class LinphoneCoreImpl implements LinphoneCore { addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr); } - public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route) throws LinphoneCoreException { - return new LinphoneProxyConfigImpl(identity, proxy, route); + public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException { + return new LinphoneProxyConfigImpl(identity, proxy, route,enableRegister); } public LinphoneProxyConfig getDefaultProxyConfig() { - throw new RuntimeException("not implemenetd yet"); + long lNativePtr = getDefaultProxyConfig(nativePtr); + if (lNativePtr!=0) { + return new LinphoneProxyConfigImpl(lNativePtr); + } else { + return null; + } } public void invite(String uri) { @@ -65,6 +75,13 @@ class LinphoneCoreImpl implements LinphoneCore { throw new LinphoneCoreException("bad proxy config"); } } + public void clearAuthInfos() { + clearAuthInfos(nativePtr); + + } + public void clearProxyConfigs() { + clearProxyConfigs(nativePtr); + } } diff --git a/LinphoneProxyConfig.java b/LinphoneProxyConfig.java index b4b5fd8b8..17085de82 100644 --- a/LinphoneProxyConfig.java +++ b/LinphoneProxyConfig.java @@ -20,7 +20,31 @@ package org.linphone.core; public interface LinphoneProxyConfig { - void enableRegister(boolean value); + /** + * Unregister proxy config a enable edition + */ + public void edit(); + /** + * Validate proxy config changes. Start registration in case + */ + public void done(); + /** + * sip user made by sip:username@domain + */ + public void setIdentity(String identity) throws LinphoneCoreException; + /** + * Set proxy uri, like sip:linphone.org:5060 + * @param proxyUri + * @throws LinphoneCoreException + */ + public void setProxy(String proxyUri) throws LinphoneCoreException; + /** + * Enable register for this proxy config. + * Register message is issued after call to {@link #done()} + * @param value + * @throws LinphoneCoreException + */ + public void enableRegister(boolean value) throws LinphoneCoreException; } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 0fa1a85b7..f1de9707b 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -18,28 +18,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import org.linphone.Linphone; + +import android.util.Log; + class LinphoneProxyConfigImpl implements LinphoneProxyConfig { protected final long nativePtr; - protected LinphoneProxyConfigImpl(String identity,String proxy,String route) throws LinphoneCoreException { + boolean ownPtr = false; + protected LinphoneProxyConfigImpl(String identity,String proxy,String route, boolean enableRegister) throws LinphoneCoreException { nativePtr = newLinphoneProxyConfig(); - setIdentity(nativePtr,identity); - if (setProxy(nativePtr,proxy)!=0) { - throw new LinphoneCoreException("Bad proxy address ["+proxy+"]"); - } + setIdentity(identity); + setProxy(proxy); + enableRegister(enableRegister); + ownPtr=true; + Log.w(Linphone.TAG, "route ["+route+"] not used yet"); + } + protected LinphoneProxyConfigImpl(long aNativePtr) { + nativePtr = aNativePtr; + ownPtr=false; } - protected void finalize() throws Throwable { - delete(nativePtr); + if (ownPtr) delete(nativePtr); } private native long newLinphoneProxyConfig(); private native void delete(long ptr); - //private native void edit(long ptr); - //private native void done(long ptr); + private native void edit(long ptr); + private native void done(long ptr); private native void setIdentity(long ptr,String identity); private native int setProxy(long ptr,String proxy); @@ -47,9 +56,24 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native void enableRegister(long ptr,boolean value); public void enableRegister(boolean value) { - //edit(nativePtr); enableRegister(nativePtr,value); - //done(nativePtr); } + public void done() { + done(nativePtr); + } + + public void edit() { + edit(nativePtr); + } + + public void setIdentity(String identity) throws LinphoneCoreException { + setIdentity(nativePtr,identity); + } + + public void setProxy(String proxyUri) throws LinphoneCoreException { + if (setProxy(nativePtr,proxyUri)!=0) { + throw new LinphoneCoreException("Bad proxy address ["+proxyUri+"]"); + } + } } From 358f29c5ccc09ba6dfcc28ccd6a1c2b7efb3962a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 8 Feb 2010 18:36:16 +0100 Subject: [PATCH 005/769] start GUI binding --- LinphoneCore.java | 2 ++ LinphoneCoreImpl.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/LinphoneCore.java b/LinphoneCore.java index 4e608452c..8ae0effd3 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -88,5 +88,7 @@ public interface LinphoneCore { public void invite(String uri); + public void terminateCall(); + public void iterate(); } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 2cc292911..0e4956566 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -37,6 +37,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void clearProxyConfigs(long nativePtr); private native void addAuthInfo(long nativePtr,long authInfoNativePtr); private native void invite(long nativePtr,String uri); + private native void terminateCall(long nativePtr); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -82,6 +84,9 @@ class LinphoneCoreImpl implements LinphoneCore { public void clearProxyConfigs() { clearProxyConfigs(nativePtr); } + public void terminateCall() { + terminateCall(nativePtr); + } } From 08ab87eaf8a928f9342261e935970e04b14f9d3c Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 12 Feb 2010 15:46:01 +0100 Subject: [PATCH 006/769] phone book integration --- LinphoneAddress.java | 37 ++++++++++++++++++++++ LinphoneAddressImpl.java | 61 ++++++++++++++++++++++++++++++++++++ LinphoneAuthInfoImpl.java | 18 +++++++++++ LinphoneCore.java | 5 +++ LinphoneCoreImpl.java | 9 ++++++ LinphoneProxyConfig.java | 8 +++-- LinphoneProxyConfigImpl.java | 5 +++ 7 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 LinphoneAddress.java create mode 100644 LinphoneAddressImpl.java diff --git a/LinphoneAddress.java b/LinphoneAddress.java new file mode 100644 index 000000000..d7ad7c4b0 --- /dev/null +++ b/LinphoneAddress.java @@ -0,0 +1,37 @@ +/* +LinphoneAddress.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +public interface LinphoneAddress { + /** + * Human display name + * @return null if not set + */ + public String getDisplayName(); + /** + * userinfo + * @return null if not set + */ + public String getUserName(); + /** + * + * @return null if not set + */ + public String getDomain(); +} diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java new file mode 100644 index 000000000..83176180e --- /dev/null +++ b/LinphoneAddressImpl.java @@ -0,0 +1,61 @@ +/* +LinphoneAddressImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + + + +public class LinphoneAddressImpl implements LinphoneAddress { + protected final long nativePtr; + boolean ownPtr = false; + private native long newLinphoneAddressImpl(String uri,String displayName); + private native void delete(long ptr); + private native String getDisplayName(long ptr); + private native String getUserName(long ptr); + private native String getDomain(long ptr); + + + protected LinphoneAddressImpl(String username,String domain,String displayName) { + nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); + } + protected LinphoneAddressImpl(long aNativePtr) { + nativePtr = aNativePtr; + ownPtr=false; + } + protected void finalize() throws Throwable { + if (ownPtr) delete(nativePtr); + } + public String getDisplayName() { + return getDisplayName(nativePtr); + } + public String getDomain() { + return getDomain(nativePtr); + } + public String getUserName() { + return getUserName(nativePtr); + } + + public String toString() { + String tmp=""; + if (getDisplayName()!=null) { + tmp="<"+getDisplayName()+">"; + } + return tmp+"sip:"+getUserName()+"@"+getDomain(); + } + +} diff --git a/LinphoneAuthInfoImpl.java b/LinphoneAuthInfoImpl.java index 15a064ec9..719101883 100644 --- a/LinphoneAuthInfoImpl.java +++ b/LinphoneAuthInfoImpl.java @@ -1,3 +1,21 @@ +/* +LinphoneAuthInfoImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ package org.linphone.core; class LinphoneAuthInfoImpl implements LinphoneAuthInfo { diff --git a/LinphoneCore.java b/LinphoneCore.java index 8ae0effd3..0a327f481 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -89,6 +89,11 @@ public interface LinphoneCore { public void invite(String uri); public void terminateCall(); + /** + * get the remote address in case of in/out call + * @return null if no call engaged yet + */ + public LinphoneAddress getRemoteAddress(); public void iterate(); } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 0e4956566..2ef2895f6 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -38,6 +38,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void addAuthInfo(long nativePtr,long authInfoNativePtr); private native void invite(long nativePtr,String uri); private native void terminateCall(long nativePtr); + private native long getRemoteAddress(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -87,6 +88,14 @@ class LinphoneCoreImpl implements LinphoneCore { public void terminateCall() { terminateCall(nativePtr); } + public LinphoneAddress getRemoteAddress() { + long ptr = getRemoteAddress(nativePtr); + if (ptr==0) { + return null; + } else { + return new LinphoneAddressImpl(ptr); + } + } } diff --git a/LinphoneProxyConfig.java b/LinphoneProxyConfig.java index 17085de82..8e338e613 100644 --- a/LinphoneProxyConfig.java +++ b/LinphoneProxyConfig.java @@ -45,6 +45,10 @@ public interface LinphoneProxyConfig { * @throws LinphoneCoreException */ public void enableRegister(boolean value) throws LinphoneCoreException; - - + /** + * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222 + * @param number + * @return + */ + public String normalizePhoneNumber(String number); } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index f1de9707b..7c65c7b28 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -55,6 +55,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native void enableRegister(long ptr,boolean value); + private native String normalizePhoneNumber(long ptr,String number); + public void enableRegister(boolean value) { enableRegister(nativePtr,value); } @@ -76,4 +78,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { throw new LinphoneCoreException("Bad proxy address ["+proxyUri+"]"); } } + public String normalizePhoneNumber(String number) { + return normalizePhoneNumber(nativePtr,number); + } } From 8f449aabbe7a28043f4317af253db3d04b9d77be Mon Sep 17 00:00:00 2001 From: jehan monnier Date: Sun, 14 Feb 2010 09:52:18 +0100 Subject: [PATCH 007/769] more jni functions implemented --- LinphoneAddress.java | 5 +++++ LinphoneAddressImpl.java | 11 +++++------ LinphoneCoreFactory.java | 3 +++ LinphoneProxyConfig.java | 11 +++++++++++ LinphoneProxyConfigImpl.java | 10 ++++++++++ 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/LinphoneAddress.java b/LinphoneAddress.java index d7ad7c4b0..619bd4fb8 100644 --- a/LinphoneAddress.java +++ b/LinphoneAddress.java @@ -34,4 +34,9 @@ public interface LinphoneAddress { * @return null if not set */ public String getDomain(); + + /** + * @return an URI version of the address that can be used to place a call using {@link LinphoneCore#invite(String)} + */ + public String toUri(); } diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java index 83176180e..fd80db86e 100644 --- a/LinphoneAddressImpl.java +++ b/LinphoneAddressImpl.java @@ -28,7 +28,7 @@ public class LinphoneAddressImpl implements LinphoneAddress { private native String getDisplayName(long ptr); private native String getUserName(long ptr); private native String getDomain(long ptr); - + private native String toUri(long ptr); protected LinphoneAddressImpl(String username,String domain,String displayName) { nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); @@ -51,11 +51,10 @@ public class LinphoneAddressImpl implements LinphoneAddress { } public String toString() { - String tmp=""; - if (getDisplayName()!=null) { - tmp="<"+getDisplayName()+">"; - } - return tmp+"sip:"+getUserName()+"@"+getDomain(); + return toUri(); + } + public String toUri() { + return toUri(nativePtr); } } diff --git a/LinphoneCoreFactory.java b/LinphoneCoreFactory.java index 265ba65dd..4cbded4f9 100644 --- a/LinphoneCoreFactory.java +++ b/LinphoneCoreFactory.java @@ -39,6 +39,9 @@ public class LinphoneCoreFactory { return new LinphoneCoreImpl(listener,userConfig,factoryConfig,userdata); } + public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName) { + return new LinphoneAddressImpl(username,domain,displayName); + } } diff --git a/LinphoneProxyConfig.java b/LinphoneProxyConfig.java index 8e338e613..97c7d21a6 100644 --- a/LinphoneProxyConfig.java +++ b/LinphoneProxyConfig.java @@ -51,4 +51,15 @@ public interface LinphoneProxyConfig { * @return */ public String normalizePhoneNumber(String number); + /** + * usefull function to automatically add internationnal prefix to e164 phone numbers + * @param prefix + */ + public void setDialPrefix(String prefix); + + /** + * rget domain host name or ip + * @return may be null + */ + public String getDomain(); } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 7c65c7b28..a82418cdb 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -55,8 +55,12 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native void enableRegister(long ptr,boolean value); + private native void setDialPrefix(long ptr, String prefix); + private native String normalizePhoneNumber(long ptr,String number); + private native String getDomain(long ptr); + public void enableRegister(boolean value) { enableRegister(nativePtr,value); } @@ -81,4 +85,10 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public String normalizePhoneNumber(String number) { return normalizePhoneNumber(nativePtr,number); } + public void setDialPrefix(String prefix) { + setDialPrefix(nativePtr, prefix); + } + public String getDomain() { + return getDomain(nativePtr); + } } From 7b6ccba59eab576a65a2af91c5ba411ea680e9a0 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 15 Feb 2010 18:01:06 +0100 Subject: [PATCH 008/769] many bug fixes + audio routing + incoming call --- LinphoneCore.java | 22 ++++++++++++++++++++- LinphoneCoreImpl.java | 37 +++++++++++++++++++++++------------- LinphoneProxyConfig.java | 6 ++++++ LinphoneProxyConfigImpl.java | 8 +++++++- 4 files changed, 58 insertions(+), 15 deletions(-) diff --git a/LinphoneCore.java b/LinphoneCore.java index 0a327f481..59747220c 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -94,6 +94,26 @@ public interface LinphoneCore { * @return null if no call engaged yet */ public LinphoneAddress getRemoteAddress(); - + /** + * + * @return TRUE if there is a call running or pending. + */ + public boolean isIncall(); + /** + * + * @return Returns true if in incoming call is pending, ie waiting for being answered or declined. + */ + public boolean isInComingInvitePending(); public void iterate(); + /** + * Accept an incoming call. + * + * Basically the application is notified of incoming calls within the + * {@link LinphoneCoreListener#inviteReceived(LinphoneCore, String)} listener. + * The application can later respond positively to the call using + * this method. + */ + public void acceptCall(); + + } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 2ef2895f6..2997033e5 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -39,21 +39,24 @@ class LinphoneCoreImpl implements LinphoneCore { private native void invite(long nativePtr,String uri); private native void terminateCall(long nativePtr); private native long getRemoteAddress(long nativePtr); + private native boolean isInCall(long nativePtr); + private native boolean isInComingInvitePending(long nativePtr); + private native void acceptCall(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); } - public void addAuthInfo(LinphoneAuthInfo info) { + public synchronized void addAuthInfo(LinphoneAuthInfo info) { addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr); } - public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException { + public synchronized LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException { return new LinphoneProxyConfigImpl(identity, proxy, route,enableRegister); } - public LinphoneProxyConfig getDefaultProxyConfig() { + public synchronized LinphoneProxyConfig getDefaultProxyConfig() { long lNativePtr = getDefaultProxyConfig(nativePtr); if (lNativePtr!=0) { return new LinphoneProxyConfigImpl(lNativePtr); @@ -62,33 +65,33 @@ class LinphoneCoreImpl implements LinphoneCore { } } - public void invite(String uri) { + public synchronized void invite(String uri) { invite(nativePtr,uri); } - public void iterate() { + public synchronized void iterate() { iterate(nativePtr); } - public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { + public synchronized void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { setDefaultProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr); } - public void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ + public synchronized void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ if (addProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) { throw new LinphoneCoreException("bad proxy config"); } } - public void clearAuthInfos() { + public synchronized void clearAuthInfos() { clearAuthInfos(nativePtr); } - public void clearProxyConfigs() { + public synchronized void clearProxyConfigs() { clearProxyConfigs(nativePtr); } - public void terminateCall() { + public synchronized void terminateCall() { terminateCall(nativePtr); } - public LinphoneAddress getRemoteAddress() { + public synchronized LinphoneAddress getRemoteAddress() { long ptr = getRemoteAddress(nativePtr); if (ptr==0) { return null; @@ -96,6 +99,14 @@ class LinphoneCoreImpl implements LinphoneCore { return new LinphoneAddressImpl(ptr); } } - - + public synchronized boolean isIncall() { + return isInCall(nativePtr); + } + public synchronized boolean isInComingInvitePending() { + return isInComingInvitePending(nativePtr); + } + public synchronized void acceptCall() { + acceptCall(nativePtr); + + } } diff --git a/LinphoneProxyConfig.java b/LinphoneProxyConfig.java index 97c7d21a6..a7fe6b850 100644 --- a/LinphoneProxyConfig.java +++ b/LinphoneProxyConfig.java @@ -56,6 +56,12 @@ public interface LinphoneProxyConfig { * @param prefix */ public void setDialPrefix(String prefix); + /** + * * Sets whether liblinphone should replace "+" by "00" in dialed numbers (passed to + * {@link LinphoneCore#invite(String)}). + * @param value default value is false + */ + public void setDialEscapePlus(boolean value); /** * rget domain host name or ip diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index a82418cdb..af2722dd2 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -42,7 +42,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { ownPtr=false; } protected void finalize() throws Throwable { - if (ownPtr) delete(nativePtr); + Log.e(Linphone.TAG,"fixme, should release underlying proxy config"); + // FIXME if (ownPtr) delete(nativePtr); } private native long newLinphoneProxyConfig(); private native void delete(long ptr); @@ -61,6 +62,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native String getDomain(long ptr); + private native void setDialEscapePlus(long ptr, boolean value); + public void enableRegister(boolean value) { enableRegister(nativePtr,value); } @@ -91,4 +94,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public String getDomain() { return getDomain(nativePtr); } + public void setDialEscapePlus(boolean value) { + setDialEscapePlus(nativePtr,value); + } } From 3f0612f88f3851f35e98b02893a5ea4d7046ac9e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 18 Feb 2010 18:29:40 +0100 Subject: [PATCH 009/769] -create LinphoneService -fix landscape ui -create History tab view --- LinphoneCallLog.java | 31 ++++++++++++++++++++++++ LinphoneCallLogImpl.java | 46 ++++++++++++++++++++++++++++++++++++ LinphoneCore.java | 7 ++++++ LinphoneCoreImpl.java | 12 ++++++++++ LinphoneProxyConfigImpl.java | 6 ++--- 5 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 LinphoneCallLog.java create mode 100644 LinphoneCallLogImpl.java diff --git a/LinphoneCallLog.java b/LinphoneCallLog.java new file mode 100644 index 000000000..19d851a43 --- /dev/null +++ b/LinphoneCallLog.java @@ -0,0 +1,31 @@ +/* +LinPhoneCallLog.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +public interface LinphoneCallLog { + public enum CallDirection { + CallOutgoing,Callincoming + } + + public LinphoneAddress getFrom(); + + public LinphoneAddress getTo (); + + public LinphoneCallLog.CallDirection getDirection(); +} diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java new file mode 100644 index 000000000..c35eea2c7 --- /dev/null +++ b/LinphoneCallLogImpl.java @@ -0,0 +1,46 @@ +/* +LinPhoneCallLogImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + + +class LinphoneCallLogImpl implements LinphoneCallLog { + + protected final long nativePtr; + + private native long getFrom(long nativePtr); + private native long getTo(long nativePtr); + private native boolean isIncoming(long nativePtr); + LinphoneCallLogImpl(long aNativePtr) { + nativePtr = aNativePtr; + } + + + public CallDirection getDirection() { + return isIncoming(nativePtr)?CallDirection.Callincoming:CallDirection.CallOutgoing; + } + + public LinphoneAddress getFrom() { + return new LinphoneAddressImpl(getFrom(nativePtr)); + } + + public LinphoneAddress getTo() { + return new LinphoneAddressImpl(getTo(nativePtr)); + } + +} diff --git a/LinphoneCore.java b/LinphoneCore.java index 59747220c..c39ef36f2 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import java.util.List; + public interface LinphoneCore { @@ -116,4 +118,9 @@ public interface LinphoneCore { public void acceptCall(); + /** + * @return a list of LinphoneCallLog + */ + public List getCallLogs(); + } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 2997033e5..80d24bd67 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,6 +20,8 @@ package org.linphone.core; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; class LinphoneCoreImpl implements LinphoneCore { @@ -42,6 +44,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native boolean isInCall(long nativePtr); private native boolean isInComingInvitePending(long nativePtr); private native void acceptCall(long nativePtr); + private native long getCallLog(long nativePtr,int position); + private native int getNumberOfCallLogs(long nativePtr); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -109,4 +114,11 @@ class LinphoneCoreImpl implements LinphoneCore { acceptCall(nativePtr); } + public List getCallLogs() { + List logs = new ArrayList(); + for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { + logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr, i))); + } + return logs; + } } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index af2722dd2..3794c58bf 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; -import org.linphone.Linphone; +import org.linphone.LinphoneService; import android.util.Log; @@ -35,14 +35,14 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { setProxy(proxy); enableRegister(enableRegister); ownPtr=true; - Log.w(Linphone.TAG, "route ["+route+"] not used yet"); + Log.w(LinphoneService.TAG, "route ["+route+"] not used yet"); } protected LinphoneProxyConfigImpl(long aNativePtr) { nativePtr = aNativePtr; ownPtr=false; } protected void finalize() throws Throwable { - Log.e(Linphone.TAG,"fixme, should release underlying proxy config"); + Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config"); // FIXME if (ownPtr) delete(nativePtr); } private native long newLinphoneProxyConfig(); From dedf30d1e4031cdea3f91ae3381a929f9638d9cf Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 19 Feb 2010 17:04:40 +0100 Subject: [PATCH 010/769] enhanced history tab --- LinphoneCore.java | 5 +++++ LinphoneCoreImpl.java | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/LinphoneCore.java b/LinphoneCore.java index c39ef36f2..c886c4038 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -123,4 +123,9 @@ public interface LinphoneCore { */ public List getCallLogs(); + /** + * destroy linphone core and free all underlying resources + */ + public void destroy(); + } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 80d24bd67..ba6f5a384 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -23,11 +23,15 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.linphone.LinphoneService; + +import android.util.Log; + class LinphoneCoreImpl implements LinphoneCore { private final LinphoneCoreListener mListener; - private final long nativePtr; + private long nativePtr = 0; private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); private native void iterate(long nativePtr); private native long getDefaultProxyConfig(long nativePtr); @@ -46,22 +50,29 @@ class LinphoneCoreImpl implements LinphoneCore { private native void acceptCall(long nativePtr); private native long getCallLog(long nativePtr,int position); private native int getNumberOfCallLogs(long nativePtr); + private native void delete(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); } + protected void finalize() throws Throwable { + + } public synchronized void addAuthInfo(LinphoneAuthInfo info) { + isValid(); addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr); } public synchronized LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException { + isValid(); return new LinphoneProxyConfigImpl(identity, proxy, route,enableRegister); } public synchronized LinphoneProxyConfig getDefaultProxyConfig() { + isValid(); long lNativePtr = getDefaultProxyConfig(nativePtr); if (lNativePtr!=0) { return new LinphoneProxyConfigImpl(lNativePtr); @@ -71,32 +82,40 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void invite(String uri) { + isValid(); invite(nativePtr,uri); } public synchronized void iterate() { + isValid(); iterate(nativePtr); } public synchronized void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { + isValid(); setDefaultProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr); } public synchronized void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ + isValid(); if (addProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) { throw new LinphoneCoreException("bad proxy config"); } } public synchronized void clearAuthInfos() { + isValid(); clearAuthInfos(nativePtr); } public synchronized void clearProxyConfigs() { + isValid(); clearProxyConfigs(nativePtr); } public synchronized void terminateCall() { + isValid(); terminateCall(nativePtr); } public synchronized LinphoneAddress getRemoteAddress() { + isValid(); long ptr = getRemoteAddress(nativePtr); if (ptr==0) { return null; @@ -105,20 +124,35 @@ class LinphoneCoreImpl implements LinphoneCore { } } public synchronized boolean isIncall() { + isValid(); return isInCall(nativePtr); } public synchronized boolean isInComingInvitePending() { + isValid(); return isInComingInvitePending(nativePtr); } public synchronized void acceptCall() { + isValid(); acceptCall(nativePtr); } - public List getCallLogs() { + public synchronized List getCallLogs() { + isValid(); List logs = new ArrayList(); for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr, i))); } return logs; } + public synchronized void destroy() { + isValid(); + delete(nativePtr); + nativePtr = 0; + } + + private void isValid() { + if (nativePtr == 0) { + throw new RuntimeException("object already destroyed"); + } + } } From b167fe09a936bd4db8b68ebcd6eb669db7ff5ba0 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 3 Mar 2010 18:12:26 +0100 Subject: [PATCH 011/769] add Networkmanager class --- LinphoneCore.java | 9 +++++++++ LinphoneCoreImpl.java | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/LinphoneCore.java b/LinphoneCore.java index c886c4038..1f8e73449 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -123,6 +123,15 @@ public interface LinphoneCore { */ public List getCallLogs(); + /** + * This method is called by the application to notify the Linphone core library when network is reachable. + * Calling this method with true trigger Linphone to initiate a registration process for all proxy + * configuration with parameter register set to enable. + * This method disable the automatic registration mode. It means you must call this method after each network state changes + * @param network state + * + */ + public void setNetworkStateReachable(boolean isReachable); /** * destroy linphone core and free all underlying resources */ diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index ba6f5a384..b1dedfeb4 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -51,6 +51,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native long getCallLog(long nativePtr,int position); private native int getNumberOfCallLogs(long nativePtr); private native void delete(long nativePtr); + private native void setNetworkStateReachable(long nativePtr,boolean isReachable); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -155,4 +156,7 @@ class LinphoneCoreImpl implements LinphoneCore { throw new RuntimeException("object already destroyed"); } } + public void setNetworkStateReachable(boolean isReachable) { + setNetworkStateReachable(nativePtr,isReachable); + } } From 5136048097ff6946a8fcc331c2ea4b50b51e7fff Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 15 Mar 2010 18:04:58 +0100 Subject: [PATCH 012/769] add support for mute/speaker --- LinphoneCore.java | 10 ++++++++++ LinphoneCoreImpl.java | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/LinphoneCore.java b/LinphoneCore.java index 1f8e73449..915062118 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -136,5 +136,15 @@ public interface LinphoneCore { * destroy linphone core and free all underlying resources */ public void destroy(); + /** + * Allow to control play level before entering sound card: + * @param level in db + */ + public void setSoftPlayLevel(float gain); + /** + * get play level before entering sound card: + * @return level in db + */ + public float getSoftPlayLevel(); } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index b1dedfeb4..81685e886 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -51,7 +51,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native long getCallLog(long nativePtr,int position); private native int getNumberOfCallLogs(long nativePtr); private native void delete(long nativePtr); - private native void setNetworkStateReachable(long nativePtr,boolean isReachable); + private native void setNetworkStateReachable(long nativePtr,boolean isReachable); + private native void setSoftPlayLevel(long nativeptr, float gain); + private native float getSoftPlayLevel(long nativeptr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -159,4 +161,11 @@ class LinphoneCoreImpl implements LinphoneCore { public void setNetworkStateReachable(boolean isReachable) { setNetworkStateReachable(nativePtr,isReachable); } + public void setSoftPlayLevel(float gain) { + setSoftPlayLevel(nativePtr,gain); + + } + public float getSoftPlayLevel() { + return getSoftPlayLevel(nativePtr); + } } From 083b74b9257700e23c409070a56c024d0534c9bc Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 16 Mar 2010 12:37:05 +0100 Subject: [PATCH 013/769] fix sip uri presentation in History fix landscape mode --- LinphoneCore.java | 6 ++++++ LinphoneCoreImpl.java | 11 ++++++----- LinphoneProxyConfigImpl.java | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/LinphoneCore.java b/LinphoneCore.java index 915062118..753dfa12f 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -146,5 +146,11 @@ public interface LinphoneCore { * @return level in db */ public float getSoftPlayLevel(); + /** + * Mutes or unmutes the local microphone. + * @param isMuted + */ + public void muteMic(boolean isMuted); + } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 81685e886..eda069112 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -23,14 +23,11 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.linphone.LinphoneService; - -import android.util.Log; - class LinphoneCoreImpl implements LinphoneCore { - private final LinphoneCoreListener mListener; + @SuppressWarnings("unused") + private final LinphoneCoreListener mListener; //to make sure to keep a reference on this object private long nativePtr = 0; private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); private native void iterate(long nativePtr); @@ -54,6 +51,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setNetworkStateReachable(long nativePtr,boolean isReachable); private native void setSoftPlayLevel(long nativeptr, float gain); private native float getSoftPlayLevel(long nativeptr); + private native void muteMic(long nativePtr,boolean isMuted); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -168,4 +166,7 @@ class LinphoneCoreImpl implements LinphoneCore { public float getSoftPlayLevel() { return getSoftPlayLevel(nativePtr); } + public void muteMic(boolean isMuted) { + muteMic(nativePtr,isMuted); + } } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 3794c58bf..11e746946 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -42,8 +42,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { ownPtr=false; } protected void finalize() throws Throwable { - Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config"); - // FIXME if (ownPtr) delete(nativePtr); + //Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config"); + if (ownPtr) delete(nativePtr); } private native long newLinphoneProxyConfig(); private native void delete(long ptr); From d4015a2afb19ab59895e67cfc6744a03e449070e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 16 Mar 2010 18:15:00 +0100 Subject: [PATCH 014/769] add about menu --- LinphoneAddress.java | 6 +++++- LinphoneAddressImpl.java | 5 +++++ LinphoneCore.java | 9 +++++++++ LinphoneCoreImpl.java | 13 +++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/LinphoneAddress.java b/LinphoneAddress.java index 619bd4fb8..86271674c 100644 --- a/LinphoneAddress.java +++ b/LinphoneAddress.java @@ -34,7 +34,11 @@ public interface LinphoneAddress { * @return null if not set */ public String getDomain(); - + /** + * set display name + * @param name + */ + public void setDisplayName(String name); /** * @return an URI version of the address that can be used to place a call using {@link LinphoneCore#invite(String)} */ diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java index fd80db86e..50036ac7d 100644 --- a/LinphoneAddressImpl.java +++ b/LinphoneAddressImpl.java @@ -29,6 +29,8 @@ public class LinphoneAddressImpl implements LinphoneAddress { private native String getUserName(long ptr); private native String getDomain(long ptr); private native String toUri(long ptr); + private native String setDisplayName(long ptr,String name); + protected LinphoneAddressImpl(String username,String domain,String displayName) { nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); @@ -56,5 +58,8 @@ public class LinphoneAddressImpl implements LinphoneAddress { public String toUri() { return toUri(nativePtr); } + public void setDisplayName(String name) { + setDisplayName(nativePtr,name); + } } diff --git a/LinphoneCore.java b/LinphoneCore.java index 753dfa12f..4245c5518 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -90,6 +90,8 @@ public interface LinphoneCore { public void invite(String uri); + public void invite(LinphoneAddress to); + public void terminateCall(); /** * get the remote address in case of in/out call @@ -151,6 +153,13 @@ public interface LinphoneCore { * @param isMuted */ public void muteMic(boolean isMuted); + /** + * Build an address according to the current proxy config. In case destination is not a sip uri, the default proxy domain is automatically appended + * @param destination + * @return + * @throws If no LinphonrAddress can be built from destination + */ + public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException; } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index eda069112..173d5846c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -52,6 +52,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setSoftPlayLevel(long nativeptr, float gain); private native float getSoftPlayLevel(long nativeptr); private native void muteMic(long nativePtr,boolean isMuted); + private native long interpretUrl(long nativePtr,String destination); + private native void inviteAddress(long nativePtr,long to); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -169,4 +171,15 @@ class LinphoneCoreImpl implements LinphoneCore { public void muteMic(boolean isMuted) { muteMic(nativePtr,isMuted); } + public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException { + long lAddress = interpretUrl(nativePtr,destination); + if (lAddress != 0) { + return new LinphoneAddressImpl(lAddress); + } else { + throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); + } + } + public void invite(LinphoneAddress to) { + inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); + } } From 7cef363a1786f46009e280775a59cc102ba1085e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 18 Mar 2010 18:13:56 +0100 Subject: [PATCH 015/769] add clear history to call history tab --- LinphoneAddressImpl.java | 3 ++- LinphoneCore.java | 11 +++++++++-- LinphoneCoreImpl.java | 8 ++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java index 50036ac7d..ed879338c 100644 --- a/LinphoneAddressImpl.java +++ b/LinphoneAddressImpl.java @@ -30,6 +30,7 @@ public class LinphoneAddressImpl implements LinphoneAddress { private native String getDomain(long ptr); private native String toUri(long ptr); private native String setDisplayName(long ptr,String name); + private native String toString(long ptr); protected LinphoneAddressImpl(String username,String domain,String displayName) { @@ -53,7 +54,7 @@ public class LinphoneAddressImpl implements LinphoneAddress { } public String toString() { - return toUri(); + return toString(nativePtr); } public String toUri() { return toUri(nativePtr); diff --git a/LinphoneCore.java b/LinphoneCore.java index 4245c5518..6ab7e2348 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -160,6 +160,13 @@ public interface LinphoneCore { * @throws If no LinphonrAddress can be built from destination */ public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException; - - + /** + * Initiate a dtmf signal if in call + * @param number + */ + public void sendDtmf(char number); + /** + * + */ + public void clearCallLogs(); } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 173d5846c..ed938a841 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -54,6 +54,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void muteMic(long nativePtr,boolean isMuted); private native long interpretUrl(long nativePtr,String destination); private native void inviteAddress(long nativePtr,long to); + private native void sendDtmf(long nativePtr,char dtmf); + private native void clearCallLogs(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -182,4 +184,10 @@ class LinphoneCoreImpl implements LinphoneCore { public void invite(LinphoneAddress to) { inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); } + public void sendDtmf(char number) { + sendDtmf(nativePtr,number); + } + public void clearCallLogs() { + clearCallLogs(nativePtr); + } } From b079162b23ca5f85a41ce1634b937296f921b280 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 23 Mar 2010 10:03:15 +0100 Subject: [PATCH 016/769] add support for android 1.5 --- LinphoneCore.java | 2 +- LinphoneCoreImpl.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LinphoneCore.java b/LinphoneCore.java index 6ab7e2348..a145c4a68 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -72,7 +72,7 @@ public interface LinphoneCore { */ public void clearProxyConfigs(); - public void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException; + public void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException; public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg); diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index ed938a841..12d3707e7 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -34,7 +34,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native long getDefaultProxyConfig(long nativePtr); private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr); - private native int addProxyConfig(long nativePtr,long proxyCfgNativePtr); + private native int addProxyConfig(LinphoneProxyConfig jprtoxyCfg,long nativePtr,long proxyCfgNativePtr); private native void clearAuthInfos(long nativePtr); private native void clearProxyConfigs(long nativePtr); @@ -100,9 +100,9 @@ class LinphoneCoreImpl implements LinphoneCore { isValid(); setDefaultProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr); } - public synchronized void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ + public synchronized void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ isValid(); - if (addProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) { + if (addProxyConfig(proxyCfg,nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) { throw new LinphoneCoreException("bad proxy config"); } } From add223eb06a12d7bec82d51ddba177c1d95768d6 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 23 Mar 2010 17:41:30 +0100 Subject: [PATCH 017/769] add first start configuration checking --- LinphoneCoreFactory.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreFactory.java b/LinphoneCoreFactory.java index 4cbded4f9..24315f6dd 100644 --- a/LinphoneCoreFactory.java +++ b/LinphoneCoreFactory.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.IOException; public class LinphoneCoreFactory { + static { System.loadLibrary("linphone"); } @@ -42,6 +43,11 @@ public class LinphoneCoreFactory { public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName) { return new LinphoneAddressImpl(username,domain,displayName); } - + + /** + * Enable verbose traces + * @param enable + */ + public native void setDebugMode(boolean enable); } From 226f635662c85d26e2d3a8c811f0bd3e41122f23 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 25 Mar 2010 14:14:10 +0100 Subject: [PATCH 018/769] extend wake lock scope to screen to avoid sound system from going to standby --- LinphoneCore.java | 5 +++++ LinphoneCoreImpl.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/LinphoneCore.java b/LinphoneCore.java index a145c4a68..8609e04e1 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -153,6 +153,11 @@ public interface LinphoneCore { * @param isMuted */ public void muteMic(boolean isMuted); + /** + * + * @return true is mic is muted + */ + public boolean isMicMuted(); /** * Build an address according to the current proxy config. In case destination is not a sip uri, the default proxy domain is automatically appended * @param destination diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 12d3707e7..a1087f24d 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -56,6 +56,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void inviteAddress(long nativePtr,long to); private native void sendDtmf(long nativePtr,char dtmf); private native void clearCallLogs(long nativePtr); + private native boolean isMicMuted(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -190,4 +191,7 @@ class LinphoneCoreImpl implements LinphoneCore { public void clearCallLogs() { clearCallLogs(nativePtr); } + public boolean isMicMuted() { + return isMicMuted(nativePtr); + } } From 02a38337438ecf71b37ec12276d096f34964658e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 7 Apr 2010 09:09:56 +0200 Subject: [PATCH 019/769] add all deps as submodules --- LinphoneAddress.java | 46 ---------- LinphoneAuthInfo.java | 25 ------ LinphoneCallLog.java | 31 ------- LinphoneCore.java | 177 ------------------------------------- LinphoneCoreException.java | 43 --------- LinphoneCoreFactory.java | 53 ----------- LinphoneCoreListener.java | 51 ----------- LinphoneProxyConfig.java | 71 --------------- 8 files changed, 497 deletions(-) delete mode 100644 LinphoneAddress.java delete mode 100644 LinphoneAuthInfo.java delete mode 100644 LinphoneCallLog.java delete mode 100644 LinphoneCore.java delete mode 100644 LinphoneCoreException.java delete mode 100644 LinphoneCoreFactory.java delete mode 100644 LinphoneCoreListener.java delete mode 100644 LinphoneProxyConfig.java diff --git a/LinphoneAddress.java b/LinphoneAddress.java deleted file mode 100644 index 86271674c..000000000 --- a/LinphoneAddress.java +++ /dev/null @@ -1,46 +0,0 @@ -/* -LinphoneAddress.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -public interface LinphoneAddress { - /** - * Human display name - * @return null if not set - */ - public String getDisplayName(); - /** - * userinfo - * @return null if not set - */ - public String getUserName(); - /** - * - * @return null if not set - */ - public String getDomain(); - /** - * set display name - * @param name - */ - public void setDisplayName(String name); - /** - * @return an URI version of the address that can be used to place a call using {@link LinphoneCore#invite(String)} - */ - public String toUri(); -} diff --git a/LinphoneAuthInfo.java b/LinphoneAuthInfo.java deleted file mode 100644 index 2a5dbaf2d..000000000 --- a/LinphoneAuthInfo.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -LinphoneAuthInfo.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -public interface LinphoneAuthInfo { - -} - - diff --git a/LinphoneCallLog.java b/LinphoneCallLog.java deleted file mode 100644 index 19d851a43..000000000 --- a/LinphoneCallLog.java +++ /dev/null @@ -1,31 +0,0 @@ -/* -LinPhoneCallLog.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -public interface LinphoneCallLog { - public enum CallDirection { - CallOutgoing,Callincoming - } - - public LinphoneAddress getFrom(); - - public LinphoneAddress getTo (); - - public LinphoneCallLog.CallDirection getDirection(); -} diff --git a/LinphoneCore.java b/LinphoneCore.java deleted file mode 100644 index 8609e04e1..000000000 --- a/LinphoneCore.java +++ /dev/null @@ -1,177 +0,0 @@ -/* -LinphoneCore.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import java.util.List; - - - -public interface LinphoneCore { - /* - * linphone core states - */ - public enum GeneralState { - /* states for GSTATE_GROUP_POWER */ - GSTATE_POWER_OFF(0), /* initial state */ - GSTATE_POWER_STARTUP(1), - GSTATE_POWER_ON(2), - GSTATE_POWER_SHUTDOWN(3), - /* states for GSTATE_GROUP_REG */ - GSTATE_REG_NONE(10), /* initial state */ - GSTATE_REG_OK(11), - GSTATE_REG_FAILED(12), - /* states for GSTATE_GROUP_CALL */ - GSTATE_CALL_IDLE(20), /* initial state */ - GSTATE_CALL_OUT_INVITE(21), - GSTATE_CALL_OUT_CONNECTED(22), - GSTATE_CALL_IN_INVITE(23), - GSTATE_CALL_IN_CONNECTED(24), - GSTATE_CALL_END(25), - GSTATE_CALL_ERROR(26), - GSTATE_INVALID(27); - private final int mValue; - - GeneralState(int value) { - mValue = value; - } - public static GeneralState fromInt(int value) { - for (GeneralState state: GeneralState.values()) { - if (state.mValue == value) return state; - } - throw new RuntimeException("sate not found ["+value+"]"); - } - } - - - /** - * @param identity sip uri sip:jehan@linphone.org - * @param proxy sip uri (sip:linphone.org) - * @param route optionnal sip usi (sip:linphone.org) - * @param register should be initiated - * @return - */ - public LinphoneProxyConfig createProxyConfig(String identity,String proxy,String route,boolean enableRegister) throws LinphoneCoreException; - /** - * clear all added proxy config - */ - public void clearProxyConfigs(); - - public void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException; - - public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg); - - /** - * @return null if no default proxy config - */ - public LinphoneProxyConfig getDefaultProxyConfig() ; - - /** - * clear all the added auth info - */ - void clearAuthInfos(); - - void addAuthInfo(LinphoneAuthInfo info); - - public void invite(String uri); - - public void invite(LinphoneAddress to); - - public void terminateCall(); - /** - * get the remote address in case of in/out call - * @return null if no call engaged yet - */ - public LinphoneAddress getRemoteAddress(); - /** - * - * @return TRUE if there is a call running or pending. - */ - public boolean isIncall(); - /** - * - * @return Returns true if in incoming call is pending, ie waiting for being answered or declined. - */ - public boolean isInComingInvitePending(); - public void iterate(); - /** - * Accept an incoming call. - * - * Basically the application is notified of incoming calls within the - * {@link LinphoneCoreListener#inviteReceived(LinphoneCore, String)} listener. - * The application can later respond positively to the call using - * this method. - */ - public void acceptCall(); - - - /** - * @return a list of LinphoneCallLog - */ - public List getCallLogs(); - - /** - * This method is called by the application to notify the Linphone core library when network is reachable. - * Calling this method with true trigger Linphone to initiate a registration process for all proxy - * configuration with parameter register set to enable. - * This method disable the automatic registration mode. It means you must call this method after each network state changes - * @param network state - * - */ - public void setNetworkStateReachable(boolean isReachable); - /** - * destroy linphone core and free all underlying resources - */ - public void destroy(); - /** - * Allow to control play level before entering sound card: - * @param level in db - */ - public void setSoftPlayLevel(float gain); - /** - * get play level before entering sound card: - * @return level in db - */ - public float getSoftPlayLevel(); - /** - * Mutes or unmutes the local microphone. - * @param isMuted - */ - public void muteMic(boolean isMuted); - /** - * - * @return true is mic is muted - */ - public boolean isMicMuted(); - /** - * Build an address according to the current proxy config. In case destination is not a sip uri, the default proxy domain is automatically appended - * @param destination - * @return - * @throws If no LinphonrAddress can be built from destination - */ - public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException; - /** - * Initiate a dtmf signal if in call - * @param number - */ - public void sendDtmf(char number); - /** - * - */ - public void clearCallLogs(); -} diff --git a/LinphoneCoreException.java b/LinphoneCoreException.java deleted file mode 100644 index abec2943e..000000000 --- a/LinphoneCoreException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -LinphoneCoreException.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -@SuppressWarnings("serial") -public class LinphoneCoreException extends Exception { - - public LinphoneCoreException() { - // TODO Auto-generated constructor stub - } - - public LinphoneCoreException(String detailMessage) { - super(detailMessage); - // TODO Auto-generated constructor stub - } - - public LinphoneCoreException(Throwable throwable) { - super(throwable); - // TODO Auto-generated constructor stub - } - - public LinphoneCoreException(String detailMessage, Throwable throwable) { - super(detailMessage, throwable); - // TODO Auto-generated constructor stub - } - -} diff --git a/LinphoneCoreFactory.java b/LinphoneCoreFactory.java deleted file mode 100644 index 24315f6dd..000000000 --- a/LinphoneCoreFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -/* -LinphoneCoreFactory.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import java.io.File; -import java.io.IOException; - -public class LinphoneCoreFactory { - - static { - System.loadLibrary("linphone"); - } - static LinphoneCoreFactory theLinphoneCoreFactory = new LinphoneCoreFactory(); - - public static LinphoneCoreFactory instance() { - - return theLinphoneCoreFactory; - } - public LinphoneAuthInfo createAuthInfo(String username,String password) { - return new LinphoneAuthInfoImpl(username,password) ; - } - - public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { - return new LinphoneCoreImpl(listener,userConfig,factoryConfig,userdata); - } - - public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName) { - return new LinphoneAddressImpl(username,domain,displayName); - } - - /** - * Enable verbose traces - * @param enable - */ - public native void setDebugMode(boolean enable); - -} diff --git a/LinphoneCoreListener.java b/LinphoneCoreListener.java deleted file mode 100644 index f48f8a9eb..000000000 --- a/LinphoneCoreListener.java +++ /dev/null @@ -1,51 +0,0 @@ -/* -LinphoneCoreListener.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - - - -public interface LinphoneCoreListener { - - /**< Notifies the application that it should show up - * @return */ - public void show(LinphoneCore lc); - /**< Notifies incoming calls - * @return */ - public void inviteReceived(LinphoneCore lc,String from); - /**< Notify calls terminated by far end - * @return */ - public void byeReceived(LinphoneCore lc,String from); - /**< Ask the application some authentication information - * @return */ - public void authInfoRequested(LinphoneCore lc,String realm,String username); - /**< Callback that notifies various events with human readable text. - * @return */ - public void displayStatus(LinphoneCore lc,String message); - /**< Callback to display a message to the user - * @return */ - public void displayMessage(LinphoneCore lc,String message); - /** Callback to display a warning to the user - * @return */ - public void displayWarning(LinphoneCore lc,String message); - /** State notification callback - * @param state LinphoneCore.GeneralState - * @return - * */ - public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state); -} diff --git a/LinphoneProxyConfig.java b/LinphoneProxyConfig.java deleted file mode 100644 index a7fe6b850..000000000 --- a/LinphoneProxyConfig.java +++ /dev/null @@ -1,71 +0,0 @@ -/* -LinphoneProxyConfig.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -public interface LinphoneProxyConfig { - - /** - * Unregister proxy config a enable edition - */ - public void edit(); - /** - * Validate proxy config changes. Start registration in case - */ - public void done(); - /** - * sip user made by sip:username@domain - */ - public void setIdentity(String identity) throws LinphoneCoreException; - /** - * Set proxy uri, like sip:linphone.org:5060 - * @param proxyUri - * @throws LinphoneCoreException - */ - public void setProxy(String proxyUri) throws LinphoneCoreException; - /** - * Enable register for this proxy config. - * Register message is issued after call to {@link #done()} - * @param value - * @throws LinphoneCoreException - */ - public void enableRegister(boolean value) throws LinphoneCoreException; - /** - * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222 - * @param number - * @return - */ - public String normalizePhoneNumber(String number); - /** - * usefull function to automatically add internationnal prefix to e164 phone numbers - * @param prefix - */ - public void setDialPrefix(String prefix); - /** - * * Sets whether liblinphone should replace "+" by "00" in dialed numbers (passed to - * {@link LinphoneCore#invite(String)}). - * @param value default value is false - */ - public void setDialEscapePlus(boolean value); - - /** - * rget domain host name or ip - * @return may be null - */ - public String getDomain(); -} From bf88d70ea31a78e142541555d6951966dd5e706d Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 8 Apr 2010 11:09:05 +0200 Subject: [PATCH 020/769] fix crash on simulator when setting display name --- LinphoneAddressImpl.java | 6 +++++- LinphoneCoreImpl.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java index ed879338c..3f11322ed 100644 --- a/LinphoneAddressImpl.java +++ b/LinphoneAddressImpl.java @@ -29,13 +29,17 @@ public class LinphoneAddressImpl implements LinphoneAddress { private native String getUserName(long ptr); private native String getDomain(long ptr); private native String toUri(long ptr); - private native String setDisplayName(long ptr,String name); + private native void setDisplayName(long ptr,String name); private native String toString(long ptr); protected LinphoneAddressImpl(String username,String domain,String displayName) { nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); } + protected LinphoneAddressImpl(long aNativePtr,boolean javaOwnPtr) { + nativePtr = aNativePtr; + ownPtr=javaOwnPtr; + } protected LinphoneAddressImpl(long aNativePtr) { nativePtr = aNativePtr; ownPtr=false; diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index a1087f24d..9768066cc 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -177,7 +177,7 @@ class LinphoneCoreImpl implements LinphoneCore { public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException { long lAddress = interpretUrl(nativePtr,destination); if (lAddress != 0) { - return new LinphoneAddressImpl(lAddress); + return new LinphoneAddressImpl(lAddress,true); } else { throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); } From a9a5d5d19a65d49fa07819a9434a44dc67d0d775 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 27 Apr 2010 14:59:03 +0200 Subject: [PATCH 021/769] Refactor LinphonecoreFactory --- LinphoneAuthInfoImpl.java | 25 +++++++++++++++++++++++++ LinphoneCoreImpl.java | 5 +---- LinphoneProxyConfigImpl.java | 15 +++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/LinphoneAuthInfoImpl.java b/LinphoneAuthInfoImpl.java index 719101883..fcea4900c 100644 --- a/LinphoneAuthInfoImpl.java +++ b/LinphoneAuthInfoImpl.java @@ -28,4 +28,29 @@ class LinphoneAuthInfoImpl implements LinphoneAuthInfo { protected void finalize() throws Throwable { delete(nativePtr); } + public String getPassword() { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + } + public String getRealm() { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + } + public String getUsername() { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + } + public void setPassword(String password) { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + + } + public void setRealm(String realm) { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + } + public void setUsername(String username) { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 9768066cc..d752cfdc0 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -72,10 +72,7 @@ class LinphoneCoreImpl implements LinphoneCore { addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr); } - public synchronized LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException { - isValid(); - return new LinphoneProxyConfigImpl(identity, proxy, route,enableRegister); - } + public synchronized LinphoneProxyConfig getDefaultProxyConfig() { isValid(); diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 11e746946..90cc16bfb 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -97,4 +97,19 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public void setDialEscapePlus(boolean value) { setDialEscapePlus(nativePtr,value); } + public String getIdentity() { + throw new RuntimeException("not implemeneted yet"); + } + public String getProxy() { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + } + public boolean isRegistered() { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + } + public boolean registerEnabled() { + // TODO Auto-generated method stub + throw new RuntimeException("not implemeneted yet"); + } } From 41510592f2ef088cd205f67738203c06f8d67bb8 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Sun, 2 May 2010 19:23:44 +0200 Subject: [PATCH 022/769] add status bar --- LinphoneAddressImpl.java | 27 +++++++++++++++ LinphoneAuthInfoImpl.java | 4 +-- LinphoneCallLogImpl.java | 2 +- LinphoneCoreFactoryImpl.java | 65 ++++++++++++++++++++++++++++++++++++ LinphoneCoreImpl.java | 7 ++-- LinphoneProxyConfigImpl.java | 16 +++++---- 6 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 LinphoneCoreFactoryImpl.java diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java index 3f11322ed..bf4670ec3 100644 --- a/LinphoneAddressImpl.java +++ b/LinphoneAddressImpl.java @@ -66,5 +66,32 @@ public class LinphoneAddressImpl implements LinphoneAddress { public void setDisplayName(String name) { setDisplayName(nativePtr,name); } + public String asString() { + return toString(); + } + public String asStringUriOnly() { + return toUri(nativePtr); + } + public void clean() { + throw new RuntimeException("Not implemented"); + } + public String getPort() { + return String.valueOf(getPortInt()); + } + public int getPortInt() { + return getPortInt(); + } + public void setDomain(String domain) { + throw new RuntimeException("Not implemented"); + } + public void setPort(String port) { + throw new RuntimeException("Not implemented"); + } + public void setPortInt(int port) { + throw new RuntimeException("Not implemented"); + } + public void setUserName(String username) { + throw new RuntimeException("Not implemented"); + } } diff --git a/LinphoneAuthInfoImpl.java b/LinphoneAuthInfoImpl.java index fcea4900c..7f9e54dd2 100644 --- a/LinphoneAuthInfoImpl.java +++ b/LinphoneAuthInfoImpl.java @@ -22,8 +22,8 @@ class LinphoneAuthInfoImpl implements LinphoneAuthInfo { protected final long nativePtr; private native long newLinphoneAuthInfo(String username, String userid, String passwd, String ha1,String realm); private native void delete(long ptr); - protected LinphoneAuthInfoImpl(String username,String password) { - nativePtr = newLinphoneAuthInfo(username,null,password,null,null); + protected LinphoneAuthInfoImpl(String username,String password, String realm) { + nativePtr = newLinphoneAuthInfo(username,null,password,null,realm); } protected void finalize() throws Throwable { delete(nativePtr); diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index c35eea2c7..b0360d194 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -32,7 +32,7 @@ class LinphoneCallLogImpl implements LinphoneCallLog { public CallDirection getDirection() { - return isIncoming(nativePtr)?CallDirection.Callincoming:CallDirection.CallOutgoing; + return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing; } public LinphoneAddress getFrom() { diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java new file mode 100644 index 000000000..a34eabcae --- /dev/null +++ b/LinphoneCoreFactoryImpl.java @@ -0,0 +1,65 @@ +/* +LinphoneCoreFactoryImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.io.File; +import java.io.IOException; + +public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { + + static { + System.loadLibrary("linphone"); + } + @Override + public LinphoneAuthInfo createAuthInfo(String username, String password, + String realm) { + return new LinphoneAuthInfoImpl(username,password,realm); + } + + @Override + public LinphoneAddress createLinphoneAddress(String username, + String domain, String displayName) { + return new LinphoneAddressImpl(username,domain,displayName); + } + + @Override + public LinphoneAddress createLinphoneAddress(String address) { + throw new RuntimeException("Not implemeneted yet"); + } + + @Override + public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, + String userConfig, String factoryConfig, Object userdata) + throws LinphoneCoreException { + try { + return new LinphoneCoreImpl(listener,new File(userConfig),new File(factoryConfig),userdata); + } catch (IOException e) { + throw new LinphoneCoreException("Cannot create LinphoneCore",e); + } + } + + @Override + public LinphoneProxyConfig createProxyConfig(String identity, String proxy, + String route, boolean enableRegister) throws LinphoneCoreException { + return new LinphoneProxyConfigImpl(identity,proxy,route,enableRegister); + } + + @Override + public native void setDebugMode(boolean enable); +} diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index d752cfdc0..547e4bc0d 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,8 +20,7 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import java.util.Vector; class LinphoneCoreImpl implements LinphoneCore { @@ -139,9 +138,9 @@ class LinphoneCoreImpl implements LinphoneCore { acceptCall(nativePtr); } - public synchronized List getCallLogs() { + public synchronized Vector getCallLogs() { isValid(); - List logs = new ArrayList(); + Vector logs = new Vector(); for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr, i))); } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 90cc16bfb..01080bfc0 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -52,10 +52,15 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native void done(long ptr); private native void setIdentity(long ptr,String identity); + private native String getIdentity(long ptr); private native int setProxy(long ptr,String proxy); + private native String getProxy(long ptr); + private native void enableRegister(long ptr,boolean value); + private native boolean isRegisterEnabled(long ptr); + private native boolean isRegistered(long ptr); private native void setDialPrefix(long ptr, String prefix); private native String normalizePhoneNumber(long ptr,String number); @@ -98,18 +103,15 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { setDialEscapePlus(nativePtr,value); } public String getIdentity() { - throw new RuntimeException("not implemeneted yet"); + return getIdentity(nativePtr); } public String getProxy() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); + return getProxy(nativePtr); } public boolean isRegistered() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); + return isRegistered(nativePtr); } public boolean registerEnabled() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); + return isRegisterEnabled(nativePtr); } } From 75f5c45f15d6c185a941911bbac779339cf2c79b Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 18 Jun 2010 11:01:12 +0200 Subject: [PATCH 023/769] add codec management start OUTGOING Call intent management --- LinphoneCoreFactoryImpl.java | 6 ++++++ LinphoneCoreImpl.java | 18 +++++++++++++++++- LinphoneProxyConfigImpl.java | 11 +++++++++++ PayloadTypeImpl.java | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 PayloadTypeImpl.java diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index a34eabcae..712e27b63 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -62,4 +62,10 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { @Override public native void setDebugMode(boolean enable); + + @Override + public void setLogHandler(LinphoneLogHandler handler) { + //not implemented on Android + + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 547e4bc0d..376831473 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -56,7 +56,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void sendDtmf(long nativePtr,char dtmf); private native void clearCallLogs(long nativePtr); private native boolean isMicMuted(long nativePtr); - + private native long findPayloadType(long nativePtr, String mime, int clockRate); + private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -190,4 +191,19 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isMicMuted() { return isMicMuted(nativePtr); } + public PayloadType findPayloadType(String mime, int clockRate) { + long playLoadType = findPayloadType(nativePtr, mime, clockRate); + if (playLoadType == 0) { + return null; + } else { + return new PayloadTypeImpl(playLoadType); + } + } + public void enablePayloadType(PayloadType pt, boolean enable) + throws LinphoneCoreException { + if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) { + throw new LinphoneCoreException("cannot enable payload type ["+pt+"]"); + } + + } } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 01080bfc0..7ffb164b2 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -69,6 +69,9 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native void setDialEscapePlus(long ptr, boolean value); + private native String getRoute(long ptr); + private native int setRoute(long ptr,String uri); + public void enableRegister(boolean value) { enableRegister(nativePtr,value); } @@ -114,4 +117,12 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public boolean registerEnabled() { return isRegisterEnabled(nativePtr); } + public String getRoute() { + return getRoute(nativePtr); + } + public void setRoute(String routeUri) throws LinphoneCoreException { + if (setRoute(nativePtr, routeUri) != 0) { + throw new LinphoneCoreException("cannot set route ["+routeUri+"]"); + } + } } diff --git a/PayloadTypeImpl.java b/PayloadTypeImpl.java new file mode 100644 index 000000000..28c206786 --- /dev/null +++ b/PayloadTypeImpl.java @@ -0,0 +1,34 @@ +/* +PayloadTypeImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +package org.linphone.core; + +class PayloadTypeImpl implements PayloadType { + + protected final long nativePtr; + + private native String toString(long ptr); + + protected PayloadTypeImpl(long aNativePtr) { + nativePtr = aNativePtr; + } + public String toString() { + return toString(nativePtr); + } +} From 963ba861443223fcad75adcaf5f700f660abbf75 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 28 Jun 2010 17:34:55 +0200 Subject: [PATCH 024/769] add EC support --- LinphoneCoreImpl.java | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 376831473..55d25dbe1 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -48,8 +48,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native int getNumberOfCallLogs(long nativePtr); private native void delete(long nativePtr); private native void setNetworkStateReachable(long nativePtr,boolean isReachable); - private native void setSoftPlayLevel(long nativeptr, float gain); - private native float getSoftPlayLevel(long nativeptr); + private native void setPlaybackGain(long nativeptr, float gain); + private native float getPlaybackGain(long nativeptr); private native void muteMic(long nativePtr,boolean isMuted); private native long interpretUrl(long nativePtr,String destination); private native void inviteAddress(long nativePtr,long to); @@ -58,6 +58,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native boolean isMicMuted(long nativePtr); private native long findPayloadType(long nativePtr, String mime, int clockRate); private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); + private native void enableEchoCancellation(long nativePtr,boolean enable); + private native boolean isEchoCancellationEnabled(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -161,12 +163,12 @@ class LinphoneCoreImpl implements LinphoneCore { public void setNetworkStateReachable(boolean isReachable) { setNetworkStateReachable(nativePtr,isReachable); } - public void setSoftPlayLevel(float gain) { - setSoftPlayLevel(nativePtr,gain); + public void setPlaybackGain(float gain) { + setPlaybackGain(nativePtr,gain); } - public float getSoftPlayLevel() { - return getSoftPlayLevel(nativePtr); + public float getPlaybackGain() { + return getPlaybackGain(nativePtr); } public void muteMic(boolean isMuted) { muteMic(nativePtr,isMuted); @@ -192,6 +194,7 @@ class LinphoneCoreImpl implements LinphoneCore { return isMicMuted(nativePtr); } public PayloadType findPayloadType(String mime, int clockRate) { + isValid(); long playLoadType = findPayloadType(nativePtr, mime, clockRate); if (playLoadType == 0) { return null; @@ -201,9 +204,19 @@ class LinphoneCoreImpl implements LinphoneCore { } public void enablePayloadType(PayloadType pt, boolean enable) throws LinphoneCoreException { + isValid(); if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) { throw new LinphoneCoreException("cannot enable payload type ["+pt+"]"); } } + public void enableEchoCancellation(boolean enable) { + isValid(); + enableEchoCancellation(nativePtr, enable); + } + public boolean isEchoCancellationEnabled() { + isValid(); + return isEchoCancellationEnabled(nativePtr); + + } } From 728865a441ce591c34254d10f07b0ba3dcee0f07 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 13 Sep 2010 23:44:29 +0200 Subject: [PATCH 025/769] new liblinphonne multi call api inband dtmf is pcm codec play dtmf on digit pressed --- LinphoneCallImpl.java | 63 +++++++++++++++++++++++++++++++++++ LinphoneCoreImpl.java | 76 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 127 insertions(+), 12 deletions(-) create mode 100644 LinphoneCallImpl.java diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java new file mode 100644 index 000000000..c71883b57 --- /dev/null +++ b/LinphoneCallImpl.java @@ -0,0 +1,63 @@ +/* +LinphoneCallImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + + +class LinphoneCallImpl implements LinphoneCall { + + protected final long nativePtr; + boolean ownPtr = false; + native private void ref(long ownPtr); + native private void unref(long ownPtr); + native private long getCallLog(long nativePtr); + private native boolean isIncoming(long nativePtr); + native private long getRemoteAddress(long nativePtr); + native private int getState(long nativePtr); + protected LinphoneCallImpl(long aNativePtr) { + nativePtr = aNativePtr; + ref(nativePtr); + } + protected void finalize() throws Throwable { + unref(nativePtr); + } + public LinphoneCallLog getCallLog() { + long lNativePtr = getCallLog(nativePtr); + if (lNativePtr!=0) { + return new LinphoneCallLogImpl(lNativePtr); + } else { + return null; + } + } + public CallDirection getDirection() { + return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing; + } + public LinphoneAddress getRemoteAddress() { + long lNativePtr = getRemoteAddress(nativePtr); + if (lNativePtr!=0) { + return new LinphoneAddressImpl(lNativePtr); + } else { + return null; + } + } + public State getState() { + return LinphoneCall.State.fromInt(getState(nativePtr)); + } + + +} diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 55d25dbe1..e042b3951 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -38,12 +38,12 @@ class LinphoneCoreImpl implements LinphoneCore { private native void clearProxyConfigs(long nativePtr); private native void addAuthInfo(long nativePtr,long authInfoNativePtr); - private native void invite(long nativePtr,String uri); - private native void terminateCall(long nativePtr); + private native long invite(long nativePtr,String uri); + private native void terminateCall(long nativePtr, long call); private native long getRemoteAddress(long nativePtr); private native boolean isInCall(long nativePtr); private native boolean isInComingInvitePending(long nativePtr); - private native void acceptCall(long nativePtr); + private native void acceptCall(long nativePtr, long call); private native long getCallLog(long nativePtr,int position); private native int getNumberOfCallLogs(long nativePtr); private native void delete(long nativePtr); @@ -52,7 +52,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native float getPlaybackGain(long nativeptr); private native void muteMic(long nativePtr,boolean isMuted); private native long interpretUrl(long nativePtr,String destination); - private native void inviteAddress(long nativePtr,long to); + private native long inviteAddress(long nativePtr,long to); private native void sendDtmf(long nativePtr,char dtmf); private native void clearCallLogs(long nativePtr); private native boolean isMicMuted(long nativePtr); @@ -60,6 +60,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr); + private native long getCurrentCall(long nativePtr) ; + private native void playDtmf(long nativePtr,char dtmf,int duration); + private native void stopDtmf(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -86,9 +89,14 @@ class LinphoneCoreImpl implements LinphoneCore { } } - public synchronized void invite(String uri) { + public synchronized LinphoneCall invite(String uri) { isValid(); - invite(nativePtr,uri); + long lNativePtr = invite(nativePtr,uri); + if (lNativePtr!=0) { + return new LinphoneCallImpl(lNativePtr); + } else { + return null; + } } public synchronized void iterate() { @@ -115,9 +123,9 @@ class LinphoneCoreImpl implements LinphoneCore { isValid(); clearProxyConfigs(nativePtr); } - public synchronized void terminateCall() { + public synchronized void terminateCall(LinphoneCall aCall) { isValid(); - terminateCall(nativePtr); + if (aCall!=null)terminateCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr); } public synchronized LinphoneAddress getRemoteAddress() { isValid(); @@ -136,9 +144,9 @@ class LinphoneCoreImpl implements LinphoneCore { isValid(); return isInComingInvitePending(nativePtr); } - public synchronized void acceptCall() { + public synchronized void acceptCall(LinphoneCall aCall) { isValid(); - acceptCall(nativePtr); + acceptCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr); } public synchronized Vector getCallLogs() { @@ -181,8 +189,13 @@ class LinphoneCoreImpl implements LinphoneCore { throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); } } - public void invite(LinphoneAddress to) { - inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); + public LinphoneCall invite(LinphoneAddress to) { + long lNativePtr = inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); + if (lNativePtr!=0) { + return new LinphoneCallImpl(lNativePtr); + } else { + return null; + } } public void sendDtmf(char number) { sendDtmf(nativePtr,number); @@ -219,4 +232,43 @@ class LinphoneCoreImpl implements LinphoneCore { return isEchoCancellationEnabled(nativePtr); } + + public synchronized LinphoneCall getCurrentCall() { + isValid(); + long lNativePtr = getCurrentCall(nativePtr); + if (lNativePtr!=0) { + return new LinphoneCallImpl(lNativePtr); + } else { + return null; + } + } + + public int getPlayLevel() { + // TODO Auto-generated method stub + return 0; + } + public void setPlayLevel(int level) { + // TODO Auto-generated method stub + + } + public void setSignalingTransport(Transport aTransport) { + // TODO Auto-generated method stub + + } + public void enableSpeaker(boolean value) { + // TODO Auto-generated method stub + + } + public boolean isSpeakerEnabled() { + // TODO Auto-generated method stub + return false; + } + public void playDtmf(char number, int duration) { + playDtmf(nativePtr,number, duration); + + } + public void stopDtmf() { + stopDtmf(nativePtr); + } + } From 2804666ea8ea99e72dcee3cca6c12837fcee1288 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 22 Oct 2010 18:33:55 +0200 Subject: [PATCH 026/769] add presence and messaging apis --- LinphoneCoreFactoryImpl.java | 10 ++++++++++ LinphoneCoreImpl.java | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 712e27b63..a6f899f31 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -68,4 +68,14 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { //not implemented on Android } + + @Override + LinphoneFriend createLinphoneFriend(String friendUri) { + return new LinphoneFriendImpl(friendUri); + } + + @Override + LinphoneFriend createLinphoneFriend() { + return createLinphoneFriend(null); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index e042b3951..0143dc7d5 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -64,6 +64,10 @@ class LinphoneCoreImpl implements LinphoneCore { private native void playDtmf(long nativePtr,char dtmf,int duration); private native void stopDtmf(long nativePtr); + private native void addFriend(long nativePtr,long friend); + private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status); + private native long createChatRoom(long nativePtr,String to); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -270,5 +274,18 @@ class LinphoneCoreImpl implements LinphoneCore { public void stopDtmf() { stopDtmf(nativePtr); } + + public void addFriend(LinphoneFriend lf) throws LinphoneCoreException { + addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr); + + } + public void setPresenceInfo(int minute_away, String alternative_contact, + OnlineStatus status) { + setPresenceInfo(nativePtr,minute_away,alternative_contact,status.mValue); + + } + public LinphoneChatRoom createChatRoom(String to) { + return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to)); + } } From ef61932d1d4dda7ed063fa33bc1ec9b19b4136c7 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 22 Oct 2010 18:36:22 +0200 Subject: [PATCH 027/769] Merge branch 'master' of belledonne-communications.com:linphone-android --- LinphoneChatRoomImpl.java | 37 ++++++++++++++++++ LinphoneFriendImpl.java | 80 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 LinphoneChatRoomImpl.java create mode 100644 LinphoneFriendImpl.java diff --git a/LinphoneChatRoomImpl.java b/LinphoneChatRoomImpl.java new file mode 100644 index 000000000..76874675d --- /dev/null +++ b/LinphoneChatRoomImpl.java @@ -0,0 +1,37 @@ +/* +LinphoneChatRoomImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +class LinphoneChatRoomImpl implements LinphoneChatRoom { + protected final long nativePtr; + private native long getPeerAddress(long ptr); + private native void sendMessage(long ptr, String message); + + protected LinphoneChatRoomImpl(long aNativePtr) { + nativePtr = aNativePtr; + } + + public LinphoneAddress getPeerAddress() { + return new LinphoneAddressImpl(getPeerAddress(nativePtr)); + } + + public void sendMessage(String message) { + sendMessage(nativePtr,message); + } +} diff --git a/LinphoneFriendImpl.java b/LinphoneFriendImpl.java new file mode 100644 index 000000000..bae44679f --- /dev/null +++ b/LinphoneFriendImpl.java @@ -0,0 +1,80 @@ +/* +LinphoneFriendImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +class LinphoneFriendImpl implements LinphoneFriend { + protected final long nativePtr; + private native long newLinphoneFriend(String friendUri); + private native void setAddress(long nativePtr,long friend); + private native long getAddress(long nativePtr); + private native void setIncSubscribePolicy(long nativePtr,int enumValue); + private native int getIncSubscribePolicy(long nativePtr); + private native void enableSubscribes(long nativePtr,boolean value); + private native boolean isSubscribesEnabled(long nativePtr); + private native int getStatus(long nativePtr); + private native void edit(long nativePtr); + private native void done(long nativePtr); + + private native void delete(long ptr); + boolean ownPtr = false; + protected LinphoneFriendImpl() { + nativePtr = newLinphoneFriend(null); + } + protected LinphoneFriendImpl(String friendUri) { + nativePtr = newLinphoneFriend(friendUri); + } + protected LinphoneFriendImpl(long aNativePtr) { + nativePtr = aNativePtr; + ownPtr=false; + } + protected void finalize() throws Throwable { + if (ownPtr) delete(nativePtr); + } + public void setAddress(LinphoneAddress anAddress) { + this.setAddress(nativePtr, ((LinphoneAddressImpl)anAddress).nativePtr); + + } + public LinphoneAddress getAddress() { + return new LinphoneAddressImpl(getAddress(nativePtr)); + } + public void setIncSubscribePolicy(SubscribePolicy policy) { + setIncSubscribePolicy(nativePtr,policy.mValue); + + } + public SubscribePolicy getIncSubscribePolicy() { + return SubscribePolicy.fromInt(getIncSubscribePolicy(nativePtr)) ; + } + public void enableSubscribes(boolean enable) { + enableSubscribes(nativePtr, enable); + } + public boolean isSubscribesEnabled() { + return isSubscribesEnabled(nativePtr); + } + + public OnlineStatus getStatus() { + return OnlineStatus.fromInt(getStatus(nativePtr)); + } + public void edit() { + edit(nativePtr); + } + public void done() { + done(nativePtr); + } + +} From 4fb072b0a1d9f64bf4236751d3ed1f877e243d7e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 26 Oct 2010 11:13:29 +0200 Subject: [PATCH 028/769] adapt to api addons --- LinphoneCoreFactoryImpl.java | 12 ++++++++++++ LinphoneCoreImpl.java | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 712e27b63..e86f0b100 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -68,4 +68,16 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { //not implemented on Android } + + @Override + LinphoneFriend createLinphoneFriend(String friendUri) { + // TODO Auto-generated method stub + return null; + } + + @Override + LinphoneFriend createLinphoneFriend() { + // TODO Auto-generated method stub + return null; + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index e042b3951..223a52fdc 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -270,5 +270,18 @@ class LinphoneCoreImpl implements LinphoneCore { public void stopDtmf() { stopDtmf(nativePtr); } + public void addFriend(LinphoneFriend lf) throws LinphoneCoreException { + // TODO Auto-generated method stub + + } + public LinphoneChatRoom createChatRoom(String to) { + // TODO Auto-generated method stub + return null; + } + public void setPresenceInfo(int minuteAway, String alternativeContact, + OnlineStatus status) { + // TODO Auto-generated method stub + + } } From ff57fa0a2891ce3cc9de773a8c922e7ffa7547c3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Nov 2010 11:33:21 +0100 Subject: [PATCH 029/769] video in progress --- AndroidVideoWindowImpl.java | 75 +++++++++++++++++++++++++++++++++++++ LinphoneCoreImpl.java | 32 ++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 AndroidVideoWindowImpl.java diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java new file mode 100644 index 000000000..f1927e184 --- /dev/null +++ b/AndroidVideoWindowImpl.java @@ -0,0 +1,75 @@ +package org.linphone.core; + +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Bitmap.Config; +import android.view.Surface; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.Surface.OutOfResourcesException; +import android.view.SurfaceHolder.Callback; + +public class AndroidVideoWindowImpl implements VideoWindow { + private Bitmap mBitmap; + private SurfaceView mView; + private Surface mSurface; + private VideoWindowListener mListener; + public static interface VideoWindowListener{ + void onSurfaceReady(AndroidVideoWindowImpl vw); + void onSurfaceDestroyed(AndroidVideoWindowImpl vw); + }; + public AndroidVideoWindowImpl(SurfaceView view){ + mView=view; + mBitmap=null; + mSurface=null; + mListener=null; + view.getHolder().addCallback(new Callback(){ + public void surfaceChanged(SurfaceHolder holder, int format, + int width, int height) { + synchronized(AndroidVideoWindowImpl.this){ + mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565); + if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); + mSurface=holder.getSurface(); + } + } + + public void surfaceCreated(SurfaceHolder holder) { + } + + public void surfaceDestroyed(SurfaceHolder holder) { + synchronized(AndroidVideoWindowImpl.this){ + mBitmap=null; + if (mListener!=null) + mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); + mSurface=null; + } + } + }); + } + public void setListener(VideoWindowListener l){ + mListener=l; + } + public Surface getSurface(){ + return mView.getHolder().getSurface(); + } + public Bitmap getBitmap(){ + return mBitmap; + } + //Called by the mediastreamer2 android display filter + public synchronized void update(){ + if (mSurface!=null){ + try { + Canvas canvas=mSurface.lockCanvas(null); + canvas.drawBitmap(mBitmap, 0, 0, null); + mSurface.unlockCanvasAndPost(canvas); + + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OutOfResourcesException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } +} diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 223a52fdc..aad67304a 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -63,6 +63,10 @@ class LinphoneCoreImpl implements LinphoneCore { private native long getCurrentCall(long nativePtr) ; private native void playDtmf(long nativePtr,char dtmf,int duration); private native void stopDtmf(long nativePtr); + private native void setVideoWindowId(long nativePtr, Object wid); + private native void setPreviewWindowId(long nativePtr, Object wid); + private AndroidVideoWindowImpl mVideoWindow; + private AndroidVideoWindowImpl mPreviewWindow; LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -283,5 +287,33 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub } + public void setPreviewWindow(VideoWindow w) { + if (mPreviewWindow!=null) + mPreviewWindow.setListener(null); + mPreviewWindow=(AndroidVideoWindowImpl)w; + mPreviewWindow.setListener(new AndroidVideoWindowImpl.VideoWindowListener(){ + public void onSurfaceDestroyed(AndroidVideoWindowImpl vw) { + setPreviewWindowId(nativePtr,null); + } + + public void onSurfaceReady(AndroidVideoWindowImpl vw) { + setPreviewWindowId(nativePtr,vw); + } + }); + } + public void setVideoWindow(VideoWindow w) { + if (mVideoWindow!=null) + mVideoWindow.setListener(null); + mVideoWindow=(AndroidVideoWindowImpl)w; + mVideoWindow.setListener(new AndroidVideoWindowImpl.VideoWindowListener(){ + public void onSurfaceDestroyed(AndroidVideoWindowImpl vw) { + setVideoWindowId(nativePtr,null); + } + + public void onSurfaceReady(AndroidVideoWindowImpl vw) { + setVideoWindowId(nativePtr,vw); + } + }); + } } From d68b8fb8ea8a085c9d467bbd2788bec10591927a Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 5 Nov 2010 17:42:40 +0100 Subject: [PATCH 030/769] Added activities to support java port of the C tutorials. --- LinphoneAddressImpl.java | 3 + LinphoneCoreFactoryImpl.java | 17 +++- LinphoneCoreImpl.java | 14 +++ tutorials/AndroidTutorialNotifier.java | 49 +++++++++ tutorials/TutorialBuddyStatusActivity.java | 98 ++++++++++++++++++ tutorials/TutorialChatRoomActivity.java | 98 ++++++++++++++++++ tutorials/TutorialHelloWorldActivity.java | 98 ++++++++++++++++++ tutorials/TutorialRegistrationActivity.java | 105 ++++++++++++++++++++ 8 files changed, 478 insertions(+), 4 deletions(-) create mode 100644 tutorials/AndroidTutorialNotifier.java create mode 100644 tutorials/TutorialBuddyStatusActivity.java create mode 100644 tutorials/TutorialChatRoomActivity.java create mode 100644 tutorials/TutorialHelloWorldActivity.java create mode 100644 tutorials/TutorialRegistrationActivity.java diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java index bf4670ec3..b9d290971 100644 --- a/LinphoneAddressImpl.java +++ b/LinphoneAddressImpl.java @@ -32,6 +32,9 @@ public class LinphoneAddressImpl implements LinphoneAddress { private native void setDisplayName(long ptr,String name); private native String toString(long ptr); + protected LinphoneAddressImpl(String identity) { + nativePtr = newLinphoneAddressImpl(identity, null); + } protected LinphoneAddressImpl(String username,String domain,String displayName) { nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index a6f899f31..1b4e9aaf0 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -39,8 +39,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } @Override - public LinphoneAddress createLinphoneAddress(String address) { - throw new RuntimeException("Not implemeneted yet"); + public LinphoneAddress createLinphoneAddress(String identity) { + return new LinphoneAddressImpl(identity); } @Override @@ -54,6 +54,15 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } } + @Override + public LinphoneCore createLinphoneCore(LinphoneCoreListener listener) throws LinphoneCoreException { + try { + return new LinphoneCoreImpl(listener); + } catch (IOException e) { + throw new LinphoneCoreException("Cannot create LinphoneCore",e); + } + } + @Override public LinphoneProxyConfig createProxyConfig(String identity, String proxy, String route, boolean enableRegister) throws LinphoneCoreException { @@ -70,12 +79,12 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } @Override - LinphoneFriend createLinphoneFriend(String friendUri) { + public LinphoneFriend createLinphoneFriend(String friendUri) { return new LinphoneFriendImpl(friendUri); } @Override - LinphoneFriend createLinphoneFriend() { + public LinphoneFriend createLinphoneFriend() { return createLinphoneFriend(null); } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 0143dc7d5..83a78a00e 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -72,6 +72,11 @@ class LinphoneCoreImpl implements LinphoneCore { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); } + LinphoneCoreImpl(LinphoneCoreListener listener) throws IOException { + mListener=listener; + nativePtr = newLinphoneCore(listener,null,null,null); + } + protected void finalize() throws Throwable { } @@ -287,5 +292,14 @@ class LinphoneCoreImpl implements LinphoneCore { public LinphoneChatRoom createChatRoom(String to) { return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to)); } + public void setPreviewWindow(VideoWindow w) { + throw new RuntimeException("not implemented yet"); + // TODO Auto-generated method stub + + } + public void setVideoWindow(VideoWindow w) { + throw new RuntimeException("not implemented yet"); + // TODO Auto-generated method stub + } } diff --git a/tutorials/AndroidTutorialNotifier.java b/tutorials/AndroidTutorialNotifier.java new file mode 100644 index 000000000..01e0555e2 --- /dev/null +++ b/tutorials/AndroidTutorialNotifier.java @@ -0,0 +1,49 @@ +/* +AndroidTutorialNotifier.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.tutorials; + +import android.os.Handler; +import android.widget.TextView; + +/** + * Write notifications to a TextView widget. + * + * @author Guillaume Beraudo + * + */ +public class AndroidTutorialNotifier extends TutorialNotifier { + + private Handler mHandler; + private TextView outputTextView; + + public AndroidTutorialNotifier(Handler mHandler, final TextView outputTextView) { + this.mHandler = mHandler; + this.outputTextView = outputTextView; + } + + + @Override + public void notify(final String s) { + mHandler.post(new Runnable() { + public void run() { + outputTextView.setText(s + "\n" + outputTextView.getText()); + } + }); + } +} diff --git a/tutorials/TutorialBuddyStatusActivity.java b/tutorials/TutorialBuddyStatusActivity.java new file mode 100644 index 000000000..376afadfb --- /dev/null +++ b/tutorials/TutorialBuddyStatusActivity.java @@ -0,0 +1,98 @@ +/* +TutorialBuddyStatusActivity.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.tutorials; + +import org.linphone.R; +import org.linphone.core.LinphoneCoreException; + +import android.app.Activity; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +/** + * Activity for displaying and starting the BuddyStatus example on Android phone. + * + * @author Guillaume Beraudo + * + */ +public class TutorialBuddyStatusActivity extends Activity { + + private static final String defaultSipAddress = "sip:tested@10.0.2.6:5059"; + private TextView sipAddressWidget; + private TutorialBuddyStatus tutorial; + private Handler mHandler = new Handler() ; + private Button buttonCall; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.hello_world); + sipAddressWidget = (TextView) findViewById(R.id.AddressId); + sipAddressWidget.setText(defaultSipAddress); + + // Output text to the outputText widget + final TextView outputText = (TextView) findViewById(R.id.OutputText); + final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); + + + // Create BuddyStatus object + tutorial = new TutorialBuddyStatus(notifier); + + + + // Assign call action to call button + buttonCall = (Button) findViewById(R.id.CallButton); + buttonCall.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + TutorialLaunchingThread thread = new TutorialLaunchingThread(); + buttonCall.setEnabled(false); + thread.start(); + } + }); + + // Assign stop action to stop button + Button buttonStop = (Button) findViewById(R.id.ButtonStop); + buttonStop.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + tutorial.stopMainLoop(); + } + }); + } + + + private class TutorialLaunchingThread extends Thread { + @Override + public void run() { + super.run(); + try { + tutorial.launchTutorial(sipAddressWidget.getText().toString()); + mHandler.post(new Runnable() { + public void run() { + buttonCall.setEnabled(true); + } + }); + } catch (LinphoneCoreException e) { + e.printStackTrace(); + } + } + } +} diff --git a/tutorials/TutorialChatRoomActivity.java b/tutorials/TutorialChatRoomActivity.java new file mode 100644 index 000000000..aa4623eeb --- /dev/null +++ b/tutorials/TutorialChatRoomActivity.java @@ -0,0 +1,98 @@ +/* +TutorialChatRoomActivity.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.tutorials; + +import org.linphone.R; +import org.linphone.core.LinphoneCoreException; + +import android.app.Activity; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +/** + * Activity for displaying and starting the chatroom example on Android phone. + * + * @author Guillaume Beraudo + * + */ +public class TutorialChatRoomActivity extends Activity { + + private static final String defaultSipAddress = "sip:tested@10.0.2.6:5059"; + private TextView sipAddressWidget; + private TutorialChatRoom tutorial; + private Handler mHandler = new Handler() ; + private Button buttonCall; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.hello_world); + sipAddressWidget = (TextView) findViewById(R.id.AddressId); + sipAddressWidget.setText(defaultSipAddress); + + // Output text to the outputText widget + final TextView outputText = (TextView) findViewById(R.id.OutputText); + final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); + + + // Create HelloWorld object + tutorial = new TutorialChatRoom(notifier); + + + + // Assign call action to call button + buttonCall = (Button) findViewById(R.id.CallButton); + buttonCall.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + TutorialLaunchingThread thread = new TutorialLaunchingThread(); + buttonCall.setEnabled(false); + thread.start(); + } + }); + + // Assign stop action to stop button + Button buttonStop = (Button) findViewById(R.id.ButtonStop); + buttonStop.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + tutorial.stopMainLoop(); + } + }); + } + + + private class TutorialLaunchingThread extends Thread { + @Override + public void run() { + super.run(); + try { + tutorial.launchTutorial(sipAddressWidget.getText().toString()); + mHandler.post(new Runnable() { + public void run() { + buttonCall.setEnabled(true); + } + }); + } catch (LinphoneCoreException e) { + e.printStackTrace(); + } + } + } +} diff --git a/tutorials/TutorialHelloWorldActivity.java b/tutorials/TutorialHelloWorldActivity.java new file mode 100644 index 000000000..3ef643a61 --- /dev/null +++ b/tutorials/TutorialHelloWorldActivity.java @@ -0,0 +1,98 @@ +/* +TutorialHelloWorldActivity.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.tutorials; + +import org.linphone.R; +import org.linphone.core.LinphoneCoreException; + +import android.app.Activity; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +/** + * Activity for displaying and starting the HelloWorld example on Android phone. + * + * @author Guillaume Beraudo + * + */ +public class TutorialHelloWorldActivity extends Activity { + + private static final String defaultSipAddress = "sip:tested@10.0.2.6:5059"; + private TextView sipAddressWidget; + private TutorialHelloWorld tutorial; + private Handler mHandler = new Handler() ; + private Button buttonCall; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.hello_world); + sipAddressWidget = (TextView) findViewById(R.id.AddressId); + sipAddressWidget.setText(defaultSipAddress); + + // Output text to the outputText widget + final TextView outputText = (TextView) findViewById(R.id.OutputText); + final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); + + + // Create HelloWorld object + tutorial = new TutorialHelloWorld(notifier); + + + + // Assign call action to call button + buttonCall = (Button) findViewById(R.id.CallButton); + buttonCall.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + TutorialLaunchingThread thread = new TutorialLaunchingThread(); + buttonCall.setEnabled(false); + thread.start(); + } + }); + + // Assign stop action to stop button + Button buttonStop = (Button) findViewById(R.id.ButtonStop); + buttonStop.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + tutorial.stopMainLoop(); + } + }); + } + + + private class TutorialLaunchingThread extends Thread { + @Override + public void run() { + super.run(); + try { + tutorial.launchTutorial(sipAddressWidget.getText().toString()); + mHandler.post(new Runnable() { + public void run() { + buttonCall.setEnabled(true); + } + }); + } catch (LinphoneCoreException e) { + e.printStackTrace(); + } + } + } +} diff --git a/tutorials/TutorialRegistrationActivity.java b/tutorials/TutorialRegistrationActivity.java new file mode 100644 index 000000000..4da10f632 --- /dev/null +++ b/tutorials/TutorialRegistrationActivity.java @@ -0,0 +1,105 @@ +/* +TutorialRegistrationActivity.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.tutorials; + +import org.linphone.R; +import org.linphone.core.LinphoneCoreException; + +import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +/** + * Activity for displaying and starting the registration example on Android phone. + * + * @author Guillaume Beraudo + * + */ +public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { + + private static final String defaultSipAddress = "sip:8182449901ip@mty11.axtel.net"; + private static final String defaultSipPassword = "49901"; + private TextView sipAddressWidget; + private TextView sipPasswordWidget; + private TutorialRegistration tutorial; + private Button buttonCall; + private Handler mHandler = new Handler(); + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.hello_world); + sipAddressWidget = (TextView) findViewById(R.id.AddressId); + sipAddressWidget.setText(defaultSipAddress); + sipPasswordWidget = (TextView) findViewById(R.id.Password); + sipPasswordWidget.setVisibility(TextView.VISIBLE); + sipPasswordWidget.setText(defaultSipPassword); + + // Output text to the outputText widget + final TextView outputText = (TextView) findViewById(R.id.OutputText); + final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); + + + // Create Tutorial object + tutorial = new TutorialRegistration(notifier); + + + + // Assign call action to call button + buttonCall = (Button) findViewById(R.id.CallButton); + buttonCall.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + TutorialLaunchingThread thread = new TutorialLaunchingThread(); + buttonCall.setEnabled(false); + thread.start(); + } + }); + + // Assign stop action to stop button + Button buttonStop = (Button) findViewById(R.id.ButtonStop); + buttonStop.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + tutorial.stopMainLoop(); + } + }); + } + + + private class TutorialLaunchingThread extends Thread { + @Override + public void run() { + super.run(); + try { + tutorial.launchTutorial( + sipAddressWidget.getText().toString(), + sipPasswordWidget.getText().toString()); + mHandler.post(new Runnable() { + public void run() { + buttonCall.setEnabled(true); + } + }); + } catch (LinphoneCoreException e) { + e.printStackTrace(); + } + } + } +} From 51daf1eea6660f0fc233de504308371d1e199206 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 9 Nov 2010 09:26:40 +0100 Subject: [PATCH 031/769] Removed dependency on GUI framework. --- LinphoneProxyConfigImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 7ffb164b2..f1dcb70a4 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -18,9 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; -import org.linphone.LinphoneService; - -import android.util.Log; @@ -35,7 +32,6 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { setProxy(proxy); enableRegister(enableRegister); ownPtr=true; - Log.w(LinphoneService.TAG, "route ["+route+"] not used yet"); } protected LinphoneProxyConfigImpl(long aNativePtr) { nativePtr = aNativePtr; From 299b7c95c342533a776358f44780c18ba2bedb02 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 9 Nov 2010 09:29:06 +0100 Subject: [PATCH 032/769] Cleanup --- tutorials/TutorialBuddyStatusActivity.java | 2 +- tutorials/TutorialChatRoomActivity.java | 2 +- tutorials/TutorialHelloWorldActivity.java | 2 +- tutorials/TutorialRegistrationActivity.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tutorials/TutorialBuddyStatusActivity.java b/tutorials/TutorialBuddyStatusActivity.java index 376afadfb..d42607d16 100644 --- a/tutorials/TutorialBuddyStatusActivity.java +++ b/tutorials/TutorialBuddyStatusActivity.java @@ -36,7 +36,7 @@ import android.widget.TextView; */ public class TutorialBuddyStatusActivity extends Activity { - private static final String defaultSipAddress = "sip:tested@10.0.2.6:5059"; + private static final String defaultSipAddress = "sip:"; private TextView sipAddressWidget; private TutorialBuddyStatus tutorial; private Handler mHandler = new Handler() ; diff --git a/tutorials/TutorialChatRoomActivity.java b/tutorials/TutorialChatRoomActivity.java index aa4623eeb..f7dab4ce7 100644 --- a/tutorials/TutorialChatRoomActivity.java +++ b/tutorials/TutorialChatRoomActivity.java @@ -36,7 +36,7 @@ import android.widget.TextView; */ public class TutorialChatRoomActivity extends Activity { - private static final String defaultSipAddress = "sip:tested@10.0.2.6:5059"; + private static final String defaultSipAddress = "sip:"; private TextView sipAddressWidget; private TutorialChatRoom tutorial; private Handler mHandler = new Handler() ; diff --git a/tutorials/TutorialHelloWorldActivity.java b/tutorials/TutorialHelloWorldActivity.java index 3ef643a61..60bd872c7 100644 --- a/tutorials/TutorialHelloWorldActivity.java +++ b/tutorials/TutorialHelloWorldActivity.java @@ -36,7 +36,7 @@ import android.widget.TextView; */ public class TutorialHelloWorldActivity extends Activity { - private static final String defaultSipAddress = "sip:tested@10.0.2.6:5059"; + private static final String defaultSipAddress = "sip:"; private TextView sipAddressWidget; private TutorialHelloWorld tutorial; private Handler mHandler = new Handler() ; diff --git a/tutorials/TutorialRegistrationActivity.java b/tutorials/TutorialRegistrationActivity.java index 4da10f632..d87446140 100644 --- a/tutorials/TutorialRegistrationActivity.java +++ b/tutorials/TutorialRegistrationActivity.java @@ -35,8 +35,8 @@ import android.widget.TextView; */ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { - private static final String defaultSipAddress = "sip:8182449901ip@mty11.axtel.net"; - private static final String defaultSipPassword = "49901"; + private static final String defaultSipAddress = "sip:"; + private static final String defaultSipPassword = ""; private TextView sipAddressWidget; private TextView sipPasswordWidget; private TutorialRegistration tutorial; From c909af1791c901c7ea656273b978f26c9a40f061 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 12 Nov 2010 09:01:59 +0100 Subject: [PATCH 033/769] add video call activity still to be debugged --- AndroidVideoWindowImpl.java | 2 +- LinphoneCoreImpl.java | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index f1927e184..2bba92d72 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -9,7 +9,7 @@ import android.view.SurfaceView; import android.view.Surface.OutOfResourcesException; import android.view.SurfaceHolder.Callback; -public class AndroidVideoWindowImpl implements VideoWindow { +public class AndroidVideoWindowImpl implements Object { private Bitmap mBitmap; private SurfaceView mView; private Surface mSurface; diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 657cdc407..e8d13a4cd 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -22,6 +22,8 @@ import java.io.File; import java.io.IOException; import java.util.Vector; +import android.view.SurfaceView; + class LinphoneCoreImpl implements LinphoneCore { @@ -71,6 +73,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native void addFriend(long nativePtr,long friend); private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status); private native long createChatRoom(long nativePtr,String to); + private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled); + private native boolean isVideoEnabled(long nativePtr); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -296,10 +301,10 @@ class LinphoneCoreImpl implements LinphoneCore { public LinphoneChatRoom createChatRoom(String to) { return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to)); } - public void setPreviewWindow(VideoWindow w) { + public void setPreviewWindow(Object w) { if (mPreviewWindow!=null) mPreviewWindow.setListener(null); - mPreviewWindow=(AndroidVideoWindowImpl)w; + mPreviewWindow=new AndroidVideoWindowImpl((SurfaceView)w); mPreviewWindow.setListener(new AndroidVideoWindowImpl.VideoWindowListener(){ public void onSurfaceDestroyed(AndroidVideoWindowImpl vw) { setPreviewWindowId(nativePtr,null); @@ -310,7 +315,7 @@ class LinphoneCoreImpl implements LinphoneCore { } }); } - public void setVideoWindow(VideoWindow w) { + public void setVideoWindow(Object w) { if (mVideoWindow!=null) mVideoWindow.setListener(null); mVideoWindow=(AndroidVideoWindowImpl)w; @@ -324,5 +329,11 @@ class LinphoneCoreImpl implements LinphoneCore { } }); } + public void enableVideo(boolean vcap_enabled, boolean display_enabled) { + enableVideo(nativePtr,vcap_enabled, display_enabled); + } + public boolean isVideoEnabled() { + return isVideoEnabled(nativePtr); + } } From aa8101f5bfc895e959857cac952c51f394639a9f Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 12 Nov 2010 09:52:56 +0100 Subject: [PATCH 034/769] fix video view --- AndroidVideoWindowImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index 2bba92d72..2bb4314f5 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -9,7 +9,7 @@ import android.view.SurfaceView; import android.view.Surface.OutOfResourcesException; import android.view.SurfaceHolder.Callback; -public class AndroidVideoWindowImpl implements Object { +public class AndroidVideoWindowImpl { private Bitmap mBitmap; private SurfaceView mView; private Surface mSurface; From ec2fd191a8bdc04572f5b417a2d64d456c902054 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 12 Nov 2010 14:11:50 +0100 Subject: [PATCH 035/769] Fixed wrong cast --- LinphoneCoreImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index e8d13a4cd..da53636bc 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -318,7 +318,7 @@ class LinphoneCoreImpl implements LinphoneCore { public void setVideoWindow(Object w) { if (mVideoWindow!=null) mVideoWindow.setListener(null); - mVideoWindow=(AndroidVideoWindowImpl)w; + mVideoWindow=new AndroidVideoWindowImpl((SurfaceView) w); mVideoWindow.setListener(new AndroidVideoWindowImpl.VideoWindowListener(){ public void onSurfaceDestroyed(AndroidVideoWindowImpl vw) { setVideoWindowId(nativePtr,null); From e9b5957dc3c0660059dc6e2e326fa0e9ccb5475d Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 12 Nov 2010 14:16:01 +0100 Subject: [PATCH 036/769] Draft for Android video capture. --- AndroidCameraRecord.java | 127 ++++++++++++++++++++++++++++ AndroidCameraRecordImpl.java | 49 +++++++++++ tutorials/JavaCameraRecordImpl.java | 69 +++++++++++++++ tutorials/TestVideoActivity.java | 70 +++++++++++++++ 4 files changed, 315 insertions(+) create mode 100644 AndroidCameraRecord.java create mode 100644 AndroidCameraRecordImpl.java create mode 100644 tutorials/JavaCameraRecordImpl.java create mode 100644 tutorials/TestVideoActivity.java diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java new file mode 100644 index 000000000..ae07c6d56 --- /dev/null +++ b/AndroidCameraRecord.java @@ -0,0 +1,127 @@ +/* +AndroidCameraRecordImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package org.linphone.core; + +import android.hardware.Camera; +import android.hardware.Camera.PreviewCallback; +import android.util.Log; +import android.view.SurfaceHolder; +import android.view.SurfaceView; + + +public abstract class AndroidCameraRecord implements SurfaceHolder.Callback { + + protected Camera camera; + private static SurfaceView surfaceView; // should be initialized first... + protected int rate; + private int visibility = SurfaceView.GONE; // Automatically hidden + private boolean visibilityChangeable = false; + + protected final SurfaceView getSurfaceView() { + return surfaceView; + } + + /** + * AndroidCameraRecord.setSurfaceView() should be called first. + * @param rate + */ + public AndroidCameraRecord(int rate) { + camera=Camera.open(); + SurfaceHolder holder = surfaceView.getHolder(); + holder.addCallback(this); + + this.rate = rate; + } + + + /** + * AndroidCameraRecord.setSurfaceView() should be called first. + * @param rate + * @param visilibity + */ + public AndroidCameraRecord(int rate, int visilibity) { + this(rate); + this.visibility = visilibity; + } + + + public void surfaceCreated(SurfaceHolder holder) { + try { + camera.setPreviewDisplay(holder); + } + catch (Throwable t) { + Log.e("PictureDemo-surfaceCallback", "Exception in setPreviewDisplay()", t); + } + + + } + + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + Camera.Parameters parameters=camera.getParameters(); + + parameters.setPreviewSize(width, height); + parameters.setPreviewFrameRate(rate); + camera.setParameters(parameters); + + camera.startPreview(); + + visibilityChangeable = true; + if (surfaceView.getVisibility() != visibility) { + updateVisibility(); + } + + } + + public void surfaceDestroyed(SurfaceHolder holder) { + camera.stopPreview(); + camera.release(); + camera=null; + } + + public void setPreviewCallBack(PreviewCallback cb) { + camera.setPreviewCallback(cb); + } + + private void updateVisibility() { + if (!visibilityChangeable) { + throw new IllegalStateException("Visilibity not changeable now"); + } + + surfaceView.setVisibility(visibility); + } + + public void setVisibility(int visibility) { + if (visibility == this.visibility) return; + + this.visibility = visibility; + updateVisibility(); + } + + public static final void setSurfaceView(SurfaceView sv) { + AndroidCameraRecord.surfaceView = sv; + } + + + /** + * Hook to add back a buffer for reuse in capture. + * Override in a version supporting addPreviewCallBackWithBuffer() + * @param buffer buffer to reuse + */ + public void addBackCaptureBuffer(byte[] buffer) {} +} diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java new file mode 100644 index 000000000..c9173d1da --- /dev/null +++ b/AndroidCameraRecordImpl.java @@ -0,0 +1,49 @@ +/* +AndroidCameraRecordImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package org.linphone.core; + +import android.hardware.Camera; +import android.hardware.Camera.PreviewCallback; +import android.util.Log; + +/** + * Record from Android camera. + * + * @author Guillaume Beraudo + * + */ +public class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { + + private long filterCtxPtr; + + public AndroidCameraRecordImpl(long filterCtxPtr, int rate) { + super(rate); + this.filterCtxPtr = filterCtxPtr; + setPreviewCallBack(this); + } + + + private native void putImage(long filterCtxPtr, byte[] buffer); + + public void onPreviewFrame(byte[] data, Camera camera) { + Log.d("onPreviewFrame: ", Integer.toString(data.length)); + putImage(filterCtxPtr, data); + } + +} diff --git a/tutorials/JavaCameraRecordImpl.java b/tutorials/JavaCameraRecordImpl.java new file mode 100644 index 000000000..45499db78 --- /dev/null +++ b/tutorials/JavaCameraRecordImpl.java @@ -0,0 +1,69 @@ +/* +JavaCameraRecordImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.tutorials; + +import org.linphone.core.AndroidCameraRecord; + +import android.hardware.Camera; +import android.hardware.Camera.PreviewCallback; +import android.util.Log; +import android.widget.TextView; + +public class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { + + private TextView debug; + private long count = 0; + private float averageCalledRate; + private int averageWindowSize = 2 * rate; + + private long startTime; + private long endTime; + + + public JavaCameraRecordImpl(int rate) { + super(rate); + setPreviewCallBack(this); + } + + public JavaCameraRecordImpl(int rate, int visilibity) { + super(rate, visilibity); + setPreviewCallBack(this); + } + + public void setDebug(TextView debug) { + this.debug = debug; + } + + public void onPreviewFrame(byte[] data, Camera camera) { + + if ((count % averageWindowSize) == 0) { + endTime = System.currentTimeMillis(); + averageCalledRate = (100000 * averageWindowSize) / (endTime - startTime); + averageCalledRate /= 100f; + startTime = endTime; + } + + count++; + + String msg = "Frame " + count + ": " + data.length + "bytes (avg="+averageCalledRate+"frames/s)"; + if (debug != null) debug.setText(msg); + Log.d("onPreviewFrame:", msg); + } + +} diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java new file mode 100644 index 000000000..6526e1cce --- /dev/null +++ b/tutorials/TestVideoActivity.java @@ -0,0 +1,70 @@ +/* +TutorialHelloWorldActivity.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.tutorials; + +import org.linphone.R; +import org.linphone.core.AndroidCameraRecord; + +import android.app.Activity; +import android.os.Bundle; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.widget.TextView; + +/** + * Activity for displaying and starting the HelloWorld example on Android phone. + * + * @author Guillaume Beraudo + * + */ +public class TestVideoActivity extends Activity { + + private SurfaceView surfaceView; + private static final int rate = 15; + + + + + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.videotest); + + surfaceView=(SurfaceView)findViewById(R.id.videotest_surfaceView); + + SurfaceHolder holder=surfaceView.getHolder(); + holder.setFixedSize(320, 240); + holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + + AndroidCameraRecord.setSurfaceView(surfaceView); + + JavaCameraRecordImpl manager = new JavaCameraRecordImpl(rate, SurfaceView.VISIBLE); + manager.setDebug((TextView) findViewById(R.id.videotest_debug)); + + } + + + + + + +} From d047b7aabd677fd48963f4166388abb86d15678e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 14 Nov 2010 19:15:27 +0100 Subject: [PATCH 037/769] bugfixes and makefile improvements --- AndroidVideoWindowImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index 2bb4314f5..87e1dc525 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -28,8 +28,9 @@ public class AndroidVideoWindowImpl { int width, int height) { synchronized(AndroidVideoWindowImpl.this){ mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565); - if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); mSurface=holder.getSurface(); + if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); + } } @@ -38,10 +39,10 @@ public class AndroidVideoWindowImpl { public void surfaceDestroyed(SurfaceHolder holder) { synchronized(AndroidVideoWindowImpl.this){ - mBitmap=null; if (mListener!=null) mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); mSurface=null; + mBitmap=null; } } }); From 97144546e2c1f0263576ae8e792a3f68a8b1bfec Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 15 Nov 2010 19:19:32 +0100 Subject: [PATCH 038/769] fix video deadlock and double instanciation of VideoActivity --- AndroidVideoWindowImpl.java | 11 +++++++---- LinphoneCoreImpl.java | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index 87e1dc525..efac2d826 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -3,6 +3,7 @@ package org.linphone.core; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Bitmap.Config; +import android.util.Log; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -14,6 +15,7 @@ public class AndroidVideoWindowImpl { private SurfaceView mView; private Surface mSurface; private VideoWindowListener mListener; + static private String TAG = "Linphone"; public static interface VideoWindowListener{ void onSurfaceReady(AndroidVideoWindowImpl vw); void onSurfaceDestroyed(AndroidVideoWindowImpl vw); @@ -26,12 +28,12 @@ public class AndroidVideoWindowImpl { view.getHolder().addCallback(new Callback(){ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + Log.i(TAG,"Surface is being changed."); synchronized(AndroidVideoWindowImpl.this){ mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565); mSurface=holder.getSurface(); - if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); - } + if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); } public void surfaceCreated(SurfaceHolder holder) { @@ -39,11 +41,11 @@ public class AndroidVideoWindowImpl { public void surfaceDestroyed(SurfaceHolder holder) { synchronized(AndroidVideoWindowImpl.this){ - if (mListener!=null) - mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); mSurface=null; mBitmap=null; } + if (mListener!=null) + mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); } }); } @@ -74,3 +76,4 @@ public class AndroidVideoWindowImpl { } } } + diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index da53636bc..c96373cb8 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -75,7 +75,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native long createChatRoom(long nativePtr,String to); private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled); private native boolean isVideoEnabled(long nativePtr); - + private static String TAG = "LinphoneCore"; LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; From b7886ab9a70f7875c9d6e70663140334416ec4ac Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 17 Nov 2010 10:44:39 +0100 Subject: [PATCH 039/769] fix crash on simulator --- LinphoneCoreImpl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 83a78a00e..775a83895 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -292,14 +292,22 @@ class LinphoneCoreImpl implements LinphoneCore { public LinphoneChatRoom createChatRoom(String to) { return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to)); } - public void setPreviewWindow(VideoWindow w) { + public void setPreviewWindow(Object w) { throw new RuntimeException("not implemented yet"); // TODO Auto-generated method stub } - public void setVideoWindow(VideoWindow w) { + public void setVideoWindow(Object w) { throw new RuntimeException("not implemented yet"); // TODO Auto-generated method stub } + public void enableVideo(boolean vcap_enabled, boolean display_enabled) { + // TODO Auto-generated method stub + + } + public boolean isVideoEnabled() { + // TODO Auto-generated method stub + return false; + } } From 37842c4b7cb6158a464eaf03542b22276a4e1f19 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 17 Nov 2010 15:52:42 +0100 Subject: [PATCH 040/769] First working Android video version. --- AndroidCameraRecord.java | 230 ++++++++++++++++++++------- AndroidCameraRecordBufferedImpl.java | 69 ++++++++ AndroidCameraRecordImpl.java | 55 ++++++- tutorials/JavaCameraRecordImpl.java | 15 +- tutorials/TestVideoActivity.java | 19 +-- 5 files changed, 302 insertions(+), 86 deletions(-) create mode 100644 AndroidCameraRecordBufferedImpl.java diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index ae07c6d56..6ebce9856 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -19,102 +19,176 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone.core; import android.hardware.Camera; +import android.hardware.Camera.ErrorCallback; import android.hardware.Camera.PreviewCallback; +import android.os.Build; +import android.os.Handler; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; +import android.view.SurfaceHolder.Callback; -public abstract class AndroidCameraRecord implements SurfaceHolder.Callback { +public abstract class AndroidCameraRecord { + + public static final int ANDROID_VERSION = Integer.parseInt(Build.VERSION.SDK); + protected static Camera camera; + private static SurfaceView surfaceView; + + protected int fps; + protected int height; + protected int width; + private int longTermVisibility; - protected Camera camera; - private static SurfaceView surfaceView; // should be initialized first... - protected int rate; - private int visibility = SurfaceView.GONE; // Automatically hidden private boolean visibilityChangeable = false; + private PreviewCallback storedPreviewCallback; - protected final SurfaceView getSurfaceView() { - return surfaceView; + private static AndroidCameraRecord instance; + private static Handler handler; + private static boolean previewStarted; + + public AndroidCameraRecord() { + // TODO check if another instance is loaded and kill it. + instance = this; } - /** - * AndroidCameraRecord.setSurfaceView() should be called first. - * @param rate + public void setParameters(int height, int width, float fps, boolean hide) { + this.fps = Math.round(fps); + this.height = height; + this.width = width; + this.longTermVisibility = hide ? SurfaceView.GONE : SurfaceView.VISIBLE; + + if (surfaceView != null) { + Log.d("Linphone", "Surfaceview defined and ready; starting video capture"); + instance.startPreview(); + } else { + Log.w("Linphone", "Surfaceview not defined; postponning video capture"); + } + } + + /* + * AndroidCameraRecord.setSurfaceView() should be called first, from the Activity code. + * It will start automatically */ - public AndroidCameraRecord(int rate) { + private void startPreview() { + assert surfaceView != null; + + if (previewStarted) { + Log.w("Linphone", "Already started"); + return; + } + + if (surfaceView.getVisibility() != SurfaceView.VISIBLE) { + // Illegal state + Log.e("Linphone", "Illegal state: video capture surface view is not visible"); + return; + } + + camera=Camera.open(); + camera.setErrorCallback(new ErrorCallback() { + public void onError(int error, Camera camera) { + Log.e("Linphone", "Camera error : " + error); + } + }); + + + Camera.Parameters parameters=camera.getParameters(); + + parameters.setPreviewSize(width, height); + parameters.setPreviewFrameRate(fps); + camera.setParameters(parameters); + + SurfaceHolder holder = surfaceView.getHolder(); - holder.addCallback(this); - - this.rate = rate; - } - - - /** - * AndroidCameraRecord.setSurfaceView() should be called first. - * @param rate - * @param visilibity - */ - public AndroidCameraRecord(int rate, int visilibity) { - this(rate); - this.visibility = visilibity; - } - - - public void surfaceCreated(SurfaceHolder holder) { try { camera.setPreviewDisplay(holder); } catch (Throwable t) { - Log.e("PictureDemo-surfaceCallback", "Exception in setPreviewDisplay()", t); + Log.e("Linphone", "Exception in Video capture setPreviewDisplay()", t); } - } + try { + camera.startPreview(); + previewStarted = true; + } catch (Throwable e) { + Log.e("Linphone", "Can't start camera preview"); + } - public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - Camera.Parameters parameters=camera.getParameters(); + previewStarted = true; - parameters.setPreviewSize(width, height); - parameters.setPreviewFrameRate(rate); - camera.setParameters(parameters); - - camera.startPreview(); + + + // Register callback to get capture buffer + if (storedPreviewCallback != null) { + reallySetPreviewCallback(camera, storedPreviewCallback); + } + visibilityChangeable = true; - if (surfaceView.getVisibility() != visibility) { + if (surfaceView.getVisibility() != longTermVisibility) { updateVisibility(); } - + + onCameraStarted(camera); } + - public void surfaceDestroyed(SurfaceHolder holder) { - camera.stopPreview(); - camera.release(); - camera=null; - } - public void setPreviewCallBack(PreviewCallback cb) { - camera.setPreviewCallback(cb); - } - private void updateVisibility() { - if (!visibilityChangeable) { - throw new IllegalStateException("Visilibity not changeable now"); + /** + * Hook. + * @param camera + */ + public void onCameraStarted(Camera camera) {} + + public void setOrStorePreviewCallBack(PreviewCallback cb) { + if (camera == null) { + Log.w("Linphone", "Capture camera not ready, storing callback"); + this.storedPreviewCallback = cb; + return; } - - surfaceView.setVisibility(visibility); + + reallySetPreviewCallback(camera, cb); } - public void setVisibility(int visibility) { - if (visibility == this.visibility) return; - this.visibility = visibility; - updateVisibility(); - } + + public static final void setSurfaceView(final SurfaceView sv, Handler mHandler) { + AndroidCameraRecord.handler = mHandler; + SurfaceHolder holder = sv.getHolder(); + holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - public static final void setSurfaceView(SurfaceView sv) { - AndroidCameraRecord.surfaceView = sv; + holder.addCallback(new Callback() { + public void surfaceDestroyed(SurfaceHolder holder) { + AndroidCameraRecord.surfaceView = null; + + if (camera == null) { + Log.e("AndroidCameraRecord.surfaceDestroyed", "illegal state"); + return; + } + camera.setPreviewCallback(null); // TODO check if used whatever the SDK version + camera.stopPreview(); + camera.release(); + camera=null; + previewStarted = false; + Log.w("Linphone", "The video capture Surface view has been destroyed"); + } + + public void surfaceCreated(SurfaceHolder holder) { + AndroidCameraRecord.surfaceView = sv; + + if (instance != null) { + instance.startPreview(); + } + } + + public void surfaceChanged(SurfaceHolder holder, int format, int width, + int height) { + // Do nothing + } + }); } @@ -124,4 +198,40 @@ public abstract class AndroidCameraRecord implements SurfaceHolder.Callback { * @param buffer buffer to reuse */ public void addBackCaptureBuffer(byte[] buffer) {} + + + + private void updateVisibility() { + if (!visibilityChangeable) { + throw new IllegalStateException("Visilibity not changeable now"); + } + + handler.post(new Runnable() { + public void run() { + Log.d("Linphone", "Changing video capture surface view visibility :" + longTermVisibility); + surfaceView.setVisibility(longTermVisibility); + } + }); + } + + public void setVisibility(int visibility) { + if (visibility == this.longTermVisibility) return; + + this.longTermVisibility = visibility; + updateVisibility(); + } + + + public void stopCaptureCallback() { + if (camera != null) { + reallySetPreviewCallback(camera, null); + } + } + + protected void reallySetPreviewCallback(Camera camera, PreviewCallback cb) { + camera.setPreviewCallback(cb); + } + } + + diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordBufferedImpl.java new file mode 100644 index 000000000..c65f479ad --- /dev/null +++ b/AndroidCameraRecordBufferedImpl.java @@ -0,0 +1,69 @@ +/* +AndroidCameraRecord8Impl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import android.hardware.Camera; +import android.hardware.Camera.PreviewCallback; +import android.hardware.Camera.Size; +import android.util.Log; + +/** + * + * Android >= 8 (2.2) version. + * @author Guillaume Beraudo + * + */ +public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { + + public AndroidCameraRecordBufferedImpl(long filterCtxPtr) { + super(filterCtxPtr); + } + + @Override + protected void reallySetPreviewCallback(Camera camera, PreviewCallback cb) { + Log.d("Linphone", "Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); + camera.setPreviewCallbackWithBuffer(cb); + } + + @Override + public void addBackCaptureBuffer(byte[] buffer) { + camera.addCallbackBuffer(buffer); + } + + @Override + public void onCameraStarted(Camera camera) { + super.onCameraStarted(camera); + + Size s = camera.getParameters().getPreviewSize(); + int wishedBufferSize = s.height * s.width * 3 / 2; + + camera.addCallbackBuffer(new byte[wishedBufferSize]); + camera.addCallbackBuffer(new byte[wishedBufferSize]); +/* + for (int i=1; i < 30; i++) { + camera.addCallbackBuffer(new byte[wishedBufferSize]); + }*/ + } + + @Override + protected void badBufferLengthReceived(byte[] buffer, int expectedBufferLength) { + super.badBufferLengthReceived(buffer, expectedBufferLength); + addBackCaptureBuffer(buffer); + } +} diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java index c9173d1da..aab29a183 100644 --- a/AndroidCameraRecordImpl.java +++ b/AndroidCameraRecordImpl.java @@ -20,6 +20,7 @@ package org.linphone.core; import android.hardware.Camera; import android.hardware.Camera.PreviewCallback; +import android.hardware.Camera.Size; import android.util.Log; /** @@ -31,19 +32,63 @@ import android.util.Log; public class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { private long filterCtxPtr; + private double timeElapsedBetweenFrames = 0; + private long lastFrameTime = 0; - public AndroidCameraRecordImpl(long filterCtxPtr, int rate) { - super(rate); - this.filterCtxPtr = filterCtxPtr; - setPreviewCallBack(this); + public AndroidCameraRecordImpl(long filterCtxPtr) { + super(); + + try { + this.filterCtxPtr = filterCtxPtr; + setOrStorePreviewCallBack(this); + } catch (Throwable e) { + Log.e("Linphone", "Error"); + } + } private native void putImage(long filterCtxPtr, byte[] buffer); + public void onPreviewFrame(byte[] data, Camera camera) { - Log.d("onPreviewFrame: ", Integer.toString(data.length)); + if (data == null) { + Log.e("Linphone", "onPreviewFrame Called with null buffer"); + return; + } + + Size s = camera.getParameters().getPreviewSize(); + int expectedBuffLength = s.width * s.height * 3 /2; + if (expectedBuffLength != data.length) { + badBufferLengthReceived(data, expectedBuffLength); + return; + } + + long curTime = System.currentTimeMillis(); + if (lastFrameTime == 0) { + lastFrameTime = curTime; + putImage(filterCtxPtr, data); + return; + } + + double currentTimeElapsed = 0.8 * (curTime - lastFrameTime) / 1000 + 0.2 * timeElapsedBetweenFrames; + if (1 / currentTimeElapsed > fps) { +// Log.d("Linphone", "Clipping frame " + Math.round(1 / currentTimeElapsed) + " > " + fps); + addBackCaptureBuffer(data); + return; + } + lastFrameTime = curTime; + timeElapsedBetweenFrames = currentTimeElapsed; + + // Log.d("onPreviewFrame: ", Integer.toString(data.length)); putImage(filterCtxPtr, data); } + + // Hook + protected void badBufferLengthReceived(byte[] data, int expectedBuffLength) { + Log.e("Linphone", "onPreviewFrame called with bad buffer length " + data.length + + " whereas expected is " + expectedBuffLength + " don't calling putImage"); + } + } diff --git a/tutorials/JavaCameraRecordImpl.java b/tutorials/JavaCameraRecordImpl.java index 45499db78..30c1838f6 100644 --- a/tutorials/JavaCameraRecordImpl.java +++ b/tutorials/JavaCameraRecordImpl.java @@ -30,21 +30,16 @@ public class JavaCameraRecordImpl extends AndroidCameraRecord implements Preview private TextView debug; private long count = 0; private float averageCalledRate; - private int averageWindowSize = 2 * rate; private long startTime; private long endTime; - public JavaCameraRecordImpl(int rate) { - super(rate); - setPreviewCallBack(this); + public JavaCameraRecordImpl() { + super(); + setOrStorePreviewCallBack(this); } - public JavaCameraRecordImpl(int rate, int visilibity) { - super(rate, visilibity); - setPreviewCallBack(this); - } public void setDebug(TextView debug) { this.debug = debug; @@ -52,9 +47,9 @@ public class JavaCameraRecordImpl extends AndroidCameraRecord implements Preview public void onPreviewFrame(byte[] data, Camera camera) { - if ((count % averageWindowSize) == 0) { + if ((count % 2 * fps) == 0) { endTime = System.currentTimeMillis(); - averageCalledRate = (100000 * averageWindowSize) / (endTime - startTime); + averageCalledRate = (100000 * 2 * fps) / (endTime - startTime); averageCalledRate /= 100f; startTime = endTime; } diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java index 6526e1cce..e016cad25 100644 --- a/tutorials/TestVideoActivity.java +++ b/tutorials/TestVideoActivity.java @@ -23,7 +23,7 @@ import org.linphone.core.AndroidCameraRecord; import android.app.Activity; import android.os.Bundle; -import android.view.SurfaceHolder; +import android.os.Handler; import android.view.SurfaceView; import android.widget.TextView; @@ -36,14 +36,11 @@ import android.widget.TextView; public class TestVideoActivity extends Activity { private SurfaceView surfaceView; - private static final int rate = 15; + private static final int rate = 7; - - - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -51,14 +48,14 @@ public class TestVideoActivity extends Activity { surfaceView=(SurfaceView)findViewById(R.id.videotest_surfaceView); - SurfaceHolder holder=surfaceView.getHolder(); - holder.setFixedSize(320, 240); - holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); +// SurfaceHolder holder=surfaceView.getHolder(); +// holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - AndroidCameraRecord.setSurfaceView(surfaceView); + AndroidCameraRecord.setSurfaceView(surfaceView, new Handler()); - JavaCameraRecordImpl manager = new JavaCameraRecordImpl(rate, SurfaceView.VISIBLE); - manager.setDebug((TextView) findViewById(R.id.videotest_debug)); + JavaCameraRecordImpl recorder = new JavaCameraRecordImpl(); + recorder.setDebug((TextView) findViewById(R.id.videotest_debug)); + recorder.setParameters(288, 352, rate, false); } From a79e8f7f9e79169bc8d15e953dfc1fc40df05d51 Mon Sep 17 00:00:00 2001 From: guillaume Date: Thu, 18 Nov 2010 15:01:15 +0100 Subject: [PATCH 041/769] addbackbuffer managed directly in java code --- AndroidCameraRecord.java | 8 -------- AndroidCameraRecordBufferedImpl.java | 11 +++-------- AndroidCameraRecordImpl.java | 9 ++------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 6ebce9856..17d9f8f9a 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -192,14 +192,6 @@ public abstract class AndroidCameraRecord { } - /** - * Hook to add back a buffer for reuse in capture. - * Override in a version supporting addPreviewCallBackWithBuffer() - * @param buffer buffer to reuse - */ - public void addBackCaptureBuffer(byte[] buffer) {} - - private void updateVisibility() { if (!visibilityChangeable) { diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordBufferedImpl.java index c65f479ad..715f17765 100644 --- a/AndroidCameraRecordBufferedImpl.java +++ b/AndroidCameraRecordBufferedImpl.java @@ -41,11 +41,6 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { camera.setPreviewCallbackWithBuffer(cb); } - @Override - public void addBackCaptureBuffer(byte[] buffer) { - camera.addCallbackBuffer(buffer); - } - @Override public void onCameraStarted(Camera camera) { super.onCameraStarted(camera); @@ -62,8 +57,8 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { } @Override - protected void badBufferLengthReceived(byte[] buffer, int expectedBufferLength) { - super.badBufferLengthReceived(buffer, expectedBufferLength); - addBackCaptureBuffer(buffer); + public void onPreviewFrame(byte[] data, Camera camera) { + super.onPreviewFrame(data, camera); + camera.addCallbackBuffer(data); } } diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java index aab29a183..6186e458a 100644 --- a/AndroidCameraRecordImpl.java +++ b/AndroidCameraRecordImpl.java @@ -60,7 +60,8 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev Size s = camera.getParameters().getPreviewSize(); int expectedBuffLength = s.width * s.height * 3 /2; if (expectedBuffLength != data.length) { - badBufferLengthReceived(data, expectedBuffLength); + Log.e("Linphone", "onPreviewFrame called with bad buffer length " + data.length + + " whereas expected is " + expectedBuffLength + " don't calling putImage"); return; } @@ -74,7 +75,6 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev double currentTimeElapsed = 0.8 * (curTime - lastFrameTime) / 1000 + 0.2 * timeElapsedBetweenFrames; if (1 / currentTimeElapsed > fps) { // Log.d("Linphone", "Clipping frame " + Math.round(1 / currentTimeElapsed) + " > " + fps); - addBackCaptureBuffer(data); return; } lastFrameTime = curTime; @@ -85,10 +85,5 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev } - // Hook - protected void badBufferLengthReceived(byte[] data, int expectedBuffLength) { - Log.e("Linphone", "onPreviewFrame called with bad buffer length " + data.length - + " whereas expected is " + expectedBuffLength + " don't calling putImage"); - } } From ae34456f2ad9ade1ed2922f42620132cb66e4d69 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 19 Nov 2010 11:42:46 +0100 Subject: [PATCH 042/769] fix for display --- LinphoneCoreImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index c96373cb8..99be0fb2b 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -335,5 +335,4 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isVideoEnabled() { return isVideoEnabled(nativePtr); } - } From 7d71181e174154330812743542812e49c1db67f3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 19 Nov 2010 16:40:29 +0100 Subject: [PATCH 043/769] add stun preference --- LinphoneCoreImpl.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 99be0fb2b..1f389a608 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -69,12 +69,16 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setPreviewWindowId(long nativePtr, Object wid); private AndroidVideoWindowImpl mVideoWindow; private AndroidVideoWindowImpl mPreviewWindow; - private native void addFriend(long nativePtr,long friend); private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status); private native long createChatRoom(long nativePtr,String to); private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled); private native boolean isVideoEnabled(long nativePtr); + private native void setFirewallPolicy(long nativePtr, int enum_value); + private native int getFirewallPolicy(long nativePtr); + private native void setStunServer(long nativePtr, String stun_server); + private native String getStunServer(long nativePtr); + private static String TAG = "LinphoneCore"; LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -335,4 +339,16 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isVideoEnabled() { return isVideoEnabled(nativePtr); } + public FirewallPolicy getFirewallPolicy() { + return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr)); + } + public String getStunServer() { + return getStunServer(nativePtr); + } + public void setFirewallPolicy(FirewallPolicy pol) { + setFirewallPolicy(nativePtr,pol.value()); + } + public void setStunServer(String stunServer) { + setStunServer(nativePtr,stunServer); + } } From 2300dfa730ee2fbfb7b8407922445ad1df575174 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 22 Nov 2010 11:23:43 +0100 Subject: [PATCH 044/769] Added Orientation change support and video capture preview --- AndroidCameraRecord.java | 23 ++++++++++++++++++++--- AndroidCameraRecordImpl.java | 6 +++--- AndroidVideoWindowImpl.java | 5 ++++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 17d9f8f9a..df6a395ea 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -46,6 +46,7 @@ public abstract class AndroidCameraRecord { private static AndroidCameraRecord instance; private static Handler handler; private static boolean previewStarted; + private static int orientationCode; public AndroidCameraRecord() { // TODO check if another instance is loaded and kill it. @@ -66,6 +67,7 @@ public abstract class AndroidCameraRecord { } } + /* * AndroidCameraRecord.setSurfaceView() should be called first, from the Activity code. * It will start automatically @@ -97,9 +99,14 @@ public abstract class AndroidCameraRecord { parameters.setPreviewSize(width, height); parameters.setPreviewFrameRate(fps); +// parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_EDOF); camera.setParameters(parameters); + camera.setDisplayOrientation(90 * orientationCode); +// parameters.setRotation() + + SurfaceHolder holder = surfaceView.getHolder(); try { camera.setPreviewDisplay(holder); @@ -165,7 +172,7 @@ public abstract class AndroidCameraRecord { AndroidCameraRecord.surfaceView = null; if (camera == null) { - Log.e("AndroidCameraRecord.surfaceDestroyed", "illegal state"); + Log.e("Linphone", "Video capture: illegal state: surface destroyed but camera is already null"); return; } camera.setPreviewCallback(null); // TODO check if used whatever the SDK version @@ -173,20 +180,23 @@ public abstract class AndroidCameraRecord { camera.release(); camera=null; previewStarted = false; - Log.w("Linphone", "The video capture Surface view has been destroyed"); + Log.w("Linphone", "Video capture Surface destroyed"); } public void surfaceCreated(SurfaceHolder holder) { AndroidCameraRecord.surfaceView = sv; + Log.w("Linphone", "Video capture surface created"); if (instance != null) { instance.startPreview(); } + + holder.isCreating(); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - // Do nothing + Log.w("Linphone", "Video capture surface changed"); } }); } @@ -223,7 +233,14 @@ public abstract class AndroidCameraRecord { protected void reallySetPreviewCallback(Camera camera, PreviewCallback cb) { camera.setPreviewCallback(cb); } + + public static void setOrientationCode(int orientation) { + AndroidCameraRecord.orientationCode = (4 + 1 - orientation) % 4; + } + protected int getOrientationCode() { + return orientationCode; + } } diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java index 6186e458a..db4e128de 100644 --- a/AndroidCameraRecordImpl.java +++ b/AndroidCameraRecordImpl.java @@ -48,7 +48,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev } - private native void putImage(long filterCtxPtr, byte[] buffer); + private native void putImage(long filterCtxPtr, byte[] buffer, int orientation); public void onPreviewFrame(byte[] data, Camera camera) { @@ -68,7 +68,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev long curTime = System.currentTimeMillis(); if (lastFrameTime == 0) { lastFrameTime = curTime; - putImage(filterCtxPtr, data); + putImage(filterCtxPtr, data, getOrientationCode()); return; } @@ -81,7 +81,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev timeElapsedBetweenFrames = currentTimeElapsed; // Log.d("onPreviewFrame: ", Integer.toString(data.length)); - putImage(filterCtxPtr, data); + putImage(filterCtxPtr, data, getOrientationCode()); } diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index efac2d826..ca9968e4c 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -34,9 +34,11 @@ public class AndroidVideoWindowImpl { mSurface=holder.getSurface(); } if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); + Log.w("Linphone", "Video display surface changed"); } - public void surfaceCreated(SurfaceHolder holder) { + public void surfaceCreated(SurfaceHolder holder) { + Log.w("Linphone", "Video display surface created"); } public void surfaceDestroyed(SurfaceHolder holder) { @@ -46,6 +48,7 @@ public class AndroidVideoWindowImpl { } if (mListener!=null) mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); + Log.w("Linphone", "Video display surface destroyed"); } }); } From 405d0b06ab9228789ea99f83e28854636c3ad051 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 22 Nov 2010 17:20:11 +0100 Subject: [PATCH 045/769] Added focus support. Rotation functinonal. --- AndroidCameraRecord.java | 25 ++++++++++++++++++++----- AndroidCameraRecordBufferedImpl.java | 10 ++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index df6a395ea..4137192ba 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -20,6 +20,7 @@ package org.linphone.core; import android.hardware.Camera; import android.hardware.Camera.ErrorCallback; +import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; import android.os.Build; import android.os.Handler; @@ -46,7 +47,7 @@ public abstract class AndroidCameraRecord { private static AndroidCameraRecord instance; private static Handler handler; private static boolean previewStarted; - private static int orientationCode; + protected static int orientationCode; public AndroidCameraRecord() { // TODO check if another instance is loaded and kill it. @@ -99,11 +100,21 @@ public abstract class AndroidCameraRecord { parameters.setPreviewSize(width, height); parameters.setPreviewFrameRate(fps); -// parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_EDOF); - camera.setParameters(parameters); - camera.setDisplayOrientation(90 * orientationCode); -// parameters.setRotation() + if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { + Log.w("Linphone", "Auto Focus supported by camera device"); + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); + } else { + Log.w("Linphone", "Auto Focus not supported by camera device"); + if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { + Log.w("Linphone", "Infinity Focus supported by camera device"); + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); + } else { + Log.w("Linphone", "Infinity Focus not supported by camera device"); + } + } + onSettingParameters(parameters); + camera.setParameters(parameters); @@ -144,6 +155,10 @@ public abstract class AndroidCameraRecord { + protected void onSettingParameters(Parameters parameters) { + + } + /** * Hook. * @param camera diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordBufferedImpl.java index 715f17765..886ad222e 100644 --- a/AndroidCameraRecordBufferedImpl.java +++ b/AndroidCameraRecordBufferedImpl.java @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone.core; import android.hardware.Camera; +import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.Size; import android.util.Log; @@ -61,4 +62,13 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { super.onPreviewFrame(data, camera); camera.addCallbackBuffer(data); } + + @Override + protected void onSettingParameters(Parameters parameters) { + super.onSettingParameters(parameters); + // Only on v8 hardware + camera.setDisplayOrientation(90 * orientationCode); + } + + } From c505024cc79e7e9fe902cd983462d3fb8b0e516a Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 23 Nov 2010 09:27:51 +0100 Subject: [PATCH 046/769] Define getStatus(): throw not implemented exception --- LinphoneCallLogImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index b0360d194..1bdb84720 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -42,5 +42,8 @@ class LinphoneCallLogImpl implements LinphoneCallLog { public LinphoneAddress getTo() { return new LinphoneAddressImpl(getTo(nativePtr)); } + public CallStatus getStatus() { + throw new RuntimeException("not implemented yet"); + } } From dc20fb7739ea78b8ff90643ca053c770424d2e21 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 25 Nov 2010 11:13:28 +0100 Subject: [PATCH 047/769] Moved mic and speaker buttons in dialer. Added camera call button. Added video preferences. Share camera on received call according to preference settings. Invite with(out) according to preference settings. --- AndroidCameraRecord.java | 104 ++++++++++++++----------------- LinphoneCallImpl.java | 8 +++ LinphoneCallParamsImpl.java | 45 +++++++++++++ LinphoneCoreImpl.java | 32 +++++++++- tutorials/TestVideoActivity.java | 5 +- 5 files changed, 133 insertions(+), 61 deletions(-) create mode 100644 LinphoneCallParamsImpl.java diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 4137192ba..c16ef065d 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -23,7 +23,6 @@ import android.hardware.Camera.ErrorCallback; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; import android.os.Build; -import android.os.Handler; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -39,33 +38,26 @@ public abstract class AndroidCameraRecord { protected int fps; protected int height; protected int width; - private int longTermVisibility; - - private boolean visibilityChangeable = false; private PreviewCallback storedPreviewCallback; private static AndroidCameraRecord instance; - private static Handler handler; private static boolean previewStarted; + private static boolean parametersSet; protected static int orientationCode; + private static boolean mute; + private static final String tag="Linphone"; public AndroidCameraRecord() { // TODO check if another instance is loaded and kill it. instance = this; } - public void setParameters(int height, int width, float fps, boolean hide) { + public void setParameters(int height, int width, float fps) { this.fps = Math.round(fps); this.height = height; this.width = width; - this.longTermVisibility = hide ? SurfaceView.GONE : SurfaceView.VISIBLE; - - if (surfaceView != null) { - Log.d("Linphone", "Surfaceview defined and ready; starting video capture"); - instance.startPreview(); - } else { - Log.w("Linphone", "Surfaceview not defined; postponning video capture"); - } + parametersSet = true; + startPreview(); } @@ -74,16 +66,27 @@ public abstract class AndroidCameraRecord { * It will start automatically */ private void startPreview() { - assert surfaceView != null; + if (mute) { + Log.d(tag, "Not starting preview as camera has been muted"); + return; + } + if (surfaceView == null) { + Log.w(tag, "Surfaceview not defined; postponning video capture"); + return; + } + if (!parametersSet) { + Log.w(tag, "Parameters not set; postponning video capture"); + return; + } if (previewStarted) { - Log.w("Linphone", "Already started"); + Log.w(tag, "Already started"); return; } if (surfaceView.getVisibility() != SurfaceView.VISIBLE) { // Illegal state - Log.e("Linphone", "Illegal state: video capture surface view is not visible"); + Log.e(tag, "Illegal state: video capture surface view is not visible"); return; } @@ -91,7 +94,7 @@ public abstract class AndroidCameraRecord { camera=Camera.open(); camera.setErrorCallback(new ErrorCallback() { public void onError(int error, Camera camera) { - Log.e("Linphone", "Camera error : " + error); + Log.e(tag, "Camera error : " + error); } }); @@ -101,15 +104,15 @@ public abstract class AndroidCameraRecord { parameters.setPreviewSize(width, height); parameters.setPreviewFrameRate(fps); if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { - Log.w("Linphone", "Auto Focus supported by camera device"); + Log.w(tag, "Auto Focus supported by camera device"); parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); } else { - Log.w("Linphone", "Auto Focus not supported by camera device"); + Log.w(tag, "Auto Focus not supported by camera device"); if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { - Log.w("Linphone", "Infinity Focus supported by camera device"); + Log.w(tag, "Infinity Focus supported by camera device"); parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); } else { - Log.w("Linphone", "Infinity Focus not supported by camera device"); + Log.w(tag, "Infinity Focus not supported by camera device"); } } @@ -123,7 +126,7 @@ public abstract class AndroidCameraRecord { camera.setPreviewDisplay(holder); } catch (Throwable t) { - Log.e("Linphone", "Exception in Video capture setPreviewDisplay()", t); + Log.e(tag, "Exception in Video capture setPreviewDisplay()", t); } @@ -131,7 +134,7 @@ public abstract class AndroidCameraRecord { camera.startPreview(); previewStarted = true; } catch (Throwable e) { - Log.e("Linphone", "Can't start camera preview"); + Log.e(tag, "Can't start camera preview"); } previewStarted = true; @@ -143,11 +146,6 @@ public abstract class AndroidCameraRecord { reallySetPreviewCallback(camera, storedPreviewCallback); } - - visibilityChangeable = true; - if (surfaceView.getVisibility() != longTermVisibility) { - updateVisibility(); - } onCameraStarted(camera); } @@ -167,7 +165,7 @@ public abstract class AndroidCameraRecord { public void setOrStorePreviewCallBack(PreviewCallback cb) { if (camera == null) { - Log.w("Linphone", "Capture camera not ready, storing callback"); + Log.w(tag, "Capture camera not ready, storing callback"); this.storedPreviewCallback = cb; return; } @@ -177,8 +175,7 @@ public abstract class AndroidCameraRecord { - public static final void setSurfaceView(final SurfaceView sv, Handler mHandler) { - AndroidCameraRecord.handler = mHandler; + public static final void setSurfaceView(final SurfaceView sv) { SurfaceHolder holder = sv.getHolder(); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); @@ -187,7 +184,7 @@ public abstract class AndroidCameraRecord { AndroidCameraRecord.surfaceView = null; if (camera == null) { - Log.e("Linphone", "Video capture: illegal state: surface destroyed but camera is already null"); + Log.e(tag, "Video capture: illegal state: surface destroyed but camera is already null"); return; } camera.setPreviewCallback(null); // TODO check if used whatever the SDK version @@ -195,12 +192,12 @@ public abstract class AndroidCameraRecord { camera.release(); camera=null; previewStarted = false; - Log.w("Linphone", "Video capture Surface destroyed"); + Log.w(tag, "Video capture Surface destroyed"); } public void surfaceCreated(SurfaceHolder holder) { AndroidCameraRecord.surfaceView = sv; - Log.w("Linphone", "Video capture surface created"); + Log.w(tag, "Video capture surface created"); if (instance != null) { instance.startPreview(); @@ -211,33 +208,13 @@ public abstract class AndroidCameraRecord { public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - Log.w("Linphone", "Video capture surface changed"); + Log.w(tag, "Video capture surface changed"); } }); } - private void updateVisibility() { - if (!visibilityChangeable) { - throw new IllegalStateException("Visilibity not changeable now"); - } - - handler.post(new Runnable() { - public void run() { - Log.d("Linphone", "Changing video capture surface view visibility :" + longTermVisibility); - surfaceView.setVisibility(longTermVisibility); - } - }); - } - - public void setVisibility(int visibility) { - if (visibility == this.longTermVisibility) return; - - this.longTermVisibility = visibility; - updateVisibility(); - } - public void stopCaptureCallback() { if (camera != null) { @@ -256,6 +233,21 @@ public abstract class AndroidCameraRecord { protected int getOrientationCode() { return orientationCode; } + + public static void setMuteCamera(boolean m) { + if (m == mute) return; + + mute = m; + if (mute && previewStarted) { + camera.stopPreview(); + return; + } + + if (!mute) { + instance.startPreview(); + } + + } } diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index c71883b57..4c9a770c9 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -29,6 +29,8 @@ class LinphoneCallImpl implements LinphoneCall { private native boolean isIncoming(long nativePtr); native private long getRemoteAddress(long nativePtr); native private int getState(long nativePtr); + private native long getCurrentParams(long nativePtr); + protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; ref(nativePtr); @@ -58,6 +60,12 @@ class LinphoneCallImpl implements LinphoneCall { public State getState() { return LinphoneCall.State.fromInt(getState(nativePtr)); } + public LinphoneCallParams getCurrentParamsReadOnly() { + return new LinphoneCallParamsImpl(getCurrentParams(nativePtr)); + } + public LinphoneCallParams getCurrentParamsReadWrite() { + return getCurrentParamsReadOnly().copy(); + } } diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java new file mode 100644 index 000000000..add724f21 --- /dev/null +++ b/LinphoneCallParamsImpl.java @@ -0,0 +1,45 @@ +/* +LinphoneCallParamsImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +public class LinphoneCallParamsImpl implements LinphoneCallParams { + protected final long nativePtr; + + public LinphoneCallParamsImpl(long nativePtr) { + this.nativePtr = nativePtr; + } + + private native void enableVideo(long nativePtr, boolean b); + private native boolean getVideoEnabled(long nativePtr); + private native long copy(long nativePtr); + + + public boolean getVideoEnabled() { + return getVideoEnabled(nativePtr); + } + + public void setVideoEnalbled(boolean b) { + enableVideo(nativePtr, b); + } + + public LinphoneCallParams copy() { + return new LinphoneCallParamsImpl(copy(nativePtr)); + } + +} diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 1f389a608..91913e322 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -55,6 +55,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void muteMic(long nativePtr,boolean isMuted); private native long interpretUrl(long nativePtr,String destination); private native long inviteAddress(long nativePtr,long to); + private native long inviteAddressWithParams(long nativePtrLc,long to, long nativePtrParam); private native void sendDtmf(long nativePtr,char dtmf); private native void clearCallLogs(long nativePtr); private native boolean isMicMuted(long nativePtr); @@ -78,6 +79,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native int getFirewallPolicy(long nativePtr); private native void setStunServer(long nativePtr, String stun_server); private native String getStunServer(long nativePtr); + private native long createDefaultCallParams(long nativePtr); + private native int updateCall(long ptrLc, long ptrCall, long ptrParams); + private static String TAG = "LinphoneCore"; @@ -211,14 +215,15 @@ class LinphoneCoreImpl implements LinphoneCore { throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); } } - public LinphoneCall invite(LinphoneAddress to) { + public LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException { long lNativePtr = inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); if (lNativePtr!=0) { return new LinphoneCallImpl(lNativePtr); } else { - return null; + throw new LinphoneCoreException("Unable to invite address " + to.asString()); } } + public void sendDtmf(char number) { sendDtmf(nativePtr,number); } @@ -351,4 +356,27 @@ class LinphoneCoreImpl implements LinphoneCore { public void setStunServer(String stunServer) { setStunServer(nativePtr,stunServer); } + + public LinphoneCallParams createDefaultCallParameters() { + return new LinphoneCallParamsImpl(createDefaultCallParams(nativePtr)); + } + + public LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException { + long ptrDestination = ((LinphoneAddressImpl)to).nativePtr; + long ptrParams =((LinphoneCallParamsImpl)params).nativePtr; + + long lcNativePtr = inviteAddressWithParams(nativePtr, ptrDestination, ptrParams); + if (lcNativePtr!=0) { + return new LinphoneCallImpl(lcNativePtr); + } else { + throw new LinphoneCoreException("Unable to invite with params " + to.asString()); + } + } + + public int updateCall(LinphoneCall call, LinphoneCallParams params) { + long ptrCall = ((LinphoneCallImpl) call).nativePtr; + long ptrParams = ((LinphoneCallParamsImpl)params).nativePtr; + + return updateCall(nativePtr, ptrCall, ptrParams); + } } diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java index e016cad25..0623e34dc 100644 --- a/tutorials/TestVideoActivity.java +++ b/tutorials/TestVideoActivity.java @@ -23,7 +23,6 @@ import org.linphone.core.AndroidCameraRecord; import android.app.Activity; import android.os.Bundle; -import android.os.Handler; import android.view.SurfaceView; import android.widget.TextView; @@ -51,11 +50,11 @@ public class TestVideoActivity extends Activity { // SurfaceHolder holder=surfaceView.getHolder(); // holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - AndroidCameraRecord.setSurfaceView(surfaceView, new Handler()); + AndroidCameraRecord.setSurfaceView(surfaceView); JavaCameraRecordImpl recorder = new JavaCameraRecordImpl(); recorder.setDebug((TextView) findViewById(R.id.videotest_debug)); - recorder.setParameters(288, 352, rate, false); + recorder.setParameters(288, 352, rate); } From 11ad5c7d021f93257058b97de187c54ce26b69d5 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 25 Nov 2010 14:01:51 +0100 Subject: [PATCH 048/769] use default ring file instead of oldring.wav --- LinphoneCallImpl.java | 3 +++ LinphoneCallLogImpl.java | 4 ++++ LinphoneCoreImpl.java | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index c71883b57..ed8f00708 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -58,6 +58,9 @@ class LinphoneCallImpl implements LinphoneCall { public State getState() { return LinphoneCall.State.fromInt(getState(nativePtr)); } + public LinphoneCallParams getCurrentParamsReadOnly() { + throw new RuntimeException("Not Implemenetd yet"); + } } diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index b0360d194..c9c8b8ffe 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -42,5 +42,9 @@ class LinphoneCallLogImpl implements LinphoneCallLog { public LinphoneAddress getTo() { return new LinphoneAddressImpl(getTo(nativePtr)); } + public CallStatus getStatus() { + // TODO Auto-generated method stub + return null; + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 775a83895..01b98bda4 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -67,6 +67,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void addFriend(long nativePtr,long friend); private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status); private native long createChatRoom(long nativePtr,String to); + private native void setRing(long nativePtr, String path); + private native String getRing(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -309,5 +311,39 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return false; } + public void setStunServer(String stun_server) { + // TODO Auto-generated method stub + + } + public String getStunServer() { + // TODO Auto-generated method stub + return null; + } + public void setFirewallPolicy(FirewallPolicy pol) { + // TODO Auto-generated method stub + + } + public FirewallPolicy getFirewallPolicy() { + // TODO Auto-generated method stub + return null; + } + public void setRing(String path) { + setRing(nativePtr,path); + + } + public String getRing() { + return getRing(nativePtr); + } + public LinphoneCall inviteAddressWithParams(LinphoneAddress destination, + LinphoneCallParams params) throws LinphoneCoreException { + throw new RuntimeException("Not Implemenetd yet"); + } + public int updateCall(LinphoneCall call, LinphoneCallParams params) { + throw new RuntimeException("Not Implemenetd yet"); + } + public LinphoneCallParams createDefaultCallParameters() { + throw new RuntimeException("Not Implemenetd yet"); + } + } From 3c26f241c1ee443fc00be8aee388d1c0b88e2e5d Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 26 Nov 2010 15:04:38 +0100 Subject: [PATCH 049/769] Added menu to videocall activity: - high/low resolution - enable/disable camera - return to dialer - terminate call Added bandwidth manager to manage video profiles and update current and subsequent calls. Added VideoSize semantics and jni wrappings on linphoneCore. --- AndroidCameraRecord.java | 65 +++++++++++++++++++++++++++++-------- LinphoneCallImpl.java | 2 -- LinphoneCallParamsImpl.java | 2 +- LinphoneCoreImpl.java | 28 +++++++++++++++- 4 files changed, 79 insertions(+), 18 deletions(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index c16ef065d..138912f57 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -18,10 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import java.util.ArrayList; +import java.util.List; + import android.hardware.Camera; import android.hardware.Camera.ErrorCallback; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; +import android.hardware.Camera.Size; import android.os.Build; import android.util.Log; import android.view.SurfaceHolder; @@ -44,8 +48,9 @@ public abstract class AndroidCameraRecord { private static boolean previewStarted; private static boolean parametersSet; protected static int orientationCode; - private static boolean mute; + private static boolean muted; private static final String tag="Linphone"; + private static List supportedVideoSizes; public AndroidCameraRecord() { // TODO check if another instance is loaded and kill it. @@ -66,7 +71,7 @@ public abstract class AndroidCameraRecord { * It will start automatically */ private void startPreview() { - if (mute) { + if (muted) { Log.d(tag, "Not starting preview as camera has been muted"); return; } @@ -100,6 +105,9 @@ public abstract class AndroidCameraRecord { Camera.Parameters parameters=camera.getParameters(); + if (supportedVideoSizes == null) { + supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); + } parameters.setPreviewSize(width, height); parameters.setPreviewFrameRate(fps); @@ -174,6 +182,13 @@ public abstract class AndroidCameraRecord { } + private static void stopPreview() { + camera.setPreviewCallback(null); // TODO check if used whatever the SDK version + camera.stopPreview(); + camera.release(); + camera=null; + previewStarted = false; + } public static final void setSurfaceView(final SurfaceView sv) { SurfaceHolder holder = sv.getHolder(); @@ -187,11 +202,7 @@ public abstract class AndroidCameraRecord { Log.e(tag, "Video capture: illegal state: surface destroyed but camera is already null"); return; } - camera.setPreviewCallback(null); // TODO check if used whatever the SDK version - camera.stopPreview(); - camera.release(); - camera=null; - previewStarted = false; + stopPreview(); Log.w(tag, "Video capture Surface destroyed"); } @@ -235,19 +246,45 @@ public abstract class AndroidCameraRecord { } public static void setMuteCamera(boolean m) { - if (m == mute) return; + if (m == muted) return; - mute = m; - if (mute && previewStarted) { - camera.stopPreview(); + muted = m; + if (muted && previewStarted) { + stopPreview(); return; } - if (!mute) { + if (!muted) { instance.startPreview(); } } + + public static void toggleMute() { + setMuteCamera(!muted); + } + + public static List supportedVideoSizes() { + if (supportedVideoSizes != null) { + return new ArrayList(supportedVideoSizes); + } + + if (camera == null) { + camera = Camera.open(); + supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); + camera.release(); + return supportedVideoSizes; + } + + throw new RuntimeException("Should not be there"); + } + + public static boolean getCameraMuted() { + return muted; + } + + public static void invalidateParameters() { + parametersSet = false; + stopPreview(); + } } - - diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 4c9a770c9..b6194c26f 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -66,6 +66,4 @@ class LinphoneCallImpl implements LinphoneCall { public LinphoneCallParams getCurrentParamsReadWrite() { return getCurrentParamsReadOnly().copy(); } - - } diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java index add724f21..1242ee996 100644 --- a/LinphoneCallParamsImpl.java +++ b/LinphoneCallParamsImpl.java @@ -34,7 +34,7 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { return getVideoEnabled(nativePtr); } - public void setVideoEnalbled(boolean b) { + public void setVideoEnabled(boolean b) { enableVideo(nativePtr, b); } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 91913e322..532a7ae2c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -81,7 +81,10 @@ class LinphoneCoreImpl implements LinphoneCore { private native String getStunServer(long nativePtr); private native long createDefaultCallParams(long nativePtr); private native int updateCall(long ptrLc, long ptrCall, long ptrParams); - + private native void setUploadBandwidth(long nativePtr, int bw); + private native void setDownloadBandwidth(long nativePtr, int bw); + private native void setPreferredVideoSize(long nativePtr, int width, int heigth); + private native int[] getPreferredVideoSize(long nativePtr); private static String TAG = "LinphoneCore"; @@ -379,4 +382,27 @@ class LinphoneCoreImpl implements LinphoneCore { return updateCall(nativePtr, ptrCall, ptrParams); } + + + public void setUploadBandwidth(int bw) { + setUploadBandwidth(nativePtr, bw); + } + + public void setDownloadBandwidth(int bw) { + setDownloadBandwidth(nativePtr, bw); + } + + public void setPreferredVideoSize(VideoSize vSize) { + setPreferredVideoSize(nativePtr, vSize.getWidth(), vSize.getHeight()); + } + + public VideoSize getPreferredVideoSize() { + int[] nativeSize = getPreferredVideoSize(nativePtr); + + VideoSize vSize = new VideoSize(); + vSize.setWidth(nativeSize[0]); + vSize.setHeight(nativeSize[1]); + + return vSize; + } } From a115f7a9d7b985c60858188875450d11a9ea1a1e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 29 Nov 2010 10:53:03 +0100 Subject: [PATCH 050/769] fix bad merges and rename some methods --- LinphoneCoreImpl.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index f0f4dc15d..c67c18dc9 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -385,9 +385,6 @@ class LinphoneCoreImpl implements LinphoneCore { return updateCall(nativePtr, ptrCall, ptrParams); } -<<<<<<< HEAD - - public void setUploadBandwidth(int bw) { setUploadBandwidth(nativePtr, bw); } @@ -406,14 +403,20 @@ class LinphoneCoreImpl implements LinphoneCore { VideoSize vSize = new VideoSize(); vSize.setWidth(nativeSize[0]); vSize.setHeight(nativeSize[1]); - return vSize; -======= + } public void setRing(String path) { setRing(nativePtr, path); } public String getRing() { return getRing(nativePtr); ->>>>>>> c95431295dc09c5558d38c6de49fa071c957d926 + } + public boolean isNetworkReachable() { + // TODO Auto-generated method stub + return false; + } + public void setNetworkReachable(boolean isReachable) { + // TODO Auto-generated method stub + } } From b091437c6f376a061b7994e0d98d9c311153113f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 29 Nov 2010 12:01:44 +0100 Subject: [PATCH 051/769] fix setNetworkReachable --- AndroidCameraRecord.java | 8 +++++--- AndroidVideoWindowImpl.java | 1 + LinphoneCoreImpl.java | 6 +----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 138912f57..eb6a10865 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -183,9 +183,11 @@ public abstract class AndroidCameraRecord { private static void stopPreview() { - camera.setPreviewCallback(null); // TODO check if used whatever the SDK version - camera.stopPreview(); - camera.release(); + if (camera!=null){ + camera.setPreviewCallback(null); // TODO check if used whatever the SDK version + camera.stopPreview(); + camera.release(); + } camera=null; previewStarted = false; } diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index ca9968e4c..9f6281bec 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -80,3 +80,4 @@ public class AndroidVideoWindowImpl { } } + diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index c67c18dc9..745c8c358 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -200,7 +200,7 @@ class LinphoneCoreImpl implements LinphoneCore { throw new RuntimeException("object already destroyed"); } } - public void setNetworkStateReachable(boolean isReachable) { + public void setNetworkReachable(boolean isReachable) { setNetworkStateReachable(nativePtr,isReachable); } public void setPlaybackGain(float gain) { @@ -415,8 +415,4 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return false; } - public void setNetworkReachable(boolean isReachable) { - // TODO Auto-generated method stub - - } } From 3f7a0b217fc223fd3b09dd63098ecf367f632d3d Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 29 Nov 2010 12:08:13 +0100 Subject: [PATCH 052/769] Added camera record manager to drive Video record class. --- AndroidCameraRecord.java | 175 +++++++----------------- AndroidCameraRecordBufferedImpl.java | 11 +- AndroidCameraRecordImpl.java | 27 ++-- AndroidCameraRecordManager.java | 190 +++++++++++++++++++++++++++ tutorials/JavaCameraRecordImpl.java | 16 ++- tutorials/TestVideoActivity.java | 9 +- 6 files changed, 277 insertions(+), 151 deletions(-) create mode 100644 AndroidCameraRecordManager.java diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 138912f57..560f4c947 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -26,70 +26,36 @@ import android.hardware.Camera.ErrorCallback; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.Size; -import android.os.Build; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; -import android.view.SurfaceHolder.Callback; public abstract class AndroidCameraRecord { - public static final int ANDROID_VERSION = Integer.parseInt(Build.VERSION.SDK); - protected static Camera camera; - private static SurfaceView surfaceView; + protected Camera camera; + private RecorderParams params; - protected int fps; - protected int height; - protected int width; private PreviewCallback storedPreviewCallback; - - private static AndroidCameraRecord instance; - private static boolean previewStarted; - private static boolean parametersSet; - protected static int orientationCode; - private static boolean muted; + private boolean previewStarted; + protected int orientationCode; private static final String tag="Linphone"; - private static List supportedVideoSizes; + private List supportedVideoSizes; - public AndroidCameraRecord() { - // TODO check if another instance is loaded and kill it. - instance = this; - } - - public void setParameters(int height, int width, float fps) { - this.fps = Math.round(fps); - this.height = height; - this.width = width; - parametersSet = true; - startPreview(); + public AndroidCameraRecord(RecorderParams parameters) { + this.params = parameters; + setRotation(parameters.rotation); } - /* - * AndroidCameraRecord.setSurfaceView() should be called first, from the Activity code. - * It will start automatically - */ - private void startPreview() { - if (muted) { - Log.d(tag, "Not starting preview as camera has been muted"); - return; - } - if (surfaceView == null) { - Log.w(tag, "Surfaceview not defined; postponning video capture"); - return; - } - if (!parametersSet) { - Log.w(tag, "Parameters not set; postponning video capture"); - return; - } - + + public void startPreview() { // FIXME throws exception? if (previewStarted) { Log.w(tag, "Already started"); return; } - if (surfaceView.getVisibility() != SurfaceView.VISIBLE) { + if (params.surfaceView.getVisibility() != SurfaceView.VISIBLE) { // Illegal state Log.e(tag, "Illegal state: video capture surface view is not visible"); return; @@ -109,8 +75,9 @@ public abstract class AndroidCameraRecord { supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); } - parameters.setPreviewSize(width, height); - parameters.setPreviewFrameRate(fps); + parameters.set("camera-id", params.cameraId); + parameters.setPreviewSize(params.width, params.height); + parameters.setPreviewFrameRate(Math.round(params.fps)); if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { Log.w(tag, "Auto Focus supported by camera device"); parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); @@ -127,9 +94,8 @@ public abstract class AndroidCameraRecord { onSettingParameters(parameters); camera.setParameters(parameters); - - SurfaceHolder holder = surfaceView.getHolder(); + SurfaceHolder holder = params.surfaceView.getHolder(); try { camera.setPreviewDisplay(holder); } @@ -151,7 +117,7 @@ public abstract class AndroidCameraRecord { // Register callback to get capture buffer if (storedPreviewCallback != null) { - reallySetPreviewCallback(camera, storedPreviewCallback); + lowLevelSetPreviewCallback(camera, storedPreviewCallback); } @@ -171,120 +137,69 @@ public abstract class AndroidCameraRecord { */ public void onCameraStarted(Camera camera) {} - public void setOrStorePreviewCallBack(PreviewCallback cb) { + public void storePreviewCallBack(PreviewCallback cb) { if (camera == null) { Log.w(tag, "Capture camera not ready, storing callback"); this.storedPreviewCallback = cb; return; } - reallySetPreviewCallback(camera, cb); + lowLevelSetPreviewCallback(camera, cb); } - private static void stopPreview() { - camera.setPreviewCallback(null); // TODO check if used whatever the SDK version + void stopPreview() { + if (!previewStarted) return; + lowLevelSetPreviewCallback(camera, null); camera.stopPreview(); camera.release(); camera=null; previewStarted = false; } - public static final void setSurfaceView(final SurfaceView sv) { - SurfaceHolder holder = sv.getHolder(); - holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - - holder.addCallback(new Callback() { - public void surfaceDestroyed(SurfaceHolder holder) { - AndroidCameraRecord.surfaceView = null; - - if (camera == null) { - Log.e(tag, "Video capture: illegal state: surface destroyed but camera is already null"); - return; - } - stopPreview(); - Log.w(tag, "Video capture Surface destroyed"); - } - - public void surfaceCreated(SurfaceHolder holder) { - AndroidCameraRecord.surfaceView = sv; - Log.w(tag, "Video capture surface created"); - - if (instance != null) { - instance.startPreview(); - } - - holder.isCreating(); - } - - public void surfaceChanged(SurfaceHolder holder, int format, int width, - int height) { - Log.w(tag, "Video capture surface changed"); - } - }); - } - - - public void stopCaptureCallback() { if (camera != null) { - reallySetPreviewCallback(camera, null); + lowLevelSetPreviewCallback(camera, null); } } - protected void reallySetPreviewCallback(Camera camera, PreviewCallback cb) { - camera.setPreviewCallback(cb); - } + protected abstract void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb); - public static void setOrientationCode(int orientation) { - AndroidCameraRecord.orientationCode = (4 + 1 - orientation) % 4; + public void setRotation(int rotation) { + orientationCode = (4 + 1 - rotation) % 4; } protected int getOrientationCode() { return orientationCode; } - public static void setMuteCamera(boolean m) { - if (m == muted) return; - muted = m; - if (muted && previewStarted) { - stopPreview(); - return; - } + + + public static class RecorderParams { + public float fps; + public int height; + public int width; + + final long filterDataNativePtr; + int cameraId; + int rotation; + public SurfaceView surfaceView; - if (!muted) { - instance.startPreview(); + public RecorderParams(long ptr) { + filterDataNativePtr = ptr; } - } - public static void toggleMute() { - setMuteCamera(!muted); + + + + public boolean isStarted() { + return previewStarted; } - public static List supportedVideoSizes() { - if (supportedVideoSizes != null) { - return new ArrayList(supportedVideoSizes); - } - - if (camera == null) { - camera = Camera.open(); - supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); - camera.release(); - return supportedVideoSizes; - } - - throw new RuntimeException("Should not be there"); - } - - public static boolean getCameraMuted() { - return muted; - } - - public static void invalidateParameters() { - parametersSet = false; - stopPreview(); + public List getSupportedVideoSizes() { + return new ArrayList(supportedVideoSizes); } } diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordBufferedImpl.java index 886ad222e..9445b40ee 100644 --- a/AndroidCameraRecordBufferedImpl.java +++ b/AndroidCameraRecordBufferedImpl.java @@ -32,13 +32,16 @@ import android.util.Log; */ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { - public AndroidCameraRecordBufferedImpl(long filterCtxPtr) { - super(filterCtxPtr); + + public AndroidCameraRecordBufferedImpl(RecorderParams parameters) { + super(parameters); } @Override - protected void reallySetPreviewCallback(Camera camera, PreviewCallback cb) { - Log.d("Linphone", "Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); + protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { + if (cb != null) { + Log.d("Linphone", "Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); + } camera.setPreviewCallbackWithBuffer(cb); } diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java index db4e128de..38ca02fec 100644 --- a/AndroidCameraRecordImpl.java +++ b/AndroidCameraRecordImpl.java @@ -34,17 +34,14 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev private long filterCtxPtr; private double timeElapsedBetweenFrames = 0; private long lastFrameTime = 0; + private final long expectedTimeBetweenFrames; - public AndroidCameraRecordImpl(long filterCtxPtr) { - super(); + public AndroidCameraRecordImpl(RecorderParams parameters) { + super(parameters); + expectedTimeBetweenFrames = 1l / Math.round(parameters.fps); + filterCtxPtr = parameters.filterDataNativePtr; - try { - this.filterCtxPtr = filterCtxPtr; - setOrStorePreviewCallBack(this); - } catch (Throwable e) { - Log.e("Linphone", "Error"); - } - + storePreviewCallBack(this); } @@ -56,6 +53,10 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev Log.e("Linphone", "onPreviewFrame Called with null buffer"); return; } + if (filterCtxPtr == 0l) { + Log.e("Linphone", "onPreviewFrame Called with no filterCtxPtr set"); + return; + } Size s = camera.getParameters().getPreviewSize(); int expectedBuffLength = s.width * s.height * 3 /2; @@ -73,7 +74,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev } double currentTimeElapsed = 0.8 * (curTime - lastFrameTime) / 1000 + 0.2 * timeElapsedBetweenFrames; - if (1 / currentTimeElapsed > fps) { + if (currentTimeElapsed < expectedTimeBetweenFrames) { // Log.d("Linphone", "Clipping frame " + Math.round(1 / currentTimeElapsed) + " > " + fps); return; } @@ -85,5 +86,11 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev } + @Override + protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { + camera.setPreviewCallback(cb); + } + + } diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java new file mode 100644 index 000000000..9295bf0b0 --- /dev/null +++ b/AndroidCameraRecordManager.java @@ -0,0 +1,190 @@ +/* +AndroidCameraRecordManager.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.linphone.core.AndroidCameraRecord.RecorderParams; + +import android.hardware.Camera; +import android.hardware.Camera.Size; +import android.os.Build; +import android.util.Log; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.SurfaceHolder.Callback; + + + +/** + * Manage the video capture; one instance per camera. + * + * @author Guillaume Beraudo + * + */ +public class AndroidCameraRecordManager { + public static final int CAMERA_ID_FIXME_USE_PREFERENCE = 0; + private static final int version = Integer.parseInt(Build.VERSION.SDK); + private static Map instances = new HashMap(); + + + // singleton + private AndroidCameraRecordManager(int cameraId) { + this.cameraId = cameraId; + } + + /** + * @param cameraId : see max_camera_id + * @return + */ + public static final synchronized AndroidCameraRecordManager getInstance(int cameraId) { + if (cameraId < 0) { + Log.e("Linphone", "Asking unmanageable camera " + cameraId); + return null; + } + + AndroidCameraRecordManager m = instances.get(cameraId); + if (m == null) { + m = new AndroidCameraRecordManager(cameraId); + instances.put(cameraId, m); + } + return m; + } + + public static final synchronized AndroidCameraRecordManager getInstance() { + return getInstance(0); + } + + private AndroidCameraRecord.RecorderParams parameters; + private SurfaceView surfaceView; + private boolean muted; + + + private AndroidCameraRecord recorder; + private final Integer cameraId; + + private List supportedVideoSizes; + private int rotation; + + + public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) { + RecorderParams p = new RecorderParams(filterDataPtr); + p.fps = fps; + p.width = width; + p.height = height; + p.cameraId = cameraId; + parameters = p; + } + + + public final void setSurfaceView(final SurfaceView sv, final int rotation) { + this.rotation = rotation; + SurfaceHolder holder = sv.getHolder(); + holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + + holder.addCallback(new Callback() { + public void surfaceDestroyed(SurfaceHolder holder) { + surfaceView = null; + stopVideoRecording(); + } + + public void surfaceCreated(SurfaceHolder holder) { + surfaceView = sv; + tryToStartVideoRecording(); + } + + public void surfaceChanged(SurfaceHolder holder, int format, int width, + int height) {} + }); + } + + public void setMuted(boolean muteState) { + if (muteState == muted) return; + muted = muteState; + if (muted) { + stopVideoRecording(); + } else { + tryToStartVideoRecording(); + } + } + public void toggleMute() { + setMuted(!muted); + } + public boolean isMuted() { + return muted; + } + + + private void tryToStartVideoRecording() { + if (muted || surfaceView == null || parameters == null) return; + + parameters.rotation = rotation; + parameters.surfaceView = surfaceView; + if (version > 8) { + recorder = new AndroidCameraRecordBufferedImpl(parameters); + } else { + recorder = new AndroidCameraRecordImpl(parameters); + } + + recorder.startPreview(); + } + + public void stopVideoRecording() { + if (recorder != null) { + recorder.stopPreview(); + recorder = null; + } + } + + + // FIXME select right camera + public List supportedVideoSizes() { + if (supportedVideoSizes != null) { + return supportedVideoSizes; + } + + if (recorder != null) { + supportedVideoSizes = recorder.getSupportedVideoSizes(); + if (supportedVideoSizes != null) return supportedVideoSizes; + } + + Camera camera = Camera.open(); + supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); + camera.release(); + return supportedVideoSizes; + } + + + public boolean isRecording() { + if (recorder != null) { + return recorder.isStarted(); + } + + return false; + } + + public void invalidateParameters() { + if (isRecording()) stopVideoRecording(); + parameters = null; + + } + +} diff --git a/tutorials/JavaCameraRecordImpl.java b/tutorials/JavaCameraRecordImpl.java index 30c1838f6..12594ccef 100644 --- a/tutorials/JavaCameraRecordImpl.java +++ b/tutorials/JavaCameraRecordImpl.java @@ -33,11 +33,13 @@ public class JavaCameraRecordImpl extends AndroidCameraRecord implements Preview private long startTime; private long endTime; + private int fps; - - public JavaCameraRecordImpl() { - super(); - setOrStorePreviewCallBack(this); + + public JavaCameraRecordImpl(AndroidCameraRecord.RecorderParams parameters) { + super(parameters); + storePreviewCallBack(this); + fps = Math.round(parameters.fps); } @@ -61,4 +63,10 @@ public class JavaCameraRecordImpl extends AndroidCameraRecord implements Preview Log.d("onPreviewFrame:", msg); } + + @Override + protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { + camera.setPreviewCallback(cb); + } + } diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java index 0623e34dc..4b4ccc09e 100644 --- a/tutorials/TestVideoActivity.java +++ b/tutorials/TestVideoActivity.java @@ -50,11 +50,14 @@ public class TestVideoActivity extends Activity { // SurfaceHolder holder=surfaceView.getHolder(); // holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - AndroidCameraRecord.setSurfaceView(surfaceView); + AndroidCameraRecord.RecorderParams params = new AndroidCameraRecord.RecorderParams(0); + params.surfaceView = surfaceView; + params.width = 352; + params.height = 288; + params.fps = rate; - JavaCameraRecordImpl recorder = new JavaCameraRecordImpl(); + JavaCameraRecordImpl recorder = new JavaCameraRecordImpl(params); recorder.setDebug((TextView) findViewById(R.id.videotest_debug)); - recorder.setParameters(288, 352, rate); } From 944aa6f02857bf93811ea3f13bd23d95e98c4c0b Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 29 Nov 2010 14:37:42 +0100 Subject: [PATCH 053/769] Fix regression framerate control. --- AndroidCameraRecordImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java index 38ca02fec..0409d5cb4 100644 --- a/AndroidCameraRecordImpl.java +++ b/AndroidCameraRecordImpl.java @@ -34,11 +34,11 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev private long filterCtxPtr; private double timeElapsedBetweenFrames = 0; private long lastFrameTime = 0; - private final long expectedTimeBetweenFrames; + private final double expectedTimeBetweenFrames; public AndroidCameraRecordImpl(RecorderParams parameters) { super(parameters); - expectedTimeBetweenFrames = 1l / Math.round(parameters.fps); + expectedTimeBetweenFrames = 1d / Math.round(parameters.fps); filterCtxPtr = parameters.filterDataNativePtr; storePreviewCallBack(this); From 7b9233ddf839fa712c2b706837d19ae5c9cbe59c Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 29 Nov 2010 14:40:00 +0100 Subject: [PATCH 054/769] Fix regression not using buffered capture on android v8. --- AndroidCameraRecordManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 9295bf0b0..159cc4c5a 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -138,7 +138,7 @@ public class AndroidCameraRecordManager { parameters.rotation = rotation; parameters.surfaceView = surfaceView; - if (version > 8) { + if (version >= 8) { recorder = new AndroidCameraRecordBufferedImpl(parameters); } else { recorder = new AndroidCameraRecordImpl(parameters); From 6c9b1ab07933197e91098e8c316b962e5edec2e0 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 29 Nov 2010 14:41:51 +0100 Subject: [PATCH 055/769] Cosmetics cleanup. --- AndroidCameraRecord.java | 20 ++++++++------------ AndroidCameraRecordBufferedImpl.java | 12 ++++-------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 560f4c947..c691a3176 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -52,7 +52,8 @@ public abstract class AndroidCameraRecord { public void startPreview() { // FIXME throws exception? if (previewStarted) { Log.w(tag, "Already started"); - return; + throw new RuntimeException("Video recorder already started"); + // return } if (params.surfaceView.getVisibility() != SurfaceView.VISIBLE) { @@ -91,7 +92,7 @@ public abstract class AndroidCameraRecord { } } - onSettingParameters(parameters); + onSettingCameraParameters(parameters); camera.setParameters(parameters); @@ -114,33 +115,28 @@ public abstract class AndroidCameraRecord { previewStarted = true; - // Register callback to get capture buffer - if (storedPreviewCallback != null) { - lowLevelSetPreviewCallback(camera, storedPreviewCallback); - } + lowLevelSetPreviewCallback(camera, storedPreviewCallback); - onCameraStarted(camera); + onPreviewStarted(camera); } - protected void onSettingParameters(Parameters parameters) { - - } + protected void onSettingCameraParameters(Parameters parameters) {} /** * Hook. * @param camera */ - public void onCameraStarted(Camera camera) {} + public void onPreviewStarted(Camera camera) {} public void storePreviewCallBack(PreviewCallback cb) { + this.storedPreviewCallback = cb; if (camera == null) { Log.w(tag, "Capture camera not ready, storing callback"); - this.storedPreviewCallback = cb; return; } diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordBufferedImpl.java index 9445b40ee..f58698df2 100644 --- a/AndroidCameraRecordBufferedImpl.java +++ b/AndroidCameraRecordBufferedImpl.java @@ -46,18 +46,14 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { } @Override - public void onCameraStarted(Camera camera) { - super.onCameraStarted(camera); + public void onPreviewStarted(Camera camera) { + super.onPreviewStarted(camera); Size s = camera.getParameters().getPreviewSize(); int wishedBufferSize = s.height * s.width * 3 / 2; camera.addCallbackBuffer(new byte[wishedBufferSize]); camera.addCallbackBuffer(new byte[wishedBufferSize]); -/* - for (int i=1; i < 30; i++) { - camera.addCallbackBuffer(new byte[wishedBufferSize]); - }*/ } @Override @@ -67,8 +63,8 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { } @Override - protected void onSettingParameters(Parameters parameters) { - super.onSettingParameters(parameters); + protected void onSettingCameraParameters(Parameters parameters) { + super.onSettingCameraParameters(parameters); // Only on v8 hardware camera.setDisplayOrientation(90 * orientationCode); } From 0e3fb02e229115fe62ec7d40ee38a8eab483a832 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 29 Nov 2010 15:06:17 +0100 Subject: [PATCH 056/769] fixed orientation doesn't work --- AndroidVideoWindowImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index 9f6281bec..ec7eb2cbb 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -48,10 +48,16 @@ public class AndroidVideoWindowImpl { } if (mListener!=null) mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); - Log.w("Linphone", "Video display surface destroyed"); + Log.d("Linphone", "Video display surface destroyed"); } }); } + static final int LANDSCAPE=0; + static final int PORTRAIT=1; + public void requestOrientation(int orientation){ + //Surface.setOrientation(0, orientation==LANDSCAPE ? 1 : 0); + //Log.d("Linphone", "Orientation changed."); + } public void setListener(VideoWindowListener l){ mListener=l; } From f54a55d359a906f8e2dfb44252febd3bc968c3d0 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 30 Nov 2010 19:02:11 +0100 Subject: [PATCH 057/769] add proxy suport to TutorialBuddyStatusActivity --- tutorials/TutorialBuddyStatusActivity.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tutorials/TutorialBuddyStatusActivity.java b/tutorials/TutorialBuddyStatusActivity.java index d42607d16..1bf4f981f 100644 --- a/tutorials/TutorialBuddyStatusActivity.java +++ b/tutorials/TutorialBuddyStatusActivity.java @@ -38,6 +38,9 @@ public class TutorialBuddyStatusActivity extends Activity { private static final String defaultSipAddress = "sip:"; private TextView sipAddressWidget; + private TextView mySipAddressWidget; + private TextView mySipPasswordWidget; + private TutorialBuddyStatus tutorial; private Handler mHandler = new Handler() ; private Button buttonCall; @@ -49,6 +52,12 @@ public class TutorialBuddyStatusActivity extends Activity { sipAddressWidget = (TextView) findViewById(R.id.AddressId); sipAddressWidget.setText(defaultSipAddress); + mySipAddressWidget = (TextView) findViewById(R.id.MyAddressId); + mySipAddressWidget.setVisibility(View.VISIBLE); + mySipPasswordWidget = (TextView) findViewById(R.id.Password); + mySipPasswordWidget.setVisibility(TextView.VISIBLE); + + // Output text to the outputText widget final TextView outputText = (TextView) findViewById(R.id.OutputText); final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); @@ -84,7 +93,9 @@ public class TutorialBuddyStatusActivity extends Activity { public void run() { super.run(); try { - tutorial.launchTutorial(sipAddressWidget.getText().toString()); + String myIdentity = mySipAddressWidget.getText().length()>0?mySipAddressWidget.getText().toString():null; + String myPassword = mySipPasswordWidget.getText().length()>0?mySipPasswordWidget.getText().toString():null; + tutorial.launchTutorial(sipAddressWidget.getText().toString(), myIdentity, myPassword); mHandler.post(new Runnable() { public void run() { buttonCall.setEnabled(true); From 8f406c57066cf0e8b002d5f46c5488030e0d0166 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 1 Dec 2010 11:39:19 +0100 Subject: [PATCH 058/769] Portrait mode. --- AndroidCameraRecord.java | 7 ++++++- AndroidCameraRecordImpl.java | 8 +++++--- AndroidCameraRecordManager.java | 13 ++++++++++--- LinphoneCallImpl.java | 5 +++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index c691a3176..9d8b2f144 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -77,7 +77,11 @@ public abstract class AndroidCameraRecord { } parameters.set("camera-id", params.cameraId); - parameters.setPreviewSize(params.width, params.height); + if (!params.videoDimensionsInverted) { + parameters.setPreviewSize(params.width, params.height); + } else { + parameters.setPreviewSize(params.height, params.width); + } parameters.setPreviewFrameRate(Math.round(params.fps)); if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { Log.w(tag, "Auto Focus supported by camera device"); @@ -182,6 +186,7 @@ public abstract class AndroidCameraRecord { int cameraId; int rotation; public SurfaceView surfaceView; + boolean videoDimensionsInverted; public RecorderParams(long ptr) { filterDataNativePtr = ptr; diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java index 0409d5cb4..2d3087854 100644 --- a/AndroidCameraRecordImpl.java +++ b/AndroidCameraRecordImpl.java @@ -35,17 +35,19 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev private double timeElapsedBetweenFrames = 0; private long lastFrameTime = 0; private final double expectedTimeBetweenFrames; + private boolean videoDimensionsInverted; public AndroidCameraRecordImpl(RecorderParams parameters) { super(parameters); expectedTimeBetweenFrames = 1d / Math.round(parameters.fps); filterCtxPtr = parameters.filterDataNativePtr; + videoDimensionsInverted = parameters.videoDimensionsInverted; storePreviewCallBack(this); } - private native void putImage(long filterCtxPtr, byte[] buffer, int orientation); + private native void putImage(long filterCtxPtr, byte[] buffer, int orientation, boolean videoDimensionsInverted); public void onPreviewFrame(byte[] data, Camera camera) { @@ -69,7 +71,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev long curTime = System.currentTimeMillis(); if (lastFrameTime == 0) { lastFrameTime = curTime; - putImage(filterCtxPtr, data, getOrientationCode()); + putImage(filterCtxPtr, data, getOrientationCode(), videoDimensionsInverted); return; } @@ -82,7 +84,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev timeElapsedBetweenFrames = currentTimeElapsed; // Log.d("onPreviewFrame: ", Integer.toString(data.length)); - putImage(filterCtxPtr, data, getOrientationCode()); + putImage(filterCtxPtr, data, getOrientationCode(), videoDimensionsInverted); } diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 159cc4c5a..02e7eb497 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -44,7 +44,7 @@ public class AndroidCameraRecordManager { public static final int CAMERA_ID_FIXME_USE_PREFERENCE = 0; private static final int version = Integer.parseInt(Build.VERSION.SDK); private static Map instances = new HashMap(); - + // singleton private AndroidCameraRecordManager(int cameraId) { @@ -83,16 +83,19 @@ public class AndroidCameraRecordManager { private List supportedVideoSizes; private int rotation; + private static final String tag = "Linphone"; public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) { + stopVideoRecording(); RecorderParams p = new RecorderParams(filterDataPtr); p.fps = fps; p.width = width; p.height = height; p.cameraId = cameraId; + p.videoDimensionsInverted = width < height; parameters = p; - } + } public final void setSurfaceView(final SurfaceView sv, final int rotation) { @@ -103,16 +106,20 @@ public class AndroidCameraRecordManager { holder.addCallback(new Callback() { public void surfaceDestroyed(SurfaceHolder holder) { surfaceView = null; + Log.d(tag , "Video capture surface destroyed"); stopVideoRecording(); } public void surfaceCreated(SurfaceHolder holder) { surfaceView = sv; + Log.d(tag , "Video capture surface created"); tryToStartVideoRecording(); } public void surfaceChanged(SurfaceHolder holder, int format, int width, - int height) {} + int height) { + Log.d(tag , "Video capture surface changed"); + } }); } diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index b6194c26f..a73492274 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -30,6 +30,7 @@ class LinphoneCallImpl implements LinphoneCall { native private long getRemoteAddress(long nativePtr); native private int getState(long nativePtr); private native long getCurrentParams(long nativePtr); + private native void enableCamera(long nativePtr, boolean enabled); protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -66,4 +67,8 @@ class LinphoneCallImpl implements LinphoneCall { public LinphoneCallParams getCurrentParamsReadWrite() { return getCurrentParamsReadOnly().copy(); } + + public void enableCamera(boolean enabled) { + enableCamera(nativePtr, enabled); + } } From 8b7584e4c644d8adde23fbfe711a911e4a711374 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 1 Dec 2010 14:24:39 +0100 Subject: [PATCH 059/769] Fix video capture not restarting on setParameters from filter. --- AndroidCameraRecordManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 02e7eb497..800879dd5 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -95,6 +95,7 @@ public class AndroidCameraRecordManager { p.cameraId = cameraId; p.videoDimensionsInverted = width < height; parameters = p; + tryToStartVideoRecording(); } From bf7f4a028643204629c9526cb0efe8336791fa79 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 1 Dec 2010 17:03:22 +0100 Subject: [PATCH 060/769] Cleanup. --- AndroidCameraRecordManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 800879dd5..4c767b887 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -189,10 +189,10 @@ public class AndroidCameraRecordManager { return false; } + public void invalidateParameters() { - if (isRecording()) stopVideoRecording(); + stopVideoRecording(); parameters = null; - } } From fb6a4a0bb508e66439f194e9a0d538f7f6ce8fc2 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 2 Dec 2010 12:29:51 +0100 Subject: [PATCH 061/769] Fix links to ABI>=5 in video code preventing use with old telephones. Disable video when ABI<5 or ILBC not found. Automatically open preference activity on linphone first launch. --- AndroidCameraRecord.java | 22 +++------- AndroidCameraRecordBufferedImpl.java | 2 +- AndroidCameraRecordImplAPI5.java | 64 ++++++++++++++++++++++++++++ AndroidCameraRecordManager.java | 23 +++++++--- 4 files changed, 89 insertions(+), 22 deletions(-) create mode 100644 AndroidCameraRecordImplAPI5.java diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 9d8b2f144..7fa4746bb 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone.core; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import android.hardware.Camera; @@ -39,7 +40,7 @@ public abstract class AndroidCameraRecord { private PreviewCallback storedPreviewCallback; private boolean previewStarted; protected int orientationCode; - private static final String tag="Linphone"; + protected static final String tag="Linphone"; private List supportedVideoSizes; public AndroidCameraRecord(RecorderParams parameters) { @@ -47,7 +48,9 @@ public abstract class AndroidCameraRecord { setRotation(parameters.rotation); } - + protected List getSupportedPreviewSizes(Camera.Parameters parameters) { + return Collections.emptyList(); + } public void startPreview() { // FIXME throws exception? if (previewStarted) { @@ -73,7 +76,7 @@ public abstract class AndroidCameraRecord { Camera.Parameters parameters=camera.getParameters(); if (supportedVideoSizes == null) { - supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); + supportedVideoSizes = getSupportedPreviewSizes(camera.getParameters()); } parameters.set("camera-id", params.cameraId); @@ -83,18 +86,7 @@ public abstract class AndroidCameraRecord { parameters.setPreviewSize(params.height, params.width); } parameters.setPreviewFrameRate(Math.round(params.fps)); - if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { - Log.w(tag, "Auto Focus supported by camera device"); - parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); - } else { - Log.w(tag, "Auto Focus not supported by camera device"); - if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { - Log.w(tag, "Infinity Focus supported by camera device"); - parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); - } else { - Log.w(tag, "Infinity Focus not supported by camera device"); - } - } + onSettingCameraParameters(parameters); camera.setParameters(parameters); diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordBufferedImpl.java index f58698df2..9f8b2d1c0 100644 --- a/AndroidCameraRecordBufferedImpl.java +++ b/AndroidCameraRecordBufferedImpl.java @@ -30,7 +30,7 @@ import android.util.Log; * @author Guillaume Beraudo * */ -public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { +public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 { public AndroidCameraRecordBufferedImpl(RecorderParams parameters) { diff --git a/AndroidCameraRecordImplAPI5.java b/AndroidCameraRecordImplAPI5.java new file mode 100644 index 000000000..7ff307d03 --- /dev/null +++ b/AndroidCameraRecordImplAPI5.java @@ -0,0 +1,64 @@ +/* +AndroidCameraRecordImplAPI5.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.util.List; + +import android.hardware.Camera; +import android.hardware.Camera.Parameters; +import android.hardware.Camera.Size; +import android.util.Log; + + +public class AndroidCameraRecordImplAPI5 extends AndroidCameraRecordImpl { + + public AndroidCameraRecordImplAPI5(RecorderParams parameters) { + super(parameters); + } + + @Override + protected void onSettingCameraParameters(Parameters parameters) { + super.onSettingCameraParameters(parameters); + + if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { + Log.w(tag, "Auto Focus supported by camera device"); + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); + } else { + Log.w(tag, "Auto Focus not supported by camera device"); + if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { + Log.w(tag, "Infinity Focus supported by camera device"); + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); + } else { + Log.w(tag, "Infinity Focus not supported by camera device"); + } + } + } + + public static List oneShotSupportedVideoSizes() { + Camera camera = Camera.open(); + List supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes(); + camera.release(); + return supportedVideoSizes; + } + + @Override + protected List getSupportedPreviewSizes(Parameters parameters) { + return parameters.getSupportedPreviewSizes(); + } +} diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 4c767b887..c6bae18da 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -24,7 +24,6 @@ import java.util.Map; import org.linphone.core.AndroidCameraRecord.RecorderParams; -import android.hardware.Camera; import android.hardware.Camera.Size; import android.os.Build; import android.util.Log; @@ -41,7 +40,6 @@ import android.view.SurfaceHolder.Callback; * */ public class AndroidCameraRecordManager { - public static final int CAMERA_ID_FIXME_USE_PREFERENCE = 0; private static final int version = Integer.parseInt(Build.VERSION.SDK); private static Map instances = new HashMap(); @@ -52,7 +50,8 @@ public class AndroidCameraRecordManager { } /** - * @param cameraId : see max_camera_id + * Instance for a given camera + * @param cameraId : starting from 0 * @return */ public static final synchronized AndroidCameraRecordManager getInstance(int cameraId) { @@ -69,6 +68,9 @@ public class AndroidCameraRecordManager { return m; } + /** + * @return instance for the default camera + */ public static final synchronized AndroidCameraRecordManager getInstance() { return getInstance(0); } @@ -148,6 +150,8 @@ public class AndroidCameraRecordManager { parameters.surfaceView = surfaceView; if (version >= 8) { recorder = new AndroidCameraRecordBufferedImpl(parameters); + } else if (version >= 5) { + recorder = new AndroidCameraRecordImplAPI5(parameters); } else { recorder = new AndroidCameraRecordImpl(parameters); } @@ -164,6 +168,10 @@ public class AndroidCameraRecordManager { // FIXME select right camera + /** + * Eventually null if API < 5. + * + */ public List supportedVideoSizes() { if (supportedVideoSizes != null) { return supportedVideoSizes; @@ -174,9 +182,12 @@ public class AndroidCameraRecordManager { if (supportedVideoSizes != null) return supportedVideoSizes; } - Camera camera = Camera.open(); - supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); - camera.release(); + if (version >= 5) { + supportedVideoSizes = AndroidCameraRecordImplAPI5.oneShotSupportedVideoSizes(); + } + + // eventually null + return supportedVideoSizes; } From 6df330a6b4f6d45a651fd3d27a25d686f752a186 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 3 Dec 2010 16:13:01 +0100 Subject: [PATCH 062/769] Add video codecs preference. Integrate JNI code for getting list of available video codecs. --- LinphoneCoreImpl.java | 16 +++++++++++++++- PayloadTypeImpl.java | 13 ++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 745c8c358..62741c7ef 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -85,9 +85,10 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setDownloadBandwidth(long nativePtr, int bw); private native void setPreferredVideoSize(long nativePtr, int width, int heigth); private native int[] getPreferredVideoSize(long nativePtr); - private native void setRing(long nativePtr, String path); private native String getRing(long nativePtr); + private native long[] listVideoPayloadTypes(long nativePtr); + private static String TAG = "LinphoneCore"; @@ -415,4 +416,17 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return false; } + + public PayloadType[] listVideoCodecs() { + long[] typesPtr = listVideoPayloadTypes(nativePtr); + if (typesPtr == null) return null; + + PayloadType[] codecs = new PayloadType[typesPtr.length]; + + for (int i=0; i < codecs.length; i++) { + codecs[i] = new PayloadTypeImpl(typesPtr[i]); + } + + return codecs; + } } diff --git a/PayloadTypeImpl.java b/PayloadTypeImpl.java index 28c206786..864b094ff 100644 --- a/PayloadTypeImpl.java +++ b/PayloadTypeImpl.java @@ -24,10 +24,21 @@ class PayloadTypeImpl implements PayloadType { protected final long nativePtr; private native String toString(long ptr); - + private native String getMime(long ptr); + private native int getRate(long ptr); + protected PayloadTypeImpl(long aNativePtr) { nativePtr = aNativePtr; } + + public int getRate() { + return getRate(nativePtr); + } + + public String getMime() { + return getMime(nativePtr); + } + public String toString() { return toString(nativePtr); } From 7adf2c94b8bd25b3caf1cb743d0b34cd85e83a98 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 6 Dec 2010 11:40:28 +0100 Subject: [PATCH 063/769] implement enablePublish --- LinphoneCoreImpl.java | 17 ++++++++++++++++- LinphoneProxyConfigImpl.java | 10 ++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 01b98bda4..5aa6a1ce0 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -179,7 +179,7 @@ class LinphoneCoreImpl implements LinphoneCore { throw new RuntimeException("object already destroyed"); } } - public void setNetworkStateReachable(boolean isReachable) { + public void setNetworkReachable(boolean isReachable) { setNetworkStateReachable(nativePtr,isReachable); } public void setPlaybackGain(float gain) { @@ -344,6 +344,21 @@ class LinphoneCoreImpl implements LinphoneCore { public LinphoneCallParams createDefaultCallParameters() { throw new RuntimeException("Not Implemenetd yet"); } + public boolean isNetworkReachable() { + throw new RuntimeException("Not Implemenetd yet"); + } + public void setUploadBandwidth(int bw) { + throw new RuntimeException("Not Implemenetd yet"); + } + public void setDownloadBandwidth(int bw) { + throw new RuntimeException("Not Implemenetd yet"); + } + public void setPreferredVideoSize(VideoSize vSize) { + throw new RuntimeException("Not Implemenetd yet"); + } + public VideoSize getPreferredVideoSize() { + throw new RuntimeException("Not Implemenetd yet"); + } } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index f1dcb70a4..1b718d5a7 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -67,6 +67,9 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native String getRoute(long ptr); private native int setRoute(long ptr,String uri); + private native void enablePublish(long ptr,boolean enable); + private native boolean publishEnabled(long ptr); + public void enableRegister(boolean value) { enableRegister(nativePtr,value); @@ -121,4 +124,11 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { throw new LinphoneCoreException("cannot set route ["+routeUri+"]"); } } + public void enablePublish(boolean enable) { + enablePublish(nativePtr,enable); + + } + public boolean publishEnabled() { + return publishEnabled(nativePtr); + } } From 289140257f58020e60fd16658a9c0b0079726d1a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 6 Dec 2010 12:16:23 +0100 Subject: [PATCH 064/769] fix unimplemented method --- LinphoneCallImpl.java | 3 +++ LinphoneCoreImpl.java | 3 +++ PayloadTypeImpl.java | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index ed8f00708..ca9d9d55f 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -61,6 +61,9 @@ class LinphoneCallImpl implements LinphoneCall { public LinphoneCallParams getCurrentParamsReadOnly() { throw new RuntimeException("Not Implemenetd yet"); } + public void enableCamera(boolean enabled) { + throw new RuntimeException("Not Implemenetd yet"); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 5aa6a1ce0..83df6de86 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -359,6 +359,9 @@ class LinphoneCoreImpl implements LinphoneCore { public VideoSize getPreferredVideoSize() { throw new RuntimeException("Not Implemenetd yet"); } + public PayloadType[] listVideoCodecs() { + throw new RuntimeException("Not Implemenetd yet"); + } } diff --git a/PayloadTypeImpl.java b/PayloadTypeImpl.java index 28c206786..821e1a091 100644 --- a/PayloadTypeImpl.java +++ b/PayloadTypeImpl.java @@ -31,4 +31,8 @@ class PayloadTypeImpl implements PayloadType { public String toString() { return toString(nativePtr); } + + public String getMime() { + throw new RuntimeException("Not Implemenetd yet"); + } } From 77745099ba904b7ff0bf1563ab9129c611f50182 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 6 Dec 2010 14:31:49 +0100 Subject: [PATCH 065/769] Fixed current CallParams not copied. Fixed not always sending static image on camera muted. Improved organization of preference activity. --- LinphoneCallImpl.java | 9 +++------ LinphoneCallParamsImpl.java | 11 ++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index a73492274..74c701a72 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -29,7 +29,7 @@ class LinphoneCallImpl implements LinphoneCall { private native boolean isIncoming(long nativePtr); native private long getRemoteAddress(long nativePtr); native private int getState(long nativePtr); - private native long getCurrentParams(long nativePtr); + private native long getCurrentParamsCopy(long nativePtr); private native void enableCamera(long nativePtr, boolean enabled); protected LinphoneCallImpl(long aNativePtr) { @@ -61,11 +61,8 @@ class LinphoneCallImpl implements LinphoneCall { public State getState() { return LinphoneCall.State.fromInt(getState(nativePtr)); } - public LinphoneCallParams getCurrentParamsReadOnly() { - return new LinphoneCallParamsImpl(getCurrentParams(nativePtr)); - } - public LinphoneCallParams getCurrentParamsReadWrite() { - return getCurrentParamsReadOnly().copy(); + public LinphoneCallParams getCurrentParamsCopy() { + return new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); } public void enableCamera(boolean enabled) { diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java index 1242ee996..33d460697 100644 --- a/LinphoneCallParamsImpl.java +++ b/LinphoneCallParamsImpl.java @@ -27,7 +27,7 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native void enableVideo(long nativePtr, boolean b); private native boolean getVideoEnabled(long nativePtr); - private native long copy(long nativePtr); + private native void destroy(long nativePtr); public boolean getVideoEnabled() { @@ -37,9 +37,10 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public void setVideoEnabled(boolean b) { enableVideo(nativePtr, b); } - - public LinphoneCallParams copy() { - return new LinphoneCallParamsImpl(copy(nativePtr)); + + @Override + protected void finalize() throws Throwable { + destroy(nativePtr); + super.finalize(); } - } From 2b829b72b6b990b9e6eab653407ac30c7347f4ed Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 6 Dec 2010 15:06:59 +0100 Subject: [PATCH 066/769] Fixed unimplemented methods. Full brightness on videocall activity. --- LinphoneProxyConfigImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index f1dcb70a4..5bf4971d0 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -121,4 +121,10 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { throw new LinphoneCoreException("cannot set route ["+routeUri+"]"); } } + public void enablePublish(boolean enable) { + throw new RuntimeException("not implemented"); + } + public boolean publishEnabled() { + throw new RuntimeException("not implemented"); + } } From 16749d14d3f6535b6ba399a5d0d8962b740979ea Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 7 Dec 2010 10:32:52 +0100 Subject: [PATCH 067/769] Simplify registration tutorial. --- tutorials/TutorialRegistrationActivity.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tutorials/TutorialRegistrationActivity.java b/tutorials/TutorialRegistrationActivity.java index d87446140..6da10f3d6 100644 --- a/tutorials/TutorialRegistrationActivity.java +++ b/tutorials/TutorialRegistrationActivity.java @@ -42,6 +42,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { private TutorialRegistration tutorial; private Button buttonCall; private Handler mHandler = new Handler(); + private TextView outputText; @Override @@ -55,7 +56,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { sipPasswordWidget.setText(defaultSipPassword); // Output text to the outputText widget - final TextView outputText = (TextView) findViewById(R.id.OutputText); + outputText = (TextView) findViewById(R.id.OutputText); final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); @@ -66,6 +67,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { // Assign call action to call button buttonCall = (Button) findViewById(R.id.CallButton); + buttonCall.setText("Register"); buttonCall.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TutorialLaunchingThread thread = new TutorialLaunchingThread(); @@ -74,13 +76,9 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { } }); - // Assign stop action to stop button + // Hide stop button Button buttonStop = (Button) findViewById(R.id.ButtonStop); - buttonStop.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - tutorial.stopMainLoop(); - } - }); + buttonStop.setVisibility(View.GONE); } @@ -92,13 +90,9 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { tutorial.launchTutorial( sipAddressWidget.getText().toString(), sipPasswordWidget.getText().toString()); - mHandler.post(new Runnable() { - public void run() { - buttonCall.setEnabled(true); - } - }); } catch (LinphoneCoreException e) { e.printStackTrace(); + outputText.setText(e.getMessage() +"\n"+outputText.getText()); } } } From 5566daf9b1dc7451909dcdf3e1c2b730e6ddf896 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 9 Dec 2010 09:08:12 +0100 Subject: [PATCH 068/769] Fixed and improved video test. --- tutorials/JavaCameraRecordImpl.java | 9 ++ tutorials/TestVideoActivity.java | 160 ++++++++++++++++++++++++---- 2 files changed, 150 insertions(+), 19 deletions(-) diff --git a/tutorials/JavaCameraRecordImpl.java b/tutorials/JavaCameraRecordImpl.java index 12594ccef..33cc6b22e 100644 --- a/tutorials/JavaCameraRecordImpl.java +++ b/tutorials/JavaCameraRecordImpl.java @@ -22,6 +22,7 @@ import org.linphone.core.AndroidCameraRecord; import android.hardware.Camera; import android.hardware.Camera.PreviewCallback; +import android.hardware.Camera.Size; import android.util.Log; import android.widget.TextView; @@ -49,6 +50,14 @@ public class JavaCameraRecordImpl extends AndroidCameraRecord implements Preview public void onPreviewFrame(byte[] data, Camera camera) { + Size s = camera.getParameters().getPreviewSize(); + int expectedBuffLength = s.width * s.height * 3 /2; + if (expectedBuffLength != data.length) { + Log.e("Linphone", "onPreviewFrame called with bad buffer length " + data.length + + " whereas expected is " + expectedBuffLength + " don't calling putImage"); + return; + } + if ((count % 2 * fps) == 0) { endTime = System.currentTimeMillis(); averageCalledRate = (100000 * 2 * fps) / (endTime - startTime); diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java index 4b4ccc09e..971b8f73f 100644 --- a/tutorials/TestVideoActivity.java +++ b/tutorials/TestVideoActivity.java @@ -15,16 +15,27 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ + */ package org.linphone.core.tutorials; +import java.util.Stack; + import org.linphone.R; import org.linphone.core.AndroidCameraRecord; +import org.linphone.core.VideoSize; import android.app.Activity; import android.os.Bundle; +import android.util.Log; +import android.view.SurfaceHolder; import android.view.SurfaceView; +import android.view.View; +import android.view.SurfaceHolder.Callback; +import android.view.View.OnClickListener; +import android.view.ViewGroup.LayoutParams; +import android.widget.Button; import android.widget.TextView; +import static org.linphone.core.VideoSize.*; /** * Activity for displaying and starting the HelloWorld example on Android phone. @@ -32,38 +43,149 @@ import android.widget.TextView; * @author Guillaume Beraudo * */ -public class TestVideoActivity extends Activity { +public class TestVideoActivity extends Activity implements Callback, OnClickListener { private SurfaceView surfaceView; private static final int rate = 7; + private JavaCameraRecordImpl recorder; + private static String tag = "Linphone"; + private TextView debugView; + private Button nextSize; + private Button changeCamera; + private Button changeOrientation; + private AndroidCameraRecord.RecorderParams params; + + private Stack videoSizes = createSizesToTest(); + private int currentCameraId = 2; + private boolean currentOrientationIsPortrait = false; + private int width; + private int height; + private boolean started; + + - - - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.videotest); surfaceView=(SurfaceView)findViewById(R.id.videotest_surfaceView); + + nextSize = (Button) findViewById(R.id.test_video_size); + nextSize.setOnClickListener(this); + + changeCamera = (Button) findViewById(R.id.test_video_camera); + changeCamera.setText("Cam"+otherCameraId(currentCameraId)); + changeCamera.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + changeCamera.setText("Cam"+currentCameraId); + currentCameraId = otherCameraId(currentCameraId); + updateRecording(); + } + }); -// SurfaceHolder holder=surfaceView.getHolder(); -// holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - - AndroidCameraRecord.RecorderParams params = new AndroidCameraRecord.RecorderParams(0); - params.surfaceView = surfaceView; - params.width = 352; - params.height = 288; - params.fps = rate; + changeOrientation = (Button) findViewById(R.id.test_video_orientation); + changeOrientation.setText(orientationToString(!currentOrientationIsPortrait)); + changeOrientation.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + currentOrientationIsPortrait = !currentOrientationIsPortrait; + changeOrientation.setText(orientationToString(!currentOrientationIsPortrait)); - JavaCameraRecordImpl recorder = new JavaCameraRecordImpl(params); - recorder.setDebug((TextView) findViewById(R.id.videotest_debug)); - + if (width == 0 || height == 0) return; + int newWidth = currentOrientationIsPortrait? Math.min(height, width) : Math.max(height, width); + int newHeight = currentOrientationIsPortrait? Math.max(height, width) : Math.min(height, width); + changeSurfaceViewLayout(newWidth, newHeight); // will change width and height on surfaceChanged + } + }); + + SurfaceHolder holder = surfaceView.getHolder(); + holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + holder.addCallback(this); + + + debugView = (TextView) findViewById(R.id.videotest_debug); + } + + protected void updateRecording() { + if (width == 0 || height == 0) return; + if (recorder != null) recorder.stopPreview(); + + params = new AndroidCameraRecord.RecorderParams(0); + params.surfaceView = surfaceView; + params.width = width; + params.height = height; + params.fps = rate; + params.cameraId = currentCameraId; + + recorder = new JavaCameraRecordImpl(params); +// recorder.setDebug(debugView); + debugView.setText(orientationToString(currentOrientationIsPortrait) + + " w="+width + " h="+height+ " cam"+currentCameraId); + recorder.startPreview(); + + } + + private String orientationToString(boolean orientationIsPortrait) { + return orientationIsPortrait? "Por" : "Lan"; + } + private int otherCameraId(int currentId) { + return (currentId == 2) ? 1 : 2; + } + public void onClick(View v) { + nextSize.setText("Next"); + started=true; + if (videoSizes.isEmpty()) { + videoSizes = createSizesToTest(); + } + + VideoSize size = videoSizes.pop(); + changeSurfaceViewLayout(size.getWidth(), size.getHeight()); + + // on surface changed the recorder will be restarted with new values + // and the surface will be resized } - - - + private void changeSurfaceViewLayout(int width, int height) { + LayoutParams params = surfaceView.getLayoutParams(); + params.height = height; + params.width = width; + surfaceView.setLayoutParams(params); + + } + private Stack createSizesToTest() { + Stack stack = new Stack(); + + stack.push(VideoSize.createStandard(QCIF, false)); + stack.push(VideoSize.createStandard(CIF, false)); + stack.push(VideoSize.createStandard(QVGA, false)); + stack.push(VideoSize.createStandard(HVGA, false)); + stack.push(new VideoSize(640,480)); + stack.push(new VideoSize(800,480)); + return stack; + } + + + + + public void surfaceDestroyed(SurfaceHolder holder) { + surfaceView = null; + Log.d(tag , "Video capture surface destroyed"); + if (recorder != null) recorder.stopPreview(); + } + + public void surfaceCreated(SurfaceHolder holder) { + Log.d(tag , "Video capture surface created"); + } + + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + if (!started) return; + if (recorder != null) recorder.stopPreview(); + + this.width = width; + this.height = height; + + updateRecording(); + } } From 90a5674b978b020637a89782fc90321027a3e629 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 9 Dec 2010 09:13:12 +0100 Subject: [PATCH 069/769] Preliminary support for front camera. --- AndroidCameraRecord.java | 41 ++++++++++----- AndroidCameraRecordBufferedImpl.java | 2 +- AndroidCameraRecordImpl.java | 15 +++--- AndroidCameraRecordManager.java | 77 +++++++++++++++++----------- LinphoneCallParamsImpl.java | 5 ++ 5 files changed, 88 insertions(+), 52 deletions(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 7fa4746bb..a34322f7f 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -39,13 +39,14 @@ public abstract class AndroidCameraRecord { private PreviewCallback storedPreviewCallback; private boolean previewStarted; - protected int orientationCode; + protected int displayOrientation; protected static final String tag="Linphone"; private List supportedVideoSizes; + private Size currentPreviewSize; public AndroidCameraRecord(RecorderParams parameters) { this.params = parameters; - setRotation(parameters.rotation); + setDisplayOrientation(parameters.rotation); } protected List getSupportedPreviewSizes(Camera.Parameters parameters) { @@ -75,11 +76,14 @@ public abstract class AndroidCameraRecord { Camera.Parameters parameters=camera.getParameters(); + parameters.set("camera-id",params.cameraId); + camera.setParameters(parameters); + parameters = camera.getParameters(); if (supportedVideoSizes == null) { - supportedVideoSizes = getSupportedPreviewSizes(camera.getParameters()); + supportedVideoSizes = new ArrayList(getSupportedPreviewSizes(parameters)); } - parameters.set("camera-id", params.cameraId); + if (!params.videoDimensionsInverted) { parameters.setPreviewSize(params.width, params.height); } else { @@ -91,6 +95,7 @@ public abstract class AndroidCameraRecord { onSettingCameraParameters(parameters); camera.setParameters(parameters); + currentPreviewSize = camera.getParameters().getPreviewSize(); SurfaceHolder holder = params.surfaceView.getHolder(); try { @@ -140,12 +145,13 @@ public abstract class AndroidCameraRecord { } - void stopPreview() { + public void stopPreview() { if (!previewStarted) return; lowLevelSetPreviewCallback(camera, null); camera.stopPreview(); camera.release(); camera=null; + if (currentPreviewSize != null) currentPreviewSize = null; previewStarted = false; } @@ -158,12 +164,16 @@ public abstract class AndroidCameraRecord { protected abstract void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb); - public void setRotation(int rotation) { - orientationCode = (4 + 1 - rotation) % 4; + public void setDisplayOrientation(int rotation) { + displayOrientation = rotation; } - protected int getOrientationCode() { - return orientationCode; + protected int rotateCapturedFrame() { + if (params.cameraId == 2) { + return 0; + } else { + return (4 + 1 - displayOrientation) % 4; + } } @@ -175,10 +185,10 @@ public abstract class AndroidCameraRecord { public int width; final long filterDataNativePtr; - int cameraId; - int rotation; + public int cameraId; + public int rotation; public SurfaceView surfaceView; - boolean videoDimensionsInverted; + public boolean videoDimensionsInverted; public RecorderParams(long ptr) { filterDataNativePtr = ptr; @@ -195,4 +205,11 @@ public abstract class AndroidCameraRecord { public List getSupportedVideoSizes() { return new ArrayList(supportedVideoSizes); } + + + protected int getExpectedBufferLength() { + if (currentPreviewSize == null) return -1; + + return currentPreviewSize.width * currentPreviewSize.height * 3 /2; + } } diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordBufferedImpl.java index 9f8b2d1c0..232d15970 100644 --- a/AndroidCameraRecordBufferedImpl.java +++ b/AndroidCameraRecordBufferedImpl.java @@ -66,7 +66,7 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 protected void onSettingCameraParameters(Parameters parameters) { super.onSettingCameraParameters(parameters); // Only on v8 hardware - camera.setDisplayOrientation(90 * orientationCode); + camera.setDisplayOrientation(90 * displayOrientation); } diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java index 2d3087854..daf26ea4e 100644 --- a/AndroidCameraRecordImpl.java +++ b/AndroidCameraRecordImpl.java @@ -20,7 +20,6 @@ package org.linphone.core; import android.hardware.Camera; import android.hardware.Camera.PreviewCallback; -import android.hardware.Camera.Size; import android.util.Log; /** @@ -35,19 +34,19 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev private double timeElapsedBetweenFrames = 0; private long lastFrameTime = 0; private final double expectedTimeBetweenFrames; - private boolean videoDimensionsInverted; + private boolean sizesInverted; public AndroidCameraRecordImpl(RecorderParams parameters) { super(parameters); expectedTimeBetweenFrames = 1d / Math.round(parameters.fps); filterCtxPtr = parameters.filterDataNativePtr; - videoDimensionsInverted = parameters.videoDimensionsInverted; + sizesInverted = parameters.videoDimensionsInverted; storePreviewCallBack(this); } - private native void putImage(long filterCtxPtr, byte[] buffer, int orientation, boolean videoDimensionsInverted); + private native void putImage(long filterCtxPtr, byte[] buffer, int rotate, boolean sizesInverted); public void onPreviewFrame(byte[] data, Camera camera) { @@ -60,8 +59,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev return; } - Size s = camera.getParameters().getPreviewSize(); - int expectedBuffLength = s.width * s.height * 3 /2; + int expectedBuffLength = getExpectedBufferLength(); if (expectedBuffLength != data.length) { Log.e("Linphone", "onPreviewFrame called with bad buffer length " + data.length + " whereas expected is " + expectedBuffLength + " don't calling putImage"); @@ -71,7 +69,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev long curTime = System.currentTimeMillis(); if (lastFrameTime == 0) { lastFrameTime = curTime; - putImage(filterCtxPtr, data, getOrientationCode(), videoDimensionsInverted); + putImage(filterCtxPtr, data, rotateCapturedFrame(), sizesInverted); return; } @@ -84,10 +82,11 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev timeElapsedBetweenFrames = currentTimeElapsed; // Log.d("onPreviewFrame: ", Integer.toString(data.length)); - putImage(filterCtxPtr, data, getOrientationCode(), videoDimensionsInverted); + putImage(filterCtxPtr, data, rotateCapturedFrame(), sizesInverted); } + @Override protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { camera.setPreviewCallback(cb); diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index c6bae18da..a19413eb7 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -18,9 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.linphone.core.AndroidCameraRecord.RecorderParams; @@ -41,38 +39,21 @@ import android.view.SurfaceHolder.Callback; */ public class AndroidCameraRecordManager { private static final int version = Integer.parseInt(Build.VERSION.SDK); - private static Map instances = new HashMap(); - + private static final String tag = "Linphone"; + private static AndroidCameraRecordManager instance; // singleton - private AndroidCameraRecordManager(int cameraId) { - this.cameraId = cameraId; - } + private AndroidCameraRecordManager() {} - /** - * Instance for a given camera - * @param cameraId : starting from 0 - * @return - */ - public static final synchronized AndroidCameraRecordManager getInstance(int cameraId) { - if (cameraId < 0) { - Log.e("Linphone", "Asking unmanageable camera " + cameraId); - return null; - } - - AndroidCameraRecordManager m = instances.get(cameraId); - if (m == null) { - m = new AndroidCameraRecordManager(cameraId); - instances.put(cameraId, m); - } - return m; - } /** - * @return instance for the default camera + * @return instance */ public static final synchronized AndroidCameraRecordManager getInstance() { - return getInstance(0); + if (instance == null) { + instance = new AndroidCameraRecordManager(); + } + return instance; } private AndroidCameraRecord.RecorderParams parameters; @@ -81,11 +62,26 @@ public class AndroidCameraRecordManager { private AndroidCameraRecord recorder; - private final Integer cameraId; + private List supportedVideoSizes; private int rotation; - private static final String tag = "Linphone"; + + private boolean useFrontCamera; + public void setUseFrontCamera(boolean value) { + if (useFrontCamera == value) return; + this.useFrontCamera = value; + + if (parameters != null) { + parameters.cameraId = cameraId(); + if (isRecording()) { + stopVideoRecording(); + tryToStartVideoRecording(); + } + } + } + public boolean isUseFrontCamera() {return useFrontCamera;} + public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) { @@ -94,15 +90,16 @@ public class AndroidCameraRecordManager { p.fps = fps; p.width = width; p.height = height; - p.cameraId = cameraId; + p.cameraId = cameraId(); p.videoDimensionsInverted = width < height; + // width and height will be inverted in Recorder on startPreview parameters = p; tryToStartVideoRecording(); } public final void setSurfaceView(final SurfaceView sv, final int rotation) { - this.rotation = rotation; + this.rotation = useFrontCamera ? 1 : rotation; SurfaceHolder holder = sv.getHolder(); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); @@ -206,4 +203,22 @@ public class AndroidCameraRecordManager { parameters = null; } + public int[] doYouSupportThisVideoSize(int[] askedSize) { + final int askedW = askedSize[0]; + final int askedH = askedSize[1]; + Log.d(tag, "w"+askedW); + Log.d(tag, "h"+askedH); + if (useFrontCamera && isPortraitSize(askedW, askedH)) { + return new int[] {askedH, askedW}; // only landscape supported + } else { + return askedSize; + } + } + private boolean isPortraitSize(int width, int height) { + return width < height; + } + + private static final int rearCamId() {return 1;} + private static final int frontCamId() {return 2;} + private final int cameraId() {return useFrontCamera? frontCamId() : rearCamId(); } } diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java index 33d460697..ef05eb228 100644 --- a/LinphoneCallParamsImpl.java +++ b/LinphoneCallParamsImpl.java @@ -27,6 +27,7 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native void enableVideo(long nativePtr, boolean b); private native boolean getVideoEnabled(long nativePtr); + private native void audioBandwidth(long nativePtr, int bw); private native void destroy(long nativePtr); @@ -43,4 +44,8 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { destroy(nativePtr); super.finalize(); } + + public void setAudioBandwidth(int value) { + audioBandwidth(nativePtr, value); + } } From 74096f25ba3d272ce4a267fa18e96707d492308d Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 9 Dec 2010 16:09:38 +0100 Subject: [PATCH 070/769] Refactor code to use the new InviteManager which in turn uses the Bandwidth and Camera managers. Improved front camera support. --- AndroidCameraRecordManager.java | 34 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index a19413eb7..c5f409394 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -184,7 +184,7 @@ public class AndroidCameraRecordManager { } // eventually null - + return supportedVideoSizes; } @@ -203,21 +203,33 @@ public class AndroidCameraRecordManager { parameters = null; } - public int[] doYouSupportThisVideoSize(int[] askedSize) { - final int askedW = askedSize[0]; - final int askedH = askedSize[1]; - Log.d(tag, "w"+askedW); - Log.d(tag, "h"+askedH); - if (useFrontCamera && isPortraitSize(askedW, askedH)) { - return new int[] {askedH, askedW}; // only landscape supported + /** + * Naive simple version. + * @param askedSize + * @return + */ + public VideoSize doYouSupportThisVideoSize(VideoSize askedSize) { + Log.d(tag, "Asking camera if it supports size "+askedSize); + if (useFrontCamera && askedSize.isPortrait()) { + return askedSize.createInverted(); // only landscape supported } else { return askedSize; } } - private boolean isPortraitSize(int width, int height) { - return width < height; - } + + private VideoSize closestVideoSize(VideoSize vSize, int defaultSizeCode, boolean defaultIsPortrait) { + VideoSize testSize = vSize.isPortrait() ? vSize.createInverted() : vSize; + + for (Size s : AndroidCameraRecordManager.getInstance().supportedVideoSizes()) { + if (s.height == testSize.getHeight() && s.width == testSize.getWidth()) { + return vSize; + } + } + + return VideoSize.createStandard(defaultSizeCode, defaultIsPortrait); + } + private static final int rearCamId() {return 1;} private static final int frontCamId() {return 2;} private final int cameraId() {return useFrontCamera? frontCamId() : rearCamId(); } From 2961330867f630250f5d4af0c5452eff6fc7a2e9 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 9 Dec 2010 22:52:27 +0100 Subject: [PATCH 071/769] Capture preview is now dynamically resized to fit Linphonecore preferredVideoSize. --- AndroidCameraRecordManager.java | 13 +++++++++++-- LinphoneCoreImpl.java | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index c5f409394..023dcffa4 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -32,7 +32,7 @@ import android.view.SurfaceHolder.Callback; /** - * Manage the video capture; one instance per camera. + * Manage the video capture, only on for all cameras. * * @author Guillaume Beraudo * @@ -81,6 +81,10 @@ public class AndroidCameraRecordManager { } } public boolean isUseFrontCamera() {return useFrontCamera;} + public boolean toggleUseFrontCamera() { + setUseFrontCamera(!useFrontCamera); + return useFrontCamera; + } @@ -132,13 +136,18 @@ public class AndroidCameraRecordManager { tryToStartVideoRecording(); } } - public void toggleMute() { + public boolean toggleMute() { setMuted(!muted); + return muted; } public boolean isMuted() { return muted; } + public void tryResumingVideoRecording() { + if (isRecording()) return; + tryToStartVideoRecording(); + } private void tryToStartVideoRecording() { if (muted || surfaceView == null || parameters == null) return; diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 62741c7ef..b9b8855ca 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -90,7 +90,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native long[] listVideoPayloadTypes(long nativePtr); - private static String TAG = "LinphoneCore"; + private static final String TAG = "LinphoneCore"; LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; From bbdc548d74ecea04a3514a3563365abbc4764b53 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 10 Dec 2010 16:42:04 +0100 Subject: [PATCH 072/769] fix orientation in 2.2 --- AndroidCameraRecordBufferedImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordBufferedImpl.java index 232d15970..ad54341c3 100644 --- a/AndroidCameraRecordBufferedImpl.java +++ b/AndroidCameraRecordBufferedImpl.java @@ -66,7 +66,7 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 protected void onSettingCameraParameters(Parameters parameters) { super.onSettingCameraParameters(parameters); // Only on v8 hardware - camera.setDisplayOrientation(90 * displayOrientation); + camera.setDisplayOrientation(90 * rotateCapturedFrame()); } From 1a18fe6207b08e209ada35b1c48617b38e2b828a Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 13 Dec 2010 14:04:38 +0100 Subject: [PATCH 073/769] Rotate information according to cameraId. --- AndroidCameraRecord.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index a34322f7f..84ad452ef 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -169,7 +169,9 @@ public abstract class AndroidCameraRecord { } protected int rotateCapturedFrame() { - if (params.cameraId == 2) { + if (params.videoDimensionsInverted) { + return 1; // always rotate 90° + } else if (params.cameraId == 2) { return 0; } else { return (4 + 1 - displayOrientation) % 4; From aa289edda101f712dd438803ffc20f47233f454b Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 13 Dec 2010 15:21:12 +0100 Subject: [PATCH 074/769] Bind proxyconfig properties and update registration tutorial. --- LinphoneProxyConfigImpl.java | 13 +++++++++++++ tutorials/TutorialRegistrationActivity.java | 11 ++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index f1dcb70a4..0145724b3 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import org.linphone.core.LinphoneCore.RegistrationState; + @@ -25,6 +27,10 @@ package org.linphone.core; class LinphoneProxyConfigImpl implements LinphoneProxyConfig { protected final long nativePtr; + + private native int getState(long nativePtr); + private native void setExpires(long nativePtr, int delay); + boolean ownPtr = false; protected LinphoneProxyConfigImpl(String identity,String proxy,String route, boolean enableRegister) throws LinphoneCoreException { nativePtr = newLinphoneProxyConfig(); @@ -121,4 +127,11 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { throw new LinphoneCoreException("cannot set route ["+routeUri+"]"); } } + public RegistrationState getState() { + return RegistrationState.fromInt(getState(nativePtr)); + } + + public void setExpires(int delay) { + setExpires(nativePtr, delay); + } } diff --git a/tutorials/TutorialRegistrationActivity.java b/tutorials/TutorialRegistrationActivity.java index d87446140..820360294 100644 --- a/tutorials/TutorialRegistrationActivity.java +++ b/tutorials/TutorialRegistrationActivity.java @@ -42,6 +42,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { private TutorialRegistration tutorial; private Button buttonCall; private Handler mHandler = new Handler(); + private TextView outputText; @Override @@ -55,7 +56,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { sipPasswordWidget.setText(defaultSipPassword); // Output text to the outputText widget - final TextView outputText = (TextView) findViewById(R.id.OutputText); + outputText = (TextView) findViewById(R.id.OutputText); final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); @@ -66,6 +67,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { // Assign call action to call button buttonCall = (Button) findViewById(R.id.CallButton); + buttonCall.setText("Register"); buttonCall.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TutorialLaunchingThread thread = new TutorialLaunchingThread(); @@ -74,7 +76,6 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { } }); - // Assign stop action to stop button Button buttonStop = (Button) findViewById(R.id.ButtonStop); buttonStop.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -92,13 +93,9 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { tutorial.launchTutorial( sipAddressWidget.getText().toString(), sipPasswordWidget.getText().toString()); - mHandler.post(new Runnable() { - public void run() { - buttonCall.setEnabled(true); - } - }); } catch (LinphoneCoreException e) { e.printStackTrace(); + outputText.setText(e.getMessage() +"\n"+outputText.getText()); } } } From 276874bf64419eb59df7bb9c71fa52364058e982 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 14 Dec 2010 12:58:28 +0100 Subject: [PATCH 075/769] Landscape preview in landscape orientation on sdk>=8 --- AndroidCameraRecord.java | 3 ++- ...fferedImpl.java => AndroidCameraRecordAPI8Impl.java | 10 ++++++---- AndroidCameraRecordManager.java | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) rename AndroidCameraRecordBufferedImpl.java => AndroidCameraRecordAPI8Impl.java (86%) diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 84ad452ef..1696efbc7 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -167,7 +167,8 @@ public abstract class AndroidCameraRecord { public void setDisplayOrientation(int rotation) { displayOrientation = rotation; } - + protected int getDisplayOrientation() {return displayOrientation;} + protected int rotateCapturedFrame() { if (params.videoDimensionsInverted) { return 1; // always rotate 90° diff --git a/AndroidCameraRecordBufferedImpl.java b/AndroidCameraRecordAPI8Impl.java similarity index 86% rename from AndroidCameraRecordBufferedImpl.java rename to AndroidCameraRecordAPI8Impl.java index ad54341c3..9655428db 100644 --- a/AndroidCameraRecordBufferedImpl.java +++ b/AndroidCameraRecordAPI8Impl.java @@ -30,10 +30,10 @@ import android.util.Log; * @author Guillaume Beraudo * */ -public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 { +public class AndroidCameraRecordAPI8Impl extends AndroidCameraRecordImplAPI5 { - public AndroidCameraRecordBufferedImpl(RecorderParams parameters) { + public AndroidCameraRecordAPI8Impl(RecorderParams parameters) { super(parameters); } @@ -66,8 +66,10 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 protected void onSettingCameraParameters(Parameters parameters) { super.onSettingCameraParameters(parameters); // Only on v8 hardware - camera.setDisplayOrientation(90 * rotateCapturedFrame()); + camera.setDisplayOrientation(90 * getPreviewCaptureRotation()); } - + private int getPreviewCaptureRotation() { + return (4 + 1 - displayOrientation) % 4; + } } diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 023dcffa4..42a57806d 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -155,7 +155,7 @@ public class AndroidCameraRecordManager { parameters.rotation = rotation; parameters.surfaceView = surfaceView; if (version >= 8) { - recorder = new AndroidCameraRecordBufferedImpl(parameters); + recorder = new AndroidCameraRecordAPI8Impl(parameters); } else if (version >= 5) { recorder = new AndroidCameraRecordImplAPI5(parameters); } else { From df734bfc9e9525bef6a85877f6667f27f47c2f56 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 14 Dec 2010 15:11:24 +0100 Subject: [PATCH 076/769] decline calls while incall because multi call not supported yet --- LinphoneCallImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 74c701a72..e2aad29a1 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -31,6 +31,7 @@ class LinphoneCallImpl implements LinphoneCall { native private int getState(long nativePtr); private native long getCurrentParamsCopy(long nativePtr); private native void enableCamera(long nativePtr, boolean enabled); + protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -68,4 +69,7 @@ class LinphoneCallImpl implements LinphoneCall { public void enableCamera(boolean enabled) { enableCamera(nativePtr, enabled); } + public boolean equals(Object call) { + return nativePtr == ((LinphoneCallImpl)call).nativePtr; + } } From 02ac3962b99bd5d710161126d6720e772cb89e6d Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 29 Dec 2010 08:15:12 +0100 Subject: [PATCH 077/769] Removed getter/setter to access video height/width directly. --- AndroidCameraRecordManager.java | 4 ++-- LinphoneCoreImpl.java | 6 +++--- tutorials/TestVideoActivity.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 42a57806d..a6c38d76d 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -32,7 +32,7 @@ import android.view.SurfaceHolder.Callback; /** - * Manage the video capture, only on for all cameras. + * Manage the video capture, only one for all cameras. * * @author Guillaume Beraudo * @@ -231,7 +231,7 @@ public class AndroidCameraRecordManager { VideoSize testSize = vSize.isPortrait() ? vSize.createInverted() : vSize; for (Size s : AndroidCameraRecordManager.getInstance().supportedVideoSizes()) { - if (s.height == testSize.getHeight() && s.width == testSize.getWidth()) { + if (s.height == testSize.height && s.width == testSize.width) { return vSize; } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 929403c9d..b49856e91 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -395,15 +395,15 @@ class LinphoneCoreImpl implements LinphoneCore { } public void setPreferredVideoSize(VideoSize vSize) { - setPreferredVideoSize(nativePtr, vSize.getWidth(), vSize.getHeight()); + setPreferredVideoSize(nativePtr, vSize.width, vSize.height); } public VideoSize getPreferredVideoSize() { int[] nativeSize = getPreferredVideoSize(nativePtr); VideoSize vSize = new VideoSize(); - vSize.setWidth(nativeSize[0]); - vSize.setHeight(nativeSize[1]); + vSize.width = nativeSize[0]; + vSize.height = nativeSize[1]; return vSize; } public void setRing(String path) { diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java index 971b8f73f..6bbdab517 100644 --- a/tutorials/TestVideoActivity.java +++ b/tutorials/TestVideoActivity.java @@ -139,7 +139,7 @@ public class TestVideoActivity extends Activity implements Callback, OnClickList } VideoSize size = videoSizes.pop(); - changeSurfaceViewLayout(size.getWidth(), size.getHeight()); + changeSurfaceViewLayout(size.width, size.height); // on surface changed the recorder will be restarted with new values // and the surface will be resized From 6dad6a315496600c8a180a39d43e3e86e8ed8360 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 3 Jan 2011 14:14:22 +0100 Subject: [PATCH 078/769] Captured video always sent in correct orientation. Temporarily blocked rotation of phone in video call activity. --- AndroidCameraRecord.java | 30 +-- ...API5.java => AndroidCameraRecord5Impl.java | 4 +- ...Impl.java => AndroidCameraRecord8Impl.java | 10 +- AndroidCameraRecord9Impl.java | 40 ++++ AndroidCameraRecordImpl.java | 12 +- AndroidCameraRecordManager.java | 206 +++++++++++++----- Version.java | 41 ++++ 7 files changed, 249 insertions(+), 94 deletions(-) rename AndroidCameraRecordImplAPI5.java => AndroidCameraRecord5Impl.java (93%) rename AndroidCameraRecordAPI8Impl.java => AndroidCameraRecord8Impl.java (86%) create mode 100644 AndroidCameraRecord9Impl.java create mode 100644 Version.java diff --git a/AndroidCameraRecord.java b/AndroidCameraRecord.java index 1696efbc7..6feafc322 100644 --- a/AndroidCameraRecord.java +++ b/AndroidCameraRecord.java @@ -39,14 +39,12 @@ public abstract class AndroidCameraRecord { private PreviewCallback storedPreviewCallback; private boolean previewStarted; - protected int displayOrientation; protected static final String tag="Linphone"; private List supportedVideoSizes; private Size currentPreviewSize; public AndroidCameraRecord(RecorderParams parameters) { this.params = parameters; - setDisplayOrientation(parameters.rotation); } protected List getSupportedPreviewSizes(Camera.Parameters parameters) { @@ -67,7 +65,7 @@ public abstract class AndroidCameraRecord { } - camera=Camera.open(); + camera = openCamera(params.cameraId); camera.setErrorCallback(new ErrorCallback() { public void onError(int error, Camera camera) { Log.e(tag, "Camera error : " + error); @@ -84,9 +82,10 @@ public abstract class AndroidCameraRecord { } - if (!params.videoDimensionsInverted) { + if (params.width >= params.height) { parameters.setPreviewSize(params.width, params.height); } else { + // invert height and width parameters.setPreviewSize(params.height, params.width); } parameters.setPreviewFrameRate(Math.round(params.fps)); @@ -126,6 +125,10 @@ public abstract class AndroidCameraRecord { + protected Camera openCamera(int cameraId) { + return Camera.open(); + } + protected void onSettingCameraParameters(Parameters parameters) {} /** @@ -164,24 +167,8 @@ public abstract class AndroidCameraRecord { protected abstract void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb); - public void setDisplayOrientation(int rotation) { - displayOrientation = rotation; - } - protected int getDisplayOrientation() {return displayOrientation;} - - protected int rotateCapturedFrame() { - if (params.videoDimensionsInverted) { - return 1; // always rotate 90° - } else if (params.cameraId == 2) { - return 0; - } else { - return (4 + 1 - displayOrientation) % 4; - } - } - - public static class RecorderParams { public float fps; public int height; @@ -191,7 +178,6 @@ public abstract class AndroidCameraRecord { public int cameraId; public int rotation; public SurfaceView surfaceView; - public boolean videoDimensionsInverted; public RecorderParams(long ptr) { filterDataNativePtr = ptr; @@ -200,7 +186,6 @@ public abstract class AndroidCameraRecord { - public boolean isStarted() { return previewStarted; } @@ -215,4 +200,5 @@ public abstract class AndroidCameraRecord { return currentPreviewSize.width * currentPreviewSize.height * 3 /2; } + } diff --git a/AndroidCameraRecordImplAPI5.java b/AndroidCameraRecord5Impl.java similarity index 93% rename from AndroidCameraRecordImplAPI5.java rename to AndroidCameraRecord5Impl.java index 7ff307d03..18e487d12 100644 --- a/AndroidCameraRecordImplAPI5.java +++ b/AndroidCameraRecord5Impl.java @@ -26,9 +26,9 @@ import android.hardware.Camera.Size; import android.util.Log; -public class AndroidCameraRecordImplAPI5 extends AndroidCameraRecordImpl { +public class AndroidCameraRecord5Impl extends AndroidCameraRecordImpl { - public AndroidCameraRecordImplAPI5(RecorderParams parameters) { + public AndroidCameraRecord5Impl(RecorderParams parameters) { super(parameters); } diff --git a/AndroidCameraRecordAPI8Impl.java b/AndroidCameraRecord8Impl.java similarity index 86% rename from AndroidCameraRecordAPI8Impl.java rename to AndroidCameraRecord8Impl.java index 9655428db..490d9ad97 100644 --- a/AndroidCameraRecordAPI8Impl.java +++ b/AndroidCameraRecord8Impl.java @@ -30,10 +30,10 @@ import android.util.Log; * @author Guillaume Beraudo * */ -public class AndroidCameraRecordAPI8Impl extends AndroidCameraRecordImplAPI5 { +public class AndroidCameraRecord8Impl extends AndroidCameraRecord5Impl { - public AndroidCameraRecordAPI8Impl(RecorderParams parameters) { + public AndroidCameraRecord8Impl(RecorderParams parameters) { super(parameters); } @@ -66,10 +66,6 @@ public class AndroidCameraRecordAPI8Impl extends AndroidCameraRecordImplAPI5 { protected void onSettingCameraParameters(Parameters parameters) { super.onSettingCameraParameters(parameters); // Only on v8 hardware - camera.setDisplayOrientation(90 * getPreviewCaptureRotation()); - } - - private int getPreviewCaptureRotation() { - return (4 + 1 - displayOrientation) % 4; + camera.setDisplayOrientation(rotation); } } diff --git a/AndroidCameraRecord9Impl.java b/AndroidCameraRecord9Impl.java new file mode 100644 index 000000000..0ddb283d2 --- /dev/null +++ b/AndroidCameraRecord9Impl.java @@ -0,0 +1,40 @@ +/* +AndroidCameraRecord9Impl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import android.hardware.Camera; + +/** + * + * Android >= 9 (2.3) version. + * @author Guillaume Beraudo + * + */ +public class AndroidCameraRecord9Impl extends AndroidCameraRecord8Impl { + + + public AndroidCameraRecord9Impl(RecorderParams parameters) { + super(parameters); + } + + @Override + protected Camera openCamera(int cameraId) { + return Camera.open(cameraId); + } +} diff --git a/AndroidCameraRecordImpl.java b/AndroidCameraRecordImpl.java index daf26ea4e..f1a4f4844 100644 --- a/AndroidCameraRecordImpl.java +++ b/AndroidCameraRecordImpl.java @@ -34,19 +34,19 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev private double timeElapsedBetweenFrames = 0; private long lastFrameTime = 0; private final double expectedTimeBetweenFrames; - private boolean sizesInverted; + protected final int rotation; public AndroidCameraRecordImpl(RecorderParams parameters) { super(parameters); expectedTimeBetweenFrames = 1d / Math.round(parameters.fps); filterCtxPtr = parameters.filterDataNativePtr; - sizesInverted = parameters.videoDimensionsInverted; + rotation = parameters.rotation; storePreviewCallBack(this); } - private native void putImage(long filterCtxPtr, byte[] buffer, int rotate, boolean sizesInverted); + private native void putImage(long filterCtxPtr, byte[] buffer, int rotate); public void onPreviewFrame(byte[] data, Camera camera) { @@ -69,7 +69,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev long curTime = System.currentTimeMillis(); if (lastFrameTime == 0) { lastFrameTime = curTime; - putImage(filterCtxPtr, data, rotateCapturedFrame(), sizesInverted); + putImage(filterCtxPtr, data, rotation); return; } @@ -82,7 +82,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev timeElapsedBetweenFrames = currentTimeElapsed; // Log.d("onPreviewFrame: ", Integer.toString(data.length)); - putImage(filterCtxPtr, data, rotateCapturedFrame(), sizesInverted); + putImage(filterCtxPtr, data, rotation); } @@ -92,6 +92,4 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev camera.setPreviewCallback(cb); } - - } diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index a6c38d76d..5c9f4d7c8 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -22,6 +22,7 @@ import java.util.List; import org.linphone.core.AndroidCameraRecord.RecorderParams; +import android.hardware.Camera; import android.hardware.Camera.Size; import android.os.Build; import android.util.Log; @@ -38,14 +39,9 @@ import android.view.SurfaceHolder.Callback; * */ public class AndroidCameraRecordManager { - private static final int version = Integer.parseInt(Build.VERSION.SDK); private static final String tag = "Linphone"; private static AndroidCameraRecordManager instance; - // singleton - private AndroidCameraRecordManager() {} - - /** * @return instance */ @@ -59,31 +55,76 @@ public class AndroidCameraRecordManager { private AndroidCameraRecord.RecorderParams parameters; private SurfaceView surfaceView; private boolean muted; - + private int cameraId; private AndroidCameraRecord recorder; - - private List supportedVideoSizes; - private int rotation; + private int phoneOrientation; + public int getPhoneOrientation() {return phoneOrientation;} + public void setPhoneOrientation(int degrees) {this.phoneOrientation = degrees;} - private boolean useFrontCamera; + private int frontCameraId; + private int rearCameraId; + + // singleton + private AndroidCameraRecordManager() { + findFrontAndRearCameraIds(); + } + + + private void findFrontAndRearCameraIds() { + if (Version.sdkAbove(9)) { + findFrontAndRearCameraIds9(); + return; + } + + if (Build.DEVICE.startsWith("GT-I9000")) { + // Galaxy S has 2 cameras + frontCameraId = 2; + rearCameraId = 1; + cameraId = rearCameraId; + return; + } + + // default to 0/0 + } + + private void findFrontAndRearCameraIds9() { + for (int id=0; id < getNumberOfCameras9(); id++) { + if (isFrontCamera9(id)) { + frontCameraId = id; + } else { + rearCameraId = id; + } + } + } + + public boolean hasSeveralCameras() { + return frontCameraId != rearCameraId; + } + + public void setUseFrontCamera(boolean value) { - if (useFrontCamera == value) return; - this.useFrontCamera = value; - + if (isFrontCamera() == value) return; // already OK + + toggleUseFrontCamera(); + } + + public boolean isUseFrontCamera() {return isFrontCamera();} + public boolean toggleUseFrontCamera() { + boolean previousUseFront = isFrontCamera(); + + cameraId = previousUseFront ? rearCameraId : frontCameraId; + if (parameters != null) { - parameters.cameraId = cameraId(); + parameters.cameraId = cameraId; if (isRecording()) { stopVideoRecording(); tryToStartVideoRecording(); } } - } - public boolean isUseFrontCamera() {return useFrontCamera;} - public boolean toggleUseFrontCamera() { - setUseFrontCamera(!useFrontCamera); - return useFrontCamera; + + return !previousUseFront; } @@ -94,16 +135,14 @@ public class AndroidCameraRecordManager { p.fps = fps; p.width = width; p.height = height; - p.cameraId = cameraId(); - p.videoDimensionsInverted = width < height; - // width and height will be inverted in Recorder on startPreview + p.cameraId = cameraId; parameters = p; tryToStartVideoRecording(); } - public final void setSurfaceView(final SurfaceView sv, final int rotation) { - this.rotation = useFrontCamera ? 1 : rotation; + public final void setSurfaceView(final SurfaceView sv, final int phoneOrientation) { + this.phoneOrientation = phoneOrientation; SurfaceHolder holder = sv.getHolder(); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); @@ -152,12 +191,15 @@ public class AndroidCameraRecordManager { private void tryToStartVideoRecording() { if (muted || surfaceView == null || parameters == null) return; - parameters.rotation = rotation; + parameters.rotation = bufferRotationForCorrectImageOrientation(); + parameters.surfaceView = surfaceView; - if (version >= 8) { - recorder = new AndroidCameraRecordAPI8Impl(parameters); - } else if (version >= 5) { - recorder = new AndroidCameraRecordImplAPI5(parameters); + if (Version.sdkAbove(9)) { + recorder = new AndroidCameraRecord9Impl(parameters); + } else if (Version.sdkAbove(8)) { + recorder = new AndroidCameraRecord8Impl(parameters); + } else if (Version.sdkAbove(5)) { + recorder = new AndroidCameraRecord5Impl(parameters); } else { recorder = new AndroidCameraRecordImpl(parameters); } @@ -188,8 +230,8 @@ public class AndroidCameraRecordManager { if (supportedVideoSizes != null) return supportedVideoSizes; } - if (version >= 5) { - supportedVideoSizes = AndroidCameraRecordImplAPI5.oneShotSupportedVideoSizes(); + if (Version.sdkAbove(5)) { + supportedVideoSizes = AndroidCameraRecord5Impl.oneShotSupportedVideoSizes(); } // eventually null @@ -212,34 +254,86 @@ public class AndroidCameraRecordManager { parameters = null; } - /** - * Naive simple version. - * @param askedSize - * @return - */ - public VideoSize doYouSupportThisVideoSize(VideoSize askedSize) { - Log.d(tag, "Asking camera if it supports size "+askedSize); - if (useFrontCamera && askedSize.isPortrait()) { - return askedSize.createInverted(); // only landscape supported - } else { - return askedSize; - } + public boolean outputIsPortrait() { + final int rotation = bufferRotationForCorrectImageOrientation(); + final boolean isPortrait = (rotation % 180) == 90; + + Log.d(tag, "Camera sensor in portrait orientation ?" + isPortrait); + return isPortrait; } - private VideoSize closestVideoSize(VideoSize vSize, int defaultSizeCode, boolean defaultIsPortrait) { - VideoSize testSize = vSize.isPortrait() ? vSize.createInverted() : vSize; - - for (Size s : AndroidCameraRecordManager.getInstance().supportedVideoSizes()) { - if (s.height == testSize.height && s.width == testSize.width) { - return vSize; - } - } - - return VideoSize.createStandard(defaultSizeCode, defaultIsPortrait); + + + public static int getNumberOfCameras() { + if (Version.sdkAbove(9)) return getNumberOfCameras9(); + + // Use hacks to guess the number of cameras + if (Build.DEVICE.startsWith("GT-I9000")) { + // Galaxy S has 2 cameras + return 2; + } else + return 1; } - private static final int rearCamId() {return 1;} - private static final int frontCamId() {return 2;} - private final int cameraId() {return useFrontCamera? frontCamId() : rearCamId(); } + private static int getNumberOfCameras9() { + return Camera.getNumberOfCameras(); + } + + public boolean isCameraOrientationPortrait() { + return (getCameraOrientation() % 180) == 90; + } + + public int getCameraOrientation() { + if (Version.sdkAbove(9)) return getCameraOrientation9(); + + // Use hacks to guess orientation of the camera + if (cameraId == 2 && Build.DEVICE.startsWith("GT-I9000")) { + // Galaxy S rear camera + // mounted in landscape for a portrait phone orientation + return 90; + } + return 0; + } + + + private int getCameraOrientation9() { + android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); + Camera.getCameraInfo(cameraId, info); + return info.orientation; + } + + public boolean isFrontCamera() { + if (Version.sdkAbove(9)) return isFrontCamera9(); + + // Use hacks to guess facing of the camera + + if (cameraId == 2 && Build.DEVICE.startsWith("GT-I9000")) { + return true; + } + + return false; + } + + private boolean isFrontCamera9() { + return isFrontCamera9(cameraId); + } + + + private boolean isFrontCamera9(int cameraId) { + android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); + Camera.getCameraInfo(cameraId, info); + return info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? true : false; + } + + private int bufferRotationForCorrectImageOrientation() { + final int cameraOrientation = getCameraOrientation(); + final int rotation = Version.sdkAbove(8) ? + (360 - cameraOrientation + 90 - phoneOrientation) % 360 + : 0; + Log.d(tag, "Capture video buffer will need a rotation of " + rotation + + " degrees : camera " + cameraOrientation + + ", phone " + phoneOrientation); + return rotation; + } } diff --git a/Version.java b/Version.java new file mode 100644 index 000000000..0ec07fc25 --- /dev/null +++ b/Version.java @@ -0,0 +1,41 @@ +/* +Version.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import android.os.Build; + +/** + * Centralize version access and allow simulation of lower versions. + * @author Guillaume Beraudo + */ +public class Version { + + private static final int buildVersion = +// Integer.parseInt(Build.VERSION.SDK); + 7; // 2.1 + + public static final boolean sdkAbove(int value) { + return buildVersion >= value; + } + + public static final boolean sdkBelow(int value) { + return buildVersion < value; + } + +} From e161f668e5f83bc3d741d23c28de8fe0788c1ab1 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 18 Jan 2011 16:19:27 +0100 Subject: [PATCH 079/769] change sent video orientation when phone is rotated --- LinphoneCoreImpl.java | 2 +- Version.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index b49856e91..3c21fe0f6 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -382,7 +382,7 @@ class LinphoneCoreImpl implements LinphoneCore { public int updateCall(LinphoneCall call, LinphoneCallParams params) { long ptrCall = ((LinphoneCallImpl) call).nativePtr; - long ptrParams = ((LinphoneCallParamsImpl)params).nativePtr; + long ptrParams = params!=null ? ((LinphoneCallParamsImpl)params).nativePtr : 0; return updateCall(nativePtr, ptrCall, ptrParams); } diff --git a/Version.java b/Version.java index 0ec07fc25..b094e31d7 100644 --- a/Version.java +++ b/Version.java @@ -27,8 +27,8 @@ import android.os.Build; public class Version { private static final int buildVersion = -// Integer.parseInt(Build.VERSION.SDK); - 7; // 2.1 + Integer.parseInt(Build.VERSION.SDK); +// 7; // 2.1 public static final boolean sdkAbove(int value) { return buildVersion >= value; @@ -38,4 +38,4 @@ public class Version { return buildVersion < value; } -} +} \ No newline at end of file From ed6a5bf8413f62d154f4e6bb9dfe76816f13786a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 24 Jan 2011 10:45:40 +0100 Subject: [PATCH 080/769] disable EC while in speaker mode --- LinphoneCallImpl.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index e2aad29a1..001443492 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -31,7 +31,10 @@ class LinphoneCallImpl implements LinphoneCall { native private int getState(long nativePtr); private native long getCurrentParamsCopy(long nativePtr); private native void enableCamera(long nativePtr, boolean enabled); - + private native void enableEchoCancellation(long nativePtr,boolean enable); + private native boolean isEchoCancellationEnabled(long nativePtr) ; + private native void enableEchoLimiter(long nativePtr,boolean enable); + private native boolean isEchoLimiterEnabled(long nativePtr) ; protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -72,4 +75,17 @@ class LinphoneCallImpl implements LinphoneCall { public boolean equals(Object call) { return nativePtr == ((LinphoneCallImpl)call).nativePtr; } + public void enableEchoCancellation(boolean enable) { + enableEchoCancellation(nativePtr,enable); + + } + public boolean isEchoCancellationEnabled() { + return isEchoCancellationEnabled(nativePtr); + } + public void enableEchoLimiter(boolean enable) { + enableEchoLimiter(nativePtr,enable); + } + public boolean isEchoLimiterEnabled() { + return isEchoLimiterEnabled(nativePtr); + } } From 7f43336078404630e72c09f5c76c5313a1d64cfa Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 25 Jan 2011 15:45:15 +0100 Subject: [PATCH 081/769] Fix cameraID=0 on Galaxy tab GT-P1000. Move sdk9 code from Video manager to dedicated class to avoid dalvik errors. Add phone information dump at Linphone startup. Add "Hack" class to centralize call to hackish code. --- AndroidCameraConf.java | 77 +++++++++++++++++++++++++ AndroidCameraConf9.java | 50 +++++++++++++++++ AndroidCameraRecordManager.java | 99 ++++----------------------------- LinphoneCoreImpl.java | 2 - 4 files changed, 139 insertions(+), 89 deletions(-) create mode 100644 AndroidCameraConf.java create mode 100644 AndroidCameraConf9.java diff --git a/AndroidCameraConf.java b/AndroidCameraConf.java new file mode 100644 index 000000000..242000dc7 --- /dev/null +++ b/AndroidCameraConf.java @@ -0,0 +1,77 @@ +/* +AndroidCameraConf.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import org.linphone.Hacks; + +import android.util.Log; + +public class AndroidCameraConf { + private static final String tag = "Linphone"; + + public void findFrontAndRearCameraIds(Integer frontCameraId, Integer rearCameraId, Integer cameraId) { + + if (Hacks.isGalaxyS()) { + Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1"); + frontCameraId = 2; + rearCameraId = 1; + cameraId = rearCameraId; + return; + } + + // default to 0/0 + } + + public int getNumberOfCameras() { + // Use hacks to guess the number of cameras + if (Hacks.isGalaxyS()) { + Log.d(tag, "Hack Galaxy S : has 2 cameras"); + return 2; + } else + return 1; + } + + + + public int getCameraOrientation(int cameraId) { + // Use hacks to guess orientation of the camera + if (cameraId == 2 && Hacks.isGalaxyS()) { + Log.d(tag, "Hack Galaxy S : rear camera id=2 ; mounted landscape"); + // mounted in landscape for a portrait phone orientation + return 90; + } + return 0; + } + + + + + public boolean isFrontCamera(int cameraId) { + // Use hacks to guess facing of the camera + if (cameraId == 2 && Hacks.isGalaxyS()) { + Log.d(tag, "Hack Galaxy S : front camera has id=2"); + return true; + } + + return false; + } + + + +} diff --git a/AndroidCameraConf9.java b/AndroidCameraConf9.java new file mode 100644 index 000000000..07e49bab0 --- /dev/null +++ b/AndroidCameraConf9.java @@ -0,0 +1,50 @@ +/* +AndroidCameraConf9.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import android.hardware.Camera; + +public class AndroidCameraConf9 extends AndroidCameraConf { + + public void findFrontAndRearCameraIds9(Integer frontCameraId, Integer rearCameraId, Integer cameraId) { + for (int id=0; id < getNumberOfCameras(); id++) { + if (isFrontCamera(id)) { + frontCameraId = id; + } else { + rearCameraId = id; + } + } + } + + public int getNumberOfCameras() { + return Camera.getNumberOfCameras(); + } + + public int getCameraOrientation(int cameraId) { + android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); + Camera.getCameraInfo(cameraId, info); + return info.orientation; + } + + public boolean isFrontCamera(int cameraId) { + android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); + Camera.getCameraInfo(cameraId, info); + return info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? true : false; + } +} diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 5c9f4d7c8..ffdcc3eea 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -22,9 +22,7 @@ import java.util.List; import org.linphone.core.AndroidCameraRecord.RecorderParams; -import android.hardware.Camera; import android.hardware.Camera.Size; -import android.os.Build; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -53,6 +51,7 @@ public class AndroidCameraRecordManager { } private AndroidCameraRecord.RecorderParams parameters; + private final AndroidCameraConf cc; private SurfaceView surfaceView; private boolean muted; private int cameraId; @@ -68,36 +67,15 @@ public class AndroidCameraRecordManager { // singleton private AndroidCameraRecordManager() { - findFrontAndRearCameraIds(); + cc = Version.sdkAbove(9) ? new AndroidCameraConf9() : new AndroidCameraConf(); + + Integer fId = -1;Integer rId = -1;Integer cId = -1; + cc.findFrontAndRearCameraIds(fId, rId, cId); + frontCameraId=fId;rearCameraId=rId;cameraId=cId; } - private void findFrontAndRearCameraIds() { - if (Version.sdkAbove(9)) { - findFrontAndRearCameraIds9(); - return; - } - if (Build.DEVICE.startsWith("GT-I9000")) { - // Galaxy S has 2 cameras - frontCameraId = 2; - rearCameraId = 1; - cameraId = rearCameraId; - return; - } - - // default to 0/0 - } - - private void findFrontAndRearCameraIds9() { - for (int id=0; id < getNumberOfCameras9(); id++) { - if (isFrontCamera9(id)) { - frontCameraId = id; - } else { - rearCameraId = id; - } - } - } public boolean hasSeveralCameras() { return frontCameraId != rearCameraId; @@ -105,14 +83,14 @@ public class AndroidCameraRecordManager { public void setUseFrontCamera(boolean value) { - if (isFrontCamera() == value) return; // already OK + if (cc.isFrontCamera(cameraId) == value) return; // already OK toggleUseFrontCamera(); } - public boolean isUseFrontCamera() {return isFrontCamera();} + public boolean isUseFrontCamera() {return cc.isFrontCamera(cameraId);} public boolean toggleUseFrontCamera() { - boolean previousUseFront = isFrontCamera(); + boolean previousUseFront = cc.isFrontCamera(cameraId); cameraId = previousUseFront ? rearCameraId : frontCameraId; @@ -265,69 +243,16 @@ public class AndroidCameraRecordManager { - public static int getNumberOfCameras() { - if (Version.sdkAbove(9)) return getNumberOfCameras9(); - - // Use hacks to guess the number of cameras - if (Build.DEVICE.startsWith("GT-I9000")) { - // Galaxy S has 2 cameras - return 2; - } else - return 1; - } - - private static int getNumberOfCameras9() { - return Camera.getNumberOfCameras(); - } + public boolean isCameraOrientationPortrait() { - return (getCameraOrientation() % 180) == 90; - } - - public int getCameraOrientation() { - if (Version.sdkAbove(9)) return getCameraOrientation9(); - - // Use hacks to guess orientation of the camera - if (cameraId == 2 && Build.DEVICE.startsWith("GT-I9000")) { - // Galaxy S rear camera - // mounted in landscape for a portrait phone orientation - return 90; - } - return 0; + return (cc.getCameraOrientation(cameraId) % 180) == 90; } - private int getCameraOrientation9() { - android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); - Camera.getCameraInfo(cameraId, info); - return info.orientation; - } - - public boolean isFrontCamera() { - if (Version.sdkAbove(9)) return isFrontCamera9(); - - // Use hacks to guess facing of the camera - - if (cameraId == 2 && Build.DEVICE.startsWith("GT-I9000")) { - return true; - } - - return false; - } - - private boolean isFrontCamera9() { - return isFrontCamera9(cameraId); - } - - - private boolean isFrontCamera9(int cameraId) { - android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); - Camera.getCameraInfo(cameraId, info); - return info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? true : false; - } private int bufferRotationForCorrectImageOrientation() { - final int cameraOrientation = getCameraOrientation(); + final int cameraOrientation = cc.getCameraOrientation(cameraId); final int rotation = Version.sdkAbove(8) ? (360 - cameraOrientation + 90 - phoneOrientation) % 360 : 0; diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 3c21fe0f6..01ba4e652 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -90,8 +90,6 @@ class LinphoneCoreImpl implements LinphoneCore { private native long[] listVideoPayloadTypes(long nativePtr); - private static final String TAG = "LinphoneCore"; - LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); From 6714bdbe1e53544f929c2282a2a0be0c61e82376 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 25 Jan 2011 15:45:36 +0100 Subject: [PATCH 082/769] add ec calibrator --- LinphoneCoreImpl.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 3c21fe0f6..2f33278f9 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -88,6 +88,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setRing(long nativePtr, String path); private native String getRing(long nativePtr); private native long[] listVideoPayloadTypes(long nativePtr); + private native void enableKeepAlive(long nativePtr,boolean enable); + private native boolean isKeepAliveEnabled(long nativePtr); + private native int startEchoCalibration(long nativePtr,Object data); private static final String TAG = "LinphoneCore"; @@ -428,4 +431,14 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isNetworkReachable() { throw new RuntimeException("Not implemented"); } + public void enableKeepAlive(boolean enable) { + enableKeepAlive(nativePtr,enable); + + } + public boolean isKeepAliveEnabled() { + return isKeepAliveEnabled(nativePtr); + } + public void startEchoCalibration(Object data) throws LinphoneCoreException { + startEchoCalibration(nativePtr, data); + } } From ddfd680240a32ed53d192f15a3d8f1943f22eb8d Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 26 Jan 2011 14:29:36 +0100 Subject: [PATCH 083/769] fix Galaxy S detection --- AndroidCameraConf.java | 10 +++++----- AndroidCameraRecordManager.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/AndroidCameraConf.java b/AndroidCameraConf.java index 242000dc7..523f249b0 100644 --- a/AndroidCameraConf.java +++ b/AndroidCameraConf.java @@ -25,13 +25,13 @@ import android.util.Log; public class AndroidCameraConf { private static final String tag = "Linphone"; - public void findFrontAndRearCameraIds(Integer frontCameraId, Integer rearCameraId, Integer cameraId) { - + public void findFrontAndRearCameraIds(int[] frontCameraId, int[] rearCameraId, int[] cameraId) { + Log.i(tag, "Detecting cameras"); if (Hacks.isGalaxyS()) { Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1"); - frontCameraId = 2; - rearCameraId = 1; - cameraId = rearCameraId; + frontCameraId[0] = 2; + rearCameraId[0] = 1; + cameraId[0] = rearCameraId[0]; return; } diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index ffdcc3eea..2ca3d70aa 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -69,9 +69,9 @@ public class AndroidCameraRecordManager { private AndroidCameraRecordManager() { cc = Version.sdkAbove(9) ? new AndroidCameraConf9() : new AndroidCameraConf(); - Integer fId = -1;Integer rId = -1;Integer cId = -1; + int[] fId = {-1};int[] rId = {-1};int[] cId = {-1}; cc.findFrontAndRearCameraIds(fId, rId, cId); - frontCameraId=fId;rearCameraId=rId;cameraId=cId; + frontCameraId=fId[0];rearCameraId=rId[0];cameraId=cId[0]; } From 05c6be619ecddfffe3ffeef7c5c4b551cdd78962 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 2 Feb 2011 22:25:50 +0100 Subject: [PATCH 084/769] allow auto replacement of calls and update ffmpeg commit id due to forced update --- LinphoneCallImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 001443492..a7104ffef 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -34,7 +34,8 @@ class LinphoneCallImpl implements LinphoneCall { private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr) ; private native void enableEchoLimiter(long nativePtr,boolean enable); - private native boolean isEchoLimiterEnabled(long nativePtr) ; + private native boolean isEchoLimiterEnabled(long nativePtr); + private native long getReplacedCall(long nativePtr); protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -88,4 +89,12 @@ class LinphoneCallImpl implements LinphoneCall { public boolean isEchoLimiterEnabled() { return isEchoLimiterEnabled(nativePtr); } + public LinphoneCall getReplacedCall(){ + long callptr=getReplacedCall(nativePtr); + if (callptr!=0){ + return new LinphoneCallImpl(callptr); + } + return null; + } + } From 3c760cd68d24b0ceb3142acb08419c4dbc78500b Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 14 Feb 2011 15:58:09 +0100 Subject: [PATCH 085/769] Make phones with sdk >=9 report they use SDK 8. --- Version.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Version.java b/Version.java index b094e31d7..2b938dbea 100644 --- a/Version.java +++ b/Version.java @@ -26,8 +26,8 @@ import android.os.Build; */ public class Version { - private static final int buildVersion = - Integer.parseInt(Build.VERSION.SDK); + private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK) >= 9? + 8 : Integer.parseInt(Build.VERSION.SDK); // Force versions above 9 to 8 // 7; // 2.1 public static final boolean sdkAbove(int value) { From 099907b8ee1d12eb26034ffec75d5c45618f63ad Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 22 Feb 2011 14:41:27 +0100 Subject: [PATCH 086/769] Several enhancements: - Fix errors in start/stop linphoneManager - Fix calls to guiListener().xx when null - Fix restart of linphoneManager - Cleanup some useless code - Work on outgoingCallReceiver - Intent CALL_PRIVILEDGED --- AndroidCameraRecordManager.java | 12 ++++++------ LinphoneCoreImpl.java | 6 +++--- Version.java | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/AndroidCameraRecordManager.java b/AndroidCameraRecordManager.java index 2ca3d70aa..ecf12c597 100644 --- a/AndroidCameraRecordManager.java +++ b/AndroidCameraRecordManager.java @@ -67,7 +67,7 @@ public class AndroidCameraRecordManager { // singleton private AndroidCameraRecordManager() { - cc = Version.sdkAbove(9) ? new AndroidCameraConf9() : new AndroidCameraConf(); + cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf(); int[] fId = {-1};int[] rId = {-1};int[] cId = {-1}; cc.findFrontAndRearCameraIds(fId, rId, cId); @@ -172,11 +172,11 @@ public class AndroidCameraRecordManager { parameters.rotation = bufferRotationForCorrectImageOrientation(); parameters.surfaceView = surfaceView; - if (Version.sdkAbove(9)) { + if (Version.sdkAboveOrEqual(9)) { recorder = new AndroidCameraRecord9Impl(parameters); - } else if (Version.sdkAbove(8)) { + } else if (Version.sdkAboveOrEqual(8)) { recorder = new AndroidCameraRecord8Impl(parameters); - } else if (Version.sdkAbove(5)) { + } else if (Version.sdkAboveOrEqual(5)) { recorder = new AndroidCameraRecord5Impl(parameters); } else { recorder = new AndroidCameraRecordImpl(parameters); @@ -208,7 +208,7 @@ public class AndroidCameraRecordManager { if (supportedVideoSizes != null) return supportedVideoSizes; } - if (Version.sdkAbove(5)) { + if (Version.sdkAboveOrEqual(5)) { supportedVideoSizes = AndroidCameraRecord5Impl.oneShotSupportedVideoSizes(); } @@ -253,7 +253,7 @@ public class AndroidCameraRecordManager { private int bufferRotationForCorrectImageOrientation() { final int cameraOrientation = cc.getCameraOrientation(cameraId); - final int rotation = Version.sdkAbove(8) ? + final int rotation = Version.sdkAboveOrEqual(8) ? (360 - cameraOrientation + 90 - phoneOrientation) % 360 : 0; Log.d(tag, "Capture video buffer will need a rotation of " + rotation diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 1a9fc67a7..533ee8b97 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -64,7 +64,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr); private native long getCurrentCall(long nativePtr) ; - private native void playDtmf(long nativePtr,char dtmf,int duration); + private native void playDtmf(long nativePtr,char dtmf,int duration, boolean speaker); private native void stopDtmf(long nativePtr); private native void setVideoWindowId(long nativePtr, Object wid); private native void setPreviewWindowId(long nativePtr, Object wid); @@ -298,8 +298,8 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return false; } - public void playDtmf(char number, int duration) { - playDtmf(nativePtr,number, duration); + public void playDtmf(char number, int duration, boolean speaker) { + playDtmf(nativePtr,number, duration, speaker); } public void stopDtmf() { diff --git a/Version.java b/Version.java index 2b938dbea..057fb53a3 100644 --- a/Version.java +++ b/Version.java @@ -30,11 +30,11 @@ public class Version { 8 : Integer.parseInt(Build.VERSION.SDK); // Force versions above 9 to 8 // 7; // 2.1 - public static final boolean sdkAbove(int value) { + public static final boolean sdkAboveOrEqual(int value) { return buildVersion >= value; } - public static final boolean sdkBelow(int value) { + public static final boolean sdkStrictlyBelow(int value) { return buildVersion < value; } From 5ffaf9c434bfe173bfd1a1a83d868df4cba04f1c Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 23 Feb 2011 15:37:28 +0100 Subject: [PATCH 087/769] Enhancements: - Numpad component factorizing setAddressWidget - Digit uses style - No more NewOutgoingCallReceiver and the associated magic Now uses CALL_PRIVILEDGED - Move Video classes to core.video package and lower visibility - Merged AndroidCameraRecord5Impl and AndroidCameraRecordImpl --- AndroidCameraRecord5Impl.java | 64 ------------------- Version.java | 4 ++ tutorials/AndroidTutorialNotifier.java | 3 +- tutorials/JavaCameraRecordImpl.java | 10 ++- tutorials/TestVideoActivity.java | 2 +- .../AndroidCameraConf.java | 7 +- .../AndroidCameraConf9.java | 4 +- .../AndroidCameraRecord.java | 2 +- .../AndroidCameraRecord8.java | 6 +- .../AndroidCameraRecord9.java | 6 +- .../AndroidCameraRecordImpl.java | 37 ++++++++++- .../AndroidCameraRecordManager.java | 15 +++-- 12 files changed, 71 insertions(+), 89 deletions(-) delete mode 100644 AndroidCameraRecord5Impl.java rename AndroidCameraConf.java => video/AndroidCameraConf.java (94%) rename AndroidCameraConf9.java => video/AndroidCameraConf9.java (94%) rename AndroidCameraRecord.java => video/AndroidCameraRecord.java (99%) rename AndroidCameraRecord8Impl.java => video/AndroidCameraRecord8.java (92%) rename AndroidCameraRecord9Impl.java => video/AndroidCameraRecord9.java (86%) rename AndroidCameraRecordImpl.java => video/AndroidCameraRecordImpl.java (67%) rename AndroidCameraRecordManager.java => video/AndroidCameraRecordManager.java (94%) diff --git a/AndroidCameraRecord5Impl.java b/AndroidCameraRecord5Impl.java deleted file mode 100644 index 18e487d12..000000000 --- a/AndroidCameraRecord5Impl.java +++ /dev/null @@ -1,64 +0,0 @@ -/* -AndroidCameraRecordImplAPI5.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import java.util.List; - -import android.hardware.Camera; -import android.hardware.Camera.Parameters; -import android.hardware.Camera.Size; -import android.util.Log; - - -public class AndroidCameraRecord5Impl extends AndroidCameraRecordImpl { - - public AndroidCameraRecord5Impl(RecorderParams parameters) { - super(parameters); - } - - @Override - protected void onSettingCameraParameters(Parameters parameters) { - super.onSettingCameraParameters(parameters); - - if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { - Log.w(tag, "Auto Focus supported by camera device"); - parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); - } else { - Log.w(tag, "Auto Focus not supported by camera device"); - if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { - Log.w(tag, "Infinity Focus supported by camera device"); - parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); - } else { - Log.w(tag, "Infinity Focus not supported by camera device"); - } - } - } - - public static List oneShotSupportedVideoSizes() { - Camera camera = Camera.open(); - List supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes(); - camera.release(); - return supportedVideoSizes; - } - - @Override - protected List getSupportedPreviewSizes(Parameters parameters) { - return parameters.getSupportedPreviewSizes(); - } -} diff --git a/Version.java b/Version.java index 057fb53a3..c06a2efea 100644 --- a/Version.java +++ b/Version.java @@ -38,4 +38,8 @@ public class Version { return buildVersion < value; } + public static int sdk() { + return buildVersion; + } + } \ No newline at end of file diff --git a/tutorials/AndroidTutorialNotifier.java b/tutorials/AndroidTutorialNotifier.java index 01e0555e2..7721f7dc1 100644 --- a/tutorials/AndroidTutorialNotifier.java +++ b/tutorials/AndroidTutorialNotifier.java @@ -23,11 +23,12 @@ import android.widget.TextView; /** * Write notifications to a TextView widget. + * This is an helper class, not a test activity. * * @author Guillaume Beraudo * */ -public class AndroidTutorialNotifier extends TutorialNotifier { +class AndroidTutorialNotifier extends TutorialNotifier { private Handler mHandler; private TextView outputTextView; diff --git a/tutorials/JavaCameraRecordImpl.java b/tutorials/JavaCameraRecordImpl.java index 33cc6b22e..a40bee238 100644 --- a/tutorials/JavaCameraRecordImpl.java +++ b/tutorials/JavaCameraRecordImpl.java @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.tutorials; -import org.linphone.core.AndroidCameraRecord; +import org.linphone.core.video.AndroidCameraRecord; import android.hardware.Camera; import android.hardware.Camera.PreviewCallback; @@ -26,7 +26,13 @@ import android.hardware.Camera.Size; import android.util.Log; import android.widget.TextView; -public class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { +/** + * This is an helper class, not a test activity. + * + * @author Guillaume Beraudo + * + */ +class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { private TextView debug; private long count = 0; diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java index 6bbdab517..ce3a9185b 100644 --- a/tutorials/TestVideoActivity.java +++ b/tutorials/TestVideoActivity.java @@ -21,8 +21,8 @@ package org.linphone.core.tutorials; import java.util.Stack; import org.linphone.R; -import org.linphone.core.AndroidCameraRecord; import org.linphone.core.VideoSize; +import org.linphone.core.video.AndroidCameraRecord; import android.app.Activity; import android.os.Bundle; diff --git a/AndroidCameraConf.java b/video/AndroidCameraConf.java similarity index 94% rename from AndroidCameraConf.java rename to video/AndroidCameraConf.java index 523f249b0..1d430082e 100644 --- a/AndroidCameraConf.java +++ b/video/AndroidCameraConf.java @@ -16,13 +16,13 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -package org.linphone.core; +package org.linphone.core.video; import org.linphone.Hacks; import android.util.Log; -public class AndroidCameraConf { +class AndroidCameraConf { private static final String tag = "Linphone"; public void findFrontAndRearCameraIds(int[] frontCameraId, int[] rearCameraId, int[] cameraId) { @@ -39,6 +39,7 @@ public class AndroidCameraConf { } public int getNumberOfCameras() { + Log.i(tag, "Detecting the number of cameras"); // Use hacks to guess the number of cameras if (Hacks.isGalaxyS()) { Log.d(tag, "Hack Galaxy S : has 2 cameras"); @@ -46,7 +47,7 @@ public class AndroidCameraConf { } else return 1; } - + public int getCameraOrientation(int cameraId) { diff --git a/AndroidCameraConf9.java b/video/AndroidCameraConf9.java similarity index 94% rename from AndroidCameraConf9.java rename to video/AndroidCameraConf9.java index 07e49bab0..4c3713b83 100644 --- a/AndroidCameraConf9.java +++ b/video/AndroidCameraConf9.java @@ -16,11 +16,11 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -package org.linphone.core; +package org.linphone.core.video; import android.hardware.Camera; -public class AndroidCameraConf9 extends AndroidCameraConf { +class AndroidCameraConf9 extends AndroidCameraConf { public void findFrontAndRearCameraIds9(Integer frontCameraId, Integer rearCameraId, Integer cameraId) { for (int id=0; id < getNumberOfCameras(); id++) { diff --git a/AndroidCameraRecord.java b/video/AndroidCameraRecord.java similarity index 99% rename from AndroidCameraRecord.java rename to video/AndroidCameraRecord.java index 6feafc322..64af664f5 100644 --- a/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -package org.linphone.core; +package org.linphone.core.video; import java.util.ArrayList; import java.util.Collections; diff --git a/AndroidCameraRecord8Impl.java b/video/AndroidCameraRecord8.java similarity index 92% rename from AndroidCameraRecord8Impl.java rename to video/AndroidCameraRecord8.java index 490d9ad97..20805bd64 100644 --- a/AndroidCameraRecord8Impl.java +++ b/video/AndroidCameraRecord8.java @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -package org.linphone.core; +package org.linphone.core.video; import android.hardware.Camera; import android.hardware.Camera.Parameters; @@ -30,10 +30,10 @@ import android.util.Log; * @author Guillaume Beraudo * */ -public class AndroidCameraRecord8Impl extends AndroidCameraRecord5Impl { +class AndroidCameraRecord8 extends AndroidCameraRecordImpl { - public AndroidCameraRecord8Impl(RecorderParams parameters) { + public AndroidCameraRecord8(RecorderParams parameters) { super(parameters); } diff --git a/AndroidCameraRecord9Impl.java b/video/AndroidCameraRecord9.java similarity index 86% rename from AndroidCameraRecord9Impl.java rename to video/AndroidCameraRecord9.java index 0ddb283d2..d81e8103e 100644 --- a/AndroidCameraRecord9Impl.java +++ b/video/AndroidCameraRecord9.java @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -package org.linphone.core; +package org.linphone.core.video; import android.hardware.Camera; @@ -26,10 +26,10 @@ import android.hardware.Camera; * @author Guillaume Beraudo * */ -public class AndroidCameraRecord9Impl extends AndroidCameraRecord8Impl { +class AndroidCameraRecord9 extends AndroidCameraRecord8 { - public AndroidCameraRecord9Impl(RecorderParams parameters) { + public AndroidCameraRecord9(RecorderParams parameters) { super(parameters); } diff --git a/AndroidCameraRecordImpl.java b/video/AndroidCameraRecordImpl.java similarity index 67% rename from AndroidCameraRecordImpl.java rename to video/AndroidCameraRecordImpl.java index f1a4f4844..9e30cca07 100644 --- a/AndroidCameraRecordImpl.java +++ b/video/AndroidCameraRecordImpl.java @@ -16,19 +16,24 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -package org.linphone.core; +package org.linphone.core.video; + +import java.util.List; import android.hardware.Camera; +import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; +import android.hardware.Camera.Size; import android.util.Log; /** * Record from Android camera. + * Android >= 5 (2.0) version. * * @author Guillaume Beraudo * */ -public class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { +class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { private long filterCtxPtr; private double timeElapsedBetweenFrames = 0; @@ -85,7 +90,35 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev putImage(filterCtxPtr, data, rotation); } + @Override + protected void onSettingCameraParameters(Parameters parameters) { + super.onSettingCameraParameters(parameters); + if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { + Log.w(tag, "Auto Focus supported by camera device"); + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); + } else { + Log.w(tag, "Auto Focus not supported by camera device"); + if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { + Log.w(tag, "Infinity Focus supported by camera device"); + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); + } else { + Log.w(tag, "Infinity Focus not supported by camera device"); + } + } + } + + public static List oneShotSupportedVideoSizes() { + Camera camera = Camera.open(); + List supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes(); + camera.release(); + return supportedVideoSizes; + } + + @Override + protected List getSupportedPreviewSizes(Parameters parameters) { + return parameters.getSupportedPreviewSizes(); + } @Override protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { diff --git a/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java similarity index 94% rename from AndroidCameraRecordManager.java rename to video/AndroidCameraRecordManager.java index ecf12c597..87c4f53ac 100644 --- a/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -16,11 +16,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -package org.linphone.core; +package org.linphone.core.video; import java.util.List; -import org.linphone.core.AndroidCameraRecord.RecorderParams; +import org.linphone.core.Version; +import org.linphone.core.video.AndroidCameraRecord.RecorderParams; import android.hardware.Camera.Size; import android.util.Log; @@ -173,13 +174,13 @@ public class AndroidCameraRecordManager { parameters.surfaceView = surfaceView; if (Version.sdkAboveOrEqual(9)) { - recorder = new AndroidCameraRecord9Impl(parameters); + recorder = new AndroidCameraRecord9(parameters); } else if (Version.sdkAboveOrEqual(8)) { - recorder = new AndroidCameraRecord8Impl(parameters); + recorder = new AndroidCameraRecord8(parameters); } else if (Version.sdkAboveOrEqual(5)) { - recorder = new AndroidCameraRecord5Impl(parameters); - } else { recorder = new AndroidCameraRecordImpl(parameters); + } else { + throw new RuntimeException("SDK version unsupported " + Version.sdk()); } recorder.startPreview(); @@ -209,7 +210,7 @@ public class AndroidCameraRecordManager { } if (Version.sdkAboveOrEqual(5)) { - supportedVideoSizes = AndroidCameraRecord5Impl.oneShotSupportedVideoSizes(); + supportedVideoSizes = AndroidCameraRecordImpl.oneShotSupportedVideoSizes(); } // eventually null From 2b84ac3ee4cd69a6b0e2c5e4daa0fea9150da04b Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 28 Feb 2011 11:55:52 +0100 Subject: [PATCH 088/769] Incall view. Hack for Audio with Galaxy S --- Hacks.java | 75 ++++++++++++++++++++++++++++++++++++ LinphoneCallImpl.java | 5 +++ LinphoneCoreImpl.java | 9 +++-- video/AndroidCameraConf.java | 2 +- 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 Hacks.java diff --git a/Hacks.java b/Hacks.java new file mode 100644 index 000000000..49c3125ae --- /dev/null +++ b/Hacks.java @@ -0,0 +1,75 @@ +/* +Hacks.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package org.linphone.core; + +import android.media.AudioManager; +import android.os.Build; +import android.util.Log; + +public class Hacks { + + private Hacks() {} + + public static boolean isGalaxyS() { + return Build.DEVICE.startsWith("GT-I9000") || Build.DEVICE.startsWith("GT-P1000"); + } + +/* private static final boolean log(final String msg) { + Log.d("Linphone", msg); + return true; + }*/ + + /* Not working as now + * Calling from Galaxy S to PC is "usable" even with no hack; other side is not even with this one*/ + public static void galaxySSwitchToCallStreamUnMuteLowerVolume(AudioManager am) { + // Switch to call audio channel (Galaxy S) + am.setSpeakerphoneOn(false); + sleep(200); + + // Lower volume + am.setStreamVolume(AudioManager.STREAM_VOICE_CALL, 1, 0); + + // Another way to select call channel + am.setMode(AudioManager.MODE_NORMAL); + sleep(200); + + // Mic is muted if not doing this + am.setMicrophoneMute(true); + sleep(200); + am.setMicrophoneMute(false); + sleep(200); + } + + private static final void sleep(int time) { + try { + Thread.sleep(time); + } catch(InterruptedException ie){} + } + + public static void dumpDeviceInformation() { + StringBuilder sb = new StringBuilder(" ==== Phone information dump ====\n"); + sb.append("DEVICE=").append(Build.DEVICE).append("\n"); + sb.append("MODEL=").append(Build.MODEL).append("\n"); + //MANUFACTURER doesn't exist in android 1.5. + //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); + sb.append("SDK=").append(Build.VERSION.SDK); + + Log.d("Linphone", sb.toString()); + } +} diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index a7104ffef..b60d92fda 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -36,6 +36,7 @@ class LinphoneCallImpl implements LinphoneCall { private native void enableEchoLimiter(long nativePtr,boolean enable); private native boolean isEchoLimiterEnabled(long nativePtr); private native long getReplacedCall(long nativePtr); + private native int getDuration(long nativePtr); protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -96,5 +97,9 @@ class LinphoneCallImpl implements LinphoneCall { } return null; } + + public int getDuration() { + return getDuration(nativePtr); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 533ee8b97..61afcd5d0 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -64,7 +64,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr); private native long getCurrentCall(long nativePtr) ; - private native void playDtmf(long nativePtr,char dtmf,int duration, boolean speaker); + private native void playDtmf(long nativePtr,char dtmf,int duration); private native void stopDtmf(long nativePtr); private native void setVideoWindowId(long nativePtr, Object wid); private native void setPreviewWindowId(long nativePtr, Object wid); @@ -298,8 +298,8 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return false; } - public void playDtmf(char number, int duration, boolean speaker) { - playDtmf(nativePtr,number, duration, speaker); + public void playDtmf(char number, int duration) { + playDtmf(nativePtr,number, duration); } public void stopDtmf() { @@ -439,4 +439,7 @@ class LinphoneCoreImpl implements LinphoneCore { public void startEchoCalibration(Object data) throws LinphoneCoreException { startEchoCalibration(nativePtr, data); } + public Transport getSignalingTransport() { + throw new RuntimeException("Not implemented"); + } } diff --git a/video/AndroidCameraConf.java b/video/AndroidCameraConf.java index 1d430082e..065ea22af 100644 --- a/video/AndroidCameraConf.java +++ b/video/AndroidCameraConf.java @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; -import org.linphone.Hacks; +import org.linphone.core.Hacks; import android.util.Log; From 5ee4ee4dba59b8932e9e4c4bc628d3c2394e0789 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 1 Mar 2011 18:39:03 +0100 Subject: [PATCH 089/769] Galaxy tab doesn't require Galaxy S speaker hack. --- Hacks.java | 12 ++++++++++-- video/AndroidCameraConf.java | 8 ++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Hacks.java b/Hacks.java index 49c3125ae..01f6d401d 100644 --- a/Hacks.java +++ b/Hacks.java @@ -22,12 +22,20 @@ import android.media.AudioManager; import android.os.Build; import android.util.Log; -public class Hacks { +public final class Hacks { private Hacks() {} public static boolean isGalaxyS() { - return Build.DEVICE.startsWith("GT-I9000") || Build.DEVICE.startsWith("GT-P1000"); + return Build.DEVICE.startsWith("GT-I9000"); + } + + public static boolean isGalaxySOrTab() { + return isGalaxyS() || isGalaxyTab(); + } + + public static boolean isGalaxyTab() { + return Build.DEVICE.startsWith("GT-P1000"); } /* private static final boolean log(final String msg) { diff --git a/video/AndroidCameraConf.java b/video/AndroidCameraConf.java index 065ea22af..a86e45787 100644 --- a/video/AndroidCameraConf.java +++ b/video/AndroidCameraConf.java @@ -27,7 +27,7 @@ class AndroidCameraConf { public void findFrontAndRearCameraIds(int[] frontCameraId, int[] rearCameraId, int[] cameraId) { Log.i(tag, "Detecting cameras"); - if (Hacks.isGalaxyS()) { + if (Hacks.isGalaxySOrTab()) { Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1"); frontCameraId[0] = 2; rearCameraId[0] = 1; @@ -41,7 +41,7 @@ class AndroidCameraConf { public int getNumberOfCameras() { Log.i(tag, "Detecting the number of cameras"); // Use hacks to guess the number of cameras - if (Hacks.isGalaxyS()) { + if (Hacks.isGalaxySOrTab()) { Log.d(tag, "Hack Galaxy S : has 2 cameras"); return 2; } else @@ -52,7 +52,7 @@ class AndroidCameraConf { public int getCameraOrientation(int cameraId) { // Use hacks to guess orientation of the camera - if (cameraId == 2 && Hacks.isGalaxyS()) { + if (cameraId == 2 && Hacks.isGalaxySOrTab()) { Log.d(tag, "Hack Galaxy S : rear camera id=2 ; mounted landscape"); // mounted in landscape for a portrait phone orientation return 90; @@ -65,7 +65,7 @@ class AndroidCameraConf { public boolean isFrontCamera(int cameraId) { // Use hacks to guess facing of the camera - if (cameraId == 2 && Hacks.isGalaxyS()) { + if (cameraId == 2 && Hacks.isGalaxySOrTab()) { Log.d(tag, "Hack Galaxy S : front camera has id=2"); return true; } From ce0d804023a8e8a68b2c1e67744d236f5473b581 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 10 Mar 2011 15:51:46 +0100 Subject: [PATCH 090/769] Transport selection (UDP, TCP, TLS);standard ports. --- LinphoneCoreImpl.java | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 61afcd5d0..8be2008f3 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -91,7 +91,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void enableKeepAlive(long nativePtr,boolean enable); private native boolean isKeepAliveEnabled(long nativePtr); private native int startEchoCalibration(long nativePtr,Object data); - + private native int getSignalingTransportPort(long nativePtr, int code); + private native void setSignalingTransportPorts(long nativePtr, int udp, int tcp, int tls); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -285,10 +286,6 @@ class LinphoneCoreImpl implements LinphoneCore { public void setPlayLevel(int level) { // TODO Auto-generated method stub - } - public void setSignalingTransport(Transport aTransport) { - // TODO Auto-generated method stub - } public void enableSpeaker(boolean value) { // TODO Auto-generated method stub @@ -439,7 +436,19 @@ class LinphoneCoreImpl implements LinphoneCore { public void startEchoCalibration(Object data) throws LinphoneCoreException { startEchoCalibration(nativePtr, data); } - public Transport getSignalingTransport() { - throw new RuntimeException("Not implemented"); + + public Transports getSignalingTransportPorts() { + Transports transports = new Transports(); + transports.udp = getSignalingTransportPort(nativePtr, 0); + transports.tcp = getSignalingTransportPort(nativePtr, 1); + transports.tls = getSignalingTransportPort(nativePtr, 3); + // See C struct LCSipTransports in linphonecore.h + // Code is the index in the structure + return transports; } + public void setSignalingTransportPorts(Transports transports) { + setSignalingTransportPorts(nativePtr, transports.udp, transports.tcp, transports.tls); + } + + } From d18561cea4c5f0ea2143ebc611bb5bf4b6b49c7a Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 11 Mar 2011 11:36:48 +0100 Subject: [PATCH 091/769] payload init, data paths, armv7 detection, typos Fix: payload initialization in PreferenceActivity Fix: paths to application data by using Android facilities Detect ARMv7 by looking at Build.CPU_ABI through reflection Fix: crash on registration change after LinphoneActivity was killed by Android --- Version.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Version.java b/Version.java index c06a2efea..65d5370d6 100644 --- a/Version.java +++ b/Version.java @@ -42,4 +42,13 @@ public class Version { return buildVersion; } + public static boolean isArmv7() { + try { + return sdkAboveOrEqual(4) + && Build.class.getField("CPU_ABI").get(null).toString().startsWith("armeabi-v7"); + } catch (Throwable e) {} + return false; + } + + } \ No newline at end of file From 56e955319a2aaf73867ed5ae8d19ec833c042f54 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 11 Mar 2011 15:37:18 +0100 Subject: [PATCH 092/769] Fix hardcoded log tags. --- Hacks.java | 4 +++- tutorials/JavaCameraRecordImpl.java | 2 +- video/AndroidCameraRecord8.java | 2 +- video/AndroidCameraRecordImpl.java | 8 ++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Hacks.java b/Hacks.java index 01f6d401d..d90588130 100644 --- a/Hacks.java +++ b/Hacks.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import org.linphone.LinphoneManager; + import android.media.AudioManager; import android.os.Build; import android.util.Log; @@ -78,6 +80,6 @@ public final class Hacks { //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); sb.append("SDK=").append(Build.VERSION.SDK); - Log.d("Linphone", sb.toString()); + Log.d(LinphoneManager.TAG, sb.toString()); } } diff --git a/tutorials/JavaCameraRecordImpl.java b/tutorials/JavaCameraRecordImpl.java index a40bee238..341bd28cc 100644 --- a/tutorials/JavaCameraRecordImpl.java +++ b/tutorials/JavaCameraRecordImpl.java @@ -59,7 +59,7 @@ class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallbac Size s = camera.getParameters().getPreviewSize(); int expectedBuffLength = s.width * s.height * 3 /2; if (expectedBuffLength != data.length) { - Log.e("Linphone", "onPreviewFrame called with bad buffer length " + data.length + Log.e(tag, "onPreviewFrame called with bad buffer length " + data.length + " whereas expected is " + expectedBuffLength + " don't calling putImage"); return; } diff --git a/video/AndroidCameraRecord8.java b/video/AndroidCameraRecord8.java index 20805bd64..ef8425d7e 100644 --- a/video/AndroidCameraRecord8.java +++ b/video/AndroidCameraRecord8.java @@ -40,7 +40,7 @@ class AndroidCameraRecord8 extends AndroidCameraRecordImpl { @Override protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { if (cb != null) { - Log.d("Linphone", "Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); + Log.d(tag, "Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); } camera.setPreviewCallbackWithBuffer(cb); } diff --git a/video/AndroidCameraRecordImpl.java b/video/AndroidCameraRecordImpl.java index 9e30cca07..84c22a0e4 100644 --- a/video/AndroidCameraRecordImpl.java +++ b/video/AndroidCameraRecordImpl.java @@ -56,17 +56,17 @@ class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCall public void onPreviewFrame(byte[] data, Camera camera) { if (data == null) { - Log.e("Linphone", "onPreviewFrame Called with null buffer"); + Log.e(tag, "onPreviewFrame Called with null buffer"); return; } if (filterCtxPtr == 0l) { - Log.e("Linphone", "onPreviewFrame Called with no filterCtxPtr set"); + Log.e(tag, "onPreviewFrame Called with no filterCtxPtr set"); return; } int expectedBuffLength = getExpectedBufferLength(); if (expectedBuffLength != data.length) { - Log.e("Linphone", "onPreviewFrame called with bad buffer length " + data.length + Log.e(tag, "onPreviewFrame called with bad buffer length " + data.length + " whereas expected is " + expectedBuffLength + " don't calling putImage"); return; } @@ -80,7 +80,7 @@ class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCall double currentTimeElapsed = 0.8 * (curTime - lastFrameTime) / 1000 + 0.2 * timeElapsedBetweenFrames; if (currentTimeElapsed < expectedTimeBetweenFrames) { -// Log.d("Linphone", "Clipping frame " + Math.round(1 / currentTimeElapsed) + " > " + fps); +// Log.d(tag, "Clipping frame " + Math.round(1 / currentTimeElapsed) + " > " + fps); return; } lastFrameTime = curTime; From 592ce55c2dc72c104d945c8bb76d01fdeee2272c Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 11 Mar 2011 15:54:43 +0100 Subject: [PATCH 093/769] Fix hardcoded log tags --- AndroidVideoWindowImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index ec7eb2cbb..243afb472 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -34,11 +34,11 @@ public class AndroidVideoWindowImpl { mSurface=holder.getSurface(); } if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); - Log.w("Linphone", "Video display surface changed"); + Log.w(TAG, "Video display surface changed"); } public void surfaceCreated(SurfaceHolder holder) { - Log.w("Linphone", "Video display surface created"); + Log.w(TAG, "Video display surface created"); } public void surfaceDestroyed(SurfaceHolder holder) { @@ -48,7 +48,7 @@ public class AndroidVideoWindowImpl { } if (mListener!=null) mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); - Log.d("Linphone", "Video display surface destroyed"); + Log.d(TAG, "Video display surface destroyed"); } }); } From 4ac9d2148b638699c91c63a4e21f3eda144db181 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 18 Mar 2011 10:52:52 +0100 Subject: [PATCH 094/769] When muting video, return if mute state changed. --- video/AndroidCameraRecordManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index 87c4f53ac..bf64b615a 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -145,14 +145,19 @@ public class AndroidCameraRecordManager { }); } - public void setMuted(boolean muteState) { - if (muteState == muted) return; + /** + * @param muteState + * @return true if mute state changed + */ + public boolean setMuted(boolean muteState) { + if (muteState == muted) return false; muted = muteState; if (muted) { stopVideoRecording(); } else { tryToStartVideoRecording(); } + return true; } public boolean toggleMute() { setMuted(!muted); From 173b47ff1ad165aed481151e81b556bd0e15ed9a Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 28 Mar 2011 15:59:55 +0200 Subject: [PATCH 095/769] ffmpeg as shared library. --- LinphoneCoreFactoryImpl.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 1b4e9aaf0..b676ccd61 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -21,9 +21,25 @@ package org.linphone.core; import java.io.File; import java.io.IOException; +import org.linphone.LinphoneManager; + +import android.util.Log; + public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { + private static void loadOptionalLibrary(String s) { + try { + System.loadLibrary(s); + } catch (Throwable e) { + Log.w(LinphoneManager.TAG, "Unable to load optional library lib" + s); + } + } + static { + loadOptionalLibrary("avutil"); + loadOptionalLibrary("swscale"); + loadOptionalLibrary("avcore"); + loadOptionalLibrary("avcodec"); System.loadLibrary("linphone"); } @Override From ae591fb01a4e1bfca4473bb2b5ee6429e78347d7 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 31 Mar 2011 11:09:19 +0200 Subject: [PATCH 096/769] Potentially fix crash when network goes down. --- LinphoneCoreImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 8be2008f3..0ca1d2a06 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -203,7 +203,7 @@ class LinphoneCoreImpl implements LinphoneCore { throw new RuntimeException("object already destroyed"); } } - public void setNetworkReachable(boolean isReachable) { + public synchronized void setNetworkReachable(boolean isReachable) { setNetworkStateReachable(nativePtr,isReachable); } public void setPlaybackGain(float gain) { From 61604d00fd7a8c974adbf670166c2616492668ab Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 6 Apr 2011 10:41:01 +0200 Subject: [PATCH 097/769] Merge ms2. Fix i18n in ms2. Activate 2.3 in Version. --- Version.java | 3 +- video/AndroidCameraConf.java | 77 +++++++---------------- video/AndroidCameraConf5.java | 88 +++++++++++++++++++++++++++ video/AndroidCameraConf9.java | 18 ++++-- video/AndroidCameraRecordManager.java | 13 ++-- 5 files changed, 128 insertions(+), 71 deletions(-) create mode 100644 video/AndroidCameraConf5.java diff --git a/Version.java b/Version.java index 65d5370d6..dccdaf833 100644 --- a/Version.java +++ b/Version.java @@ -26,8 +26,7 @@ import android.os.Build; */ public class Version { - private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK) >= 9? - 8 : Integer.parseInt(Build.VERSION.SDK); // Force versions above 9 to 8 + private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK); // 7; // 2.1 public static final boolean sdkAboveOrEqual(int value) { diff --git a/video/AndroidCameraConf.java b/video/AndroidCameraConf.java index a86e45787..3d7a7bcad 100644 --- a/video/AndroidCameraConf.java +++ b/video/AndroidCameraConf.java @@ -1,6 +1,6 @@ /* AndroidCameraConf.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2011 Belledonne Communications, Grenoble, France This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -15,64 +15,31 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ + */ package org.linphone.core.video; -import org.linphone.core.Hacks; -import android.util.Log; +/** + * @author Guillaume Beraudo + * + */ +interface AndroidCameraConf { -class AndroidCameraConf { - private static final String tag = "Linphone"; + AndroidCameras getFoundCameras(); - public void findFrontAndRearCameraIds(int[] frontCameraId, int[] rearCameraId, int[] cameraId) { - Log.i(tag, "Detecting cameras"); - if (Hacks.isGalaxySOrTab()) { - Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1"); - frontCameraId[0] = 2; - rearCameraId[0] = 1; - cameraId[0] = rearCameraId[0]; - return; - } + int getNumberOfCameras(); - // default to 0/0 + int getCameraOrientation(int cameraId); + + boolean isFrontCamera(int cameraId); + + class AndroidCameras { + Integer front; + Integer rear; + Integer defaultC; + + boolean hasFrontCamera() { return front != null; } + boolean hasRearCamera() { return rear != null; } + boolean hasSeveralCameras() { return front != rear && front != null; } } - - public int getNumberOfCameras() { - Log.i(tag, "Detecting the number of cameras"); - // Use hacks to guess the number of cameras - if (Hacks.isGalaxySOrTab()) { - Log.d(tag, "Hack Galaxy S : has 2 cameras"); - return 2; - } else - return 1; - } - - - - public int getCameraOrientation(int cameraId) { - // Use hacks to guess orientation of the camera - if (cameraId == 2 && Hacks.isGalaxySOrTab()) { - Log.d(tag, "Hack Galaxy S : rear camera id=2 ; mounted landscape"); - // mounted in landscape for a portrait phone orientation - return 90; - } - return 0; - } - - - - - public boolean isFrontCamera(int cameraId) { - // Use hacks to guess facing of the camera - if (cameraId == 2 && Hacks.isGalaxySOrTab()) { - Log.d(tag, "Hack Galaxy S : front camera has id=2"); - return true; - } - - return false; - } - - - -} +} \ No newline at end of file diff --git a/video/AndroidCameraConf5.java b/video/AndroidCameraConf5.java new file mode 100644 index 000000000..3c010180d --- /dev/null +++ b/video/AndroidCameraConf5.java @@ -0,0 +1,88 @@ +/* +AndroidCameraConf.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.video; + +import org.linphone.core.Hacks; + +import android.util.Log; + +class AndroidCameraConf5 implements AndroidCameraConf { + private static final String tag = "Linphone"; + private AndroidCameras foundCameras; + public AndroidCameras getFoundCameras() {return foundCameras;} + + public AndroidCameraConf5() { + Log.i(tag, "Detecting cameras"); + + // Defaults 0/0/0 + foundCameras = new AndroidCameras(); + + if (Hacks.isGalaxySOrTab()) { + Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1"); + foundCameras.front = 2; + foundCameras.rear = 1; + foundCameras.defaultC = foundCameras.rear; + } + + } + + public int getNumberOfCameras() { + Log.i(tag, "Detecting the number of cameras"); + if (Hacks.isGalaxySOrTab()) { + Log.d(tag, "Hack Galaxy S : has 2 cameras"); + return 2; + } else + return 1; + } + + + + public int getCameraOrientation(int cameraId) { + // Use hacks to guess orientation of the camera + if (Hacks.isGalaxySOrTab() && !isFrontCamera(cameraId)) { + Log.d(tag, "Hack Galaxy S : rear camera mounted landscape"); + // mounted in landscape for a portrait phone orientation + // |^^^^^^^^| + // | ____ | + // | |____| | + // | | + // | | + // | Phone | + // |________| + return 90; + } + return 0; + } + + + + + public boolean isFrontCamera(int cameraId) { + // Use hacks to guess facing of the camera + if (cameraId == 2 && Hacks.isGalaxySOrTab()) { + Log.d(tag, "Hack Galaxy S : front camera has id=2"); + return true; + } + + return false; + } + + + +} diff --git a/video/AndroidCameraConf9.java b/video/AndroidCameraConf9.java index 4c3713b83..ad6e50e90 100644 --- a/video/AndroidCameraConf9.java +++ b/video/AndroidCameraConf9.java @@ -20,14 +20,21 @@ package org.linphone.core.video; import android.hardware.Camera; -class AndroidCameraConf9 extends AndroidCameraConf { +class AndroidCameraConf9 implements AndroidCameraConf { + private AndroidCameras foundCameras; + public AndroidCameras getFoundCameras() {return foundCameras;} + + public AndroidCameraConf9() { + foundCameras = new AndroidCameras(); - public void findFrontAndRearCameraIds9(Integer frontCameraId, Integer rearCameraId, Integer cameraId) { for (int id=0; id < getNumberOfCameras(); id++) { + if (foundCameras.defaultC == null) + foundCameras.defaultC = id; + if (isFrontCamera(id)) { - frontCameraId = id; + foundCameras.front = id; } else { - rearCameraId = id; + foundCameras.rear = id; } } } @@ -39,7 +46,7 @@ class AndroidCameraConf9 extends AndroidCameraConf { public int getCameraOrientation(int cameraId) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); - return info.orientation; + return (info.orientation - 90) %360; } public boolean isFrontCamera(int cameraId) { @@ -47,4 +54,5 @@ class AndroidCameraConf9 extends AndroidCameraConf { Camera.getCameraInfo(cameraId, info); return info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? true : false; } + } diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index bf64b615a..5fa1b37e2 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -63,23 +63,18 @@ public class AndroidCameraRecordManager { public int getPhoneOrientation() {return phoneOrientation;} public void setPhoneOrientation(int degrees) {this.phoneOrientation = degrees;} - private int frontCameraId; - private int rearCameraId; // singleton private AndroidCameraRecordManager() { - cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf(); - - int[] fId = {-1};int[] rId = {-1};int[] cId = {-1}; - cc.findFrontAndRearCameraIds(fId, rId, cId); - frontCameraId=fId[0];rearCameraId=rId[0];cameraId=cId[0]; + cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5(); + cameraId = cc.getFoundCameras().defaultC; } public boolean hasSeveralCameras() { - return frontCameraId != rearCameraId; + return cc.getFoundCameras().hasSeveralCameras(); } @@ -93,7 +88,7 @@ public class AndroidCameraRecordManager { public boolean toggleUseFrontCamera() { boolean previousUseFront = cc.isFrontCamera(cameraId); - cameraId = previousUseFront ? rearCameraId : frontCameraId; + cameraId = previousUseFront ? cc.getFoundCameras().rear : cc.getFoundCameras().front; if (parameters != null) { parameters.cameraId = cameraId; From 4dd30dcf60e4c9da854abec5a4ef0b2a4d9c863e Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 6 Apr 2011 12:26:57 +0200 Subject: [PATCH 098/769] Support GalaxyS SC-02B. --- Hacks.java | 19 +++++++++++++++++-- Version.java | 4 +++- video/AndroidCameraConf.java | 9 +++++++-- video/AndroidCameraConf5.java | 18 +++++++++++------- video/AndroidCameraRecordManager.java | 8 +++++++- 5 files changed, 45 insertions(+), 13 deletions(-) diff --git a/Hacks.java b/Hacks.java index d90588130..1f96da119 100644 --- a/Hacks.java +++ b/Hacks.java @@ -29,7 +29,15 @@ public final class Hacks { private Hacks() {} public static boolean isGalaxyS() { - return Build.DEVICE.startsWith("GT-I9000"); + return isGT9000() || isSC02B(); + } + + public static boolean needGalaxySAudioHack() { + return isGalaxySOrTab(); + } + + public static boolean isGalaxySOrTabWithFrontCamera() { + return isGalaxySOrTab() && !isGalaxySOrTabWithoutFrontCamera(); } public static boolean isGalaxySOrTab() { @@ -37,7 +45,14 @@ public final class Hacks { } public static boolean isGalaxyTab() { - return Build.DEVICE.startsWith("GT-P1000"); + return isGTP1000(); + } + + private static boolean isGT9000() {return Build.DEVICE.startsWith("GT-I9000");} + private static boolean isSC02B() {return Build.DEVICE.startsWith("SC-02B");} + private static boolean isGTP1000() {return Build.DEVICE.startsWith("GT-P1000");} + private static boolean isGalaxySOrTabWithoutFrontCamera() { + return isSC02B(); } /* private static final boolean log(final String msg) { diff --git a/Version.java b/Version.java index dccdaf833..8064cb176 100644 --- a/Version.java +++ b/Version.java @@ -26,7 +26,9 @@ import android.os.Build; */ public class Version { - private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK); + private static final int buildVersion = + Integer.parseInt(Build.VERSION.SDK); +// 8; // 2.2 // 7; // 2.1 public static final boolean sdkAboveOrEqual(int value) { diff --git a/video/AndroidCameraConf.java b/video/AndroidCameraConf.java index 3d7a7bcad..85bbe4526 100644 --- a/video/AndroidCameraConf.java +++ b/video/AndroidCameraConf.java @@ -33,10 +33,15 @@ interface AndroidCameraConf { boolean isFrontCamera(int cameraId); + /** + * Default: no front; rear=0; default=rear + * @author Guillaume Beraudo + * + */ class AndroidCameras { Integer front; - Integer rear; - Integer defaultC; + Integer rear = 0; + Integer defaultC = rear; boolean hasFrontCamera() { return front != null; } boolean hasRearCamera() { return rear != null; } diff --git a/video/AndroidCameraConf5.java b/video/AndroidCameraConf5.java index 3c010180d..c3298d1c7 100644 --- a/video/AndroidCameraConf5.java +++ b/video/AndroidCameraConf5.java @@ -30,12 +30,17 @@ class AndroidCameraConf5 implements AndroidCameraConf { public AndroidCameraConf5() { Log.i(tag, "Detecting cameras"); - // Defaults 0/0/0 + // Defaults foundCameras = new AndroidCameras(); if (Hacks.isGalaxySOrTab()) { - Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1"); - foundCameras.front = 2; + Log.d(tag, "Hack Galaxy S : has one or more cameras"); + if (Hacks.isGalaxySOrTabWithFrontCamera()) { + Log.d(tag, "Hack Galaxy S : HAVE a front camera"); + foundCameras.front = 2; + } else { + Log.d(tag, "Hack Galaxy S : NO front camera"); + } foundCameras.rear = 1; foundCameras.defaultC = foundCameras.rear; } @@ -44,7 +49,7 @@ class AndroidCameraConf5 implements AndroidCameraConf { public int getNumberOfCameras() { Log.i(tag, "Detecting the number of cameras"); - if (Hacks.isGalaxySOrTab()) { + if (Hacks.isGalaxySOrTabWithFrontCamera()) { Log.d(tag, "Hack Galaxy S : has 2 cameras"); return 2; } else @@ -55,8 +60,8 @@ class AndroidCameraConf5 implements AndroidCameraConf { public int getCameraOrientation(int cameraId) { // Use hacks to guess orientation of the camera - if (Hacks.isGalaxySOrTab() && !isFrontCamera(cameraId)) { - Log.d(tag, "Hack Galaxy S : rear camera mounted landscape"); + if (Hacks.isGalaxySOrTab() && isFrontCamera(cameraId)) { + Log.d(tag, "Hack Galaxy S : front camera mounted landscape"); // mounted in landscape for a portrait phone orientation // |^^^^^^^^| // | ____ | @@ -72,7 +77,6 @@ class AndroidCameraConf5 implements AndroidCameraConf { - public boolean isFrontCamera(int cameraId) { // Use hacks to guess facing of the camera if (cameraId == 2 && Hacks.isGalaxySOrTab()) { diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index 5fa1b37e2..4649fe0b2 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -76,11 +76,17 @@ public class AndroidCameraRecordManager { public boolean hasSeveralCameras() { return cc.getFoundCameras().hasSeveralCameras(); } + public boolean hasFrontCamera() { + return cc.getFoundCameras().front != null; + } public void setUseFrontCamera(boolean value) { + if (!hasFrontCamera()) { + Log.e(tag, "setUseFrontCamera(true) while no front camera detected on device: using rear"); + value = false; + } if (cc.isFrontCamera(cameraId) == value) return; // already OK - toggleUseFrontCamera(); } From f596a19ad553cf00643d10fb9c70a8dbdc4542c0 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 6 Apr 2011 15:16:20 +0200 Subject: [PATCH 099/769] Enable ipv6 support for Android. --- LinphoneCoreImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 0ca1d2a06..81885d13a 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -93,7 +93,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native int startEchoCalibration(long nativePtr,Object data); private native int getSignalingTransportPort(long nativePtr, int code); private native void setSignalingTransportPorts(long nativePtr, int udp, int tcp, int tls); - + private native void enableIpv6(long nativePtr,boolean enable); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -450,5 +451,8 @@ class LinphoneCoreImpl implements LinphoneCore { setSignalingTransportPorts(nativePtr, transports.udp, transports.tcp, transports.tls); } + public void enableIpv6(boolean enable) { + enableIpv6(nativePtr,enable); + } } From 1e2a21ea2aceaca503c79b9fe80a781f7b22b6b1 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 11 Apr 2011 12:18:47 +0200 Subject: [PATCH 100/769] Initial support to softvolume. --- LinphoneCoreImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 81885d13a..f90812fc4 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -94,6 +94,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native int getSignalingTransportPort(long nativePtr, int code); private native void setSignalingTransportPorts(long nativePtr, int udp, int tcp, int tls); private native void enableIpv6(long nativePtr,boolean enable); + private native void adjustSoftwareVolume(long nativePtr,int db); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -454,5 +455,8 @@ class LinphoneCoreImpl implements LinphoneCore { public void enableIpv6(boolean enable) { enableIpv6(nativePtr,enable); } + public void adjustSoftwareVolume(int i) { + adjustSoftwareVolume(nativePtr, i); + } } From 9aa95c08cc798333594c23d2e195a196d4f3fa89 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 15 Apr 2011 23:56:32 +0200 Subject: [PATCH 101/769] add amr support to linphone-android --- LinphoneCoreImpl.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index f90812fc4..9b374c0f8 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -88,6 +88,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setRing(long nativePtr, String path); private native String getRing(long nativePtr); private native long[] listVideoPayloadTypes(long nativePtr); + private native long[] listAudioPayloadTypes(long nativePtr); private native void enableKeepAlive(long nativePtr,boolean enable); private native boolean isKeepAliveEnabled(long nativePtr); private native int startEchoCalibration(long nativePtr,Object data); @@ -413,7 +414,7 @@ class LinphoneCoreImpl implements LinphoneCore { return getRing(nativePtr); } - public PayloadType[] listVideoCodecs() { + public PayloadType[] getVideoCodecs() { long[] typesPtr = listVideoPayloadTypes(nativePtr); if (typesPtr == null) return null; @@ -425,6 +426,18 @@ class LinphoneCoreImpl implements LinphoneCore { return codecs; } + public PayloadType[] getAudioCodecs() { + long[] typesPtr = listAudioPayloadTypes(nativePtr); + if (typesPtr == null) return null; + + PayloadType[] codecs = new PayloadType[typesPtr.length]; + + for (int i=0; i < codecs.length; i++) { + codecs[i] = new PayloadTypeImpl(typesPtr[i]); + } + + return codecs; + } public boolean isNetworkReachable() { throw new RuntimeException("Not implemented"); } From 857dd1503e82e8a2b9645b52a889396f582c0aef Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 18 Apr 2011 15:18:00 +0200 Subject: [PATCH 102/769] Soft volume. Forced for galaxy S. Pref. access mgr. --- Hacks.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Hacks.java b/Hacks.java index 1f96da119..23ebcb487 100644 --- a/Hacks.java +++ b/Hacks.java @@ -97,4 +97,8 @@ public final class Hacks { Log.d(LinphoneManager.TAG, sb.toString()); } + + public static boolean needSoftvolume() { + return isGalaxySOrTab(); + } } From d78b0760407c29f58c778bb4dc601c56f2a6e1d4 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 19 Apr 2011 09:05:28 +0200 Subject: [PATCH 103/769] Fix deliver script. Move TAG to core Version.java --- Hacks.java | 6 ++---- LinphoneCoreFactoryImpl.java | 4 +--- Version.java | 2 ++ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Hacks.java b/Hacks.java index 23ebcb487..0eea6a814 100644 --- a/Hacks.java +++ b/Hacks.java @@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; -import org.linphone.LinphoneManager; - import android.media.AudioManager; import android.os.Build; import android.util.Log; @@ -94,8 +92,8 @@ public final class Hacks { //MANUFACTURER doesn't exist in android 1.5. //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); sb.append("SDK=").append(Build.VERSION.SDK); - - Log.d(LinphoneManager.TAG, sb.toString()); + + Log.d(Version.TAG, sb.toString()); } public static boolean needSoftvolume() { diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index b676ccd61..0a9ba7a76 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -21,8 +21,6 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import org.linphone.LinphoneManager; - import android.util.Log; public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { @@ -31,7 +29,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { try { System.loadLibrary(s); } catch (Throwable e) { - Log.w(LinphoneManager.TAG, "Unable to load optional library lib" + s); + Log.w(Version.TAG, "Unable to load optional library lib" + s); } } diff --git a/Version.java b/Version.java index 8064cb176..350189eea 100644 --- a/Version.java +++ b/Version.java @@ -26,6 +26,8 @@ import android.os.Build; */ public class Version { + public static final String TAG="Linphone"; + private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK); // 8; // 2.2 From 5b9a6d1123a9f34ca5f4a6da6e92f5e32b9d7f6a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 19 Apr 2011 10:54:37 +0200 Subject: [PATCH 104/769] detect when processor doesn't have ARM NEON instructions and disable video then --- Version.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Version.java b/Version.java index 8064cb176..9701b75c3 100644 --- a/Version.java +++ b/Version.java @@ -25,7 +25,7 @@ import android.os.Build; * @author Guillaume Beraudo */ public class Version { - + private static native boolean nativeHasNeon(); private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK); // 8; // 2.2 @@ -50,6 +50,8 @@ public class Version { } catch (Throwable e) {} return false; } + public static boolean hasNeon(){ + return nativeHasNeon(); + } - -} \ No newline at end of file +} From 4404fea296da048f07b2c51e09d301d509999663 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 19 Apr 2011 14:11:25 +0200 Subject: [PATCH 105/769] Add debugs to trace detected and used camera id. --- video/AndroidCameraConf.java | 12 +++++++++++- video/AndroidCameraRecord.java | 12 +++++++++--- video/AndroidCameraRecordManager.java | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/video/AndroidCameraConf.java b/video/AndroidCameraConf.java index 85bbe4526..9796ba12b 100644 --- a/video/AndroidCameraConf.java +++ b/video/AndroidCameraConf.java @@ -45,6 +45,16 @@ interface AndroidCameraConf { boolean hasFrontCamera() { return front != null; } boolean hasRearCamera() { return rear != null; } - boolean hasSeveralCameras() { return front != rear && front != null; } + boolean hasSeveralCameras() { return front != rear && front != null; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Cameras :"); + if (rear != null) sb.append(" rear=").append(rear); + if (front != null) sb.append(" front=").append(front); + if (defaultC != null) sb.append(" default=").append(defaultC); + return sb.toString(); + } } } \ No newline at end of file diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java index 64af664f5..d807a30cc 100644 --- a/video/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -22,6 +22,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.linphone.core.Version; + import android.hardware.Camera; import android.hardware.Camera.ErrorCallback; import android.hardware.Camera.Parameters; @@ -65,6 +67,7 @@ public abstract class AndroidCameraRecord { } + Log.d(tag, "Trying to open camera with id " + params.cameraId); camera = openCamera(params.cameraId); camera.setErrorCallback(new ErrorCallback() { public void onError(int error, Camera camera) { @@ -74,9 +77,12 @@ public abstract class AndroidCameraRecord { Camera.Parameters parameters=camera.getParameters(); - parameters.set("camera-id",params.cameraId); - camera.setParameters(parameters); - parameters = camera.getParameters(); + if (Version.sdkStrictlyBelow(9)) { + parameters.set("camera-id",params.cameraId); + camera.setParameters(parameters); + parameters = camera.getParameters(); + } + if (supportedVideoSizes == null) { supportedVideoSizes = new ArrayList(getSupportedPreviewSizes(parameters)); } diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index 4649fe0b2..f86e82bf9 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -67,6 +67,7 @@ public class AndroidCameraRecordManager { // singleton private AndroidCameraRecordManager() { cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5(); + Log.i(tag, "=== Detected " + cc.getFoundCameras()+ " ==="); cameraId = cc.getFoundCameras().defaultC; } From a66eb9aee50ec8c17b97fb576587e9e14ab865c6 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 20 Apr 2011 15:41:52 +0200 Subject: [PATCH 106/769] Improve Galaxy S support. Add hack preferences. - Switching to earpiece/speaker shouldn't mute the mic anymore - Enable hidden audio hacks by removing "android:layout="@layout/hidden" from "pref_audio_hacks_title" PreferenceScreen. --- Hacks.java | 18 ++++++++++++++---- LinphoneCoreImpl.java | 13 ++++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Hacks.java b/Hacks.java index 0eea6a814..5459bbd4b 100644 --- a/Hacks.java +++ b/Hacks.java @@ -30,9 +30,6 @@ public final class Hacks { return isGT9000() || isSC02B(); } - public static boolean needGalaxySAudioHack() { - return isGalaxySOrTab(); - } public static boolean isGalaxySOrTabWithFrontCamera() { return isGalaxySOrTab() && !isGalaxySOrTabWithoutFrontCamera(); @@ -93,10 +90,23 @@ public final class Hacks { //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); sb.append("SDK=").append(Build.VERSION.SDK); - Log.d(Version.TAG, sb.toString()); + Log.i(Version.TAG, sb.toString()); } public static boolean needSoftvolume() { return isGalaxySOrTab(); } + + public static boolean needRoutingAPI() { + return Version.sdkStrictlyBelow(5) /* Date: Fri, 20 May 2011 12:55:40 +0200 Subject: [PATCH 107/769] Video hacks + disabled mirroring of capture. --- Hacks.java | 37 +++++++++++++++++++-------- video/AndroidCameraConf5.java | 13 +++++++--- video/AndroidCameraConf9.java | 7 +++++ video/AndroidCameraRecord.java | 27 ++++++++++++------- video/AndroidCameraRecordImpl.java | 10 +++++--- video/AndroidCameraRecordManager.java | 36 ++++++++++++++++++-------- 6 files changed, 94 insertions(+), 36 deletions(-) diff --git a/Hacks.java b/Hacks.java index 5459bbd4b..38a578769 100644 --- a/Hacks.java +++ b/Hacks.java @@ -26,14 +26,14 @@ public final class Hacks { private Hacks() {} - public static boolean isGalaxyS() { - return isGT9000() || isSC02B(); - } - public static boolean isGalaxySOrTabWithFrontCamera() { return isGalaxySOrTab() && !isGalaxySOrTabWithoutFrontCamera(); } + private static boolean isGalaxySOrTabWithoutFrontCamera() { + return isSC02B() || isSGHI896(); + } + public static boolean isGalaxySOrTab() { return isGalaxyS() || isGalaxyTab(); @@ -42,13 +42,26 @@ public final class Hacks { public static boolean isGalaxyTab() { return isGTP1000(); } - - private static boolean isGT9000() {return Build.DEVICE.startsWith("GT-I9000");} - private static boolean isSC02B() {return Build.DEVICE.startsWith("SC-02B");} - private static boolean isGTP1000() {return Build.DEVICE.startsWith("GT-P1000");} - private static boolean isGalaxySOrTabWithoutFrontCamera() { - return isSC02B(); + private static boolean isGalaxyS() { + return isGT9000() || isSC02B() || isSGHI896() || isSPHD700(); } + + public static final boolean hasTwoCamerasRear0Front1() { + return isSPHD700() || isADR6400(); + } + + // HTC + private static final boolean isADR6400() { + return Build.MODEL.startsWith("ADR6400") || Build.DEVICE.startsWith("ADR6400"); + } // HTC Thunderbolt + + // Galaxy S variants + private static final boolean isSPHD700() {return Build.DEVICE.startsWith("SPH-D700");} // Epic + private static boolean isSGHI896() {return Build.DEVICE.startsWith("SGH-I896");} // Captivate + private static boolean isGT9000() {return Build.DEVICE.startsWith("GT-I9000");} // Galaxy S + private static boolean isSC02B() {return Build.DEVICE.startsWith("SC-02B");} // Docomo + private static boolean isGTP1000() {return Build.DEVICE.startsWith("GT-P1000");} // Tab + /* private static final boolean log(final String msg) { Log.d("Linphone", msg); @@ -109,4 +122,8 @@ public final class Hacks { // return false; return isGalaxySOrTab() && !isSC02B(); } + + public static boolean hasTwoCameras() { + return isSPHD700() || isGalaxySOrTabWithFrontCamera(); + } } diff --git a/video/AndroidCameraConf5.java b/video/AndroidCameraConf5.java index c3298d1c7..8f9bab996 100644 --- a/video/AndroidCameraConf5.java +++ b/video/AndroidCameraConf5.java @@ -36,21 +36,25 @@ class AndroidCameraConf5 implements AndroidCameraConf { if (Hacks.isGalaxySOrTab()) { Log.d(tag, "Hack Galaxy S : has one or more cameras"); if (Hacks.isGalaxySOrTabWithFrontCamera()) { - Log.d(tag, "Hack Galaxy S : HAVE a front camera"); + Log.d(tag, "Hack Galaxy S : HAS a front camera with id=2"); foundCameras.front = 2; } else { Log.d(tag, "Hack Galaxy S : NO front camera"); } + Log.d(tag, "Hack Galaxy S : HAS a rear camera with id=1"); foundCameras.rear = 1; foundCameras.defaultC = foundCameras.rear; + } else if (Hacks.hasTwoCamerasRear0Front1()) { + Log.d(tag, "Hack SPHD700 has 2 cameras a rear with id=0 and a front with id=1"); + foundCameras.front = 1; } } public int getNumberOfCameras() { Log.i(tag, "Detecting the number of cameras"); - if (Hacks.isGalaxySOrTabWithFrontCamera()) { - Log.d(tag, "Hack Galaxy S : has 2 cameras"); + if (Hacks.hasTwoCamerasRear0Front1() || Hacks.isGalaxySOrTabWithFrontCamera()) { + Log.d(tag, "Hack: we know this model has 2 cameras"); return 2; } else return 1; @@ -82,6 +86,9 @@ class AndroidCameraConf5 implements AndroidCameraConf { if (cameraId == 2 && Hacks.isGalaxySOrTab()) { Log.d(tag, "Hack Galaxy S : front camera has id=2"); return true; + } else if (cameraId == 1 && Hacks.hasTwoCamerasRear0Front1()) { + Log.d(tag, "Hack SPHD700 : front camera has id=1"); + return true; } return false; diff --git a/video/AndroidCameraConf9.java b/video/AndroidCameraConf9.java index ad6e50e90..c53e7fce4 100644 --- a/video/AndroidCameraConf9.java +++ b/video/AndroidCameraConf9.java @@ -18,7 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; +import org.linphone.LinphoneManager; + import android.hardware.Camera; +import android.util.Log; class AndroidCameraConf9 implements AndroidCameraConf { private AndroidCameras foundCameras; @@ -46,6 +49,10 @@ class AndroidCameraConf9 implements AndroidCameraConf { public int getCameraOrientation(int cameraId) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); + Log.d(LinphoneManager.TAG, String.format("Camera info for %i: orientation=%i returned=%i ", + cameraId, + info.orientation, + (info.orientation - 90) %360)); return (info.orientation - 90) %360; } diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java index d807a30cc..27bd02c63 100644 --- a/video/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -53,7 +53,7 @@ public abstract class AndroidCameraRecord { return Collections.emptyList(); } - public void startPreview() { // FIXME throws exception? + public synchronized void startPreview() { // FIXME throws exception? if (previewStarted) { Log.w(tag, "Already started"); throw new RuntimeException("Video recorder already started"); @@ -68,6 +68,10 @@ public abstract class AndroidCameraRecord { Log.d(tag, "Trying to open camera with id " + params.cameraId); + if (camera != null) { + Log.e(tag, "Camera is not null, ?already open? : aborting"); + return; + } camera = openCamera(params.cameraId); camera.setErrorCallback(new ErrorCallback() { public void onError(int error, Camera camera) { @@ -79,8 +83,6 @@ public abstract class AndroidCameraRecord { Camera.Parameters parameters=camera.getParameters(); if (Version.sdkStrictlyBelow(9)) { parameters.set("camera-id",params.cameraId); - camera.setParameters(parameters); - parameters = camera.getParameters(); } if (supportedVideoSizes == null) { @@ -94,14 +96,15 @@ public abstract class AndroidCameraRecord { // invert height and width parameters.setPreviewSize(params.height, params.width); } + // should setParameters and get again to have the real one?? + currentPreviewSize = parameters.getPreviewSize(); + parameters.setPreviewFrameRate(Math.round(params.fps)); onSettingCameraParameters(parameters); camera.setParameters(parameters); - currentPreviewSize = camera.getParameters().getPreviewSize(); - SurfaceHolder holder = params.surfaceView.getHolder(); try { camera.setPreviewDisplay(holder); @@ -113,9 +116,11 @@ public abstract class AndroidCameraRecord { try { camera.startPreview(); - previewStarted = true; } catch (Throwable e) { - Log.e(tag, "Can't start camera preview"); + Log.e(tag, "Error, can't start camera preview. Releasing camera!"); + camera.release(); + camera = null; + return; } previewStarted = true; @@ -160,7 +165,7 @@ public abstract class AndroidCameraRecord { camera.stopPreview(); camera.release(); camera=null; - if (currentPreviewSize != null) currentPreviewSize = null; + currentPreviewSize = null; previewStarted = false; } @@ -176,6 +181,8 @@ public abstract class AndroidCameraRecord { public static class RecorderParams { + public static enum MirrorType {NO, HORIZONTAL, CENTRAL, VERTICAL}; + public float fps; public int height; public int width; @@ -184,7 +191,9 @@ public abstract class AndroidCameraRecord { public int cameraId; public int rotation; public SurfaceView surfaceView; - + + public MirrorType mirror = MirrorType.NO; + public RecorderParams(long ptr) { filterDataNativePtr = ptr; } diff --git a/video/AndroidCameraRecordImpl.java b/video/AndroidCameraRecordImpl.java index 84c22a0e4..3e68ab921 100644 --- a/video/AndroidCameraRecordImpl.java +++ b/video/AndroidCameraRecordImpl.java @@ -20,6 +20,8 @@ package org.linphone.core.video; import java.util.List; +import org.linphone.core.video.AndroidCameraRecord.RecorderParams.MirrorType; + import android.hardware.Camera; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; @@ -40,18 +42,20 @@ class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCall private long lastFrameTime = 0; private final double expectedTimeBetweenFrames; protected final int rotation; + private MirrorType mirror; public AndroidCameraRecordImpl(RecorderParams parameters) { super(parameters); expectedTimeBetweenFrames = 1d / Math.round(parameters.fps); filterCtxPtr = parameters.filterDataNativePtr; rotation = parameters.rotation; + mirror = parameters.mirror; storePreviewCallBack(this); } - private native void putImage(long filterCtxPtr, byte[] buffer, int rotate); + private native void putImage(long filterCtxPtr, byte[] buffer, int rotate, int mirror); public void onPreviewFrame(byte[] data, Camera camera) { @@ -74,7 +78,7 @@ class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCall long curTime = System.currentTimeMillis(); if (lastFrameTime == 0) { lastFrameTime = curTime; - putImage(filterCtxPtr, data, rotation); + putImage(filterCtxPtr, data, rotation, mirror.ordinal()); return; } @@ -87,7 +91,7 @@ class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCall timeElapsedBetweenFrames = currentTimeElapsed; // Log.d("onPreviewFrame: ", Integer.toString(data.length)); - putImage(filterCtxPtr, data, rotation); + putImage(filterCtxPtr, data, rotation, mirror.ordinal()); } @Override diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index f86e82bf9..d3c75f98f 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -118,6 +118,17 @@ public class AndroidCameraRecordManager { p.height = height; p.cameraId = cameraId; parameters = p; + + /* Need first a working camera to test + if (isUseFrontCamera()) { + if (isCameraOrientationPortrait()) { + p.mirror = RecorderParams.MirrorType.CENTRAL; + } else { + p.mirror = RecorderParams.MirrorType.HORIZONTAL; + } + } // else no mirror + */ + tryToStartVideoRecording(); } @@ -174,7 +185,7 @@ public class AndroidCameraRecordManager { tryToStartVideoRecording(); } - private void tryToStartVideoRecording() { + private synchronized void tryToStartVideoRecording() { if (muted || surfaceView == null || parameters == null) return; parameters.rotation = bufferRotationForCorrectImageOrientation(); @@ -193,7 +204,7 @@ public class AndroidCameraRecordManager { recorder.startPreview(); } - public void stopVideoRecording() { + public synchronized void stopVideoRecording() { if (recorder != null) { recorder.stopPreview(); recorder = null; @@ -244,7 +255,7 @@ public class AndroidCameraRecordManager { final int rotation = bufferRotationForCorrectImageOrientation(); final boolean isPortrait = (rotation % 180) == 90; - Log.d(tag, "Camera sensor in portrait orientation ?" + isPortrait); + Log.d(tag, "Camera sensor in portrait orientation? " + isPortrait); return isPortrait; } @@ -260,13 +271,16 @@ public class AndroidCameraRecordManager { private int bufferRotationForCorrectImageOrientation() { - final int cameraOrientation = cc.getCameraOrientation(cameraId); - final int rotation = Version.sdkAboveOrEqual(8) ? - (360 - cameraOrientation + 90 - phoneOrientation) % 360 - : 0; - Log.d(tag, "Capture video buffer will need a rotation of " + rotation - + " degrees : camera " + cameraOrientation - + ", phone " + phoneOrientation); - return rotation; + if (Version.sdkAboveOrEqual(8)) { + final int cameraOrientation = cc.getCameraOrientation(cameraId); + final int rotation = (360 - cameraOrientation + 90 - phoneOrientation) % 360; + Log.d(tag, String.format( + "Capture video buffer of cameraId=%d will need a rotation of " + + "%d degrees: camera_orientation=%d, phone_orientation=%d", + cameraId, rotation, cameraOrientation, phoneOrientation)); + return rotation; + } + + return 0; } } From 3b88d0c151c0beeb656da0dbb9562a9653f6fd0a Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 25 May 2011 11:31:18 +0200 Subject: [PATCH 108/769] Fix bad pattern --- video/AndroidCameraConf9.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/AndroidCameraConf9.java b/video/AndroidCameraConf9.java index c53e7fce4..683c0c5b5 100644 --- a/video/AndroidCameraConf9.java +++ b/video/AndroidCameraConf9.java @@ -49,7 +49,7 @@ class AndroidCameraConf9 implements AndroidCameraConf { public int getCameraOrientation(int cameraId) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); - Log.d(LinphoneManager.TAG, String.format("Camera info for %i: orientation=%i returned=%i ", + Log.d(LinphoneManager.TAG, String.format("Camera info for %d: orientation=%d returned=%d ", cameraId, info.orientation, (info.orientation - 90) %360)); From 4284ff4dc957895fb67f46fcf41eaad8447a5c9a Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 1 Jun 2011 12:23:39 +0200 Subject: [PATCH 109/769] Fix non existing Android API calls from old sdk. --- ...AndroidCameraRecordImpl.java => AndroidCameraRecord5.java} | 4 ++-- video/AndroidCameraRecord8.java | 2 +- video/AndroidCameraRecordManager.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename video/{AndroidCameraRecordImpl.java => AndroidCameraRecord5.java} (96%) diff --git a/video/AndroidCameraRecordImpl.java b/video/AndroidCameraRecord5.java similarity index 96% rename from video/AndroidCameraRecordImpl.java rename to video/AndroidCameraRecord5.java index 3e68ab921..62af64b9f 100644 --- a/video/AndroidCameraRecordImpl.java +++ b/video/AndroidCameraRecord5.java @@ -35,7 +35,7 @@ import android.util.Log; * @author Guillaume Beraudo * */ -class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { +class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallback { private long filterCtxPtr; private double timeElapsedBetweenFrames = 0; @@ -44,7 +44,7 @@ class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCall protected final int rotation; private MirrorType mirror; - public AndroidCameraRecordImpl(RecorderParams parameters) { + public AndroidCameraRecord5(RecorderParams parameters) { super(parameters); expectedTimeBetweenFrames = 1d / Math.round(parameters.fps); filterCtxPtr = parameters.filterDataNativePtr; diff --git a/video/AndroidCameraRecord8.java b/video/AndroidCameraRecord8.java index ef8425d7e..b62c63e97 100644 --- a/video/AndroidCameraRecord8.java +++ b/video/AndroidCameraRecord8.java @@ -30,7 +30,7 @@ import android.util.Log; * @author Guillaume Beraudo * */ -class AndroidCameraRecord8 extends AndroidCameraRecordImpl { +class AndroidCameraRecord8 extends AndroidCameraRecord5 { public AndroidCameraRecord8(RecorderParams parameters) { diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index d3c75f98f..8b4f1fc6d 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -196,7 +196,7 @@ public class AndroidCameraRecordManager { } else if (Version.sdkAboveOrEqual(8)) { recorder = new AndroidCameraRecord8(parameters); } else if (Version.sdkAboveOrEqual(5)) { - recorder = new AndroidCameraRecordImpl(parameters); + recorder = new AndroidCameraRecord5(parameters); } else { throw new RuntimeException("SDK version unsupported " + Version.sdk()); } @@ -228,7 +228,7 @@ public class AndroidCameraRecordManager { } if (Version.sdkAboveOrEqual(5)) { - supportedVideoSizes = AndroidCameraRecordImpl.oneShotSupportedVideoSizes(); + supportedVideoSizes = AndroidCameraRecord5.oneShotSupportedVideoSizes(); } // eventually null From 55d7aee36c0f2443a594edfb7abd89bdecd0d531 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 1 Jun 2011 16:18:40 +0200 Subject: [PATCH 110/769] Front camera mirror. Shouldn't work for Nexus S. --- video/AndroidCameraRecordManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index 8b4f1fc6d..df884583d 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -119,15 +119,15 @@ public class AndroidCameraRecordManager { p.cameraId = cameraId; parameters = p; - /* Need first a working camera to test if (isUseFrontCamera()) { - if (isCameraOrientationPortrait()) { + if (!isCameraOrientationPortrait()) { + // Code for Nexus S: to be tested p.mirror = RecorderParams.MirrorType.CENTRAL; } else { + // Code for Galaxy S like: camera mounted landscape when phone hold portrait p.mirror = RecorderParams.MirrorType.HORIZONTAL; } - } // else no mirror - */ + } tryToStartVideoRecording(); } From 069c31c2dd1b4589939a421a5c9fbe21c3b34bb7 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 3 Jun 2011 15:32:29 +0200 Subject: [PATCH 111/769] Fix log tag. --- video/AndroidCameraConf9.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/AndroidCameraConf9.java b/video/AndroidCameraConf9.java index 683c0c5b5..6b6f8a1ba 100644 --- a/video/AndroidCameraConf9.java +++ b/video/AndroidCameraConf9.java @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; -import org.linphone.LinphoneManager; +import org.linphone.core.Version; import android.hardware.Camera; import android.util.Log; @@ -49,7 +49,7 @@ class AndroidCameraConf9 implements AndroidCameraConf { public int getCameraOrientation(int cameraId) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); - Log.d(LinphoneManager.TAG, String.format("Camera info for %d: orientation=%d returned=%d ", + Log.d(Version.TAG, String.format("Camera info for %d: orientation=%d returned=%d ", cameraId, info.orientation, (info.orientation - 90) %360)); From 39caf85271b2c5dbc23aff26690c24e243f4ff30 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 3 Jun 2011 15:40:01 +0200 Subject: [PATCH 112/769] Removed camera testing on startup. --- Hacks.java | 18 ++++++++++++++++++ Version.java | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/Hacks.java b/Hacks.java index 38a578769..7ddf63d56 100644 --- a/Hacks.java +++ b/Hacks.java @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import android.hardware.Camera; import android.media.AudioManager; import android.os.Build; import android.util.Log; @@ -126,4 +127,21 @@ public final class Hacks { public static boolean hasTwoCameras() { return isSPHD700() || isGalaxySOrTabWithFrontCamera(); } + + public static boolean hasCamera() { + if (Version.sdkAboveOrEqual(Version.API09_GINGERBREAD_23)) { + int nb = 0; + try { + nb = (Integer) Camera.class.getMethod("getNumberOfCameras", (Class[])null).invoke(null); + } catch (Exception e) { + Log.wtf(Version.TAG, "Error getting number of cameras"); + } + return nb > 0; + } + + Log.i(Version.TAG, "Hack: considering there IS a camera.\n" + + "If it is not the case, report DEVICE and MODEL to linphone-users@nongnu.org"); + return true; + } + } diff --git a/Version.java b/Version.java index 924217a26..37fbfd877 100644 --- a/Version.java +++ b/Version.java @@ -28,6 +28,14 @@ public class Version { public static final String TAG="Linphone"; + public static final int API03_CUPCAKE_15 = 3; + public static final int API04_DONUT_16 = 4; + public static final int API06_ECLAIR_20 = 6; + public static final int API07_ECLAIR_21 = 7; + public static final int API08_FROYO_22 = 8; + public static final int API09_GINGERBREAD_23 = 9; + public static final int API11_HONEYCOMB_30 = 11; + private static native boolean nativeHasNeon(); private static Boolean hasNeon; From 2e8a69679b7e6204af21a894462cbd08a4c70b1d Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 3 Jun 2011 15:40:56 +0200 Subject: [PATCH 113/769] Capture focus (continuous or click preview for auto focus) --- video/AndroidCameraRecord.java | 28 ++++++++++++++++-- video/AndroidCameraRecord5.java | 42 +++++++++++++++------------ video/AndroidCameraRecord8.java | 10 +++++++ video/AndroidCameraRecord9.java | 10 +++++++ video/AndroidCameraRecordManager.java | 8 ++--- 5 files changed, 72 insertions(+), 26 deletions(-) diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java index 27bd02c63..ae477302e 100644 --- a/video/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -25,6 +25,7 @@ import java.util.List; import org.linphone.core.Version; import android.hardware.Camera; +import android.hardware.Camera.AutoFocusCallback; import android.hardware.Camera.ErrorCallback; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; @@ -32,9 +33,11 @@ import android.hardware.Camera.Size; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; +import android.view.View; +import android.view.View.OnClickListener; -public abstract class AndroidCameraRecord { +public abstract class AndroidCameraRecord implements AutoFocusCallback { protected Camera camera; private RecorderParams params; @@ -125,6 +128,19 @@ public abstract class AndroidCameraRecord { previewStarted = true; + // Activate autofocus + if (Camera.Parameters.FOCUS_MODE_AUTO.equals(parameters.getFocusMode())) { + OnClickListener svClickListener = new OnClickListener() { + public void onClick(View v) { + Log.i(tag, "Auto focus requested"); + camera.autoFocus(AndroidCameraRecord.this); + } + }; + params.surfaceView.setOnClickListener(svClickListener); + // svClickListener.onClick(null); + } else { + params.surfaceView.setOnClickListener(null); + } // Register callback to get capture buffer lowLevelSetPreviewCallback(camera, storedPreviewCallback); @@ -151,7 +167,7 @@ public abstract class AndroidCameraRecord { public void storePreviewCallBack(PreviewCallback cb) { this.storedPreviewCallback = cb; if (camera == null) { - Log.w(tag, "Capture camera not ready, storing callback"); + Log.w(tag, "Capture camera not ready, storing preview callback"); return; } @@ -165,6 +181,7 @@ public abstract class AndroidCameraRecord { camera.stopPreview(); camera.release(); camera=null; + Log.d(tag, "Camera released"); currentPreviewSize = null; previewStarted = false; } @@ -189,6 +206,7 @@ public abstract class AndroidCameraRecord { final long filterDataNativePtr; public int cameraId; + public boolean isFrontCamera; public int rotation; public SurfaceView surfaceView; @@ -215,5 +233,9 @@ public abstract class AndroidCameraRecord { return currentPreviewSize.width * currentPreviewSize.height * 3 /2; } - + + public void onAutoFocus(boolean success, Camera camera) { + if (success) Log.i(tag, "Autofocus success"); + else Log.i(tag, "Autofocus failure"); + } } diff --git a/video/AndroidCameraRecord5.java b/video/AndroidCameraRecord5.java index 62af64b9f..90ca02d05 100644 --- a/video/AndroidCameraRecord5.java +++ b/video/AndroidCameraRecord5.java @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; +import java.util.Arrays; import java.util.List; import org.linphone.core.video.AndroidCameraRecord.RecorderParams.MirrorType; @@ -43,6 +44,7 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac private final double expectedTimeBetweenFrames; protected final int rotation; private MirrorType mirror; +// private boolean isUsingFrontCamera; public AndroidCameraRecord5(RecorderParams parameters) { super(parameters); @@ -50,6 +52,7 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac filterCtxPtr = parameters.filterDataNativePtr; rotation = parameters.rotation; mirror = parameters.mirror; +// isUsingFrontCamera = parameters.isFrontCamera; storePreviewCallBack(this); } @@ -94,31 +97,34 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac putImage(filterCtxPtr, data, rotation, mirror.ordinal()); } + protected String selectFocusMode(final List supportedFocusModes) {/* + if (isUsingFrontCamera && supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_FIXED)) { + return Camera.Parameters.FOCUS_MODE_FIXED; + } + if (!isUsingFrontCamera && supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { + return Camera.Parameters.FOCUS_MODE_INFINITY; + }*/ + + if (supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) { + return Camera.Parameters.FOCUS_MODE_AUTO; + } + + return null; // Should not occur? + } + @Override protected void onSettingCameraParameters(Parameters parameters) { super.onSettingCameraParameters(parameters); - - if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) { - Log.w(tag, "Auto Focus supported by camera device"); - parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); + List supportedFocusModes = parameters.getSupportedFocusModes(); + String focusMode = selectFocusMode(supportedFocusModes); + if (focusMode != null) { + Log.w(tag, "Selected focus mode: " + focusMode); + parameters.setFocusMode(focusMode); } else { - Log.w(tag, "Auto Focus not supported by camera device"); - if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { - Log.w(tag, "Infinity Focus supported by camera device"); - parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); - } else { - Log.w(tag, "Infinity Focus not supported by camera device"); - } + Log.i(tag, "No suitable focus mode found in : " + Arrays.toString(supportedFocusModes.toArray())); } } - public static List oneShotSupportedVideoSizes() { - Camera camera = Camera.open(); - List supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes(); - camera.release(); - return supportedVideoSizes; - } - @Override protected List getSupportedPreviewSizes(Parameters parameters) { return parameters.getSupportedPreviewSizes(); diff --git a/video/AndroidCameraRecord8.java b/video/AndroidCameraRecord8.java index b62c63e97..ad776475b 100644 --- a/video/AndroidCameraRecord8.java +++ b/video/AndroidCameraRecord8.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; +import java.util.List; + import android.hardware.Camera; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; @@ -68,4 +70,12 @@ class AndroidCameraRecord8 extends AndroidCameraRecord5 { // Only on v8 hardware camera.setDisplayOrientation(rotation); } + + @Override + protected String selectFocusMode(final List supportedFocusModes) { + if (supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_EDOF)) { + return Camera.Parameters.FOCUS_MODE_EDOF; + } else + return super.selectFocusMode(supportedFocusModes); + } } diff --git a/video/AndroidCameraRecord9.java b/video/AndroidCameraRecord9.java index d81e8103e..f0023ef57 100644 --- a/video/AndroidCameraRecord9.java +++ b/video/AndroidCameraRecord9.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; +import java.util.List; + import android.hardware.Camera; /** @@ -37,4 +39,12 @@ class AndroidCameraRecord9 extends AndroidCameraRecord8 { protected Camera openCamera(int cameraId) { return Camera.open(cameraId); } + + @Override + protected String selectFocusMode(final List supportedFocusModes) { + if (supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { + return Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO; + } else + return super.selectFocusMode(supportedFocusModes); + } } diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index df884583d..a78550a42 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -99,6 +99,7 @@ public class AndroidCameraRecordManager { if (parameters != null) { parameters.cameraId = cameraId; + parameters.isFrontCamera = !previousUseFront; if (isRecording()) { stopVideoRecording(); tryToStartVideoRecording(); @@ -117,9 +118,10 @@ public class AndroidCameraRecordManager { p.width = width; p.height = height; p.cameraId = cameraId; + p.isFrontCamera = isUseFrontCamera(); parameters = p; - if (isUseFrontCamera()) { + if (p.isFrontCamera) { if (!isCameraOrientationPortrait()) { // Code for Nexus S: to be tested p.mirror = RecorderParams.MirrorType.CENTRAL; @@ -227,10 +229,6 @@ public class AndroidCameraRecordManager { if (supportedVideoSizes != null) return supportedVideoSizes; } - if (Version.sdkAboveOrEqual(5)) { - supportedVideoSizes = AndroidCameraRecord5.oneShotSupportedVideoSizes(); - } - // eventually null return supportedVideoSizes; From 3c6d4b89d0d86ae993498477de07c7cb6a1ed8e1 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 6 Jun 2011 15:04:16 +0200 Subject: [PATCH 114/769] Fix Log.wtf didn't exist on earlier Android versiosn. --- Hacks.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Hacks.java b/Hacks.java index 7ddf63d56..7628632be 100644 --- a/Hacks.java +++ b/Hacks.java @@ -134,7 +134,7 @@ public final class Hacks { try { nb = (Integer) Camera.class.getMethod("getNumberOfCameras", (Class[])null).invoke(null); } catch (Exception e) { - Log.wtf(Version.TAG, "Error getting number of cameras"); + Log.e(Version.TAG, "Error getting number of cameras"); } return nb > 0; } From bd0745ecc33e04327087b409b8a7b7c091bc1e37 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 10 Jun 2011 19:04:53 +0200 Subject: [PATCH 115/769] implement quality indicators methods --- LinphoneCallImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index b60d92fda..653bd157e 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -37,6 +37,8 @@ class LinphoneCallImpl implements LinphoneCall { private native boolean isEchoLimiterEnabled(long nativePtr); private native long getReplacedCall(long nativePtr); private native int getDuration(long nativePtr); + private native float getCurrentQuality(long nativePtr); + private native float getAverageQuality(long nativePtr); protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -101,5 +103,11 @@ class LinphoneCallImpl implements LinphoneCall { public int getDuration() { return getDuration(nativePtr); } + public float getAverageQuality() { + return getAverageQuality(nativePtr); + } + public float getCurrentQuality() { + return getCurrentQuality(nativePtr); + } } From 1ac48c525da85ef50a8bf524df7784cabb63843f Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 17 Jun 2011 11:10:08 +0200 Subject: [PATCH 116/769] Efficient log class. --- Log.java | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Log.java diff --git a/Log.java b/Log.java new file mode 100644 index 000000000..f223e6100 --- /dev/null +++ b/Log.java @@ -0,0 +1,102 @@ +/* +Log.java +Copyright (C) 2011 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + + +/** + * Convenient wrapper for Android logs. + * + * @author Guillaume Beraudo + */ +public final class Log { + + public static final String TAG = "Linphone"; + + public static void i(Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.INFO)) { + android.util.Log.i(TAG, toString(objects)); + } + } + public static void i(Throwable t, Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.INFO)) { + android.util.Log.i(TAG, toString(objects), t); + } + } + + + public static void d(Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.DEBUG)) { + android.util.Log.d(TAG, toString(objects)); + } + } + public static void d(Throwable t, Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.DEBUG)) { + android.util.Log.d(TAG, toString(objects), t); + } + } + + public static void w(Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.WARN)) { + android.util.Log.w(TAG, toString(objects)); + } + } + public static void w(Throwable t, Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.WARN)) { + android.util.Log.w(TAG, toString(objects), t); + } + } + + public static void e(Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.ERROR)) { + android.util.Log.e(TAG, toString(objects)); + } + } + public static void e(Throwable t, Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.ERROR)) { + android.util.Log.e(TAG, toString(objects), t); + } + } + + /** + * @throws RuntimeException always throw after logging the error message. + */ + public static void f(Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.ERROR)) { + android.util.Log.e(TAG, toString(objects)); + throw new RuntimeException("Fatal error : " + toString(objects)); + } + } + /** + * @throws RuntimeException always throw after logging the error message. + */ + public static void f(Throwable t, Object...objects) { + if (android.util.Log.isLoggable(TAG, android.util.Log.ERROR)) { + android.util.Log.e(TAG, toString(objects), t); + throw new RuntimeException("Fatal error : " + toString(objects), t); + } + } + + private static String toString(Object...objects) { + StringBuilder sb = new StringBuilder(); + for (Object o : objects) { + sb.append(o); + } + return sb.toString(); + } +} From 3698ea0b736d94fdaf78b158a0b02e884018e8fe Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 17 Jun 2011 16:02:53 +0200 Subject: [PATCH 117/769] Fix crashes on network change. --- video/AndroidCameraRecord5.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/AndroidCameraRecord5.java b/video/AndroidCameraRecord5.java index 90ca02d05..8ee2c8303 100644 --- a/video/AndroidCameraRecord5.java +++ b/video/AndroidCameraRecord5.java @@ -77,7 +77,7 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac + " whereas expected is " + expectedBuffLength + " don't calling putImage"); return; } - + long curTime = System.currentTimeMillis(); if (lastFrameTime == 0) { lastFrameTime = curTime; From 64ae9ce334ca90758730f9674aa62386562c31cd Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 20 Jun 2011 13:47:46 +0200 Subject: [PATCH 118/769] Rework video capture. Fix high/low resolution switch. --- video/AndroidCameraConf5.java | 4 +- video/AndroidCameraConf9.java | 7 +- video/AndroidCameraRecord.java | 5 + video/AndroidCameraRecordManager.java | 126 ++++++++++++++++++++------ 4 files changed, 109 insertions(+), 33 deletions(-) diff --git a/video/AndroidCameraConf5.java b/video/AndroidCameraConf5.java index 8f9bab996..3deda1c69 100644 --- a/video/AndroidCameraConf5.java +++ b/video/AndroidCameraConf5.java @@ -74,9 +74,9 @@ class AndroidCameraConf5 implements AndroidCameraConf { // | | // | Phone | // |________| - return 90; + return 180; } - return 0; + return 90; } diff --git a/video/AndroidCameraConf9.java b/video/AndroidCameraConf9.java index 6b6f8a1ba..b32c80303 100644 --- a/video/AndroidCameraConf9.java +++ b/video/AndroidCameraConf9.java @@ -49,11 +49,10 @@ class AndroidCameraConf9 implements AndroidCameraConf { public int getCameraOrientation(int cameraId) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); - Log.d(Version.TAG, String.format("Camera info for %d: orientation=%d returned=%d ", + Log.d(Version.TAG, String.format("Camera info for %d: orientation=%d", cameraId, - info.orientation, - (info.orientation - 90) %360)); - return (info.orientation - 90) %360; + info.orientation)); + return info.orientation; } public boolean isFrontCamera(int cameraId) { diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java index ae477302e..1fa12b86f 100644 --- a/video/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -211,6 +211,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { public SurfaceView surfaceView; public MirrorType mirror = MirrorType.NO; + public int phoneOrientation; public RecorderParams(long ptr) { filterDataNativePtr = ptr; @@ -238,4 +239,8 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { if (success) Log.i(tag, "Autofocus success"); else Log.i(tag, "Autofocus failure"); } + + public int getStoredPhoneOrientation() { + return params.phoneOrientation; + } } diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index a78550a42..f30f23e96 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -20,11 +20,14 @@ package org.linphone.core.video; import java.util.List; +import org.linphone.LinphoneManager; import org.linphone.core.Version; import org.linphone.core.video.AndroidCameraRecord.RecorderParams; +import android.content.Context; import android.hardware.Camera.Size; import android.util.Log; +import android.view.OrientationEventListener; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.SurfaceHolder.Callback; @@ -40,6 +43,8 @@ import android.view.SurfaceHolder.Callback; public class AndroidCameraRecordManager { private static final String tag = "Linphone"; private static AndroidCameraRecordManager instance; + private OrientationEventListener orientationEventListener; + private OnCapturingStateChangedListener capturingStateChangedListener; /** * @return instance @@ -59,9 +64,7 @@ public class AndroidCameraRecordManager { private AndroidCameraRecord recorder; private List supportedVideoSizes; - private int phoneOrientation; - public int getPhoneOrientation() {return phoneOrientation;} - public void setPhoneOrientation(int degrees) {this.phoneOrientation = degrees;} + private int mAlwaysChangingPhoneOrientation=0; // singleton @@ -112,7 +115,10 @@ public class AndroidCameraRecordManager { public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) { - stopVideoRecording(); + if (recorder != null) { + Log.w(tag, "Recorder should not be running"); + stopVideoRecording(); + } RecorderParams p = new RecorderParams(filterDataPtr); p.fps = fps; p.width = width; @@ -135,8 +141,7 @@ public class AndroidCameraRecordManager { } - public final void setSurfaceView(final SurfaceView sv, final int phoneOrientation) { - this.phoneOrientation = phoneOrientation; + public final void setSurfaceView(final SurfaceView sv) { SurfaceHolder holder = sv.getHolder(); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); @@ -186,11 +191,20 @@ public class AndroidCameraRecordManager { if (isRecording()) return; tryToStartVideoRecording(); } - + private synchronized void tryToStartVideoRecording() { + if (orientationEventListener == null) { + throw new RuntimeException("startOrientationSensor was not called"); + } + if (muted || surfaceView == null || parameters == null) return; - - parameters.rotation = bufferRotationForCorrectImageOrientation(); + + if (recorder != null) { + Log.e(tag, "Recorder already present"); + stopVideoRecording(); + } + + parameters.rotation = bufferRotationToCompensateCameraAndPhoneOrientations(); parameters.surfaceView = surfaceView; if (Version.sdkAboveOrEqual(9)) { @@ -204,20 +218,26 @@ public class AndroidCameraRecordManager { } recorder.startPreview(); + + if (capturingStateChangedListener != null) { + capturingStateChangedListener.captureStarted(); + } } public synchronized void stopVideoRecording() { if (recorder != null) { recorder.stopPreview(); recorder = null; + if (capturingStateChangedListener != null) { + capturingStateChangedListener.captureStopped(); + } } } - // FIXME select right camera + /** - * Eventually null if API < 5. - * + * FIXME select right camera */ public List supportedVideoSizes() { if (supportedVideoSizes != null) { @@ -229,8 +249,6 @@ public class AndroidCameraRecordManager { if (supportedVideoSizes != null) return supportedVideoSizes; } - // eventually null - return supportedVideoSizes; } @@ -249,11 +267,11 @@ public class AndroidCameraRecordManager { parameters = null; } - public boolean outputIsPortrait() { - final int rotation = bufferRotationForCorrectImageOrientation(); + public boolean isOutputPortraitDependingOnCameraAndPhoneOrientations() { + final int rotation = bufferRotationToCompensateCameraAndPhoneOrientations(); final boolean isPortrait = (rotation % 180) == 90; - Log.d(tag, "Camera sensor in portrait orientation? " + isPortrait); + Log.d(tag, "Camera sensor in " + (isPortrait? "portrait":"landscape") + " orientation."); return isPortrait; } @@ -263,22 +281,76 @@ public class AndroidCameraRecordManager { public boolean isCameraOrientationPortrait() { - return (cc.getCameraOrientation(cameraId) % 180) == 90; + return (cc.getCameraOrientation(cameraId) % 180) == 0; } - private int bufferRotationForCorrectImageOrientation() { - if (Version.sdkAboveOrEqual(8)) { - final int cameraOrientation = cc.getCameraOrientation(cameraId); - final int rotation = (360 - cameraOrientation + 90 - phoneOrientation) % 360; - Log.d(tag, String.format( + private int bufferRotationToCompensateCameraAndPhoneOrientations() { + if (Version.sdkStrictlyBelow(Version.API08_FROYO_22)) { + // Don't perform any rotation + // Phone screen should use fitting orientation + return 0; + } + + final int phoneOrientation = mAlwaysChangingPhoneOrientation; + final int cameraOrientation = cc.getCameraOrientation(cameraId); + final int rotation = (cameraOrientation + phoneOrientation) % 360; + Log.d(tag, String.format( "Capture video buffer of cameraId=%d will need a rotation of " + "%d degrees: camera_orientation=%d, phone_orientation=%d", cameraId, rotation, cameraOrientation, phoneOrientation)); - return rotation; - } - - return 0; + return rotation; } + + + /** + * Register a sensor to track phoneOrientation changes + */ + public void startOrientationSensor(Context c) { + if (orientationEventListener == null) { + orientationEventListener = new LocalOrientationEventListener(c); + orientationEventListener.enable(); + } + } + + private class LocalOrientationEventListener extends OrientationEventListener { + public LocalOrientationEventListener(Context context) { + super(context); + } + @Override + public void onOrientationChanged(final int o) { + if (o == OrientationEventListener.ORIENTATION_UNKNOWN) return; + + int degrees=270; + if (o < 45 || o >315) degrees=0; + else if (o<135) degrees=90; + else if (o<225) degrees=180; + + if (mAlwaysChangingPhoneOrientation == degrees) return; + + Log.i(tag, "Phone orientation changed to " + degrees); + mAlwaysChangingPhoneOrientation = degrees; + } + } + + /** + * @return true if linphone core configured to send a A buffer while phone orientation induces !A buffer (A=landscape or portrait) + */ + public boolean isOutputOrientationMismatch() { + final boolean currentlyPortrait = LinphoneManager.getLc().getPreferredVideoSize().isPortrait(); + final boolean shouldBePortrait = isOutputPortraitDependingOnCameraAndPhoneOrientations(); + return currentlyPortrait ^ shouldBePortrait; + } + + public void setOnCapturingStateChanged(OnCapturingStateChangedListener listener) { + this.capturingStateChangedListener=listener; + } + + public static interface OnCapturingStateChangedListener { + void captureStarted(); + void captureStopped(); + } + + } From f5b18a690957971522fa0d6705e9aade6f7ae6a9 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 20 Jun 2011 14:44:50 +0200 Subject: [PATCH 119/769] Convert Logs to new system. No more "tags" remaining. --- AndroidVideoWindowImpl.java | 12 +++++------ Hacks.java | 9 ++++----- LinphoneCoreFactoryImpl.java | 4 +--- Log.java | 1 + Version.java | 2 -- tutorials/JavaCameraRecordImpl.java | 6 +++--- tutorials/TestVideoActivity.java | 13 +++++++----- video/AndroidCameraConf5.java | 25 +++++++++++------------ video/AndroidCameraConf9.java | 7 ++----- video/AndroidCameraRecord.java | 27 ++++++++++++------------- video/AndroidCameraRecord5.java | 16 +++++++-------- video/AndroidCameraRecord8.java | 5 +++-- video/AndroidCameraRecordManager.java | 29 +++++++++++++-------------- 13 files changed, 74 insertions(+), 82 deletions(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index 243afb472..254efb379 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -3,7 +3,6 @@ package org.linphone.core; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Bitmap.Config; -import android.util.Log; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -15,7 +14,6 @@ public class AndroidVideoWindowImpl { private SurfaceView mView; private Surface mSurface; private VideoWindowListener mListener; - static private String TAG = "Linphone"; public static interface VideoWindowListener{ void onSurfaceReady(AndroidVideoWindowImpl vw); void onSurfaceDestroyed(AndroidVideoWindowImpl vw); @@ -28,17 +26,17 @@ public class AndroidVideoWindowImpl { view.getHolder().addCallback(new Callback(){ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - Log.i(TAG,"Surface is being changed."); + Log.i("Surface is being changed."); synchronized(AndroidVideoWindowImpl.this){ mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565); mSurface=holder.getSurface(); } if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); - Log.w(TAG, "Video display surface changed"); + Log.w("Video display surface changed"); } public void surfaceCreated(SurfaceHolder holder) { - Log.w(TAG, "Video display surface created"); + Log.w("Video display surface created"); } public void surfaceDestroyed(SurfaceHolder holder) { @@ -48,7 +46,7 @@ public class AndroidVideoWindowImpl { } if (mListener!=null) mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); - Log.d(TAG, "Video display surface destroyed"); + Log.d("Video display surface destroyed"); } }); } @@ -56,7 +54,7 @@ public class AndroidVideoWindowImpl { static final int PORTRAIT=1; public void requestOrientation(int orientation){ //Surface.setOrientation(0, orientation==LANDSCAPE ? 1 : 0); - //Log.d("Linphone", "Orientation changed."); + //Log.d("Orientation changed."); } public void setListener(VideoWindowListener l){ mListener=l; diff --git a/Hacks.java b/Hacks.java index 7628632be..fd9342827 100644 --- a/Hacks.java +++ b/Hacks.java @@ -21,7 +21,6 @@ package org.linphone.core; import android.hardware.Camera; import android.media.AudioManager; import android.os.Build; -import android.util.Log; public final class Hacks { @@ -65,7 +64,7 @@ public final class Hacks { /* private static final boolean log(final String msg) { - Log.d("Linphone", msg); + Log.d(msg); return true; }*/ @@ -104,7 +103,7 @@ public final class Hacks { //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); sb.append("SDK=").append(Build.VERSION.SDK); - Log.i(Version.TAG, sb.toString()); + Log.i(sb.toString()); } public static boolean needSoftvolume() { @@ -134,12 +133,12 @@ public final class Hacks { try { nb = (Integer) Camera.class.getMethod("getNumberOfCameras", (Class[])null).invoke(null); } catch (Exception e) { - Log.e(Version.TAG, "Error getting number of cameras"); + Log.e("Error getting number of cameras"); } return nb > 0; } - Log.i(Version.TAG, "Hack: considering there IS a camera.\n" + Log.i("Hack: considering there IS a camera.\n" + "If it is not the case, report DEVICE and MODEL to linphone-users@nongnu.org"); return true; } diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 0a9ba7a76..a2800be92 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -21,15 +21,13 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import android.util.Log; - public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { private static void loadOptionalLibrary(String s) { try { System.loadLibrary(s); } catch (Throwable e) { - Log.w(Version.TAG, "Unable to load optional library lib" + s); + Log.w("Unable to load optional library lib", s); } } diff --git a/Log.java b/Log.java index f223e6100..c341fa68e 100644 --- a/Log.java +++ b/Log.java @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone.core; + /** * Convenient wrapper for Android logs. * diff --git a/Version.java b/Version.java index 37fbfd877..6bf12be45 100644 --- a/Version.java +++ b/Version.java @@ -26,8 +26,6 @@ import android.os.Build; */ public class Version { - public static final String TAG="Linphone"; - public static final int API03_CUPCAKE_15 = 3; public static final int API04_DONUT_16 = 4; public static final int API06_ECLAIR_20 = 6; diff --git a/tutorials/JavaCameraRecordImpl.java b/tutorials/JavaCameraRecordImpl.java index 341bd28cc..4772c7a5b 100644 --- a/tutorials/JavaCameraRecordImpl.java +++ b/tutorials/JavaCameraRecordImpl.java @@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.tutorials; +import org.linphone.core.Log; import org.linphone.core.video.AndroidCameraRecord; import android.hardware.Camera; import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.Size; -import android.util.Log; import android.widget.TextView; /** @@ -59,8 +59,8 @@ class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallbac Size s = camera.getParameters().getPreviewSize(); int expectedBuffLength = s.width * s.height * 3 /2; if (expectedBuffLength != data.length) { - Log.e(tag, "onPreviewFrame called with bad buffer length " + data.length - + " whereas expected is " + expectedBuffLength + " don't calling putImage"); + Log.e("onPreviewFrame called with bad buffer length ", data.length, + " whereas expected is ", expectedBuffLength, " don't calling putImage"); return; } diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java index ce3a9185b..7523cb0ff 100644 --- a/tutorials/TestVideoActivity.java +++ b/tutorials/TestVideoActivity.java @@ -18,15 +18,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.tutorials; +import static org.linphone.core.VideoSize.CIF; +import static org.linphone.core.VideoSize.HVGA; +import static org.linphone.core.VideoSize.QCIF; +import static org.linphone.core.VideoSize.QVGA; + import java.util.Stack; import org.linphone.R; +import org.linphone.core.Log; import org.linphone.core.VideoSize; import org.linphone.core.video.AndroidCameraRecord; import android.app.Activity; import android.os.Bundle; -import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; @@ -35,7 +40,6 @@ import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.TextView; -import static org.linphone.core.VideoSize.*; /** * Activity for displaying and starting the HelloWorld example on Android phone. @@ -48,7 +52,6 @@ public class TestVideoActivity extends Activity implements Callback, OnClickList private SurfaceView surfaceView; private static final int rate = 7; private JavaCameraRecordImpl recorder; - private static String tag = "Linphone"; private TextView debugView; private Button nextSize; private Button changeCamera; @@ -171,12 +174,12 @@ public class TestVideoActivity extends Activity implements Callback, OnClickList public void surfaceDestroyed(SurfaceHolder holder) { surfaceView = null; - Log.d(tag , "Video capture surface destroyed"); + Log.d("Video capture surface destroyed"); if (recorder != null) recorder.stopPreview(); } public void surfaceCreated(SurfaceHolder holder) { - Log.d(tag , "Video capture surface created"); + Log.d("Video capture surface created"); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { diff --git a/video/AndroidCameraConf5.java b/video/AndroidCameraConf5.java index 3deda1c69..f8dbe56cb 100644 --- a/video/AndroidCameraConf5.java +++ b/video/AndroidCameraConf5.java @@ -19,42 +19,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone.core.video; import org.linphone.core.Hacks; +import org.linphone.core.Log; -import android.util.Log; class AndroidCameraConf5 implements AndroidCameraConf { - private static final String tag = "Linphone"; private AndroidCameras foundCameras; public AndroidCameras getFoundCameras() {return foundCameras;} public AndroidCameraConf5() { - Log.i(tag, "Detecting cameras"); + Log.i("Detecting cameras"); // Defaults foundCameras = new AndroidCameras(); if (Hacks.isGalaxySOrTab()) { - Log.d(tag, "Hack Galaxy S : has one or more cameras"); + Log.d("Hack Galaxy S : has one or more cameras"); if (Hacks.isGalaxySOrTabWithFrontCamera()) { - Log.d(tag, "Hack Galaxy S : HAS a front camera with id=2"); + Log.d("Hack Galaxy S : HAS a front camera with id=2"); foundCameras.front = 2; } else { - Log.d(tag, "Hack Galaxy S : NO front camera"); + Log.d("Hack Galaxy S : NO front camera"); } - Log.d(tag, "Hack Galaxy S : HAS a rear camera with id=1"); + Log.d("Hack Galaxy S : HAS a rear camera with id=1"); foundCameras.rear = 1; foundCameras.defaultC = foundCameras.rear; } else if (Hacks.hasTwoCamerasRear0Front1()) { - Log.d(tag, "Hack SPHD700 has 2 cameras a rear with id=0 and a front with id=1"); + Log.d("Hack SPHD700 has 2 cameras a rear with id=0 and a front with id=1"); foundCameras.front = 1; } } public int getNumberOfCameras() { - Log.i(tag, "Detecting the number of cameras"); + Log.i("Detecting the number of cameras"); if (Hacks.hasTwoCamerasRear0Front1() || Hacks.isGalaxySOrTabWithFrontCamera()) { - Log.d(tag, "Hack: we know this model has 2 cameras"); + Log.d("Hack: we know this model has 2 cameras"); return 2; } else return 1; @@ -65,7 +64,7 @@ class AndroidCameraConf5 implements AndroidCameraConf { public int getCameraOrientation(int cameraId) { // Use hacks to guess orientation of the camera if (Hacks.isGalaxySOrTab() && isFrontCamera(cameraId)) { - Log.d(tag, "Hack Galaxy S : front camera mounted landscape"); + Log.d("Hack Galaxy S : front camera mounted landscape"); // mounted in landscape for a portrait phone orientation // |^^^^^^^^| // | ____ | @@ -84,10 +83,10 @@ class AndroidCameraConf5 implements AndroidCameraConf { public boolean isFrontCamera(int cameraId) { // Use hacks to guess facing of the camera if (cameraId == 2 && Hacks.isGalaxySOrTab()) { - Log.d(tag, "Hack Galaxy S : front camera has id=2"); + Log.d("Hack Galaxy S : front camera has id=2"); return true; } else if (cameraId == 1 && Hacks.hasTwoCamerasRear0Front1()) { - Log.d(tag, "Hack SPHD700 : front camera has id=1"); + Log.d("Hack SPHD700 : front camera has id=1"); return true; } diff --git a/video/AndroidCameraConf9.java b/video/AndroidCameraConf9.java index b32c80303..d0ef0faa5 100644 --- a/video/AndroidCameraConf9.java +++ b/video/AndroidCameraConf9.java @@ -18,10 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; -import org.linphone.core.Version; +import org.linphone.core.Log; import android.hardware.Camera; -import android.util.Log; class AndroidCameraConf9 implements AndroidCameraConf { private AndroidCameras foundCameras; @@ -49,9 +48,7 @@ class AndroidCameraConf9 implements AndroidCameraConf { public int getCameraOrientation(int cameraId) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); - Log.d(Version.TAG, String.format("Camera info for %d: orientation=%d", - cameraId, - info.orientation)); + Log.d("Camera info for ",cameraId,": orientation=",info.orientation); return info.orientation; } diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java index 1fa12b86f..dec9338b2 100644 --- a/video/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.linphone.core.Log; import org.linphone.core.Version; import android.hardware.Camera; @@ -30,7 +31,6 @@ import android.hardware.Camera.ErrorCallback; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.Size; -import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; @@ -44,7 +44,6 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { private PreviewCallback storedPreviewCallback; private boolean previewStarted; - protected static final String tag="Linphone"; private List supportedVideoSizes; private Size currentPreviewSize; @@ -58,27 +57,27 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { public synchronized void startPreview() { // FIXME throws exception? if (previewStarted) { - Log.w(tag, "Already started"); + Log.w("Already started"); throw new RuntimeException("Video recorder already started"); // return } if (params.surfaceView.getVisibility() != SurfaceView.VISIBLE) { // Illegal state - Log.e(tag, "Illegal state: video capture surface view is not visible"); + Log.e("Illegal state: video capture surface view is not visible"); return; } - Log.d(tag, "Trying to open camera with id " + params.cameraId); + Log.d("Trying to open camera with id ", params.cameraId); if (camera != null) { - Log.e(tag, "Camera is not null, ?already open? : aborting"); + Log.e("Camera is not null, ?already open? : aborting"); return; } camera = openCamera(params.cameraId); camera.setErrorCallback(new ErrorCallback() { public void onError(int error, Camera camera) { - Log.e(tag, "Camera error : " + error); + Log.e("Camera error : ", error); } }); @@ -113,14 +112,14 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { camera.setPreviewDisplay(holder); } catch (Throwable t) { - Log.e(tag, "Exception in Video capture setPreviewDisplay()", t); + Log.e(t,"Exception in Video capture setPreviewDisplay()"); } try { camera.startPreview(); } catch (Throwable e) { - Log.e(tag, "Error, can't start camera preview. Releasing camera!"); + Log.e("Error, can't start camera preview. Releasing camera!"); camera.release(); camera = null; return; @@ -132,7 +131,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { if (Camera.Parameters.FOCUS_MODE_AUTO.equals(parameters.getFocusMode())) { OnClickListener svClickListener = new OnClickListener() { public void onClick(View v) { - Log.i(tag, "Auto focus requested"); + Log.i("Auto focus requested"); camera.autoFocus(AndroidCameraRecord.this); } }; @@ -167,7 +166,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { public void storePreviewCallBack(PreviewCallback cb) { this.storedPreviewCallback = cb; if (camera == null) { - Log.w(tag, "Capture camera not ready, storing preview callback"); + Log.w("Capture camera not ready, storing preview callback"); return; } @@ -181,7 +180,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { camera.stopPreview(); camera.release(); camera=null; - Log.d(tag, "Camera released"); + Log.d("Camera released"); currentPreviewSize = null; previewStarted = false; } @@ -236,8 +235,8 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { } public void onAutoFocus(boolean success, Camera camera) { - if (success) Log.i(tag, "Autofocus success"); - else Log.i(tag, "Autofocus failure"); + if (success) Log.i("Autofocus success"); + else Log.i("Autofocus failure"); } public int getStoredPhoneOrientation() { diff --git a/video/AndroidCameraRecord5.java b/video/AndroidCameraRecord5.java index 8ee2c8303..03f9123db 100644 --- a/video/AndroidCameraRecord5.java +++ b/video/AndroidCameraRecord5.java @@ -21,13 +21,13 @@ package org.linphone.core.video; import java.util.Arrays; import java.util.List; +import org.linphone.core.Log; import org.linphone.core.video.AndroidCameraRecord.RecorderParams.MirrorType; import android.hardware.Camera; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.Size; -import android.util.Log; /** * Record from Android camera. @@ -63,18 +63,18 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac public void onPreviewFrame(byte[] data, Camera camera) { if (data == null) { - Log.e(tag, "onPreviewFrame Called with null buffer"); + Log.e("onPreviewFrame Called with null buffer"); return; } if (filterCtxPtr == 0l) { - Log.e(tag, "onPreviewFrame Called with no filterCtxPtr set"); + Log.e("onPreviewFrame Called with no filterCtxPtr set"); return; } int expectedBuffLength = getExpectedBufferLength(); if (expectedBuffLength != data.length) { - Log.e(tag, "onPreviewFrame called with bad buffer length " + data.length - + " whereas expected is " + expectedBuffLength + " don't calling putImage"); + Log.e("onPreviewFrame called with bad buffer length ", data.length, + " whereas expected is ", expectedBuffLength, " don't calling putImage"); return; } @@ -87,7 +87,7 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac double currentTimeElapsed = 0.8 * (curTime - lastFrameTime) / 1000 + 0.2 * timeElapsedBetweenFrames; if (currentTimeElapsed < expectedTimeBetweenFrames) { -// Log.d(tag, "Clipping frame " + Math.round(1 / currentTimeElapsed) + " > " + fps); +// Log.d("Clipping frame ", Math.round(1 / currentTimeElapsed), " > ", fps); return; } lastFrameTime = curTime; @@ -118,10 +118,10 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac List supportedFocusModes = parameters.getSupportedFocusModes(); String focusMode = selectFocusMode(supportedFocusModes); if (focusMode != null) { - Log.w(tag, "Selected focus mode: " + focusMode); + Log.w("Selected focus mode: ", focusMode); parameters.setFocusMode(focusMode); } else { - Log.i(tag, "No suitable focus mode found in : " + Arrays.toString(supportedFocusModes.toArray())); + Log.i("No suitable focus mode found in : ", Arrays.toString(supportedFocusModes.toArray())); } } diff --git a/video/AndroidCameraRecord8.java b/video/AndroidCameraRecord8.java index ad776475b..c5fda6774 100644 --- a/video/AndroidCameraRecord8.java +++ b/video/AndroidCameraRecord8.java @@ -20,11 +20,12 @@ package org.linphone.core.video; import java.util.List; +import org.linphone.core.Log; + import android.hardware.Camera; import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.Size; -import android.util.Log; /** * @@ -42,7 +43,7 @@ class AndroidCameraRecord8 extends AndroidCameraRecord5 { @Override protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { if (cb != null) { - Log.d(tag, "Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); + Log.d("Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); } camera.setPreviewCallbackWithBuffer(cb); } diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index f30f23e96..beb8fecb0 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -21,12 +21,12 @@ package org.linphone.core.video; import java.util.List; import org.linphone.LinphoneManager; +import org.linphone.core.Log; import org.linphone.core.Version; import org.linphone.core.video.AndroidCameraRecord.RecorderParams; import android.content.Context; import android.hardware.Camera.Size; -import android.util.Log; import android.view.OrientationEventListener; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -41,7 +41,6 @@ import android.view.SurfaceHolder.Callback; * */ public class AndroidCameraRecordManager { - private static final String tag = "Linphone"; private static AndroidCameraRecordManager instance; private OrientationEventListener orientationEventListener; private OnCapturingStateChangedListener capturingStateChangedListener; @@ -70,7 +69,7 @@ public class AndroidCameraRecordManager { // singleton private AndroidCameraRecordManager() { cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5(); - Log.i(tag, "=== Detected " + cc.getFoundCameras()+ " ==="); + Log.i("=== Detected " + cc.getFoundCameras()+ " ==="); cameraId = cc.getFoundCameras().defaultC; } @@ -87,7 +86,7 @@ public class AndroidCameraRecordManager { public void setUseFrontCamera(boolean value) { if (!hasFrontCamera()) { - Log.e(tag, "setUseFrontCamera(true) while no front camera detected on device: using rear"); + Log.e("setUseFrontCamera(true) while no front camera detected on device: using rear"); value = false; } if (cc.isFrontCamera(cameraId) == value) return; // already OK @@ -116,7 +115,7 @@ public class AndroidCameraRecordManager { public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) { if (recorder != null) { - Log.w(tag, "Recorder should not be running"); + Log.w("Recorder should not be running"); stopVideoRecording(); } RecorderParams p = new RecorderParams(filterDataPtr); @@ -148,19 +147,19 @@ public class AndroidCameraRecordManager { holder.addCallback(new Callback() { public void surfaceDestroyed(SurfaceHolder holder) { surfaceView = null; - Log.d(tag , "Video capture surface destroyed"); + Log.d("Video capture surface destroyed"); stopVideoRecording(); } public void surfaceCreated(SurfaceHolder holder) { surfaceView = sv; - Log.d(tag , "Video capture surface created"); + Log.d("Video capture surface created"); tryToStartVideoRecording(); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - Log.d(tag , "Video capture surface changed"); + Log.d("Video capture surface changed"); } }); } @@ -200,7 +199,7 @@ public class AndroidCameraRecordManager { if (muted || surfaceView == null || parameters == null) return; if (recorder != null) { - Log.e(tag, "Recorder already present"); + Log.e("Recorder already present"); stopVideoRecording(); } @@ -271,7 +270,7 @@ public class AndroidCameraRecordManager { final int rotation = bufferRotationToCompensateCameraAndPhoneOrientations(); final boolean isPortrait = (rotation % 180) == 90; - Log.d(tag, "Camera sensor in " + (isPortrait? "portrait":"landscape") + " orientation."); + Log.d("Camera sensor in ", isPortrait? "portrait":"landscape"," orientation."); return isPortrait; } @@ -296,10 +295,10 @@ public class AndroidCameraRecordManager { final int phoneOrientation = mAlwaysChangingPhoneOrientation; final int cameraOrientation = cc.getCameraOrientation(cameraId); final int rotation = (cameraOrientation + phoneOrientation) % 360; - Log.d(tag, String.format( - "Capture video buffer of cameraId=%d will need a rotation of " - + "%d degrees: camera_orientation=%d, phone_orientation=%d", - cameraId, rotation, cameraOrientation, phoneOrientation)); + Log.d("Capture video buffer of cameraId=",cameraId, + " will need a rotation of ",rotation, + " degrees: camera_orientation=",cameraOrientation, + " phone_orientation=", phoneOrientation); return rotation; } @@ -329,7 +328,7 @@ public class AndroidCameraRecordManager { if (mAlwaysChangingPhoneOrientation == degrees) return; - Log.i(tag, "Phone orientation changed to " + degrees); + Log.i("Phone orientation changed to ", degrees); mAlwaysChangingPhoneOrientation = degrees; } } From 94d58ce1e6336ed050e2b08671ea481ccf8632d7 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 21 Jun 2011 15:33:33 +0200 Subject: [PATCH 120/769] Fix regression video with Galaxy S. --- video/AndroidCameraRecordManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index beb8fecb0..6ad9a78de 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -294,7 +294,10 @@ public class AndroidCameraRecordManager { final int phoneOrientation = mAlwaysChangingPhoneOrientation; final int cameraOrientation = cc.getCameraOrientation(cameraId); - final int rotation = (cameraOrientation + phoneOrientation) % 360; + int frontCameraCorrection = 0; + if (cc.isFrontCamera(cameraId)) // TODO: check with other phones (Nexus S, ...) + frontCameraCorrection=180; // hack that "just works" on Galaxy S. + final int rotation = (cameraOrientation + phoneOrientation + frontCameraCorrection) % 360; Log.d("Capture video buffer of cameraId=",cameraId, " will need a rotation of ",rotation, " degrees: camera_orientation=",cameraOrientation, From 03c280a21665044ed510a2e598399a5263b494dd Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 22 Jun 2011 13:06:47 +0200 Subject: [PATCH 121/769] add missing ptime setters --- LinphoneCoreImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 32052f143..b68d9c676 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -99,6 +99,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native int pauseCall(long nativePtr, long callPtr); private native int pauseAllCalls(long nativePtr); private native int resumeCall(long nativePtr, long callPtr); + private native void setUploadPtime(long nativePtr, int ptime); + private native void setDownloadPtime(long nativePtr, int ptime); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -483,4 +486,11 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean pauseAllCalls() { return 0 == pauseAllCalls(nativePtr); } + public void setDownloadPtime(int ptime) { + setDownloadPtime(nativePtr,ptime); + + } + public void setUploadPtime(int ptime) { + setUploadPtime(nativePtr,ptime); + } } From f91c9b4805a7050b1f192b28c848b4aac39ae713 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 1 Jul 2011 18:08:04 +0200 Subject: [PATCH 122/769] disable video on non capable hardware --- Version.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Version.java b/Version.java index 6bf12be45..61a92b40b 100644 --- a/Version.java +++ b/Version.java @@ -65,5 +65,8 @@ public class Version { if (hasNeon == null) hasNeon = nativeHasNeon(); return hasNeon; } + public static boolean isVideoCapable() { + return !Version.sdkStrictlyBelow(5) && Version.hasNeon() && Hacks.hasCamera(); + } } From d9333176bf4b03cc1c585f12a4ecc52294a05340 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 15 Jul 2011 22:08:36 +0200 Subject: [PATCH 123/769] Rename openssl libs. ZRTP API and makefiles. --- LinphoneCallImpl.java | 14 +++++++++++++- LinphoneCoreFactoryImpl.java | 12 ++++++++++++ LinphoneCoreImpl.java | 7 ++++++- Version.java | 4 ++++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 653bd157e..55d3baedf 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -39,6 +39,9 @@ class LinphoneCallImpl implements LinphoneCall { private native int getDuration(long nativePtr); private native float getCurrentQuality(long nativePtr); private native float getAverageQuality(long nativePtr); + private native String getAuthenticationToken(long nativePtr); + private native boolean isAuthenticationTokenVerified(long nativePtr); + private native boolean areStreamsEncrypted(long nativePtr); protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -109,5 +112,14 @@ class LinphoneCallImpl implements LinphoneCall { public float getCurrentQuality() { return getCurrentQuality(nativePtr); } - + + public String getAuthenticationToken(){ + return getAuthenticationToken(nativePtr); + } + public boolean isAuthenticationTokenVerified(){ + return isAuthenticationTokenVerified(nativePtr); + } + public boolean areStreamsEncrypted() { + return areStreamsEncrypted(nativePtr); + } } diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index a2800be92..6301c5c70 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -32,10 +32,22 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } static { + // FFMPEG (audio/video) loadOptionalLibrary("avutil"); loadOptionalLibrary("swscale"); loadOptionalLibrary("avcore"); loadOptionalLibrary("avcodec"); + + // OPENSSL (cryptography) + // lin prefix avoids collision with libs in /system/lib + loadOptionalLibrary("lincrypto"); + loadOptionalLibrary("linssl"); + + // Secure RTP and key negotiation + loadOptionalLibrary("srtp"); + loadOptionalLibrary("zrtpcpp"); // GPLv3+ + + //Main library System.loadLibrary("linphone"); } @Override diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index b68d9c676..b8fddda20 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -101,7 +101,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native int resumeCall(long nativePtr, long callPtr); private native void setUploadPtime(long nativePtr, int ptime); private native void setDownloadPtime(long nativePtr, int ptime); - + private native void setZrtpSecretsCache(long nativePtr, String file); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -493,4 +494,8 @@ class LinphoneCoreImpl implements LinphoneCore { public void setUploadPtime(int ptime) { setUploadPtime(nativePtr,ptime); } + + public void setZrtpSecretsCache(String file) { + setZrtpSecretsCache(nativePtr,file); + } } diff --git a/Version.java b/Version.java index 61a92b40b..14dff0c27 100644 --- a/Version.java +++ b/Version.java @@ -34,6 +34,7 @@ public class Version { public static final int API09_GINGERBREAD_23 = 9; public static final int API11_HONEYCOMB_30 = 11; + private static native boolean nativeHasZrtp(); private static native boolean nativeHasNeon(); private static Boolean hasNeon; @@ -69,4 +70,7 @@ public class Version { return !Version.sdkStrictlyBelow(5) && Version.hasNeon() && Hacks.hasCamera(); } + public static boolean hasZrtp(){ + return nativeHasZrtp(); + } } From efdfe92b18348a8234f01a7874bc504ebc18476a Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 20 Jul 2011 11:52:09 +0200 Subject: [PATCH 124/769] Enable TLS option --- LinphoneCoreFactoryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 6301c5c70..7e8f6e5de 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -37,7 +37,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { loadOptionalLibrary("swscale"); loadOptionalLibrary("avcore"); loadOptionalLibrary("avcodec"); - + // OPENSSL (cryptography) // lin prefix avoids collision with libs in /system/lib loadOptionalLibrary("lincrypto"); From 4eb83bcf13d2d9a25709d6f5887f14388c9c98f0 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 22 Jul 2011 11:43:05 +0200 Subject: [PATCH 125/769] Updated Android implementation to support new trusted root CA option --- LinphoneCoreFactoryImpl.java | 14 ++++++++++++++ LinphoneCoreImpl.java | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 7e8f6e5de..f92dd6c86 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -19,7 +19,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone.core; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; +import java.security.InvalidAlgorithmParameterException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.PKIXParameters; +import java.security.cert.TrustAnchor; +import java.security.cert.X509Certificate; +import java.util.Iterator; + +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index b8fddda20..f09c5f9ee 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -87,6 +87,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native int[] getPreferredVideoSize(long nativePtr); private native void setRing(long nativePtr, String path); private native String getRing(long nativePtr); + private native void setRootCA(long nativePtr, String path); private native long[] listVideoPayloadTypes(long nativePtr); private native long[] listAudioPayloadTypes(long nativePtr); private native void enableKeepAlive(long nativePtr,boolean enable); @@ -420,6 +421,10 @@ class LinphoneCoreImpl implements LinphoneCore { return getRing(nativePtr); } + public void setRootCA(String path) { + setRootCA(nativePtr, path); + } + public PayloadType[] getVideoCodecs() { long[] typesPtr = listVideoPayloadTypes(nativePtr); if (typesPtr == null) return null; From 69f71d9bc81ed27c65031c6c6b4fe142272c85ee Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 22 Jul 2011 12:44:41 +0200 Subject: [PATCH 126/769] clean up sdk deps --- video/AndroidCameraRecordManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index 6ad9a78de..86d12fffa 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -20,7 +20,8 @@ package org.linphone.core.video; import java.util.List; -import org.linphone.LinphoneManager; + +import org.linphone.core.LinphoneCore; import org.linphone.core.Log; import org.linphone.core.Version; import org.linphone.core.video.AndroidCameraRecord.RecorderParams; @@ -339,8 +340,8 @@ public class AndroidCameraRecordManager { /** * @return true if linphone core configured to send a A buffer while phone orientation induces !A buffer (A=landscape or portrait) */ - public boolean isOutputOrientationMismatch() { - final boolean currentlyPortrait = LinphoneManager.getLc().getPreferredVideoSize().isPortrait(); + public boolean isOutputOrientationMismatch(LinphoneCore lc) { + final boolean currentlyPortrait = lc.getPreferredVideoSize().isPortrait(); final boolean shouldBePortrait = isOutputPortraitDependingOnCameraAndPhoneOrientations(); return currentlyPortrait ^ shouldBePortrait; } From 748ad2f38529f74468daa217e4b8fbf80d777401 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 1 Aug 2011 10:09:11 +0200 Subject: [PATCH 127/769] ZRTP on old arm devices. --- LinphoneCoreFactoryImpl.java | 2 ++ Version.java | 7 +++++++ video/AndroidCameraConf5.java | 2 -- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index f92dd6c86..674b62450 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -63,6 +63,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { //Main library System.loadLibrary("linphone"); + + Version.dumpCapabilities(); } @Override public LinphoneAuthInfo createAuthInfo(String username, String password, diff --git a/Version.java b/Version.java index 14dff0c27..53ae2e05f 100644 --- a/Version.java +++ b/Version.java @@ -73,4 +73,11 @@ public class Version { public static boolean hasZrtp(){ return nativeHasZrtp(); } + + public static void dumpCapabilities(){ + StringBuilder sb = new StringBuilder(" ==== Capabilities dump ====\n"); + sb.append("Has neon: ").append(Boolean.toString(hasNeon())).append("\n"); + sb.append("Has ZRTP: ").append(Boolean.toString(hasZrtp())).append("\n"); + Log.i(sb.toString()); + } } diff --git a/video/AndroidCameraConf5.java b/video/AndroidCameraConf5.java index f8dbe56cb..c9c3a1ade 100644 --- a/video/AndroidCameraConf5.java +++ b/video/AndroidCameraConf5.java @@ -27,8 +27,6 @@ class AndroidCameraConf5 implements AndroidCameraConf { public AndroidCameras getFoundCameras() {return foundCameras;} public AndroidCameraConf5() { - Log.i("Detecting cameras"); - // Defaults foundCameras = new AndroidCameras(); From 8b09455f817acd6c02f0b01fb602fc1d76d0bb06 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 4 Aug 2011 10:04:31 +0200 Subject: [PATCH 128/769] Fix Android logs from java. Some levels where hidden due to the use of isLoggable. --- Log.java | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/Log.java b/Log.java index c341fa68e..b70b65931 100644 --- a/Log.java +++ b/Log.java @@ -18,7 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; - +import static android.util.Log.DEBUG; +import static android.util.Log.ERROR; +import static android.util.Log.INFO; +import static android.util.Log.WARN; /** * Convenient wrapper for Android logs. @@ -28,48 +31,54 @@ package org.linphone.core; public final class Log { public static final String TAG = "Linphone"; - + private static final boolean useIsLoggable = false; + + @SuppressWarnings(value="all") + private static boolean isLoggable(int level) { + return !useIsLoggable || android.util.Log.isLoggable(TAG, level); + } + public static void i(Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.INFO)) { + if (isLoggable(INFO)) { android.util.Log.i(TAG, toString(objects)); } } public static void i(Throwable t, Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.INFO)) { + if (isLoggable(INFO)) { android.util.Log.i(TAG, toString(objects), t); } } public static void d(Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.DEBUG)) { + if (isLoggable(DEBUG)) { android.util.Log.d(TAG, toString(objects)); } } public static void d(Throwable t, Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.DEBUG)) { + if (isLoggable(DEBUG)) { android.util.Log.d(TAG, toString(objects), t); } } public static void w(Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.WARN)) { + if (isLoggable(WARN)) { android.util.Log.w(TAG, toString(objects)); } } public static void w(Throwable t, Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.WARN)) { + if (isLoggable(WARN)) { android.util.Log.w(TAG, toString(objects), t); } } public static void e(Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.ERROR)) { + if (isLoggable(ERROR)) { android.util.Log.e(TAG, toString(objects)); } } public static void e(Throwable t, Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.ERROR)) { + if (isLoggable(ERROR)) { android.util.Log.e(TAG, toString(objects), t); } } @@ -78,7 +87,7 @@ public final class Log { * @throws RuntimeException always throw after logging the error message. */ public static void f(Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.ERROR)) { + if (isLoggable(ERROR)) { android.util.Log.e(TAG, toString(objects)); throw new RuntimeException("Fatal error : " + toString(objects)); } @@ -87,7 +96,7 @@ public final class Log { * @throws RuntimeException always throw after logging the error message. */ public static void f(Throwable t, Object...objects) { - if (android.util.Log.isLoggable(TAG, android.util.Log.ERROR)) { + if (isLoggable(ERROR)) { android.util.Log.e(TAG, toString(objects), t); throw new RuntimeException("Fatal error : " + toString(objects), t); } From c635198a64da7563e3f5782383d61c56d5db0ec0 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 4 Aug 2011 11:26:19 +0200 Subject: [PATCH 129/769] Fix video on Nexus S. --- video/AndroidCameraConf.java | 6 +++ video/AndroidCameraConf5.java | 17 ++++++++ video/AndroidCameraConf9.java | 20 +++++++++ video/AndroidCameraRecord.java | 37 +++++++++++++--- video/AndroidCameraRecord5.java | 1 + video/AndroidCameraRecordManager.java | 62 +++++++++++++-------------- video/VideoUtil.java | 42 ++++++++++++++++++ 7 files changed, 147 insertions(+), 38 deletions(-) create mode 100644 video/VideoUtil.java diff --git a/video/AndroidCameraConf.java b/video/AndroidCameraConf.java index 9796ba12b..874a6d2da 100644 --- a/video/AndroidCameraConf.java +++ b/video/AndroidCameraConf.java @@ -18,6 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; +import java.util.List; + +import org.linphone.core.VideoSize; + /** * @author Guillaume Beraudo @@ -33,6 +37,8 @@ interface AndroidCameraConf { boolean isFrontCamera(int cameraId); + List getSupportedPreviewSizes(int cameraId); + /** * Default: no front; rear=0; default=rear * @author Guillaume Beraudo diff --git a/video/AndroidCameraConf5.java b/video/AndroidCameraConf5.java index c9c3a1ade..06c266d7a 100644 --- a/video/AndroidCameraConf5.java +++ b/video/AndroidCameraConf5.java @@ -18,8 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; +import java.util.List; + import org.linphone.core.Hacks; import org.linphone.core.Log; +import org.linphone.core.VideoSize; + +import android.hardware.Camera; class AndroidCameraConf5 implements AndroidCameraConf { @@ -90,6 +95,18 @@ class AndroidCameraConf5 implements AndroidCameraConf { return false; } + + public List getSupportedPreviewSizes(int cameraId) { + if (getNumberOfCameras() >1) { + Log.w("Hack: on older devices, using video formats supported by default camera"); + } + Log.i("Opening camera to retrieve supported video sizes"); + Camera c = Camera.open(); + List sizes=VideoUtil.createList(c.getParameters().getSupportedPreviewSizes()); + c.release(); + Log.i("Camera opened to retrieve supported video sizes released"); + return sizes; + } diff --git a/video/AndroidCameraConf9.java b/video/AndroidCameraConf9.java index d0ef0faa5..02e909895 100644 --- a/video/AndroidCameraConf9.java +++ b/video/AndroidCameraConf9.java @@ -18,12 +18,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.linphone.core.Log; +import org.linphone.core.VideoSize; import android.hardware.Camera; class AndroidCameraConf9 implements AndroidCameraConf { private AndroidCameras foundCameras; + private Map> supportedSizes = new HashMap>(); public AndroidCameras getFoundCameras() {return foundCameras;} public AndroidCameraConf9() { @@ -38,9 +44,19 @@ class AndroidCameraConf9 implements AndroidCameraConf { } else { foundCameras.rear = id; } + supportedSizes.put(id, findSupportedVideoSizes(id)); } } + private List findSupportedVideoSizes(int id) { + Log.i("Opening camera ",id," to retrieve supported video sizes"); + Camera c = Camera.open(id); + List sizes=VideoUtil.createList(c.getParameters().getSupportedPreviewSizes()); + c.release(); + Log.i("Camera ",id," opened to retrieve supported video sizes released"); + return sizes; + } + public int getNumberOfCameras() { return Camera.getNumberOfCameras(); } @@ -58,4 +74,8 @@ class AndroidCameraConf9 implements AndroidCameraConf { return info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? true : false; } + public List getSupportedPreviewSizes(int cameraId) { + return supportedSizes.get(cameraId); + } + } diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java index dec9338b2..bb9fd9786 100644 --- a/video/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core.video; -import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.linphone.core.Log; import org.linphone.core.Version; +import org.linphone.core.VideoSize; import android.hardware.Camera; import android.hardware.Camera.AutoFocusCallback; @@ -44,7 +44,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { private PreviewCallback storedPreviewCallback; private boolean previewStarted; - private List supportedVideoSizes; + private List supportedVideoSizes; private Size currentPreviewSize; public AndroidCameraRecord(RecorderParams parameters) { @@ -55,6 +55,23 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { return Collections.emptyList(); } + private int[] findClosestFpsRange(int expectedFps, List fpsRanges) { + Log.d("Searching for closest fps range from ",expectedFps); + int measure = Integer.MAX_VALUE; + int[] closestRange = {expectedFps,expectedFps}; + for (int[] curRange : fpsRanges) { + if (curRange[0] > expectedFps || curRange[1] < expectedFps) continue; + int curMeasure = Math.abs(curRange[0] - expectedFps) + + Math.abs(curRange[1] - expectedFps); + if (curMeasure < measure) { + closestRange=curRange; + Log.d("a better range has been found: w=",closestRange[0],",h=",closestRange[1]); + } + } + Log.d("The closest fps range is w=",closestRange[0],",h=",closestRange[1]); + return closestRange; + } + public synchronized void startPreview() { // FIXME throws exception? if (previewStarted) { Log.w("Already started"); @@ -83,12 +100,12 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { Camera.Parameters parameters=camera.getParameters(); - if (Version.sdkStrictlyBelow(9)) { + if (Version.sdkStrictlyBelow(Version.API09_GINGERBREAD_23)) { parameters.set("camera-id",params.cameraId); } if (supportedVideoSizes == null) { - supportedVideoSizes = new ArrayList(getSupportedPreviewSizes(parameters)); + supportedVideoSizes = VideoUtil.createList(getSupportedPreviewSizes(parameters)); } @@ -101,7 +118,13 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { // should setParameters and get again to have the real one?? currentPreviewSize = parameters.getPreviewSize(); - parameters.setPreviewFrameRate(Math.round(params.fps)); + // Frame rate + if (Version.sdkStrictlyBelow(Version.API09_GINGERBREAD_23)) { + parameters.setPreviewFrameRate(Math.round(params.fps)); + } else { + int[] range=findClosestFpsRange((int)(1000*params.fps), parameters.getSupportedPreviewFpsRange()); + parameters.setPreviewFpsRange(range[0], range[1]); + } onSettingCameraParameters(parameters); @@ -223,8 +246,8 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { return previewStarted; } - public List getSupportedVideoSizes() { - return new ArrayList(supportedVideoSizes); + public List getSupportedVideoSizes() { + return supportedVideoSizes; } diff --git a/video/AndroidCameraRecord5.java b/video/AndroidCameraRecord5.java index 03f9123db..45f94cd29 100644 --- a/video/AndroidCameraRecord5.java +++ b/video/AndroidCameraRecord5.java @@ -135,4 +135,5 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac camera.setPreviewCallback(cb); } + } diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index 86d12fffa..22f437d21 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -20,14 +20,13 @@ package org.linphone.core.video; import java.util.List; - import org.linphone.core.LinphoneCore; import org.linphone.core.Log; import org.linphone.core.Version; +import org.linphone.core.VideoSize; import org.linphone.core.video.AndroidCameraRecord.RecorderParams; import android.content.Context; -import android.hardware.Camera.Size; import android.view.OrientationEventListener; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -63,7 +62,6 @@ public class AndroidCameraRecordManager { private int cameraId; private AndroidCameraRecord recorder; - private List supportedVideoSizes; private int mAlwaysChangingPhoneOrientation=0; @@ -126,11 +124,14 @@ public class AndroidCameraRecordManager { p.cameraId = cameraId; p.isFrontCamera = isUseFrontCamera(); parameters = p; - + + // Mirror the sent frames in order to make them readable + // (otherwise it is mirrored and thus unreadable) if (p.isFrontCamera) { - if (!isCameraOrientationPortrait()) { - // Code for Nexus S: to be tested - p.mirror = RecorderParams.MirrorType.CENTRAL; + if (!isCameraMountedPortrait()) { + // Code for Nexus S + if (isFrameToBeShownPortrait()) + p.mirror = RecorderParams.MirrorType.CENTRAL; } else { // Code for Galaxy S like: camera mounted landscape when phone hold portrait p.mirror = RecorderParams.MirrorType.HORIZONTAL; @@ -236,20 +237,9 @@ public class AndroidCameraRecordManager { - /** - * FIXME select right camera - */ - public List supportedVideoSizes() { - if (supportedVideoSizes != null) { - return supportedVideoSizes; - } - - if (recorder != null) { - supportedVideoSizes = recorder.getSupportedVideoSizes(); - if (supportedVideoSizes != null) return supportedVideoSizes; - } - - return supportedVideoSizes; + public List supportedVideoSizes() { + Log.d("Using supportedVideoSizes of camera ",cameraId); + return cc.getSupportedPreviewSizes(cameraId); } @@ -267,20 +257,28 @@ public class AndroidCameraRecordManager { parameters = null; } - public boolean isOutputPortraitDependingOnCameraAndPhoneOrientations() { + /** Depends on currently selected camera, camera mounted portrait/landscape, current phone orientation */ + public boolean isFrameToBeShownPortrait() { final int rotation = bufferRotationToCompensateCameraAndPhoneOrientations(); - final boolean isPortrait = (rotation % 180) == 90; - - Log.d("Camera sensor in ", isPortrait? "portrait":"landscape"," orientation."); + + boolean isPortrait; + if (isCameraMountedPortrait()) { + // Nexus S + isPortrait = (rotation % 180) == 0; + } else { + isPortrait = (rotation % 180) == 90; + } + + Log.d("The frame to be shown and sent to remote is ", isPortrait? "portrait":"landscape"," orientation."); return isPortrait; } - - - public boolean isCameraOrientationPortrait() { + + + public boolean isCameraMountedPortrait() { return (cc.getCameraOrientation(cameraId) % 180) == 0; } @@ -296,8 +294,10 @@ public class AndroidCameraRecordManager { final int phoneOrientation = mAlwaysChangingPhoneOrientation; final int cameraOrientation = cc.getCameraOrientation(cameraId); int frontCameraCorrection = 0; - if (cc.isFrontCamera(cameraId)) // TODO: check with other phones (Nexus S, ...) - frontCameraCorrection=180; // hack that "just works" on Galaxy S. + if (cc.isFrontCamera(cameraId)) { + frontCameraCorrection=180; // hack that "just works" on Galaxy S and Nexus S. + // See also magic with mirrors in setParametersFromFilter + } final int rotation = (cameraOrientation + phoneOrientation + frontCameraCorrection) % 360; Log.d("Capture video buffer of cameraId=",cameraId, " will need a rotation of ",rotation, @@ -342,7 +342,7 @@ public class AndroidCameraRecordManager { */ public boolean isOutputOrientationMismatch(LinphoneCore lc) { final boolean currentlyPortrait = lc.getPreferredVideoSize().isPortrait(); - final boolean shouldBePortrait = isOutputPortraitDependingOnCameraAndPhoneOrientations(); + final boolean shouldBePortrait = isFrameToBeShownPortrait(); return currentlyPortrait ^ shouldBePortrait; } diff --git a/video/VideoUtil.java b/video/VideoUtil.java new file mode 100644 index 000000000..065557b77 --- /dev/null +++ b/video/VideoUtil.java @@ -0,0 +1,42 @@ +/* +VideoUtil.java +Copyright (C) 2011 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core.video; + +import java.util.ArrayList; +import java.util.List; + +import org.linphone.core.VideoSize; + +import android.hardware.Camera.Size; + +/** + * @author Guillaume Beraudo + */ +final class VideoUtil { + + private VideoUtil() {} + + public static List createList(List supportedVideoSizes) { + List converted = new ArrayList(supportedVideoSizes.size()); + for (Size s : supportedVideoSizes) { + converted.add(new VideoSize(s.width, s.height)); + } + return converted; + } +} From 6eb200df4a908a29646dcf9ee04e76a19da108b2 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 4 Aug 2011 16:13:16 +0200 Subject: [PATCH 130/769] Don't load Camera Manager on video uncapable devices. --- video/AndroidCameraRecordManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java index 22f437d21..7e8e8b613 100644 --- a/video/AndroidCameraRecordManager.java +++ b/video/AndroidCameraRecordManager.java @@ -67,6 +67,9 @@ public class AndroidCameraRecordManager { // singleton private AndroidCameraRecordManager() { + if (!Version.isVideoCapable()) { // imply sdk>=5 + throw new RuntimeException("AndroidCameraRecordManager: hardware is not video capable"); + } cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5(); Log.i("=== Detected " + cc.getFoundCameras()+ " ==="); cameraId = cc.getFoundCameras().defaultC; From 83390c8351c467e7e53538cceca1304ed2261f11 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 5 Aug 2011 16:15:24 +0200 Subject: [PATCH 131/769] Conventien method to sleep. --- Hacks.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Hacks.java b/Hacks.java index fd9342827..ceca9ee80 100644 --- a/Hacks.java +++ b/Hacks.java @@ -89,7 +89,7 @@ public final class Hacks { sleep(200); } - private static final void sleep(int time) { + public static final void sleep(int time) { try { Thread.sleep(time); } catch(InterruptedException ie){} From 2b19e7cf75e5df1777d5610f65076d38ddc883ec Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 12 Aug 2011 16:21:22 +0200 Subject: [PATCH 132/769] android: add opengl support for video display --- AndroidVideoWindowImpl.java | 98 +++++++++++++++++++++++++++++++------ 1 file changed, 84 insertions(+), 14 deletions(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index 254efb379..2fd27b424 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -1,8 +1,14 @@ package org.linphone.core; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +import org.linphone.OpenGLESDisplay; + import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Bitmap.Config; +import android.opengl.GLSurfaceView; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -10,15 +16,18 @@ import android.view.Surface.OutOfResourcesException; import android.view.SurfaceHolder.Callback; public class AndroidVideoWindowImpl { - private Bitmap mBitmap; + private boolean useGLrendering; + private Bitmap mBitmap; private SurfaceView mView; - private Surface mSurface; + private Surface mSurface; private VideoWindowListener mListener; + private Renderer renderer; public static interface VideoWindowListener{ void onSurfaceReady(AndroidVideoWindowImpl vw); void onSurfaceDestroyed(AndroidVideoWindowImpl vw); }; public AndroidVideoWindowImpl(SurfaceView view){ + useGLrendering = (view instanceof GLSurfaceView); mView=view; mBitmap=null; mSurface=null; @@ -27,9 +36,11 @@ public class AndroidVideoWindowImpl { public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Log.i("Surface is being changed."); - synchronized(AndroidVideoWindowImpl.this){ - mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565); - mSurface=holder.getSurface(); + if (!useGLrendering) { + synchronized(AndroidVideoWindowImpl.this){ + mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565); + mSurface=holder.getSurface(); + } } if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); Log.w("Video display surface changed"); @@ -40,15 +51,23 @@ public class AndroidVideoWindowImpl { } public void surfaceDestroyed(SurfaceHolder holder) { - synchronized(AndroidVideoWindowImpl.this){ - mSurface=null; - mBitmap=null; + if (!useGLrendering) { + synchronized(AndroidVideoWindowImpl.this){ + mSurface=null; + mBitmap=null; + } } if (mListener!=null) mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); Log.d("Video display surface destroyed"); } }); + + if (useGLrendering) { + renderer = new Renderer(); + ((GLSurfaceView)mView).setRenderer(renderer); + ((GLSurfaceView)mView).setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); + } } static final int LANDSCAPE=0; static final int PORTRAIT=1; @@ -57,31 +76,82 @@ public class AndroidVideoWindowImpl { //Log.d("Orientation changed."); } public void setListener(VideoWindowListener l){ - mListener=l; + mListener=l; } public Surface getSurface(){ + if (useGLrendering) + Log.e("View class does not match Video display filter used (you must use a non-GL View)"); return mView.getHolder().getSurface(); } public Bitmap getBitmap(){ + if (useGLrendering) + Log.e("View class does not match Video display filter used (you must use a non-GL View)"); return mBitmap; } - //Called by the mediastreamer2 android display filter + + public void setOpenGLESDisplay(int ptr) { + if (!useGLrendering) + Log.e("View class does not match Video display filter used (you must use a GL View)"); + renderer.setOpenGLESDisplay(ptr); + } + + public void requestRender() { + ((GLSurfaceView)mView).requestRender(); + } + + //Called by the mediastreamer2 android display filter public synchronized void update(){ if (mSurface!=null){ try { - Canvas canvas=mSurface.lockCanvas(null); + Canvas canvas=mSurface.lockCanvas(null); canvas.drawBitmap(mBitmap, 0, 0, null); mSurface.unlockCanvasAndPost(canvas); - + } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OutOfResourcesException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - } + } + } } + + private static class Renderer implements GLSurfaceView.Renderer { + int ptr; + boolean initPending; + int width, height; + + public Renderer() { + ptr = 0; + initPending = false; + } + + public void setOpenGLESDisplay(int ptr) { + this.ptr = ptr; + } + + public void onDrawFrame(GL10 gl) { + if (ptr == 0) + return; + if (initPending) { + OpenGLESDisplay.init(ptr, width, height); + initPending = false; + } + OpenGLESDisplay.render(ptr); + } + + public void onSurfaceChanged(GL10 gl, int width, int height) { + /* delay init until ptr is set */ + this.width = width; + this.height = height; + initPending = true; + } + + public void onSurfaceCreated(GL10 gl, EGLConfig config) { + + } + } } From 524c8e4919638aabfe3db0ca5a243327e80de32b Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 12 Aug 2011 09:37:22 +0200 Subject: [PATCH 133/769] video: initialize fps range using first value given by the hardware --- video/AndroidCameraRecord.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java index bb9fd9786..fe787f317 100644 --- a/video/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -58,7 +58,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { private int[] findClosestFpsRange(int expectedFps, List fpsRanges) { Log.d("Searching for closest fps range from ",expectedFps); int measure = Integer.MAX_VALUE; - int[] closestRange = {expectedFps,expectedFps}; + int[] closestRange = fpsRanges.get(0); for (int[] curRange : fpsRanges) { if (curRange[0] > expectedFps || curRange[1] < expectedFps) continue; int curMeasure = Math.abs(curRange[0] - expectedFps) From b60a44a59eb1b5deafcc91ca6a3880ebfa34b47b Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 16 Aug 2011 09:48:36 +0200 Subject: [PATCH 134/769] android: 'synchronized' native calls to liblinphone Avoids dead locks in exosip. --- LinphoneCoreImpl.java | 96 +++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index f09c5f9ee..99a2e194a 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -216,17 +216,17 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setNetworkReachable(boolean isReachable) { setNetworkStateReachable(nativePtr,isReachable); } - public void setPlaybackGain(float gain) { + public synchronized void setPlaybackGain(float gain) { setPlaybackGain(nativePtr,gain); } - public float getPlaybackGain() { + public synchronized float getPlaybackGain() { return getPlaybackGain(nativePtr); } - public void muteMic(boolean isMuted) { + public synchronized void muteMic(boolean isMuted) { muteMic(nativePtr,isMuted); } - public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException { + public synchronized LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException { long lAddress = interpretUrl(nativePtr,destination); if (lAddress != 0) { return new LinphoneAddressImpl(lAddress,true); @@ -234,7 +234,7 @@ class LinphoneCoreImpl implements LinphoneCore { throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); } } - public LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException { + public synchronized LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException { long lNativePtr = inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); if (lNativePtr!=0) { return new LinphoneCallImpl(lNativePtr); @@ -243,16 +243,16 @@ class LinphoneCoreImpl implements LinphoneCore { } } - public void sendDtmf(char number) { + public synchronized void sendDtmf(char number) { sendDtmf(nativePtr,number); } - public void clearCallLogs() { + public synchronized void clearCallLogs() { clearCallLogs(nativePtr); } - public boolean isMicMuted() { + public synchronized boolean isMicMuted() { return isMicMuted(nativePtr); } - public PayloadType findPayloadType(String mime, int clockRate) { + public synchronized PayloadType findPayloadType(String mime, int clockRate) { isValid(); long playLoadType = findPayloadType(nativePtr, mime, clockRate); if (playLoadType == 0) { @@ -261,7 +261,7 @@ class LinphoneCoreImpl implements LinphoneCore { return new PayloadTypeImpl(playLoadType); } } - public void enablePayloadType(PayloadType pt, boolean enable) + public synchronized void enablePayloadType(PayloadType pt, boolean enable) throws LinphoneCoreException { isValid(); if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) { @@ -269,11 +269,11 @@ class LinphoneCoreImpl implements LinphoneCore { } } - public void enableEchoCancellation(boolean enable) { + public synchronized void enableEchoCancellation(boolean enable) { isValid(); enableEchoCancellation(nativePtr, enable); } - public boolean isEchoCancellationEnabled() { + public synchronized boolean isEchoCancellationEnabled() { isValid(); return isEchoCancellationEnabled(nativePtr); @@ -305,27 +305,27 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return false; } - public void playDtmf(char number, int duration) { + public synchronized void playDtmf(char number, int duration) { playDtmf(nativePtr,number, duration); } - public void stopDtmf() { + public synchronized void stopDtmf() { stopDtmf(nativePtr); } - public void addFriend(LinphoneFriend lf) throws LinphoneCoreException { + public synchronized void addFriend(LinphoneFriend lf) throws LinphoneCoreException { addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr); } - public void setPresenceInfo(int minute_away, String alternative_contact, + public synchronized void setPresenceInfo(int minute_away, String alternative_contact, OnlineStatus status) { setPresenceInfo(nativePtr,minute_away,alternative_contact,status.mValue); } - public LinphoneChatRoom createChatRoom(String to) { + public synchronized LinphoneChatRoom createChatRoom(String to) { return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to)); } - public void setPreviewWindow(Object w) { + public synchronized void setPreviewWindow(Object w) { if (mPreviewWindow!=null) mPreviewWindow.setListener(null); mPreviewWindow=new AndroidVideoWindowImpl((SurfaceView)w); @@ -339,7 +339,7 @@ class LinphoneCoreImpl implements LinphoneCore { } }); } - public void setVideoWindow(Object w) { + public synchronized void setVideoWindow(Object w) { if (mVideoWindow!=null) mVideoWindow.setListener(null); mVideoWindow=new AndroidVideoWindowImpl((SurfaceView) w); @@ -353,30 +353,30 @@ class LinphoneCoreImpl implements LinphoneCore { } }); } - public void enableVideo(boolean vcap_enabled, boolean display_enabled) { + public synchronized void enableVideo(boolean vcap_enabled, boolean display_enabled) { enableVideo(nativePtr,vcap_enabled, display_enabled); } - public boolean isVideoEnabled() { + public synchronized boolean isVideoEnabled() { return isVideoEnabled(nativePtr); } - public FirewallPolicy getFirewallPolicy() { + public synchronized FirewallPolicy getFirewallPolicy() { return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr)); } - public String getStunServer() { + public synchronized String getStunServer() { return getStunServer(nativePtr); } - public void setFirewallPolicy(FirewallPolicy pol) { + public synchronized void setFirewallPolicy(FirewallPolicy pol) { setFirewallPolicy(nativePtr,pol.value()); } - public void setStunServer(String stunServer) { + public synchronized void setStunServer(String stunServer) { setStunServer(nativePtr,stunServer); } - public LinphoneCallParams createDefaultCallParameters() { + public synchronized LinphoneCallParams createDefaultCallParameters() { return new LinphoneCallParamsImpl(createDefaultCallParams(nativePtr)); } - public LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException { + public synchronized LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException { long ptrDestination = ((LinphoneAddressImpl)to).nativePtr; long ptrParams =((LinphoneCallParamsImpl)params).nativePtr; @@ -388,25 +388,25 @@ class LinphoneCoreImpl implements LinphoneCore { } } - public int updateCall(LinphoneCall call, LinphoneCallParams params) { + public synchronized int updateCall(LinphoneCall call, LinphoneCallParams params) { long ptrCall = ((LinphoneCallImpl) call).nativePtr; long ptrParams = params!=null ? ((LinphoneCallParamsImpl)params).nativePtr : 0; return updateCall(nativePtr, ptrCall, ptrParams); } - public void setUploadBandwidth(int bw) { + public synchronized void setUploadBandwidth(int bw) { setUploadBandwidth(nativePtr, bw); } - public void setDownloadBandwidth(int bw) { + public synchronized void setDownloadBandwidth(int bw) { setDownloadBandwidth(nativePtr, bw); } - public void setPreferredVideoSize(VideoSize vSize) { + public synchronized void setPreferredVideoSize(VideoSize vSize) { setPreferredVideoSize(nativePtr, vSize.width, vSize.height); } - public VideoSize getPreferredVideoSize() { + public synchronized VideoSize getPreferredVideoSize() { int[] nativeSize = getPreferredVideoSize(nativePtr); VideoSize vSize = new VideoSize(); @@ -414,18 +414,18 @@ class LinphoneCoreImpl implements LinphoneCore { vSize.height = nativeSize[1]; return vSize; } - public void setRing(String path) { + public synchronized void setRing(String path) { setRing(nativePtr, path); } - public String getRing() { + public synchronized String getRing() { return getRing(nativePtr); } - public void setRootCA(String path) { + public synchronized void setRootCA(String path) { setRootCA(nativePtr, path); } - public PayloadType[] getVideoCodecs() { + public synchronized PayloadType[] getVideoCodecs() { long[] typesPtr = listVideoPayloadTypes(nativePtr); if (typesPtr == null) return null; @@ -437,7 +437,7 @@ class LinphoneCoreImpl implements LinphoneCore { return codecs; } - public PayloadType[] getAudioCodecs() { + public synchronized PayloadType[] getAudioCodecs() { long[] typesPtr = listAudioPayloadTypes(nativePtr); if (typesPtr == null) return null; @@ -449,21 +449,21 @@ class LinphoneCoreImpl implements LinphoneCore { return codecs; } - public boolean isNetworkReachable() { + public synchronized boolean isNetworkReachable() { throw new RuntimeException("Not implemented"); } - public void enableKeepAlive(boolean enable) { + public synchronized void enableKeepAlive(boolean enable) { enableKeepAlive(nativePtr,enable); } - public boolean isKeepAliveEnabled() { + public synchronized boolean isKeepAliveEnabled() { return isKeepAliveEnabled(nativePtr); } - public void startEchoCalibration(Object data) throws LinphoneCoreException { + public synchronized void startEchoCalibration(Object data) throws LinphoneCoreException { startEchoCalibration(nativePtr, data); } - public Transports getSignalingTransportPorts() { + public synchronized Transports getSignalingTransportPorts() { Transports transports = new Transports(); transports.udp = getSignalingTransportPort(nativePtr, 0); transports.tcp = getSignalingTransportPort(nativePtr, 1); @@ -472,14 +472,14 @@ class LinphoneCoreImpl implements LinphoneCore { // Code is the index in the structure return transports; } - public void setSignalingTransportPorts(Transports transports) { + public synchronized void setSignalingTransportPorts(Transports transports) { setSignalingTransportPorts(nativePtr, transports.udp, transports.tcp, transports.tls); } - public void enableIpv6(boolean enable) { + public synchronized void enableIpv6(boolean enable) { enableIpv6(nativePtr,enable); } - public void adjustSoftwareVolume(int i) { + public synchronized void adjustSoftwareVolume(int i) { adjustSoftwareVolume(nativePtr, i); } @@ -492,15 +492,15 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean pauseAllCalls() { return 0 == pauseAllCalls(nativePtr); } - public void setDownloadPtime(int ptime) { + public synchronized void setDownloadPtime(int ptime) { setDownloadPtime(nativePtr,ptime); } - public void setUploadPtime(int ptime) { + public synchronized void setUploadPtime(int ptime) { setUploadPtime(nativePtr,ptime); } - public void setZrtpSecretsCache(String file) { + public synchronized void setZrtpSecretsCache(String file) { setZrtpSecretsCache(nativePtr,file); } } From 878f0238f7b4137653b40f4fe12d42261bd7cd5f Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 18 Aug 2011 09:36:31 +0200 Subject: [PATCH 135/769] Fix use of unsupported video capture frame rate. --- video/AndroidCameraRecord.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java index fe787f317..9d4dd29fe 100644 --- a/video/AndroidCameraRecord.java +++ b/video/AndroidCameraRecord.java @@ -55,7 +55,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { return Collections.emptyList(); } - private int[] findClosestFpsRange(int expectedFps, List fpsRanges) { + private int[] findClosestEnclosingFpsRange(int expectedFps, List fpsRanges) { Log.d("Searching for closest fps range from ",expectedFps); int measure = Integer.MAX_VALUE; int[] closestRange = fpsRanges.get(0); @@ -120,9 +120,20 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback { // Frame rate if (Version.sdkStrictlyBelow(Version.API09_GINGERBREAD_23)) { - parameters.setPreviewFrameRate(Math.round(params.fps)); + // Select the supported fps just faster than the target rate + List supportedFrameRates=parameters.getSupportedPreviewFrameRates(); + if (supportedFrameRates != null && supportedFrameRates.size() > 0) { + Collections.sort(supportedFrameRates); + int selectedRate = -1; + for (Integer rate : supportedFrameRates) { + selectedRate=rate; + if (rate >= params.fps) break; + } + parameters.setPreviewFrameRate(selectedRate); + } } else { - int[] range=findClosestFpsRange((int)(1000*params.fps), parameters.getSupportedPreviewFpsRange()); + List supportedRanges = parameters.getSupportedPreviewFpsRange(); + int[] range=findClosestEnclosingFpsRange((int)(1000*params.fps), supportedRanges); parameters.setPreviewFpsRange(range[0], range[1]); } From 954beb9c3df3a616960cce1a38004f4022cb28bb Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 5 Sep 2011 16:40:47 +0200 Subject: [PATCH 136/769] echo cancellation improvemnents: - use echo limiter always on !armv7 - enable echo cancellation by default - toggle speaker mode on during video calls --- LinphoneCoreImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 99a2e194a..23a8d3914 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -103,6 +103,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setUploadPtime(long nativePtr, int ptime); private native void setDownloadPtime(long nativePtr, int ptime); private native void setZrtpSecretsCache(long nativePtr, String file); + private native void enableEchoLimiter(long nativePtr2, boolean val); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -503,4 +504,8 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setZrtpSecretsCache(String file) { setZrtpSecretsCache(nativePtr,file); } + public void enableEchoLimiter(boolean val) { + enableEchoLimiter(nativePtr,val); + } + } From b923fd19d6847b1617c359fb2cb354af04cfef7a Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 13 Sep 2011 11:21:31 +0200 Subject: [PATCH 137/769] android: fix video rendering bug when changing resolution during call --- AndroidVideoWindowImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java index 2fd27b424..4fc213f5f 100644 --- a/AndroidVideoWindowImpl.java +++ b/AndroidVideoWindowImpl.java @@ -120,15 +120,20 @@ public class AndroidVideoWindowImpl { private static class Renderer implements GLSurfaceView.Renderer { int ptr; boolean initPending; - int width, height; + int width=-1, height=-1; public Renderer() { - ptr = 0; + ptr = 0; initPending = false; } public void setOpenGLESDisplay(int ptr) { this.ptr = ptr; + // if dimension are set, we are recreating MS2 graph without + // recreating the surface => need to force init + if (width > 0 && height > 0) { + initPending = true; + } } public void onDrawFrame(GL10 gl) { From b0357a9dddad99ffd6ce5cedf1944133e06fa539 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 14 Sep 2011 17:41:17 +0200 Subject: [PATCH 138/769] New Mediastreamer Android Camera filter integration android: new mediastreamer integration android: new ms2 integration Video calls minor corrections --- AndroidVideoWindowImpl.java | 162 ------------ Hacks.java | 146 ----------- LinphoneCallImpl.java | 9 +- LinphoneCoreImpl.java | 49 ++-- Version.java | 2 + tutorials/JavaCameraRecordImpl.java | 87 ------- tutorials/TestVideoActivity.java | 194 -------------- video/AndroidCameraConf.java | 66 ----- video/AndroidCameraConf5.java | 113 -------- video/AndroidCameraConf9.java | 81 ------ video/AndroidCameraRecord.java | 279 -------------------- video/AndroidCameraRecord5.java | 139 ---------- video/AndroidCameraRecord8.java | 82 ------ video/AndroidCameraRecord9.java | 50 ---- video/AndroidCameraRecordManager.java | 362 -------------------------- 15 files changed, 31 insertions(+), 1790 deletions(-) delete mode 100644 AndroidVideoWindowImpl.java delete mode 100644 Hacks.java delete mode 100644 tutorials/JavaCameraRecordImpl.java delete mode 100644 tutorials/TestVideoActivity.java delete mode 100644 video/AndroidCameraConf.java delete mode 100644 video/AndroidCameraConf5.java delete mode 100644 video/AndroidCameraConf9.java delete mode 100644 video/AndroidCameraRecord.java delete mode 100644 video/AndroidCameraRecord5.java delete mode 100644 video/AndroidCameraRecord8.java delete mode 100644 video/AndroidCameraRecord9.java delete mode 100644 video/AndroidCameraRecordManager.java diff --git a/AndroidVideoWindowImpl.java b/AndroidVideoWindowImpl.java deleted file mode 100644 index 4fc213f5f..000000000 --- a/AndroidVideoWindowImpl.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.linphone.core; - -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; - -import org.linphone.OpenGLESDisplay; - -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Bitmap.Config; -import android.opengl.GLSurfaceView; -import android.view.Surface; -import android.view.SurfaceHolder; -import android.view.SurfaceView; -import android.view.Surface.OutOfResourcesException; -import android.view.SurfaceHolder.Callback; - -public class AndroidVideoWindowImpl { - private boolean useGLrendering; - private Bitmap mBitmap; - private SurfaceView mView; - private Surface mSurface; - private VideoWindowListener mListener; - private Renderer renderer; - public static interface VideoWindowListener{ - void onSurfaceReady(AndroidVideoWindowImpl vw); - void onSurfaceDestroyed(AndroidVideoWindowImpl vw); - }; - public AndroidVideoWindowImpl(SurfaceView view){ - useGLrendering = (view instanceof GLSurfaceView); - mView=view; - mBitmap=null; - mSurface=null; - mListener=null; - view.getHolder().addCallback(new Callback(){ - public void surfaceChanged(SurfaceHolder holder, int format, - int width, int height) { - Log.i("Surface is being changed."); - if (!useGLrendering) { - synchronized(AndroidVideoWindowImpl.this){ - mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565); - mSurface=holder.getSurface(); - } - } - if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); - Log.w("Video display surface changed"); - } - - public void surfaceCreated(SurfaceHolder holder) { - Log.w("Video display surface created"); - } - - public void surfaceDestroyed(SurfaceHolder holder) { - if (!useGLrendering) { - synchronized(AndroidVideoWindowImpl.this){ - mSurface=null; - mBitmap=null; - } - } - if (mListener!=null) - mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); - Log.d("Video display surface destroyed"); - } - }); - - if (useGLrendering) { - renderer = new Renderer(); - ((GLSurfaceView)mView).setRenderer(renderer); - ((GLSurfaceView)mView).setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); - } - } - static final int LANDSCAPE=0; - static final int PORTRAIT=1; - public void requestOrientation(int orientation){ - //Surface.setOrientation(0, orientation==LANDSCAPE ? 1 : 0); - //Log.d("Orientation changed."); - } - public void setListener(VideoWindowListener l){ - mListener=l; - } - public Surface getSurface(){ - if (useGLrendering) - Log.e("View class does not match Video display filter used (you must use a non-GL View)"); - return mView.getHolder().getSurface(); - } - public Bitmap getBitmap(){ - if (useGLrendering) - Log.e("View class does not match Video display filter used (you must use a non-GL View)"); - return mBitmap; - } - - public void setOpenGLESDisplay(int ptr) { - if (!useGLrendering) - Log.e("View class does not match Video display filter used (you must use a GL View)"); - renderer.setOpenGLESDisplay(ptr); - } - - public void requestRender() { - ((GLSurfaceView)mView).requestRender(); - } - - //Called by the mediastreamer2 android display filter - public synchronized void update(){ - if (mSurface!=null){ - try { - Canvas canvas=mSurface.lockCanvas(null); - canvas.drawBitmap(mBitmap, 0, 0, null); - mSurface.unlockCanvasAndPost(canvas); - - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (OutOfResourcesException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - private static class Renderer implements GLSurfaceView.Renderer { - int ptr; - boolean initPending; - int width=-1, height=-1; - - public Renderer() { - ptr = 0; - initPending = false; - } - - public void setOpenGLESDisplay(int ptr) { - this.ptr = ptr; - // if dimension are set, we are recreating MS2 graph without - // recreating the surface => need to force init - if (width > 0 && height > 0) { - initPending = true; - } - } - - public void onDrawFrame(GL10 gl) { - if (ptr == 0) - return; - if (initPending) { - OpenGLESDisplay.init(ptr, width, height); - initPending = false; - } - OpenGLESDisplay.render(ptr); - } - - public void onSurfaceChanged(GL10 gl, int width, int height) { - /* delay init until ptr is set */ - this.width = width; - this.height = height; - initPending = true; - } - - public void onSurfaceCreated(GL10 gl, EGLConfig config) { - - } - } -} - - diff --git a/Hacks.java b/Hacks.java deleted file mode 100644 index ceca9ee80..000000000 --- a/Hacks.java +++ /dev/null @@ -1,146 +0,0 @@ -/* -Hacks.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -package org.linphone.core; - -import android.hardware.Camera; -import android.media.AudioManager; -import android.os.Build; - -public final class Hacks { - - private Hacks() {} - - - public static boolean isGalaxySOrTabWithFrontCamera() { - return isGalaxySOrTab() && !isGalaxySOrTabWithoutFrontCamera(); - } - private static boolean isGalaxySOrTabWithoutFrontCamera() { - return isSC02B() || isSGHI896(); - } - - - public static boolean isGalaxySOrTab() { - return isGalaxyS() || isGalaxyTab(); - } - - public static boolean isGalaxyTab() { - return isGTP1000(); - } - private static boolean isGalaxyS() { - return isGT9000() || isSC02B() || isSGHI896() || isSPHD700(); - } - - public static final boolean hasTwoCamerasRear0Front1() { - return isSPHD700() || isADR6400(); - } - - // HTC - private static final boolean isADR6400() { - return Build.MODEL.startsWith("ADR6400") || Build.DEVICE.startsWith("ADR6400"); - } // HTC Thunderbolt - - // Galaxy S variants - private static final boolean isSPHD700() {return Build.DEVICE.startsWith("SPH-D700");} // Epic - private static boolean isSGHI896() {return Build.DEVICE.startsWith("SGH-I896");} // Captivate - private static boolean isGT9000() {return Build.DEVICE.startsWith("GT-I9000");} // Galaxy S - private static boolean isSC02B() {return Build.DEVICE.startsWith("SC-02B");} // Docomo - private static boolean isGTP1000() {return Build.DEVICE.startsWith("GT-P1000");} // Tab - - -/* private static final boolean log(final String msg) { - Log.d(msg); - return true; - }*/ - - /* Not working as now - * Calling from Galaxy S to PC is "usable" even with no hack; other side is not even with this one*/ - public static void galaxySSwitchToCallStreamUnMuteLowerVolume(AudioManager am) { - // Switch to call audio channel (Galaxy S) - am.setSpeakerphoneOn(false); - sleep(200); - - // Lower volume - am.setStreamVolume(AudioManager.STREAM_VOICE_CALL, 1, 0); - - // Another way to select call channel - am.setMode(AudioManager.MODE_NORMAL); - sleep(200); - - // Mic is muted if not doing this - am.setMicrophoneMute(true); - sleep(200); - am.setMicrophoneMute(false); - sleep(200); - } - - public static final void sleep(int time) { - try { - Thread.sleep(time); - } catch(InterruptedException ie){} - } - - public static void dumpDeviceInformation() { - StringBuilder sb = new StringBuilder(" ==== Phone information dump ====\n"); - sb.append("DEVICE=").append(Build.DEVICE).append("\n"); - sb.append("MODEL=").append(Build.MODEL).append("\n"); - //MANUFACTURER doesn't exist in android 1.5. - //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); - sb.append("SDK=").append(Build.VERSION.SDK); - - Log.i(sb.toString()); - } - - public static boolean needSoftvolume() { - return isGalaxySOrTab(); - } - - public static boolean needRoutingAPI() { - return Version.sdkStrictlyBelow(5) /* 0; - } - - Log.i("Hack: considering there IS a camera.\n" - + "If it is not the case, report DEVICE and MODEL to linphone-users@nongnu.org"); - return true; - } - -} diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 55d3baedf..b027e2170 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -20,7 +20,7 @@ package org.linphone.core; class LinphoneCallImpl implements LinphoneCall { - + protected final long nativePtr; boolean ownPtr = false; native private void ref(long ownPtr); @@ -31,6 +31,7 @@ class LinphoneCallImpl implements LinphoneCall { native private int getState(long nativePtr); private native long getCurrentParamsCopy(long nativePtr); private native void enableCamera(long nativePtr, boolean enabled); + private native boolean cameraEnabled(long nativePtr); private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr) ; private native void enableEchoLimiter(long nativePtr,boolean enable); @@ -48,7 +49,7 @@ class LinphoneCallImpl implements LinphoneCall { ref(nativePtr); } protected void finalize() throws Throwable { - unref(nativePtr); + unref(nativePtr); } public LinphoneCallLog getCallLog() { long lNativePtr = getCallLog(nativePtr); @@ -79,6 +80,10 @@ class LinphoneCallImpl implements LinphoneCall { public void enableCamera(boolean enabled) { enableCamera(nativePtr, enabled); } + @Override + public boolean cameraEnabled() { + return cameraEnabled(nativePtr); + } public boolean equals(Object call) { return nativePtr == ((LinphoneCallImpl)call).nativePtr; } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 23a8d3914..d4b54b663 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -22,7 +22,8 @@ import java.io.File; import java.io.IOException; import java.util.Vector; -import android.view.SurfaceView; +import org.linphone.LinphoneManager; +import org.linphone.mediastream.video.AndroidVideoWindowImpl; class LinphoneCoreImpl implements LinphoneCore { @@ -68,8 +69,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void stopDtmf(long nativePtr); private native void setVideoWindowId(long nativePtr, Object wid); private native void setPreviewWindowId(long nativePtr, Object wid); - private AndroidVideoWindowImpl mVideoWindow; - private AndroidVideoWindowImpl mPreviewWindow; + private native void setDeviceRotation(long nativePtr, int rotation); private native void addFriend(long nativePtr,long friend); private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status); private native long createChatRoom(long nativePtr,String to); @@ -104,6 +104,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setDownloadPtime(long nativePtr, int ptime); private native void setZrtpSecretsCache(long nativePtr, String file); private native void enableEchoLimiter(long nativePtr2, boolean val); + private native int setVideoDevice(long nativePtr2, int id); + private native int getVideoDevice(long nativePtr2); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -327,33 +329,15 @@ class LinphoneCoreImpl implements LinphoneCore { return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to)); } public synchronized void setPreviewWindow(Object w) { - if (mPreviewWindow!=null) - mPreviewWindow.setListener(null); - mPreviewWindow=new AndroidVideoWindowImpl((SurfaceView)w); - mPreviewWindow.setListener(new AndroidVideoWindowImpl.VideoWindowListener(){ - public void onSurfaceDestroyed(AndroidVideoWindowImpl vw) { - setPreviewWindowId(nativePtr,null); - } - - public void onSurfaceReady(AndroidVideoWindowImpl vw) { - setPreviewWindowId(nativePtr,vw); - } - }); + setPreviewWindowId(nativePtr,w); } public synchronized void setVideoWindow(Object w) { - if (mVideoWindow!=null) - mVideoWindow.setListener(null); - mVideoWindow=new AndroidVideoWindowImpl((SurfaceView) w); - mVideoWindow.setListener(new AndroidVideoWindowImpl.VideoWindowListener(){ - public void onSurfaceDestroyed(AndroidVideoWindowImpl vw) { - setVideoWindowId(nativePtr,null); - } - - public void onSurfaceReady(AndroidVideoWindowImpl vw) { - setVideoWindowId(nativePtr,vw); - } - }); + setVideoWindowId(nativePtr, w); } + public synchronized void setDeviceRotation(int rotation) { + setDeviceRotation(nativePtr, rotation); + } + public synchronized void enableVideo(boolean vcap_enabled, boolean display_enabled) { enableVideo(nativePtr,vcap_enabled, display_enabled); } @@ -507,5 +491,16 @@ class LinphoneCoreImpl implements LinphoneCore { public void enableEchoLimiter(boolean val) { enableEchoLimiter(nativePtr,val); } + @Override + public void setVideoDevice(int id) { + Log.i("Setting camera id :", id); + if (setVideoDevice(nativePtr, id) != 0) { + Log.e("Failed to set video device to id:", id); + } + } + @Override + public int getVideoDevice() { + return getVideoDevice(nativePtr); + } } diff --git a/Version.java b/Version.java index 53ae2e05f..edbb25e8e 100644 --- a/Version.java +++ b/Version.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import org.linphone.mediastream.video.capture.hwconf.Hacks; + import android.os.Build; /** diff --git a/tutorials/JavaCameraRecordImpl.java b/tutorials/JavaCameraRecordImpl.java deleted file mode 100644 index 4772c7a5b..000000000 --- a/tutorials/JavaCameraRecordImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -/* -JavaCameraRecordImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.tutorials; - -import org.linphone.core.Log; -import org.linphone.core.video.AndroidCameraRecord; - -import android.hardware.Camera; -import android.hardware.Camera.PreviewCallback; -import android.hardware.Camera.Size; -import android.widget.TextView; - -/** - * This is an helper class, not a test activity. - * - * @author Guillaume Beraudo - * - */ -class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback { - - private TextView debug; - private long count = 0; - private float averageCalledRate; - - private long startTime; - private long endTime; - private int fps; - - - public JavaCameraRecordImpl(AndroidCameraRecord.RecorderParams parameters) { - super(parameters); - storePreviewCallBack(this); - fps = Math.round(parameters.fps); - } - - - public void setDebug(TextView debug) { - this.debug = debug; - } - - public void onPreviewFrame(byte[] data, Camera camera) { - - Size s = camera.getParameters().getPreviewSize(); - int expectedBuffLength = s.width * s.height * 3 /2; - if (expectedBuffLength != data.length) { - Log.e("onPreviewFrame called with bad buffer length ", data.length, - " whereas expected is ", expectedBuffLength, " don't calling putImage"); - return; - } - - if ((count % 2 * fps) == 0) { - endTime = System.currentTimeMillis(); - averageCalledRate = (100000 * 2 * fps) / (endTime - startTime); - averageCalledRate /= 100f; - startTime = endTime; - } - - count++; - - String msg = "Frame " + count + ": " + data.length + "bytes (avg="+averageCalledRate+"frames/s)"; - if (debug != null) debug.setText(msg); - Log.d("onPreviewFrame:", msg); - } - - - @Override - protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { - camera.setPreviewCallback(cb); - } - -} diff --git a/tutorials/TestVideoActivity.java b/tutorials/TestVideoActivity.java deleted file mode 100644 index 7523cb0ff..000000000 --- a/tutorials/TestVideoActivity.java +++ /dev/null @@ -1,194 +0,0 @@ -/* -TutorialHelloWorldActivity.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -package org.linphone.core.tutorials; - -import static org.linphone.core.VideoSize.CIF; -import static org.linphone.core.VideoSize.HVGA; -import static org.linphone.core.VideoSize.QCIF; -import static org.linphone.core.VideoSize.QVGA; - -import java.util.Stack; - -import org.linphone.R; -import org.linphone.core.Log; -import org.linphone.core.VideoSize; -import org.linphone.core.video.AndroidCameraRecord; - -import android.app.Activity; -import android.os.Bundle; -import android.view.SurfaceHolder; -import android.view.SurfaceView; -import android.view.View; -import android.view.SurfaceHolder.Callback; -import android.view.View.OnClickListener; -import android.view.ViewGroup.LayoutParams; -import android.widget.Button; -import android.widget.TextView; - -/** - * Activity for displaying and starting the HelloWorld example on Android phone. - * - * @author Guillaume Beraudo - * - */ -public class TestVideoActivity extends Activity implements Callback, OnClickListener { - - private SurfaceView surfaceView; - private static final int rate = 7; - private JavaCameraRecordImpl recorder; - private TextView debugView; - private Button nextSize; - private Button changeCamera; - private Button changeOrientation; - private AndroidCameraRecord.RecorderParams params; - - private Stack videoSizes = createSizesToTest(); - private int currentCameraId = 2; - private boolean currentOrientationIsPortrait = false; - private int width; - private int height; - private boolean started; - - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.videotest); - - surfaceView=(SurfaceView)findViewById(R.id.videotest_surfaceView); - - nextSize = (Button) findViewById(R.id.test_video_size); - nextSize.setOnClickListener(this); - - changeCamera = (Button) findViewById(R.id.test_video_camera); - changeCamera.setText("Cam"+otherCameraId(currentCameraId)); - changeCamera.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - changeCamera.setText("Cam"+currentCameraId); - currentCameraId = otherCameraId(currentCameraId); - updateRecording(); - } - }); - - changeOrientation = (Button) findViewById(R.id.test_video_orientation); - changeOrientation.setText(orientationToString(!currentOrientationIsPortrait)); - changeOrientation.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - currentOrientationIsPortrait = !currentOrientationIsPortrait; - changeOrientation.setText(orientationToString(!currentOrientationIsPortrait)); - - if (width == 0 || height == 0) return; - int newWidth = currentOrientationIsPortrait? Math.min(height, width) : Math.max(height, width); - int newHeight = currentOrientationIsPortrait? Math.max(height, width) : Math.min(height, width); - changeSurfaceViewLayout(newWidth, newHeight); // will change width and height on surfaceChanged - } - }); - - SurfaceHolder holder = surfaceView.getHolder(); - holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - holder.addCallback(this); - - - debugView = (TextView) findViewById(R.id.videotest_debug); - } - - protected void updateRecording() { - if (width == 0 || height == 0) return; - if (recorder != null) recorder.stopPreview(); - - params = new AndroidCameraRecord.RecorderParams(0); - params.surfaceView = surfaceView; - params.width = width; - params.height = height; - params.fps = rate; - params.cameraId = currentCameraId; - - recorder = new JavaCameraRecordImpl(params); -// recorder.setDebug(debugView); - debugView.setText(orientationToString(currentOrientationIsPortrait) - + " w="+width + " h="+height+ " cam"+currentCameraId); - recorder.startPreview(); - - } - - private String orientationToString(boolean orientationIsPortrait) { - return orientationIsPortrait? "Por" : "Lan"; - } - private int otherCameraId(int currentId) { - return (currentId == 2) ? 1 : 2; - } - public void onClick(View v) { - nextSize.setText("Next"); - started=true; - if (videoSizes.isEmpty()) { - videoSizes = createSizesToTest(); - } - - VideoSize size = videoSizes.pop(); - changeSurfaceViewLayout(size.width, size.height); - - // on surface changed the recorder will be restarted with new values - // and the surface will be resized - } - - - private void changeSurfaceViewLayout(int width, int height) { - LayoutParams params = surfaceView.getLayoutParams(); - params.height = height; - params.width = width; - surfaceView.setLayoutParams(params); - - } - - private Stack createSizesToTest() { - Stack stack = new Stack(); - - stack.push(VideoSize.createStandard(QCIF, false)); - stack.push(VideoSize.createStandard(CIF, false)); - stack.push(VideoSize.createStandard(QVGA, false)); - stack.push(VideoSize.createStandard(HVGA, false)); - stack.push(new VideoSize(640,480)); - stack.push(new VideoSize(800,480)); - return stack; - } - - - - - public void surfaceDestroyed(SurfaceHolder holder) { - surfaceView = null; - Log.d("Video capture surface destroyed"); - if (recorder != null) recorder.stopPreview(); - } - - public void surfaceCreated(SurfaceHolder holder) { - Log.d("Video capture surface created"); - } - - public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - if (!started) return; - if (recorder != null) recorder.stopPreview(); - - this.width = width; - this.height = height; - - updateRecording(); - } -} diff --git a/video/AndroidCameraConf.java b/video/AndroidCameraConf.java deleted file mode 100644 index 874a6d2da..000000000 --- a/video/AndroidCameraConf.java +++ /dev/null @@ -1,66 +0,0 @@ -/* -AndroidCameraConf.java -Copyright (C) 2011 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -package org.linphone.core.video; - -import java.util.List; - -import org.linphone.core.VideoSize; - - -/** - * @author Guillaume Beraudo - * - */ -interface AndroidCameraConf { - - AndroidCameras getFoundCameras(); - - int getNumberOfCameras(); - - int getCameraOrientation(int cameraId); - - boolean isFrontCamera(int cameraId); - - List getSupportedPreviewSizes(int cameraId); - - /** - * Default: no front; rear=0; default=rear - * @author Guillaume Beraudo - * - */ - class AndroidCameras { - Integer front; - Integer rear = 0; - Integer defaultC = rear; - - boolean hasFrontCamera() { return front != null; } - boolean hasRearCamera() { return rear != null; } - boolean hasSeveralCameras() { return front != rear && front != null; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("Cameras :"); - if (rear != null) sb.append(" rear=").append(rear); - if (front != null) sb.append(" front=").append(front); - if (defaultC != null) sb.append(" default=").append(defaultC); - return sb.toString(); - } - } -} \ No newline at end of file diff --git a/video/AndroidCameraConf5.java b/video/AndroidCameraConf5.java deleted file mode 100644 index 06c266d7a..000000000 --- a/video/AndroidCameraConf5.java +++ /dev/null @@ -1,113 +0,0 @@ -/* -AndroidCameraConf.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.video; - -import java.util.List; - -import org.linphone.core.Hacks; -import org.linphone.core.Log; -import org.linphone.core.VideoSize; - -import android.hardware.Camera; - - -class AndroidCameraConf5 implements AndroidCameraConf { - private AndroidCameras foundCameras; - public AndroidCameras getFoundCameras() {return foundCameras;} - - public AndroidCameraConf5() { - // Defaults - foundCameras = new AndroidCameras(); - - if (Hacks.isGalaxySOrTab()) { - Log.d("Hack Galaxy S : has one or more cameras"); - if (Hacks.isGalaxySOrTabWithFrontCamera()) { - Log.d("Hack Galaxy S : HAS a front camera with id=2"); - foundCameras.front = 2; - } else { - Log.d("Hack Galaxy S : NO front camera"); - } - Log.d("Hack Galaxy S : HAS a rear camera with id=1"); - foundCameras.rear = 1; - foundCameras.defaultC = foundCameras.rear; - } else if (Hacks.hasTwoCamerasRear0Front1()) { - Log.d("Hack SPHD700 has 2 cameras a rear with id=0 and a front with id=1"); - foundCameras.front = 1; - } - - } - - public int getNumberOfCameras() { - Log.i("Detecting the number of cameras"); - if (Hacks.hasTwoCamerasRear0Front1() || Hacks.isGalaxySOrTabWithFrontCamera()) { - Log.d("Hack: we know this model has 2 cameras"); - return 2; - } else - return 1; - } - - - - public int getCameraOrientation(int cameraId) { - // Use hacks to guess orientation of the camera - if (Hacks.isGalaxySOrTab() && isFrontCamera(cameraId)) { - Log.d("Hack Galaxy S : front camera mounted landscape"); - // mounted in landscape for a portrait phone orientation - // |^^^^^^^^| - // | ____ | - // | |____| | - // | | - // | | - // | Phone | - // |________| - return 180; - } - return 90; - } - - - - public boolean isFrontCamera(int cameraId) { - // Use hacks to guess facing of the camera - if (cameraId == 2 && Hacks.isGalaxySOrTab()) { - Log.d("Hack Galaxy S : front camera has id=2"); - return true; - } else if (cameraId == 1 && Hacks.hasTwoCamerasRear0Front1()) { - Log.d("Hack SPHD700 : front camera has id=1"); - return true; - } - - return false; - } - - public List getSupportedPreviewSizes(int cameraId) { - if (getNumberOfCameras() >1) { - Log.w("Hack: on older devices, using video formats supported by default camera"); - } - Log.i("Opening camera to retrieve supported video sizes"); - Camera c = Camera.open(); - List sizes=VideoUtil.createList(c.getParameters().getSupportedPreviewSizes()); - c.release(); - Log.i("Camera opened to retrieve supported video sizes released"); - return sizes; - } - - - -} diff --git a/video/AndroidCameraConf9.java b/video/AndroidCameraConf9.java deleted file mode 100644 index 02e909895..000000000 --- a/video/AndroidCameraConf9.java +++ /dev/null @@ -1,81 +0,0 @@ -/* -AndroidCameraConf9.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.video; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.linphone.core.Log; -import org.linphone.core.VideoSize; - -import android.hardware.Camera; - -class AndroidCameraConf9 implements AndroidCameraConf { - private AndroidCameras foundCameras; - private Map> supportedSizes = new HashMap>(); - public AndroidCameras getFoundCameras() {return foundCameras;} - - public AndroidCameraConf9() { - foundCameras = new AndroidCameras(); - - for (int id=0; id < getNumberOfCameras(); id++) { - if (foundCameras.defaultC == null) - foundCameras.defaultC = id; - - if (isFrontCamera(id)) { - foundCameras.front = id; - } else { - foundCameras.rear = id; - } - supportedSizes.put(id, findSupportedVideoSizes(id)); - } - } - - private List findSupportedVideoSizes(int id) { - Log.i("Opening camera ",id," to retrieve supported video sizes"); - Camera c = Camera.open(id); - List sizes=VideoUtil.createList(c.getParameters().getSupportedPreviewSizes()); - c.release(); - Log.i("Camera ",id," opened to retrieve supported video sizes released"); - return sizes; - } - - public int getNumberOfCameras() { - return Camera.getNumberOfCameras(); - } - - public int getCameraOrientation(int cameraId) { - android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); - Camera.getCameraInfo(cameraId, info); - Log.d("Camera info for ",cameraId,": orientation=",info.orientation); - return info.orientation; - } - - public boolean isFrontCamera(int cameraId) { - android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); - Camera.getCameraInfo(cameraId, info); - return info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? true : false; - } - - public List getSupportedPreviewSizes(int cameraId) { - return supportedSizes.get(cameraId); - } - -} diff --git a/video/AndroidCameraRecord.java b/video/AndroidCameraRecord.java deleted file mode 100644 index 9d4dd29fe..000000000 --- a/video/AndroidCameraRecord.java +++ /dev/null @@ -1,279 +0,0 @@ -/* -AndroidCameraRecordImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -package org.linphone.core.video; - -import java.util.Collections; -import java.util.List; - -import org.linphone.core.Log; -import org.linphone.core.Version; -import org.linphone.core.VideoSize; - -import android.hardware.Camera; -import android.hardware.Camera.AutoFocusCallback; -import android.hardware.Camera.ErrorCallback; -import android.hardware.Camera.Parameters; -import android.hardware.Camera.PreviewCallback; -import android.hardware.Camera.Size; -import android.view.SurfaceHolder; -import android.view.SurfaceView; -import android.view.View; -import android.view.View.OnClickListener; - - -public abstract class AndroidCameraRecord implements AutoFocusCallback { - - protected Camera camera; - private RecorderParams params; - - private PreviewCallback storedPreviewCallback; - private boolean previewStarted; - private List supportedVideoSizes; - private Size currentPreviewSize; - - public AndroidCameraRecord(RecorderParams parameters) { - this.params = parameters; - } - - protected List getSupportedPreviewSizes(Camera.Parameters parameters) { - return Collections.emptyList(); - } - - private int[] findClosestEnclosingFpsRange(int expectedFps, List fpsRanges) { - Log.d("Searching for closest fps range from ",expectedFps); - int measure = Integer.MAX_VALUE; - int[] closestRange = fpsRanges.get(0); - for (int[] curRange : fpsRanges) { - if (curRange[0] > expectedFps || curRange[1] < expectedFps) continue; - int curMeasure = Math.abs(curRange[0] - expectedFps) - + Math.abs(curRange[1] - expectedFps); - if (curMeasure < measure) { - closestRange=curRange; - Log.d("a better range has been found: w=",closestRange[0],",h=",closestRange[1]); - } - } - Log.d("The closest fps range is w=",closestRange[0],",h=",closestRange[1]); - return closestRange; - } - - public synchronized void startPreview() { // FIXME throws exception? - if (previewStarted) { - Log.w("Already started"); - throw new RuntimeException("Video recorder already started"); - // return - } - - if (params.surfaceView.getVisibility() != SurfaceView.VISIBLE) { - // Illegal state - Log.e("Illegal state: video capture surface view is not visible"); - return; - } - - - Log.d("Trying to open camera with id ", params.cameraId); - if (camera != null) { - Log.e("Camera is not null, ?already open? : aborting"); - return; - } - camera = openCamera(params.cameraId); - camera.setErrorCallback(new ErrorCallback() { - public void onError(int error, Camera camera) { - Log.e("Camera error : ", error); - } - }); - - - Camera.Parameters parameters=camera.getParameters(); - if (Version.sdkStrictlyBelow(Version.API09_GINGERBREAD_23)) { - parameters.set("camera-id",params.cameraId); - } - - if (supportedVideoSizes == null) { - supportedVideoSizes = VideoUtil.createList(getSupportedPreviewSizes(parameters)); - } - - - if (params.width >= params.height) { - parameters.setPreviewSize(params.width, params.height); - } else { - // invert height and width - parameters.setPreviewSize(params.height, params.width); - } - // should setParameters and get again to have the real one?? - currentPreviewSize = parameters.getPreviewSize(); - - // Frame rate - if (Version.sdkStrictlyBelow(Version.API09_GINGERBREAD_23)) { - // Select the supported fps just faster than the target rate - List supportedFrameRates=parameters.getSupportedPreviewFrameRates(); - if (supportedFrameRates != null && supportedFrameRates.size() > 0) { - Collections.sort(supportedFrameRates); - int selectedRate = -1; - for (Integer rate : supportedFrameRates) { - selectedRate=rate; - if (rate >= params.fps) break; - } - parameters.setPreviewFrameRate(selectedRate); - } - } else { - List supportedRanges = parameters.getSupportedPreviewFpsRange(); - int[] range=findClosestEnclosingFpsRange((int)(1000*params.fps), supportedRanges); - parameters.setPreviewFpsRange(range[0], range[1]); - } - - - onSettingCameraParameters(parameters); - camera.setParameters(parameters); - - SurfaceHolder holder = params.surfaceView.getHolder(); - try { - camera.setPreviewDisplay(holder); - } - catch (Throwable t) { - Log.e(t,"Exception in Video capture setPreviewDisplay()"); - } - - - try { - camera.startPreview(); - } catch (Throwable e) { - Log.e("Error, can't start camera preview. Releasing camera!"); - camera.release(); - camera = null; - return; - } - - previewStarted = true; - - // Activate autofocus - if (Camera.Parameters.FOCUS_MODE_AUTO.equals(parameters.getFocusMode())) { - OnClickListener svClickListener = new OnClickListener() { - public void onClick(View v) { - Log.i("Auto focus requested"); - camera.autoFocus(AndroidCameraRecord.this); - } - }; - params.surfaceView.setOnClickListener(svClickListener); - // svClickListener.onClick(null); - } else { - params.surfaceView.setOnClickListener(null); - } - - // Register callback to get capture buffer - lowLevelSetPreviewCallback(camera, storedPreviewCallback); - - - onPreviewStarted(camera); - } - - - - - protected Camera openCamera(int cameraId) { - return Camera.open(); - } - - protected void onSettingCameraParameters(Parameters parameters) {} - - /** - * Hook. - * @param camera - */ - public void onPreviewStarted(Camera camera) {} - - public void storePreviewCallBack(PreviewCallback cb) { - this.storedPreviewCallback = cb; - if (camera == null) { - Log.w("Capture camera not ready, storing preview callback"); - return; - } - - lowLevelSetPreviewCallback(camera, cb); - } - - - public void stopPreview() { - if (!previewStarted) return; - lowLevelSetPreviewCallback(camera, null); - camera.stopPreview(); - camera.release(); - camera=null; - Log.d("Camera released"); - currentPreviewSize = null; - previewStarted = false; - } - - - public void stopCaptureCallback() { - if (camera != null) { - lowLevelSetPreviewCallback(camera, null); - } - } - - protected abstract void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb); - - - - public static class RecorderParams { - public static enum MirrorType {NO, HORIZONTAL, CENTRAL, VERTICAL}; - - public float fps; - public int height; - public int width; - - final long filterDataNativePtr; - public int cameraId; - public boolean isFrontCamera; - public int rotation; - public SurfaceView surfaceView; - - public MirrorType mirror = MirrorType.NO; - public int phoneOrientation; - - public RecorderParams(long ptr) { - filterDataNativePtr = ptr; - } - } - - - - public boolean isStarted() { - return previewStarted; - } - - public List getSupportedVideoSizes() { - return supportedVideoSizes; - } - - - protected int getExpectedBufferLength() { - if (currentPreviewSize == null) return -1; - - return currentPreviewSize.width * currentPreviewSize.height * 3 /2; - } - - public void onAutoFocus(boolean success, Camera camera) { - if (success) Log.i("Autofocus success"); - else Log.i("Autofocus failure"); - } - - public int getStoredPhoneOrientation() { - return params.phoneOrientation; - } -} diff --git a/video/AndroidCameraRecord5.java b/video/AndroidCameraRecord5.java deleted file mode 100644 index 45f94cd29..000000000 --- a/video/AndroidCameraRecord5.java +++ /dev/null @@ -1,139 +0,0 @@ -/* -AndroidCameraRecordImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -package org.linphone.core.video; - -import java.util.Arrays; -import java.util.List; - -import org.linphone.core.Log; -import org.linphone.core.video.AndroidCameraRecord.RecorderParams.MirrorType; - -import android.hardware.Camera; -import android.hardware.Camera.Parameters; -import android.hardware.Camera.PreviewCallback; -import android.hardware.Camera.Size; - -/** - * Record from Android camera. - * Android >= 5 (2.0) version. - * - * @author Guillaume Beraudo - * - */ -class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallback { - - private long filterCtxPtr; - private double timeElapsedBetweenFrames = 0; - private long lastFrameTime = 0; - private final double expectedTimeBetweenFrames; - protected final int rotation; - private MirrorType mirror; -// private boolean isUsingFrontCamera; - - public AndroidCameraRecord5(RecorderParams parameters) { - super(parameters); - expectedTimeBetweenFrames = 1d / Math.round(parameters.fps); - filterCtxPtr = parameters.filterDataNativePtr; - rotation = parameters.rotation; - mirror = parameters.mirror; -// isUsingFrontCamera = parameters.isFrontCamera; - - storePreviewCallBack(this); - } - - - private native void putImage(long filterCtxPtr, byte[] buffer, int rotate, int mirror); - - - public void onPreviewFrame(byte[] data, Camera camera) { - if (data == null) { - Log.e("onPreviewFrame Called with null buffer"); - return; - } - if (filterCtxPtr == 0l) { - Log.e("onPreviewFrame Called with no filterCtxPtr set"); - return; - } - - int expectedBuffLength = getExpectedBufferLength(); - if (expectedBuffLength != data.length) { - Log.e("onPreviewFrame called with bad buffer length ", data.length, - " whereas expected is ", expectedBuffLength, " don't calling putImage"); - return; - } - - long curTime = System.currentTimeMillis(); - if (lastFrameTime == 0) { - lastFrameTime = curTime; - putImage(filterCtxPtr, data, rotation, mirror.ordinal()); - return; - } - - double currentTimeElapsed = 0.8 * (curTime - lastFrameTime) / 1000 + 0.2 * timeElapsedBetweenFrames; - if (currentTimeElapsed < expectedTimeBetweenFrames) { -// Log.d("Clipping frame ", Math.round(1 / currentTimeElapsed), " > ", fps); - return; - } - lastFrameTime = curTime; - timeElapsedBetweenFrames = currentTimeElapsed; - - // Log.d("onPreviewFrame: ", Integer.toString(data.length)); - putImage(filterCtxPtr, data, rotation, mirror.ordinal()); - } - - protected String selectFocusMode(final List supportedFocusModes) {/* - if (isUsingFrontCamera && supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_FIXED)) { - return Camera.Parameters.FOCUS_MODE_FIXED; - } - if (!isUsingFrontCamera && supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_INFINITY)) { - return Camera.Parameters.FOCUS_MODE_INFINITY; - }*/ - - if (supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) { - return Camera.Parameters.FOCUS_MODE_AUTO; - } - - return null; // Should not occur? - } - - @Override - protected void onSettingCameraParameters(Parameters parameters) { - super.onSettingCameraParameters(parameters); - List supportedFocusModes = parameters.getSupportedFocusModes(); - String focusMode = selectFocusMode(supportedFocusModes); - if (focusMode != null) { - Log.w("Selected focus mode: ", focusMode); - parameters.setFocusMode(focusMode); - } else { - Log.i("No suitable focus mode found in : ", Arrays.toString(supportedFocusModes.toArray())); - } - } - - @Override - protected List getSupportedPreviewSizes(Parameters parameters) { - return parameters.getSupportedPreviewSizes(); - } - - @Override - protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { - camera.setPreviewCallback(cb); - } - - -} diff --git a/video/AndroidCameraRecord8.java b/video/AndroidCameraRecord8.java deleted file mode 100644 index c5fda6774..000000000 --- a/video/AndroidCameraRecord8.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -AndroidCameraRecord8Impl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.video; - -import java.util.List; - -import org.linphone.core.Log; - -import android.hardware.Camera; -import android.hardware.Camera.Parameters; -import android.hardware.Camera.PreviewCallback; -import android.hardware.Camera.Size; - -/** - * - * Android >= 8 (2.2) version. - * @author Guillaume Beraudo - * - */ -class AndroidCameraRecord8 extends AndroidCameraRecord5 { - - - public AndroidCameraRecord8(RecorderParams parameters) { - super(parameters); - } - - @Override - protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { - if (cb != null) { - Log.d("Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); - } - camera.setPreviewCallbackWithBuffer(cb); - } - - @Override - public void onPreviewStarted(Camera camera) { - super.onPreviewStarted(camera); - - Size s = camera.getParameters().getPreviewSize(); - int wishedBufferSize = s.height * s.width * 3 / 2; - - camera.addCallbackBuffer(new byte[wishedBufferSize]); - camera.addCallbackBuffer(new byte[wishedBufferSize]); - } - - @Override - public void onPreviewFrame(byte[] data, Camera camera) { - super.onPreviewFrame(data, camera); - camera.addCallbackBuffer(data); - } - - @Override - protected void onSettingCameraParameters(Parameters parameters) { - super.onSettingCameraParameters(parameters); - // Only on v8 hardware - camera.setDisplayOrientation(rotation); - } - - @Override - protected String selectFocusMode(final List supportedFocusModes) { - if (supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_EDOF)) { - return Camera.Parameters.FOCUS_MODE_EDOF; - } else - return super.selectFocusMode(supportedFocusModes); - } -} diff --git a/video/AndroidCameraRecord9.java b/video/AndroidCameraRecord9.java deleted file mode 100644 index f0023ef57..000000000 --- a/video/AndroidCameraRecord9.java +++ /dev/null @@ -1,50 +0,0 @@ -/* -AndroidCameraRecord9Impl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.video; - -import java.util.List; - -import android.hardware.Camera; - -/** - * - * Android >= 9 (2.3) version. - * @author Guillaume Beraudo - * - */ -class AndroidCameraRecord9 extends AndroidCameraRecord8 { - - - public AndroidCameraRecord9(RecorderParams parameters) { - super(parameters); - } - - @Override - protected Camera openCamera(int cameraId) { - return Camera.open(cameraId); - } - - @Override - protected String selectFocusMode(final List supportedFocusModes) { - if (supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { - return Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO; - } else - return super.selectFocusMode(supportedFocusModes); - } -} diff --git a/video/AndroidCameraRecordManager.java b/video/AndroidCameraRecordManager.java deleted file mode 100644 index 7e8e8b613..000000000 --- a/video/AndroidCameraRecordManager.java +++ /dev/null @@ -1,362 +0,0 @@ -/* -AndroidCameraRecordManager.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.video; - -import java.util.List; - -import org.linphone.core.LinphoneCore; -import org.linphone.core.Log; -import org.linphone.core.Version; -import org.linphone.core.VideoSize; -import org.linphone.core.video.AndroidCameraRecord.RecorderParams; - -import android.content.Context; -import android.view.OrientationEventListener; -import android.view.SurfaceHolder; -import android.view.SurfaceView; -import android.view.SurfaceHolder.Callback; - - - -/** - * Manage the video capture, only one for all cameras. - * - * @author Guillaume Beraudo - * - */ -public class AndroidCameraRecordManager { - private static AndroidCameraRecordManager instance; - private OrientationEventListener orientationEventListener; - private OnCapturingStateChangedListener capturingStateChangedListener; - - /** - * @return instance - */ - public static final synchronized AndroidCameraRecordManager getInstance() { - if (instance == null) { - instance = new AndroidCameraRecordManager(); - } - return instance; - } - - private AndroidCameraRecord.RecorderParams parameters; - private final AndroidCameraConf cc; - private SurfaceView surfaceView; - private boolean muted; - private int cameraId; - - private AndroidCameraRecord recorder; - private int mAlwaysChangingPhoneOrientation=0; - - - // singleton - private AndroidCameraRecordManager() { - if (!Version.isVideoCapable()) { // imply sdk>=5 - throw new RuntimeException("AndroidCameraRecordManager: hardware is not video capable"); - } - cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5(); - Log.i("=== Detected " + cc.getFoundCameras()+ " ==="); - cameraId = cc.getFoundCameras().defaultC; - } - - - - - public boolean hasSeveralCameras() { - return cc.getFoundCameras().hasSeveralCameras(); - } - public boolean hasFrontCamera() { - return cc.getFoundCameras().front != null; - } - - - public void setUseFrontCamera(boolean value) { - if (!hasFrontCamera()) { - Log.e("setUseFrontCamera(true) while no front camera detected on device: using rear"); - value = false; - } - if (cc.isFrontCamera(cameraId) == value) return; // already OK - toggleUseFrontCamera(); - } - - public boolean isUseFrontCamera() {return cc.isFrontCamera(cameraId);} - public boolean toggleUseFrontCamera() { - boolean previousUseFront = cc.isFrontCamera(cameraId); - - cameraId = previousUseFront ? cc.getFoundCameras().rear : cc.getFoundCameras().front; - - if (parameters != null) { - parameters.cameraId = cameraId; - parameters.isFrontCamera = !previousUseFront; - if (isRecording()) { - stopVideoRecording(); - tryToStartVideoRecording(); - } - } - - return !previousUseFront; - } - - - - public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) { - if (recorder != null) { - Log.w("Recorder should not be running"); - stopVideoRecording(); - } - RecorderParams p = new RecorderParams(filterDataPtr); - p.fps = fps; - p.width = width; - p.height = height; - p.cameraId = cameraId; - p.isFrontCamera = isUseFrontCamera(); - parameters = p; - - // Mirror the sent frames in order to make them readable - // (otherwise it is mirrored and thus unreadable) - if (p.isFrontCamera) { - if (!isCameraMountedPortrait()) { - // Code for Nexus S - if (isFrameToBeShownPortrait()) - p.mirror = RecorderParams.MirrorType.CENTRAL; - } else { - // Code for Galaxy S like: camera mounted landscape when phone hold portrait - p.mirror = RecorderParams.MirrorType.HORIZONTAL; - } - } - - tryToStartVideoRecording(); - } - - - public final void setSurfaceView(final SurfaceView sv) { - SurfaceHolder holder = sv.getHolder(); - holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - - holder.addCallback(new Callback() { - public void surfaceDestroyed(SurfaceHolder holder) { - surfaceView = null; - Log.d("Video capture surface destroyed"); - stopVideoRecording(); - } - - public void surfaceCreated(SurfaceHolder holder) { - surfaceView = sv; - Log.d("Video capture surface created"); - tryToStartVideoRecording(); - } - - public void surfaceChanged(SurfaceHolder holder, int format, int width, - int height) { - Log.d("Video capture surface changed"); - } - }); - } - - /** - * @param muteState - * @return true if mute state changed - */ - public boolean setMuted(boolean muteState) { - if (muteState == muted) return false; - muted = muteState; - if (muted) { - stopVideoRecording(); - } else { - tryToStartVideoRecording(); - } - return true; - } - public boolean toggleMute() { - setMuted(!muted); - return muted; - } - public boolean isMuted() { - return muted; - } - - public void tryResumingVideoRecording() { - if (isRecording()) return; - tryToStartVideoRecording(); - } - - private synchronized void tryToStartVideoRecording() { - if (orientationEventListener == null) { - throw new RuntimeException("startOrientationSensor was not called"); - } - - if (muted || surfaceView == null || parameters == null) return; - - if (recorder != null) { - Log.e("Recorder already present"); - stopVideoRecording(); - } - - parameters.rotation = bufferRotationToCompensateCameraAndPhoneOrientations(); - - parameters.surfaceView = surfaceView; - if (Version.sdkAboveOrEqual(9)) { - recorder = new AndroidCameraRecord9(parameters); - } else if (Version.sdkAboveOrEqual(8)) { - recorder = new AndroidCameraRecord8(parameters); - } else if (Version.sdkAboveOrEqual(5)) { - recorder = new AndroidCameraRecord5(parameters); - } else { - throw new RuntimeException("SDK version unsupported " + Version.sdk()); - } - - recorder.startPreview(); - - if (capturingStateChangedListener != null) { - capturingStateChangedListener.captureStarted(); - } - } - - public synchronized void stopVideoRecording() { - if (recorder != null) { - recorder.stopPreview(); - recorder = null; - if (capturingStateChangedListener != null) { - capturingStateChangedListener.captureStopped(); - } - } - } - - - - public List supportedVideoSizes() { - Log.d("Using supportedVideoSizes of camera ",cameraId); - return cc.getSupportedPreviewSizes(cameraId); - } - - - public boolean isRecording() { - if (recorder != null) { - return recorder.isStarted(); - } - - return false; - } - - - public void invalidateParameters() { - stopVideoRecording(); - parameters = null; - } - - /** Depends on currently selected camera, camera mounted portrait/landscape, current phone orientation */ - public boolean isFrameToBeShownPortrait() { - final int rotation = bufferRotationToCompensateCameraAndPhoneOrientations(); - - boolean isPortrait; - if (isCameraMountedPortrait()) { - // Nexus S - isPortrait = (rotation % 180) == 0; - } else { - isPortrait = (rotation % 180) == 90; - } - - Log.d("The frame to be shown and sent to remote is ", isPortrait? "portrait":"landscape"," orientation."); - return isPortrait; - } - - - - - - - public boolean isCameraMountedPortrait() { - return (cc.getCameraOrientation(cameraId) % 180) == 0; - } - - - - private int bufferRotationToCompensateCameraAndPhoneOrientations() { - if (Version.sdkStrictlyBelow(Version.API08_FROYO_22)) { - // Don't perform any rotation - // Phone screen should use fitting orientation - return 0; - } - - final int phoneOrientation = mAlwaysChangingPhoneOrientation; - final int cameraOrientation = cc.getCameraOrientation(cameraId); - int frontCameraCorrection = 0; - if (cc.isFrontCamera(cameraId)) { - frontCameraCorrection=180; // hack that "just works" on Galaxy S and Nexus S. - // See also magic with mirrors in setParametersFromFilter - } - final int rotation = (cameraOrientation + phoneOrientation + frontCameraCorrection) % 360; - Log.d("Capture video buffer of cameraId=",cameraId, - " will need a rotation of ",rotation, - " degrees: camera_orientation=",cameraOrientation, - " phone_orientation=", phoneOrientation); - return rotation; - } - - - /** - * Register a sensor to track phoneOrientation changes - */ - public void startOrientationSensor(Context c) { - if (orientationEventListener == null) { - orientationEventListener = new LocalOrientationEventListener(c); - orientationEventListener.enable(); - } - } - - private class LocalOrientationEventListener extends OrientationEventListener { - public LocalOrientationEventListener(Context context) { - super(context); - } - @Override - public void onOrientationChanged(final int o) { - if (o == OrientationEventListener.ORIENTATION_UNKNOWN) return; - - int degrees=270; - if (o < 45 || o >315) degrees=0; - else if (o<135) degrees=90; - else if (o<225) degrees=180; - - if (mAlwaysChangingPhoneOrientation == degrees) return; - - Log.i("Phone orientation changed to ", degrees); - mAlwaysChangingPhoneOrientation = degrees; - } - } - - /** - * @return true if linphone core configured to send a A buffer while phone orientation induces !A buffer (A=landscape or portrait) - */ - public boolean isOutputOrientationMismatch(LinphoneCore lc) { - final boolean currentlyPortrait = lc.getPreferredVideoSize().isPortrait(); - final boolean shouldBePortrait = isFrameToBeShownPortrait(); - return currentlyPortrait ^ shouldBePortrait; - } - - public void setOnCapturingStateChanged(OnCapturingStateChangedListener listener) { - this.capturingStateChangedListener=listener; - } - - public static interface OnCapturingStateChangedListener { - void captureStarted(); - void captureStopped(); - } - - -} From 9bf7e93992de78603d48abcb4024efcb918dbf1f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 19 Sep 2011 12:44:22 +0200 Subject: [PATCH 139/769] fix broken compilation and update linphone submodule --- LinphoneCallImpl.java | 5 ++++- LinphoneCoreImpl.java | 47 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index b027e2170..db8b3f733 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -80,7 +80,6 @@ class LinphoneCallImpl implements LinphoneCall { public void enableCamera(boolean enabled) { enableCamera(nativePtr, enabled); } - @Override public boolean cameraEnabled() { return cameraEnabled(nativePtr); } @@ -127,4 +126,8 @@ class LinphoneCallImpl implements LinphoneCall { public boolean areStreamsEncrypted() { return areStreamsEncrypted(nativePtr); } + public boolean isInConference() { + // TODO Auto-generated method stub + return false; + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index d4b54b663..20d18e90e 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,6 +20,7 @@ package org.linphone.core; import java.io.File; import java.io.IOException; +import java.util.List; import java.util.Vector; import org.linphone.LinphoneManager; @@ -491,16 +492,58 @@ class LinphoneCoreImpl implements LinphoneCore { public void enableEchoLimiter(boolean val) { enableEchoLimiter(nativePtr,val); } - @Override public void setVideoDevice(int id) { Log.i("Setting camera id :", id); if (setVideoDevice(nativePtr, id) != 0) { Log.e("Failed to set video device to id:", id); } } - @Override public int getVideoDevice() { return getVideoDevice(nativePtr); } + public void addAllToConference() { + // TODO Auto-generated method stub + + } + public void addToConference(LinphoneCall call) { + // TODO Auto-generated method stub + + } + public void enterConference() { + // TODO Auto-generated method stub + + } + public List getCalls() { + // TODO Auto-generated method stub + return null; + } + public int getCallsNb() { + // TODO Auto-generated method stub + return 0; + } + public int getConferenceSize() { + // TODO Auto-generated method stub + return 0; + } + public boolean isInConference() { + // TODO Auto-generated method stub + return false; + } + public void leaveConference() { + // TODO Auto-generated method stub + + } + public void removeFromConference(LinphoneCall call) { + // TODO Auto-generated method stub + + } + public void terminateAllCalls() { + // TODO Auto-generated method stub + + } + public void terminateConference() { + // TODO Auto-generated method stub + + } } From 698e7ac2b253083b6ed088e89e1df6d8f0fefd61 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 20 Sep 2011 21:33:05 +0200 Subject: [PATCH 140/769] update linphone submodule, fix compilation issue --- LinphoneCoreImpl.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 20d18e90e..01517762d 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -545,5 +545,14 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub } + public void transferCall(LinphoneCall call, String referTo) { + // TODO Auto-generated method stub + + } + public void transferCallToAnother(LinphoneCall callToTransfer, + LinphoneCall destination) { + // TODO Auto-generated method stub + + } } From d97eeee7f51d06b760053aca902c532d6b432358 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 22 Sep 2011 10:50:35 +0200 Subject: [PATCH 141/769] Fix errors with different Android SDK (3, 5) --- LinphoneCoreFactoryImpl.java | 2 + Version.java | 85 ------------------------------------ 2 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 Version.java diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 674b62450..19b0282f3 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -35,6 +35,8 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; +import org.linphone.mediastream.Version; + public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { private static void loadOptionalLibrary(String s) { diff --git a/Version.java b/Version.java deleted file mode 100644 index edbb25e8e..000000000 --- a/Version.java +++ /dev/null @@ -1,85 +0,0 @@ -/* -Version.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import org.linphone.mediastream.video.capture.hwconf.Hacks; - -import android.os.Build; - -/** - * Centralize version access and allow simulation of lower versions. - * @author Guillaume Beraudo - */ -public class Version { - - public static final int API03_CUPCAKE_15 = 3; - public static final int API04_DONUT_16 = 4; - public static final int API06_ECLAIR_20 = 6; - public static final int API07_ECLAIR_21 = 7; - public static final int API08_FROYO_22 = 8; - public static final int API09_GINGERBREAD_23 = 9; - public static final int API11_HONEYCOMB_30 = 11; - - private static native boolean nativeHasZrtp(); - private static native boolean nativeHasNeon(); - private static Boolean hasNeon; - - private static final int buildVersion = - Integer.parseInt(Build.VERSION.SDK); -// 8; // 2.2 -// 7; // 2.1 - - public static final boolean sdkAboveOrEqual(int value) { - return buildVersion >= value; - } - - public static final boolean sdkStrictlyBelow(int value) { - return buildVersion < value; - } - - public static int sdk() { - return buildVersion; - } - - public static boolean isArmv7() { - try { - return sdkAboveOrEqual(4) - && Build.class.getField("CPU_ABI").get(null).toString().startsWith("armeabi-v7"); - } catch (Throwable e) {} - return false; - } - public static boolean hasNeon(){ - if (hasNeon == null) hasNeon = nativeHasNeon(); - return hasNeon; - } - public static boolean isVideoCapable() { - return !Version.sdkStrictlyBelow(5) && Version.hasNeon() && Hacks.hasCamera(); - } - - public static boolean hasZrtp(){ - return nativeHasZrtp(); - } - - public static void dumpCapabilities(){ - StringBuilder sb = new StringBuilder(" ==== Capabilities dump ====\n"); - sb.append("Has neon: ").append(Boolean.toString(hasNeon())).append("\n"); - sb.append("Has ZRTP: ").append(Boolean.toString(hasZrtp())).append("\n"); - Log.i(sb.toString()); - } -} From d5b7321a657bf0fce20771d0e6af8a5476cc8c0c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 22 Sep 2011 10:55:47 +0200 Subject: [PATCH 142/769] fix inconsistency when a second call arrives --- LinphoneCallImpl.java | 6 ++---- LinphoneCoreImpl.java | 10 ++-------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index db8b3f733..ceb541ed0 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -23,8 +23,7 @@ class LinphoneCallImpl implements LinphoneCall { protected final long nativePtr; boolean ownPtr = false; - native private void ref(long ownPtr); - native private void unref(long ownPtr); + native private void finalize(long nativePtr); native private long getCallLog(long nativePtr); private native boolean isIncoming(long nativePtr); native private long getRemoteAddress(long nativePtr); @@ -46,10 +45,9 @@ class LinphoneCallImpl implements LinphoneCall { protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; - ref(nativePtr); } protected void finalize() throws Throwable { - unref(nativePtr); + finalize(nativePtr); } public LinphoneCallLog getCallLog() { long lNativePtr = getCallLog(nativePtr); diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 01517762d..52019f96b 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -65,7 +65,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr); - private native long getCurrentCall(long nativePtr) ; + private native Object getCurrentCall(long nativePtr) ; private native void playDtmf(long nativePtr,char dtmf,int duration); private native void stopDtmf(long nativePtr); private native void setVideoWindowId(long nativePtr, Object wid); @@ -285,12 +285,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized LinphoneCall getCurrentCall() { isValid(); - long lNativePtr = getCurrentCall(nativePtr); - if (lNativePtr!=0) { - return new LinphoneCallImpl(lNativePtr); - } else { - return null; - } + return (LinphoneCall)getCurrentCall(nativePtr); } public int getPlayLevel() { @@ -554,5 +549,4 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub } - } From 98ea21e21fb80198e3d5bf007017a5075da7aaf6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 22 Sep 2011 17:11:35 +0200 Subject: [PATCH 143/769] fix for unique LinphoneCalls again --- LinphoneCallImpl.java | 13 ++++++------- LinphoneCoreImpl.java | 25 ++++++++++--------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index ceb541ed0..70968e79d 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -35,14 +35,17 @@ class LinphoneCallImpl implements LinphoneCall { private native boolean isEchoCancellationEnabled(long nativePtr) ; private native void enableEchoLimiter(long nativePtr,boolean enable); private native boolean isEchoLimiterEnabled(long nativePtr); - private native long getReplacedCall(long nativePtr); + private native Object getReplacedCall(long nativePtr); private native int getDuration(long nativePtr); private native float getCurrentQuality(long nativePtr); private native float getAverageQuality(long nativePtr); private native String getAuthenticationToken(long nativePtr); private native boolean isAuthenticationTokenVerified(long nativePtr); private native boolean areStreamsEncrypted(long nativePtr); - + + /* + * This method must always be called from JNI, nothing else. + */ protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; } @@ -98,11 +101,7 @@ class LinphoneCallImpl implements LinphoneCall { return isEchoLimiterEnabled(nativePtr); } public LinphoneCall getReplacedCall(){ - long callptr=getReplacedCall(nativePtr); - if (callptr!=0){ - return new LinphoneCallImpl(callptr); - } - return null; + return (LinphoneCall)getReplacedCall(nativePtr); } public int getDuration() { diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 52019f96b..a45bad1c7 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -42,7 +42,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void clearProxyConfigs(long nativePtr); private native void addAuthInfo(long nativePtr,long authInfoNativePtr); - private native long invite(long nativePtr,String uri); + private native Object invite(long nativePtr,String uri); private native void terminateCall(long nativePtr, long call); private native long getRemoteAddress(long nativePtr); private native boolean isInCall(long nativePtr); @@ -56,8 +56,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native float getPlaybackGain(long nativeptr); private native void muteMic(long nativePtr,boolean isMuted); private native long interpretUrl(long nativePtr,String destination); - private native long inviteAddress(long nativePtr,long to); - private native long inviteAddressWithParams(long nativePtrLc,long to, long nativePtrParam); + private native Object inviteAddress(long nativePtr,long to); + private native Object inviteAddressWithParams(long nativePtrLc,long to, long nativePtrParam); private native void sendDtmf(long nativePtr,char dtmf); private native void clearCallLogs(long nativePtr); private native boolean isMicMuted(long nativePtr); @@ -140,12 +140,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized LinphoneCall invite(String uri) { isValid(); - long lNativePtr = invite(nativePtr,uri); - if (lNativePtr!=0) { - return new LinphoneCallImpl(lNativePtr); - } else { - return null; - } + return (LinphoneCall)invite(nativePtr,uri); } public synchronized void iterate() { @@ -239,9 +234,9 @@ class LinphoneCoreImpl implements LinphoneCore { } } public synchronized LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException { - long lNativePtr = inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); - if (lNativePtr!=0) { - return new LinphoneCallImpl(lNativePtr); + LinphoneCall call = (LinphoneCall)inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); + if (call!=null) { + return call; } else { throw new LinphoneCoreException("Unable to invite address " + to.asString()); } @@ -361,9 +356,9 @@ class LinphoneCoreImpl implements LinphoneCore { long ptrDestination = ((LinphoneAddressImpl)to).nativePtr; long ptrParams =((LinphoneCallParamsImpl)params).nativePtr; - long lcNativePtr = inviteAddressWithParams(nativePtr, ptrDestination, ptrParams); - if (lcNativePtr!=0) { - return new LinphoneCallImpl(lcNativePtr); + LinphoneCall call = (LinphoneCall)inviteAddressWithParams(nativePtr, ptrDestination, ptrParams); + if (call!=null) { + return call; } else { throw new LinphoneCoreException("Unable to invite with params " + to.asString()); } From dfdd63a2ed80b193dca5e6aab6ccafd20093e139 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 26 Sep 2011 09:18:48 +0200 Subject: [PATCH 144/769] Report bug button in about activity when debug on. --- LinphoneCoreFactoryImpl.java | 14 -------------- LinphoneCoreImpl.java | 3 --- 2 files changed, 17 deletions(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 19b0282f3..1591a8b4e 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -19,21 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone.core; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; -import java.security.InvalidAlgorithmParameterException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.PKIXParameters; -import java.security.cert.TrustAnchor; -import java.security.cert.X509Certificate; -import java.util.Iterator; - -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; import org.linphone.mediastream.Version; diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index a45bad1c7..92eb4a43c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -23,9 +23,6 @@ import java.io.IOException; import java.util.List; import java.util.Vector; -import org.linphone.LinphoneManager; -import org.linphone.mediastream.video.AndroidVideoWindowImpl; - class LinphoneCoreImpl implements LinphoneCore { From 79965f6d156c1412a1cf3764765f27bf88b5f978 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 14 Sep 2011 11:04:14 +0200 Subject: [PATCH 145/769] Preliminary code for conferencing support. --- LinphoneCallImpl.java | 5 +- LinphoneCallParamsImpl.java | 5 ++ LinphoneCoreImpl.java | 93 ++++++++++++++++++++++--------------- 3 files changed, 64 insertions(+), 39 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 70968e79d..acad5a09f 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -123,8 +123,9 @@ class LinphoneCallImpl implements LinphoneCall { public boolean areStreamsEncrypted() { return areStreamsEncrypted(nativePtr); } + public boolean isInConference() { - // TODO Auto-generated method stub - return false; + LinphoneCallParamsImpl params = new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); + return params.localConferenceMode(); } } diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java index ef05eb228..d9c490ae1 100644 --- a/LinphoneCallParamsImpl.java +++ b/LinphoneCallParamsImpl.java @@ -48,4 +48,9 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public void setAudioBandwidth(int value) { audioBandwidth(nativePtr, value); } + + private native boolean localConferenceMode(long nativePtr); + public boolean localConferenceMode() { + return localConferenceMode(nativePtr); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 92eb4a43c..ab87a17b2 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,6 +20,7 @@ package org.linphone.core; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Vector; @@ -488,50 +489,68 @@ class LinphoneCoreImpl implements LinphoneCore { public int getVideoDevice() { return getVideoDevice(nativePtr); } - public void addAllToConference() { - // TODO Auto-generated method stub - - } - public void addToConference(LinphoneCall call) { - // TODO Auto-generated method stub - - } - public void enterConference() { - // TODO Auto-generated method stub - - } - public List getCalls() { - // TODO Auto-generated method stub - return null; - } - public int getCallsNb() { - // TODO Auto-generated method stub - return 0; - } - public int getConferenceSize() { - // TODO Auto-generated method stub - return 0; - } - public boolean isInConference() { - // TODO Auto-generated method stub - return false; - } + + + private native void leaveConference(long nativePtr); public void leaveConference() { - // TODO Auto-generated method stub - + leaveConference(nativePtr); } - public void removeFromConference(LinphoneCall call) { - // TODO Auto-generated method stub - + + private native void enterConference(long nativePtr); + public void enterConference() { + enterConference(nativePtr); } - public void terminateAllCalls() { - // TODO Auto-generated method stub - + + private native boolean isInConference(long nativePtr); + public boolean isInConference() { + return isInConference(nativePtr); } + + private native void addToConference(long nativePtr, long nativePtrLcall); + public void addToConference(LinphoneCall call, boolean addOthersToNewConference) { + addToConference(nativePtr, ((LinphoneCallImpl)call).nativePtr); + } + + private native void terminateConference(long nativePtr); public void terminateConference() { - // TODO Auto-generated method stub + terminateConference(nativePtr); + } + private native int getConferenceSize(long nativePtr); + public int getConferenceSize() { + return getConferenceSize(nativePtr); + } + private native int getCallsNb(long nativePtr); + public int getCallsNb() { + return getCallsNb(nativePtr); + } + private native void terminateAllCalls(long nativePtr); + public void terminateAllCalls() { + terminateAllCalls(nativePtr); + } + private native long getCall(long nativePtr, int position); + @SuppressWarnings("unchecked") public List getCalls() { + int size = getCallsNb(nativePtr); + List calls = new ArrayList(size); + for (int i=0; i < size; i++) { + calls.add(new LinphoneCallImpl(getCall(nativePtr, i))); + } + return calls; + } + private native void addAllToConference(long nativePtr); + public void addAllToConference() { + addAllToConference(nativePtr); } + private native void addToConference(long nativePtr); + public void addToConference(LinphoneCall call) { + addToConference(nativePtr); + + } + private native void removeFromConference(long nativePtr); + public void removeFromConference(LinphoneCall call) { + removeFromConference(nativePtr); + } + public void transferCall(LinphoneCall call, String referTo) { // TODO Auto-generated method stub From eb6fe80e62d12bfb574864f34c2f8f923cd1807b Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 14 Sep 2011 11:37:54 +0200 Subject: [PATCH 146/769] Fix mediastreamer2 build. --- LinphoneCallImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index acad5a09f..c96593d63 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -128,4 +128,9 @@ class LinphoneCallImpl implements LinphoneCall { LinphoneCallParamsImpl params = new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); return params.localConferenceMode(); } + + @Override + public String toString() { + return "Call " + nativePtr; + } } From b44d51a5b17da9973c35729386c41a8b085eea17 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 20 Sep 2011 14:36:15 +0200 Subject: [PATCH 147/769] Initial support for conferencing. --- LinphoneCoreImpl.java | 53 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index ab87a17b2..a5b4b718c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -477,7 +477,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setZrtpSecretsCache(String file) { setZrtpSecretsCache(nativePtr,file); } - public void enableEchoLimiter(boolean val) { + public synchronized void enableEchoLimiter(boolean val) { enableEchoLimiter(nativePtr,val); } public void setVideoDevice(int id) { @@ -492,43 +492,38 @@ class LinphoneCoreImpl implements LinphoneCore { private native void leaveConference(long nativePtr); - public void leaveConference() { + public synchronized void leaveConference() { leaveConference(nativePtr); } private native void enterConference(long nativePtr); - public void enterConference() { + public synchronized void enterConference() { enterConference(nativePtr); } private native boolean isInConference(long nativePtr); - public boolean isInConference() { + public synchronized boolean isInConference() { return isInConference(nativePtr); } - private native void addToConference(long nativePtr, long nativePtrLcall); - public void addToConference(LinphoneCall call, boolean addOthersToNewConference) { - addToConference(nativePtr, ((LinphoneCallImpl)call).nativePtr); - } - private native void terminateConference(long nativePtr); - public void terminateConference() { + public synchronized void terminateConference() { terminateConference(nativePtr); } private native int getConferenceSize(long nativePtr); - public int getConferenceSize() { + public synchronized int getConferenceSize() { return getConferenceSize(nativePtr); } private native int getCallsNb(long nativePtr); - public int getCallsNb() { + public synchronized int getCallsNb() { return getCallsNb(nativePtr); } private native void terminateAllCalls(long nativePtr); - public void terminateAllCalls() { + public synchronized void terminateAllCalls() { terminateAllCalls(nativePtr); } private native long getCall(long nativePtr, int position); - @SuppressWarnings("unchecked") public List getCalls() { + @SuppressWarnings("unchecked") public synchronized List getCalls() { int size = getCallsNb(nativePtr); List calls = new ArrayList(size); for (int i=0; i < size; i++) { @@ -537,27 +532,31 @@ class LinphoneCoreImpl implements LinphoneCore { return calls; } private native void addAllToConference(long nativePtr); - public void addAllToConference() { + public synchronized void addAllToConference() { addAllToConference(nativePtr); } - private native void addToConference(long nativePtr); - public void addToConference(LinphoneCall call) { - addToConference(nativePtr); + private native void addToConference(long nativePtr, long nativePtrLcall); + public synchronized void addToConference(LinphoneCall call) { + addToConference(nativePtr, getCallPtr(call)); } private native void removeFromConference(long nativePtr); - public void removeFromConference(LinphoneCall call) { - removeFromConference(nativePtr); + public synchronized void removeFromConference(LinphoneCall call) { + removeFromConference(getCallPtr(call)); } - public void transferCall(LinphoneCall call, String referTo) { - // TODO Auto-generated method stub - + private long getCallPtr(LinphoneCall call) { + return ((LinphoneCallImpl)call).nativePtr; } - public void transferCallToAnother(LinphoneCall callToTransfer, - LinphoneCall destination) { - // TODO Auto-generated method stub - + + private native int transferCall(long nativePtr, long callPtr, String referTo); + public synchronized void transferCall(LinphoneCall call, String referTo) { + transferCall(nativePtr, getCallPtr(call), referTo); + } + + private native int transferCallToAnother(long nativePtr, long callPtr, long destPtr); + public synchronized void transferCallToAnother(LinphoneCall call, LinphoneCall dest) { + transferCallToAnother(nativePtr, getCallPtr(call), getCallPtr(dest)); } } From 8a89467629e7ee95d375a96bc59937f9f46253b3 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 29 Sep 2011 16:36:40 +0200 Subject: [PATCH 148/769] improved incoming activity + back to conference button. --- LinphoneCallImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index c96593d63..3f153e0fc 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -84,9 +84,21 @@ class LinphoneCallImpl implements LinphoneCall { public boolean cameraEnabled() { return cameraEnabled(nativePtr); } + + @Override public boolean equals(Object call) { + if (this == call) return true; + if (call == null) return false; + if (!(call instanceof LinphoneCallImpl)) return false; return nativePtr == ((LinphoneCallImpl)call).nativePtr; } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (int) (nativePtr ^ (nativePtr >>> 32)); + return result; + } public void enableEchoCancellation(boolean enable) { enableEchoCancellation(nativePtr,enable); From f57826fb231936c82760c12f5cdb3dcc230843de Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 30 Sep 2011 13:51:46 +0200 Subject: [PATCH 149/769] Fix second incoming call from same uri crash. --- LinphoneCoreImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index a5b4b718c..8a40cdb9f 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -559,4 +559,11 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void transferCallToAnother(LinphoneCall call, LinphoneCall dest) { transferCallToAnother(nativePtr, getCallPtr(call), getCallPtr(dest)); } + + private native long findCallFromUri(long nativePtr, String uri); + @Override + public synchronized LinphoneCall findCallFromUri(String uri) { + long callPtr = findCallFromUri(nativePtr, uri); + return callPtr != 0 ? new LinphoneCallImpl(callPtr) : null; + } } From 17df23f74ac47e3c7ee263a918b9bfba850ddee7 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 7 Oct 2011 08:48:12 +0200 Subject: [PATCH 150/769] Add missing LinphoneCore function impl --- LinphoneCoreImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 92eb4a43c..4b3f9e99c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -541,4 +541,8 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub } + public LinphoneCall findCallFromUri(String uri) { + // TODO Auto-generated method stub + return null; + } } From 70f96ce8e9e871140d938d3c8d05fcccfc130a1c Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 6 Oct 2011 14:50:38 +0200 Subject: [PATCH 151/769] Enable srtp --- LinphoneCoreImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 4b3f9e99c..902ea9f4f 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -515,7 +515,7 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isInConference() { // TODO Auto-generated method stub return false; - } + } public void leaveConference() { // TODO Auto-generated method stub From d8f8b821037fddb489f0325520f0b7ba51f341d0 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 7 Oct 2011 09:52:59 +0200 Subject: [PATCH 152/769] Enhance conference activity style + permute calls. --- LinphoneCoreImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 8a40cdb9f..0f91922d7 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -522,12 +522,12 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void terminateAllCalls() { terminateAllCalls(nativePtr); } - private native long getCall(long nativePtr, int position); + private native Object getCall(long nativePtr, int position); @SuppressWarnings("unchecked") public synchronized List getCalls() { int size = getCallsNb(nativePtr); List calls = new ArrayList(size); for (int i=0; i < size; i++) { - calls.add(new LinphoneCallImpl(getCall(nativePtr, i))); + calls.add((LinphoneCall)getCall(nativePtr, i)); } return calls; } From 382b6f480a1286aab7711a3f767321c186c57b66 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 7 Oct 2011 14:43:32 +0200 Subject: [PATCH 153/769] Hide LinphonecallImpl constructor. linphonecalls should not be created from java. --- LinphoneCallImpl.java | 2 +- LinphoneCoreImpl.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 3f153e0fc..6370dce17 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -46,7 +46,7 @@ class LinphoneCallImpl implements LinphoneCall { /* * This method must always be called from JNI, nothing else. */ - protected LinphoneCallImpl(long aNativePtr) { + private LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; } protected void finalize() throws Throwable { diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 0f91922d7..bf5e5de9c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -560,10 +560,9 @@ class LinphoneCoreImpl implements LinphoneCore { transferCallToAnother(nativePtr, getCallPtr(call), getCallPtr(dest)); } - private native long findCallFromUri(long nativePtr, String uri); + private native Object findCallFromUri(long nativePtr, String uri); @Override public synchronized LinphoneCall findCallFromUri(String uri) { - long callPtr = findCallFromUri(nativePtr, uri); - return callPtr != 0 ? new LinphoneCallImpl(callPtr) : null; + return (LinphoneCall) findCallFromUri(nativePtr, uri); } } From 641354c50f65f6dbb94d7888fb3ae0c65ae066fc Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 10 Oct 2011 09:26:14 +0200 Subject: [PATCH 154/769] srtp: add Java impl --- LinphoneCallParamsImpl.java | 10 ++++++++++ LinphoneCoreImpl.java | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java index ef05eb228..c346dcd1f 100644 --- a/LinphoneCallParamsImpl.java +++ b/LinphoneCallParamsImpl.java @@ -28,6 +28,8 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native void enableVideo(long nativePtr, boolean b); private native boolean getVideoEnabled(long nativePtr); private native void audioBandwidth(long nativePtr, int bw); + private native void setMediaEncryption(long nativePtr, String menc); + private native String getMediaEncryption(long nativePtr); private native void destroy(long nativePtr); @@ -48,4 +50,12 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public void setAudioBandwidth(int value) { audioBandwidth(nativePtr, value); } + + public String getMediaEncryption() { + return getMediaEncryption(nativePtr); + } + + public void setMediaEnctyption(String menc) { + setMediaEncryption(nativePtr, menc); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 902ea9f4f..355523d59 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -104,7 +104,12 @@ class LinphoneCoreImpl implements LinphoneCore { private native void enableEchoLimiter(long nativePtr2, boolean val); private native int setVideoDevice(long nativePtr2, int id); private native int getVideoDevice(long nativePtr2); - + private native String getMediaEncryption(long nativePtr); + private native void setMediaEncryption(long nativePtr, String menc); + private native boolean isMediaEncryptionMandatory(long nativePtr); + private native void setMediaEncryptionMandatory(long nativePtr, boolean yesno); + + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -545,4 +550,17 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return null; } + + public String getMediaEncryption() { + return getMediaEncryption(nativePtr); + } + public boolean isMediaEncryptionMandatory() { + return isMediaEncryptionMandatory(nativePtr); + } + public void setMediaEncryption(String menc) { + setMediaEncryption(nativePtr, menc); + } + public void setMediaEncryptionMandatory(boolean yesno) { + setMediaEncryptionMandatory(nativePtr, yesno); + } } From ebaa5f460d1388cba04063cf7b660ffa2636b5b8 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 18 Oct 2011 15:44:35 +0200 Subject: [PATCH 155/769] Ability to limit number of calls / hide transfers. --- LinphoneCoreImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 139e1a30f..b2a26a976 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -583,4 +583,9 @@ class LinphoneCoreImpl implements LinphoneCore { public void setMediaEncryptionMandatory(boolean yesno) { setMediaEncryptionMandatory(nativePtr, yesno); } + + private native int getMaxCalls(long nativePtr); + public int getMaxCalls() { + return getMaxCalls(nativePtr); + } } From 5d05c296465e1009888c7011d6007433809d1c46 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 26 Oct 2011 13:14:39 +0200 Subject: [PATCH 156/769] Reject incoming and outgoing calls to incall people. --- LinphoneCoreImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index b2a26a976..0e5cfbdb5 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -588,4 +588,8 @@ class LinphoneCoreImpl implements LinphoneCore { public int getMaxCalls() { return getMaxCalls(nativePtr); } + @Override + public boolean isMyself(String uri) { + return uri.equals(getDefaultProxyConfig().getIdentity()); + } } From 9fa4af5159134fd7d9bbc82b880017d5d95ff365 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 27 Oct 2011 10:43:15 +0200 Subject: [PATCH 157/769] Better add call, callee actions dialog, dtmf numpad. Prevent situations where several calls use the sound resources at the same time. --- LinphoneCoreImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 0e5cfbdb5..7c1f6d905 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -590,6 +590,13 @@ class LinphoneCoreImpl implements LinphoneCore { } @Override public boolean isMyself(String uri) { - return uri.equals(getDefaultProxyConfig().getIdentity()); + LinphoneProxyConfig lpc = getDefaultProxyConfig(); + if (lpc == null) return false; + return uri.equals(lpc.getIdentity()); + } + + private native boolean soundResourcesLocked(long nativePtr); + public boolean soundResourcesLocked() { + return soundResourcesLocked(nativePtr); } } From ab036c5fe0f8510d2557177a7f6ae3c2834275b5 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 3 Nov 2011 16:12:38 +0100 Subject: [PATCH 158/769] Fix rejection of SIP calls while in GSM call. Audio was messed up. --- LinphoneCoreImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 7c1f6d905..5d9d634db 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -599,4 +599,10 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean soundResourcesLocked() { return soundResourcesLocked(nativePtr); } + + private native void setMaxCalls(long nativePtr, int max); + @Override + public void setMaxCalls(int max) { + setMaxCalls(nativePtr, max); + } } From 6fe2f65ab0729447299643b0602141a746bc82bd Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 8 Nov 2011 16:23:21 +0100 Subject: [PATCH 159/769] fix for silk 24khz on Galaxy S --- LinphoneCallImpl.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 6370dce17..2550367cb 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -132,9 +132,6 @@ class LinphoneCallImpl implements LinphoneCall { public boolean isAuthenticationTokenVerified(){ return isAuthenticationTokenVerified(nativePtr); } - public boolean areStreamsEncrypted() { - return areStreamsEncrypted(nativePtr); - } public boolean isInConference() { LinphoneCallParamsImpl params = new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); From 453e6a5319d2dfc98d511718251b3e873735aefd Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 9 Nov 2011 17:28:51 +0100 Subject: [PATCH 160/769] add option to enable echo limiter, and fallback to it when echo limiter failed --- LinphoneCoreImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 5d9d634db..7f63f0cb3 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -605,4 +605,9 @@ class LinphoneCoreImpl implements LinphoneCore { public void setMaxCalls(int max) { setMaxCalls(nativePtr, max); } + private native boolean isEchoLimiterEnabled(long nativePtr); + @Override + public boolean isEchoLimiterEnabled() { + return isEchoLimiterEnabled(nativePtr); + } } From b15cee59b3e442673c4a7182db24cf6a857b63cc Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 14 Nov 2011 15:37:03 +0100 Subject: [PATCH 161/769] Improve ZRTP GUI + setAuthenticationVerified --- LinphoneCallImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 2550367cb..802801155 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -39,9 +39,6 @@ class LinphoneCallImpl implements LinphoneCall { private native int getDuration(long nativePtr); private native float getCurrentQuality(long nativePtr); private native float getAverageQuality(long nativePtr); - private native String getAuthenticationToken(long nativePtr); - private native boolean isAuthenticationTokenVerified(long nativePtr); - private native boolean areStreamsEncrypted(long nativePtr); /* * This method must always be called from JNI, nothing else. @@ -126,13 +123,21 @@ class LinphoneCallImpl implements LinphoneCall { return getCurrentQuality(nativePtr); } + private native String getAuthenticationToken(long nativePtr); public String getAuthenticationToken(){ return getAuthenticationToken(nativePtr); } + + private native boolean isAuthenticationTokenVerified(long nativePtr); public boolean isAuthenticationTokenVerified(){ return isAuthenticationTokenVerified(nativePtr); } + private native boolean setAuthenticationTokenVerified(long nativePtr, boolean verified); + public void setAuthenticationTokenVerified(boolean verified){ + setAuthenticationTokenVerified(nativePtr, verified); + } + public boolean isInConference() { LinphoneCallParamsImpl params = new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); return params.localConferenceMode(); From 34a0b4eb5e8aa963fdac5d47ffebed764b18a36a Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 22 Nov 2011 11:12:57 +0100 Subject: [PATCH 162/769] Fundamental incall UI changes. - single click for resuming/pausing call; - long click for advanced call/conference interaction; - terminate call action according to situation; - conference details activity; - cleanings. --- LinphoneCoreImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 7f63f0cb3..363ac8ac4 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -501,9 +501,9 @@ class LinphoneCoreImpl implements LinphoneCore { leaveConference(nativePtr); } - private native void enterConference(long nativePtr); - public synchronized void enterConference() { - enterConference(nativePtr); + private native boolean enterConference(long nativePtr); + public synchronized boolean enterConference() { + return enterConference(nativePtr); } private native boolean isInConference(long nativePtr); From cc90b960f10487b3f39ddcce290699681dcd77eb Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 23 Nov 2011 22:20:00 +0100 Subject: [PATCH 163/769] media encryption API enhancements add preference for media encryption selection. --- LinphoneCallParamsImpl.java | 14 ++++++++------ LinphoneCoreImpl.java | 23 ++++++++++++++--------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java index 8a7fba15c..bb7e9b1ab 100644 --- a/LinphoneCallParamsImpl.java +++ b/LinphoneCallParamsImpl.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import org.linphone.core.LinphoneCore.MediaEncryption; + public class LinphoneCallParamsImpl implements LinphoneCallParams { protected final long nativePtr; @@ -28,8 +30,8 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native void enableVideo(long nativePtr, boolean b); private native boolean getVideoEnabled(long nativePtr); private native void audioBandwidth(long nativePtr, int bw); - private native void setMediaEncryption(long nativePtr, String menc); - private native String getMediaEncryption(long nativePtr); + private native void setMediaEncryption(long nativePtr, int menc); + private native int getMediaEncryption(long nativePtr); private native void destroy(long nativePtr); @@ -51,12 +53,12 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { audioBandwidth(nativePtr, value); } - public String getMediaEncryption() { - return getMediaEncryption(nativePtr); + public MediaEncryption getMediaEncryption() { + return MediaEncryption.fromInt(getMediaEncryption(nativePtr)); } - public void setMediaEnctyption(String menc) { - setMediaEncryption(nativePtr, menc); + public void setMediaEnctyption(MediaEncryption menc) { + setMediaEncryption(nativePtr, menc.mValue); } private native boolean localConferenceMode(long nativePtr); diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 7f63f0cb3..eeb082dca 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -105,8 +105,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void enableEchoLimiter(long nativePtr2, boolean val); private native int setVideoDevice(long nativePtr2, int id); private native int getVideoDevice(long nativePtr2); - private native String getMediaEncryption(long nativePtr); - private native void setMediaEncryption(long nativePtr, String menc); + private native int getMediaEncryption(long nativePtr); + private native void setMediaEncryption(long nativePtr, int menc); private native boolean isMediaEncryptionMandatory(long nativePtr); private native void setMediaEncryptionMandatory(long nativePtr, boolean yesno); @@ -501,9 +501,9 @@ class LinphoneCoreImpl implements LinphoneCore { leaveConference(nativePtr); } - private native void enterConference(long nativePtr); - public synchronized void enterConference() { - enterConference(nativePtr); + private native boolean enterConference(long nativePtr); + public synchronized boolean enterConference() { + return enterConference(nativePtr); } private native boolean isInConference(long nativePtr); @@ -571,14 +571,14 @@ class LinphoneCoreImpl implements LinphoneCore { return (LinphoneCall) findCallFromUri(nativePtr, uri); } - public String getMediaEncryption() { - return getMediaEncryption(nativePtr); + public MediaEncryption getMediaEncryption() { + return MediaEncryption.fromInt(getMediaEncryption(nativePtr)); } public boolean isMediaEncryptionMandatory() { return isMediaEncryptionMandatory(nativePtr); } - public void setMediaEncryption(String menc) { - setMediaEncryption(nativePtr, menc); + public void setMediaEncryption(MediaEncryption menc) { + setMediaEncryption(nativePtr, menc.mValue); } public void setMediaEncryptionMandatory(boolean yesno) { setMediaEncryptionMandatory(nativePtr, yesno); @@ -610,4 +610,9 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isEchoLimiterEnabled() { return isEchoLimiterEnabled(nativePtr); } + private native boolean mediaEncryptionSupported(long nativePtr, int menc); + @Override + public boolean mediaEncryptionSupported(MediaEncryption menc) { + return mediaEncryptionSupported(nativePtr,menc.mValue); + } } From a829a84f6dae73a5dc7e6c867f265913570eac65 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 1 Dec 2011 08:51:48 +0100 Subject: [PATCH 164/769] Play sound to other part when holding call. --- LinphoneCoreImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index eeb082dca..b9d15299c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -615,4 +615,10 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean mediaEncryptionSupported(MediaEncryption menc) { return mediaEncryptionSupported(nativePtr,menc.mValue); } + + private native void setPlayFile(long nativePtr, String path); + @Override + public void setPlayFile(String path) { + setPlayFile(nativePtr, path); + } } From d6b568905f8bc89eb267981764e96d7d3630e897 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 6 Dec 2011 14:03:25 +0100 Subject: [PATCH 165/769] fix bad JNI interface for removeFromConf() and update linphone submodule for conferencing fixes --- LinphoneCoreImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index b9d15299c..61ddbd4d6 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -546,9 +546,9 @@ class LinphoneCoreImpl implements LinphoneCore { addToConference(nativePtr, getCallPtr(call)); } - private native void removeFromConference(long nativePtr); + private native void removeFromConference(long nativePtr, long nativeCallPtr); public synchronized void removeFromConference(LinphoneCall call) { - removeFromConference(getCallPtr(call)); + removeFromConference(nativePtr,getCallPtr(call)); } private long getCallPtr(LinphoneCall call) { From b8e9569e5d497c1ff1a029cedc73a96baa2d5f01 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 16 Dec 2011 10:59:32 +0100 Subject: [PATCH 166/769] Optional tunnel plugin. Requires a tunnel implementation with Android.mk in submodules/linphone/tunnel --- LinphoneCoreFactoryImpl.java | 3 +++ LinphoneCoreImpl.java | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 1591a8b4e..39fbeee54 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -49,6 +49,9 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { loadOptionalLibrary("srtp"); loadOptionalLibrary("zrtpcpp"); // GPLv3+ + // Tunnel + loadOptionalLibrary("tunnelclient"); + //Main library System.loadLibrary("linphone"); diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 61ddbd4d6..5d04d745c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -617,8 +617,43 @@ class LinphoneCoreImpl implements LinphoneCore { } private native void setPlayFile(long nativePtr, String path); + @Override public void setPlayFile(String path) { setPlayFile(nativePtr, path); } + + + private native void tunnelAddServerAndMirror(long nativePtr, String host, int port, int mirror, int ms); + @Override + public void tunnelAddServerAndMirror(String host, int port, int mirror, int ms) { + tunnelAddServerAndMirror(nativePtr, host, port, mirror, ms); + } + + private native void tunnelAutoDetect(long nativePtr); + @Override + public void tunnelAutoDetect() { + tunnelAutoDetect(nativePtr); + } + + private native void tunnelCleanServers(long nativePtr); + @Override + public void tunnelCleanServers() { + tunnelCleanServers(nativePtr); + } + + private native void tunnelEnable(long nativePtr, boolean enable); + @Override + public void tunnelEnable(boolean enable) { + tunnelEnable(nativePtr, enable); + } + + private native void tunnelEnableLogs(long nativePtr, boolean enable); + @Override + public void tunnelEnableLogs(boolean enable) { + tunnelEnableLogs(nativePtr, enable); + } + + @Override + public native boolean isTunnelAvailable(); } From 7e81d189d0ba19670d6e8a2d36b70934d8b71745 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 30 Dec 2011 17:00:28 +0100 Subject: [PATCH 167/769] Show who is talking in conf view --- LinphoneCallImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 802801155..b2b71dcb5 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -147,4 +147,9 @@ class LinphoneCallImpl implements LinphoneCall { public String toString() { return "Call " + nativePtr; } + + private native float getPlayVolume(long nativePtr); + public float getPlayVolume() { + return getPlayVolume(nativePtr); + } } From 757b973a8d0dab62a4852646c402fb37cfe5f8cf Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 2 Feb 2012 11:30:26 +0100 Subject: [PATCH 168/769] Linphone submodule updated for JNI --- LinphoneCoreImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 5d04d745c..ee91f4f5d 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -88,6 +88,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native String getRing(long nativePtr); private native void setRootCA(long nativePtr, String path); private native long[] listVideoPayloadTypes(long nativePtr); + private native long[] getProxyConfigList(long nativePtr); private native long[] listAudioPayloadTypes(long nativePtr); private native void enableKeepAlive(long nativePtr,boolean enable); private native boolean isKeepAliveEnabled(long nativePtr); @@ -404,6 +405,19 @@ class LinphoneCoreImpl implements LinphoneCore { setRootCA(nativePtr, path); } + public synchronized LinphoneProxyConfig[] getProxyConfigList() { + long[] typesPtr = getProxyConfigList(nativePtr); + if (typesPtr == null) return null; + + LinphoneProxyConfig[] proxies = new LinphoneProxyConfig[typesPtr.length]; + + for (int i=0; i < proxies.length; i++) { + proxies[i] = new LinphoneProxyConfigImpl(typesPtr[i]); + } + + return proxies; + } + public synchronized PayloadType[] getVideoCodecs() { long[] typesPtr = listVideoPayloadTypes(nativePtr); if (typesPtr == null) return null; From 9db10616e2d3d4faa7be6ce08d0b788d12c81708 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 17 Feb 2012 11:30:39 +0100 Subject: [PATCH 169/769] add g729 integration --- LinphoneCoreFactoryImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 39fbeee54..a5ae7805f 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -51,9 +51,12 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { // Tunnel loadOptionalLibrary("tunnelclient"); + + // g729 A implementation + loadOptionalLibrary("bcg729"); //Main library - System.loadLibrary("linphone"); + System.loadLibrary("linphone"); Version.dumpCapabilities(); } From 139e7a49a8f733e112ce60fd645b55ffccb4bef6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 29 Feb 2012 16:55:17 +0100 Subject: [PATCH 170/769] End of JNI export for getRemoteParams, acceptCallWithParams, acceptCallUpdate and deferCallUpdate --- LinphoneCallImpl.java | 5 ++++- LinphoneCoreImpl.java | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index b2b71dcb5..008b19df4 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -29,6 +29,7 @@ class LinphoneCallImpl implements LinphoneCall { native private long getRemoteAddress(long nativePtr); native private int getState(long nativePtr); private native long getCurrentParamsCopy(long nativePtr); + private native long getRemoteParams(long nativePtr); private native void enableCamera(long nativePtr, boolean enabled); private native boolean cameraEnabled(long nativePtr); private native void enableEchoCancellation(long nativePtr,boolean enable); @@ -74,7 +75,9 @@ class LinphoneCallImpl implements LinphoneCall { public LinphoneCallParams getCurrentParamsCopy() { return new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); } - + public LinphoneCallParams getRemoteParams() { + return new LinphoneCallParamsImpl(getRemoteParams(nativePtr)); + } public void enableCamera(boolean enabled) { enableCamera(nativePtr, enabled); } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index ee91f4f5d..f6ee3c835 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -670,4 +670,26 @@ class LinphoneCoreImpl implements LinphoneCore { @Override public native boolean isTunnelAvailable(); + + private native void acceptCallWithParams(long nativePtr, LinphoneCall aCall, + LinphoneCallParams params); + @Override + public void acceptCallWithParams(LinphoneCall aCall, + LinphoneCallParams params) throws LinphoneCoreException { + acceptCallWithParams(nativePtr, aCall, params); + } + + private native void acceptCallUpdate(long nativePtr, LinphoneCall aCall, LinphoneCallParams params); + @Override + public void acceptCallUpdate(LinphoneCall aCall, LinphoneCallParams params) + throws LinphoneCoreException { + acceptCallUpdate(nativePtr, aCall, params); + } + + private native void deferCallUpdate(long nativePtr, LinphoneCall aCall, LinphoneCallParams params); + @Override + public void deferCallUpdate(LinphoneCall aCall, LinphoneCallParams params) + throws LinphoneCoreException { + deferCallUpdate(nativePtr, aCall, params); + } } From 5904cfcc49793e8f5576e6e5ab5bd9a8f3cd85d8 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 1 Mar 2012 12:14:15 +0100 Subject: [PATCH 171/769] Update exosip & linphone submodule + using setVideoPolicy --- LinphoneCoreImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index f6ee3c835..2e79fde95 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -692,4 +692,9 @@ class LinphoneCoreImpl implements LinphoneCore { throws LinphoneCoreException { deferCallUpdate(nativePtr, aCall, params); } + + private native void setVideoPolicy(long nativePtr, boolean autoInitiate, boolean autoAccept); + public void setVideoPolicy(boolean autoInitiate, boolean autoAccept) { + setVideoPolicy(nativePtr, autoInitiate, autoAccept); + } } From 19df41ad738aa1c7b6e8ddcfca7359f67403c7de Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 1 Mar 2012 14:20:21 +0100 Subject: [PATCH 172/769] Updated linphone to match JNI exports --- LinphoneCoreImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 2e79fde95..f58247591 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -686,11 +686,11 @@ class LinphoneCoreImpl implements LinphoneCore { acceptCallUpdate(nativePtr, aCall, params); } - private native void deferCallUpdate(long nativePtr, LinphoneCall aCall, LinphoneCallParams params); + private native void deferCallUpdate(long nativePtr, LinphoneCall aCall); @Override - public void deferCallUpdate(LinphoneCall aCall, LinphoneCallParams params) + public void deferCallUpdate(LinphoneCall aCall) throws LinphoneCoreException { - deferCallUpdate(nativePtr, aCall, params); + deferCallUpdate(nativePtr, aCall); } private native void setVideoPolicy(long nativePtr, boolean autoInitiate, boolean autoAccept); From f2d47eda42438d65c8d248d20e6e2429106b9630 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 7 Mar 2012 13:49:16 +0100 Subject: [PATCH 173/769] Fixed JNI pointers --- LinphoneCoreImpl.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index f58247591..8e2a83008 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -568,6 +568,10 @@ class LinphoneCoreImpl implements LinphoneCore { private long getCallPtr(LinphoneCall call) { return ((LinphoneCallImpl)call).nativePtr; } + + private long getCallParamsPtr(LinphoneCallParams callParams) { + return ((LinphoneCallParamsImpl)callParams).nativePtr; + } private native int transferCall(long nativePtr, long callPtr, String referTo); public synchronized void transferCall(LinphoneCall call, String referTo) { @@ -671,26 +675,26 @@ class LinphoneCoreImpl implements LinphoneCore { @Override public native boolean isTunnelAvailable(); - private native void acceptCallWithParams(long nativePtr, LinphoneCall aCall, - LinphoneCallParams params); + private native void acceptCallWithParams(long nativePtr, long aCall, + long params); @Override public void acceptCallWithParams(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException { - acceptCallWithParams(nativePtr, aCall, params); + acceptCallWithParams(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); } - private native void acceptCallUpdate(long nativePtr, LinphoneCall aCall, LinphoneCallParams params); + private native void acceptCallUpdate(long nativePtr, long aCall, long params); @Override public void acceptCallUpdate(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException { - acceptCallUpdate(nativePtr, aCall, params); + acceptCallUpdate(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); } - private native void deferCallUpdate(long nativePtr, LinphoneCall aCall); + private native void deferCallUpdate(long nativePtr, long aCall); @Override public void deferCallUpdate(LinphoneCall aCall) throws LinphoneCoreException { - deferCallUpdate(nativePtr, aCall); + deferCallUpdate(nativePtr, getCallPtr(aCall)); } private native void setVideoPolicy(long nativePtr, boolean autoInitiate, boolean autoAccept); From 571948eb7d11f318ff8d158658889daab4cb932a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 8 Mar 2012 16:04:20 +0100 Subject: [PATCH 174/769] Dynamic video with asking dependings on the settings + linphone submodule updated --- LinphoneCoreImpl.java | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 8e2a83008..b79d19306 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -589,21 +589,21 @@ class LinphoneCoreImpl implements LinphoneCore { return (LinphoneCall) findCallFromUri(nativePtr, uri); } - public MediaEncryption getMediaEncryption() { + public synchronized MediaEncryption getMediaEncryption() { return MediaEncryption.fromInt(getMediaEncryption(nativePtr)); } - public boolean isMediaEncryptionMandatory() { + public synchronized boolean isMediaEncryptionMandatory() { return isMediaEncryptionMandatory(nativePtr); } - public void setMediaEncryption(MediaEncryption menc) { + public synchronized void setMediaEncryption(MediaEncryption menc) { setMediaEncryption(nativePtr, menc.mValue); } - public void setMediaEncryptionMandatory(boolean yesno) { + public synchronized void setMediaEncryptionMandatory(boolean yesno) { setMediaEncryptionMandatory(nativePtr, yesno); } private native int getMaxCalls(long nativePtr); - public int getMaxCalls() { + public synchronized int getMaxCalls() { return getMaxCalls(nativePtr); } @Override @@ -614,61 +614,61 @@ class LinphoneCoreImpl implements LinphoneCore { } private native boolean soundResourcesLocked(long nativePtr); - public boolean soundResourcesLocked() { + public synchronized boolean soundResourcesLocked() { return soundResourcesLocked(nativePtr); } private native void setMaxCalls(long nativePtr, int max); @Override - public void setMaxCalls(int max) { + public synchronized void setMaxCalls(int max) { setMaxCalls(nativePtr, max); } private native boolean isEchoLimiterEnabled(long nativePtr); @Override - public boolean isEchoLimiterEnabled() { + public synchronized boolean isEchoLimiterEnabled() { return isEchoLimiterEnabled(nativePtr); } private native boolean mediaEncryptionSupported(long nativePtr, int menc); @Override - public boolean mediaEncryptionSupported(MediaEncryption menc) { + public synchronized boolean mediaEncryptionSupported(MediaEncryption menc) { return mediaEncryptionSupported(nativePtr,menc.mValue); } private native void setPlayFile(long nativePtr, String path); @Override - public void setPlayFile(String path) { + public synchronized void setPlayFile(String path) { setPlayFile(nativePtr, path); } private native void tunnelAddServerAndMirror(long nativePtr, String host, int port, int mirror, int ms); @Override - public void tunnelAddServerAndMirror(String host, int port, int mirror, int ms) { + public synchronized void tunnelAddServerAndMirror(String host, int port, int mirror, int ms) { tunnelAddServerAndMirror(nativePtr, host, port, mirror, ms); } private native void tunnelAutoDetect(long nativePtr); @Override - public void tunnelAutoDetect() { + public synchronized void tunnelAutoDetect() { tunnelAutoDetect(nativePtr); } private native void tunnelCleanServers(long nativePtr); @Override - public void tunnelCleanServers() { + public synchronized void tunnelCleanServers() { tunnelCleanServers(nativePtr); } private native void tunnelEnable(long nativePtr, boolean enable); @Override - public void tunnelEnable(boolean enable) { + public synchronized void tunnelEnable(boolean enable) { tunnelEnable(nativePtr, enable); } private native void tunnelEnableLogs(long nativePtr, boolean enable); @Override - public void tunnelEnableLogs(boolean enable) { + public synchronized void tunnelEnableLogs(boolean enable) { tunnelEnableLogs(nativePtr, enable); } @@ -678,27 +678,27 @@ class LinphoneCoreImpl implements LinphoneCore { private native void acceptCallWithParams(long nativePtr, long aCall, long params); @Override - public void acceptCallWithParams(LinphoneCall aCall, + public synchronized void acceptCallWithParams(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException { acceptCallWithParams(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); } private native void acceptCallUpdate(long nativePtr, long aCall, long params); @Override - public void acceptCallUpdate(LinphoneCall aCall, LinphoneCallParams params) + public synchronized void acceptCallUpdate(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException { acceptCallUpdate(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); } private native void deferCallUpdate(long nativePtr, long aCall); @Override - public void deferCallUpdate(LinphoneCall aCall) + public synchronized void deferCallUpdate(LinphoneCall aCall) throws LinphoneCoreException { deferCallUpdate(nativePtr, getCallPtr(aCall)); } private native void setVideoPolicy(long nativePtr, boolean autoInitiate, boolean autoAccept); - public void setVideoPolicy(boolean autoInitiate, boolean autoAccept) { + public synchronized void setVideoPolicy(boolean autoInitiate, boolean autoAccept) { setVideoPolicy(nativePtr, autoInitiate, autoAccept); } } From 623c8c7ef8ff9b5297762fbbaef0b3e5676e93e9 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 13 Mar 2012 22:05:41 +0100 Subject: [PATCH 175/769] add setUserAgent() method. --- LinphoneCoreImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index b79d19306..939a022d2 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -701,4 +701,9 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setVideoPolicy(boolean autoInitiate, boolean autoAccept) { setVideoPolicy(nativePtr, autoInitiate, autoAccept); } + private native void setUserAgent(long nativePtr, String name, String version); + @Override + public void setUserAgent(String name, String version) { + setUserAgent(nativePtr,name,version); + } } From 0116f4b2d382847c0affec699b4bb8057a98d7cd Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 22 Mar 2012 10:37:56 +0100 Subject: [PATCH 176/769] ms_set_cpu_count exported via JNI --- coreapi/linphonecore_jni.cc | 4 ++++ java/common/org/linphone/core/LinphoneCore.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 9abb9caa5..bc4f6a14e 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1705,3 +1705,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPolicy(JNIEnv *e vpol.automatically_accept = autoAccept; linphone_core_set_video_policy((LinphoneCore *)lc, &vpol); } + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCount(JNIEnv *env, jobject thiz, jint count) { + ms_set_cpu_count(count); +} diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 9b9ec8cf8..88db6a590 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -761,4 +761,6 @@ public interface LinphoneCore { void setVideoPolicy(boolean autoInitiate, boolean autoAccept); void setUserAgent(String name, String version); + + void setCpuCount(int count); } From 34092444ca7a6f539f6ea742c0aa9cd33e0e01f7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 22 Mar 2012 11:35:01 +0100 Subject: [PATCH 177/769] fix stupid mistake in es translation --- po/es.po | 4054 +++++++++++++++++++++++++++--------------------------- 1 file changed, 2027 insertions(+), 2027 deletions(-) diff --git a/po/es.po b/po/es.po index f87483dee..04d7a3c3b 100644 --- a/po/es.po +++ b/po/es.po @@ -2,2030 +2,2030 @@ # Copyright (C) YEAR Free Software Foundation, Inc. # FIRST AUTHOR , YEAR. # -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Linphone 0.9.1\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-12-05 12:41+0100\n" -"PO-Revision-Date: 2002-10-15 HO:MI+ZONE\n" -"Last-Translator: Nelson Benitez \n" -"Language-Team: es \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../gtk/calllogs.c:71 -#, c-format -msgid "%i minute" -msgid_plural "%i minutes" -msgstr[0] "" -msgstr[1] "" - -#: ../gtk/calllogs.c:74 -#, c-format -msgid "%i second" -msgid_plural "%i seconds" -msgstr[0] "" -msgstr[1] "" - -#: ../gtk/calllogs.c:77 -#, c-format -msgid "" -"%s\t%s\tQuality: %s\n" -"%s\t%s %s\t" -msgstr "" - -#: ../gtk/calllogs.c:79 -msgid "n/a" -msgstr "" - -#: ../gtk/conference.c:33 ../gtk/incall_view.c:183 -msgid "Conference" -msgstr "" - -#: ../gtk/conference.c:41 -msgid "Me" -msgstr "" - -#: ../gtk/support.c:49 ../gtk/support.c:73 ../gtk/support.c:102 -#, c-format -msgid "Couldn't find pixmap file: %s" -msgstr "No se pudo encontrar el archivo pixmap: %s" - -#: ../gtk/chat.c:27 -#, c-format -msgid "Chat with %s" -msgstr "" - -#: ../gtk/main.c:83 -msgid "log to stdout some debug information while running." -msgstr "" - -#: ../gtk/main.c:90 -msgid "path to a file to write logs into." -msgstr "" - -#: ../gtk/main.c:97 -msgid "Start only in the system tray, do not show the main interface." -msgstr "" - -#: ../gtk/main.c:104 -msgid "address to call right now" -msgstr "" - -#: ../gtk/main.c:111 -msgid "if set automatically answer incoming calls" -msgstr "" - -#: ../gtk/main.c:118 -msgid "" -"Specifiy a working directory (should be the base of the installation, eg: c:" -"\\Program Files\\Linphone)" -msgstr "" - -#: ../gtk/main.c:464 -#, c-format -msgid "Call with %s" -msgstr "" - -#: ../gtk/main.c:815 -#, c-format -msgid "" -"%s would like to add you to his contact list.\n" -"Would you allow him to see your presence status or add him to your contact " -"list ?\n" -"If you answer no, this person will be temporarily blacklisted." -msgstr "" - -#: ../gtk/main.c:893 -#, c-format -msgid "" -"Please enter your password for username %s\n" -" at domain %s:" -msgstr "" - -#: ../gtk/main.c:993 -#, fuzzy -msgid "Call error" -msgstr "Llamada cancelada." - -#: ../gtk/main.c:996 ../coreapi/linphonecore.c:2406 -#, fuzzy -msgid "Call ended" -msgstr "Llamada cancelada." - -#: ../gtk/main.c:999 ../coreapi/linphonecore.c:199 -msgid "Incoming call" -msgstr "" - -#: ../gtk/main.c:1001 ../gtk/incall_view.c:292 ../gtk/main.ui.h:20 -msgid "Answer" -msgstr "" - -#: ../gtk/main.c:1003 ../gtk/main.ui.h:29 -#, fuzzy -msgid "Decline" -msgstr "linea" - -#: ../gtk/main.c:1009 -#, fuzzy -msgid "Call paused" -msgstr "Llamada cancelada." - -#: ../gtk/main.c:1009 -#, c-format -msgid "by %s" -msgstr "" - -#: ../gtk/main.c:1165 -msgid "Website link" -msgstr "" - -#: ../gtk/main.c:1205 -msgid "Linphone - a video internet phone" -msgstr "" - -#: ../gtk/main.c:1295 -#, c-format -msgid "%s (Default)" -msgstr "" - -#: ../gtk/main.c:1566 ../coreapi/callbacks.c:700 -#, c-format -msgid "We are transferred to %s" -msgstr "" - -#: ../gtk/main.c:1576 -msgid "" -"No sound cards have been detected on this computer.\n" -"You won't be able to send or receive audio calls." -msgstr "" - -#: ../gtk/main.c:1663 -msgid "A free SIP video-phone" -msgstr "" - -#: ../gtk/friendlist.c:203 -#, fuzzy -msgid "Add to addressbook" -msgstr "Agenda" - -#: ../gtk/friendlist.c:258 ../gtk/propertybox.c:296 ../gtk/contact.ui.h:3 -msgid "Name" -msgstr "Nombre" - -#: ../gtk/friendlist.c:271 -#, fuzzy -msgid "Presence status" -msgstr "Estado" - -#: ../gtk/friendlist.c:308 -#, c-format -msgid "Search in %s directory" -msgstr "" - -#: ../gtk/friendlist.c:568 -msgid "Invalid sip contact !" -msgstr "" - -#: ../gtk/friendlist.c:613 -#, c-format -msgid "Call %s" -msgstr "" - -#: ../gtk/friendlist.c:614 -#, c-format -msgid "Send text to %s" -msgstr "" - -#: ../gtk/friendlist.c:615 -#, fuzzy, c-format -msgid "Edit contact '%s'" -msgstr "(Ninguna informacion de contacto !)" - -#: ../gtk/friendlist.c:616 -#, c-format -msgid "Delete contact '%s'" -msgstr "" - -#: ../gtk/friendlist.c:658 -#, c-format -msgid "Add new contact from %s directory" -msgstr "" - -#: ../gtk/propertybox.c:302 -msgid "Rate (Hz)" -msgstr "" - -#: ../gtk/propertybox.c:308 -msgid "Status" -msgstr "Estado" - -#: ../gtk/propertybox.c:314 -msgid "Min bitrate (kbit/s)" -msgstr "" - -#: ../gtk/propertybox.c:321 -msgid "Parameters" -msgstr "Parametros" - -#: ../gtk/propertybox.c:364 ../gtk/propertybox.c:507 -msgid "Enabled" -msgstr "Activado" - -#: ../gtk/propertybox.c:366 ../gtk/propertybox.c:507 -msgid "Disabled" -msgstr "Desactivado" - -#: ../gtk/propertybox.c:553 -msgid "Account" -msgstr "" - -#: ../gtk/propertybox.c:693 -msgid "English" -msgstr "" - -#: ../gtk/propertybox.c:694 -msgid "French" -msgstr "" - -#: ../gtk/propertybox.c:695 -msgid "Swedish" -msgstr "" - -#: ../gtk/propertybox.c:696 -msgid "Italian" -msgstr "" - -#: ../gtk/propertybox.c:697 -msgid "Spanish" -msgstr "" - -#: ../gtk/propertybox.c:698 -msgid "Brazilian Portugese" -msgstr "" - -#: ../gtk/propertybox.c:699 -msgid "Polish" -msgstr "" - -#: ../gtk/propertybox.c:700 -msgid "German" -msgstr "" - -#: ../gtk/propertybox.c:701 -msgid "Russian" -msgstr "" - -#: ../gtk/propertybox.c:702 -msgid "Japanese" -msgstr "" - -#: ../gtk/propertybox.c:703 -msgid "Dutch" -msgstr "" - -#: ../gtk/propertybox.c:704 -msgid "Hungarian" -msgstr "" - -#: ../gtk/propertybox.c:705 -msgid "Czech" -msgstr "" - -#: ../gtk/propertybox.c:706 -msgid "Chinese" -msgstr "" - -#: ../gtk/propertybox.c:707 -msgid "Traditional Chinese" -msgstr "" - -#: ../gtk/propertybox.c:708 -msgid "Norwegian" -msgstr "" - -#: ../gtk/propertybox.c:765 -msgid "" -"You need to restart linphone for the new language selection to take effect." -msgstr "" - -#: ../gtk/propertybox.c:835 -#, fuzzy -msgid "None" -msgstr "Ninguno." - -#: ../gtk/propertybox.c:839 -msgid "SRTP" -msgstr "" - -#: ../gtk/propertybox.c:845 -msgid "ZRTP" -msgstr "" - -#: ../gtk/update.c:80 -#, c-format -msgid "" -"A more recent version is availalble from %s.\n" -"Would you like to open a browser to download it ?" -msgstr "" - -#: ../gtk/update.c:91 -msgid "You are running the lastest version." -msgstr "" - -#: ../gtk/buddylookup.c:85 -msgid "Firstname, Lastname" -msgstr "" - -#: ../gtk/buddylookup.c:160 -msgid "Error communicating with server." -msgstr "" - -#: ../gtk/buddylookup.c:164 -#, fuzzy -msgid "Connecting..." -msgstr "Conexion" - -#: ../gtk/buddylookup.c:168 -#, fuzzy -msgid "Connected" -msgstr "Conectado." - -#: ../gtk/buddylookup.c:172 -msgid "Receiving data..." -msgstr "" - -#: ../gtk/buddylookup.c:180 -#, c-format -msgid "Found %i contact" -msgid_plural "Found %i contacts" -msgstr[0] "" -msgstr[1] "" - -#: ../gtk/setupwizard.c:25 -msgid "" -"Welcome !\n" -"This assistant will help you to use a SIP account for your calls." -msgstr "" - -#: ../gtk/setupwizard.c:34 -msgid "Create an account by choosing a username" -msgstr "" - -#: ../gtk/setupwizard.c:35 -msgid "I have already an account and just want to use it" -msgstr "" - -#: ../gtk/setupwizard.c:53 -msgid "Please choose a username:" -msgstr "" - -#: ../gtk/setupwizard.c:54 -#, fuzzy -msgid "Username:" -msgstr "Manual de Usuario" - -#: ../gtk/setupwizard.c:92 -#, c-format -msgid "Checking if '%s' is available..." -msgstr "" - -#: ../gtk/setupwizard.c:97 ../gtk/setupwizard.c:164 -msgid "Please wait..." -msgstr "" - -#: ../gtk/setupwizard.c:101 -msgid "Sorry this username already exists. Please try a new one." -msgstr "" - -#: ../gtk/setupwizard.c:103 ../gtk/setupwizard.c:168 -msgid "Ok !" -msgstr "" - -#: ../gtk/setupwizard.c:106 ../gtk/setupwizard.c:171 -msgid "Communication problem, please try again later." -msgstr "" - -#: ../gtk/setupwizard.c:134 -msgid "Thank you. Your account is now configured and ready for use." -msgstr "" - -#: ../gtk/setupwizard.c:228 -msgid "Welcome to the account setup assistant" -msgstr "" - -#: ../gtk/setupwizard.c:232 -msgid "Account setup assistant" -msgstr "" - -#: ../gtk/setupwizard.c:236 -msgid "Choosing a username" -msgstr "" - -#: ../gtk/setupwizard.c:240 -msgid "Verifying" -msgstr "" - -#: ../gtk/setupwizard.c:244 -#, fuzzy -msgid "Confirmation" -msgstr "Informacion" - -#: ../gtk/setupwizard.c:249 -msgid "Creating your account" -msgstr "" - -#: ../gtk/setupwizard.c:253 -msgid "Now ready !" -msgstr "" - -#: ../gtk/incall_view.c:69 -#, fuzzy, c-format -msgid "Call #%i" -msgstr "Llamada cancelada." - -#: ../gtk/incall_view.c:127 -#, c-format -msgid "Transfer to call #%i with %s" -msgstr "" - -#: ../gtk/incall_view.c:155 -msgid "Transfer" -msgstr "" - -#: ../gtk/incall_view.c:271 -#, fuzzy -msgid "Calling..." -msgstr "Contactando " - -#: ../gtk/incall_view.c:274 ../gtk/incall_view.c:482 -msgid "00::00::00" -msgstr "" - -#: ../gtk/incall_view.c:285 -#, fuzzy -msgid "Incoming call" -msgstr "Contactando " - -#: ../gtk/incall_view.c:322 -msgid "good" -msgstr "" - -#: ../gtk/incall_view.c:324 -msgid "average" -msgstr "" - -#: ../gtk/incall_view.c:326 -msgid "poor" -msgstr "" - -#: ../gtk/incall_view.c:328 -msgid "very poor" -msgstr "" - -#: ../gtk/incall_view.c:330 -msgid "too bad" -msgstr "" - -#: ../gtk/incall_view.c:331 ../gtk/incall_view.c:347 -msgid "unavailable" -msgstr "" - -#: ../gtk/incall_view.c:447 -msgid "Secured by SRTP" -msgstr "" - -#: ../gtk/incall_view.c:453 -#, c-format -msgid "Secured by ZRTP - [auth token: %s]" -msgstr "" - -#: ../gtk/incall_view.c:459 -msgid "Set unverified" -msgstr "" - -#: ../gtk/incall_view.c:459 ../gtk/main.ui.h:49 -msgid "Set verified" -msgstr "" - -#: ../gtk/incall_view.c:480 -msgid "In conference" -msgstr "" - -#: ../gtk/incall_view.c:480 -#, fuzzy -msgid "In call" -msgstr "Contactando " - -#: ../gtk/incall_view.c:499 -#, fuzzy -msgid "Paused call" -msgstr "Contactando " - -#: ../gtk/incall_view.c:511 -#, c-format -msgid "%02i::%02i::%02i" -msgstr "" - -#: ../gtk/incall_view.c:527 -#, fuzzy -msgid "Call ended." -msgstr "Llamada cancelada." - -#: ../gtk/incall_view.c:584 -msgid "Resume" -msgstr "" - -#: ../gtk/incall_view.c:591 ../gtk/main.ui.h:45 -msgid "Pause" -msgstr "" - -#: ../gtk/loginframe.c:93 -#, c-format -msgid "Please enter login information for %s" -msgstr "" - -#: ../gtk/main.ui.h:1 -msgid "#" -msgstr "#" - -#: ../gtk/main.ui.h:2 -msgid "*" -msgstr "*" - -#: ../gtk/main.ui.h:3 -msgid "0" -msgstr "0" - -#: ../gtk/main.ui.h:4 -msgid "1" -msgstr "1" - -#: ../gtk/main.ui.h:5 -msgid "2" -msgstr "2" - -#: ../gtk/main.ui.h:6 -msgid "3" -msgstr "3" - -#: ../gtk/main.ui.h:7 -msgid "4" -msgstr "4" - -#: ../gtk/main.ui.h:8 -msgid "5" -msgstr "10" - -#: ../gtk/main.ui.h:9 -msgid "6" -msgstr "6" - -#: ../gtk/main.ui.h:10 -msgid "7" -msgstr "7" - -#: ../gtk/main.ui.h:11 -msgid "8" -msgstr "8" - -#: ../gtk/main.ui.h:12 -msgid "9" -msgstr "9" - -#: ../gtk/main.ui.h:13 -#, fuzzy -msgid "Add contacts from directory" -msgstr "Informacion de codec" - -#: ../gtk/main.ui.h:14 -#, fuzzy -msgid "Callee name" -msgstr "Llamada cancelada." - -#: ../gtk/main.ui.h:15 -#, fuzzy -msgid "Welcome !" -msgstr "Contactando " - -#: ../gtk/main.ui.h:16 -msgid "A" -msgstr "" - -#: ../gtk/main.ui.h:17 -msgid "ADSL" -msgstr "" - -#: ../gtk/main.ui.h:18 -#, fuzzy -msgid "Add contact" -msgstr "(Ninguna informacion de contacto !)" - -#: ../gtk/main.ui.h:19 -msgid "All users" -msgstr "" - -#: ../gtk/main.ui.h:21 -msgid "Automatically log me in" -msgstr "" - -#: ../gtk/main.ui.h:22 -msgid "B" -msgstr "" - -#: ../gtk/main.ui.h:23 ../gtk/parameters.ui.h:21 -msgid "C" -msgstr "" - -#: ../gtk/main.ui.h:24 -#, fuzzy -msgid "Call" -msgstr "Llamada cancelada." - -#: ../gtk/main.ui.h:25 -msgid "Call quality rating" -msgstr "" - -#: ../gtk/main.ui.h:26 -msgid "Check _Updates" -msgstr "" - -#: ../gtk/main.ui.h:27 -#, fuzzy -msgid "Contacts" -msgstr "Contactando " - -#: ../gtk/main.ui.h:28 -msgid "D" -msgstr "" - -#: ../gtk/main.ui.h:30 -#, fuzzy -msgid "Default" -msgstr "Identidad" - -#: ../gtk/main.ui.h:31 -#, fuzzy -msgid "Duration" -msgstr "Informacion" - -#: ../gtk/main.ui.h:32 -#, fuzzy -msgid "Enable self-view" -msgstr "Activado" - -#: ../gtk/main.ui.h:33 -#, fuzzy -msgid "Enable video" -msgstr "Activado" - -#: ../gtk/main.ui.h:34 -msgid "Enter username, phone number, or full sip address" -msgstr "" - -#: ../gtk/main.ui.h:35 -msgid "Fiber Channel" -msgstr "" - -#: ../gtk/main.ui.h:36 -#, fuzzy -msgid "In call" -msgstr "Contactando " - -#: ../gtk/main.ui.h:37 -msgid "Initiate a new call" -msgstr "" - -#: ../gtk/main.ui.h:38 -msgid "Internet connection:" -msgstr "" - -#: ../gtk/main.ui.h:39 -msgid "Keypad" -msgstr "" - -#: ../gtk/main.ui.h:40 -#, fuzzy -msgid "Login information" -msgstr "Informacion de codec" - -#: ../gtk/main.ui.h:41 -msgid "Lookup:" -msgstr "" - -#: ../gtk/main.ui.h:42 -#, fuzzy -msgid "My current identity:" -msgstr "Identidad" - -#: ../gtk/main.ui.h:43 -#, fuzzy -msgid "Online users" -msgstr "linea" - -#: ../gtk/main.ui.h:44 -#, fuzzy -msgid "Password" -msgstr "Tu Contraseña:" - -#: ../gtk/main.ui.h:46 -#, fuzzy -msgid "Recent calls" -msgstr "Contactando " - -#: ../gtk/main.ui.h:47 -#, fuzzy -msgid "SIP address or phone number:" -msgstr "La direccion SIP del servidor de registro." - -#: ../gtk/main.ui.h:48 -msgid "Search" -msgstr "" - -#: ../gtk/main.ui.h:50 -#, fuzzy -msgid "Show debug window" -msgstr "Linphone esta terminando..." - -#: ../gtk/main.ui.h:51 -#, fuzzy -msgid "Username" -msgstr "Manual de Usuario" - -#: ../gtk/main.ui.h:52 -msgid "_Help" -msgstr "" - -#: ../gtk/main.ui.h:53 -msgid "_Homepage" -msgstr "" - -#: ../gtk/main.ui.h:54 -msgid "_Options" -msgstr "" - -#: ../gtk/main.ui.h:55 -msgid "in" -msgstr "" - -#: ../gtk/main.ui.h:56 -msgid "label" -msgstr "" - -#: ../gtk/about.ui.h:1 -msgid "(C) Belledonne Communications,2010\n" -msgstr "" - -#: ../gtk/about.ui.h:3 -#, fuzzy -msgid "About linphone" -msgstr "linphone" - -#: ../gtk/about.ui.h:4 -msgid "An internet video phone using the standard SIP (rfc3261) protocol." -msgstr "" - -#: ../gtk/about.ui.h:5 -msgid "" -"fr: Simon Morlat\n" -"en: Simon Morlat and Delphine Perreau\n" -"it: Alberto Zanoni \n" -"de: Jean-Jacques Sarton \n" -"sv: Daniel Nylander \n" -"es: Jesus Benitez \n" -"ja: YAMAGUCHI YOSHIYA \n" -"pt_BR: Rafael Caesar Lenzi \n" -"pl: Robert Nasiadek \n" -"cs: Petr Pisar \n" -"hu: anonymous\n" -msgstr "" - -#: ../gtk/contact.ui.h:1 -#, fuzzy -msgid "Contact information" -msgstr "Informacion de codec" - -#: ../gtk/contact.ui.h:2 -msgid "Allow this contact to see my presence status" -msgstr "" - -#: ../gtk/contact.ui.h:4 -#, fuzzy -msgid "SIP Address" -msgstr "Direccion" - -#: ../gtk/contact.ui.h:5 -msgid "Show this contact presence status" -msgstr "" - -#: ../gtk/log.ui.h:1 -#, fuzzy -msgid "Linphone debug window" -msgstr "Linphone esta terminando..." - -#: ../gtk/password.ui.h:1 -#, fuzzy -msgid "Linphone - Authentication required" -msgstr "Informacion de codec" - -#: ../gtk/password.ui.h:2 -#, fuzzy -msgid "Password:" -msgstr "Tu Contraseña:" - -#: ../gtk/password.ui.h:3 -msgid "Please enter the domain password" -msgstr "" - -#: ../gtk/password.ui.h:4 -msgid "UserID" -msgstr "" - -#: ../gtk/call_logs.ui.h:1 -msgid "Call back" -msgstr "" - -#: ../gtk/call_logs.ui.h:2 -msgid "Call history" -msgstr "" - -#: ../gtk/call_logs.ui.h:3 -msgid "Clear all" -msgstr "" - -#: ../gtk/sip_account.ui.h:1 -msgid "Configure a SIP account" -msgstr "" - -#: ../gtk/sip_account.ui.h:2 -msgid "Linphone - Configure a SIP account" -msgstr "" - -#: ../gtk/sip_account.ui.h:3 -msgid "Looks like sip:" -msgstr "" - -#: ../gtk/sip_account.ui.h:4 -msgid "Looks like sip:@" -msgstr "" - -#: ../gtk/sip_account.ui.h:5 -#, fuzzy -msgid "Publish presence information" -msgstr "Informacion de codec" - -#: ../gtk/sip_account.ui.h:6 -msgid "Register" -msgstr "" - -#: ../gtk/sip_account.ui.h:7 -#, fuzzy -msgid "Registration duration (sec):" -msgstr "Se ha registrado con exito." - -#: ../gtk/sip_account.ui.h:8 -msgid "Route (optional):" -msgstr "" - -#: ../gtk/sip_account.ui.h:9 -#, fuzzy -msgid "SIP Proxy address:" -msgstr "Direccion SIP" - -#: ../gtk/sip_account.ui.h:10 -#, fuzzy -msgid "Your SIP identity:" -msgstr "Identidad" - -#: ../gtk/sip_account.ui.h:11 -msgid "sip:" -msgstr "SIP:" - -#: ../gtk/chatroom.ui.h:1 -#, fuzzy -msgid "Send" -msgstr "Sonido" - -#: ../gtk/parameters.ui.h:1 -msgid "0 stands for \"unlimited\"" -msgstr "" - -#: ../gtk/parameters.ui.h:2 -#, fuzzy -msgid "Audio" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:3 -msgid "Bandwidth control" -msgstr "" - -#: ../gtk/parameters.ui.h:4 -#, fuzzy -msgid "Codecs" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:5 -#, fuzzy -msgid "Default identity" -msgstr "Identidad" - -#: ../gtk/parameters.ui.h:6 -#, fuzzy -msgid "Language" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:7 -#, fuzzy -msgid "Level" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:8 -#, fuzzy -msgid "NAT and Firewall" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:9 -msgid "Network protocol and ports" -msgstr "" - -#: ../gtk/parameters.ui.h:10 -#, fuzzy -msgid "Privacy" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:11 -#, fuzzy -msgid "Proxy accounts" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:12 -#, fuzzy -msgid "Transport" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:13 -#, fuzzy -msgid "Video" -msgstr "Contactando " - -#: ../gtk/parameters.ui.h:14 -msgid "" -"Adaptive rate control is a technique to dynamically guess the available " -"bandwidth during a call." -msgstr "" - -#: ../gtk/parameters.ui.h:15 -msgid "ALSA special device (optional):" -msgstr "" - -#: ../gtk/parameters.ui.h:16 -msgid "Add" -msgstr "Añadir" - -#: ../gtk/parameters.ui.h:17 -msgid "Audio RTP/UDP:" -msgstr "" - -#: ../gtk/parameters.ui.h:18 -#, fuzzy -msgid "Audio codecs" -msgstr "Propiedades del codec de Audio" - -#: ../gtk/parameters.ui.h:19 -msgid "Behind NAT / Firewall (specify gateway IP below)" -msgstr "" - -#: ../gtk/parameters.ui.h:20 -msgid "Behind NAT / Firewall (use STUN to resolve)" -msgstr "" - -#: ../gtk/parameters.ui.h:22 -msgid "CIF" -msgstr "" - -#: ../gtk/parameters.ui.h:23 -#, fuzzy -msgid "Capture device:" -msgstr "Usar dispositivo de sonido:" - -#: ../gtk/parameters.ui.h:24 -#, fuzzy -msgid "Codecs" -msgstr "Codecs" - -#: ../gtk/parameters.ui.h:25 -msgid "Direct connection to the Internet" -msgstr "" - -#: ../gtk/parameters.ui.h:26 -msgid "Disable" -msgstr "Desactivado" - -#: ../gtk/parameters.ui.h:27 -#, fuzzy -msgid "Done" -msgstr "Ninguno." - -#: ../gtk/parameters.ui.h:28 -msgid "Download speed limit in Kbit/sec:" -msgstr "" - -#: ../gtk/parameters.ui.h:29 -msgid "Edit" -msgstr "" - -#: ../gtk/parameters.ui.h:30 -msgid "Enable" -msgstr "Activado" - -#: ../gtk/parameters.ui.h:31 -msgid "Enable adaptive rate control" -msgstr "" - -#: ../gtk/parameters.ui.h:32 -msgid "Enable echo cancellation" -msgstr "" - -#: ../gtk/parameters.ui.h:33 -msgid "Erase all passwords" -msgstr "" - -#: ../gtk/parameters.ui.h:34 -msgid "Manage SIP Accounts" -msgstr "" - -#: ../gtk/parameters.ui.h:35 -msgid "Media encryption type" -msgstr "" - -#: ../gtk/parameters.ui.h:36 -msgid "Multimedia settings" -msgstr "" - -#: ../gtk/parameters.ui.h:37 -#, fuzzy -msgid "Network settings" -msgstr "Red" - -#: ../gtk/parameters.ui.h:38 -#, fuzzy -msgid "Playback device:" -msgstr "Usar dispositivo de sonido:" - -#: ../gtk/parameters.ui.h:39 -msgid "Prefered video resolution:" -msgstr "" - -#: ../gtk/parameters.ui.h:40 -#, fuzzy -msgid "Public IP address:" -msgstr "Direccion SIP" - -#: ../gtk/parameters.ui.h:41 -msgid "" -"Register to FONICS\n" -"virtual network !" -msgstr "" - -#: ../gtk/parameters.ui.h:43 -msgid "Remove" -msgstr "Borrar" - -#: ../gtk/parameters.ui.h:44 -#, fuzzy -msgid "Ring device:" -msgstr "Usar dispositivo de sonido:" - -#: ../gtk/parameters.ui.h:45 -#, fuzzy -msgid "Ring sound:" -msgstr "Fuente de grabacion:" - -#: ../gtk/parameters.ui.h:46 -msgid "SIP (TCP)" -msgstr "" - -#: ../gtk/parameters.ui.h:47 -msgid "SIP (TLS)" -msgstr "" - -#: ../gtk/parameters.ui.h:48 -msgid "SIP (UDP)" -msgstr "" - -#: ../gtk/parameters.ui.h:49 -msgid "Send DTMFs as SIP info" -msgstr "" - -#: ../gtk/parameters.ui.h:50 -msgid "Set Maximum Transmission Unit:" -msgstr "" - -#: ../gtk/parameters.ui.h:51 -msgid "Settings" -msgstr "" - -#: ../gtk/parameters.ui.h:52 -msgid "Show advanced settings" -msgstr "" - -#: ../gtk/parameters.ui.h:53 -#, fuzzy -msgid "Stun server:" -msgstr "Servidor de Redireccionamiento" - -#: ../gtk/parameters.ui.h:54 -msgid "This section defines your SIP address when not using a SIP account" -msgstr "" - -#: ../gtk/parameters.ui.h:55 -msgid "Upload speed limit in Kbit/sec:" -msgstr "" - -#: ../gtk/parameters.ui.h:56 -msgid "Use IPv6 instead of IPv4" -msgstr "" - -#: ../gtk/parameters.ui.h:57 -#, fuzzy -msgid "User interface" -msgstr "Manual de Usuario" - -#: ../gtk/parameters.ui.h:58 -msgid "Video RTP/UDP:" -msgstr "" - -#: ../gtk/parameters.ui.h:59 -#, fuzzy -msgid "Video codecs" -msgstr "Propiedades del codec de Audio" - -#: ../gtk/parameters.ui.h:60 -#, fuzzy -msgid "Video input device:" -msgstr "Usar dispositivo de sonido:" - -#: ../gtk/parameters.ui.h:61 -msgid "Your display name (eg: John Doe):" -msgstr "" - -#: ../gtk/parameters.ui.h:62 -#, fuzzy -msgid "Your resulting SIP address:" -msgstr "Tu direccion SIP:" - -#: ../gtk/parameters.ui.h:63 -#, fuzzy -msgid "Your username:" -msgstr "Manual de Usuario" - -#: ../gtk/parameters.ui.h:64 -msgid "a sound card" -msgstr "" - -#: ../gtk/parameters.ui.h:65 -msgid "default camera" -msgstr "" - -#: ../gtk/parameters.ui.h:66 -msgid "default soundcard" -msgstr "" - -#: ../gtk/buddylookup.ui.h:1 -#, fuzzy -msgid "Search somebody" -msgstr "Contactando " - -#: ../gtk/buddylookup.ui.h:2 -msgid "Add to my list" -msgstr "" - -#: ../gtk/buddylookup.ui.h:3 -#, fuzzy -msgid "Search contacts in directory" -msgstr "Informacion de codec" - -#: ../gtk/waiting.ui.h:1 -#, fuzzy -msgid "Linphone" -msgstr "linphone" - -#: ../gtk/waiting.ui.h:2 -msgid "Please wait" -msgstr "" - -#: ../coreapi/linphonecore.c:187 -msgid "aborted" -msgstr "" - -#: ../coreapi/linphonecore.c:190 -msgid "completed" -msgstr "" - -#: ../coreapi/linphonecore.c:193 -msgid "missed" -msgstr "" - -#: ../coreapi/linphonecore.c:198 -#, c-format -msgid "" -"%s at %s\n" -"From: %s\n" -"To: %s\n" -"Status: %s\n" -"Duration: %i mn %i sec\n" -msgstr "" - -#: ../coreapi/linphonecore.c:199 -msgid "Outgoing call" -msgstr "" - -#: ../coreapi/linphonecore.c:1088 -#, fuzzy -msgid "Ready" -msgstr "Preparado." - -#: ../coreapi/linphonecore.c:1831 -msgid "Looking for telephone number destination..." -msgstr "" - -#: ../coreapi/linphonecore.c:1834 -msgid "Could not resolve this number." -msgstr "" - -#: ../coreapi/linphonecore.c:1878 -#, fuzzy -msgid "" -"Could not parse given sip address. A sip url usually looks like sip:" -"user@domain" -msgstr "" -"Direccion SIP mal escrita. Una direccion SIP es " - -#: ../coreapi/linphonecore.c:2025 -#, fuzzy -msgid "Contacting" -msgstr "Contactando " - -#: ../coreapi/linphonecore.c:2032 -#, fuzzy -msgid "Could not call" -msgstr "No se pudo encontrar el archivo pixmap: %s" - -#: ../coreapi/linphonecore.c:2140 -msgid "Sorry, we have reached the maximum number of simultaneous calls" -msgstr "" - -#: ../coreapi/linphonecore.c:2270 -msgid "Modifying call parameters..." -msgstr "" - -#: ../coreapi/linphonecore.c:2366 -msgid "Connected." -msgstr "Conectado." - -#: ../coreapi/linphonecore.c:2389 -#, fuzzy -msgid "Call aborted" -msgstr "Llamada cancelada." - -#: ../coreapi/linphonecore.c:2530 -msgid "Could not pause the call" -msgstr "" - -#: ../coreapi/linphonecore.c:2535 -msgid "Pausing the current call..." -msgstr "" - -#: ../coreapi/misc.c:147 -msgid "" -"Your computer appears to be using ALSA sound drivers.\n" -"This is the best choice. However the pcm oss emulation module\n" -"is missing and linphone needs it. Please execute\n" -"'modprobe snd-pcm-oss' as root to load it." -msgstr "" -"Tu ordenador parece estar usando los controladores de ALSA.\n" -"Esa es la mejor eleccion. Sin embargo el modulo de emulacion pcm de OSS\n" -"no se encuentra y linphone lo necesita. Por favor ejecute\n" -"'modprobe snd-pcm-oss' como root para cargarlo." - -#: ../coreapi/misc.c:150 -msgid "" -"Your computer appears to be using ALSA sound drivers.\n" -"This is the best choice. However the mixer oss emulation module\n" -"is missing and linphone needs it. Please execute\n" -" 'modprobe snd-mixer-oss' as root to load it." -msgstr "" -"Tu ordenador parece estar usando los controladores de ALSA.\n" -"Esa es la mejor eleccion. Sin embargo el modulo de emulacion mixer de OSS\n" -"no se encuentra y linphone lo necesita. Por favor ejecute\n" -" 'modprobe snd-mixer-oss' como root para cargarlo." - -#: ../coreapi/misc.c:478 -msgid "Stun lookup in progress..." -msgstr "" - -#: ../coreapi/friend.c:33 -#, fuzzy -msgid "Online" -msgstr "linea" - -#: ../coreapi/friend.c:36 -msgid "Busy" -msgstr "" - -#: ../coreapi/friend.c:39 -msgid "Be right back" -msgstr "" - -#: ../coreapi/friend.c:42 -msgid "Away" -msgstr "Ausente" - -#: ../coreapi/friend.c:45 -#, fuzzy -msgid "On the phone" -msgstr "linphone" - -#: ../coreapi/friend.c:48 -msgid "Out to lunch" -msgstr "" - -#: ../coreapi/friend.c:51 -msgid "Do not disturb" -msgstr "No molestar" - -#: ../coreapi/friend.c:54 -#, fuzzy -msgid "Moved" -msgstr "Codecs" - -#: ../coreapi/friend.c:57 -msgid "Using another messaging service" -msgstr "" - -#: ../coreapi/friend.c:60 -#, fuzzy -msgid "Offline" -msgstr "linea" - -#: ../coreapi/friend.c:63 -msgid "Pending" -msgstr "" - -#: ../coreapi/friend.c:66 -msgid "Unknown-bug" -msgstr "" - -#: ../coreapi/proxy.c:192 -msgid "" -"The sip proxy address you entered is invalid, it must start with \"sip:\" " -"followed by a hostname." -msgstr "" - -#: ../coreapi/proxy.c:198 -msgid "" -"The sip identity you entered is invalid.\n" -"It should look like sip:username@proxydomain, such as sip:alice@example.net" -msgstr "" - -#: ../coreapi/proxy.c:690 -#, fuzzy, c-format -msgid "Could not login as %s" -msgstr "No se pudo encontrar el archivo pixmap: %s" - -#: ../coreapi/callbacks.c:206 -#, fuzzy -msgid "is contacting you" -msgstr "le esta llamando." - -#: ../coreapi/callbacks.c:207 -msgid " and asked autoanswer." -msgstr "" - -#: ../coreapi/callbacks.c:207 -msgid "." -msgstr "" - -#: ../coreapi/callbacks.c:266 -#, fuzzy -msgid "Remote ringing." -msgstr "Registrando..." - -#: ../coreapi/callbacks.c:282 -#, fuzzy -msgid "Remote ringing..." -msgstr "Registrando..." - -#: ../coreapi/callbacks.c:293 -msgid "Early media." -msgstr "" - -#: ../coreapi/callbacks.c:331 -#, c-format -msgid "Call with %s is paused." -msgstr "" - -#: ../coreapi/callbacks.c:342 -#, c-format -msgid "Call answered by %s - on hold." -msgstr "" - -#: ../coreapi/callbacks.c:357 -#, fuzzy -msgid "Call resumed." -msgstr "Llamada cancelada." - -#: ../coreapi/callbacks.c:362 -#, fuzzy, c-format -msgid "Call answered by %s." -msgstr "" -"Llamar o\n" -"Responder" - -#: ../coreapi/callbacks.c:432 -msgid "We are being paused..." -msgstr "" - -#: ../coreapi/callbacks.c:436 -msgid "We have been resumed..." -msgstr "" - -#: ../coreapi/callbacks.c:441 -msgid "Call has been updated by remote..." -msgstr "" - -#: ../coreapi/callbacks.c:473 -#, fuzzy -msgid "Call terminated." -msgstr "Llamada cancelada." - -#: ../coreapi/callbacks.c:480 -msgid "User is busy." -msgstr "El usuario esta ocupado." - -#: ../coreapi/callbacks.c:481 -msgid "User is temporarily unavailable." -msgstr "El usuario le dice que volvera enseguida." - -#. char *retrymsg=_("%s. Retry after %i minute(s)."); -#: ../coreapi/callbacks.c:483 -msgid "User does not want to be disturbed." -msgstr "El usuario no quiere que lo molesten." - -#: ../coreapi/callbacks.c:484 -msgid "Call declined." -msgstr "Llamada cancelada." - -#: ../coreapi/callbacks.c:496 -msgid "No response." -msgstr "" - -#: ../coreapi/callbacks.c:500 -msgid "Protocol error." -msgstr "" - -#: ../coreapi/callbacks.c:516 -msgid "Redirected" -msgstr "" - -#: ../coreapi/callbacks.c:526 -msgid "Not found" -msgstr "" - -#: ../coreapi/callbacks.c:551 -msgid "No common codecs" -msgstr "" - -#: ../coreapi/callbacks.c:557 -#, fuzzy -msgid "Call failed." -msgstr "Llamada cancelada." - -#: ../coreapi/callbacks.c:631 -#, fuzzy, c-format -msgid "Registration on %s successful." -msgstr "Se ha registrado con exito." - -#: ../coreapi/callbacks.c:632 -#, fuzzy, c-format -msgid "Unregistration on %s done." -msgstr "Se ha registrado con exito." - -#: ../coreapi/callbacks.c:648 -msgid "no response timeout" -msgstr "" - -#: ../coreapi/callbacks.c:651 -#, fuzzy, c-format -msgid "Registration on %s failed: %s" -msgstr "Se ha registrado con exito." - -#: ../coreapi/sal_eXosip2.c:873 ../coreapi/sal_eXosip2.c:875 -#, fuzzy -msgid "Authentication failure" -msgstr "Informacion de codec" - -#: ../coreapi/linphonecall.c:128 -#, fuzzy, c-format -msgid "Authentication token is %s" -msgstr "Informacion de codec" - -#: ../coreapi/linphonecall.c:1560 -#, c-format -msgid "You have missed %i call." -msgid_plural "You have missed %i calls." -msgstr[0] "" -msgstr[1] "" - -#, fuzzy -#~ msgid "Contact list" -#~ msgstr "Contactando " - -#, fuzzy -#~ msgid "Audio & video" -#~ msgstr "Propiedades del codec de Audio" - -#, fuzzy -#~ msgid "Audio only" -#~ msgstr "Propiedades del codec de Audio" - -#, fuzzy -#~ msgid "Duration:" -#~ msgstr "Informacion" - -#, fuzzy -#~ msgid "_Linphone" -#~ msgstr "linphone" - -#, fuzzy -#~ msgid "gtk-cancel" -#~ msgstr "Conectado." - -#, fuzzy -#~ msgid "gtk-ok" -#~ msgstr "Borrar" - -#, fuzzy -#~ msgid "gtk-close" -#~ msgstr "Conectado." - -#, fuzzy -#~ msgid "Ports" -#~ msgstr "Contactando " - -#, fuzzy -#~ msgid "_Modes" -#~ msgstr "Codecs" - -#, fuzzy -#~ msgid "" -#~ "Audio codecs\n" -#~ "Video codecs" -#~ msgstr "Propiedades del codec de Audio" - -#, fuzzy -#~ msgid "Request Cancelled." -#~ msgstr "Llamada cancelada." - -#~ msgid "User cannot be found at given address." -#~ msgstr "No se encontro ningun usuario en la direccion indicada." - -#~ msgid "Remote user cannot support any of proposed codecs." -#~ msgstr "El usuario remoto no soporta ninguno de los codecs propuestos." - -#~ msgid "Timeout." -#~ msgstr "Tiempo agotado." - -#~ msgid "Remote host was found but refused connection." -#~ msgstr "Se encontro host remoto pero rechazo la conexion." - -#~ msgid "" -#~ "User is not reachable at the moment but he invites you\n" -#~ "to contact him using the following alternate resource:" -#~ msgstr "" -#~ "Usuario no disponible en este momento pero le invita\n" -#~ "a contactarle usando el siguiente recurso alternativo:" - -#, fuzzy -#~ msgid "Gone" -#~ msgstr "Ninguno." - -#, fuzzy -#~ msgid "SIP address" -#~ msgstr "Direccion" - -#, fuzzy -#~ msgid "Display filters" -#~ msgstr "Nombre a mostrar:" - -#, fuzzy -#~ msgid "_Properties" -#~ msgstr "Propiedades de RTP" - -#, fuzzy -#~ msgid "Proxy in use" -#~ msgstr "Servidor Proxy" - -#~ msgid "Sound" -#~ msgstr "Sonido" - -#, fuzzy -#~ msgid "Proxy accounts" -#~ msgstr "Servidor Proxy" - -#~ msgid "Address book" -#~ msgstr "Agenda" - -#, fuzzy -#~ msgid "Shows the address book" -#~ msgstr "Muestra la Agenda" - -#~ msgid "Show more..." -#~ msgstr "Mostrar mas..." - -#~ msgid "Playback level:" -#~ msgstr "Nivel de reproduccion:" - -#~ msgid "Recording level:" -#~ msgstr "Nivel de Grabacion:" - -#, fuzzy -#~ msgid "Ring level:" -#~ msgstr "Nivel de Grabacion:" - -#~ msgid "Reachable" -#~ msgstr "Disponible" - -#~ msgid "Busy, I'll be back in " -#~ msgstr "Ocupado, estare de vuelta en " - -#~ msgid "The other party will be informed that you'll be back in X minutes" -#~ msgstr "" -#~ "Se le comunicara a la otra persona que estaras de vuelta en X minutos" - -#~ msgid "mn" -#~ msgstr "min" - -#~ msgid "Moved temporarily" -#~ msgstr "Vengo enseguida" - -#~ msgid "Alternative service" -#~ msgstr "Servicio alternativo" - -#~ msgid "URL:" -#~ msgstr "URL:" - -#~ msgid "Presence" -#~ msgstr "Estado" - -#~ msgid "Press digits to send DTMFs." -#~ msgstr "Pulsa los digitos para mandar DTMFs." - -#~ msgid "DTMF" -#~ msgstr "DTMF" - -#~ msgid "" -#~ "Linphone is a web-phone.\n" -#~ "It is compatible with SIP and RTP protocols." -#~ msgstr "" -#~ "Linphone es un telefono para Internet.\n" -#~ "Es compatible con los protocolos SIP y RTP." - -#, fuzzy -#~ msgid "Use IPv6 network (if available)" -#~ msgstr "El usuario le dice que volvera enseguida." - -#, fuzzy -#~ msgid "" -#~ "These options is only for users in a private network, behind a gateway. " -#~ "If you are not in this situation, then leave this empty." -#~ msgstr "" -#~ "Esta opcion es solo para usuarios en una red privada, detras de un " -#~ "cortafuegos. Siese no es tu caso, deja esto vacio." - -#, fuzzy -#~ msgid "NAT traversal options (experimental)" -#~ msgstr "Opciones para NAT transversal (experimental)" - -#, fuzzy -#~ msgid "Number of buffered miliseconds (jitter compensation):" -#~ msgstr "Numero de milisegundos en el buffer(compensacion jitter):" - -#~ msgid "RTP port used for audio:" -#~ msgstr "Puerto RTP usado para audio:" - -#~ msgid "micro" -#~ msgstr "microfono" - -#~ msgid "Recording source:" -#~ msgstr "Fuente de grabacion:" - -#~ msgid "Sound properties" -#~ msgstr "Propiedades de sonido" - -#~ msgid "Run sip user agent on port:" -#~ msgstr "Ejecutar SIP user agent en el puerto:" - -#~ msgid "It is strongly recommended to use port 5060." -#~ msgstr "Se recomienda encarecidamente usar el puerto 5060." - -#~ msgid "SIP port" -#~ msgstr "Puerto SIP" - -#~ msgid "@" -#~ msgstr "@" - -#~ msgid "Identity" -#~ msgstr "Identidad" - -#, fuzzy -#~ msgid "Add proxy/registrar" -#~ msgstr "Usar el registro SIP" - -#~ msgid "Remote services" -#~ msgstr "Servicios Remotos:" - -#~ msgid "SIP" -#~ msgstr "SIP" - -#~ msgid "List of audio codecs, in order of preference:" -#~ msgstr "Lista de codecs de audio, en orden de preferencia:" - -#~ msgid "" -#~ "Note: Codecs in red are not usable regarding to your connection type to " -#~ "the internet." -#~ msgstr "" -#~ "Nota: Los codecs en ROJO no son adecuados para tu conexion a internet." - -#, fuzzy -#~ msgid "No information availlable" -#~ msgstr "Informacion no disponible" - -#, fuzzy -#~ msgid "Codec information" -#~ msgstr "Informacion de codec" - -#~ msgid "Address Book" -#~ msgstr "Agenda" - -#~ msgid "Select" -#~ msgstr "Seleccionar" - -#~ msgid "" -#~ "User is not reachable at the moment but he invites you to contact him " -#~ "using the following alternate ressource:" -#~ msgstr "" -#~ "Usuario no disponible en este momento pero le invita a contactarle usando " -#~ "el siguiente recurso alternativo:" - -#~ msgid "None." -#~ msgstr "Ninguno." - -#, fuzzy -#~ msgid "Name:" -#~ msgstr "Nombre" - -#, fuzzy -#~ msgid "Bad sip address: a sip address looks like sip:user@domain" -#~ msgstr "" -#~ "Direccion SIP mal escrita. Una direccion SIP es " - -#~ msgid "Communication ended." -#~ msgstr "Comunicacion finalizada." - -#, fuzzy -#~ msgid "Firewall 's external ip address (in dot notations):" -#~ msgstr "Direccion IP del cortafuegos (en notacion con puntos):" - -#~ msgid "Index" -#~ msgstr "Indice" - -#, fuzzy -#~ msgid "Server address" -#~ msgstr "Direccion del Servidor:" - -#~ msgid "28k modem" -#~ msgstr "modem 28k" - -#~ msgid "56k modem" -#~ msgstr "modem 56k" - -#~ msgid "64k modem (numeris)" -#~ msgstr "modem 64k (numeris)" - -#~ msgid "ADSL or Cable modem" -#~ msgstr "ADSL o Cable" - -#~ msgid "Ethernet or equivalent" -#~ msgstr "Ethernet o equivalente" - -#~ msgid "Connection type:" -#~ msgstr "Tipo de conexion:" - -#, fuzzy -#~ msgid "" -#~ "Linphone could not open audio device %s. Check if your sound card is " -#~ "fully configured and working." -#~ msgstr "" -#~ "Linphone no pudo abrir el dispositivo de audio. Asegurese que su tarjeta " -#~ "de sonido esta completamente configurada y operativa." - -#~ msgid "Type here the sip address of the person you want to call." -#~ msgstr "Escribe aqui la direccion SIP de la persona que quieres llamar." - -#~ msgid "" -#~ "Release or\n" -#~ "Refuse" -#~ msgstr "" -#~ "Descolgar o\n" -#~ "Rechazar" - -#~ msgid "%s. Retry after %i minute(s)." -#~ msgstr "%s. Reintentar tras %i minutos." - -#, fuzzy -#~ msgid "Timeout..." -#~ msgstr "Tiempo agotado." - -#~ msgid "Toggle this if you want to be registered on a remote server." -#~ msgstr "Marcar opcion si desea registrarse en un servidor remoto." - -#~ msgid "Address of record:" -#~ msgstr "Nombre de registro:" - -#~ msgid "" -#~ "The password used for registration. On some servers it is not necessary" -#~ msgstr "" -#~ "La contraseña usada para registrarse. En algunos servidores no es " -#~ "necesaria" - -#~ msgid "Use this registrar server as outbound proxy." -#~ msgstr "Usar el servidor de registro como outbound proxy." - -#~ msgid "sip address:" -#~ msgstr "Direccion SIP:" - -#~ msgid "Modify" -#~ msgstr "Modificar" - -#~ msgid "" -#~ "You are currently using the i810_audio driver.\n" -#~ "This driver is buggy and so does not work with Linphone.\n" -#~ "We suggest that you replace it by its equivalent ALSA driver,\n" -#~ "either with packages from your distribution, or by downloading\n" -#~ "ALSA drivers at http://www.alsa-project.org." -#~ msgstr "" -#~ "Estas usando actualmente el controlador i810_audio.\n" -#~ "Ese controlador tiene errores y por tanto no funciona con Linphone.\n" -#~ "Le recomendamos que lo sustituya por su controlador equivalente de ALSA,\n" -#~ "ya sea mediante paquetes de su distribucion, o descargando\n" -#~ "controladores ALSA de http://www.alsa-project.org." - -#~ msgid "Unregistration successfull." -#~ msgstr "Cancelacion del registro completada." - -#~ msgid "C: 2001" -#~ msgstr "Abril 2001" - -#~ msgid "Select network interface to use:" -#~ msgstr "Selecciona la interfaz de red para usar:" - -#~ msgid "Network interface properties" -#~ msgstr "Propiedades de Interfaz de Red:" - -#~ msgid "RTP" -#~ msgstr "RTP" - -#~ msgid "Threads not supported by glib. Upgrade your glib.\n" -#~ msgstr "Threads no soportados por glib. Actualize su glib.\n" - -#~ msgid "Run linphone as a gnome-applet." -#~ msgstr "Lanzar linphone como un gnome-applet." - -#~ msgid "Run linphone as a daemon (for use without gnome)." -#~ msgstr "Ejecutar linphone como demonio (para uso sin gnome)." - -#~ msgid "" -#~ "Cannot find network previously used interface %s.\n" -#~ "If your computer is temporary connected to the internet, please connect " -#~ "and then run linphone.\n" -#~ "If you want to change your default network interface, go to the " -#~ "parameters 'box." -#~ msgstr "" -#~ "No se puede encontrar la interfaz de red usada previamente %s.\n" -#~ "Si tu ordenador esta conectado temporalmente a Internet, por favor " -#~ "conecta y entonces ejecuta linphone.\n" -#~ "Si quieres cambiar tu interfaz de red predeterminada, ve a la opcion " -#~ "Parametros." - -#, fuzzy -#~ msgid "" -#~ "Linphone cannot open the audio device.\n" -#~ "It may be caused by other programs using it.\n" -#~ "Do you want linphone to kill these programs (esd or artsd) ?" -#~ msgstr "" -#~ "Linphone no puede abrir el dispositivo de audio.\n" -#~ " Puede deberse a que otros programas lo esten usando.\n" -#~ "¿ Quiere que Linphone cierre esos programas (esd o artsd) ?" - -#~ msgid "Use it as a:" -#~ msgstr "Usarlo como un:" - -#~ msgid "Outbound proxy" -#~ msgstr "Outbound proxy" - -#~ msgid "" -#~ "Togle this button if the registrar must be used to proxy calls through a " -#~ "firewall." -#~ msgstr "" -#~ "Marcar esta opcion si el servidor de registro debe ser usado para " -#~ "llamadas a proxy a traves de un cortafuegos." - -#~ msgid "OSS" -#~ msgstr "OSS" - -#~ msgid "ALSA" -#~ msgstr "ALSA" - -#~ msgid "Automatically kill applications using soundcard when needed" -#~ msgstr "" -#~ "Cerrar aplicaciones que usen la tarjeta de sonido cuando se necesite." - -#~ msgid "" -#~ "Your computer is connected to several networks. Check in the global " -#~ "parameters if Linphone uses the one that you want." -#~ msgstr "" -#~ "Tu ordenador esta conectado a varias redes. Revisa en los Parametros " -#~ "globales si Linphone usa la que necesitas." - -#~ msgid "" -#~ "Linphone failed to open the sound device. See the README file included in " -#~ "the distribution for details." -#~ msgstr "" -#~ "Linphone fallo al abrir el dispositivo de sonido. Vea el archivo README " -#~ "incluido en la distribucion para mas detalles." - -#~ msgid "Interface not found." -#~ msgstr "Interfaz no encontrada." - -#~ msgid "Warning" -#~ msgstr "Atencion" - -#~ msgid "" -#~ "Linphone cannot open the sound device. It may be caused by other programs " -#~ "using it. Do you want linphone to kill these programs (esd or artsd) ?" -#~ msgstr "" -#~ "Linphone no puede abrir el dispositivo de sonido. Puede deberse a que " -#~ "otros programaslo esten usando. ¿ Quiere que Linphone cierre esos " -#~ "programas (esd o artsd) ?" - -#~ msgid "Linphone shutdowns..." -#~ msgstr "Linphone esta terminando..." - -#~ msgid "" -#~ "Please, wait a few seconds untils linphone unregisters your sip addess " -#~ "from registrar server..." -#~ msgstr "" -#~ "Por favor, espere unos segundos hasta que Linphone cancele el registro de " -#~ "su direccion SIP en el servidor de registros..." - -#~ msgid "Bad formuled sip address." -#~ msgstr "Direccion SIP mal escrita." - -#~ msgid "Couldn't create pixmap from file: %s" -#~ msgstr "No se pudo crear pixmap desde el archivo: %s" - -#~ msgid "" -#~ "Linphone did not detect any valid network interface. If you use a " -#~ "temporary internet connection, please connect and then run linphone again." -#~ msgstr "" -#~ "Linphone no detecto ninguna interfaz de red valida. Si usas una conexion " -#~ "temporal a Internet, por favor conecta y vuelve a ejecutar Linphone." - -#~ msgid "List of network interfaces on your system." -#~ msgstr "Lista de interfaces de red en tu sistema." - -#~ msgid "" -#~ "RTP est le mode de transport de la voix. Modifier ces paramètres pour " -#~ "tenter d'améliorer la qualité de la communication si celle-ci est " -#~ "dégradée." -#~ msgstr "" -#~ "RTP es el modelo de transporte de la voz. Modifica estos parametros para " -#~ "intentar mejorar la calidad de la comunicacion, si es que.es mala." - -#~ msgid "Use rtp port:" -#~ msgstr "Puerto RTP:" - -#~ msgid "" -#~ "Les codecs ou vocodeurs sont les algorithmes utilisés pour compresser la " -#~ "voix." -#~ msgstr "" -#~ "Los codecs o codificadores/decodificadores son los algoritmos usados para " -#~ "comprimir la voz." - -#~ msgid "" -#~ "Vous pouvez ajuster avec cet onglet des paramètre liés à votre carte son." -#~ msgstr "Puede modificar estos parametros a su gusto." +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Linphone 0.9.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-12-05 12:41+0100\n" +"PO-Revision-Date: 2002-10-15 HO:MI+ZONE\n" +"Last-Translator: Nelson Benitez \n" +"Language-Team: es \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../gtk/calllogs.c:71 +#, c-format +msgid "%i minute" +msgid_plural "%i minutes" +msgstr[0] "" +msgstr[1] "" + +#: ../gtk/calllogs.c:74 +#, c-format +msgid "%i second" +msgid_plural "%i seconds" +msgstr[0] "" +msgstr[1] "" + +#: ../gtk/calllogs.c:77 +#, c-format +msgid "" +"%s\t%s\tQuality: %s\n" +"%s\t%s %s\t" +msgstr "" + +#: ../gtk/calllogs.c:79 +msgid "n/a" +msgstr "" + +#: ../gtk/conference.c:33 ../gtk/incall_view.c:183 +msgid "Conference" +msgstr "" + +#: ../gtk/conference.c:41 +msgid "Me" +msgstr "" + +#: ../gtk/support.c:49 ../gtk/support.c:73 ../gtk/support.c:102 +#, c-format +msgid "Couldn't find pixmap file: %s" +msgstr "No se pudo encontrar el archivo pixmap: %s" + +#: ../gtk/chat.c:27 +#, c-format +msgid "Chat with %s" +msgstr "" + +#: ../gtk/main.c:83 +msgid "log to stdout some debug information while running." +msgstr "" + +#: ../gtk/main.c:90 +msgid "path to a file to write logs into." +msgstr "" + +#: ../gtk/main.c:97 +msgid "Start only in the system tray, do not show the main interface." +msgstr "" + +#: ../gtk/main.c:104 +msgid "address to call right now" +msgstr "" + +#: ../gtk/main.c:111 +msgid "if set automatically answer incoming calls" +msgstr "" + +#: ../gtk/main.c:118 +msgid "" +"Specifiy a working directory (should be the base of the installation, eg: c:" +"\\Program Files\\Linphone)" +msgstr "" + +#: ../gtk/main.c:464 +#, c-format +msgid "Call with %s" +msgstr "" + +#: ../gtk/main.c:815 +#, c-format +msgid "" +"%s would like to add you to his contact list.\n" +"Would you allow him to see your presence status or add him to your contact " +"list ?\n" +"If you answer no, this person will be temporarily blacklisted." +msgstr "" + +#: ../gtk/main.c:893 +#, c-format +msgid "" +"Please enter your password for username %s\n" +" at domain %s:" +msgstr "" + +#: ../gtk/main.c:993 +#, fuzzy +msgid "Call error" +msgstr "Llamada cancelada." + +#: ../gtk/main.c:996 ../coreapi/linphonecore.c:2406 +#, fuzzy +msgid "Call ended" +msgstr "Llamada cancelada." + +#: ../gtk/main.c:999 ../coreapi/linphonecore.c:199 +msgid "Incoming call" +msgstr "" + +#: ../gtk/main.c:1001 ../gtk/incall_view.c:292 ../gtk/main.ui.h:20 +msgid "Answer" +msgstr "" + +#: ../gtk/main.c:1003 ../gtk/main.ui.h:29 +#, fuzzy +msgid "Decline" +msgstr "linea" + +#: ../gtk/main.c:1009 +#, fuzzy +msgid "Call paused" +msgstr "Llamada cancelada." + +#: ../gtk/main.c:1009 +#, c-format +msgid "by %s" +msgstr "" + +#: ../gtk/main.c:1165 +msgid "Website link" +msgstr "" + +#: ../gtk/main.c:1205 +msgid "Linphone - a video internet phone" +msgstr "" + +#: ../gtk/main.c:1295 +#, c-format +msgid "%s (Default)" +msgstr "" + +#: ../gtk/main.c:1566 ../coreapi/callbacks.c:700 +#, c-format +msgid "We are transferred to %s" +msgstr "" + +#: ../gtk/main.c:1576 +msgid "" +"No sound cards have been detected on this computer.\n" +"You won't be able to send or receive audio calls." +msgstr "" + +#: ../gtk/main.c:1663 +msgid "A free SIP video-phone" +msgstr "" + +#: ../gtk/friendlist.c:203 +#, fuzzy +msgid "Add to addressbook" +msgstr "Agenda" + +#: ../gtk/friendlist.c:258 ../gtk/propertybox.c:296 ../gtk/contact.ui.h:3 +msgid "Name" +msgstr "Nombre" + +#: ../gtk/friendlist.c:271 +#, fuzzy +msgid "Presence status" +msgstr "Estado" + +#: ../gtk/friendlist.c:308 +#, c-format +msgid "Search in %s directory" +msgstr "" + +#: ../gtk/friendlist.c:568 +msgid "Invalid sip contact !" +msgstr "" + +#: ../gtk/friendlist.c:613 +#, c-format +msgid "Call %s" +msgstr "" + +#: ../gtk/friendlist.c:614 +#, c-format +msgid "Send text to %s" +msgstr "" + +#: ../gtk/friendlist.c:615 +#, fuzzy, c-format +msgid "Edit contact '%s'" +msgstr "(Ninguna informacion de contacto !)" + +#: ../gtk/friendlist.c:616 +#, c-format +msgid "Delete contact '%s'" +msgstr "" + +#: ../gtk/friendlist.c:658 +#, c-format +msgid "Add new contact from %s directory" +msgstr "" + +#: ../gtk/propertybox.c:302 +msgid "Rate (Hz)" +msgstr "" + +#: ../gtk/propertybox.c:308 +msgid "Status" +msgstr "Estado" + +#: ../gtk/propertybox.c:314 +msgid "Min bitrate (kbit/s)" +msgstr "" + +#: ../gtk/propertybox.c:321 +msgid "Parameters" +msgstr "Parametros" + +#: ../gtk/propertybox.c:364 ../gtk/propertybox.c:507 +msgid "Enabled" +msgstr "Activado" + +#: ../gtk/propertybox.c:366 ../gtk/propertybox.c:507 +msgid "Disabled" +msgstr "Desactivado" + +#: ../gtk/propertybox.c:553 +msgid "Account" +msgstr "" + +#: ../gtk/propertybox.c:693 +msgid "English" +msgstr "" + +#: ../gtk/propertybox.c:694 +msgid "French" +msgstr "" + +#: ../gtk/propertybox.c:695 +msgid "Swedish" +msgstr "" + +#: ../gtk/propertybox.c:696 +msgid "Italian" +msgstr "" + +#: ../gtk/propertybox.c:697 +msgid "Spanish" +msgstr "" + +#: ../gtk/propertybox.c:698 +msgid "Brazilian Portugese" +msgstr "" + +#: ../gtk/propertybox.c:699 +msgid "Polish" +msgstr "" + +#: ../gtk/propertybox.c:700 +msgid "German" +msgstr "" + +#: ../gtk/propertybox.c:701 +msgid "Russian" +msgstr "" + +#: ../gtk/propertybox.c:702 +msgid "Japanese" +msgstr "" + +#: ../gtk/propertybox.c:703 +msgid "Dutch" +msgstr "" + +#: ../gtk/propertybox.c:704 +msgid "Hungarian" +msgstr "" + +#: ../gtk/propertybox.c:705 +msgid "Czech" +msgstr "" + +#: ../gtk/propertybox.c:706 +msgid "Chinese" +msgstr "" + +#: ../gtk/propertybox.c:707 +msgid "Traditional Chinese" +msgstr "" + +#: ../gtk/propertybox.c:708 +msgid "Norwegian" +msgstr "" + +#: ../gtk/propertybox.c:765 +msgid "" +"You need to restart linphone for the new language selection to take effect." +msgstr "" + +#: ../gtk/propertybox.c:835 +#, fuzzy +msgid "None" +msgstr "Ninguno." + +#: ../gtk/propertybox.c:839 +msgid "SRTP" +msgstr "" + +#: ../gtk/propertybox.c:845 +msgid "ZRTP" +msgstr "" + +#: ../gtk/update.c:80 +#, c-format +msgid "" +"A more recent version is availalble from %s.\n" +"Would you like to open a browser to download it ?" +msgstr "" + +#: ../gtk/update.c:91 +msgid "You are running the lastest version." +msgstr "" + +#: ../gtk/buddylookup.c:85 +msgid "Firstname, Lastname" +msgstr "" + +#: ../gtk/buddylookup.c:160 +msgid "Error communicating with server." +msgstr "" + +#: ../gtk/buddylookup.c:164 +#, fuzzy +msgid "Connecting..." +msgstr "Conexion" + +#: ../gtk/buddylookup.c:168 +#, fuzzy +msgid "Connected" +msgstr "Conectado." + +#: ../gtk/buddylookup.c:172 +msgid "Receiving data..." +msgstr "" + +#: ../gtk/buddylookup.c:180 +#, c-format +msgid "Found %i contact" +msgid_plural "Found %i contacts" +msgstr[0] "" +msgstr[1] "" + +#: ../gtk/setupwizard.c:25 +msgid "" +"Welcome !\n" +"This assistant will help you to use a SIP account for your calls." +msgstr "" + +#: ../gtk/setupwizard.c:34 +msgid "Create an account by choosing a username" +msgstr "" + +#: ../gtk/setupwizard.c:35 +msgid "I have already an account and just want to use it" +msgstr "" + +#: ../gtk/setupwizard.c:53 +msgid "Please choose a username:" +msgstr "" + +#: ../gtk/setupwizard.c:54 +#, fuzzy +msgid "Username:" +msgstr "Manual de Usuario" + +#: ../gtk/setupwizard.c:92 +#, c-format +msgid "Checking if '%s' is available..." +msgstr "" + +#: ../gtk/setupwizard.c:97 ../gtk/setupwizard.c:164 +msgid "Please wait..." +msgstr "" + +#: ../gtk/setupwizard.c:101 +msgid "Sorry this username already exists. Please try a new one." +msgstr "" + +#: ../gtk/setupwizard.c:103 ../gtk/setupwizard.c:168 +msgid "Ok !" +msgstr "" + +#: ../gtk/setupwizard.c:106 ../gtk/setupwizard.c:171 +msgid "Communication problem, please try again later." +msgstr "" + +#: ../gtk/setupwizard.c:134 +msgid "Thank you. Your account is now configured and ready for use." +msgstr "" + +#: ../gtk/setupwizard.c:228 +msgid "Welcome to the account setup assistant" +msgstr "" + +#: ../gtk/setupwizard.c:232 +msgid "Account setup assistant" +msgstr "" + +#: ../gtk/setupwizard.c:236 +msgid "Choosing a username" +msgstr "" + +#: ../gtk/setupwizard.c:240 +msgid "Verifying" +msgstr "" + +#: ../gtk/setupwizard.c:244 +#, fuzzy +msgid "Confirmation" +msgstr "Informacion" + +#: ../gtk/setupwizard.c:249 +msgid "Creating your account" +msgstr "" + +#: ../gtk/setupwizard.c:253 +msgid "Now ready !" +msgstr "" + +#: ../gtk/incall_view.c:69 +#, fuzzy, c-format +msgid "Call #%i" +msgstr "Llamada cancelada." + +#: ../gtk/incall_view.c:127 +#, c-format +msgid "Transfer to call #%i with %s" +msgstr "" + +#: ../gtk/incall_view.c:155 +msgid "Transfer" +msgstr "" + +#: ../gtk/incall_view.c:271 +#, fuzzy +msgid "Calling..." +msgstr "Contactando " + +#: ../gtk/incall_view.c:274 ../gtk/incall_view.c:482 +msgid "00::00::00" +msgstr "" + +#: ../gtk/incall_view.c:285 +#, fuzzy +msgid "Incoming call" +msgstr "Contactando " + +#: ../gtk/incall_view.c:322 +msgid "good" +msgstr "" + +#: ../gtk/incall_view.c:324 +msgid "average" +msgstr "" + +#: ../gtk/incall_view.c:326 +msgid "poor" +msgstr "" + +#: ../gtk/incall_view.c:328 +msgid "very poor" +msgstr "" + +#: ../gtk/incall_view.c:330 +msgid "too bad" +msgstr "" + +#: ../gtk/incall_view.c:331 ../gtk/incall_view.c:347 +msgid "unavailable" +msgstr "" + +#: ../gtk/incall_view.c:447 +msgid "Secured by SRTP" +msgstr "" + +#: ../gtk/incall_view.c:453 +#, c-format +msgid "Secured by ZRTP - [auth token: %s]" +msgstr "" + +#: ../gtk/incall_view.c:459 +msgid "Set unverified" +msgstr "" + +#: ../gtk/incall_view.c:459 ../gtk/main.ui.h:49 +msgid "Set verified" +msgstr "" + +#: ../gtk/incall_view.c:480 +msgid "In conference" +msgstr "" + +#: ../gtk/incall_view.c:480 +#, fuzzy +msgid "In call" +msgstr "Contactando " + +#: ../gtk/incall_view.c:499 +#, fuzzy +msgid "Paused call" +msgstr "Contactando " + +#: ../gtk/incall_view.c:511 +#, c-format +msgid "%02i::%02i::%02i" +msgstr "" + +#: ../gtk/incall_view.c:527 +#, fuzzy +msgid "Call ended." +msgstr "Llamada cancelada." + +#: ../gtk/incall_view.c:584 +msgid "Resume" +msgstr "" + +#: ../gtk/incall_view.c:591 ../gtk/main.ui.h:45 +msgid "Pause" +msgstr "" + +#: ../gtk/loginframe.c:93 +#, c-format +msgid "Please enter login information for %s" +msgstr "" + +#: ../gtk/main.ui.h:1 +msgid "#" +msgstr "#" + +#: ../gtk/main.ui.h:2 +msgid "*" +msgstr "*" + +#: ../gtk/main.ui.h:3 +msgid "0" +msgstr "0" + +#: ../gtk/main.ui.h:4 +msgid "1" +msgstr "1" + +#: ../gtk/main.ui.h:5 +msgid "2" +msgstr "2" + +#: ../gtk/main.ui.h:6 +msgid "3" +msgstr "3" + +#: ../gtk/main.ui.h:7 +msgid "4" +msgstr "4" + +#: ../gtk/main.ui.h:8 +msgid "5" +msgstr "5" + +#: ../gtk/main.ui.h:9 +msgid "6" +msgstr "6" + +#: ../gtk/main.ui.h:10 +msgid "7" +msgstr "7" + +#: ../gtk/main.ui.h:11 +msgid "8" +msgstr "8" + +#: ../gtk/main.ui.h:12 +msgid "9" +msgstr "9" + +#: ../gtk/main.ui.h:13 +#, fuzzy +msgid "Add contacts from directory" +msgstr "Informacion de codec" + +#: ../gtk/main.ui.h:14 +#, fuzzy +msgid "Callee name" +msgstr "Llamada cancelada." + +#: ../gtk/main.ui.h:15 +#, fuzzy +msgid "Welcome !" +msgstr "Contactando " + +#: ../gtk/main.ui.h:16 +msgid "A" +msgstr "" + +#: ../gtk/main.ui.h:17 +msgid "ADSL" +msgstr "" + +#: ../gtk/main.ui.h:18 +#, fuzzy +msgid "Add contact" +msgstr "(Ninguna informacion de contacto !)" + +#: ../gtk/main.ui.h:19 +msgid "All users" +msgstr "" + +#: ../gtk/main.ui.h:21 +msgid "Automatically log me in" +msgstr "" + +#: ../gtk/main.ui.h:22 +msgid "B" +msgstr "" + +#: ../gtk/main.ui.h:23 ../gtk/parameters.ui.h:21 +msgid "C" +msgstr "" + +#: ../gtk/main.ui.h:24 +#, fuzzy +msgid "Call" +msgstr "Llamada cancelada." + +#: ../gtk/main.ui.h:25 +msgid "Call quality rating" +msgstr "" + +#: ../gtk/main.ui.h:26 +msgid "Check _Updates" +msgstr "" + +#: ../gtk/main.ui.h:27 +#, fuzzy +msgid "Contacts" +msgstr "Contactando " + +#: ../gtk/main.ui.h:28 +msgid "D" +msgstr "" + +#: ../gtk/main.ui.h:30 +#, fuzzy +msgid "Default" +msgstr "Identidad" + +#: ../gtk/main.ui.h:31 +#, fuzzy +msgid "Duration" +msgstr "Informacion" + +#: ../gtk/main.ui.h:32 +#, fuzzy +msgid "Enable self-view" +msgstr "Activado" + +#: ../gtk/main.ui.h:33 +#, fuzzy +msgid "Enable video" +msgstr "Activado" + +#: ../gtk/main.ui.h:34 +msgid "Enter username, phone number, or full sip address" +msgstr "" + +#: ../gtk/main.ui.h:35 +msgid "Fiber Channel" +msgstr "" + +#: ../gtk/main.ui.h:36 +#, fuzzy +msgid "In call" +msgstr "Contactando " + +#: ../gtk/main.ui.h:37 +msgid "Initiate a new call" +msgstr "" + +#: ../gtk/main.ui.h:38 +msgid "Internet connection:" +msgstr "" + +#: ../gtk/main.ui.h:39 +msgid "Keypad" +msgstr "" + +#: ../gtk/main.ui.h:40 +#, fuzzy +msgid "Login information" +msgstr "Informacion de codec" + +#: ../gtk/main.ui.h:41 +msgid "Lookup:" +msgstr "" + +#: ../gtk/main.ui.h:42 +#, fuzzy +msgid "My current identity:" +msgstr "Identidad" + +#: ../gtk/main.ui.h:43 +#, fuzzy +msgid "Online users" +msgstr "linea" + +#: ../gtk/main.ui.h:44 +#, fuzzy +msgid "Password" +msgstr "Tu Contraseña:" + +#: ../gtk/main.ui.h:46 +#, fuzzy +msgid "Recent calls" +msgstr "Contactando " + +#: ../gtk/main.ui.h:47 +#, fuzzy +msgid "SIP address or phone number:" +msgstr "La direccion SIP del servidor de registro." + +#: ../gtk/main.ui.h:48 +msgid "Search" +msgstr "" + +#: ../gtk/main.ui.h:50 +#, fuzzy +msgid "Show debug window" +msgstr "Linphone esta terminando..." + +#: ../gtk/main.ui.h:51 +#, fuzzy +msgid "Username" +msgstr "Manual de Usuario" + +#: ../gtk/main.ui.h:52 +msgid "_Help" +msgstr "" + +#: ../gtk/main.ui.h:53 +msgid "_Homepage" +msgstr "" + +#: ../gtk/main.ui.h:54 +msgid "_Options" +msgstr "" + +#: ../gtk/main.ui.h:55 +msgid "in" +msgstr "" + +#: ../gtk/main.ui.h:56 +msgid "label" +msgstr "" + +#: ../gtk/about.ui.h:1 +msgid "(C) Belledonne Communications,2010\n" +msgstr "" + +#: ../gtk/about.ui.h:3 +#, fuzzy +msgid "About linphone" +msgstr "linphone" + +#: ../gtk/about.ui.h:4 +msgid "An internet video phone using the standard SIP (rfc3261) protocol." +msgstr "" + +#: ../gtk/about.ui.h:5 +msgid "" +"fr: Simon Morlat\n" +"en: Simon Morlat and Delphine Perreau\n" +"it: Alberto Zanoni \n" +"de: Jean-Jacques Sarton \n" +"sv: Daniel Nylander \n" +"es: Jesus Benitez \n" +"ja: YAMAGUCHI YOSHIYA \n" +"pt_BR: Rafael Caesar Lenzi \n" +"pl: Robert Nasiadek \n" +"cs: Petr Pisar \n" +"hu: anonymous\n" +msgstr "" + +#: ../gtk/contact.ui.h:1 +#, fuzzy +msgid "Contact information" +msgstr "Informacion de codec" + +#: ../gtk/contact.ui.h:2 +msgid "Allow this contact to see my presence status" +msgstr "" + +#: ../gtk/contact.ui.h:4 +#, fuzzy +msgid "SIP Address" +msgstr "Direccion" + +#: ../gtk/contact.ui.h:5 +msgid "Show this contact presence status" +msgstr "" + +#: ../gtk/log.ui.h:1 +#, fuzzy +msgid "Linphone debug window" +msgstr "Linphone esta terminando..." + +#: ../gtk/password.ui.h:1 +#, fuzzy +msgid "Linphone - Authentication required" +msgstr "Informacion de codec" + +#: ../gtk/password.ui.h:2 +#, fuzzy +msgid "Password:" +msgstr "Tu Contraseña:" + +#: ../gtk/password.ui.h:3 +msgid "Please enter the domain password" +msgstr "" + +#: ../gtk/password.ui.h:4 +msgid "UserID" +msgstr "" + +#: ../gtk/call_logs.ui.h:1 +msgid "Call back" +msgstr "" + +#: ../gtk/call_logs.ui.h:2 +msgid "Call history" +msgstr "" + +#: ../gtk/call_logs.ui.h:3 +msgid "Clear all" +msgstr "" + +#: ../gtk/sip_account.ui.h:1 +msgid "Configure a SIP account" +msgstr "" + +#: ../gtk/sip_account.ui.h:2 +msgid "Linphone - Configure a SIP account" +msgstr "" + +#: ../gtk/sip_account.ui.h:3 +msgid "Looks like sip:" +msgstr "" + +#: ../gtk/sip_account.ui.h:4 +msgid "Looks like sip:@" +msgstr "" + +#: ../gtk/sip_account.ui.h:5 +#, fuzzy +msgid "Publish presence information" +msgstr "Informacion de codec" + +#: ../gtk/sip_account.ui.h:6 +msgid "Register" +msgstr "" + +#: ../gtk/sip_account.ui.h:7 +#, fuzzy +msgid "Registration duration (sec):" +msgstr "Se ha registrado con exito." + +#: ../gtk/sip_account.ui.h:8 +msgid "Route (optional):" +msgstr "" + +#: ../gtk/sip_account.ui.h:9 +#, fuzzy +msgid "SIP Proxy address:" +msgstr "Direccion SIP" + +#: ../gtk/sip_account.ui.h:10 +#, fuzzy +msgid "Your SIP identity:" +msgstr "Identidad" + +#: ../gtk/sip_account.ui.h:11 +msgid "sip:" +msgstr "SIP:" + +#: ../gtk/chatroom.ui.h:1 +#, fuzzy +msgid "Send" +msgstr "Sonido" + +#: ../gtk/parameters.ui.h:1 +msgid "0 stands for \"unlimited\"" +msgstr "" + +#: ../gtk/parameters.ui.h:2 +#, fuzzy +msgid "Audio" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:3 +msgid "Bandwidth control" +msgstr "" + +#: ../gtk/parameters.ui.h:4 +#, fuzzy +msgid "Codecs" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:5 +#, fuzzy +msgid "Default identity" +msgstr "Identidad" + +#: ../gtk/parameters.ui.h:6 +#, fuzzy +msgid "Language" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:7 +#, fuzzy +msgid "Level" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:8 +#, fuzzy +msgid "NAT and Firewall" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:9 +msgid "Network protocol and ports" +msgstr "" + +#: ../gtk/parameters.ui.h:10 +#, fuzzy +msgid "Privacy" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:11 +#, fuzzy +msgid "Proxy accounts" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:12 +#, fuzzy +msgid "Transport" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:13 +#, fuzzy +msgid "Video" +msgstr "Contactando " + +#: ../gtk/parameters.ui.h:14 +msgid "" +"Adaptive rate control is a technique to dynamically guess the available " +"bandwidth during a call." +msgstr "" + +#: ../gtk/parameters.ui.h:15 +msgid "ALSA special device (optional):" +msgstr "" + +#: ../gtk/parameters.ui.h:16 +msgid "Add" +msgstr "Añadir" + +#: ../gtk/parameters.ui.h:17 +msgid "Audio RTP/UDP:" +msgstr "" + +#: ../gtk/parameters.ui.h:18 +#, fuzzy +msgid "Audio codecs" +msgstr "Propiedades del codec de Audio" + +#: ../gtk/parameters.ui.h:19 +msgid "Behind NAT / Firewall (specify gateway IP below)" +msgstr "" + +#: ../gtk/parameters.ui.h:20 +msgid "Behind NAT / Firewall (use STUN to resolve)" +msgstr "" + +#: ../gtk/parameters.ui.h:22 +msgid "CIF" +msgstr "" + +#: ../gtk/parameters.ui.h:23 +#, fuzzy +msgid "Capture device:" +msgstr "Usar dispositivo de sonido:" + +#: ../gtk/parameters.ui.h:24 +#, fuzzy +msgid "Codecs" +msgstr "Codecs" + +#: ../gtk/parameters.ui.h:25 +msgid "Direct connection to the Internet" +msgstr "" + +#: ../gtk/parameters.ui.h:26 +msgid "Disable" +msgstr "Desactivado" + +#: ../gtk/parameters.ui.h:27 +#, fuzzy +msgid "Done" +msgstr "Ninguno." + +#: ../gtk/parameters.ui.h:28 +msgid "Download speed limit in Kbit/sec:" +msgstr "" + +#: ../gtk/parameters.ui.h:29 +msgid "Edit" +msgstr "" + +#: ../gtk/parameters.ui.h:30 +msgid "Enable" +msgstr "Activado" + +#: ../gtk/parameters.ui.h:31 +msgid "Enable adaptive rate control" +msgstr "" + +#: ../gtk/parameters.ui.h:32 +msgid "Enable echo cancellation" +msgstr "" + +#: ../gtk/parameters.ui.h:33 +msgid "Erase all passwords" +msgstr "" + +#: ../gtk/parameters.ui.h:34 +msgid "Manage SIP Accounts" +msgstr "" + +#: ../gtk/parameters.ui.h:35 +msgid "Media encryption type" +msgstr "" + +#: ../gtk/parameters.ui.h:36 +msgid "Multimedia settings" +msgstr "" + +#: ../gtk/parameters.ui.h:37 +#, fuzzy +msgid "Network settings" +msgstr "Red" + +#: ../gtk/parameters.ui.h:38 +#, fuzzy +msgid "Playback device:" +msgstr "Usar dispositivo de sonido:" + +#: ../gtk/parameters.ui.h:39 +msgid "Prefered video resolution:" +msgstr "" + +#: ../gtk/parameters.ui.h:40 +#, fuzzy +msgid "Public IP address:" +msgstr "Direccion SIP" + +#: ../gtk/parameters.ui.h:41 +msgid "" +"Register to FONICS\n" +"virtual network !" +msgstr "" + +#: ../gtk/parameters.ui.h:43 +msgid "Remove" +msgstr "Borrar" + +#: ../gtk/parameters.ui.h:44 +#, fuzzy +msgid "Ring device:" +msgstr "Usar dispositivo de sonido:" + +#: ../gtk/parameters.ui.h:45 +#, fuzzy +msgid "Ring sound:" +msgstr "Fuente de grabacion:" + +#: ../gtk/parameters.ui.h:46 +msgid "SIP (TCP)" +msgstr "" + +#: ../gtk/parameters.ui.h:47 +msgid "SIP (TLS)" +msgstr "" + +#: ../gtk/parameters.ui.h:48 +msgid "SIP (UDP)" +msgstr "" + +#: ../gtk/parameters.ui.h:49 +msgid "Send DTMFs as SIP info" +msgstr "" + +#: ../gtk/parameters.ui.h:50 +msgid "Set Maximum Transmission Unit:" +msgstr "" + +#: ../gtk/parameters.ui.h:51 +msgid "Settings" +msgstr "" + +#: ../gtk/parameters.ui.h:52 +msgid "Show advanced settings" +msgstr "" + +#: ../gtk/parameters.ui.h:53 +#, fuzzy +msgid "Stun server:" +msgstr "Servidor de Redireccionamiento" + +#: ../gtk/parameters.ui.h:54 +msgid "This section defines your SIP address when not using a SIP account" +msgstr "" + +#: ../gtk/parameters.ui.h:55 +msgid "Upload speed limit in Kbit/sec:" +msgstr "" + +#: ../gtk/parameters.ui.h:56 +msgid "Use IPv6 instead of IPv4" +msgstr "" + +#: ../gtk/parameters.ui.h:57 +#, fuzzy +msgid "User interface" +msgstr "Manual de Usuario" + +#: ../gtk/parameters.ui.h:58 +msgid "Video RTP/UDP:" +msgstr "" + +#: ../gtk/parameters.ui.h:59 +#, fuzzy +msgid "Video codecs" +msgstr "Propiedades del codec de Audio" + +#: ../gtk/parameters.ui.h:60 +#, fuzzy +msgid "Video input device:" +msgstr "Usar dispositivo de sonido:" + +#: ../gtk/parameters.ui.h:61 +msgid "Your display name (eg: John Doe):" +msgstr "" + +#: ../gtk/parameters.ui.h:62 +#, fuzzy +msgid "Your resulting SIP address:" +msgstr "Tu direccion SIP:" + +#: ../gtk/parameters.ui.h:63 +#, fuzzy +msgid "Your username:" +msgstr "Manual de Usuario" + +#: ../gtk/parameters.ui.h:64 +msgid "a sound card" +msgstr "" + +#: ../gtk/parameters.ui.h:65 +msgid "default camera" +msgstr "" + +#: ../gtk/parameters.ui.h:66 +msgid "default soundcard" +msgstr "" + +#: ../gtk/buddylookup.ui.h:1 +#, fuzzy +msgid "Search somebody" +msgstr "Contactando " + +#: ../gtk/buddylookup.ui.h:2 +msgid "Add to my list" +msgstr "" + +#: ../gtk/buddylookup.ui.h:3 +#, fuzzy +msgid "Search contacts in directory" +msgstr "Informacion de codec" + +#: ../gtk/waiting.ui.h:1 +#, fuzzy +msgid "Linphone" +msgstr "linphone" + +#: ../gtk/waiting.ui.h:2 +msgid "Please wait" +msgstr "" + +#: ../coreapi/linphonecore.c:187 +msgid "aborted" +msgstr "" + +#: ../coreapi/linphonecore.c:190 +msgid "completed" +msgstr "" + +#: ../coreapi/linphonecore.c:193 +msgid "missed" +msgstr "" + +#: ../coreapi/linphonecore.c:198 +#, c-format +msgid "" +"%s at %s\n" +"From: %s\n" +"To: %s\n" +"Status: %s\n" +"Duration: %i mn %i sec\n" +msgstr "" + +#: ../coreapi/linphonecore.c:199 +msgid "Outgoing call" +msgstr "" + +#: ../coreapi/linphonecore.c:1088 +#, fuzzy +msgid "Ready" +msgstr "Preparado." + +#: ../coreapi/linphonecore.c:1831 +msgid "Looking for telephone number destination..." +msgstr "" + +#: ../coreapi/linphonecore.c:1834 +msgid "Could not resolve this number." +msgstr "" + +#: ../coreapi/linphonecore.c:1878 +#, fuzzy +msgid "" +"Could not parse given sip address. A sip url usually looks like sip:" +"user@domain" +msgstr "" +"Direccion SIP mal escrita. Una direccion SIP es " + +#: ../coreapi/linphonecore.c:2025 +#, fuzzy +msgid "Contacting" +msgstr "Contactando " + +#: ../coreapi/linphonecore.c:2032 +#, fuzzy +msgid "Could not call" +msgstr "No se pudo encontrar el archivo pixmap: %s" + +#: ../coreapi/linphonecore.c:2140 +msgid "Sorry, we have reached the maximum number of simultaneous calls" +msgstr "" + +#: ../coreapi/linphonecore.c:2270 +msgid "Modifying call parameters..." +msgstr "" + +#: ../coreapi/linphonecore.c:2366 +msgid "Connected." +msgstr "Conectado." + +#: ../coreapi/linphonecore.c:2389 +#, fuzzy +msgid "Call aborted" +msgstr "Llamada cancelada." + +#: ../coreapi/linphonecore.c:2530 +msgid "Could not pause the call" +msgstr "" + +#: ../coreapi/linphonecore.c:2535 +msgid "Pausing the current call..." +msgstr "" + +#: ../coreapi/misc.c:147 +msgid "" +"Your computer appears to be using ALSA sound drivers.\n" +"This is the best choice. However the pcm oss emulation module\n" +"is missing and linphone needs it. Please execute\n" +"'modprobe snd-pcm-oss' as root to load it." +msgstr "" +"Tu ordenador parece estar usando los controladores de ALSA.\n" +"Esa es la mejor eleccion. Sin embargo el modulo de emulacion pcm de OSS\n" +"no se encuentra y linphone lo necesita. Por favor ejecute\n" +"'modprobe snd-pcm-oss' como root para cargarlo." + +#: ../coreapi/misc.c:150 +msgid "" +"Your computer appears to be using ALSA sound drivers.\n" +"This is the best choice. However the mixer oss emulation module\n" +"is missing and linphone needs it. Please execute\n" +" 'modprobe snd-mixer-oss' as root to load it." +msgstr "" +"Tu ordenador parece estar usando los controladores de ALSA.\n" +"Esa es la mejor eleccion. Sin embargo el modulo de emulacion mixer de OSS\n" +"no se encuentra y linphone lo necesita. Por favor ejecute\n" +" 'modprobe snd-mixer-oss' como root para cargarlo." + +#: ../coreapi/misc.c:478 +msgid "Stun lookup in progress..." +msgstr "" + +#: ../coreapi/friend.c:33 +#, fuzzy +msgid "Online" +msgstr "linea" + +#: ../coreapi/friend.c:36 +msgid "Busy" +msgstr "" + +#: ../coreapi/friend.c:39 +msgid "Be right back" +msgstr "" + +#: ../coreapi/friend.c:42 +msgid "Away" +msgstr "Ausente" + +#: ../coreapi/friend.c:45 +#, fuzzy +msgid "On the phone" +msgstr "linphone" + +#: ../coreapi/friend.c:48 +msgid "Out to lunch" +msgstr "" + +#: ../coreapi/friend.c:51 +msgid "Do not disturb" +msgstr "No molestar" + +#: ../coreapi/friend.c:54 +#, fuzzy +msgid "Moved" +msgstr "Codecs" + +#: ../coreapi/friend.c:57 +msgid "Using another messaging service" +msgstr "" + +#: ../coreapi/friend.c:60 +#, fuzzy +msgid "Offline" +msgstr "linea" + +#: ../coreapi/friend.c:63 +msgid "Pending" +msgstr "" + +#: ../coreapi/friend.c:66 +msgid "Unknown-bug" +msgstr "" + +#: ../coreapi/proxy.c:192 +msgid "" +"The sip proxy address you entered is invalid, it must start with \"sip:\" " +"followed by a hostname." +msgstr "" + +#: ../coreapi/proxy.c:198 +msgid "" +"The sip identity you entered is invalid.\n" +"It should look like sip:username@proxydomain, such as sip:alice@example.net" +msgstr "" + +#: ../coreapi/proxy.c:690 +#, fuzzy, c-format +msgid "Could not login as %s" +msgstr "No se pudo encontrar el archivo pixmap: %s" + +#: ../coreapi/callbacks.c:206 +#, fuzzy +msgid "is contacting you" +msgstr "le esta llamando." + +#: ../coreapi/callbacks.c:207 +msgid " and asked autoanswer." +msgstr "" + +#: ../coreapi/callbacks.c:207 +msgid "." +msgstr "" + +#: ../coreapi/callbacks.c:266 +#, fuzzy +msgid "Remote ringing." +msgstr "Registrando..." + +#: ../coreapi/callbacks.c:282 +#, fuzzy +msgid "Remote ringing..." +msgstr "Registrando..." + +#: ../coreapi/callbacks.c:293 +msgid "Early media." +msgstr "" + +#: ../coreapi/callbacks.c:331 +#, c-format +msgid "Call with %s is paused." +msgstr "" + +#: ../coreapi/callbacks.c:342 +#, c-format +msgid "Call answered by %s - on hold." +msgstr "" + +#: ../coreapi/callbacks.c:357 +#, fuzzy +msgid "Call resumed." +msgstr "Llamada cancelada." + +#: ../coreapi/callbacks.c:362 +#, fuzzy, c-format +msgid "Call answered by %s." +msgstr "" +"Llamar o\n" +"Responder" + +#: ../coreapi/callbacks.c:432 +msgid "We are being paused..." +msgstr "" + +#: ../coreapi/callbacks.c:436 +msgid "We have been resumed..." +msgstr "" + +#: ../coreapi/callbacks.c:441 +msgid "Call has been updated by remote..." +msgstr "" + +#: ../coreapi/callbacks.c:473 +#, fuzzy +msgid "Call terminated." +msgstr "Llamada cancelada." + +#: ../coreapi/callbacks.c:480 +msgid "User is busy." +msgstr "El usuario esta ocupado." + +#: ../coreapi/callbacks.c:481 +msgid "User is temporarily unavailable." +msgstr "El usuario le dice que volvera enseguida." + +#. char *retrymsg=_("%s. Retry after %i minute(s)."); +#: ../coreapi/callbacks.c:483 +msgid "User does not want to be disturbed." +msgstr "El usuario no quiere que lo molesten." + +#: ../coreapi/callbacks.c:484 +msgid "Call declined." +msgstr "Llamada cancelada." + +#: ../coreapi/callbacks.c:496 +msgid "No response." +msgstr "" + +#: ../coreapi/callbacks.c:500 +msgid "Protocol error." +msgstr "" + +#: ../coreapi/callbacks.c:516 +msgid "Redirected" +msgstr "" + +#: ../coreapi/callbacks.c:526 +msgid "Not found" +msgstr "" + +#: ../coreapi/callbacks.c:551 +msgid "No common codecs" +msgstr "" + +#: ../coreapi/callbacks.c:557 +#, fuzzy +msgid "Call failed." +msgstr "Llamada cancelada." + +#: ../coreapi/callbacks.c:631 +#, fuzzy, c-format +msgid "Registration on %s successful." +msgstr "Se ha registrado con exito." + +#: ../coreapi/callbacks.c:632 +#, fuzzy, c-format +msgid "Unregistration on %s done." +msgstr "Se ha registrado con exito." + +#: ../coreapi/callbacks.c:648 +msgid "no response timeout" +msgstr "" + +#: ../coreapi/callbacks.c:651 +#, fuzzy, c-format +msgid "Registration on %s failed: %s" +msgstr "Se ha registrado con exito." + +#: ../coreapi/sal_eXosip2.c:873 ../coreapi/sal_eXosip2.c:875 +#, fuzzy +msgid "Authentication failure" +msgstr "Informacion de codec" + +#: ../coreapi/linphonecall.c:128 +#, fuzzy, c-format +msgid "Authentication token is %s" +msgstr "Informacion de codec" + +#: ../coreapi/linphonecall.c:1560 +#, c-format +msgid "You have missed %i call." +msgid_plural "You have missed %i calls." +msgstr[0] "" +msgstr[1] "" + +#, fuzzy +#~ msgid "Contact list" +#~ msgstr "Contactando " + +#, fuzzy +#~ msgid "Audio & video" +#~ msgstr "Propiedades del codec de Audio" + +#, fuzzy +#~ msgid "Audio only" +#~ msgstr "Propiedades del codec de Audio" + +#, fuzzy +#~ msgid "Duration:" +#~ msgstr "Informacion" + +#, fuzzy +#~ msgid "_Linphone" +#~ msgstr "linphone" + +#, fuzzy +#~ msgid "gtk-cancel" +#~ msgstr "Conectado." + +#, fuzzy +#~ msgid "gtk-ok" +#~ msgstr "Borrar" + +#, fuzzy +#~ msgid "gtk-close" +#~ msgstr "Conectado." + +#, fuzzy +#~ msgid "Ports" +#~ msgstr "Contactando " + +#, fuzzy +#~ msgid "_Modes" +#~ msgstr "Codecs" + +#, fuzzy +#~ msgid "" +#~ "Audio codecs\n" +#~ "Video codecs" +#~ msgstr "Propiedades del codec de Audio" + +#, fuzzy +#~ msgid "Request Cancelled." +#~ msgstr "Llamada cancelada." + +#~ msgid "User cannot be found at given address." +#~ msgstr "No se encontro ningun usuario en la direccion indicada." + +#~ msgid "Remote user cannot support any of proposed codecs." +#~ msgstr "El usuario remoto no soporta ninguno de los codecs propuestos." + +#~ msgid "Timeout." +#~ msgstr "Tiempo agotado." + +#~ msgid "Remote host was found but refused connection." +#~ msgstr "Se encontro host remoto pero rechazo la conexion." + +#~ msgid "" +#~ "User is not reachable at the moment but he invites you\n" +#~ "to contact him using the following alternate resource:" +#~ msgstr "" +#~ "Usuario no disponible en este momento pero le invita\n" +#~ "a contactarle usando el siguiente recurso alternativo:" + +#, fuzzy +#~ msgid "Gone" +#~ msgstr "Ninguno." + +#, fuzzy +#~ msgid "SIP address" +#~ msgstr "Direccion" + +#, fuzzy +#~ msgid "Display filters" +#~ msgstr "Nombre a mostrar:" + +#, fuzzy +#~ msgid "_Properties" +#~ msgstr "Propiedades de RTP" + +#, fuzzy +#~ msgid "Proxy in use" +#~ msgstr "Servidor Proxy" + +#~ msgid "Sound" +#~ msgstr "Sonido" + +#, fuzzy +#~ msgid "Proxy accounts" +#~ msgstr "Servidor Proxy" + +#~ msgid "Address book" +#~ msgstr "Agenda" + +#, fuzzy +#~ msgid "Shows the address book" +#~ msgstr "Muestra la Agenda" + +#~ msgid "Show more..." +#~ msgstr "Mostrar mas..." + +#~ msgid "Playback level:" +#~ msgstr "Nivel de reproduccion:" + +#~ msgid "Recording level:" +#~ msgstr "Nivel de Grabacion:" + +#, fuzzy +#~ msgid "Ring level:" +#~ msgstr "Nivel de Grabacion:" + +#~ msgid "Reachable" +#~ msgstr "Disponible" + +#~ msgid "Busy, I'll be back in " +#~ msgstr "Ocupado, estare de vuelta en " + +#~ msgid "The other party will be informed that you'll be back in X minutes" +#~ msgstr "" +#~ "Se le comunicara a la otra persona que estaras de vuelta en X minutos" + +#~ msgid "mn" +#~ msgstr "min" + +#~ msgid "Moved temporarily" +#~ msgstr "Vengo enseguida" + +#~ msgid "Alternative service" +#~ msgstr "Servicio alternativo" + +#~ msgid "URL:" +#~ msgstr "URL:" + +#~ msgid "Presence" +#~ msgstr "Estado" + +#~ msgid "Press digits to send DTMFs." +#~ msgstr "Pulsa los digitos para mandar DTMFs." + +#~ msgid "DTMF" +#~ msgstr "DTMF" + +#~ msgid "" +#~ "Linphone is a web-phone.\n" +#~ "It is compatible with SIP and RTP protocols." +#~ msgstr "" +#~ "Linphone es un telefono para Internet.\n" +#~ "Es compatible con los protocolos SIP y RTP." + +#, fuzzy +#~ msgid "Use IPv6 network (if available)" +#~ msgstr "El usuario le dice que volvera enseguida." + +#, fuzzy +#~ msgid "" +#~ "These options is only for users in a private network, behind a gateway. " +#~ "If you are not in this situation, then leave this empty." +#~ msgstr "" +#~ "Esta opcion es solo para usuarios en una red privada, detras de un " +#~ "cortafuegos. Siese no es tu caso, deja esto vacio." + +#, fuzzy +#~ msgid "NAT traversal options (experimental)" +#~ msgstr "Opciones para NAT transversal (experimental)" + +#, fuzzy +#~ msgid "Number of buffered miliseconds (jitter compensation):" +#~ msgstr "Numero de milisegundos en el buffer(compensacion jitter):" + +#~ msgid "RTP port used for audio:" +#~ msgstr "Puerto RTP usado para audio:" + +#~ msgid "micro" +#~ msgstr "microfono" + +#~ msgid "Recording source:" +#~ msgstr "Fuente de grabacion:" + +#~ msgid "Sound properties" +#~ msgstr "Propiedades de sonido" + +#~ msgid "Run sip user agent on port:" +#~ msgstr "Ejecutar SIP user agent en el puerto:" + +#~ msgid "It is strongly recommended to use port 5060." +#~ msgstr "Se recomienda encarecidamente usar el puerto 5060." + +#~ msgid "SIP port" +#~ msgstr "Puerto SIP" + +#~ msgid "@" +#~ msgstr "@" + +#~ msgid "Identity" +#~ msgstr "Identidad" + +#, fuzzy +#~ msgid "Add proxy/registrar" +#~ msgstr "Usar el registro SIP" + +#~ msgid "Remote services" +#~ msgstr "Servicios Remotos:" + +#~ msgid "SIP" +#~ msgstr "SIP" + +#~ msgid "List of audio codecs, in order of preference:" +#~ msgstr "Lista de codecs de audio, en orden de preferencia:" + +#~ msgid "" +#~ "Note: Codecs in red are not usable regarding to your connection type to " +#~ "the internet." +#~ msgstr "" +#~ "Nota: Los codecs en ROJO no son adecuados para tu conexion a internet." + +#, fuzzy +#~ msgid "No information availlable" +#~ msgstr "Informacion no disponible" + +#, fuzzy +#~ msgid "Codec information" +#~ msgstr "Informacion de codec" + +#~ msgid "Address Book" +#~ msgstr "Agenda" + +#~ msgid "Select" +#~ msgstr "Seleccionar" + +#~ msgid "" +#~ "User is not reachable at the moment but he invites you to contact him " +#~ "using the following alternate ressource:" +#~ msgstr "" +#~ "Usuario no disponible en este momento pero le invita a contactarle usando " +#~ "el siguiente recurso alternativo:" + +#~ msgid "None." +#~ msgstr "Ninguno." + +#, fuzzy +#~ msgid "Name:" +#~ msgstr "Nombre" + +#, fuzzy +#~ msgid "Bad sip address: a sip address looks like sip:user@domain" +#~ msgstr "" +#~ "Direccion SIP mal escrita. Una direccion SIP es " + +#~ msgid "Communication ended." +#~ msgstr "Comunicacion finalizada." + +#, fuzzy +#~ msgid "Firewall 's external ip address (in dot notations):" +#~ msgstr "Direccion IP del cortafuegos (en notacion con puntos):" + +#~ msgid "Index" +#~ msgstr "Indice" + +#, fuzzy +#~ msgid "Server address" +#~ msgstr "Direccion del Servidor:" + +#~ msgid "28k modem" +#~ msgstr "modem 28k" + +#~ msgid "56k modem" +#~ msgstr "modem 56k" + +#~ msgid "64k modem (numeris)" +#~ msgstr "modem 64k (numeris)" + +#~ msgid "ADSL or Cable modem" +#~ msgstr "ADSL o Cable" + +#~ msgid "Ethernet or equivalent" +#~ msgstr "Ethernet o equivalente" + +#~ msgid "Connection type:" +#~ msgstr "Tipo de conexion:" + +#, fuzzy +#~ msgid "" +#~ "Linphone could not open audio device %s. Check if your sound card is " +#~ "fully configured and working." +#~ msgstr "" +#~ "Linphone no pudo abrir el dispositivo de audio. Asegurese que su tarjeta " +#~ "de sonido esta completamente configurada y operativa." + +#~ msgid "Type here the sip address of the person you want to call." +#~ msgstr "Escribe aqui la direccion SIP de la persona que quieres llamar." + +#~ msgid "" +#~ "Release or\n" +#~ "Refuse" +#~ msgstr "" +#~ "Descolgar o\n" +#~ "Rechazar" + +#~ msgid "%s. Retry after %i minute(s)." +#~ msgstr "%s. Reintentar tras %i minutos." + +#, fuzzy +#~ msgid "Timeout..." +#~ msgstr "Tiempo agotado." + +#~ msgid "Toggle this if you want to be registered on a remote server." +#~ msgstr "Marcar opcion si desea registrarse en un servidor remoto." + +#~ msgid "Address of record:" +#~ msgstr "Nombre de registro:" + +#~ msgid "" +#~ "The password used for registration. On some servers it is not necessary" +#~ msgstr "" +#~ "La contraseña usada para registrarse. En algunos servidores no es " +#~ "necesaria" + +#~ msgid "Use this registrar server as outbound proxy." +#~ msgstr "Usar el servidor de registro como outbound proxy." + +#~ msgid "sip address:" +#~ msgstr "Direccion SIP:" + +#~ msgid "Modify" +#~ msgstr "Modificar" + +#~ msgid "" +#~ "You are currently using the i810_audio driver.\n" +#~ "This driver is buggy and so does not work with Linphone.\n" +#~ "We suggest that you replace it by its equivalent ALSA driver,\n" +#~ "either with packages from your distribution, or by downloading\n" +#~ "ALSA drivers at http://www.alsa-project.org." +#~ msgstr "" +#~ "Estas usando actualmente el controlador i810_audio.\n" +#~ "Ese controlador tiene errores y por tanto no funciona con Linphone.\n" +#~ "Le recomendamos que lo sustituya por su controlador equivalente de ALSA,\n" +#~ "ya sea mediante paquetes de su distribucion, o descargando\n" +#~ "controladores ALSA de http://www.alsa-project.org." + +#~ msgid "Unregistration successfull." +#~ msgstr "Cancelacion del registro completada." + +#~ msgid "C: 2001" +#~ msgstr "Abril 2001" + +#~ msgid "Select network interface to use:" +#~ msgstr "Selecciona la interfaz de red para usar:" + +#~ msgid "Network interface properties" +#~ msgstr "Propiedades de Interfaz de Red:" + +#~ msgid "RTP" +#~ msgstr "RTP" + +#~ msgid "Threads not supported by glib. Upgrade your glib.\n" +#~ msgstr "Threads no soportados por glib. Actualize su glib.\n" + +#~ msgid "Run linphone as a gnome-applet." +#~ msgstr "Lanzar linphone como un gnome-applet." + +#~ msgid "Run linphone as a daemon (for use without gnome)." +#~ msgstr "Ejecutar linphone como demonio (para uso sin gnome)." + +#~ msgid "" +#~ "Cannot find network previously used interface %s.\n" +#~ "If your computer is temporary connected to the internet, please connect " +#~ "and then run linphone.\n" +#~ "If you want to change your default network interface, go to the " +#~ "parameters 'box." +#~ msgstr "" +#~ "No se puede encontrar la interfaz de red usada previamente %s.\n" +#~ "Si tu ordenador esta conectado temporalmente a Internet, por favor " +#~ "conecta y entonces ejecuta linphone.\n" +#~ "Si quieres cambiar tu interfaz de red predeterminada, ve a la opcion " +#~ "Parametros." + +#, fuzzy +#~ msgid "" +#~ "Linphone cannot open the audio device.\n" +#~ "It may be caused by other programs using it.\n" +#~ "Do you want linphone to kill these programs (esd or artsd) ?" +#~ msgstr "" +#~ "Linphone no puede abrir el dispositivo de audio.\n" +#~ " Puede deberse a que otros programas lo esten usando.\n" +#~ "¿ Quiere que Linphone cierre esos programas (esd o artsd) ?" + +#~ msgid "Use it as a:" +#~ msgstr "Usarlo como un:" + +#~ msgid "Outbound proxy" +#~ msgstr "Outbound proxy" + +#~ msgid "" +#~ "Togle this button if the registrar must be used to proxy calls through a " +#~ "firewall." +#~ msgstr "" +#~ "Marcar esta opcion si el servidor de registro debe ser usado para " +#~ "llamadas a proxy a traves de un cortafuegos." + +#~ msgid "OSS" +#~ msgstr "OSS" + +#~ msgid "ALSA" +#~ msgstr "ALSA" + +#~ msgid "Automatically kill applications using soundcard when needed" +#~ msgstr "" +#~ "Cerrar aplicaciones que usen la tarjeta de sonido cuando se necesite." + +#~ msgid "" +#~ "Your computer is connected to several networks. Check in the global " +#~ "parameters if Linphone uses the one that you want." +#~ msgstr "" +#~ "Tu ordenador esta conectado a varias redes. Revisa en los Parametros " +#~ "globales si Linphone usa la que necesitas." + +#~ msgid "" +#~ "Linphone failed to open the sound device. See the README file included in " +#~ "the distribution for details." +#~ msgstr "" +#~ "Linphone fallo al abrir el dispositivo de sonido. Vea el archivo README " +#~ "incluido en la distribucion para mas detalles." + +#~ msgid "Interface not found." +#~ msgstr "Interfaz no encontrada." + +#~ msgid "Warning" +#~ msgstr "Atencion" + +#~ msgid "" +#~ "Linphone cannot open the sound device. It may be caused by other programs " +#~ "using it. Do you want linphone to kill these programs (esd or artsd) ?" +#~ msgstr "" +#~ "Linphone no puede abrir el dispositivo de sonido. Puede deberse a que " +#~ "otros programaslo esten usando. ¿ Quiere que Linphone cierre esos " +#~ "programas (esd o artsd) ?" + +#~ msgid "Linphone shutdowns..." +#~ msgstr "Linphone esta terminando..." + +#~ msgid "" +#~ "Please, wait a few seconds untils linphone unregisters your sip addess " +#~ "from registrar server..." +#~ msgstr "" +#~ "Por favor, espere unos segundos hasta que Linphone cancele el registro de " +#~ "su direccion SIP en el servidor de registros..." + +#~ msgid "Bad formuled sip address." +#~ msgstr "Direccion SIP mal escrita." + +#~ msgid "Couldn't create pixmap from file: %s" +#~ msgstr "No se pudo crear pixmap desde el archivo: %s" + +#~ msgid "" +#~ "Linphone did not detect any valid network interface. If you use a " +#~ "temporary internet connection, please connect and then run linphone again." +#~ msgstr "" +#~ "Linphone no detecto ninguna interfaz de red valida. Si usas una conexion " +#~ "temporal a Internet, por favor conecta y vuelve a ejecutar Linphone." + +#~ msgid "List of network interfaces on your system." +#~ msgstr "Lista de interfaces de red en tu sistema." + +#~ msgid "" +#~ "RTP est le mode de transport de la voix. Modifier ces paramètres pour " +#~ "tenter d'améliorer la qualité de la communication si celle-ci est " +#~ "dégradée." +#~ msgstr "" +#~ "RTP es el modelo de transporte de la voz. Modifica estos parametros para " +#~ "intentar mejorar la calidad de la comunicacion, si es que.es mala." + +#~ msgid "Use rtp port:" +#~ msgstr "Puerto RTP:" + +#~ msgid "" +#~ "Les codecs ou vocodeurs sont les algorithmes utilisés pour compresser la " +#~ "voix." +#~ msgstr "" +#~ "Los codecs o codificadores/decodificadores son los algoritmos usados para " +#~ "comprimir la voz." + +#~ msgid "" +#~ "Vous pouvez ajuster avec cet onglet des paramètre liés à votre carte son." +#~ msgstr "Puede modificar estos parametros a su gusto." From 131086ee0c4659dd2dc89ec0e21fb963fab51914 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 22 Mar 2012 16:23:44 +0100 Subject: [PATCH 178/769] Renamed exported setCpu method --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index bc4f6a14e..bec7bbba7 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1706,6 +1706,6 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPolicy(JNIEnv *e linphone_core_set_video_policy((LinphoneCore *)lc, &vpol); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCount(JNIEnv *env, jobject thiz, jint count) { +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCountNative(JNIEnv *env, jobject thiz, jint count) { ms_set_cpu_count(count); } From 849f5c75d09b1df37d4420c62c2d562d2c56e14e Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 22 Mar 2012 16:50:42 +0100 Subject: [PATCH 179/769] Added multicore option for MS --- LinphoneCoreImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 939a022d2..92faacc55 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -706,4 +706,10 @@ class LinphoneCoreImpl implements LinphoneCore { public void setUserAgent(String name, String version) { setUserAgent(nativePtr,name,version); } + + private native void setCpuCountNative(int count); + public void setCpuCount(int count) + { + setCpuCountNative(count); + } } From a43d75d8a36099f14638eaf14606535fe559df7b Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 14 Mar 2012 16:25:53 +0100 Subject: [PATCH 180/769] Add display_filter_auto_rotate paramter to linphonerc Conflicts: mediastreamer2 --- coreapi/linphonecall.c | 1 + mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index bb68bf03e..82d4e5098 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -899,6 +899,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){ call->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc)); + video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0)); if( lc->video_conf.displaytype != NULL) video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype); video_stream_set_event_callback(call->videostream,video_stream_event_cb, call); diff --git a/mediastreamer2 b/mediastreamer2 index 0481d7d11..d1e350535 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0481d7d11e445bf04b095f4adc6d3b76f9e86ee2 +Subproject commit d1e3505352c469f91333f65e43cda48560b26a91 From b285ff17c8f3f9d40c01cbb3f05c6c882d6e3ea3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 26 Mar 2012 11:54:33 +0200 Subject: [PATCH 181/769] implement property to set video max recv buf size --- coreapi/linphonecall.c | 25 ++++++++++++++----------- mediastreamer2 | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 82d4e5098..4872a4cdc 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -898,18 +898,21 @@ void linphone_call_init_media_streams(LinphoneCall *call){ #ifdef VIDEO_ENABLED if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){ + int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); call->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc)); - video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0)); - if( lc->video_conf.displaytype != NULL) - video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype); - video_stream_set_event_callback(call->videostream,video_stream_event_cb, call); - if (lc->rtptf){ - RtpTransport *vrtp=lc->rtptf->video_rtp_func(lc->rtptf->video_rtp_func_data, call->video_port); - RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); - rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); - } - call->videostream_app_evq = ortp_ev_queue_new(); - rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq); + video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0)); + if (video_recv_buf_size>0) rtp_session_set_recv_buf_size(call->videostream->session,video_recv_buf_size); + + if( lc->video_conf.displaytype != NULL) + video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype); + video_stream_set_event_callback(call->videostream,video_stream_event_cb, call); + if (lc->rtptf){ + RtpTransport *vrtp=lc->rtptf->video_rtp_func(lc->rtptf->video_rtp_func_data, call->video_port); + RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); + rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); + } + call->videostream_app_evq = ortp_ev_queue_new(); + rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq); #ifdef TEST_EXT_RENDERER video_stream_set_render_callback(call->videostream,rendercb,NULL); #endif diff --git a/mediastreamer2 b/mediastreamer2 index d1e350535..b2893aabe 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d1e3505352c469f91333f65e43cda48560b26a91 +Subproject commit b2893aabe7f2ea65a084f60bdfde0962b680ab53 From 680fbbf02499867b58c39a5b632db98cf67cbf94 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 26 Mar 2012 12:55:08 +0200 Subject: [PATCH 182/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index b2893aabe..33599a544 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b2893aabe7f2ea65a084f60bdfde0962b680ab53 +Subproject commit 33599a544a23878604cd42a769c1044d599c1347 From 35ab327fb2fed019f920adb1bfc4ad60a3677b01 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 26 Mar 2012 15:21:32 +0200 Subject: [PATCH 183/769] Update current_call before notifiying call state change for LinphoneCallStreamsRunning --- coreapi/callbacks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 63bff23a9..5ffd43e44 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -368,9 +368,9 @@ static void call_accepted(SalOp *op){ } } linphone_core_update_streams (lc,call,md); - linphone_call_set_state(call, LinphoneCallStreamsRunning, "Streams running"); if (!call->current_params.in_conference) lc->current_call=call; + linphone_call_set_state(call, LinphoneCallStreamsRunning, "Streams running"); } }else{ /*send a bye*/ From 8ffeb3eb7c7e5738883f6c247330316753bf173e Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 26 Mar 2012 15:22:20 +0200 Subject: [PATCH 184/769] Expose ms2 MS_VIDEO_DECODER_FIRST_IMAGE_DECODED event to application --- coreapi/linphonecall.c | 8 +++++++- coreapi/linphonecore.h | 5 ++++- mediastreamer2 | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4872a4cdc..bf96a0400 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -842,12 +842,18 @@ static void rendercb(void *data, const MSPicture *local, const MSPicture *remote #ifdef VIDEO_ENABLED static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const unsigned int event_id, const void *args){ + LinphoneCall* call = (LinphoneCall*) user_pointer; ms_warning("In linphonecall.c: video_stream_event_cb"); switch (event_id) { case MS_VIDEO_DECODER_DECODING_ERRORS: ms_warning("Case is MS_VIDEO_DECODER_DECODING_ERRORS"); - linphone_call_send_vfu_request((LinphoneCall*) user_pointer); + linphone_call_send_vfu_request(call); break; + case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED: + ms_message("First video frame decoded successfully"); + if (call->core->vtable.call_first_video_frame != NULL) + call->core->vtable.call_first_video_frame(call->core, call); + break; default: ms_warning("Unhandled event %i", event_id); break; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 35fa25ad3..ea14d1596 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -613,7 +613,9 @@ typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int d typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to); /** Callback prototype */ typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf); - +/** Callback prototype */ +typedef void (*CallFirstVideoFrameCb)(struct _LinphoneCore *lc, LinphoneCall *call); + /** * This structure holds all callbacks that the application should implement. * None is mandatory. @@ -637,6 +639,7 @@ typedef struct _LinphoneVTable{ DisplayUrlCb display_url; ShowInterfaceCb show; /**< Notifies the application that it should show up*/ CallEncryptionChangedCb call_encryption_changed; /** Date: Tue, 27 Mar 2012 09:14:07 +0200 Subject: [PATCH 185/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index ef76a73e3..992399ad9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ef76a73e369e5afe9d7172b4330ebce2b2aee0ae +Subproject commit 992399ad92032dd5da35c84ec0a14249c8af5144 From 9a21860f49a6c4c52f5aafbcba84cf960d94b400 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 27 Mar 2012 15:22:57 +0200 Subject: [PATCH 186/769] Add 'video_enabled' information to call log --- coreapi/linphonecall.c | 1 + coreapi/linphonecore.c | 2 ++ coreapi/linphonecore.h | 1 + mediastreamer2 | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index bf96a0400..61a528d2a 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1337,6 +1337,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut call->current_params.has_video=FALSE; if (call->videostream!=NULL) { linphone_call_start_video_stream(call,cname,all_inputs_muted); + call->log->video_enabled = TRUE; } call->all_muted=all_inputs_muted; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 63be1a7fc..bee7ad5fe 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -132,6 +132,7 @@ void call_logs_write_to_config_file(LinphoneCore *lc){ lp_config_set_int(cfg,logsection,"duration",cl->duration); if (cl->refkey) lp_config_set_string(cfg,logsection,"refkey",cl->refkey); lp_config_set_float(cfg,logsection,"quality",cl->quality); + lp_config_set_int(cfg,logsection,"video_enabled", cl->video_enabled); } for(;imax_call_logs;++i){ snprintf(logsection,sizeof(logsection),"call_log_%i",i); @@ -160,6 +161,7 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){ tmp=lp_config_get_string(cfg,logsection,"refkey",NULL); if (tmp) cl->refkey=ms_strdup(tmp); cl->quality=lp_config_get_float(cfg,logsection,"quality",-1); + cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0); lc->call_logs=ms_list_append(lc->call_logs,cl); }else break; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index ea14d1596..b7ceb87dd 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -153,6 +153,7 @@ typedef struct _LinphoneCallLog{ rtp_stats_t local_stats; rtp_stats_t remote_stats; float quality; + int video_enabled; struct _LinphoneCore *lc; } LinphoneCallLog; diff --git a/mediastreamer2 b/mediastreamer2 index 992399ad9..513945c97 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 992399ad92032dd5da35c84ec0a14249c8af5144 +Subproject commit 513945c9781dbb9ae6905bb7fa80db2665f64d01 From 2cb5c30f98ba04071dfcfa21d2c9a9bf1a744ae9 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 27 Mar 2012 15:56:12 +0200 Subject: [PATCH 187/769] Update RPM spec (use git version when it is possible) --- linphone.spec.in | 2 +- mediastreamer2 | 2 +- oRTP | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/linphone.spec.in b/linphone.spec.in index ff79974e6..44e3f5f00 100644 --- a/linphone.spec.in +++ b/linphone.spec.in @@ -11,7 +11,7 @@ Name: linphone Version: @VERSION@ -Release: %(git describe --tags | sed 's/.*-\([0-9]*\)-g.*/\1/' || echo '1')%{?dist} +Release: %(git describe --tags --abbrev=40 | sed -rn 's/^.*-([0-9]+)-g[a-z0-9]{40}$/\1/p' || echo '1')%{?dist} Summary: Phone anywhere in the whole world by using the Internet Group: Applications/Communications diff --git a/mediastreamer2 b/mediastreamer2 index 513945c97..9d722a145 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 513945c9781dbb9ae6905bb7fa80db2665f64d01 +Subproject commit 9d722a1456c8574b385fac0eadf4ad6a4067637b diff --git a/oRTP b/oRTP index 3fb614e2e..99cbcd905 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 3fb614e2ed15803f2c96c223cceb5545a60f2431 +Subproject commit 99cbcd905d357fd3a297f8d0e2aa4698c11c805a From 00984708fdda2c97b19b1f056efcaa35c800f8b1 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 27 Mar 2012 16:19:45 +0200 Subject: [PATCH 188/769] fix linphone-devel mediastream-devel dependency --- linphone.spec.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/linphone.spec.in b/linphone.spec.in index 44e3f5f00..86929b575 100644 --- a/linphone.spec.in +++ b/linphone.spec.in @@ -27,7 +27,7 @@ BuildRequires: gtk2-devel BuildRequires: libeXosip2-devel speex-devel gettext BuildRequires: intltool gettext-devel %if %{video} -BuildRequires: ffmpeg-devel SDL-devel +BuildRequires: ffmpeg-devel SDL-devel %endif %description @@ -35,12 +35,12 @@ Linphone is a SIP compliant audio & video phone. It can be used to run calls over the internet. It has a gtk+ and console interface. %package devel -Summary: Development libraries for linphone -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} -Requires: ortp-devel = @ORTP_VERSION@ -Requires: mediastreamer2-devel = @MS2_VERSION@ -Requires: glib2-devel +Summary: Development libraries for linphone +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: ortp-devel = @ORTP_VERSION@ +Requires: mediastreamer-devel = @MS2_VERSION@ +Requires: glib2-devel %description devel Libraries and headers required to develop software with linphone. From 3a8b6a943c924d3049ed1980721959ab628d471d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 29 Mar 2012 10:43:46 +0200 Subject: [PATCH 189/769] fix mac os build (AM_GNU_GETTEXT was adding flags to CPPFLAGS) --- configure.ac | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index ce3604451..7a523eecb 100644 --- a/configure.ac +++ b/configure.ac @@ -102,9 +102,13 @@ AC_SUBST(ALL_LINGUAS) AC_DEFINE_UNQUOTED(LINPHONE_ALL_LANGS, "$ALL_LINGUAS", [All supported languages]) if test "$mingw_found" != "yes" ; then -dnl gettext macro does not work properly under mingw. And we want to use the one provided by GTK. -AM_GNU_GETTEXT([external]) -LIBS="$LIBS $LIBINTL" + dnl gettext macro does not work properly under mingw. And we want to use the one provided by GTK. + + dnl AM_GNU_GETTEXT pollutes CPPFLAGS: workaround this. + CPPFLAGS_save=$CPPFLAGS + AM_GNU_GETTEXT([external]) + CPPFLAGS=$CPPFLAGS_save + LIBS="$LIBS $LIBINTL" else AC_DEFINE(ENABLE_NLS,1,[Tells whether localisation is possible]) AC_DEFINE(HAVE_GETTEXT,1,[Tells wheter localisation is possible]) From 48f34568c9fab1cbc11e3c6030fca07d175d488d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 29 Mar 2012 15:09:52 +0200 Subject: [PATCH 190/769] implement notifications when doing transfers --- configure.ac | 2 +- coreapi/callbacks.c | 40 +++++++++++++- coreapi/linphonecall.c | 5 ++ coreapi/linphonecore.c | 10 +++- coreapi/linphonecore.h | 9 ++- coreapi/presence.c | 2 +- coreapi/private.h | 5 +- coreapi/sal.h | 17 ++++-- coreapi/sal_eXosip2.c | 121 +++++++++++++++++++++++++++++------------ gtk/incall_view.c | 22 ++++++++ gtk/linphone.h | 1 + gtk/main.c | 6 ++ mediastreamer2 | 2 +- 13 files changed, 191 insertions(+), 51 deletions(-) diff --git a/configure.ac b/configure.ac index 7a523eecb..2bead21dd 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ if test "$LINPHONE_EXTRA_VERSION" != "" ;then LINPHONE_VERSION=$LINPHONE_VERSION.${LINPHONE_EXTRA_VERSION} fi -LIBLINPHONE_SO_CURRENT=4 dnl increment this number when you add/change/remove an interface +LIBLINPHONE_SO_CURRENT=5 dnl increment this number when you add/change/remove an interface LIBLINPHONE_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT LIBLINPHONE_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 5ffd43e44..8d41da101 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -323,6 +323,7 @@ static void call_accepted(SalOp *op){ call->state==LinphoneCallOutgoingRinging || call->state==LinphoneCallOutgoingEarlyMedia){ linphone_call_set_state(call,LinphoneCallConnected,"Connected"); + if (call->referer) linphone_core_notify_refer_state(lc,call->referer,call); } if (md && !sal_media_description_empty(md)){ if (sal_media_description_has_dir(md,SalStreamSendOnly) || @@ -591,6 +592,10 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de } else { linphone_call_set_state(call,LinphoneCallError,msg); } + if (call->referer && linphone_call_get_state(call->referer)==LinphoneCallPaused && call->referer->was_automatically_paused){ + /*resume to the call that send us the refer automatically*/ + linphone_core_resume_call(lc,call->referer); + } } static void call_released(SalOp *op){ @@ -744,12 +749,11 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ if (call->state!=LinphoneCallPaused){ ms_message("Automatically pausing current call to accept transfer."); linphone_core_pause_call(lc,call); + call->was_automatically_paused=TRUE; } linphone_core_start_refered_call(lc,call); - sal_call_accept_refer(op); }else if (lc->vtable.refer_received){ lc->vtable.refer_received(lc,referto); - sal_call_accept_refer(op); } } @@ -766,7 +770,7 @@ static void notify(SalOp *op, const char *from, const char *msg){ lc->vtable.notify_recv(lc,call,from,msg); } -static void notify_presence(SalOp *op, SalSubscribeState ss, SalPresenceStatus status, const char *msg){ +static void notify_presence(SalOp *op, SalSubscribeStatus ss, SalPresenceStatus status, const char *msg){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); linphone_notify_recv(lc,op,ss,status); } @@ -795,6 +799,35 @@ static void ping_reply(SalOp *op){ } } +static void notify_refer(SalOp *op, SalReferStatus status){ + LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); + LinphoneCall *call=(LinphoneCall*) sal_op_get_user_pointer(op); + LinphoneCallState cstate; + if (call==NULL) { + ms_warning("Receiving notify_refer for unknown call."); + return ; + } + switch(status){ + case SalReferTrying: + cstate=LinphoneCallOutgoingProgress; + break; + case SalReferSuccess: + cstate=LinphoneCallConnected; + break; + case SalReferFailed: + cstate=LinphoneCallError; + break; + default: + cstate=LinphoneCallError; + } + if (lc->vtable.transfer_state_changed) + lc->vtable.transfer_state_changed(lc,call,cstate); + if (cstate==LinphoneCallConnected){ + /*automatically terminate the call as the transfer is complete.*/ + linphone_core_terminate_call(lc,call); + } +} + SalCallbacks linphone_sal_callbacks={ call_received, call_ringing, @@ -814,6 +847,7 @@ SalCallbacks linphone_sal_callbacks={ text_received, notify, notify_presence, + notify_refer, subscribe_received, subscribe_closed, ping_reply diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 61a528d2a..433d0ce26 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -332,6 +332,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr discover_mtu(lc,linphone_address_get_domain (to)); if (params->referer){ sal_call_set_referer(call->op,params->referer->op); + call->referer=linphone_call_ref(params->referer); } return call; } @@ -401,6 +402,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){ linphone_core_stop_dtmf(lc); call->ringing_beep=FALSE; } + if (call->referer){ + linphone_call_unref(call->referer); + call->referer=NULL; + } } void linphone_call_fix_call_parameters(LinphoneCall *call){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index bee7ad5fe..904f6a6c8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1943,12 +1943,20 @@ const char * linphone_core_get_route(LinphoneCore *lc){ void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call){ if (call->refer_pending){ LinphoneCallParams *cp=linphone_core_create_default_call_parameters(lc); + LinphoneCall *newcall; cp->has_video &= !!lc->video_policy.automatically_initiate; cp->referer=call; ms_message("Starting new call to refered address %s",call->refer_to); call->refer_pending=FALSE; - linphone_core_invite_with_params(lc,call->refer_to,cp); + newcall=linphone_core_invite_with_params(lc,call->refer_to,cp); linphone_call_params_destroy(cp); + if (newcall) linphone_core_notify_refer_state(lc,call,newcall); + } +} + +void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall){ + if (referer->op!=NULL){ + sal_call_notify_refer_state(referer->op,newcall ? newcall->op : NULL); } } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index b7ceb87dd..4581d24fa 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -616,7 +616,9 @@ typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to); typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf); /** Callback prototype */ typedef void (*CallFirstVideoFrameCb)(struct _LinphoneCore *lc, LinphoneCall *call); - +/** Callback prototype for in progress transfers. The new_call_state is the state of the call resulting of the transfer, at the other party. */ +typedef void (*LinphoneTransferStateChanged)(struct _LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state); + /** * This structure holds all callbacks that the application should implement. * None is mandatory. @@ -632,6 +634,9 @@ typedef struct _LinphoneVTable{ TextMessageReceived text_received; /**< A text message has been received */ DtmfReceived dtmf_received; /**< A dtmf has been received received */ ReferReceived refer_received; /**< An out of call refer was received */ + CallEncryptionChangedCb call_encryption_changed; /**did,"SIP/2.0 100 Trying\r\n"); + } + else if (newcall->cid!=-1){ + if (newcall->did==-1){ + /* not yet established*/ + if (!newcall->terminated){ + /* in progress*/ + send_notify_for_refer(h->did,"SIP/2.0 100 Trying\r\n"); + } + }else{ + if (!newcall->terminated){ + send_notify_for_refer(h->did,"SIP/2.0 200 Ok\r\n"); + } + } + } + return 0; +} + int sal_ping(SalOp *op, const char *from, const char *to){ osip_message_t *options=NULL; @@ -748,26 +787,6 @@ int sal_ping(SalOp *op, const char *from, const char *to){ return -1; } -int sal_call_accept_refer(SalOp *op){ - osip_message_t *msg=NULL; - int err=0; - eXosip_lock(); - err = eXosip_call_build_notify(op->did,EXOSIP_SUBCRSTATE_ACTIVE,&msg); - if(msg != NULL) - { - osip_message_set_header(msg,(const char *)"event","refer"); - osip_message_set_content_type(msg,"message/sipfrag"); - osip_message_set_body(msg,"SIP/2.0 100 Trying",sizeof("SIP/2.0 100 Trying")); - eXosip_call_send_request(op->did,msg); - } - else - { - ms_error("could not get a notify built\n"); - } - eXosip_unlock(); - return err; -} - int sal_call_refer(SalOp *h, const char *refer_to){ osip_message_t *msg=NULL; int err=0; @@ -1517,6 +1536,51 @@ static void process_refer(Sal *sal, SalOp *op, eXosip_event_t *ev){ } } +void process_notify(Sal *sal, eXosip_event_t *ev){ + osip_header_t *h=NULL; + char *from=NULL; + SalOp *op=find_op(sal,ev); + osip_message_t *ans=NULL; + + ms_message("Receiving NOTIFY request !"); + osip_from_to_str(ev->request->from,&from); + osip_message_header_get_byname(ev->request,"Event",0,&h); + if(h){ + osip_body_t *body=NULL; + //osip_content_type_t *ct=NULL; + osip_message_get_body(ev->request,0,&body); + //ct=osip_message_get_content_type(ev->request); + if (h->hvalue && strcasecmp(h->hvalue,"refer")==0){ + /*special handling of refer events*/ + if (body && body->body){ + osip_message_t *msg; + osip_message_init(&msg); + if (osip_message_parse_sipfrag(msg,body->body,strlen(body->body))==0){ + int code=osip_message_get_status_code(msg); + if (code==100){ + sal->callbacks.notify_refer(op,SalReferTrying); + }else if (code==200){ + sal->callbacks.notify_refer(op,SalReferSuccess); + }else if (code>=400){ + sal->callbacks.notify_refer(op,SalReferFailed); + } + } + osip_message_free(msg); + } + }else{ + /*generic handling*/ + sal->callbacks.notify(op,from,h->hvalue); + } + } + /*answer that we received the notify*/ + eXosip_lock(); + eXosip_call_build_answer(ev->tid,200,&ans); + if (ans) + eXosip_call_send_answer(ev->tid,200,ans); + eXosip_unlock(); + osip_free(from); +} + static void call_message_new(Sal *sal, eXosip_event_t *ev){ osip_message_t *ans=NULL; if (ev->request){ @@ -1559,22 +1623,7 @@ static void call_message_new(Sal *sal, eXosip_event_t *ev){ ms_message("Receiving REFER request !"); process_refer(sal,op,ev); }else if(MSG_IS_NOTIFY(ev->request)){ - osip_header_t *h=NULL; - char *from=NULL; - SalOp *op=find_op(sal,ev); - - ms_message("Receiving NOTIFY request !"); - osip_from_to_str(ev->request->from,&from); - osip_message_header_get_byname(ev->request,"Event",0,&h); - if(h) - sal->callbacks.notify(op,from,h->hvalue); - /*answer that we received the notify*/ - eXosip_lock(); - eXosip_call_build_answer(ev->tid,200,&ans); - if (ans) - eXosip_call_send_answer(ev->tid,200,ans); - eXosip_unlock(); - osip_free(from); + process_notify(sal,ev); }else if (MSG_IS_OPTIONS(ev->request)){ eXosip_lock(); eXosip_call_build_answer(ev->tid,200,&ans); diff --git a/gtk/incall_view.c b/gtk/incall_view.c index d693ac149..d19dba8c2 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -579,6 +579,28 @@ void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_m linphone_gtk_terminate_conference_participant(call); } +void linphone_gtk_in_call_view_set_transfer_status(LinphoneCall *call,LinphoneCallState cstate){ + GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); + if (callview){ + GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration"); + const char *transfer_status="unknown"; + switch(cstate){ + case LinphoneCallOutgoingProgress: + transfer_status=_("Transfer in progress"); + break; + case LinphoneCallConnected: + transfer_status=_("Transfer done."); + break; + case LinphoneCallError: + transfer_status=_("Transfer failed."); + break; + default: + break; + } + gtk_label_set_text(GTK_LABEL(duration),transfer_status); + } +} + void linphone_gtk_draw_mute_button(GtkButton *button, gboolean active){ g_object_set_data(G_OBJECT(button),"active",GINT_TO_POINTER(active)); if (active){ diff --git a/gtk/linphone.h b/gtk/linphone.h index 7074bc87d..d4cafe28f 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -107,6 +107,7 @@ void linphone_gtk_in_call_view_update_duration(LinphoneCall *call); void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_msg); void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call); void linphone_gtk_in_call_view_set_paused(LinphoneCall *call); +void linphone_gtk_in_call_view_set_transfer_status(LinphoneCall *call,LinphoneCallState cstate); void linphone_gtk_mute_clicked(GtkButton *button); void linphone_gtk_enable_mute_button(GtkButton *button, gboolean sensitive); void linphone_gtk_enable_hold_button(LinphoneCall *call, gboolean sensitive, gboolean holdon); diff --git a/gtk/main.c b/gtk/main.c index 60c4556d7..819195268 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -63,6 +63,7 @@ static void linphone_gtk_display_url(LinphoneCore *lc, const char *msg, const ch static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl); static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cs, const char *msg); static void linphone_gtk_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t enabled, const char *token); +static void linphone_gtk_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate); static gboolean linphone_gtk_auto_answer(LinphoneCall *call); static void linphone_gtk_status_icon_set_blinking(gboolean val); @@ -225,6 +226,7 @@ static void linphone_gtk_init_liblinphone(const char *config_file, vtable.refer_received=linphone_gtk_refer_received; vtable.buddy_info_updated=linphone_gtk_buddy_info_updated; vtable.call_encryption_changed=linphone_gtk_call_encryption_changed; + vtable.transfer_state_changed=linphone_gtk_transfer_state_changed; linphone_core_set_user_agent("Linphone", LINPHONE_VERSION); the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL); @@ -1133,6 +1135,10 @@ static void linphone_gtk_call_encryption_changed(LinphoneCore *lc, LinphoneCall linphone_gtk_in_call_view_show_encryption(call); } +static void linphone_gtk_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate){ + linphone_gtk_in_call_view_set_transfer_status(call,cstate); +} + static void update_registration_status(LinphoneProxyConfig *cfg, LinphoneRegistrationState rs){ GtkComboBox *box=GTK_COMBO_BOX(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"identities")); GtkTreeModel *model=gtk_combo_box_get_model(box); diff --git a/mediastreamer2 b/mediastreamer2 index 9d722a145..1b517a0bc 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 9d722a1456c8574b385fac0eadf4ad6a4067637b +Subproject commit 1b517a0bc1d6559267143130d137d0252a05f752 From 9c0fb8ce7189334c36e86b638ed72e5199a7118a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 29 Mar 2012 15:55:55 +0200 Subject: [PATCH 191/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1b517a0bc..7af64431d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1b517a0bc1d6559267143130d137d0252a05f752 +Subproject commit 7af64431dde94b21e0313ced873726462b4f5f32 From d481382fb4c55300737d1f6fc02cecb4d509cc60 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 30 Mar 2012 13:06:19 +0200 Subject: [PATCH 192/769] Moved the 'video frame decoded' callback from Core to LinphoneCall --- coreapi/linphonecall.c | 14 +++++++++++--- coreapi/linphonecore.h | 10 ++++++---- coreapi/private.h | 7 +++++++ mediastreamer2 | 2 +- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 433d0ce26..35e840902 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -856,8 +856,8 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u break; case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED: ms_message("First video frame decoded successfully"); - if (call->core->vtable.call_first_video_frame != NULL) - call->core->vtable.call_first_video_frame(call->core, call); + if (call->nextVideoFrameDecoded._func != NULL) + call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data); break; default: ms_warning("Unhandled event %i", event_id); @@ -866,6 +866,14 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u } #endif +void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data) { + call->nextVideoFrameDecoded._func = cb; + call->nextVideoFrameDecoded._user_data = user_data; +#ifdef VIDEO_ENABLED + ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION); +#endif +} + void linphone_call_init_media_streams(LinphoneCall *call){ LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; @@ -1284,6 +1292,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna cam=get_nowebcam_device(); } if (!is_inactive){ + call->log->video_enabled = TRUE; video_stream_set_direction (call->videostream, dir); ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); video_stream_set_device_rotation(call->videostream, lc->device_rotation); @@ -1342,7 +1351,6 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut call->current_params.has_video=FALSE; if (call->videostream!=NULL) { linphone_call_start_video_stream(call,cname,all_inputs_muted); - call->log->video_enabled = TRUE; } call->all_muted=all_inputs_muted; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 4581d24fa..9ed629710 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -226,6 +226,9 @@ typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy; **/ struct _LinphoneCall; typedef struct _LinphoneCall LinphoneCall; + +/** Callback prototype */ +typedef void (*LinphoneCallCbFunc)(struct _LinphoneCall *call,void * user_data); /** * LinphoneCallState enum represents the different state a call can reach into. @@ -287,6 +290,8 @@ void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t void linphone_call_send_vfu_request(LinphoneCall *call); void *linphone_call_get_user_pointer(LinphoneCall *call); void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer); +void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data); + /** * Enables or disable echo cancellation for this call * @param call @@ -614,8 +619,6 @@ typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int d typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to); /** Callback prototype */ typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf); -/** Callback prototype */ -typedef void (*CallFirstVideoFrameCb)(struct _LinphoneCore *lc, LinphoneCall *call); /** Callback prototype for in progress transfers. The new_call_state is the state of the call resulting of the transfer, at the other party. */ typedef void (*LinphoneTransferStateChanged)(struct _LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state); @@ -635,8 +638,7 @@ typedef struct _LinphoneVTable{ DtmfReceived dtmf_received; /**< A dtmf has been received received */ ReferReceived refer_received; /**< An out of call refer was received */ CallEncryptionChangedCb call_encryption_changed; /** Date: Fri, 30 Mar 2012 15:44:58 +0200 Subject: [PATCH 193/769] don't try to send text through not yet established dialogs --- coreapi/chat.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index d90cf61e4..9847c2c3b 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -52,15 +52,20 @@ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg){ const char *route=NULL; const char *identity=linphone_core_find_best_identity(cr->lc,cr->peer_url,&route); - SalOp *op; + SalOp *op=NULL; LinphoneCall *call; - if((call = linphone_core_get_call_by_remote_address(cr->lc,cr->peer))!=NULL) - { - ms_message("send SIP message into the call\n"); - op = call->op; + if((call = linphone_core_get_call_by_remote_address(cr->lc,cr->peer))!=NULL){ + if (call->state==LinphoneCallConnected || + call->state==LinphoneCallStreamsRunning || + call->state==LinphoneCallPaused || + call->state==LinphoneCallPausing || + call->state==LinphoneCallPausedByRemote){ + ms_message("send SIP message through the existing call."); + op = call->op; + } } - else - { + if (op==NULL){ + /*sending out of calls*/ op = sal_op_new(cr->lc->sal); sal_op_set_route(op,route); if (cr->op!=NULL){ From 478cb5104ce4e58793ac2cc1feed0c3bdcec576c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 31 Mar 2012 16:32:31 +0200 Subject: [PATCH 194/769] update ms2 to repair build --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 624178446..0796641e6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6241784466c0032b701cbb00d4ddab1db120bbf0 +Subproject commit 0796641e644123ac2e38384bdf9f6d66638ecbdc From 1f53d4f5d88493b9fb09be75f67a25960b1c526a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 2 Apr 2012 17:12:54 +0200 Subject: [PATCH 195/769] update oRTP for zrtp and srtp bugfixes --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 99cbcd905..04570bd7a 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 99cbcd905d357fd3a297f8d0e2aa4698c11c805a +Subproject commit 04570bd7a02f9baa682c4667fbba16e8c951b62b From aab6c70d934e40381e8b32504dbe2848d9bd1f7f Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 3 Apr 2012 10:49:23 +0200 Subject: [PATCH 196/769] introduce use of card preferred sample rate, usefull for IOS to speed-up call estbalishement --- coreapi/callbacks.c | 1 + coreapi/linphonecall.c | 14 ++++++++++---- coreapi/sal.h | 1 + mediastreamer2 | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 63bff23a9..a4181cfa0 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -276,6 +276,7 @@ static void call_ringing(SalOp *h){ if (lc->ringstream!=NULL) return; /*already ringing !*/ if (lc->sound_conf.play_sndcard!=NULL){ MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard; + if (call->localdesc->streams[0].max_rate>0) ms_snd_card_set_preferred_sample_rate(ringcard, call->localdesc->streams[0].max_rate); lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard); } ms_message("Remote ringing..."); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 82d4e5098..6ec119105 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/msfileplayer.h" #include "mediastreamer2/msjpegwriter.h" #include "mediastreamer2/mseventqueue.h" +#include "mediastreamer2/mssndcard.h" #ifdef VIDEO_ENABLED static MSWebCam *get_nowebcam_device(){ @@ -172,9 +173,10 @@ void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t propagate_encryption_changed(call); } -static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, int bandwidth_limit){ +static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, int bandwidth_limit,int* max_sample_rate){ MSList *l=NULL; const MSList *it; + if (max_sample_rate) *max_sample_rate=0; for(it=codecs;it!=NULL;it=it->next){ PayloadType *pt=(PayloadType*)it->data; if (pt->flags & PAYLOAD_TYPE_ENABLED){ @@ -184,6 +186,7 @@ static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, int bandw } if (linphone_core_check_payload_type_usability(lc,pt)){ l=ms_list_append(l,payload_type_clone(pt)); + if (max_sample_rate && payload_type_get_rate(pt)>*max_sample_rate) *max_sample_rate=payload_type_get_rate(pt); } } } @@ -199,6 +202,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); + md->session_id=session_id; md->session_ver=session_ver; md->nstreams=1; @@ -213,10 +217,11 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li SalProtoRtpSavp : SalProtoRtpAvp; md->streams[0].type=SalAudio; md->streams[0].ptime=lc->net_conf.down_ptime; - l=make_codec_list(lc,lc->codecs_conf.audio_codecs,call->params.audio_bw); + l=make_codec_list(lc,lc->codecs_conf.audio_codecs,call->params.audio_bw,&md->streams[0].max_rate); pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event")); l=ms_list_append(l,pt); md->streams[0].payloads=l; + if (call->params.has_video){ @@ -224,7 +229,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[1].port=call->video_port; md->streams[1].proto=md->streams[0].proto; md->streams[1].type=SalVideo; - l=make_codec_list(lc,lc->codecs_conf.video_codecs,0); + l=make_codec_list(lc,lc->codecs_conf.video_codecs,0,NULL); md->streams[1].payloads=l; } @@ -1154,7 +1159,8 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna captcard=playcard=NULL; } use_ec=captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc); - + if (playcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(playcard, stream->max_rate); + if (captcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(captcard, stream->max_rate); audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc); audio_stream_start_full( call->audiostream, diff --git a/coreapi/sal.h b/coreapi/sal.h index 1ae18a9d4..e74e80c68 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -134,6 +134,7 @@ typedef struct SalStreamDescription{ SalStreamDir dir; SalSrtpCryptoAlgo crypto[SAL_CRYPTO_ALGO_MAX]; unsigned int crypto_local_tag; + int max_rate; } SalStreamDescription; #define SAL_MEDIA_DESCRIPTION_MAX_STREAMS 4 diff --git a/mediastreamer2 b/mediastreamer2 index d1e350535..3e43a4991 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d1e3505352c469f91333f65e43cda48560b26a91 +Subproject commit 3e43a499150a684eef2d775e3fe8ff4ddf72b769 From cc40a4f2a7f6fc6eab689208804868d836ddcd8e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 3 Apr 2012 15:04:28 +0200 Subject: [PATCH 197/769] fix compilation issues --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 3e43a4991..32adc29b6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3e43a499150a684eef2d775e3fe8ff4ddf72b769 +Subproject commit 32adc29b6fbee450c2bfd307dd9642eaecff16ef From b06a202d82739f9e9d66a02104f79f8399ecb680 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 3 Apr 2012 15:35:42 +0200 Subject: [PATCH 198/769] fix: don't stop ringback in linphone_core_stop_dtmf_stream(). --- coreapi/linphonecore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 904f6a6c8..6f459b2be 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4583,8 +4583,10 @@ void linphone_core_start_dtmf_stream(LinphoneCore* lc) { } void linphone_core_stop_dtmf_stream(LinphoneCore* lc) { - if (lc->ringstream) ring_stop(lc->ringstream); - lc->ringstream=NULL; + if (lc->ringstream && dmfs_playing_start_time!=0) { + ring_stop(lc->ringstream); + lc->ringstream=NULL; + } } int linphone_core_get_max_calls(LinphoneCore *lc) { From 9b421bfd4358c3189ea717f2a2c4050eb0bdcb01 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 3 Apr 2012 16:04:57 +0200 Subject: [PATCH 199/769] fix broken compile --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6f459b2be..f99cb9c29 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4583,7 +4583,7 @@ void linphone_core_start_dtmf_stream(LinphoneCore* lc) { } void linphone_core_stop_dtmf_stream(LinphoneCore* lc) { - if (lc->ringstream && dmfs_playing_start_time!=0) { + if (lc->ringstream && lc->dmfs_playing_start_time!=0) { ring_stop(lc->ringstream); lc->ringstream=NULL; } From 05e04e20594d5ace744cb8aee3cc386376cefb72 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 3 Apr 2012 15:34:03 +0200 Subject: [PATCH 200/769] Add transfer_state property to LinphoneCall --- coreapi/callbacks.c | 4 ++-- coreapi/linphonecall.c | 13 +++++++++++++ coreapi/linphonecore.c | 5 ++++- coreapi/linphonecore.h | 1 + coreapi/private.h | 2 ++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 34fd552af..c58b42e73 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -420,6 +420,7 @@ static void call_resumed(LinphoneCore *lc, LinphoneCall *call){ if(lc->vtable.display_status) lc->vtable.display_status(lc,_("We have been resumed.")); linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)"); + linphone_call_set_transfer_state(call, LinphoneCallIdle); } static void call_paused_by_remote(LinphoneCore *lc, LinphoneCall *call){ @@ -821,8 +822,7 @@ static void notify_refer(SalOp *op, SalReferStatus status){ default: cstate=LinphoneCallError; } - if (lc->vtable.transfer_state_changed) - lc->vtable.transfer_state_changed(lc,call,cstate); + linphone_call_set_transfer_state(call, cstate); if (cstate==LinphoneCallConnected){ /*automatically terminate the call as the transfer is complete.*/ linphone_core_terminate_call(lc,call); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 9c3ecfd11..d41c6cdad 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -295,6 +295,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, call->magic=linphone_call_magic; call->refcnt=1; call->state=LinphoneCallIdle; + call->transfer_state = LinphoneCallIdle; call->start_time=time(NULL); call->media_start_time=0; call->log=linphone_call_log_new(call, from, to); @@ -1675,4 +1676,16 @@ void linphone_call_log_completed(LinphoneCall *call){ call_logs_write_to_config_file(lc); } +LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call) { + return call->transfer_state; +} + +void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state) { + if (state != call->transfer_state) { + LinphoneCore* lc = call->core; + call->transfer_state = state; + if (lc->vtable.transfer_state_changed) + lc->vtable.transfer_state_changed(lc, call, state); + } +} diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f99cb9c29..3a081d23d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2262,6 +2262,7 @@ int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char sal_call_refer(call->op,real_url); ms_free(real_url); linphone_address_destroy(real_parsed_url); + linphone_call_set_transfer_state(call, LinphoneCallOutgoingInit); return 0; } @@ -2278,7 +2279,9 @@ int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char * close the call with us (the 'dest' call). **/ int linphone_core_transfer_call_to_another(LinphoneCore *lc, LinphoneCall *call, LinphoneCall *dest){ - return sal_call_refer_with_replaces (call->op,dest->op); + int result = sal_call_refer_with_replaces (call->op,dest->op); + linphone_call_set_transfer_state(call, LinphoneCallOutgoingInit); + return result; } bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 9ed629710..d2860c3a2 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -291,6 +291,7 @@ void linphone_call_send_vfu_request(LinphoneCall *call); void *linphone_call_get_user_pointer(LinphoneCall *call); void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer); void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data); +LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call); /** * Enables or disable echo cancellation for this call diff --git a/coreapi/private.h b/coreapi/private.h index 425b51008..ec57eaf9c 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -100,6 +100,7 @@ struct _LinphoneCall time_t start_time; /*time at which the call was initiated*/ time_t media_start_time; /*time at which it was accepted, media streams established*/ LinphoneCallState state; + LinphoneCallState transfer_state; /*idle if no transfer*/ LinphoneReason reason; int refcnt; void * user_pointer; @@ -142,6 +143,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *local, LinphoneAddress * remote); void linphone_call_log_completed(LinphoneCall *call); void linphone_call_log_destroy(LinphoneCallLog *cl); +void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state); void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos); From cb41acb925aaeb761154f3166ce3107f9051a674 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 3 Apr 2012 16:18:23 +0200 Subject: [PATCH 201/769] fix auto-resuming of call in case of transfer failures --- coreapi/callbacks.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index c58b42e73..3f0ac8114 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -585,6 +585,10 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de lc->ringstream=NULL; } linphone_call_stop_media_streams (call); + if (call->referer && linphone_call_get_state(call->referer)==LinphoneCallPaused && call->referer->was_automatically_paused){ + /*resume to the call that send us the refer automatically*/ + linphone_core_resume_call(lc,call->referer); + } if (sr == SalReasonDeclined) { call->reason=LinphoneReasonDeclined; linphone_call_set_state(call,LinphoneCallEnd,"Call declined."); @@ -594,10 +598,6 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de } else { linphone_call_set_state(call,LinphoneCallError,msg); } - if (call->referer && linphone_call_get_state(call->referer)==LinphoneCallPaused && call->referer->was_automatically_paused){ - /*resume to the call that send us the refer automatically*/ - linphone_core_resume_call(lc,call->referer); - } } static void call_released(SalOp *op){ From e7123e495aa88c5432b1a7c21e5f9de39ef5bc90 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 3 Apr 2012 16:22:01 +0200 Subject: [PATCH 202/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 32adc29b6..3870493e9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 32adc29b6fbee450c2bfd307dd9642eaecff16ef +Subproject commit 3870493e9a59ddf7858cf4628dd86ec7a8b469d8 From 5d60fae67e3a524afcdaedfac5a3dc15333a3b07 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 4 Apr 2012 10:39:56 +0200 Subject: [PATCH 203/769] fix bug in incoming call timeout implementation --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3a081d23d..5854774ff 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1800,7 +1800,7 @@ void linphone_core_iterate(LinphoneCore *lc){ /*start the call even if the OPTIONS reply did not arrive*/ linphone_core_start_invite(lc,call,NULL); } - if (call->dir==LinphoneCallIncoming && call->state==LinphoneCallOutgoingRinging){ + if (call->state==LinphoneCallIncomingReceived){ elapsed=curtime-call->start_time; ms_message("incoming call ringing for %i seconds",elapsed); if (elapsed>lc->sip_conf.inc_timeout){ From 2111e92a393cd0cbf3934ea1de406904f0d34bca Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 4 Apr 2012 12:29:03 +0200 Subject: [PATCH 204/769] bugfix: do not retry without encryption when call is cancelled --- coreapi/callbacks.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 3f0ac8114..bde6a2f40 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -561,16 +561,18 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de int i; ms_message("Outgoing call failed with SRTP (SAVP) enabled - retrying with AVP"); linphone_call_stop_media_streams(call); - /* clear SRTP local params */ - call->params.media_encryption = LinphoneMediaEncryptionNone; - for(i=0; ilocaldesc->nstreams; i++) { - call->localdesc->streams[i].proto = SalProtoRtpAvp; - memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto)); + if (call->state==LinphoneCallOutgoingInit || call->state==LinphoneCallOutgoingProgress){ + /* clear SRTP local params */ + call->params.media_encryption = LinphoneMediaEncryptionNone; + for(i=0; ilocaldesc->nstreams; i++) { + call->localdesc->streams[i].proto = SalProtoRtpAvp; + memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto)); + } + linphone_core_start_invite(lc, call, NULL); } - linphone_core_start_invite(lc, call, NULL); return; } - msg=_("No common codecs"); + msg=_("Incompatible media parameters."); if (lc->vtable.display_status) lc->vtable.display_status(lc,msg); break; From 30eca09f41d40af19a67e64912a35bf1e313cd30 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 5 Apr 2012 12:43:41 +0200 Subject: [PATCH 205/769] add linphone_core_get_payload_type_number in api --- coreapi/linphonecore.h | 2 ++ coreapi/misc.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d2860c3a2..0bca75ce9 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -792,6 +792,8 @@ int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate) ; +int linphone_core_get_payload_type_number(LinphoneCore *lc, PayloadType *pt); + const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt); bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt); diff --git a/coreapi/misc.c b/coreapi/misc.c index ea85f1036..41d4efac8 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -202,6 +202,10 @@ int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t return -1; } +int linphone_core_get_payload_type_number(LinphoneCore *lc, PayloadType *pt){ + return payload_type_get_number(pt); +} + const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt){ if (ms_filter_codec_supported(pt->mime_type)){ MSFilterDesc *desc=ms_filter_get_encoder(pt->mime_type); From 01ea50745690cf33d15fc0c29c78b5bf4a730686 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 6 Apr 2012 12:59:48 +0200 Subject: [PATCH 206/769] update ms2 and ortp --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 3870493e9..150bda5db 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3870493e9a59ddf7858cf4628dd86ec7a8b469d8 +Subproject commit 150bda5db6f25850e32bb0947daee8bdd0222e52 diff --git a/oRTP b/oRTP index 04570bd7a..5e7a3b571 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 04570bd7a02f9baa682c4667fbba16e8c951b62b +Subproject commit 5e7a3b571a073cab29e52634c11f780d7008e0e8 From b3a6a7014ce66bcc27a884fed71cb13117634db3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 6 Apr 2012 16:03:52 +0200 Subject: [PATCH 207/769] update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 10dc278dc..413970e6a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +linphone-3.xxx -- + * fix bug in zRTP support (upgrade required) + * + linphone-3.5.2 -- February 22, 2012 * updated oRTP to 0.20.0 * updated mediastreamer2 to 2.8.2 From 9f4d3ab100b03cdd8e089e47d437ec1554d6d304 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 6 Apr 2012 16:07:14 +0200 Subject: [PATCH 208/769] Mediastreamer2 updated --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 150bda5db..ecee8e86d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 150bda5db6f25850e32bb0947daee8bdd0222e52 +Subproject commit ecee8e86d403a6bf18e87ca24607ce9a1783674c From 52e06a6fba5eba90f6daab043204105da7224bcd Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 6 Apr 2012 17:24:16 +0200 Subject: [PATCH 209/769] fix a few codecs without numbering --- coreapi/linphonecore.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 5854774ff..fd1fe7d1c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -992,6 +992,19 @@ static void linphone_core_assign_payload_type(LinphoneCore *lc, PayloadType *con lc->payload_types=ms_list_append(lc->payload_types,pt); } +static void linphone_core_handle_static_payloads(LinphoneCore *lc){ + RtpProfile *prof=&av_profile; + int i; + for(i=0;i<128;++i){ + PayloadType *pt=rtp_profile_get_payload(prof,i); + if (pt){ + if (payload_type_get_number(pt)!=i){ + linphone_core_assign_payload_type(lc,pt,i,NULL); + } + } + } +} + static void linphone_core_free_payload_types(LinphoneCore *lc){ ms_list_for_each(lc->payload_types,(void (*)(void*))payload_type_destroy); ms_list_free(lc->payload_types); @@ -1069,7 +1082,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta /*add all payload type for which we don't care about the number */ linphone_core_assign_payload_type(lc,&payload_type_ilbc,-1,"mode=30"); linphone_core_assign_payload_type(lc,&payload_type_amr,-1,"octet-align=1"); - linphone_core_assign_payload_type(lc,&payload_type_amrwb,-1,"octet-align=1"); + linphone_core_assign_payload_type(lc,&payload_type_amrwb,-1,"octet-align=1"); linphone_core_assign_payload_type(lc,&payload_type_lpc1015,-1,NULL); linphone_core_assign_payload_type(lc,&payload_type_g726_16,-1,NULL); linphone_core_assign_payload_type(lc,&payload_type_g726_24,-1,NULL); @@ -1084,6 +1097,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta linphone_core_assign_payload_type(lc,&payload_type_silk_wb,-1,NULL); linphone_core_assign_payload_type(lc,&payload_type_silk_swb,-1,NULL); linphone_core_assign_payload_type(lc,&payload_type_g729,18,"annexb=no"); + linphone_core_handle_static_payloads(lc); ms_init(); /* create a mediastreamer2 event queue and set it as global */ From f97f8094c9bce5a565018aa9dccd5a4bd2a1ddd4 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 11 Apr 2012 14:25:46 +0200 Subject: [PATCH 210/769] update ms2: protect iounit render call back againt filter destruction --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index ecee8e86d..abb47bc01 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ecee8e86d403a6bf18e87ca24607ce9a1783674c +Subproject commit abb47bc01fadac3e943d9d4a9cfb55993ca0e609 From 57d665e1625c0c1c3872b92096d6b12e1217ecc2 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 12 Apr 2012 13:51:55 +0200 Subject: [PATCH 211/769] fix ms2 compilation issue --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index abb47bc01..da89da8f9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit abb47bc01fadac3e943d9d4a9cfb55993ca0e609 +Subproject commit da89da8f938e658ef713511e2ff653bce4b7d423 From 51694fd79acb88cf1d7cb3e10d4aefd603449d08 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 16 Apr 2012 15:44:02 +0200 Subject: [PATCH 212/769] use double registration also for TCP and TLS --- coreapi/sal_eXosip2.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index a89a8a13c..ef82b9bea 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1788,26 +1788,24 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori osip_free(tmp); sal_address_destroy(ori_contact_address); - if (transport == SalTransportUDP) { - eXosip_lock(); - eXosip_register_build_register(op->rid,op->expires,&msg); - if (msg==NULL){ - eXosip_unlock(); - ms_warning("Fail to create a contact updated register."); - return FALSE; - } - if (fix_message_contact(op,msg,last_answer)) { - eXosip_register_send_register(op->rid,msg); - eXosip_unlock(); - ms_message("Resending new register with updated contact"); - return TRUE; - } else { - ms_warning("Fail to send updated register."); - eXosip_unlock(); - return FALSE; - } - eXosip_unlock(); + eXosip_lock(); + eXosip_register_build_register(op->rid,op->expires,&msg); + if (msg==NULL){ + eXosip_unlock(); + ms_warning("Fail to create a contact updated register."); + return FALSE; } + if (fix_message_contact(op,msg,last_answer)) { + eXosip_register_send_register(op->rid,msg); + eXosip_unlock(); + ms_message("Resending new register with updated contact"); + return TRUE; + } else { + ms_warning("Fail to send updated register."); + eXosip_unlock(); + return FALSE; + } + eXosip_unlock(); update_contact_from_response(op,last_answer); return FALSE; From 02369158f50408f4d805fe0284a37aa8fe953105 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 17 Apr 2012 11:13:29 +0200 Subject: [PATCH 213/769] Add video zoom API --- coreapi/linphonecore.c | 23 +++++++++++++++++++++++ coreapi/linphonecore.h | 2 ++ mediastreamer2 | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index fd1fe7d1c..f7d78a025 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4776,3 +4776,26 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para params->in_conference=FALSE; } +void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float cx, float cy) { + VideoStream* vstream = call->videostream; + float zoom[3]; + + if (zoom_factor < 1) + zoom_factor = 1; + float halfsize = 0.5 * 1.0 / zoom_factor; + + if ((cx - halfsize) < 0) + cx = 0 + halfsize; + if ((cx + halfsize) > 1) + cx = 1 - halfsize; + if ((cy - halfsize) < 0) + cy = 0 + halfsize; + if ((cy + halfsize) > 1) + cy = 1 - halfsize; + + zoom[0] = zoom_factor; + zoom[1] = cx; + zoom[2] = cy; + ms_filter_call_method(vstream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom); +} + diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 0bca75ce9..a5a1e8c0c 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1131,6 +1131,8 @@ typedef struct LinphoneTunnel LinphoneTunnel; * get tunnel instance if available */ LinphoneTunnel *linphone_core_get_tunnel(LinphoneCore *lc); + + void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float cx, float cy); #ifdef __cplusplus } diff --git a/mediastreamer2 b/mediastreamer2 index da89da8f9..c194c9209 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit da89da8f938e658ef713511e2ff653bce4b7d423 +Subproject commit c194c9209bf6c96d419c0513f979ca1114ff3111 From ec2bfe3f34e04b08e1410d2349e88ae700b4c271 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 17 Apr 2012 16:50:07 +0200 Subject: [PATCH 214/769] Makefile for Android without neon --- build/android/Android-no-neon.mk | 199 +++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 build/android/Android-no-neon.mk diff --git a/build/android/Android-no-neon.mk b/build/android/Android-no-neon.mk new file mode 100644 index 000000000..a7348ca5c --- /dev/null +++ b/build/android/Android-no-neon.mk @@ -0,0 +1,199 @@ +## +## Android.mk -Android build script- +## +## +## Copyright (C) 2010 Belledonne Communications, Grenoble, France +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## + +LOCAL_PATH:= $(call my-dir)/../../coreapi + + +include $(CLEAR_VARS) + +LOCAL_CPP_EXTENSION := .cc + +LOCAL_SRC_FILES := \ + linphonecore.c \ + misc.c \ + enum.c \ + presence.c \ + proxy.c \ + friend.c \ + authentication.c \ + lpconfig.c \ + chat.c \ + sipsetup.c \ + siplogin.c \ + address.c \ + linphonecore_jni.cc \ + sal.c \ + sal_eXosip2.c \ + sal_eXosip2_presence.c \ + sal_eXosip2_sdp.c \ + offeranswer.c \ + callbacks.c \ + linphonecall.c \ + conference.c \ + ec-calibrator.c + +ifndef MY_LOG_DOMAIN +MY_LOG_DOMAIN = \"Linphone\" +endif + +LOCAL_CFLAGS += \ + -D_BYTE_ORDER=_LITTLE_ENDIAN \ + -DORTP_INET6 \ + -DINET6 \ + -DOSIP_MT \ + -DENABLE_TRACE \ + -DLINPHONE_VERSION=\"3.4.0\" \ + -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ + -DLOG_DOMAIN=$(MY_LOG_DOMAIN) + +LOCAL_CFLAGS += -DIN_LINPHONE + +ifeq ($(LINPHONE_VIDEO),1) +LOCAL_CFLAGS += -DVIDEO_ENABLED +ifeq ($(BUILD_X264),1) +LOCAL_CFLAGS += -DHAVE_X264 +endif +endif + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/include \ + $(LOCAL_PATH)/../oRTP/include \ + $(LOCAL_PATH)/../mediastreamer2/include \ + $(LOCAL_PATH)/../../externals/exosip/include \ + $(LOCAL_PATH)/../../externals/osip/include + +LOCAL_LDLIBS += -llog -ldl + + + +LOCAL_STATIC_LIBRARIES := \ + cpufeatures \ + libmediastreamer2 \ + libortp \ + libeXosip2 \ + libosip2 \ + libgsm + +ifeq ($(BUILD_TUNNEL),1) +LOCAL_CFLAGS +=-DTUNNEL_ENABLED +LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../tunnel/include $(LOCAL_PATH)/../../tunnel/src +LOCAL_SRC_FILES += linphone_tunnel.cc TunnelManager.cc +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) +LOCAL_SHARED_LIBRARIES += libtunnelclient +else +LOCAL_STATIC_LIBRARIES += libtunnelclient +endif +endif + + +_BUILD_AMR=0 +ifneq ($(BUILD_AMRNB), 0) +_BUILD_AMR=1 +endif + +ifneq ($(BUILD_AMRWB), 0) +_BUILD_AMR=1 +endif + +ifneq ($(_BUILD_AMR), 0) +LOCAL_CFLAGS += -DHAVE_AMR +LOCAL_STATIC_LIBRARIES += \ + libmsamr \ + libopencoreamr +endif + +ifneq ($(BUILD_AMRWB), 0) +LOCAL_STATIC_LIBRARIES += \ + libvoamrwbenc +endif + + +ifeq ($(BUILD_SILK),1) +LOCAL_CFLAGS += -DHAVE_SILK +LOCAL_STATIC_LIBRARIES += libmssilk +endif + +ifeq ($(BUILD_G729),1) +LOCAL_CFLAGS += -DHAVE_G729 +LOCAL_SHARED_LIBRARIES += libbcg729 +LOCAL_STATIC_LIBRARIES += libmsbcg729 +endif + +ifeq ($(LINPHONE_VIDEO),1) +LOCAL_LDLIBS += -lGLESv2 +LOCAL_STATIC_LIBRARIES += libvpx +ifeq ($(BUILD_X264),1) +LOCAL_STATIC_LIBRARIES += \ + libmsx264 \ + libx264 +endif +LOCAL_SHARED_LIBRARIES += \ + libavcodecnoneon \ + libswscalenoneon \ + libavcorenoneon \ + libavutilnoneon +endif + +LOCAL_STATIC_LIBRARIES += libspeex + +ifeq ($(BUILD_SRTP), 1) + LOCAL_C_INCLUDES += $(SRTP_C_INCLUDE) +endif + +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) +LOCAL_CFLAGS += -DHAVE_ILBC=1 +LOCAL_STATIC_LIBRARIES += libmsilbc +endif + +LOCAL_C_INCLUDES += $(LIBLINPHONE_EXTENDED_C_INCLUDES) +LOCAL_WHOLE_STATIC_LIBRARIES += $(LIBLINPHONE_EXTENDED_STATIC_LIBS) +LOCAL_SRC_FILES += $(LIBLINPHONE_EXTENDED_SRC_FILES) + +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) + LOCAL_SHARED_LIBRARIES += liblinssl liblincrypto + ifeq ($(BUILD_GPLV3_ZRTP),1) + LOCAL_SHARED_LIBRARIES += libzrtpcpp + endif + + ifeq ($(BUILD_SRTP),1) + LOCAL_SHARED_LIBRARIES += libsrtp + endif +else + LOCAL_LDLIBS += -lz + #LOCAL_STATIC_LIBRARIES += libz libdl + LOCAL_STATIC_LIBRARIES += \ + libssl-static libcrypto-static + ifeq ($(BUILD_GPLV3_ZRTP),1) + LOCAL_STATIC_LIBRARIES += libzrtpcpp-static + endif + + ifeq ($(BUILD_SRTP),1) + LOCAL_STATIC_LIBRARIES += libsrtp-static + endif +endif + +LOCAL_MODULE := liblinphonenoneon +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,android/cpufeatures) + + From b24e3aba5f625e20f64dc43d21e0d2a4ac852882 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 17 Apr 2012 16:57:37 +0200 Subject: [PATCH 215/769] Fix last issue with pause + fix shared libs without neon problem --- LinphoneCoreFactoryImpl.java | 48 ++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index a5ae7805f..3dedd06d0 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -20,9 +20,12 @@ package org.linphone.core; import java.io.File; import java.io.IOException; +import java.io.InputStream; import org.linphone.mediastream.Version; +import android.util.Log; + public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { private static void loadOptionalLibrary(String s) { @@ -35,10 +38,17 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { static { // FFMPEG (audio/video) - loadOptionalLibrary("avutil"); - loadOptionalLibrary("swscale"); - loadOptionalLibrary("avcore"); - loadOptionalLibrary("avcodec"); + if (!hasNeonInCpuFeatures()) { + loadOptionalLibrary("avutilnoneon"); + loadOptionalLibrary("swscalenoneon"); + loadOptionalLibrary("avcorenoneon"); + loadOptionalLibrary("avcodecnoneon"); + } else { + loadOptionalLibrary("avutil"); + loadOptionalLibrary("swscale"); + loadOptionalLibrary("avcore"); + loadOptionalLibrary("avcodec"); + } // OPENSSL (cryptography) // lin prefix avoids collision with libs in /system/lib @@ -56,7 +66,11 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { loadOptionalLibrary("bcg729"); //Main library - System.loadLibrary("linphone"); + if (!hasNeonInCpuFeatures()) { + System.loadLibrary("linphonenoneon"); + } else { + System.loadLibrary("linphone"); + } Version.dumpCapabilities(); } @@ -121,4 +135,28 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { public LinphoneFriend createLinphoneFriend() { return createLinphoneFriend(null); } + + public static boolean hasNeonInCpuFeatures() + { + ProcessBuilder cmd; + boolean result = false; + + try { + String[] args = {"/system/bin/cat", "/proc/cpuinfo"}; + cmd = new ProcessBuilder(args); + + Process process = cmd.start(); + InputStream in = process.getInputStream(); + byte[] re = new byte[1024]; + while(in.read(re) != -1){ + String line = new String(re); + if (line.startsWith("Features")) + result = line.contains("neon"); + } + in.close(); + } catch(IOException ex){ + ex.printStackTrace(); + } + return result; + } } From a1d057be714b8a12fb7ab1c2b9586b442d831b04 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 17 Apr 2012 18:05:05 +0200 Subject: [PATCH 216/769] optimize AudioUnit startup time --- coreapi/callbacks.c | 7 +++++-- coreapi/linphonecore.c | 8 +++++++- mediastreamer2 | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index bde6a2f40..b587ac75c 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -277,6 +277,9 @@ static void call_ringing(SalOp *h){ if (lc->sound_conf.play_sndcard!=NULL){ MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard; if (call->localdesc->streams[0].max_rate>0) ms_snd_card_set_preferred_sample_rate(ringcard, call->localdesc->streams[0].max_rate); + /*we release sound before playing ringback tone*/ + if (call->audiostream) + audio_stream_unprepare_sound(call->audiostream); lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard); } ms_message("Remote ringing..."); @@ -285,7 +288,7 @@ static void call_ringing(SalOp *h){ linphone_call_set_state(call,LinphoneCallOutgoingRinging,"Remote ringing"); }else{ /*accept early media */ - if (call->audiostream && call->audiostream->ticker!=NULL){ + if (call->audiostream && audio_stream_started(call->audiostream)){ /*streams already started */ ms_message("Early media already started."); return; @@ -299,7 +302,7 @@ static void call_ringing(SalOp *h){ lc->ringstream=NULL; } ms_message("Doing early media..."); - linphone_core_update_streams (lc,call,md); + linphone_core_update_streams(lc,call,md); } } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f7d78a025..9a73d0aa6 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2071,8 +2071,9 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro ms_free(contact); } - //TODO : should probably not be done here linphone_call_init_media_streams(call); + if (lc->ringstream==NULL) + audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); if (!lc->sip_conf.sdp_200_ack){ call->media_pending=TRUE; sal_call_set_local_media_description(call->op,call->localdesc); @@ -2459,6 +2460,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, const char *contact=NULL; SalOp *replaced; SalMediaDescription *new_md; + bool_t was_ringing=FALSE; if (call==NULL){ //if just one call is present answer the only one ... @@ -2494,6 +2496,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, ring_stop(lc->ringstream); ms_message("ring stopped"); lc->ringstream=NULL; + was_ringing=TRUE; } if (call->ringing_beep){ linphone_core_stop_dtmf(lc); @@ -2515,6 +2518,9 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, if (call->audiostream==NULL) linphone_call_init_media_streams(call); + if (!was_ringing && call->audiostream->ticker==NULL){ + audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); + } if (params){ call->params=*params; diff --git a/mediastreamer2 b/mediastreamer2 index c194c9209..bef50ee99 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c194c9209bf6c96d419c0513f979ca1114ff3111 +Subproject commit bef50ee99700c4b6cb8c504fbec1686f3102edea From 1e25bf2a30cd6b9c78593cc19a14f38de8873aa7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 19 Apr 2012 11:36:17 +0200 Subject: [PATCH 217/769] fix bug with bad contact in 200Ok in case of authless proxy config. --- coreapi/sal_eXosip2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index ef82b9bea..f21f43654 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1799,6 +1799,7 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori eXosip_register_send_register(op->rid,msg); eXosip_unlock(); ms_message("Resending new register with updated contact"); + update_contact_from_response(op,last_answer); return TRUE; } else { ms_warning("Fail to send updated register."); @@ -1806,8 +1807,6 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori return FALSE; } eXosip_unlock(); - - update_contact_from_response(op,last_answer); return FALSE; } From c0c9ebc214434556b50db8023e172048cf7a9866 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 19 Apr 2012 16:32:30 +0200 Subject: [PATCH 218/769] Mediastreamer2 updated --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index bef50ee99..153983f60 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bef50ee99700c4b6cb8c504fbec1686f3102edea +Subproject commit 153983f60d0b1865bd1e6f164d7f48ff4fc4e7eb From d0501c8328f9008b65091ee106e91d95b4ffb1f6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 19 Apr 2012 16:35:29 +0200 Subject: [PATCH 219/769] Fix video preferences issue --- LinphoneCoreFactoryImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 3dedd06d0..29f1c58ca 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -150,8 +150,10 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { byte[] re = new byte[1024]; while(in.read(re) != -1){ String line = new String(re); - if (line.startsWith("Features")) + if (line.startsWith("Features")) { result = line.contains("neon"); + break; + } } in.close(); } catch(IOException ex){ From e1faecc5e5b363813046a776b7a88af477688c42 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 19 Apr 2012 17:47:31 +0200 Subject: [PATCH 220/769] fix bug for refer state notifications and update ortp --- coreapi/callbacks.c | 8 ++++++-- coreapi/sal_eXosip2.c | 25 ++++++++++++++++++++++--- coreapi/sal_eXosip2.h | 1 + oRTP | 2 +- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index b587ac75c..142a7a564 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -341,6 +341,8 @@ static void call_accepted(SalOp *op){ } linphone_core_update_streams (lc,call,md); linphone_call_set_state(call,LinphoneCallPaused,"Call paused"); + if (call->refer_pending) + linphone_core_start_refered_call(lc,call); }else if (sal_media_description_has_dir(md,SalStreamRecvOnly)){ /*we are put on hold when the call is initially accepted */ if (lc->vtable.display_status){ @@ -757,8 +759,10 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ ms_message("Automatically pausing current call to accept transfer."); linphone_core_pause_call(lc,call); call->was_automatically_paused=TRUE; - } - linphone_core_start_refered_call(lc,call); + /*then we will start the refered when the pause is accepted, in order to serialize transactions within the dialog. + * Indeed we need to avoid to send a NOTIFY to inform about of state of the refered call while the pause isn't completed. + **/ + }else linphone_core_start_refered_call(lc,call); }else if (lc->vtable.refer_received){ lc->vtable.refer_received(lc,referto); } diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index f21f43654..6a4e2b284 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -734,7 +734,7 @@ static int send_notify_for_refer(int did, const char *sipfrag){ eXosip_call_build_notify(did,EXOSIP_SUBCRSTATE_ACTIVE,&msg); if (msg==NULL){ eXosip_unlock(); - ms_error("Could not build NOTIFY for refer."); + ms_warning("Could not build NOTIFY for refer."); return -1; } osip_message_set_content_type(msg,"message/sipfrag"); @@ -760,7 +760,10 @@ int sal_call_notify_refer_state(SalOp *h, SalOp *newcall){ } }else{ if (!newcall->terminated){ - send_notify_for_refer(h->did,"SIP/2.0 200 Ok\r\n"); + if (send_notify_for_refer(h->did,"SIP/2.0 200 Ok\r\n")==-1){ + /* we need previous notify transaction to complete, so buffer the request for later*/ + h->sipfrag_pending="SIP/2.0 200 Ok\r\n"; + } } } } @@ -1536,7 +1539,7 @@ static void process_refer(Sal *sal, SalOp *op, eXosip_event_t *ev){ } } -void process_notify(Sal *sal, eXosip_event_t *ev){ +static void process_notify(Sal *sal, eXosip_event_t *ev){ osip_header_t *h=NULL; char *from=NULL; SalOp *op=find_op(sal,ev); @@ -1900,6 +1903,18 @@ static void other_request_reply(Sal *sal,eXosip_event_t *ev){ } } +static void process_in_call_reply(Sal *sal, eXosip_event_t *ev){ + SalOp *op=find_op(sal,ev); + if (ev->response){ + if (ev->request && strcmp(osip_message_get_method(ev->request),"NOTIFY")==0){ + if (op->sipfrag_pending){ + send_notify_for_refer(op->did,op->sipfrag_pending); + op->sipfrag_pending=NULL; + } + } + } +} + static bool_t process_event(Sal *sal, eXosip_event_t *ev){ ms_message("linphone process event get a message %d\n",ev->type); switch(ev->type){ @@ -1961,6 +1976,10 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){ return process_authentication(sal,ev); } break; + case EXOSIP_CALL_MESSAGE_ANSWERED: + ms_message("EXOSIP_CALL_MESSAGE_ANSWERED "); + process_in_call_reply(sal,ev); + break; case EXOSIP_IN_SUBSCRIPTION_NEW: ms_message("CALL_IN_SUBSCRIPTION_NEW "); sal_exosip_subscription_recv(sal,ev); diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index 75dd7e58c..f85ddfa1c 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -66,6 +66,7 @@ struct SalOp{ char *replaces; char *referred_by; const SalAuthInfo *auth_info; + const char *sipfrag_pending; bool_t supports_session_timers; bool_t sdp_offering; bool_t reinvite; diff --git a/oRTP b/oRTP index 5e7a3b571..41d13b7e4 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 5e7a3b571a073cab29e52634c11f780d7008e0e8 +Subproject commit 41d13b7e491c7fc418987b63ff6ef80c7e8895a4 From 7eee8c91693c3ac8ffb92e6a3df0bf1d8ef8d6a5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 20 Apr 2012 22:30:24 +0200 Subject: [PATCH 221/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 153983f60..75eb1fcf8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 153983f60d0b1865bd1e6f164d7f48ff4fc4e7eb +Subproject commit 75eb1fcf8d6097e51bcb507be339dd397c6b4dd5 From 93bed082d2c61a88bf793aa748e365744ce8df5b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 20 Apr 2012 22:49:29 +0200 Subject: [PATCH 222/769] stop dtmf stream before starting a new call --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 9a73d0aa6..a7ccef402 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2070,7 +2070,7 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro sal_op_set_contact(call->op, contact); ms_free(contact); } - + linphone_core_stop_dtmf_stream(lc); linphone_call_init_media_streams(call); if (lc->ringstream==NULL) audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); From 9694d4a9eba15cc79ed0813d9198082c1be052f3 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 23 Apr 2012 13:51:24 +0200 Subject: [PATCH 223/769] Compatible with Java 1.3 --- .../org/linphone/core/LinphoneCall.java | 4 +-- .../org/linphone/core/LinphoneCallLog.java | 4 +-- .../org/linphone/core/LinphoneCore.java | 27 +++++++++---------- .../linphone/core/LinphoneCoreFactory.java | 2 +- .../org/linphone/core/LinphoneFriend.java | 4 +-- .../org/linphone/core/OnlineStatus.java | 4 +-- 6 files changed, 21 insertions(+), 24 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index 24606ada7..4d8e23d80 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -31,7 +31,7 @@ public interface LinphoneCall { * */ static class State { - @SuppressWarnings("unchecked") + static private Vector values = new Vector(); private final int mValue; public final int value() {return mValue;} @@ -119,7 +119,7 @@ public interface LinphoneCall { */ public static final State CallReleased = new State(18,"CallReleased"); - @SuppressWarnings("unchecked") + private State(int value,String stringValue) { mValue = value; values.addElement(this); diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index dbd2bcc27..015f071df 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -31,7 +31,7 @@ public interface LinphoneCallLog { * */ static class CallStatus { - @SuppressWarnings("unchecked") + static private Vector values = new Vector(); private final int mValue; private final String mStringValue; @@ -52,7 +52,7 @@ public interface LinphoneCallLog { */ public final static CallStatus Declined = new CallStatus(3,"Declined"); - @SuppressWarnings("unchecked") + private CallStatus(int value,String stringValue) { mValue = value; values.addElement(this); diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 88db6a590..31300e384 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; - -import java.util.List; import java.util.Vector; import org.linphone.core.LinphoneCallParams; @@ -34,7 +32,7 @@ public interface LinphoneCore { * linphone core states */ static public class GlobalState { - @SuppressWarnings("unchecked") + static private Vector values = new Vector(); /** * Off @@ -56,7 +54,7 @@ public interface LinphoneCore { private final int mValue; private final String mStringValue; - @SuppressWarnings("unchecked") + private GlobalState(int value,String stringValue) { mValue = value; values.addElement(this); @@ -79,7 +77,7 @@ public interface LinphoneCore { * */ static public class RegistrationState { - @SuppressWarnings("unchecked") + private static Vector values = new Vector(); /** * None @@ -104,7 +102,7 @@ public interface LinphoneCore { private final int mValue; private final String mStringValue; - @SuppressWarnings("unchecked") + private RegistrationState(int value,String stringValue) { mValue = value; values.addElement(this); @@ -127,7 +125,7 @@ public interface LinphoneCore { * */ static public class FirewallPolicy { - @SuppressWarnings("unchecked") + static private Vector values = new Vector(); /** * No firewall is assumed. @@ -145,7 +143,7 @@ public interface LinphoneCore { private final int mValue; private final String mStringValue; - @SuppressWarnings("unchecked") + private FirewallPolicy(int value,String stringValue) { mValue = value; values.addElement(this); @@ -187,7 +185,7 @@ public interface LinphoneCore { * */ static public class MediaEncryption { - @SuppressWarnings("unchecked") + static private Vector values = new Vector(); /** * None @@ -204,7 +202,7 @@ public interface LinphoneCore { protected final int mValue; private final String mStringValue; - @SuppressWarnings("unchecked") + private MediaEncryption(int value,String stringValue) { mValue = value; values.addElement(this); @@ -226,7 +224,7 @@ public interface LinphoneCore { * EC Calibrator Status */ static public class EcCalibratorStatus { - @SuppressWarnings("unchecked") + static private Vector values = new Vector(); public static final int IN_PROGRESS_STATUS=0; public static final int DONE_STATUS=1; @@ -247,7 +245,7 @@ public interface LinphoneCore { private final int mValue; private final String mStringValue; - @SuppressWarnings("unchecked") + private EcCalibratorStatus(int value,String stringValue) { mValue = value; values.addElement(this); @@ -411,8 +409,7 @@ public interface LinphoneCore { /** * @return a list of LinphoneCallLog */ - @SuppressWarnings("unchecked") - public List getCallLogs(); + public Vector getCallLogs(); /** * This method is called by the application to notify the Linphone core library when network is reachable. @@ -693,7 +690,7 @@ public interface LinphoneCore { int getConferenceSize(); void terminateAllCalls(); - @SuppressWarnings("unchecked") List getCalls(); + Vector getCalls(); int getCallsNb(); diff --git a/java/common/org/linphone/core/LinphoneCoreFactory.java b/java/common/org/linphone/core/LinphoneCoreFactory.java index b5beba393..fe35b257f 100644 --- a/java/common/org/linphone/core/LinphoneCoreFactory.java +++ b/java/common/org/linphone/core/LinphoneCoreFactory.java @@ -36,7 +36,7 @@ abstract public class LinphoneCoreFactory { factoryName = className; } - @SuppressWarnings("unchecked") + public static final synchronized LinphoneCoreFactory instance() { try { if (theLinphoneCoreFactory == null) { diff --git a/java/common/org/linphone/core/LinphoneFriend.java b/java/common/org/linphone/core/LinphoneFriend.java index 88bcbab8e..d4f0e7503 100644 --- a/java/common/org/linphone/core/LinphoneFriend.java +++ b/java/common/org/linphone/core/LinphoneFriend.java @@ -36,7 +36,7 @@ public interface LinphoneFriend { */ static class SubscribePolicy { - @SuppressWarnings("unchecked") + static private Vector values = new Vector(); protected final int mValue; private final String mStringValue; @@ -54,7 +54,7 @@ public interface LinphoneFriend { */ public final static SubscribePolicy SPAccept = new SubscribePolicy(2,"SPAccept"); - @SuppressWarnings("unchecked") + private SubscribePolicy(int value,String stringValue) { mValue = value; values.addElement(this); diff --git a/java/common/org/linphone/core/OnlineStatus.java b/java/common/org/linphone/core/OnlineStatus.java index 8a0da6ce2..a1b36ab37 100644 --- a/java/common/org/linphone/core/OnlineStatus.java +++ b/java/common/org/linphone/core/OnlineStatus.java @@ -27,7 +27,7 @@ import java.util.Vector; */ public class OnlineStatus { - @SuppressWarnings("unchecked") + static private Vector values = new Vector(); /** * Offline @@ -77,7 +77,7 @@ public class OnlineStatus { protected final int mValue; private final String mStringValue; - @SuppressWarnings("unchecked") + private OnlineStatus(int value,String stringValue) { mValue = value; values.addElement(this); From 7f9529d265644466096e67dff6745a1d5ecf239e Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 24 Apr 2012 10:16:31 +0200 Subject: [PATCH 224/769] Add linphone icon to uninstaller icon --- linphone.iss.in | 1 + 1 file changed, 1 insertion(+) diff --git a/linphone.iss.in b/linphone.iss.in index b0cbd08f0..de88854d3 100644 --- a/linphone.iss.in +++ b/linphone.iss.in @@ -13,6 +13,7 @@ OutputBaseFilename=setup Compression=lzma SolidCompression=yes ShowLanguageDialog=yes +UninstallDisplayIcon={app}\bin\linphone.exe [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" From 49631ae72f33c9f667780d3b961344f61dee9889 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 24 Apr 2012 11:46:05 +0200 Subject: [PATCH 225/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 75eb1fcf8..7303425a2 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 75eb1fcf8d6097e51bcb507be339dd397c6b4dd5 +Subproject commit 7303425a2bc993eff7f8446c566f7f282e90cc33 From 9635ebedd5a30fd734572e497ae64590974a0429 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 24 Apr 2012 15:13:26 +0200 Subject: [PATCH 226/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7303425a2..7e21fed93 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7303425a2bc993eff7f8446c566f7f282e90cc33 +Subproject commit 7e21fed93e1c35a721a63fc089cc53b9e503af62 From edad295e0596eebc7ca4aed7472e0e3bdc696b41 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 25 Apr 2012 09:25:22 +0200 Subject: [PATCH 227/769] improve Ui and update ms2 for important bugfix --- gtk/main.c | 4 +--- gtk/main.ui | 2 +- mediastreamer2 | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/gtk/main.c b/gtk/main.c index 819195268..b7ef5869f 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -774,13 +774,12 @@ void linphone_gtk_answer_clicked(GtkWidget *button){ void linphone_gtk_enable_video(GtkWidget *w){ gboolean val=gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); - GtkWidget *selfview_item=linphone_gtk_get_widget(linphone_gtk_get_main_window(),"selfview_item"); + //GtkWidget *selfview_item=linphone_gtk_get_widget(linphone_gtk_get_main_window(),"selfview_item"); LinphoneVideoPolicy policy={0}; policy.automatically_initiate=policy.automatically_accept=val; linphone_core_enable_video(linphone_gtk_get_core(),TRUE,TRUE); linphone_core_set_video_policy(linphone_gtk_get_core(),&policy); - gtk_widget_set_sensitive(selfview_item,val); if (val){ linphone_core_enable_video_preview(linphone_gtk_get_core(), linphone_gtk_get_ui_config_int("videoselfview",VIDEOSELFVIEW_DEFAULT)); @@ -1418,7 +1417,6 @@ static void linphone_gtk_check_menu_items(void){ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(linphone_gtk_get_widget( linphone_gtk_get_main_window(),"enable_video_item")), video_enabled); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(selfview_item),selfview); - gtk_widget_set_sensitive(selfview_item,video_enabled); } static gboolean linphone_gtk_can_manage_accounts(){ diff --git a/gtk/main.ui b/gtk/main.ui index 96647fe4d..eebb05e75 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -498,7 +498,7 @@ True False False - Enable video + Always start video True diff --git a/mediastreamer2 b/mediastreamer2 index 7e21fed93..43c192346 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7e21fed93e1c35a721a63fc089cc53b9e503af62 +Subproject commit 43c1923468d962aa5577ebcf6d8674ef9d426e40 From cae534589d206da63b708757aaee80602662bf14 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 25 Apr 2012 14:29:28 +0200 Subject: [PATCH 228/769] Important ms2 update + Java 1.3 compatible --- LinphoneCoreImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 92faacc55..597f647f3 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -542,9 +542,9 @@ class LinphoneCoreImpl implements LinphoneCore { terminateAllCalls(nativePtr); } private native Object getCall(long nativePtr, int position); - @SuppressWarnings("unchecked") public synchronized List getCalls() { + @SuppressWarnings("unchecked") public synchronized Vector getCalls() { int size = getCallsNb(nativePtr); - List calls = new ArrayList(size); + Vector calls = new Vector(size); for (int i=0; i < size; i++) { calls.add((LinphoneCall)getCall(nativePtr, i)); } From ea6dd35f763c1f678dbd44da6330a9994abf34bc Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 25 Apr 2012 14:58:57 +0200 Subject: [PATCH 229/769] Add API to know Call audio/video codec --- coreapi/linphonecall.c | 14 ++++++++++++++ coreapi/linphonecore.h | 6 ++++-- coreapi/misc.c | 8 ++++---- coreapi/private.h | 2 ++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d41c6cdad..69f9266a1 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -770,6 +770,14 @@ void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled){ cp->has_video=enabled; } +const PayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp) { + return cp->audio_codec; +} + +const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp) { + return cp->video_codec; +} + /** * Returns whether video is enabled. **/ @@ -1146,6 +1154,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna bool_t use_ec; if (used_pt!=-1){ + call->current_params.audio_codec = rtp_profile_get_payload(call->audio_profile, used_pt); if (playcard==NULL) { ms_warning("No card defined for playback !"); } @@ -1262,6 +1271,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna const char *addr=vstream->addr[0]!='\0' ? vstream->addr : call->resultdesc->addr; call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt); if (used_pt!=-1){ + call->current_params.video_codec = rtp_profile_get_payload(call->video_profile, used_pt); VideoStreamDir dir=VideoStreamSendRecv; MSWebCam *cam=lc->video_conf.device; bool_t is_inactive=FALSE; @@ -1333,6 +1343,10 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone){ LinphoneCore *lc=call->core; + + call->current_params.audio_codec = NULL; + call->current_params.video_codec = NULL; + LinphoneAddress *me=linphone_core_get_primary_contact_parsed(lc); char *cname; bool_t use_arc=linphone_core_adaptive_rate_control_enabled(lc); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index a5a1e8c0c..d3a514a69 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -183,6 +183,8 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl); struct _LinphoneCallParams; typedef struct _LinphoneCallParams LinphoneCallParams; +const PayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp); +const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp); LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp); void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled); bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp); @@ -786,13 +788,13 @@ const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc); int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs); -bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, PayloadType *pt); +bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *pt); int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable); PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate) ; -int linphone_core_get_payload_type_number(LinphoneCore *lc, PayloadType *pt); +int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt); const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt); diff --git a/coreapi/misc.c b/coreapi/misc.c index 41d4efac8..881b88eb6 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -181,12 +181,12 @@ static void payload_type_set_enable(PayloadType *pt,int value) else payload_type_unset_flag(pt,PAYLOAD_TYPE_ENABLED); } -static bool_t payload_type_enabled(PayloadType *pt) { +static bool_t payload_type_enabled(const PayloadType *pt) { return (((pt)->flags & PAYLOAD_TYPE_ENABLED)!=0); } -bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, PayloadType *pt){ - if (ms_list_find(lc->codecs_conf.audio_codecs,pt) || ms_list_find(lc->codecs_conf.video_codecs,pt)){ +bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *pt){ + if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt)){ return payload_type_enabled(pt); } ms_error("Getting enablement status of codec not in audio or video list of PayloadType !"); @@ -202,7 +202,7 @@ int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t return -1; } -int linphone_core_get_payload_type_number(LinphoneCore *lc, PayloadType *pt){ +int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt){ return payload_type_get_number(pt); } diff --git a/coreapi/private.h b/coreapi/private.h index ec57eaf9c..a790276dd 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -68,6 +68,8 @@ struct _LinphoneCallParams{ LinphoneCall *referer; /*in case this call creation is consecutive to an incoming transfer, this points to the original call */ int audio_bw; /* bandwidth limit for audio stream */ LinphoneMediaEncryption media_encryption; + PayloadType *audio_codec; + PayloadType *video_codec; bool_t has_video; bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/ bool_t in_conference; /*in conference mode */ From 38d4730be5d172c13d0bd58a53c397c140f81231 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 26 Apr 2012 11:30:50 +0200 Subject: [PATCH 230/769] add missing using namespace::std --- coreapi/TunnelManager.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index b8f1dae48..3e998cb74 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -25,6 +25,7 @@ using namespace belledonnecomm; +using namespace ::std; Mutex TunnelManager::sMutex; From 0e496ed3d9f19528b0a2db5050c11030ca6a1312 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 26 Apr 2012 15:30:08 +0200 Subject: [PATCH 231/769] zoom: float to float* so the app can know about zoom limits --- coreapi/linphonecore.c | 22 +++++++++++----------- coreapi/linphonecore.h | 2 +- mediastreamer2 | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a7ccef402..a8440a63d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4782,7 +4782,7 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para params->in_conference=FALSE; } -void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float cx, float cy) { +void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) { VideoStream* vstream = call->videostream; float zoom[3]; @@ -4790,18 +4790,18 @@ void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float cx, f zoom_factor = 1; float halfsize = 0.5 * 1.0 / zoom_factor; - if ((cx - halfsize) < 0) - cx = 0 + halfsize; - if ((cx + halfsize) > 1) - cx = 1 - halfsize; - if ((cy - halfsize) < 0) - cy = 0 + halfsize; - if ((cy + halfsize) > 1) - cy = 1 - halfsize; + if ((*cx - halfsize) < 0) + *cx = 0 + halfsize; + if ((*cx + halfsize) > 1) + *cx = 1 - halfsize; + if ((*cy - halfsize) < 0) + *cy = 0 + halfsize; + if ((*cy + halfsize) > 1) + *cy = 1 - halfsize; zoom[0] = zoom_factor; - zoom[1] = cx; - zoom[2] = cy; + zoom[1] = *cx; + zoom[2] = *cy; ms_filter_call_method(vstream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d3a514a69..bd10556a0 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1134,7 +1134,7 @@ typedef struct LinphoneTunnel LinphoneTunnel; */ LinphoneTunnel *linphone_core_get_tunnel(LinphoneCore *lc); - void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float cx, float cy); +void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy); #ifdef __cplusplus } diff --git a/mediastreamer2 b/mediastreamer2 index 43c192346..37474c877 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 43c1923468d962aa5577ebcf6d8674ef9d426e40 +Subproject commit 37474c877a7f4e1c458c6f9edf1302e75d929dd1 From 53d5f0c2bf8a5fbbfb04ce4126db81ff3da38916 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 27 Apr 2012 10:24:38 +0200 Subject: [PATCH 232/769] fix login frame --- gtk/loginframe.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gtk/loginframe.c b/gtk/loginframe.c index f1a67d9d5..7251adf38 100644 --- a/gtk/loginframe.c +++ b/gtk/loginframe.c @@ -62,14 +62,14 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){ int nettype; const char *passwd=NULL; - + if (linphone_core_get_download_bandwidth(lc)==512 && linphone_core_get_upload_bandwidth(lc)==512) nettype=NetworkKindOpticalFiber; else nettype=NetworkKindAdsl; gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(mw,"login_internet_kind")),nettype); - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(mw,"internet_kind")),nettype); - + //gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(mw,"internet_kind")),nettype); + if (linphone_gtk_get_ui_config_int("automatic_login",0) ){ g_timeout_add(250,(GSourceFunc)do_login_noprompt,cfg); return; @@ -88,7 +88,6 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){ gtk_widget_hide(linphone_gtk_get_widget(mw,"disconnect_item")); gtk_widget_hide(linphone_gtk_get_widget(mw,"main_frame")); gtk_widget_show(linphone_gtk_get_widget(mw,"login_frame")); - gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"main_menu"),FALSE); gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"options_menu"),FALSE); str=g_strdup_printf(_("Please enter login information for %s"),linphone_proxy_config_get_domain(cfg)); gtk_label_set_text(GTK_LABEL(label),str); @@ -118,7 +117,6 @@ void linphone_gtk_exit_login_frame(void){ GtkWidget *mw=linphone_gtk_get_main_window(); gtk_widget_show(linphone_gtk_get_widget(mw,"main_frame")); gtk_widget_hide(linphone_gtk_get_widget(mw,"login_frame")); - gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"main_menu"),TRUE); gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"options_menu"),TRUE); gtk_widget_show(linphone_gtk_get_widget(mw,"disconnect_item")); } From 058e011ce1f33e2b2d5c60ac2668730753a95fd4 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 27 Apr 2012 15:42:35 +0200 Subject: [PATCH 233/769] Fix issues/behaviour on smartphones + update linphone/ms2/ortp --- LinphoneCoreImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 92faacc55..0dd655fcd 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,8 +20,6 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import java.util.Vector; @@ -542,9 +540,9 @@ class LinphoneCoreImpl implements LinphoneCore { terminateAllCalls(nativePtr); } private native Object getCall(long nativePtr, int position); - @SuppressWarnings("unchecked") public synchronized List getCalls() { + @SuppressWarnings("unchecked") public synchronized Vector getCalls() { int size = getCallsNb(nativePtr); - List calls = new ArrayList(size); + Vector calls = new Vector(size); for (int i=0; i < size; i++) { calls.add((LinphoneCall)getCall(nativePtr, i)); } From acc0b85683c64c4a808db1eeb8992fdf69118dda Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Fri, 27 Apr 2012 16:30:40 +0200 Subject: [PATCH 234/769] Refresh identity after loginframe --- gtk/loginframe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/loginframe.c b/gtk/loginframe.c index 7251adf38..08b90fe45 100644 --- a/gtk/loginframe.c +++ b/gtk/loginframe.c @@ -49,6 +49,7 @@ static gboolean do_login_noprompt(LinphoneProxyConfig *cfg){ tmp=linphone_address_as_string (addr); do_login(ssctx,tmp,NULL); linphone_address_destroy(addr); + linphone_gtk_load_identities(); return FALSE; } From fb7cab25589abcbcc52099ffd8a621bbcb1ff1b6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 27 Apr 2012 16:53:03 +0200 Subject: [PATCH 235/769] Fixes for smartphones --- LinphoneCoreFactoryImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 29f1c58ca..99c880e37 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -68,6 +68,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { //Main library if (!hasNeonInCpuFeatures()) { System.loadLibrary("linphonenoneon"); + Log.w("linphone", "No-neon liblinphone loaded"); } else { System.loadLibrary("linphone"); } @@ -150,7 +151,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { byte[] re = new byte[1024]; while(in.read(re) != -1){ String line = new String(re); - if (line.startsWith("Features")) { + if (line.contains("Features")) { result = line.contains("neon"); break; } From d0ced93c25f088c04a9f92b82aa41c5b1f271e23 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 27 Apr 2012 17:08:36 +0200 Subject: [PATCH 236/769] bugfix with srtp at shutdown --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 41d13b7e4..07fa32444 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 41d13b7e491c7fc418987b63ff6ef80c7e8895a4 +Subproject commit 07fa32444a010965baec9562c9d07da5e5d6f2ce From 504a67b0e74c9d9a23c95e8e38127368c8276804 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 2 May 2012 10:10:20 +0200 Subject: [PATCH 237/769] replace vectors by array lin LinphoneCore.java --- java/common/org/linphone/core/LinphoneCore.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 31300e384..f33415b46 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -409,7 +409,7 @@ public interface LinphoneCore { /** * @return a list of LinphoneCallLog */ - public Vector getCallLogs(); + public LinphoneCallLog[] getCallLogs(); /** * This method is called by the application to notify the Linphone core library when network is reachable. @@ -690,7 +690,7 @@ public interface LinphoneCore { int getConferenceSize(); void terminateAllCalls(); - Vector getCalls(); + LinphoneCall[] getCalls(); int getCallsNb(); From 4f108428984e0e32a2deb69caa2374b6b6e7eccd Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 2 May 2012 10:12:08 +0200 Subject: [PATCH 238/769] replace vectores by arrays in linphone core api --- LinphoneCoreImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 0dd655fcd..0b2996a03 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -195,11 +195,11 @@ class LinphoneCoreImpl implements LinphoneCore { acceptCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr); } - public synchronized Vector getCallLogs() { + public synchronized LinphoneCallLog[] getCallLogs() { isValid(); - Vector logs = new Vector(); + LinphoneCallLog[] logs = new LinphoneCallLog[getNumberOfCallLogs(nativePtr)]; for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { - logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr, i))); + logs[i] = new LinphoneCallLogImpl(getCallLog(nativePtr, i)); } return logs; } @@ -540,11 +540,11 @@ class LinphoneCoreImpl implements LinphoneCore { terminateAllCalls(nativePtr); } private native Object getCall(long nativePtr, int position); - @SuppressWarnings("unchecked") public synchronized Vector getCalls() { + public synchronized LinphoneCall[] getCalls() { int size = getCallsNb(nativePtr); - Vector calls = new Vector(size); + LinphoneCall[] calls = new LinphoneCall[size]; for (int i=0; i < size; i++) { - calls.add((LinphoneCall)getCall(nativePtr, i)); + calls[i]=((LinphoneCall)getCall(nativePtr, i)); } return calls; } From 04fa4d457b3b584eae8c5964a48a97ec4040c94a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 30 Apr 2012 14:34:48 +0200 Subject: [PATCH 239/769] make sure registration with expires=0 is allowed --- coreapi/linphonecore.c | 4 ++-- coreapi/proxy.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a8440a63d..802afe725 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4393,7 +4393,7 @@ void linphone_core_refresh_registers(LinphoneCore* lc) { elem=linphone_core_get_proxy_config_list(lc); for(;elem!=NULL;elem=elem->next){ LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; - if (linphone_proxy_config_register_enabled(cfg) ) { + if (linphone_proxy_config_register_enabled(cfg) && linphone_proxy_config_get_expires(cfg)>0) { linphone_proxy_config_refresh_register(cfg); } } @@ -4403,7 +4403,7 @@ void __linphone_core_invalidate_registers(LinphoneCore* lc){ const MSList *elem=linphone_core_get_proxy_config_list(lc); for(;elem!=NULL;elem=elem->next){ LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; - if (linphone_proxy_config_register_enabled(cfg) ) { + if (linphone_proxy_config_register_enabled(cfg)) { linphone_proxy_config_edit(cfg); linphone_proxy_config_done(cfg); } diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 49e0ec3cc..cf7675807 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -218,7 +218,7 @@ void linphone_proxy_config_enableregister(LinphoneProxyConfig *obj, bool_t val){ * Sets the registration expiration time in seconds. **/ void linphone_proxy_config_expires(LinphoneProxyConfig *obj, int val){ - if (val<=0) val=600; + if (val<0) val=600; obj->expires=val; } From eb10f722f830e4cde7463679ef2ecb931636da4a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 3 May 2012 09:42:44 +0200 Subject: [PATCH 240/769] update oRTP --- m4/readline.m4 | 6 +++--- oRTP | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/m4/readline.m4 b/m4/readline.m4 index 8c4e18566..13a217fda 100644 --- a/m4/readline.m4 +++ b/m4/readline.m4 @@ -22,15 +22,15 @@ if test "$readline_prefix" != "none"; then AC_CHECK_HEADERS(readline.h readline/readline.h, readline_h_found=yes) AC_CHECK_HEADERS(history.h readline/history.h) - AC_CHECK_LIB(readline, readline, [readline_libs_found=yes],[],[-lncurses]) + AC_CHECK_LIB(readline, readline, [readline_libs_found=yes],[],[]) LIBS=$LIBS_save CPPFLAGS=$CPPFLAGS_save if test "$readline_libs_found$readline_h_found" != "yesyes" ; then - AC_MSG_WARN("Could not find libreadline headers or library, linphonec will have limited prompt features") + AC_MSG_WARN([Could not find libreadline headers or library, linphonec will have limited prompt features]) else - READLINE_LIBS="$READLINE_LIBS -lreadline -lncurses" + READLINE_LIBS="$READLINE_LIBS -lreadline " fi diff --git a/oRTP b/oRTP index 07fa32444..a24da0932 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 07fa32444a010965baec9562c9d07da5e5d6f2ce +Subproject commit a24da093214970684312a70592b3e7e5dbaa1b26 From 394fab87613733ca6d76896dabba0f63e3199496 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 3 May 2012 16:21:23 +0200 Subject: [PATCH 241/769] Update mediastreamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 37474c877..32e7b8fde 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 37474c877a7f4e1c458c6f9edf1302e75d929dd1 +Subproject commit 32e7b8fde7ea0aeb86c5a456af9c6b43dbde1837 From 1c39ff2ce3a54395306565b85b1242db1ec7a26f Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 3 May 2012 16:32:11 +0200 Subject: [PATCH 242/769] Update mediastreamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 32e7b8fde..13818e851 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 32e7b8fde7ea0aeb86c5a456af9c6b43dbde1837 +Subproject commit 13818e851af2f51b3f0fe7bcec64931038a3d9f3 From a0bf029785638361f1a80be4e2d50bcfe29e5eda Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 4 May 2012 09:48:52 +0200 Subject: [PATCH 243/769] update ms2 for fixing make distcheck --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 13818e851..382bc1036 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 13818e851af2f51b3f0fe7bcec64931038a3d9f3 +Subproject commit 382bc1036d37e7339813a3c5796d88beea1211f5 From cac68c720a8154846e399d28876f4f57ff5e91f2 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 7 May 2012 22:16:26 +0200 Subject: [PATCH 244/769] update ms2 for android bugfix --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 382bc1036..f08143a15 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 382bc1036d37e7339813a3c5796d88beea1211f5 +Subproject commit f08143a159df482c84e71307071da6655910ad4d From d50242268651df5852d89fe47fdab82733804676 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 9 May 2012 12:15:22 +0200 Subject: [PATCH 245/769] oRTP updated --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 5e7a3b571..a73a8924e 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 5e7a3b571a073cab29e52634c11f780d7008e0e8 +Subproject commit a73a8924e1f686fe73990c77d6ff92b6a05151fe From bbde983c9bb2209ded4d121ec25674370ac31799 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 10 May 2012 10:46:41 +0200 Subject: [PATCH 246/769] Load neon liblinphone if fails to load no-neon liblinphone --- LinphoneCoreFactoryImpl.java | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 99c880e37..8cc721e90 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -28,21 +28,30 @@ import android.util.Log; public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { - private static void loadOptionalLibrary(String s) { + private static boolean loadOptionalLibrary(String s) { try { System.loadLibrary(s); + return true; } catch (Throwable e) { Log.w("Unable to load optional library lib", s); } + return false; } static { // FFMPEG (audio/video) if (!hasNeonInCpuFeatures()) { - loadOptionalLibrary("avutilnoneon"); - loadOptionalLibrary("swscalenoneon"); - loadOptionalLibrary("avcorenoneon"); - loadOptionalLibrary("avcodecnoneon"); + boolean noNeonLibrariesLoaded = true; + noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avutilnoneon"); + noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("swscalenoneon"); + noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avcorenoneon"); + noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avcodecnoneon"); + if (!noNeonLibrariesLoaded) { + loadOptionalLibrary("avutil"); + loadOptionalLibrary("swscale"); + loadOptionalLibrary("avcore"); + loadOptionalLibrary("avcodec"); + } } else { loadOptionalLibrary("avutil"); loadOptionalLibrary("swscale"); @@ -67,8 +76,13 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { //Main library if (!hasNeonInCpuFeatures()) { - System.loadLibrary("linphonenoneon"); - Log.w("linphone", "No-neon liblinphone loaded"); + try { + System.loadLibrary("linphonenoneon"); + Log.w("linphone", "No-neon liblinphone loaded"); + } catch (UnsatisfiedLinkError ule) { + Log.w("linphone", "Failed to load no-neon liblinphone, loading neon liblinphone"); + System.loadLibrary("linphone"); + } } else { System.loadLibrary("linphone"); } From 9ca8f73d0b02a92412b9de27f0c09635c9585fa5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 10 May 2012 17:19:51 +0200 Subject: [PATCH 247/769] update ms2 and ortp --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index f08143a15..8f038bf38 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f08143a159df482c84e71307071da6655910ad4d +Subproject commit 8f038bf38022e1a7c13b88f5b00c1d1ba3ef2386 diff --git a/oRTP b/oRTP index a73a8924e..21b8cec3b 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit a73a8924e1f686fe73990c77d6ff92b6a05151fe +Subproject commit 21b8cec3b70108f54d8550db26db01629777d62d From c1bc179ba7bd1c4a655d98d560c01167bb8f08b9 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 15 May 2012 11:05:13 +0200 Subject: [PATCH 248/769] Refresh registrations button (need activation) In .linphonerc add in [GtkUi] section: shown_widgets=main_window.proxy_refresh_button --- gtk/main.c | 12 + gtk/main.ui | 2559 +++++++++++++++++++++++---------------------------- 2 files changed, 1180 insertions(+), 1391 deletions(-) diff --git a/gtk/main.c b/gtk/main.c index b7ef5869f..fc8a6bfcc 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -806,6 +806,18 @@ void linphone_gtk_used_identity_changed(GtkWidget *w){ if (sel) g_free(sel); } + +void on_proxy_refresh_button_clicked(GtkWidget *w){ + LinphoneCore *lc=linphone_gtk_get_core(); + MSList const *item=linphone_core_get_proxy_config_list(lc); + while (item != NULL) { + LinphoneProxyConfig *lpc=(LinphoneProxyConfig*)item->data; + linphone_proxy_config_edit(lpc); + linphone_proxy_config_done(lpc); + item = item->next; + } +} + static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid){ linphone_gtk_show_friends(); } diff --git a/gtk/main.ui b/gtk/main.ui index eebb05e75..9a458dbc0 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -1,48 +1,27 @@ - + + - False True - False 0 none True - False 12 True - False True - False - - - True - False - <b>Callee name</b> - True - right - end - - - True - True - end - 0 - - True True - False False @@ -50,10 +29,21 @@ 1 + + + True + <b>Callee name</b> + True + right + end + + + end + 0 + + - True - True 0 @@ -62,7 +52,6 @@ 170 30 True - False False @@ -82,26 +71,21 @@ - False - False 0.5 none True - False 12 12 True - False True - False @@ -115,23 +99,18 @@ True - False label center - True - True 1 - False True - False gtk-dialog-authentication 1 @@ -144,7 +123,6 @@ True - False gtk-apply @@ -156,12 +134,9 @@ True - False label - True - True 2 @@ -171,8 +146,7 @@ True True True - False - + False @@ -189,17 +163,14 @@ - False True True - False half - + - True False 0 @@ -207,7 +178,6 @@ True - False False @@ -218,12 +188,10 @@ True - False gtk-missing-image 1 - True False 2 @@ -231,7 +199,6 @@ True - False False @@ -249,7 +216,6 @@ - False spread @@ -257,8 +223,7 @@ True True True - False - + False @@ -272,8 +237,7 @@ True True True - False - + False @@ -291,7 +255,6 @@ True - False True spread @@ -299,8 +262,7 @@ Pause True True - False - + False @@ -314,11 +276,10 @@ True True True - False False - True + False 1 @@ -336,44 +297,34 @@ True - False True True - False In call True center - True - True 0 True - False Duration center - True - True 1 True - False Call quality rating - True - True 2 @@ -384,1373 +335,52 @@ True - False gtk-info True - False gtk-add True - False gtk-clear True - False gtk-connect True - False gtk-refresh True - False gtk-properties True - False gtk-home True - False gtk-execute True - False gtk-add True - False gtk-add True - False gtk-add True - False gtk-add - - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - False - - - True - False - False - _Options - True - - - - True - False - - - gtk-preferences - True - False - False - True - True - - - - - - gtk-disconnect - False - False - True - True - - - - - - True - False - - - - - True - False - False - Always start video - True - - - - - - True - False - False - Enable self-view - True - True - - - - - - True - False - False - - - - - gtk-quit - False - False - True - True - - - - - - - - - - True - False - False - _Help - True - - - True - False - - - gtk-about - True - False - False - True - True - - - - - - Show debug window - True - False - False - image1 - False - - - - - - _Homepage - True - False - False - True - image4 - False - - - - - - Check _Updates - False - False - True - image5 - False - - - - - - Account assistant - False - False - image12 - False - - - - - - - - - - False - True - 0 - - - - - True - False - - - True - False - - - True - False - - - True - True - True - False - - - - False - False - 0 - - - - - True - True - Initiate a new call - False - - - - False - False - 1 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - none - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - 5 - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - True - True - Enter username, phone number, or full sip address - ◠- False - False - - - - True - True - 0 - - - - - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - SIP address or phone number: - True - - - - - True - True - 2 - - - - - True - True - True - False - - - - False - False - 3 - - - - - False - True - 8 - 0 - - - - - True - True - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - False - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Lookup: - - - True - True - 12 - 0 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - ◠- True - False - False - - - - True - True - 4 - 1 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - in - - - True - True - 8 - 2 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - model1 - 0 - - - - - 0 - - - - - True - True - 4 - 3 - - - - - False - True - 0 - - - - - True - True - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - 0 - - - - - - - - - - - - True - True - 1 - - - - - False - 0 - none - - - False - - - True - True - ◠- True - False - False - - - - - - - True - True - 0 - - - - - True - True - True - False - none - - - - True - False - - - True - False - gtk-find - - - True - True - 0 - - - - - True - False - Search - - - True - True - 1 - - - - - - - False - True - 1 - - - - - - - True - False - <b>Add contacts from directory</b> - True - - - - - False - False - 5 - 2 - - - - - True - False - - - Add contact - True - True - False - image10 - - - - False - False - 0 - - - - - False - False - 3 - - - - - True - True - 0 - - - - - - - True - False - - - True - False - gtk-directory - 1 - - - True - True - 0 - - - - - True - False - Contacts - - - True - True - 1 - - - - - False - - - - - True - False - - - True - False - 2 - - - True - False - end - - - gtk-clear - True - True - True - False - True - - - - False - False - 0 - - - - - - - - - - - False - True - end - 0 - - - - - True - True - never - - - True - True - False - - - - - - - - - - True - True - 1 - - - - - True - True - 0 - - - - - 1 - - - - - True - False - - - True - False - gtk-refresh - 1 - - - True - True - 0 - - - - - True - False - 0.49000000953674316 - Recent calls - - - True - True - 1 - - - - - 1 - False - - - - - True - False - 0.5 - none - - - True - False - 0 - 0 - - - True - False - 0 - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - 4 - 4 - True - - - D - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - 3 - 4 - - - - - # - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - 3 - 4 - - - - - 0 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - 3 - 4 - - - - - * - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - - - - - C - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - 2 - 3 - - - - - 9 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - 2 - 3 - - - - - 8 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - 2 - 3 - - - - - 7 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - - - - - B - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - 1 - 2 - - - - - 6 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - 1 - 2 - - - - - 5 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - 1 - 2 - - - - - 4 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - - - - - A - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - - - - - 3 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - - - - - 2 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - - - - - 1 - 40 - 40 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - - - - - - - - - - - - 2 - - - - - True - False - - - True - False - gtk-missing-image - 1 - - - True - True - 0 - - - - - True - False - Keypad - - - True - True - 1 - - - - - 2 - False - - - - - True - True - 1 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - none - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - model3 - 0 - - - - - 0 - - - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - My current identity: - True - - - - - False - False - 2 - - - - - True - True - 0 - - - - - False - 0 - etched-out - - - True - False - 12 - - - True - False - - - True - False - gtk-missing-image - - - True - True - 0 - - - - - True - False - 0 - none - - - True - False - 12 - 12 - - - True - False - 4 - 2 - - - True - False - Username - - - - - True - False - Password - - - 1 - 2 - - - - - True - False - Internet connection: - - - 2 - 3 - - - - - True - True - ◠- False - False - - - 1 - 2 - - - - - True - True - False - ◠- False - False - - - 1 - 2 - 1 - 2 - - - - - True - False - model4 - 0 - - - - - 0 - - - - - 1 - 2 - 2 - 3 - - - - - Automatically log me in - True - True - False - False - True - - - 1 - 2 - 3 - 4 - - - - - - - - - - - - True - False - Login information - True - - - - - True - True - 10 - 1 - - - - - True - False - - - gtk-connect - True - True - True - False - True - - - - False - False - 0 - - - - - True - True - 2 - - - - - - - - - True - False - <b>Welcome !</b> - True - - - - - True - True - 1 - - - - - True - True - 1 - - - - - True - False - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - - - True - True - 0 - - - - - True - True - True - False - none - - - - False - True - 5 - 1 - - - - - False - False - 2 - - - - - @@ -1804,4 +434,1151 @@ + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + + + True + _Options + True + + + + True + + + gtk-preferences + True + True + True + + + + + + gtk-disconnect + True + True + + + + + + True + + + + + True + Always start video + True + + + + + + True + Enable self-view + True + True + + + + + + True + + + + + gtk-quit + True + True + + + + + + + + + + True + _Help + True + + + True + + + gtk-about + True + True + True + + + + + + Show debug window + True + image1 + False + + + + + + _Homepage + True + True + image4 + False + + + + + + Check _Updates + True + image5 + False + + + + + + Account assistant + image12 + False + + + + + + + + + + False + 0 + + + + + True + + + True + + + True + + + True + True + True + + + + False + False + 0 + + + + + True + True + Initiate a new call + + + + False + False + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + none + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + True + Enter username, phone number, or full sip address + + + + + 0 + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + SIP address or phone number: + True + + + + + 2 + + + + + True + True + True + + + + False + False + 3 + + + + + False + 8 + 0 + + + + + True + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Lookup: + + + 12 + 0 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + True + + + + 4 + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + in + + + 8 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + model1 + 0 + + + + + 0 + + + + + 4 + 3 + + + + + False + 0 + + + + + True + True + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + 0 + + + + + + + + + 1 + + + + + 0 + none + + + + + True + True + + True + + + + + + + 0 + + + + + True + True + True + none + + + + True + + + True + gtk-find + + + 0 + + + + + True + Search + + + 1 + + + + + + + False + 1 + + + + + + + True + <b>Add contacts from directory</b> + True + + + + + False + False + 5 + 2 + + + + + True + + + Add contact + True + True + image10 + + + + False + False + 0 + + + + + False + False + 3 + + + + + 0 + + + + + + + True + + + True + gtk-directory + 1 + + + 0 + + + + + True + Contacts + + + 1 + + + + + False + + + + + True + + + True + 2 + + + True + True + never + + + True + True + False + + + + + + + 1 + + + + + True + end + + + gtk-clear + True + True + True + True + + + + False + False + 0 + + + + + + + + + + + False + end + 0 + + + + + 0 + + + + + 1 + + + + + True + + + True + gtk-refresh + 1 + + + 0 + + + + + True + 0.49000000953674316 + Recent calls + + + 1 + + + + + 1 + False + + + + + True + 0.5 + none + + + True + 0 + 0 + + + True + 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + 4 + 4 + True + + + D + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 3 + 4 + 3 + 4 + + + + + # + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 2 + 3 + 3 + 4 + + + + + 0 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 1 + 2 + 3 + 4 + + + + + * + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 3 + 4 + + + + + C + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 3 + 4 + 2 + 3 + + + + + 9 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 2 + 3 + 2 + 3 + + + + + 8 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 1 + 2 + 2 + 3 + + + + + 7 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 2 + 3 + + + + + B + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 3 + 4 + 1 + 2 + + + + + 6 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 2 + 3 + 1 + 2 + + + + + 5 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 1 + 2 + 1 + 2 + + + + + 4 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 1 + 2 + + + + + A + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 3 + 4 + + + + + 3 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 2 + 3 + + + + + 2 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 1 + 2 + + + + + 1 + 40 + 40 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + + + + + + + + + 2 + + + + + True + + + True + gtk-missing-image + 1 + + + 0 + + + + + True + Keypad + + + 1 + + + + + 2 + False + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + none + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + model3 + 0 + + + + + 0 + + + + + + + True + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + My current identity: + True + + + 0 + + + + + True + True + none + + + + True + gtk-refresh + + + + + 1 + + + + + + + False + False + 2 + + + + + 0 + + + + + 0 + etched-out + + + True + 12 + + + True + + + True + gtk-missing-image + + + 0 + + + + + True + 0 + none + + + True + 12 + 12 + + + True + 4 + 2 + + + True + Username + + + + + True + Password + + + 1 + 2 + + + + + True + Internet connection: + + + 2 + 3 + + + + + True + True + + + + 1 + 2 + + + + + True + True + False + + + + 1 + 2 + 1 + 2 + + + + + True + model4 + 0 + + + + + 0 + + + + + 1 + 2 + 2 + 3 + + + + + Automatically log me in + True + True + False + True + + + 1 + 2 + 3 + 4 + + + + + + + + + + + + True + Login information + True + + + + + 10 + 1 + + + + + True + + + gtk-connect + True + True + True + True + + + + False + False + 0 + + + + + 2 + + + + + + + + + True + <b>Welcome !</b> + True + + + + + 1 + + + + + 1 + + + + + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + 0 + + + + + True + True + True + none + + + + False + 5 + 1 + + + + + False + False + 2 + + + + + From 7fcaf449af301b89dc7fc614c8c539950ca51341 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 15 May 2012 12:25:46 +0200 Subject: [PATCH 249/769] Update mediastreamer2 & oRTP --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 8f038bf38..b2b50e9fd 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 8f038bf38022e1a7c13b88f5b00c1d1ba3ef2386 +Subproject commit b2b50e9fd7c946f9bd49fc02f98579794a63a14b diff --git a/oRTP b/oRTP index 21b8cec3b..f7861fa0e 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 21b8cec3b70108f54d8550db26db01629777d62d +Subproject commit f7861fa0e1204091e3bb9aa2f05643f819d1a2b1 From c9f89e6aa3e6be80a6e0139045eb92990ce487e2 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 15 May 2012 14:34:58 +0200 Subject: [PATCH 250/769] Do not tread ACK event if call has been terminated --- coreapi/sal_eXosip2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 6a4e2b284..d1cf241ab 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1062,6 +1062,10 @@ static void handle_ack(Sal *sal, eXosip_event_t *ev){ ms_warning("ack for non-existing call !"); return; } + if (op->terminated) { + ms_warning("ack for terminated call, ignoring"); + return; + } if (op->sdp_offering){ sdp=eXosip_get_sdp_info(ev->ack); From e74d43779caf53e19cad16633b193071ed57d5f2 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 15 May 2012 17:08:57 +0200 Subject: [PATCH 251/769] Add rtp timestamp configure option + debug option Update oRTP & mediastreamer2 --- configure.ac | 21 +++++++++++++++++++++ mediastreamer2 | 2 +- oRTP | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2bead21dd..a56a93cbd 100644 --- a/configure.ac +++ b/configure.ac @@ -245,6 +245,24 @@ if test x$ipv6 = xtrue ; then fi AC_SUBST(IPV6_CFLAGS) +dnl enable timestamp support +AC_ARG_ENABLE(rtp-timestamp, + [ --enable-rtp-timestamp Turn on RTP packet timestamp], + [case "${enableval}" in + yes) rtptimestamp=true;; + no) rtptimestamp=false;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-rtp-timestamp) ;; + esac],[rtptimestamp=false]) + +AC_ARG_ENABLE(debug, + [ --enable-debug=[yes/no] enables the display of traces showing the execution of the library. [default=yes]], + [case "${enableval}" in + yes) debug_enabled=yes;; + no) debug_enabled=no;; + *) AC_MSG_ERROR("Bad value for --enable-debug");; + esac], + [debug_enabled=no]) + dnl enable truespeech codec support AC_ARG_ENABLE(truespeech, [ --enable-truespeech Turn on TrueSpeech support (x86 only)], @@ -562,6 +580,9 @@ else if test x$ac_cv_c_bigendian = xyes ; then ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN" fi + if test x$rtptimestamp = xtrue ; then + ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_TIMESTAMP" + fi ORTP_DIR=oRTP changequote(<<, >>) ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'` diff --git a/mediastreamer2 b/mediastreamer2 index b2b50e9fd..241333872 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b2b50e9fd7c946f9bd49fc02f98579794a63a14b +Subproject commit 2413338721f9ac82249a47b333ccca53fb7d3359 diff --git a/oRTP b/oRTP index f7861fa0e..9d8e0cc62 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit f7861fa0e1204091e3bb9aa2f05643f819d1a2b1 +Subproject commit 9d8e0cc62b8da06d596f4ed2b62e2c98dad990b3 From c8d9c79e7692b3310d392e3537ba8c9d57a0481c Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 16 May 2012 09:39:04 +0200 Subject: [PATCH 252/769] Update mediastreamer2 & oRTP --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 241333872..f726584f2 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2413338721f9ac82249a47b333ccca53fb7d3359 +Subproject commit f726584f2a708f2f8a0c9d1933018382364cbf15 diff --git a/oRTP b/oRTP index 9d8e0cc62..ff0da4b42 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 9d8e0cc62b8da06d596f4ed2b62e2c98dad990b3 +Subproject commit ff0da4b42661d9996753372cb35dc0f25f5ff6ec From 853fc5c97ad9784e71cacd8ac07e4e21fa0ea139 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 16 May 2012 10:15:19 +0200 Subject: [PATCH 253/769] Update mediastreamer2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index f726584f2..eae923bd8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f726584f2a708f2f8a0c9d1933018382364cbf15 +Subproject commit eae923bd8fd87476f0dddcde6d54824147d031fb From 42d4ce6e491cde2cbb5e9a611ba04d1323598e73 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 16 May 2012 12:36:10 +0200 Subject: [PATCH 254/769] Update oRTP and add genericplc to POTFILES.skip --- oRTP | 2 +- po/POTFILES.skip | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/oRTP b/oRTP index ff0da4b42..6f2a1cbad 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit ff0da4b42661d9996753372cb35dc0f25f5ff6ec +Subproject commit 6f2a1cbad342f448140e0bbab6a2771443efceeb diff --git a/po/POTFILES.skip b/po/POTFILES.skip index d1c11e80e..49808b8ef 100755 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -12,6 +12,7 @@ mediastreamer2/src/extdisplay.c mediastreamer2/src/gsm.c mediastreamer2/src/ice.c mediastreamer2/src/itc.c +mediastreamer2/src/genericplc.c mediastreamer2/src/macsnd.c mediastreamer2/src/msandroid.cpp mediastreamer2/src/msandroidvideo.cpp From e1c1375b45ebf6ab23b3a655ca53d964d7fa08e2 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 16 May 2012 14:43:49 +0200 Subject: [PATCH 255/769] Update oRTP --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 6f2a1cbad..52db5d9dd 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 6f2a1cbad342f448140e0bbab6a2771443efceeb +Subproject commit 52db5d9ddbb28a85b1a9ede6598c9405cfe0b418 From d39e3932213bd2c3817b9080958e64f0c994c790 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 16 May 2012 15:42:04 +0200 Subject: [PATCH 256/769] Change rtp-timestamp option to ntp-timestamp --- configure.ac | 12 ++++++------ mediastreamer2 | 2 +- oRTP | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index a56a93cbd..de51fbc1e 100644 --- a/configure.ac +++ b/configure.ac @@ -246,13 +246,13 @@ fi AC_SUBST(IPV6_CFLAGS) dnl enable timestamp support -AC_ARG_ENABLE(rtp-timestamp, - [ --enable-rtp-timestamp Turn on RTP packet timestamp], +AC_ARG_ENABLE(ntp-timestamp, + [ --enable-ntp-timestamp Turn on NTP timestamping on received packet], [case "${enableval}" in - yes) rtptimestamp=true;; - no) rtptimestamp=false;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-rtp-timestamp) ;; - esac],[rtptimestamp=false]) + yes) ntptimestamp=true;; + no) ntptimestamp=false;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ntp-timestamp) ;; + esac],[ntptimestamp=false]) AC_ARG_ENABLE(debug, [ --enable-debug=[yes/no] enables the display of traces showing the execution of the library. [default=yes]], diff --git a/mediastreamer2 b/mediastreamer2 index eae923bd8..20b28098f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit eae923bd8fd87476f0dddcde6d54824147d031fb +Subproject commit 20b28098fa2b95fd2489fdbd73202e2b4807d4ab diff --git a/oRTP b/oRTP index 52db5d9dd..2a36f8669 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 52db5d9ddbb28a85b1a9ede6598c9405cfe0b418 +Subproject commit 2a36f8669ea5a9499017711c53a311bea69e0ee3 From 1e332bb9252a3690969be31bed3e33b2ad912300 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 16 May 2012 15:54:32 +0200 Subject: [PATCH 257/769] Update oRTP --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 2a36f8669..4cbfe71ec 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 2a36f8669ea5a9499017711c53a311bea69e0ee3 +Subproject commit 4cbfe71ec86a41ec64aa37a3b68183e9bcbe958e From cec8d7574e72ee9217f0a7869d3847695936a805 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 17 May 2012 11:18:35 +0200 Subject: [PATCH 258/769] Update mediastreamer2 & oRTP --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 20b28098f..14187df4b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 20b28098fa2b95fd2489fdbd73202e2b4807d4ab +Subproject commit 14187df4b75733457792b9b1f1dab6cbf852b45b diff --git a/oRTP b/oRTP index 4cbfe71ec..2590e21d8 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 4cbfe71ec86a41ec64aa37a3b68183e9bcbe958e +Subproject commit 2590e21d864b43d6ac3a2ece0cf3b4d0e208e866 From 3f071e9eb06e964ee93347dd18b2820ebfafa83f Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 18 May 2012 12:37:06 +0200 Subject: [PATCH 259/769] fix tunnel code for android --- coreapi/linphone_tunnel.cc | 3 - coreapi/linphone_tunnel.h | 66 +++++++++++++++++-- coreapi/linphonecore_jni.cc | 6 -- .../org/linphone/core/LinphoneCore.java | 1 - 4 files changed, 62 insertions(+), 14 deletions(-) diff --git a/coreapi/linphone_tunnel.cc b/coreapi/linphone_tunnel.cc index 1cc940f4b..d36778bb8 100644 --- a/coreapi/linphone_tunnel.cc +++ b/coreapi/linphone_tunnel.cc @@ -196,7 +196,6 @@ void linphone_tunnel_configure(LinphoneTunnel *tunnel){ linphone_tunnel_enable(tunnel, enabled); } - #else /*stubs to avoid to have #ifdef TUNNEL_ENABLED in upper layers*/ @@ -225,8 +224,6 @@ bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel){ return FALSE; } -void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled){ -} void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler){ } diff --git a/coreapi/linphone_tunnel.h b/coreapi/linphone_tunnel.h index 362c49f1a..539668904 100644 --- a/coreapi/linphone_tunnel.h +++ b/coreapi/linphone_tunnel.h @@ -28,28 +28,86 @@ #include "linphonecore.h" -/* - * Linphone VoIP tunnel extension API +/** + * @addtogroup tunnel + * @{ **/ + /** + * This set of methods enhance LinphoneCore functionalities in order to provide an easy to use API to + * - provision tunnel servers ip addresses and ports. This functionality is an option not implemented under GPL. + * - start/stop the tunneling service + * - perform auto-detection whether tunneling is required, based on a test of sending/receiving a flow of UDP packets. + * + * It takes in charge automatically the SIP registration procedure when connecting or disconnecting to a tunnel server. + * No other action on LinphoneCore is required to enable full operation in tunnel mode. + **/ + #ifdef __cplusplus extern "C" { #endif - +/** + * Add a tunnel server. At least one should be provided to be able to connect. + * When several addresses are provided, the tunnel client may try each of them until it gets connected. + * @param tunnel object + * @param ip server ip address + * @param port tunnel server tls port, recommended value is 443 + */ void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port); +/** + *Add tunnel server with auto detection capabilities + * + * @param tunnel object + * @param ip tunnel server ip address + * @param port tunnel server tls port, recommended value is 443 + * @param remote_udp_mirror remote port on the tunnel server side used to test udp reachability + * @param delay udp packet round trip delay in ms considered as acceptable. recommended value is 1000 ms. + */ void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror, int delay); -/*returns a string of space separated list of host:port of tunnel server addresses*/ +/** + * @param tunnel object + * returns a string of space separated list of host:port of tunnel server addresses + * */ char *linphone_tunnel_get_servers(LinphoneTunnel *tunnel); +/** + * @param tunnel object + * Removes all tunnel server address previously entered with addServer() +**/ void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel); +/** + * Sets whether tunneling of SIP and RTP is required. + * @param tunnel object + * @param isEnabled If true enter in tunneled mode, if false exits from tunneled mode. + * The TunnelManager takes care of refreshing SIP registration when switching on or off the tunneled mode. + * +**/ void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled); +/** + * @param tunnel object + * Returns a boolean indicating whether tunneled operation is enabled. +**/ bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel); +/** + * @param tunnel object + * Forces reconnection to the tunnel server. + * This method is useful when the device switches from wifi to Edge/3G or vice versa. In most cases the tunnel client socket + * won't be notified promptly that its connection is now zombie, so it is recommended to call this method that will cause + * the lost connection to be closed and new connection to be issued. +**/ void linphone_tunnel_reconnect(LinphoneTunnel *tunnel); +/** + * @param tunnel object + * In auto detect mode, the tunnel manager try to establish a real time rtp cummunication with the tunnel server on specified port. + *
In case of success, the tunnel is automatically turned off. Otherwise, if no udp commmunication is feasible, tunnel mode is turned on. + *
Call this method each time to run the auto detection algorithm + */ void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel); void linphone_tunnel_set_http_proxy(LinphoneTunnel *tunnel, const char *host, int port, const char* username,const char* passwd); void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd); +void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled); #ifdef __cplusplus } diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index bec7bbba7..619961432 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1680,12 +1680,6 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnable(JNIEnv *env #endif } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnableLogs(JNIEnv *env,jobject thiz,jlong pCore, jboolean enable) { -#ifdef TUNNEL_ENABLED - LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; - linphone_tunnel_enable_logs(tunnel, enable); -#endif -} extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUserAgent(JNIEnv *env,jobject thiz,jlong pCore, jstring name, jstring version){ const char* cname=env->GetStringUTFChars(name, NULL); diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index f33415b46..0d8e14ae9 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -741,7 +741,6 @@ public interface LinphoneCore { void setPlayFile(String path); void tunnelEnable(boolean enable); void tunnelAutoDetect(); - void tunnelEnableLogs(boolean enable); void tunnelCleanServers(); /** * @param host tunnel server ip address From cc640524b498981ee523ebf4e951adfc81c25835 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 21 May 2012 12:25:01 +0200 Subject: [PATCH 260/769] fix missing handling of paused-by-remote when done twice --- coreapi/callbacks.c | 2 +- coreapi/linphone_tunnel.h | 10 +++++++--- coreapi/linphonecore.c | 4 ++-- coreapi/linphonecore.h | 3 +++ coreapi/proxy.c | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 142a7a564..d7bc861ba 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -463,7 +463,7 @@ static void call_updating(SalOp *op){ case LinphoneCallPausedByRemote: if (sal_media_description_has_dir(rmd,SalStreamSendRecv) || sal_media_description_has_dir(rmd,SalStreamRecvOnly)){ call_resumed(lc,call); - } + }else call_paused_by_remote(lc,call); break; case LinphoneCallStreamsRunning: case LinphoneCallConnected: diff --git a/coreapi/linphone_tunnel.h b/coreapi/linphone_tunnel.h index 539668904..ea49ac8b2 100644 --- a/coreapi/linphone_tunnel.h +++ b/coreapi/linphone_tunnel.h @@ -52,7 +52,7 @@ extern "C" * Add a tunnel server. At least one should be provided to be able to connect. * When several addresses are provided, the tunnel client may try each of them until it gets connected. * @param tunnel object - * @param ip server ip address + * @param host server ip address * @param port tunnel server tls port, recommended value is 443 */ void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port); @@ -60,7 +60,7 @@ void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int po *Add tunnel server with auto detection capabilities * * @param tunnel object - * @param ip tunnel server ip address + * @param host tunnel server ip address * @param port tunnel server tls port, recommended value is 443 * @param remote_udp_mirror remote port on the tunnel server side used to test udp reachability * @param delay udp packet round trip delay in ms considered as acceptable. recommended value is 1000 ms. @@ -79,7 +79,7 @@ void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel); /** * Sets whether tunneling of SIP and RTP is required. * @param tunnel object - * @param isEnabled If true enter in tunneled mode, if false exits from tunneled mode. + * @param enabled If true enter in tunneled mode, if false exits from tunneled mode. * The TunnelManager takes care of refreshing SIP registration when switching on or off the tunneled mode. * **/ @@ -109,6 +109,10 @@ void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled); +/** + * @} +**/ + #ifdef __cplusplus } #endif diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 802afe725..0ca5b7b4a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2367,7 +2367,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho * Then, when the user responds to dialog prompt, it becomes possible to call linphone_core_accept_call_update() to answer * the reINVITE, with eventually video enabled in the LinphoneCallParams argument. * - * @Returns 0 if successful, -1 if the linphone_core_defer_call_update() was done outside a #LinphoneCallUpdatedByRemote notification, which is illegal. + * @return 0 if successful, -1 if the linphone_core_defer_call_update() was done outside a #LinphoneCallUpdatedByRemote notification, which is illegal. **/ int linphone_core_defer_call_update(LinphoneCore *lc, LinphoneCall *call){ if (call->state==LinphoneCallUpdatedByRemote){ @@ -2395,7 +2395,7 @@ int linphone_core_defer_call_update(LinphoneCore *lc, LinphoneCall *call){ * @param lc the linphone core object. * @param call the LinphoneCall object * @param params a LinphoneCallParams object describing the call parameters to accept. - * @Returns 0 if sucessful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state). + * @return 0 if sucessful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state). **/ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){ SalMediaDescription *md; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index bd10556a0..0eaec1e81 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -227,6 +227,9 @@ typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy; * The LinphoneCall object represents a call issued or received by the LinphoneCore **/ struct _LinphoneCall; +/** + * The LinphoneCall object represents a call issued or received by the LinphoneCore +**/ typedef struct _LinphoneCall LinphoneCall; /** Callback prototype */ diff --git a/coreapi/proxy.c b/coreapi/proxy.c index cf7675807..1676e0918 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -477,7 +477,7 @@ const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj){ /** * Returns the SIP identity that belongs to this proxy configuration. * - * The SIP identity is a SIP address (Display Name ) + * The SIP identity is a SIP address (Display Name ) **/ const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj){ return obj->reg_identity; From d92f7e0b38703626dc96a03a4500d631280e8a9f Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 21 May 2012 15:35:14 +0200 Subject: [PATCH 261/769] Add call audio/video stats --- coreapi/linphonecall.c | 53 +++++++++++++++++++++++++++++++++++++++--- coreapi/linphonecore.h | 23 ++++++++++++++++-- coreapi/private.h | 5 +++- 3 files changed, 75 insertions(+), 6 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 69f9266a1..8dccf9612 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -68,6 +68,14 @@ LinphoneCore *linphone_call_get_core(const LinphoneCall *call){ return call->core; } +const LinphoneCallStats *linphone_call_get_audio_stats(const LinphoneCall *call) { + return &call->stats[LINPHONE_CALL_STATS_AUDIO]; +} + +const LinphoneCallStats *linphone_call_get_video_stats(const LinphoneCall *call) { + return &call->stats[LINPHONE_CALL_STATS_VIDEO]; +} + const char* linphone_call_get_authentication_token(LinphoneCall *call){ return call->auth_token; } @@ -305,7 +313,14 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, if (port_offset==-1) return; call->audio_port=linphone_core_get_audio_port(call->core)+port_offset; call->video_port=linphone_core_get_video_port(call->core)+port_offset; + linphone_call_init_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], LINPHONE_CALL_STATS_AUDIO); + linphone_call_init_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], LINPHONE_CALL_STATS_VIDEO); +} +void linphone_call_init_stats(LinphoneCallStats *stats, int type) { + stats->type = LINPHONE_CALL_STATS_AUDIO; + stats->received_rtcp = NULL; + stats->sent_rtcp = NULL; } static void discover_mtu(LinphoneCore *lc, const char *remote){ @@ -1594,6 +1609,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ } void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed){ + LinphoneCore* lc = call->core; int disconnect_timeout = linphone_core_get_nortp_timeout(call->core); bool_t disconnected=FALSE; @@ -1623,9 +1639,25 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse OrtpEvent *ev; while (NULL != (ev=ortp_ev_queue_get(call->videostream_app_evq))){ OrtpEventType evt=ortp_event_get_type(ev); + OrtpEventData *evd=ortp_event_get_data(ev); if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){ - OrtpEventData *evd=ortp_event_get_data(ev); linphone_call_videostream_encryption_changed(call, evd->info.zrtp_stream_encrypted); + } else if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) { + call->stats[LINPHONE_CALL_STATS_VIDEO].round_trip_delay = rtp_session_get_round_trip_propagation(call->videostream->session); + if(call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp != NULL) + freemsg(call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp); + call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp = evd->packet; + evd->packet = NULL; + if (lc->vtable.call_stats_updated) + lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + } else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) { + memcpy(&call->stats[LINPHONE_CALL_STATS_VIDEO].jitter_stats, rtp_session_get_jitter_stats(call->videostream->session), sizeof(jitter_stats_t)); + if(call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp != NULL) + freemsg(call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp); + call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp = evd->packet; + evd->packet = NULL; + if (lc->vtable.call_stats_updated) + lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); } ortp_event_destroy(ev); } @@ -1641,12 +1673,27 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse OrtpEvent *ev; while (NULL != (ev=ortp_ev_queue_get(call->audiostream_app_evq))){ OrtpEventType evt=ortp_event_get_type(ev); + OrtpEventData *evd=ortp_event_get_data(ev); if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){ - OrtpEventData *evd=ortp_event_get_data(ev); linphone_call_audiostream_encryption_changed(call, evd->info.zrtp_stream_encrypted); } else if (evt == ORTP_EVENT_ZRTP_SAS_READY) { - OrtpEventData *evd=ortp_event_get_data(ev); linphone_call_audiostream_auth_token_ready(call, evd->info.zrtp_sas.sas, evd->info.zrtp_sas.verified); + } else if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) { + call->stats[LINPHONE_CALL_STATS_AUDIO].round_trip_delay = rtp_session_get_round_trip_propagation(call->audiostream->session); + if(call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp != NULL) + freemsg(call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp); + call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp = evd->packet; + evd->packet = NULL; + if (lc->vtable.call_stats_updated) + lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + } else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) { + memcpy(&call->stats[LINPHONE_CALL_STATS_AUDIO].jitter_stats, rtp_session_get_jitter_stats(call->audiostream->session), sizeof(jitter_stats_t)); + if(call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp != NULL) + freemsg(call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp); + call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp = evd->packet; + evd->packet = NULL; + if (lc->vtable.call_stats_updated) + lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); } ortp_event_destroy(ev); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index bd10556a0..9b0de2e71 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -228,7 +228,23 @@ typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy; **/ struct _LinphoneCall; typedef struct _LinphoneCall LinphoneCall; - + + +#define LINPHONE_CALL_STATS_AUDIO 0 +#define LINPHONE_CALL_STATS_VIDEO 1 + +typedef struct _LinphoneCallStats { + int type; + jitter_stats_t jitter_stats; + mblk_t* received_rtcp; + mblk_t* sent_rtcp; + float round_trip_delay; +} LinphoneCallStats; + +const LinphoneCallStats *linphone_call_get_audio_stats(const LinphoneCall *call); +const LinphoneCallStats *linphone_call_get_video_stats(const LinphoneCall *call); + + /** Callback prototype */ typedef void (*LinphoneCallCbFunc)(struct _LinphoneCall *call,void * user_data); @@ -624,6 +640,8 @@ typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to); typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf); /** Callback prototype for in progress transfers. The new_call_state is the state of the call resulting of the transfer, at the other party. */ typedef void (*LinphoneTransferStateChanged)(struct _LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state); +/** Callback prototype */ +typedef void (*CallStatsUpdated)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallStats *stats); /** * This structure holds all callbacks that the application should implement. @@ -641,9 +659,10 @@ typedef struct _LinphoneVTable{ DtmfReceived dtmf_received; /**< A dtmf has been received received */ ReferReceived refer_received; /**< An out of call refer was received */ CallEncryptionChangedCb call_encryption_changed; /** Date: Mon, 21 May 2012 15:42:28 +0200 Subject: [PATCH 262/769] Add const to CallStatsUpdated callback --- coreapi/linphonecore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 0530626ea..59dbca0cb 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -644,7 +644,7 @@ typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf); /** Callback prototype for in progress transfers. The new_call_state is the state of the call resulting of the transfer, at the other party. */ typedef void (*LinphoneTransferStateChanged)(struct _LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state); /** Callback prototype */ -typedef void (*CallStatsUpdated)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallStats *stats); +typedef void (*CallStatsUpdated)(struct _LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *stats); /** * This structure holds all callbacks that the application should implement. From 59415aa6e4289c82291148a2b21918996d0547a8 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 21 May 2012 16:19:11 +0200 Subject: [PATCH 263/769] Fix configure rtptimestamp -> ntptimestamp --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index de51fbc1e..235fb79b1 100644 --- a/configure.ac +++ b/configure.ac @@ -580,7 +580,7 @@ else if test x$ac_cv_c_bigendian = xyes ; then ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN" fi - if test x$rtptimestamp = xtrue ; then + if test x$ntptimestamp = xtrue ; then ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_TIMESTAMP" fi ORTP_DIR=oRTP From a4cfc69c954f8fb1e626c940b8f243d4232e9b9c Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 21 May 2012 17:29:47 +0200 Subject: [PATCH 264/769] Fix call stats init --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 8dccf9612..f010a7e79 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -318,7 +318,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, } void linphone_call_init_stats(LinphoneCallStats *stats, int type) { - stats->type = LINPHONE_CALL_STATS_AUDIO; + stats->type = type; stats->received_rtcp = NULL; stats->sent_rtcp = NULL; } From 8815f986bbb8617354c867d7bb424aad7de73b5e Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 22 May 2012 08:16:03 -0400 Subject: [PATCH 265/769] Fix unused variable with disabled video --- coreapi/linphonecore.c | 3 ++- mediastreamer2 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0ca5b7b4a..4073633b9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -773,8 +773,9 @@ static void video_config_read(LinphoneCore *lc){ int capture, display, self_view; #endif const char *str; +#ifdef VIDEO_ENABLED LinphoneVideoPolicy vpol; - +#endif build_video_devices_table(lc); str=lp_config_get_string(lc->config,"video","device",NULL); diff --git a/mediastreamer2 b/mediastreamer2 index 14187df4b..df295558f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 14187df4b75733457792b9b1f1dab6cbf852b45b +Subproject commit df295558fd536483b0ac16d8bfde76cc8dad1c9a From 409282ca6357ea1b6d8f4791725b27dfb5bdc142 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 22 May 2012 14:29:47 +0200 Subject: [PATCH 266/769] Update mediastreamer2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index df295558f..3279ea72e 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit df295558fd536483b0ac16d8bfde76cc8dad1c9a +Subproject commit 3279ea72e4938b7b9977e885cd990e981780ef80 From c6a6de60dbab77fbf6246551f36858df63daade6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 23 May 2012 10:41:11 +0200 Subject: [PATCH 267/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 3279ea72e..0e4d3ab53 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3279ea72e4938b7b9977e885cd990e981780ef80 +Subproject commit 0e4d3ab53014eee02282ed72b82086df16526245 From 8fd5f5b9f068b3ac4efd059c76029d7f7136acc6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 23 May 2012 11:53:10 +0200 Subject: [PATCH 268/769] update linphone for ms2 bugfix for phones having more than 2 cameras --- LinphoneCoreImpl.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 0b2996a03..54f6383a0 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -664,12 +664,6 @@ class LinphoneCoreImpl implements LinphoneCore { tunnelEnable(nativePtr, enable); } - private native void tunnelEnableLogs(long nativePtr, boolean enable); - @Override - public synchronized void tunnelEnableLogs(boolean enable) { - tunnelEnableLogs(nativePtr, enable); - } - @Override public native boolean isTunnelAvailable(); From 35eda1272cc50bc4fbb361482744155d55c25aeb Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 23 May 2012 16:39:43 +0200 Subject: [PATCH 269/769] Update mediastreamer2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 0e4d3ab53..490c8ef09 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0e4d3ab53014eee02282ed72b82086df16526245 +Subproject commit 490c8ef097c334b2be8746ea8391077b0dc2f03b From f3cadcf4a4c91441d5df8fc8fc25134abba310a3 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 23 May 2012 16:59:45 +0200 Subject: [PATCH 270/769] Factorized makefiles --- build/android/Android-no-neon.mk | 161 +-------------------------- build/android/Android.mk | 169 +--------------------------- build/android/common.mk | 183 +++++++++++++++++++++++++++++++ 3 files changed, 185 insertions(+), 328 deletions(-) create mode 100644 build/android/common.mk diff --git a/build/android/Android-no-neon.mk b/build/android/Android-no-neon.mk index a7348ca5c..970e8bc8a 100644 --- a/build/android/Android-no-neon.mk +++ b/build/android/Android-no-neon.mk @@ -24,172 +24,13 @@ LOCAL_PATH:= $(call my-dir)/../../coreapi include $(CLEAR_VARS) -LOCAL_CPP_EXTENSION := .cc +include $(linphone-root-dir)/submodules/linphone/build/android/common.mk -LOCAL_SRC_FILES := \ - linphonecore.c \ - misc.c \ - enum.c \ - presence.c \ - proxy.c \ - friend.c \ - authentication.c \ - lpconfig.c \ - chat.c \ - sipsetup.c \ - siplogin.c \ - address.c \ - linphonecore_jni.cc \ - sal.c \ - sal_eXosip2.c \ - sal_eXosip2_presence.c \ - sal_eXosip2_sdp.c \ - offeranswer.c \ - callbacks.c \ - linphonecall.c \ - conference.c \ - ec-calibrator.c - -ifndef MY_LOG_DOMAIN -MY_LOG_DOMAIN = \"Linphone\" -endif - -LOCAL_CFLAGS += \ - -D_BYTE_ORDER=_LITTLE_ENDIAN \ - -DORTP_INET6 \ - -DINET6 \ - -DOSIP_MT \ - -DENABLE_TRACE \ - -DLINPHONE_VERSION=\"3.4.0\" \ - -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ - -DLOG_DOMAIN=$(MY_LOG_DOMAIN) - -LOCAL_CFLAGS += -DIN_LINPHONE - -ifeq ($(LINPHONE_VIDEO),1) -LOCAL_CFLAGS += -DVIDEO_ENABLED -ifeq ($(BUILD_X264),1) -LOCAL_CFLAGS += -DHAVE_X264 -endif -endif - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/include \ - $(LOCAL_PATH)/../oRTP/include \ - $(LOCAL_PATH)/../mediastreamer2/include \ - $(LOCAL_PATH)/../../externals/exosip/include \ - $(LOCAL_PATH)/../../externals/osip/include - -LOCAL_LDLIBS += -llog -ldl - - - -LOCAL_STATIC_LIBRARIES := \ - cpufeatures \ - libmediastreamer2 \ - libortp \ - libeXosip2 \ - libosip2 \ - libgsm - -ifeq ($(BUILD_TUNNEL),1) -LOCAL_CFLAGS +=-DTUNNEL_ENABLED -LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../tunnel/include $(LOCAL_PATH)/../../tunnel/src -LOCAL_SRC_FILES += linphone_tunnel.cc TunnelManager.cc -ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) -LOCAL_SHARED_LIBRARIES += libtunnelclient -else -LOCAL_STATIC_LIBRARIES += libtunnelclient -endif -endif - - -_BUILD_AMR=0 -ifneq ($(BUILD_AMRNB), 0) -_BUILD_AMR=1 -endif - -ifneq ($(BUILD_AMRWB), 0) -_BUILD_AMR=1 -endif - -ifneq ($(_BUILD_AMR), 0) -LOCAL_CFLAGS += -DHAVE_AMR -LOCAL_STATIC_LIBRARIES += \ - libmsamr \ - libopencoreamr -endif - -ifneq ($(BUILD_AMRWB), 0) -LOCAL_STATIC_LIBRARIES += \ - libvoamrwbenc -endif - - -ifeq ($(BUILD_SILK),1) -LOCAL_CFLAGS += -DHAVE_SILK -LOCAL_STATIC_LIBRARIES += libmssilk -endif - -ifeq ($(BUILD_G729),1) -LOCAL_CFLAGS += -DHAVE_G729 -LOCAL_SHARED_LIBRARIES += libbcg729 -LOCAL_STATIC_LIBRARIES += libmsbcg729 -endif - -ifeq ($(LINPHONE_VIDEO),1) -LOCAL_LDLIBS += -lGLESv2 -LOCAL_STATIC_LIBRARIES += libvpx -ifeq ($(BUILD_X264),1) -LOCAL_STATIC_LIBRARIES += \ - libmsx264 \ - libx264 -endif LOCAL_SHARED_LIBRARIES += \ libavcodecnoneon \ libswscalenoneon \ libavcorenoneon \ libavutilnoneon -endif - -LOCAL_STATIC_LIBRARIES += libspeex - -ifeq ($(BUILD_SRTP), 1) - LOCAL_C_INCLUDES += $(SRTP_C_INCLUDE) -endif - -ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) -LOCAL_CFLAGS += -DHAVE_ILBC=1 -LOCAL_STATIC_LIBRARIES += libmsilbc -endif - -LOCAL_C_INCLUDES += $(LIBLINPHONE_EXTENDED_C_INCLUDES) -LOCAL_WHOLE_STATIC_LIBRARIES += $(LIBLINPHONE_EXTENDED_STATIC_LIBS) -LOCAL_SRC_FILES += $(LIBLINPHONE_EXTENDED_SRC_FILES) - -ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) - LOCAL_SHARED_LIBRARIES += liblinssl liblincrypto - ifeq ($(BUILD_GPLV3_ZRTP),1) - LOCAL_SHARED_LIBRARIES += libzrtpcpp - endif - - ifeq ($(BUILD_SRTP),1) - LOCAL_SHARED_LIBRARIES += libsrtp - endif -else - LOCAL_LDLIBS += -lz - #LOCAL_STATIC_LIBRARIES += libz libdl - LOCAL_STATIC_LIBRARIES += \ - libssl-static libcrypto-static - ifeq ($(BUILD_GPLV3_ZRTP),1) - LOCAL_STATIC_LIBRARIES += libzrtpcpp-static - endif - - ifeq ($(BUILD_SRTP),1) - LOCAL_STATIC_LIBRARIES += libsrtp-static - endif -endif LOCAL_MODULE := liblinphonenoneon include $(BUILD_SHARED_LIBRARY) diff --git a/build/android/Android.mk b/build/android/Android.mk index bf02efce8..903a05169 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -24,176 +24,9 @@ LOCAL_PATH:= $(call my-dir)/../../coreapi include $(CLEAR_VARS) -LOCAL_CPP_EXTENSION := .cc - -LOCAL_SRC_FILES := \ - linphonecore.c \ - misc.c \ - enum.c \ - presence.c \ - proxy.c \ - friend.c \ - authentication.c \ - lpconfig.c \ - chat.c \ - sipsetup.c \ - siplogin.c \ - address.c \ - linphonecore_jni.cc \ - sal.c \ - sal_eXosip2.c \ - sal_eXosip2_presence.c \ - sal_eXosip2_sdp.c \ - offeranswer.c \ - callbacks.c \ - linphonecall.c \ - conference.c \ - ec-calibrator.c - -ifndef MY_LOG_DOMAIN -MY_LOG_DOMAIN = \"Linphone\" -endif - -LOCAL_CFLAGS += \ - -D_BYTE_ORDER=_LITTLE_ENDIAN \ - -DORTP_INET6 \ - -DINET6 \ - -DOSIP_MT \ - -DENABLE_TRACE \ - -DLINPHONE_VERSION=\"3.4.0\" \ - -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ - -DLOG_DOMAIN=$(MY_LOG_DOMAIN) - -LOCAL_CFLAGS += -DIN_LINPHONE - -ifeq ($(LINPHONE_VIDEO),1) -LOCAL_CFLAGS += -DVIDEO_ENABLED -ifeq ($(BUILD_X264),1) -LOCAL_CFLAGS += -DHAVE_X264 -endif -endif - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/include \ - $(LOCAL_PATH)/../oRTP/include \ - $(LOCAL_PATH)/../mediastreamer2/include \ - $(LOCAL_PATH)/../../externals/exosip/include \ - $(LOCAL_PATH)/../../externals/osip/include - -LOCAL_LDLIBS += -llog -ldl - - - -LOCAL_STATIC_LIBRARIES := \ - cpufeatures \ - libmediastreamer2 \ - libortp \ - libeXosip2 \ - libosip2 \ - libgsm - -ifeq ($(BUILD_TUNNEL),1) -LOCAL_CFLAGS +=-DTUNNEL_ENABLED -LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../tunnel/include $(LOCAL_PATH)/../../tunnel/src -LOCAL_SRC_FILES += linphone_tunnel.cc TunnelManager.cc -ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) -LOCAL_SHARED_LIBRARIES += libtunnelclient -else -LOCAL_STATIC_LIBRARIES += libtunnelclient -endif -endif - - -_BUILD_AMR=0 -ifneq ($(BUILD_AMRNB), 0) -_BUILD_AMR=1 -endif - -ifneq ($(BUILD_AMRWB), 0) -_BUILD_AMR=1 -endif - -ifneq ($(_BUILD_AMR), 0) -LOCAL_CFLAGS += -DHAVE_AMR -LOCAL_STATIC_LIBRARIES += \ - libmsamr \ - libopencoreamr -endif - -ifneq ($(BUILD_AMRWB), 0) -LOCAL_STATIC_LIBRARIES += \ - libvoamrwbenc -endif - - -ifeq ($(BUILD_SILK),1) -LOCAL_CFLAGS += -DHAVE_SILK -LOCAL_STATIC_LIBRARIES += libmssilk -endif - -ifeq ($(BUILD_G729),1) -LOCAL_CFLAGS += -DHAVE_G729 -LOCAL_SHARED_LIBRARIES += libbcg729 -LOCAL_STATIC_LIBRARIES += libmsbcg729 -endif - -ifeq ($(LINPHONE_VIDEO),1) -LOCAL_LDLIBS += -lGLESv2 -LOCAL_STATIC_LIBRARIES += libvpx -ifeq ($(BUILD_X264),1) -LOCAL_STATIC_LIBRARIES += \ - libmsx264 \ - libx264 -endif -LOCAL_SHARED_LIBRARIES += \ - libavcodec \ - libswscale \ - libavcore \ - libavutil -endif - -LOCAL_STATIC_LIBRARIES += libspeex - -ifeq ($(BUILD_SRTP), 1) - LOCAL_C_INCLUDES += $(SRTP_C_INCLUDE) -endif - -ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) -LOCAL_CFLAGS += -DHAVE_ILBC=1 -LOCAL_STATIC_LIBRARIES += libmsilbc -endif - -LOCAL_C_INCLUDES += $(LIBLINPHONE_EXTENDED_C_INCLUDES) -LOCAL_WHOLE_STATIC_LIBRARIES += $(LIBLINPHONE_EXTENDED_STATIC_LIBS) -LOCAL_SRC_FILES += $(LIBLINPHONE_EXTENDED_SRC_FILES) - -ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) - LOCAL_SHARED_LIBRARIES += liblinssl liblincrypto - ifeq ($(BUILD_GPLV3_ZRTP),1) - LOCAL_SHARED_LIBRARIES += libzrtpcpp - endif - - ifeq ($(BUILD_SRTP),1) - LOCAL_SHARED_LIBRARIES += libsrtp - endif -else - LOCAL_LDLIBS += -lz - #LOCAL_STATIC_LIBRARIES += libz libdl - LOCAL_STATIC_LIBRARIES += \ - libssl-static libcrypto-static - ifeq ($(BUILD_GPLV3_ZRTP),1) - LOCAL_STATIC_LIBRARIES += libzrtpcpp-static - endif - - ifeq ($(BUILD_SRTP),1) - LOCAL_STATIC_LIBRARIES += libsrtp-static - endif -endif +include $(linphone-root-dir)/submodules/linphone/build/android/common.mk LOCAL_MODULE := liblinphone include $(BUILD_SHARED_LIBRARY) $(call import-module,android/cpufeatures) - - diff --git a/build/android/common.mk b/build/android/common.mk new file mode 100644 index 000000000..38b6c22cd --- /dev/null +++ b/build/android/common.mk @@ -0,0 +1,183 @@ +## +## Android.mk -Android build script- +## +## +## Copyright (C) 2010 Belledonne Communications, Grenoble, France +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## + +LOCAL_CPP_EXTENSION := .cc + +LOCAL_SRC_FILES := \ + linphonecore.c \ + misc.c \ + enum.c \ + presence.c \ + proxy.c \ + friend.c \ + authentication.c \ + lpconfig.c \ + chat.c \ + sipsetup.c \ + siplogin.c \ + address.c \ + linphonecore_jni.cc \ + sal.c \ + sal_eXosip2.c \ + sal_eXosip2_presence.c \ + sal_eXosip2_sdp.c \ + offeranswer.c \ + callbacks.c \ + linphonecall.c \ + conference.c \ + ec-calibrator.c + +ifndef MY_LOG_DOMAIN +MY_LOG_DOMAIN = \"Linphone\" +endif + +LOCAL_CFLAGS += \ + -D_BYTE_ORDER=_LITTLE_ENDIAN \ + -DORTP_INET6 \ + -DINET6 \ + -DOSIP_MT \ + -DENABLE_TRACE \ + -DLINPHONE_VERSION=\"3.4.0\" \ + -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ + -DLOG_DOMAIN=$(MY_LOG_DOMAIN) + +LOCAL_CFLAGS += -DIN_LINPHONE + +ifeq ($(LINPHONE_VIDEO),1) +LOCAL_CFLAGS += -DVIDEO_ENABLED +ifeq ($(BUILD_X264),1) +LOCAL_CFLAGS += -DHAVE_X264 +endif +endif + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/include \ + $(LOCAL_PATH)/../oRTP/include \ + $(LOCAL_PATH)/../mediastreamer2/include \ + $(LOCAL_PATH)/../../externals/exosip/include \ + $(LOCAL_PATH)/../../externals/osip/include + +LOCAL_LDLIBS += -llog -ldl + + + +LOCAL_STATIC_LIBRARIES := \ + cpufeatures \ + libmediastreamer2 \ + libortp \ + libeXosip2 \ + libosip2 \ + libgsm + +ifeq ($(BUILD_TUNNEL),1) +LOCAL_CFLAGS +=-DTUNNEL_ENABLED +LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../tunnel/include $(LOCAL_PATH)/../../tunnel/src +LOCAL_SRC_FILES += linphone_tunnel.cc TunnelManager.cc +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) +LOCAL_SHARED_LIBRARIES += libtunnelclient +else +LOCAL_STATIC_LIBRARIES += libtunnelclient +endif +endif + + +_BUILD_AMR=0 +ifneq ($(BUILD_AMRNB), 0) +_BUILD_AMR=1 +endif + +ifneq ($(BUILD_AMRWB), 0) +_BUILD_AMR=1 +endif + +ifneq ($(_BUILD_AMR), 0) +LOCAL_CFLAGS += -DHAVE_AMR +LOCAL_STATIC_LIBRARIES += \ + libmsamr \ + libopencoreamr +endif + +ifneq ($(BUILD_AMRWB), 0) +LOCAL_STATIC_LIBRARIES += \ + libvoamrwbenc +endif + + +ifeq ($(BUILD_SILK),1) +LOCAL_CFLAGS += -DHAVE_SILK +LOCAL_STATIC_LIBRARIES += libmssilk +endif + +ifeq ($(BUILD_G729),1) +LOCAL_CFLAGS += -DHAVE_G729 +LOCAL_SHARED_LIBRARIES += libbcg729 +LOCAL_STATIC_LIBRARIES += libmsbcg729 +endif + +ifeq ($(LINPHONE_VIDEO),1) +LOCAL_LDLIBS += -lGLESv2 +LOCAL_STATIC_LIBRARIES += libvpx +ifeq ($(BUILD_X264),1) +LOCAL_STATIC_LIBRARIES += \ + libmsx264 \ + libx264 +endif +endif + +LOCAL_STATIC_LIBRARIES += libspeex + +ifeq ($(BUILD_SRTP), 1) + LOCAL_C_INCLUDES += $(SRTP_C_INCLUDE) +endif + +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) +LOCAL_CFLAGS += -DHAVE_ILBC=1 +LOCAL_STATIC_LIBRARIES += libmsilbc +endif + +LOCAL_C_INCLUDES += $(LIBLINPHONE_EXTENDED_C_INCLUDES) +LOCAL_WHOLE_STATIC_LIBRARIES += $(LIBLINPHONE_EXTENDED_STATIC_LIBS) +LOCAL_SRC_FILES += $(LIBLINPHONE_EXTENDED_SRC_FILES) + +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) + LOCAL_SHARED_LIBRARIES += liblinssl liblincrypto + ifeq ($(BUILD_GPLV3_ZRTP),1) + LOCAL_SHARED_LIBRARIES += libzrtpcpp + endif + + ifeq ($(BUILD_SRTP),1) + LOCAL_SHARED_LIBRARIES += libsrtp + endif +else + LOCAL_LDLIBS += -lz + #LOCAL_STATIC_LIBRARIES += libz libdl + LOCAL_STATIC_LIBRARIES += \ + libssl-static libcrypto-static + ifeq ($(BUILD_GPLV3_ZRTP),1) + LOCAL_STATIC_LIBRARIES += libzrtpcpp-static + endif + + ifeq ($(BUILD_SRTP),1) + LOCAL_STATIC_LIBRARIES += libsrtp-static + endif +endif + From bad6c152f1521de8648d47c70e9321b7668b40b5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 23 May 2012 17:10:28 +0200 Subject: [PATCH 271/769] fix two bugs in sal - declare auth info valid after a received 180 - don't authenticate terminated calls. --- coreapi/sal_eXosip2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index d1cf241ab..7e48f02ca 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -883,6 +883,7 @@ int sal_call_terminate(SalOp *h){ } void sal_op_authenticate(SalOp *h, const SalAuthInfo *info){ + if (h->terminated) return; if (h->pending_auth){ push_auth_to_exosip(info); @@ -1969,6 +1970,7 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){ case EXOSIP_CALL_RINGING: ms_message("CALL_RINGING"); call_ringing(sal,ev); + authentication_ok(sal,ev); break; case EXOSIP_CALL_MESSAGE_NEW: ms_message("EXOSIP_CALL_MESSAGE_NEW"); From cd96b8ba6695890d61f55b3b070b09265d4e2b37 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 23 May 2012 17:37:01 +0200 Subject: [PATCH 272/769] Renamed liblinphone for armv5 + fix compilation issue --- build/android/Android-no-neon.mk | 10 +++++++--- build/android/Android.mk | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/build/android/Android-no-neon.mk b/build/android/Android-no-neon.mk index 970e8bc8a..3d72ffc55 100644 --- a/build/android/Android-no-neon.mk +++ b/build/android/Android-no-neon.mk @@ -28,11 +28,15 @@ include $(linphone-root-dir)/submodules/linphone/build/android/common.mk LOCAL_SHARED_LIBRARIES += \ libavcodecnoneon \ - libswscalenoneon \ - libavcorenoneon \ - libavutilnoneon + libswscale \ + libavcore \ + libavutil LOCAL_MODULE := liblinphonenoneon +ifeq ($(TARGET_ARCH_ABI),armeabi) +LOCAL_MODULE_FILENAME := liblinphonearmv5 +endif + include $(BUILD_SHARED_LIBRARY) $(call import-module,android/cpufeatures) diff --git a/build/android/Android.mk b/build/android/Android.mk index 903a05169..549367611 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -26,7 +26,14 @@ include $(CLEAR_VARS) include $(linphone-root-dir)/submodules/linphone/build/android/common.mk +LOCAL_SHARED_LIBRARIES += \ + libavcodec \ + libswscale \ + libavcore \ + libavutil + LOCAL_MODULE := liblinphone + include $(BUILD_SHARED_LIBRARY) $(call import-module,android/cpufeatures) From 9806cc6b5d0d76accbb2b91e9f104d321dc99f9f Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 23 May 2012 17:38:16 +0200 Subject: [PATCH 273/769] Updated libs compilation --- LinphoneCoreFactoryImpl.java | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 8cc721e90..baed45873 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -40,22 +40,16 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { static { // FFMPEG (audio/video) + loadOptionalLibrary("avutil"); + loadOptionalLibrary("swscale"); + loadOptionalLibrary("avcore"); + if (!hasNeonInCpuFeatures()) { - boolean noNeonLibrariesLoaded = true; - noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avutilnoneon"); - noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("swscalenoneon"); - noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avcorenoneon"); - noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avcodecnoneon"); + boolean noNeonLibrariesLoaded = loadOptionalLibrary("avcodecnoneon"); if (!noNeonLibrariesLoaded) { - loadOptionalLibrary("avutil"); - loadOptionalLibrary("swscale"); - loadOptionalLibrary("avcore"); loadOptionalLibrary("avcodec"); } } else { - loadOptionalLibrary("avutil"); - loadOptionalLibrary("swscale"); - loadOptionalLibrary("avcore"); loadOptionalLibrary("avcodec"); } @@ -77,7 +71,11 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { //Main library if (!hasNeonInCpuFeatures()) { try { - System.loadLibrary("linphonenoneon"); + if (isArmv5()) { + System.loadLibrary("linphonearmv5"); + } else { + System.loadLibrary("linphonenoneon"); + } Log.w("linphone", "No-neon liblinphone loaded"); } catch (UnsatisfiedLinkError ule) { Log.w("linphone", "Failed to load no-neon liblinphone, loading neon liblinphone"); @@ -176,4 +174,9 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } return result; } + + public static boolean isArmv5() + { + return System.getProperty("os.arch").contains("armv5"); + } } From 2e0e95552ccd22a87b994b7e0248cabb41e72472 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 24 May 2012 17:06:37 +0200 Subject: [PATCH 274/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 490c8ef09..b2e32f4b8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 490c8ef097c334b2be8746ea8391077b0dc2f03b +Subproject commit b2e32f4b82b3bf73389f757fb0db5646280bfb4a From 7ad822f81ec94008ef6fcceafd620cf94863957b Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Fri, 25 May 2012 09:48:55 +0200 Subject: [PATCH 275/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index b2e32f4b8..457a44f11 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b2e32f4b82b3bf73389f757fb0db5646280bfb4a +Subproject commit 457a44f11e5a947678ae4f53fda0c3ede9a083b1 From e2379a67051d30fb061ce738cf83e4d81f45bb14 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 25 May 2012 15:21:26 +0200 Subject: [PATCH 276/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 457a44f11..778f7faa9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 457a44f11e5a947678ae4f53fda0c3ede9a083b1 +Subproject commit 778f7faa9cc92b4c1f256f8af93ac205d2493b18 From 121089650a4b06036a388e0cf3c6502038798c77 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 29 May 2012 19:30:45 +0200 Subject: [PATCH 277/769] In linphone_call_zoom_video check video output presence --- coreapi/linphonecore.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4073633b9..679f19604 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4784,25 +4784,27 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para } void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) { - VideoStream* vstream = call->videostream; - float zoom[3]; - - if (zoom_factor < 1) - zoom_factor = 1; - float halfsize = 0.5 * 1.0 / zoom_factor; - - if ((*cx - halfsize) < 0) - *cx = 0 + halfsize; - if ((*cx + halfsize) > 1) - *cx = 1 - halfsize; - if ((*cy - halfsize) < 0) - *cy = 0 + halfsize; - if ((*cy + halfsize) > 1) - *cy = 1 - halfsize; - - zoom[0] = zoom_factor; - zoom[1] = *cx; - zoom[2] = *cy; - ms_filter_call_method(vstream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom); + VideoStream* vstream = call->videostream; + if (vstream) { + float zoom[3]; + + if (zoom_factor < 1) + zoom_factor = 1; + float halfsize = 0.5 * 1.0 / zoom_factor; + + if ((*cx - halfsize) < 0) + *cx = 0 + halfsize; + if ((*cx + halfsize) > 1) + *cx = 1 - halfsize; + if ((*cy - halfsize) < 0) + *cy = 0 + halfsize; + if ((*cy + halfsize) > 1) + *cy = 1 - halfsize; + + zoom[0] = zoom_factor; + zoom[1] = *cx; + zoom[2] = *cy; + ms_filter_call_method(vstream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom); + }else ms_warning("Could not apply zoom: video output wasn't activated."); } From fde22ebf2217c7e6b736ba3e50813243c0eff459 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 29 May 2012 23:50:35 +0200 Subject: [PATCH 278/769] implement setting of http proxy host and port (for tunnel extension) in gtk ui --- coreapi/TunnelManager.cc | 2 +- coreapi/linphone_tunnel.cc | 25 ++-- coreapi/linphone_tunnel.h | 1 + gtk/propertybox.c | 20 ++++ gtk/tunnel_config.ui | 229 +++++++++++++++++++++++++++++++++---- 5 files changed, 246 insertions(+), 31 deletions(-) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index 3e998cb74..44d12251c 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -276,7 +276,7 @@ void TunnelManager::waitUnRegistration(){ LinphoneProxyConfig* lProxy; linphone_core_get_default_proxy(mCore, &lProxy); if (lProxy && linphone_proxy_config_get_state(lProxy)==LinphoneRegistrationOk) { - int i; + int i=0; linphone_proxy_config_edit(lProxy); //make sure unregister is sent and authenticated do{ diff --git a/coreapi/linphone_tunnel.cc b/coreapi/linphone_tunnel.cc index d36778bb8..947286373 100644 --- a/coreapi/linphone_tunnel.cc +++ b/coreapi/linphone_tunnel.cc @@ -152,6 +152,17 @@ void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel *tunnel, const char void linphone_tunnel_set_http_proxy(LinphoneTunnel*tunnel, const char *host, int port, const char* username,const char* passwd){ bcTunnel(tunnel)->setHttpProxy(host, port, username, passwd); + lp_config_set_string(config(tunnel),"tunnel","http_proxy_host",host); + lp_config_set_int(config(tunnel),"tunnel","http_proxy_port",port); + lp_config_set_string(config(tunnel),"tunnel","http_proxy_username",username); + lp_config_set_string(config(tunnel),"tunnel","http_proxy_password",passwd); +} + +void linphone_tunnel_get_http_proxy(LinphoneTunnel*tunnel,const char **host, int *port, const char **username, const char **passwd){ + if (host) *host=lp_config_get_string(config(tunnel),"tunnel","http_proxy_host",NULL); + if (port) *port=lp_config_get_int(config(tunnel),"tunnel","http_proxy_port",0); + if (username) *username=lp_config_get_string(config(tunnel),"tunnel","http_proxy_username",NULL); + if (passwd) *passwd=lp_config_get_string(config(tunnel),"tunnel","http_proxy_password",NULL); } void linphone_tunnel_reconnect(LinphoneTunnel *tunnel){ @@ -162,19 +173,17 @@ void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel){ bcTunnel(tunnel)->autoDetect(); } -static void tunnel_add_servers_from_config(LinphoneTunnel *tunnel, const char* confaddress){ - char *addresses=(char*)ms_strdup(confaddress); +static void tunnel_add_servers_from_config(LinphoneTunnel *tunnel, char* confaddress){ char *str1; - for(str1=addresses;;str1=NULL){ + for(str1=confaddress;;str1=NULL){ char *port; char *address=strtok(str1," "); // Not thread safe if (!address) break; port=strchr(address, ':'); - if (!port) ms_fatal("Bad tunnel address %s", address); + if (!port) ms_fatal("Bad tunnel address %s",confaddress); *port++='\0'; linphone_tunnel_add_server(tunnel, address, atoi(port)); } - ms_free(addresses); } static void my_ortp_logv(OrtpLogLevel level, const char *fmt, va_list args){ @@ -188,10 +197,12 @@ static void my_ortp_logv(OrtpLogLevel level, const char *fmt, va_list args){ void linphone_tunnel_configure(LinphoneTunnel *tunnel){ bool_t enabled=(bool_t)lp_config_get_int(config(tunnel),"tunnel","enabled",FALSE); const char* addresses=lp_config_get_string(config(tunnel),"tunnel","server_addresses", NULL); + char *copy=addresses ? ms_strdup(addresses) : NULL; linphone_tunnel_enable_logs_with_handler(tunnel,TRUE,my_ortp_logv); linphone_tunnel_clean_servers(tunnel); - if (addresses){ - tunnel_add_servers_from_config(tunnel,addresses); + if (copy){ + tunnel_add_servers_from_config(tunnel,copy); + ms_free(copy); } linphone_tunnel_enable(tunnel, enabled); } diff --git a/coreapi/linphone_tunnel.h b/coreapi/linphone_tunnel.h index ea49ac8b2..5d78fe8f6 100644 --- a/coreapi/linphone_tunnel.h +++ b/coreapi/linphone_tunnel.h @@ -106,6 +106,7 @@ void linphone_tunnel_reconnect(LinphoneTunnel *tunnel); void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel); void linphone_tunnel_set_http_proxy(LinphoneTunnel *tunnel, const char *host, int port, const char* username,const char* passwd); void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd); +void linphone_tunnel_get_http_proxy(LinphoneTunnel*tunnel,const char **host, int *port, const char **username, const char **passwd); void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled); diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 5af25a5c4..809207a2a 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1077,6 +1077,19 @@ void linphone_gtk_edit_tunnel(GtkButton *button){ } else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"radio_disable")),1); } + { + const char *proxy=NULL,*username=NULL,*password=NULL; + port=0; + linphone_tunnel_get_http_proxy(tunnel,&proxy,&port,&username,&password); + if (proxy) + gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"http_host")),proxy); + if (port>0) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"http_port")), port); + if (username) + gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"username")),username); + if (password) + gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"password")),password); + } g_object_weak_ref(G_OBJECT(w),(GWeakNotify)linphone_gtk_edit_tunnel_closed,w); gtk_widget_show(w); @@ -1090,12 +1103,19 @@ void linphone_gtk_tunnel_ok(GtkButton *button){ gint port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"port"))); gboolean enabled=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"radio_enable"))); const char *host=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"host"))); + const char *http_host=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"http_host"))); + gint http_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"http_port"))); + const char *username=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"username"))); + const char *password=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"password"))); if (tunnel==NULL) return; if (host && *host=='\0') host=NULL; + if (http_port==0) http_port=8080; linphone_tunnel_clean_servers(tunnel); linphone_tunnel_add_server(tunnel,host,port); linphone_tunnel_enable(tunnel,enabled); + linphone_tunnel_set_http_proxy(tunnel,http_host,http_port,username,password); + gtk_widget_destroy(w); } diff --git a/gtk/tunnel_config.ui b/gtk/tunnel_config.ui index c10ddf257..427346613 100644 --- a/gtk/tunnel_config.ui +++ b/gtk/tunnel_config.ui @@ -1,14 +1,23 @@ - + - + - 3600 - 100000 + 1 + 65535 + 443 + 1 + 10 + + + 1 + 65535 + 8080 1 10 + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 Linphone - Configure a SIP account @@ -18,32 +27,39 @@ True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 2 True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 none True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 12 True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 4 2 + True True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Host right @@ -55,6 +71,10 @@ True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + False + True + True 1 @@ -64,6 +84,7 @@ True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Port right @@ -73,14 +94,35 @@ 2 + + + True + True + â— + False + False + True + True + adjustment1 + + + 1 + 2 + 1 + 2 + + Enable True True False + False + 0 True True + radio_disable 1 @@ -95,9 +137,10 @@ True True False + False + 0 True True - radio_enable 1 @@ -106,20 +149,6 @@ 4 - - - True - True - - adjustment1 - - - 1 - 2 - 1 - 2 - - @@ -128,6 +157,8 @@ + True + True 0 @@ -138,19 +169,168 @@ True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Configure tunnel + <b>Configure tunnel</b> True + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 12 + + + True + False + 4 + 2 + True + + + True + False + Host + + + + + True + False + Port + + + 1 + 2 + + + + + True + False + Username + + + 2 + 3 + + + + + True + False + Password + + + 3 + 4 + + + + + True + True + â— + False + False + True + True + adjustment2 + + + 1 + 2 + 1 + 2 + + + + + True + True + â— + False + False + True + True + + + 1 + 2 + + + + + True + True + â— + False + False + True + True + + + 1 + 2 + 2 + 3 + + + + + True + True + False + â— + False + False + True + True + + + 1 + 2 + 3 + 4 + + + + + + + + + True + False + <b>Configure http proxy (optional)</b> + True + + + + + True + True 1 True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK end @@ -160,8 +340,9 @@ True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True - + False @@ -176,8 +357,9 @@ True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True - + False @@ -188,8 +370,9 @@ False + True end - 0 + 2 From dfb7e62d42cc926a966a490bc6c6275a58b7a312 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 30 May 2012 10:00:04 +0200 Subject: [PATCH 279/769] add tunnel stub --- coreapi/linphone_tunnel.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/linphone_tunnel.cc b/coreapi/linphone_tunnel.cc index 947286373..6a47e83ab 100644 --- a/coreapi/linphone_tunnel.cc +++ b/coreapi/linphone_tunnel.cc @@ -245,6 +245,9 @@ void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel *tunnel, const char void linphone_tunnel_set_http_proxy(LinphoneTunnel*tunnel, const char *host, int port, const char* username,const char* passwd){ } +void linphone_tunnel_get_http_proxy(LinphoneTunnel*tunnel,const char **host, int *port, const char **username, const char **passwd){ +} + void linphone_tunnel_reconnect(LinphoneTunnel *tunnel){ } From 0e6098d29ebc40fcd56b98c83fd3e76c3e914f2e Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 30 May 2012 16:42:34 +0200 Subject: [PATCH 280/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 778f7faa9..7fe1c91af 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 778f7faa9cc92b4c1f256f8af93ac205d2493b18 +Subproject commit 7fe1c91afdd73a48fcf62884fd697cba6e61141f From 0e464598b3ca67b09470accafaed16fb1b4aab3a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 31 May 2012 10:50:18 +0200 Subject: [PATCH 281/769] fix bad window title --- gtk/tunnel_config.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/tunnel_config.ui b/gtk/tunnel_config.ui index 427346613..a940a5f7c 100644 --- a/gtk/tunnel_config.ui +++ b/gtk/tunnel_config.ui @@ -20,7 +20,7 @@ False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 - Linphone - Configure a SIP account + Configure VoIP tunnel center-on-parent linphone2.png dialog From ad228ff1fdfd105561097c8d10831c102fcfac4d Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 31 May 2012 13:01:44 +0200 Subject: [PATCH 282/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7fe1c91af..8fb5d72cf 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7fe1c91afdd73a48fcf62884fd697cba6e61141f +Subproject commit 8fb5d72cf1ecc1c30c29fc4ba093b9bade74ba6a From bc8f026d2b9a8c058f1411037f397a96d422c107 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 31 May 2012 14:15:17 +0200 Subject: [PATCH 283/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 8fb5d72cf..38d2d7411 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 8fb5d72cf1ecc1c30c29fc4ba093b9bade74ba6a +Subproject commit 38d2d7411a6fb3cd61d33234a16b88ade1967b4d From 3d0d30a5ae0cd5e6d910d77d1f2b11e93a290757 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 31 May 2012 15:32:07 +0200 Subject: [PATCH 284/769] update README and improve windows logging --- README.mingw | 26 ++++++++++++++++++++++---- gtk/logging.c | 1 + 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.mingw b/README.mingw index c35236dcc..42b130f33 100644 --- a/README.mingw +++ b/README.mingw @@ -26,7 +26,7 @@ Download lastest linphone-deps-win32 zip from http://download.savannah.gnu.org/releases-noredirect/linphone/misc using your browser. -Download lastest gtk+ win32 bundle from http://www.gtk.org +Download lastest gtk+2 win32 bundle from http://www.gtk.org Install all these three package in /: @@ -65,20 +65,38 @@ WARNING: During the build, windows might slow down suddenly. Using ctl+alt+del t you might see a process 'LVpSRV.exe' or something like this that eats 90% of cpu. Kill it. Don't know what it is, but once killed, windows runs normally. -#Compile and install tunnel -cd tunnel && ./autogen.sh && ./configure --prefix=/opt/linphone && make && make install +#Compile and install tunnel (optional, available under proprietary licensing) + +cd tunnel && ./autogen.sh && ./configure --prefix=/usr --enable-shared --disable-static && make && make install + +#Build linphone itself: #run autogen.sh after a git checkout or update + ./autogen.sh + ./configure --prefix=/opt/linphone --enable-shared --disable-static +#note: in order to use the tunnel, append --enable-tunnel to the configure line above. + +#compile: + make -#will install to /opt/linphone, required for compilation of plugins. + +#now install to /opt/linphone, required for compilation of plugins. + make install + #make a binary zip of linphone + make zip + #additionally you can make binary installer if you have Inno Setup 5 installed in its default path + make setup.exe + #now you're done, you have a fresh linphone windows installer in the current directory. + + #build plugins cd mediastreamer2/plugins/msx264 ./autogen.sh diff --git a/gtk/logging.c b/gtk/logging.c index e2a9da600..15bef85e0 100644 --- a/gtk/logging.c +++ b/gtk/logging.c @@ -206,6 +206,7 @@ static void linphone_gtk_log_file(OrtpLogLevel lev, const char *msg) case of a crash (which is one of the main reasons we have a log facility in the first place). */ fprintf(outlog, "[%s] [%s] %s\n", date, lname, msg); + fflush(outlog); } } From 99ace7d2fd1a0f57bc1a562374ea0bc7bf71dea4 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 1 Jun 2012 09:45:47 +0200 Subject: [PATCH 285/769] Fix armv6 loadling liblinphone issue --- LinphoneCoreFactoryImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index baed45873..7d0be46e3 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -71,7 +71,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { //Main library if (!hasNeonInCpuFeatures()) { try { - if (isArmv5()) { + if (!isArmv7()) { System.loadLibrary("linphonearmv5"); } else { System.loadLibrary("linphonenoneon"); @@ -175,8 +175,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { return result; } - public static boolean isArmv5() + public static boolean isArmv7() { - return System.getProperty("os.arch").contains("armv5"); + return System.getProperty("os.arch").contains("armv7"); } } From d3d00b7ef2dfb412bf4e316e276899ff82c39975 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 1 Jun 2012 14:46:58 +0200 Subject: [PATCH 286/769] add --no-video option to gtk app --- gtk/main.c | 29 ++++++++++++++++++++++------- mediastreamer2 | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/gtk/main.c b/gtk/main.c index fc8a6bfcc..2a6c307b6 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define VIDEOSELFVIEW_DEFAULT 1 +#define VIDEOSELFVIEW_DEFAULT 0 #include "linphone.h" #include "lpconfig.h" @@ -66,11 +66,13 @@ static void linphone_gtk_call_encryption_changed(LinphoneCore *lc, LinphoneCall static void linphone_gtk_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate); static gboolean linphone_gtk_auto_answer(LinphoneCall *call); static void linphone_gtk_status_icon_set_blinking(gboolean val); +void _linphone_gtk_enable_video(gboolean val); static gboolean verbose=0; static gboolean auto_answer = 0; static gchar * addr_to_call = NULL; +static gboolean no_video=FALSE; static gboolean iconified=FALSE; static gchar *workingdir=NULL; static char *progpath=NULL; @@ -91,6 +93,13 @@ static GOptionEntry linphone_options[]={ .arg_data = &linphone_logfile, .description = N_("path to a file to write logs into.") }, + { + .long_name = "no-video", + .short_name = '\0', + .arg = G_OPTION_ARG_NONE, + .arg_data = (gpointer)&no_video, + .description = N_("Start linphone with video disabled.") + }, { .long_name="iconified", .short_name= '\0', @@ -234,6 +243,10 @@ static void linphone_gtk_init_liblinphone(const char *config_file, linphone_core_set_zrtp_secrets_file(the_core,secrets_file); g_free(secrets_file); linphone_core_enable_video(the_core,TRUE,TRUE); + if (no_video) { + _linphone_gtk_enable_video(FALSE); + linphone_gtk_set_ui_config_int("videoselfview",0); + } } @@ -648,10 +661,8 @@ bool_t linphone_gtk_video_enabled(void){ void linphone_gtk_show_main_window(){ GtkWidget *w=linphone_gtk_get_main_window(); LinphoneCore *lc=linphone_gtk_get_core(); - if (linphone_gtk_video_enabled()){ - linphone_core_enable_video_preview(lc,linphone_gtk_get_ui_config_int("videoselfview", + linphone_core_enable_video_preview(lc,linphone_gtk_get_ui_config_int("videoselfview", VIDEOSELFVIEW_DEFAULT)); - } gtk_widget_show(w); gtk_window_present(GTK_WINDOW(w)); } @@ -772,9 +783,7 @@ void linphone_gtk_answer_clicked(GtkWidget *button){ } } -void linphone_gtk_enable_video(GtkWidget *w){ - gboolean val=gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); - //GtkWidget *selfview_item=linphone_gtk_get_widget(linphone_gtk_get_main_window(),"selfview_item"); +void _linphone_gtk_enable_video(gboolean val){ LinphoneVideoPolicy policy={0}; policy.automatically_initiate=policy.automatically_accept=val; linphone_core_enable_video(linphone_gtk_get_core(),TRUE,TRUE); @@ -788,6 +797,12 @@ void linphone_gtk_enable_video(GtkWidget *w){ } } +void linphone_gtk_enable_video(GtkWidget *w){ + gboolean val=gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); + //GtkWidget *selfview_item=linphone_gtk_get_widget(linphone_gtk_get_main_window(),"selfview_item"); + _linphone_gtk_enable_video(val); +} + void linphone_gtk_enable_self_view(GtkWidget *w){ gboolean val=gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); LinphoneCore *lc=linphone_gtk_get_core(); diff --git a/mediastreamer2 b/mediastreamer2 index 38d2d7411..343d9116b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 38d2d7411a6fb3cd61d33234a16b88ade1967b4d +Subproject commit 343d9116b35e2f80c01e77a4bc7bbf898126cd53 From 31e817b49e39844029a7b1be5ae499cfd37b9a20 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 4 Jun 2012 12:23:37 +0200 Subject: [PATCH 287/769] workaround for SDP offers with zero ports --- coreapi/offeranswer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index fd0196782..5a2b4f527 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -233,7 +233,7 @@ static void initiate_incoming(const SalStreamDescription *local_cap, result->proto=remote_offer->proto; result->type=local_cap->type; result->dir=compute_dir_incoming(local_cap->dir,remote_offer->dir); - if (result->payloads && !only_telephone_event(result->payloads)){ + if (result->payloads && !only_telephone_event(result->payloads) && (remote_offer->port!=0 || remote_offer->port==SalStreamSendOnly)){ strcpy(result->addr,local_cap->addr); memcpy(result->candidates,local_cap->candidates,sizeof(result->candidates)); result->port=local_cap->port; From 2d669353c3eda22e63023fde2f3cde7b437d2c81 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 5 Jun 2012 12:54:33 +0200 Subject: [PATCH 288/769] fix unitialized value --- coreapi/sal_eXosip2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 7e48f02ca..4c0e5512b 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -162,7 +162,7 @@ void sal_exosip_fix_route(SalOp *op){ } SalOp * sal_op_new(Sal *sal){ - SalOp *op=ms_new(SalOp,1); + SalOp *op=ms_new0(SalOp,1); __sal_op_init(op,sal); op->cid=op->did=op->tid=op->rid=op->nid=op->sid=-1; op->result=NULL; From 3d5d12d8579996faf7d1ef8a2c600356c8d598ea Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 6 Jun 2012 10:50:15 +0200 Subject: [PATCH 289/769] implement expiration of old contact during double registration, and avoid sending an updated register if server already fixed the contact. --- coreapi/linphonecore.c | 1 + coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 67 +++++++++++++++++++++++++++++------------- coreapi/sal_eXosip2.h | 1 + 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 679f19604..77080eba8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -478,6 +478,7 @@ static void sip_config_read(LinphoneCore *lc) sal_use_rport(lc->sal,lp_config_get_int(lc->config,"sip","use_rport",1)); sal_use_101(lc->sal,lp_config_get_int(lc->config,"sip","use_101",1)); sal_reuse_authorization(lc->sal, lp_config_get_int(lc->config,"sip","reuse_authorization",0)); + sal_expire_old_registration_contacts(lc->sal,lp_config_get_int(lc->config,"sip","expire_old_registration_contacts",0)); tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",0); linphone_core_set_use_rfc2833_for_dtmf(lc,tmp); diff --git a/coreapi/sal.h b/coreapi/sal.h index bbe4dafff..d2d9cbe51 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -291,6 +291,7 @@ void sal_set_keepalive_period(Sal *ctx,unsigned int value); unsigned int sal_get_keepalive_period(Sal *ctx); void sal_use_session_timers(Sal *ctx, int expires); void sal_use_double_registrations(Sal *ctx, bool_t enabled); +void sal_expire_old_registration_contacts(Sal *ctx, bool_t enabled); void sal_reuse_authorization(Sal *ctx, bool_t enabled); void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec); void sal_use_rport(Sal *ctx, bool_t use_rports); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 4c0e5512b..863c4f47b 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -33,7 +33,7 @@ static bool_t call_failure(Sal *sal, eXosip_event_t *ev); static void text_received(Sal *sal, eXosip_event_t *ev); static void masquerade_via(osip_message_t *msg, const char *ip, const char *port); -static bool_t fix_message_contact(SalOp *op, osip_message_t *request,osip_message_t *last_answer); +static bool_t fix_message_contact(SalOp *op, osip_message_t *request,osip_message_t *last_answer, bool_t expire_last_contact); static void update_contact_from_response(SalOp *op, osip_message_t *response); void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*)){ @@ -283,6 +283,7 @@ Sal * sal_init(){ sal->reuse_authorization=FALSE; sal->rootCa = 0; sal->verify_server_certs=TRUE; + sal->expire_old_contact=FALSE; return sal; } @@ -429,6 +430,10 @@ void sal_use_double_registrations(Sal *ctx, bool_t enabled){ ctx->double_reg=enabled; } +void sal_expire_old_registration_contacts(Sal *ctx, bool_t enabled){ + ctx->expire_old_contact=enabled; +} + void sal_use_rport(Sal *ctx, bool_t use_rports){ ctx->use_rports=use_rports; } @@ -1733,7 +1738,7 @@ static void masquerade_via(osip_message_t *msg, const char *ip, const char *port } -static bool_t fix_message_contact(SalOp *op, osip_message_t *request,osip_message_t *last_answer) { +static bool_t fix_message_contact(SalOp *op, osip_message_t *request,osip_message_t *last_answer, bool_t expire_last_contact) { osip_contact_t *ctt=NULL; const char *received; int rport; @@ -1746,6 +1751,20 @@ static bool_t fix_message_contact(SalOp *op, osip_message_t *request,osip_messag ms_warning("fix_message_contact(): no contact to update"); return FALSE; } + if (expire_last_contact){ + osip_contact_t *oldct=ctt; + osip_generic_param_t *param=NULL; + ctt=NULL; + osip_contact_clone(oldct,&ctt); + osip_list_add(&request->contacts,ctt,0); + osip_contact_param_get_byname(oldct,"expires",¶m); + if (param){ + if (param->gvalue) osip_free(param->gvalue); + param->gvalue=osip_strdup("0"); + }else{ + osip_contact_param_add(oldct,osip_strdup("expires"),osip_strdup("0")); + } + } if (ctt->url->host!=NULL){ osip_free(ctt->url->host); } @@ -1772,29 +1791,35 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori char* tmp; osip_message_t *msg=NULL; Sal* sal=op->base.root; + int i=0; + bool_t found_valid_contact=FALSE; if (sal->double_reg==FALSE ) return FALSE; if (extract_received_rport(last_answer,&received,&rport,&transport)==-1) return FALSE; - osip_message_get_contact(orig_request,0,&ctt); - osip_contact_to_str(ctt,&tmp); - ori_contact_address = sal_address_new(tmp); + do{ + ctt=NULL; + osip_message_get_contact(last_answer,i,&ctt); + if (ctt==NULL) osip_message_get_contact(orig_request,0,&ctt); + if (ctt){ + osip_contact_to_str(ctt,&tmp); + ori_contact_address = sal_address_new(tmp); - /*check if contact is up to date*/ - if (strcmp(sal_address_get_domain(ori_contact_address),received) ==0 - && sal_address_get_port_int(ori_contact_address) == rport - && sal_address_get_transport(ori_contact_address) == transport) { - ms_message("Register has up to date contact, doing nothing."); - osip_free(tmp); - sal_address_destroy(ori_contact_address); - return FALSE; - } else ms_message("contact do not match, need to update the register (%s with %s:%i;transport=%s)" - ,tmp - ,received - ,rport - ,sal_transport_to_string(transport)); - osip_free(tmp); - sal_address_destroy(ori_contact_address); + /*check if contact is up to date*/ + if (strcmp(sal_address_get_domain(ori_contact_address),received) ==0 + && sal_address_get_port_int(ori_contact_address) == rport + && sal_address_get_transport(ori_contact_address) == transport) { + ms_message("Register response has up to date contact, doing nothing."); + found_valid_contact=TRUE; + } + osip_free(tmp); + sal_address_destroy(ori_contact_address); + }else break; + i++; + }while(!found_valid_contact); + if (!found_valid_contact) + ms_message("Contact do not match, resending register."); + else return FALSE; eXosip_lock(); eXosip_register_build_register(op->rid,op->expires,&msg); @@ -1803,7 +1828,7 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori ms_warning("Fail to create a contact updated register."); return FALSE; } - if (fix_message_contact(op,msg,last_answer)) { + if (fix_message_contact(op,msg,last_answer,op->base.root->expire_old_contact)) { eXosip_register_send_register(op->rid,msg); eXosip_unlock(); ms_message("Resending new register with updated contact"); diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index f85ddfa1c..ccc95d56a 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -47,6 +47,7 @@ struct Sal{ bool_t use_101; bool_t reuse_authorization; bool_t verify_server_certs; + bool_t expire_old_contact; }; struct SalOp{ From 903756a7cb30363efa6ad5a8285848fee3bacfd3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 6 Jun 2012 21:48:29 +0200 Subject: [PATCH 290/769] fix possible infinite loop --- coreapi/sal_eXosip2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 863c4f47b..51cef8b66 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1800,7 +1800,7 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori do{ ctt=NULL; osip_message_get_contact(last_answer,i,&ctt); - if (ctt==NULL) osip_message_get_contact(orig_request,0,&ctt); + if (i==0 && ctt==NULL) osip_message_get_contact(orig_request,0,&ctt); if (ctt){ osip_contact_to_str(ctt,&tmp); ori_contact_address = sal_address_new(tmp); From c45873a06a7afa3fe0e011c365fea261339f4fba Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 7 Jun 2012 15:24:29 +0200 Subject: [PATCH 291/769] clean up expired contact in registrations --- coreapi/sal_eXosip2.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 51cef8b66..8333f1554 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1752,11 +1752,14 @@ static bool_t fix_message_contact(SalOp *op, osip_message_t *request,osip_messag return FALSE; } if (expire_last_contact){ - osip_contact_t *oldct=ctt; + osip_contact_t *oldct=NULL,*prevct; osip_generic_param_t *param=NULL; - ctt=NULL; - osip_contact_clone(oldct,&ctt); - osip_list_add(&request->contacts,ctt,0); + osip_contact_clone(ctt,&oldct); + while ((prevct=(osip_contact_t*)osip_list_get(&request->contacts,1))!=NULL){ + osip_contact_free(prevct); + osip_list_remove(&request->contacts,1); + } + osip_list_add(&request->contacts,oldct,1); osip_contact_param_get_byname(oldct,"expires",¶m); if (param){ if (param->gvalue) osip_free(param->gvalue); @@ -1793,6 +1796,7 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori Sal* sal=op->base.root; int i=0; bool_t found_valid_contact=FALSE; + bool_t from_request=FALSE; if (sal->double_reg==FALSE ) return FALSE; @@ -1800,7 +1804,10 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori do{ ctt=NULL; osip_message_get_contact(last_answer,i,&ctt); - if (i==0 && ctt==NULL) osip_message_get_contact(orig_request,0,&ctt); + if (!from_request && ctt==NULL) { + osip_message_get_contact(orig_request,0,&ctt); + from_request=TRUE; + } if (ctt){ osip_contact_to_str(ctt,&tmp); ori_contact_address = sal_address_new(tmp); @@ -1809,7 +1816,12 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori if (strcmp(sal_address_get_domain(ori_contact_address),received) ==0 && sal_address_get_port_int(ori_contact_address) == rport && sal_address_get_transport(ori_contact_address) == transport) { - ms_message("Register response has up to date contact, doing nothing."); + if (!from_request){ + ms_message("Register response has up to date contact, doing nothing."); + }else { + ms_warning("Register response does not have up to date contact, but last request had." + "Stupid registrar detected, giving up."); + } found_valid_contact=TRUE; } osip_free(tmp); From 71a3ba34641f32d3b069329b4eab56b10807ee42 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 12 Jun 2012 13:48:34 +0200 Subject: [PATCH 292/769] improve linphone_core_find_payload_type to use strcasecmp --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 77080eba8..19d6f1378 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4511,7 +4511,7 @@ static PayloadType* find_payload_type_from_list(const char* type, int rate,const const MSList *elem; for(elem=from;elem!=NULL;elem=elem->next){ PayloadType *pt=(PayloadType*)elem->data; - if ((strcmp((char*)type, payload_type_get_mime(pt)) == 0) && (rate == -1 || rate==pt->clock_rate)) { + if ((strcasecmp((char*)type, payload_type_get_mime(pt)) == 0) && (rate == -1 || rate==pt->clock_rate)) { return pt; } } From 02130419d357a9148e87bf0bdcef3272f03740f4 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 12 Jun 2012 16:10:13 +0200 Subject: [PATCH 293/769] fix sip random port feature --- coreapi/linphonecore.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 19d6f1378..c0531ae9a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -467,6 +467,7 @@ static void sip_config_read(LinphoneCore *lc) LCSipTransports tr; int i,tmp; int ipv6; + int random_port; tmp=lp_config_get_int(lc->config,"sip","use_info",0); linphone_core_set_use_info_for_dtmf(lc,tmp); @@ -489,21 +490,26 @@ static void sip_config_read(LinphoneCore *lc) } linphone_core_enable_ipv6(lc,ipv6); memset(&tr,0,sizeof(tr)); - if (lp_config_get_int(lc->config,"sip","sip_random_port",0)) { - tr.udp_port=(0xDFF&+random())+1024; - } else { - tr.udp_port=lp_config_get_int(lc->config,"sip","sip_port",5060); - } - if (lp_config_get_int(lc->config,"sip","sip_tcp_random_port",0)) { - tr.tcp_port=(0xDFF&+random())+1024; - } else { - tr.tcp_port=lp_config_get_int(lc->config,"sip","sip_tcp_port",0); - } - if (lp_config_get_int(lc->config,"sip","sip_tls_random_port",0)) { - tr.tls_port=(0xDFF&+random())+1024; - } else { - tr.tls_port=lp_config_get_int(lc->config,"sip","sip_tls_port",0); - } + + tr.udp_port=lp_config_get_int(lc->config,"sip","sip_port",0); + tr.tcp_port=lp_config_get_int(lc->config,"sip","sip_tcp_port",0); + tr.tls_port=lp_config_get_int(lc->config,"sip","sip_tls_port",0); + + if (lp_config_get_int(lc->config,"sip","sip_random_port",0)==1) + random_port=(0xDFFF&random())+1024; + else random_port=0; + + if (tr.udp_port==0 && tr.tcp_port==0 && tr.tls_port==0){ + tr.udp_port=5060; + } + + if (tr.udp_port>0 && random_port){ + tr.udp_port=random_port; + }else if (tr.tcp_port>0 && random_port){ + tr.tcp_port=random_port; + }else if (tr.tls_port>0 && random_port){ + tr.tls_port=random_port; + } #ifdef __linux sal_set_root_ca(lc->sal, lp_config_get_string(lc->config,"sip","root_ca", "/etc/ssl/certs")); From 3a4c17df8f5ac930894ffd3ac155d4d4dc0b40f5 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 12 Jun 2012 16:18:19 +0200 Subject: [PATCH 294/769] Added getStatus method for LinphoneCallLog --- coreapi/linphonecore_jni.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 619961432..52f5d24ad 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1119,6 +1119,11 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getFrom(JNIEnv* env ,jlong ptr) { return (jlong)((LinphoneCallLog*)ptr)->from; } +extern "C" int Java_org_linphone_core_LinphoneCallLogImpl_getStatus(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + return (jlong)((LinphoneCallLog*)ptr)->status; +} extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTo(JNIEnv* env ,jobject thiz ,jlong ptr) { From 23d589cec01361b7c08528cd7433d5b01c0579bb Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 12 Jun 2012 17:21:11 +0200 Subject: [PATCH 295/769] fix bugs in call status, write codecs config immediately --- coreapi/callbacks.c | 15 ++++++++-- coreapi/linphonecall.c | 10 +++++-- coreapi/linphonecore.c | 67 ++++++++++++++++++++++++------------------ coreapi/linphonecore.h | 3 +- coreapi/misc.c | 1 + coreapi/private.h | 1 + gtk/calllogs.c | 21 ++++++++++++- 7 files changed, 83 insertions(+), 35 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index d7bc861ba..8ec8f39b1 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -484,9 +484,18 @@ static void call_terminated(SalOp *op, const char *from){ if (call==NULL) return; - if (linphone_call_get_state(call)==LinphoneCallEnd || linphone_call_get_state(call)==LinphoneCallError){ - ms_warning("call_terminated: ignoring."); - return; + switch(linphone_call_get_state(call)){ + case LinphoneCallEnd: + case LinphoneCallError: + ms_warning("call_terminated: ignoring."); + return; + break; + case LinphoneCallIncomingReceived: + case LinphoneCallIncomingEarlyMedia: + call->reason=LinphoneReasonNotAnswered; + break; + default: + break; } ms_message("Current call terminated..."); //we stop the call only if we have this current call or if we are in call diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f010a7e79..ac8460291 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -497,8 +497,14 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const call->state=cstate; } if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){ - if (call->reason==LinphoneReasonDeclined){ - call->log->status=LinphoneCallDeclined; + switch(call->reason){ + case LinphoneReasonDeclined: + call->log->status=LinphoneCallDeclined; + case LinphoneReasonNotAnswered: + call->log->status=LinphoneCallMissed; + break; + default: + break; } linphone_call_set_terminated (call); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c0531ae9a..3bc23b344 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1319,6 +1319,7 @@ int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs) { if (lc->codecs_conf.audio_codecs!=NULL) ms_list_free(lc->codecs_conf.audio_codecs); lc->codecs_conf.audio_codecs=codecs; + _linphone_core_codec_config_write(lc); return 0; } @@ -1333,6 +1334,7 @@ int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs) { if (lc->codecs_conf.video_codecs!=NULL) ms_list_free(lc->codecs_conf.video_codecs); lc->codecs_conf.video_codecs=codecs; + _linphone_core_codec_config_write(lc); return 0; } @@ -1827,6 +1829,7 @@ void linphone_core_iterate(LinphoneCore *lc){ ms_message("incoming call ringing for %i seconds",elapsed); if (elapsed>lc->sip_conf.inc_timeout){ call->log->status=LinphoneCallMissed; + call->reason=LinphoneReasonNotAnswered; linphone_core_terminate_call(lc,call); } } @@ -2569,7 +2572,8 @@ int linphone_core_abort_call(LinphoneCore *lc, LinphoneCall *call, const char *e static void terminate_call(LinphoneCore *lc, LinphoneCall *call){ if (call->state==LinphoneCallIncomingReceived){ - call->reason=LinphoneReasonDeclined; + if (call->reason!=LinphoneReasonNotAnswered) + call->reason=LinphoneReasonDeclined; } /*stop ringing*/ if (lc->ringstream!=NULL) { @@ -4261,38 +4265,43 @@ void video_config_uninit(LinphoneCore *lc) ms_free(lc->video_conf.cams); } -void codecs_config_uninit(LinphoneCore *lc) -{ - PayloadType *pt; - codecs_config_t *config=&lc->codecs_conf; - MSList *node; - char key[50]; - int index; - index=0; - for(node=config->audio_codecs;node!=NULL;node=ms_list_next(node)){ - pt=(PayloadType*)(node->data); +void _linphone_core_codec_config_write(LinphoneCore *lc){ + if (linphone_core_ready(lc)){ + PayloadType *pt; + codecs_config_t *config=&lc->codecs_conf; + MSList *node; + char key[50]; + int index; + index=0; + for(node=config->audio_codecs;node!=NULL;node=ms_list_next(node)){ + pt=(PayloadType*)(node->data); + sprintf(key,"audio_codec_%i",index); + lp_config_set_string(lc->config,key,"mime",pt->mime_type); + lp_config_set_int(lc->config,key,"rate",pt->clock_rate); + lp_config_set_int(lc->config,key,"enabled",linphone_core_payload_type_enabled(lc,pt)); + index++; + } sprintf(key,"audio_codec_%i",index); - lp_config_set_string(lc->config,key,"mime",pt->mime_type); - lp_config_set_int(lc->config,key,"rate",pt->clock_rate); - lp_config_set_int(lc->config,key,"enabled",linphone_core_payload_type_enabled(lc,pt)); - index++; - } - sprintf(key,"audio_codec_%i",index); - lp_config_clean_section (lc->config,key); + lp_config_clean_section (lc->config,key); - index=0; - for(node=config->video_codecs;node!=NULL;node=ms_list_next(node)){ - pt=(PayloadType*)(node->data); + index=0; + for(node=config->video_codecs;node!=NULL;node=ms_list_next(node)){ + pt=(PayloadType*)(node->data); + sprintf(key,"video_codec_%i",index); + lp_config_set_string(lc->config,key,"mime",pt->mime_type); + lp_config_set_int(lc->config,key,"rate",pt->clock_rate); + lp_config_set_int(lc->config,key,"enabled",linphone_core_payload_type_enabled(lc,pt)); + lp_config_set_string(lc->config,key,"recv_fmtp",pt->recv_fmtp); + index++; + } sprintf(key,"video_codec_%i",index); - lp_config_set_string(lc->config,key,"mime",pt->mime_type); - lp_config_set_int(lc->config,key,"rate",pt->clock_rate); - lp_config_set_int(lc->config,key,"enabled",linphone_core_payload_type_enabled(lc,pt)); - lp_config_set_string(lc->config,key,"recv_fmtp",pt->recv_fmtp); - index++; + lp_config_clean_section (lc->config,key); } - sprintf(key,"video_codec_%i",index); - lp_config_clean_section (lc->config,key); +} +static void codecs_config_uninit(LinphoneCore *lc) +{ + _linphone_core_codec_config_write(lc); ms_list_free(lc->codecs_conf.audio_codecs); ms_list_free(lc->codecs_conf.video_codecs); } @@ -4584,6 +4593,8 @@ const char *linphone_reason_to_string(LinphoneReason err){ return "Call declined"; case LinphoneReasonNotFound: return "User not found"; + case LinphoneReasonNotAnswered: + return "Not answered"; } return "unknown error"; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 59dbca0cb..ae3f9cb15 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -205,7 +205,8 @@ enum _LinphoneReason{ LinphoneReasonNoResponse, /**codecs_conf.audio_codecs,pt) || ms_list_find(lc->codecs_conf.video_codecs,pt)){ payload_type_set_enable(pt,enabled); + _linphone_core_codec_config_write(lc); return 0; } ms_error("Enabling codec not in audio or video list of PayloadType !"); diff --git a/coreapi/private.h b/coreapi/private.h index 773e77882..1ab7a6a7d 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -568,6 +568,7 @@ bool_t linphone_core_sound_resources_available(LinphoneCore *lc); void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall); void __linphone_core_invalidate_registers(LinphoneCore* lc); +void _linphone_core_codec_config_write(LinphoneCore *lc); #define HOLD_OFF (0) #define HOLD_ON (1) diff --git a/gtk/calllogs.c b/gtk/calllogs.c index 5ff2a08eb..bd5969ec8 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -57,6 +57,7 @@ void linphone_gtk_call_log_update(GtkWidget *w){ const char *display; gchar *logtxt, *minutes, *seconds; gchar quality[20]; + const char *status=NULL; display=linphone_address_get_display_name (la); if (display==NULL){ @@ -67,17 +68,35 @@ void linphone_gtk_call_log_update(GtkWidget *w){ if (cl->quality!=-1){ snprintf(quality,sizeof(quality),"%.1f",cl->quality); } + switch(cl->status){ + case LinphoneCallAborted: + status=_("Aborted"); + break; + case LinphoneCallMissed: + status=_("Missed"); + break; + case LinphoneCallDeclined: + status=_("Declined"); + break; + default: + break; + } minutes=g_markup_printf_escaped( ngettext("%i minute", "%i minutes", cl->duration/60), cl->duration/60); seconds=g_markup_printf_escaped( ngettext("%i second", "%i seconds", cl->duration%60), cl->duration%60); - logtxt=g_markup_printf_escaped( + if (status==NULL) logtxt=g_markup_printf_escaped( _("%s\t%s\t" "Quality: %s\n%s\t%s %s\t"), display, addr, cl->quality!=-1 ? quality : _("n/a"), cl->start_date, minutes, seconds); + else logtxt=g_markup_printf_escaped( + _("%s\t%s\t" + "\n%s\t%s"), + display, addr, + cl->start_date, status); g_free(minutes); g_free(seconds); gtk_list_store_append (store,&iter); From 160dc76b0efccc8ef78f006718dd6029f54b10fe Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 13 Jun 2012 10:15:16 +0200 Subject: [PATCH 296/769] Created and exported some methods to manage call logs from Java --- coreapi/linphonecore.c | 8 ++++++++ coreapi/linphonecore.h | 2 ++ coreapi/linphonecore_jni.cc | 12 ++++++++++++ java/common/org/linphone/core/LinphoneCallLog.java | 2 ++ java/common/org/linphone/core/LinphoneCore.java | 11 +++++++++++ 5 files changed, 35 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c0531ae9a..ada24237d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3485,6 +3485,14 @@ void linphone_core_clear_call_logs(LinphoneCore *lc){ call_logs_write_to_config_file(lc); } +int linphone_core_get_missed_calls_count(LinphoneCore *lc) { + return lc->missed_calls; +} + +void linphone_core_remove_call_log(LinphoneCore *lc, void *data) { + lc->call_logs = ms_list_remove(lc->call_logs, data); +} + static void toggle_video_preview(LinphoneCore *lc, bool_t val){ #ifdef VIDEO_ENABLED if (val){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 59dbca0cb..a59353a21 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -969,6 +969,8 @@ void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val); /* returns a list of LinphoneCallLog */ const MSList * linphone_core_get_call_logs(LinphoneCore *lc); void linphone_core_clear_call_logs(LinphoneCore *lc); +int linphone_core_get_missed_calls_count(LinphoneCore *lc); +void linphone_core_remove_call_log(LinphoneCore *lc, void *data); /* video support */ bool_t linphone_core_video_supported(LinphoneCore *lc); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 52f5d24ad..f3ba28685 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -642,6 +642,18 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_stopDtmf( JNIEnv* env linphone_core_stop_dtmf((LinphoneCore*)lc); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_getMissedCallsCount(JNIEnv* env + ,jobject thiz + ,jlong lc) { + linphone_core_get_missed_calls_count((LinphoneCore*)lc); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeCallLog(JNIEnv* env + ,jobject thiz + ,jlong lc, jlong log) { + linphone_core_remove_call_log((LinphoneCore*)lc, (void*) log); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv* env ,jobject thiz ,jlong lc) { diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index 015f071df..c56f324d1 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -94,4 +94,6 @@ public interface LinphoneCallLog { * @return */ public CallStatus getStatus(); + + public long getNativePtr(); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 0d8e14ae9..b6830863c 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -20,6 +20,7 @@ package org.linphone.core; import java.util.Vector; +import org.linphone.core.LinphoneCallLog; import org.linphone.core.LinphoneCallParams; /** @@ -759,4 +760,14 @@ public interface LinphoneCore { void setUserAgent(String name, String version); void setCpuCount(int count); + + /** + * remove a call log + */ + public void removeCallLog(LinphoneCallLog log); + + /** + * @return count of missed calls + */ + public int getMissedCallsCount(); } From d72e9c553ebc58de52ada8987f9d08e61c87d129 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 13 Jun 2012 10:34:52 +0200 Subject: [PATCH 297/769] Save the logs removed --- coreapi/linphonecore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 9caa52dc3..134d38d34 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3495,6 +3495,7 @@ int linphone_core_get_missed_calls_count(LinphoneCore *lc) { void linphone_core_remove_call_log(LinphoneCore *lc, void *data) { lc->call_logs = ms_list_remove(lc->call_logs, data); + call_logs_write_to_config_file(lc); } static void toggle_video_preview(LinphoneCore *lc, bool_t val){ From 9ee07aa8ffbcaf12159946b3b91bfb77d4cf13bb Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 13 Jun 2012 14:06:52 +0200 Subject: [PATCH 298/769] Added JNI method to get call start date in log --- coreapi/linphonecore_jni.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index f3ba28685..35ee7f26d 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1146,6 +1146,12 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_isIncoming(JNIEnv ,jlong ptr) { return ((LinphoneCallLog*)ptr)->dir==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE; } +extern "C" jstring Java_org_linphone_core_LinphoneCallLogImpl_getStartDate(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + jstring jvalue =env->NewStringUTF(((LinphoneCallLog*)ptr)->start_date); + return jvalue; +} /*payloadType*/ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) { From f1f3c3c5e75931947fb4d8e265ef7f5e1fda6616 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 13 Jun 2012 14:11:14 +0200 Subject: [PATCH 299/769] Added LinphoneCallLog interface previously exported JNI method --- java/common/org/linphone/core/LinphoneCallLog.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index c56f324d1..fa1bc2ae5 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -96,4 +96,9 @@ public interface LinphoneCallLog { public CallStatus getStatus(); public long getNativePtr(); + + /** + * @return a human readble String with the start date/time of the call + */ + public String getStartDate(); } From cc211d4813f09a75f9fe27484e55031d39c2aee2 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 13 Jun 2012 14:15:48 +0200 Subject: [PATCH 300/769] Exported JNI method to get call duration from log --- coreapi/linphonecore_jni.cc | 5 +++++ java/common/org/linphone/core/LinphoneCallLog.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 35ee7f26d..d45f6009b 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1152,6 +1152,11 @@ extern "C" jstring Java_org_linphone_core_LinphoneCallLogImpl_getStartDate(JNIEn jstring jvalue =env->NewStringUTF(((LinphoneCallLog*)ptr)->start_date); return jvalue; } +extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + return ((LinphoneCallLog*)ptr)->duration; +} /*payloadType*/ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) { diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index fa1bc2ae5..98bf40c50 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -101,4 +101,9 @@ public interface LinphoneCallLog { * @return a human readble String with the start date/time of the call */ public String getStartDate(); + + /** + * @return the call duration, in seconds + */ + public int getCallDuration(); } From 0d922d4c801cf6c9179638e5311485e871889284 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 13 Jun 2012 15:11:25 +0200 Subject: [PATCH 301/769] Added resetMissedCallsCount to linphone core and exported via JNI --- coreapi/linphonecore.c | 4 ++++ coreapi/linphonecore.h | 1 + coreapi/linphonecore_jni.cc | 6 ++++++ java/common/org/linphone/core/LinphoneCore.java | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 134d38d34..41b9e2dda 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3493,6 +3493,10 @@ int linphone_core_get_missed_calls_count(LinphoneCore *lc) { return lc->missed_calls; } +void linphone_core_reset_missed_calls_count(LinphoneCore *lc) { + lc->missed_calls=0; +} + void linphone_core_remove_call_log(LinphoneCore *lc, void *data) { lc->call_logs = ms_list_remove(lc->call_logs, data); call_logs_write_to_config_file(lc); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 531950d72..c9c6fc1a1 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -971,6 +971,7 @@ void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val); const MSList * linphone_core_get_call_logs(LinphoneCore *lc); void linphone_core_clear_call_logs(LinphoneCore *lc); int linphone_core_get_missed_calls_count(LinphoneCore *lc); +void linphone_core_reset_missed_calls_count(LinphoneCore *lc); void linphone_core_remove_call_log(LinphoneCore *lc, void *data); /* video support */ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index d45f6009b..4393e3a3b 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -648,6 +648,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_getMissedCallsCount(JNIE linphone_core_get_missed_calls_count((LinphoneCore*)lc); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_resetMissedCallsCount(JNIEnv* env + ,jobject thiz + ,jlong lc) { + linphone_core_reset_missed_calls_count((LinphoneCore*)lc); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeCallLog(JNIEnv* env ,jobject thiz ,jlong lc, jlong log) { diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index b6830863c..86559f43f 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -770,4 +770,9 @@ public interface LinphoneCore { * @return count of missed calls */ public int getMissedCallsCount(); + + /** + * Set missed calls count to zero + */ + public void resetMissedCallsCount(); } From 89296804e4adc3bddf8248187ff328ebf2d74438 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 13 Jun 2012 17:38:13 +0200 Subject: [PATCH 302/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 343d9116b..5b865fce6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 343d9116b35e2f80c01e77a4bc7bbf898126cd53 +Subproject commit 5b865fce6a98d20b9b8696784b5e7e6467f2ced0 From 630e26944dd6e5cca53787452b162ec6baf7ba48 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 13 Jun 2012 17:45:48 +0200 Subject: [PATCH 303/769] Update ms2 (fix) --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 5b865fce6..415269b15 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5b865fce6a98d20b9b8696784b5e7e6467f2ced0 +Subproject commit 415269b15fb64aec82328332602591abac2d782d From 80e4341e05c2410d4b3e64ac8c2b997910ef7075 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 18 Jun 2012 16:56:48 +0200 Subject: [PATCH 304/769] add setHttpProxy wrapper --- coreapi/linphonecore_jni.cc | 27 ++++++++++++------- .../org/linphone/core/LinphoneCallLog.java | 2 -- .../org/linphone/core/LinphoneCore.java | 1 + 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 4393e3a3b..5d0b61b70 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1685,33 +1685,42 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMaxCalls(JNIEnv *env, extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAddServerAndMirror(JNIEnv *env,jobject thiz,jlong pCore, jstring jHost, jint port, jint mirror, jint delay) { -#ifdef TUNNEL_ENABLED - LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; + LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; + if (!tunnel) return; const char* cHost=env->GetStringUTFChars(jHost, NULL); linphone_tunnel_add_server_and_mirror(tunnel, cHost, port, mirror, delay); env->ReleaseStringUTFChars(jHost, cHost); -#endif } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelSetHttpProxy(JNIEnv *env,jobject thiz,jlong pCore, + jstring jHost, jint port, jstring username, jstring password) { + + LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; + if (!tunnel) return; + const char* cHost=(jHost!=NULL) ? env->GetStringUTFChars(jHost, NULL) : NULL; + const char* cUsername= (username!=NULL) ? env->GetStringUTFChars(username, NULL) : NULL; + const char* cPassword= (password!=NULL) ? env->GetStringUTFChars(password, NULL) : NULL; + linphone_tunnel_set_http_proxy(tunnel,cHost, port,cUsername,cPassword); + if (cHost) env->ReleaseStringUTFChars(jHost, cHost); + if (cUsername) env->ReleaseStringUTFChars(username, cUsername); + if (cPassword) env->ReleaseStringUTFChars(password, cPassword); +} + + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAutoDetect(JNIEnv *env,jobject thiz,jlong pCore) { -#ifdef TUNNEL_ENABLED LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; linphone_tunnel_auto_detect(tunnel); -#endif + } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelCleanServers(JNIEnv *env,jobject thiz,jlong pCore) { -#ifdef TUNNEL_ENABLED LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; linphone_tunnel_clean_servers(tunnel); -#endif } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnable(JNIEnv *env,jobject thiz,jlong pCore, jboolean enable) { -#ifdef TUNNEL_ENABLED LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; linphone_tunnel_enable(tunnel, enable); -#endif } diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index 98bf40c50..40299e6d9 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -95,8 +95,6 @@ public interface LinphoneCallLog { */ public CallStatus getStatus(); - public long getNativePtr(); - /** * @return a human readble String with the start date/time of the call */ diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 86559f43f..f4bcc7ef8 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -743,6 +743,7 @@ public interface LinphoneCore { void tunnelEnable(boolean enable); void tunnelAutoDetect(); void tunnelCleanServers(); + void tunnelSetHttpProxy(String proxy_host, int port, String username, String password); /** * @param host tunnel server ip address * @param port tunnel server tls port, recommended value is 443 From 7db25e2e318a591c0c175782e244af18fab44915 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 18 Jun 2012 17:00:26 +0200 Subject: [PATCH 305/769] add tunnelSetHttpProxy() --- LinphoneCallLogImpl.java | 10 ++++++++++ LinphoneCoreImpl.java | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index 1bdb84720..895e27a38 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -45,5 +45,15 @@ class LinphoneCallLogImpl implements LinphoneCallLog { public CallStatus getStatus() { throw new RuntimeException("not implemented yet"); } + @Override + public String getStartDate() { + // TODO Auto-generated method stub + return null; + } + @Override + public int getCallDuration() { + // TODO Auto-generated method stub + return 0; + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 54f6383a0..d02f69cfb 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -704,4 +704,25 @@ class LinphoneCoreImpl implements LinphoneCore { { setCpuCountNative(count); } + private native void tunnelSetHttpProxyNative(long nativePtr, String proxy_host, int port, String username, String password); + @Override + public void tunnelSetHttpProxy(String proxy_host, int port, + String username, String password) { + tunnelSetHttpProxyNative(nativePtr,proxy_host, port, username, password); + } + @Override + public void removeCallLog(LinphoneCallLog log) { + // TODO Auto-generated method stub + + } + @Override + public int getMissedCallsCount() { + // TODO Auto-generated method stub + return 0; + } + @Override + public void resetMissedCallsCount() { + // TODO Auto-generated method stub + + } } From d5a3e7b345d894a1fc40691d1cd7c242947ebe11 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 21 Jun 2012 10:05:25 +0200 Subject: [PATCH 306/769] First changes for the new UI --- LinphoneCallLogImpl.java | 18 +++- LinphoneCoreImpl.java | 18 +++- tutorials/AndroidTutorialNotifier.java | 50 --------- tutorials/TutorialBuddyStatusActivity.java | 109 -------------------- tutorials/TutorialChatRoomActivity.java | 98 ------------------ tutorials/TutorialHelloWorldActivity.java | 98 ------------------ tutorials/TutorialRegistrationActivity.java | 103 ------------------ 7 files changed, 31 insertions(+), 463 deletions(-) delete mode 100644 tutorials/AndroidTutorialNotifier.java delete mode 100644 tutorials/TutorialBuddyStatusActivity.java delete mode 100644 tutorials/TutorialChatRoomActivity.java delete mode 100644 tutorials/TutorialHelloWorldActivity.java delete mode 100644 tutorials/TutorialRegistrationActivity.java diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index 1bdb84720..996b51c10 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -26,11 +26,14 @@ class LinphoneCallLogImpl implements LinphoneCallLog { private native long getFrom(long nativePtr); private native long getTo(long nativePtr); private native boolean isIncoming(long nativePtr); + private native int getStatus(long nativePtr); + private native String getStartDate(long nativePtr); + private native int getCallDuration(long nativePtr); + LinphoneCallLogImpl(long aNativePtr) { nativePtr = aNativePtr; } - public CallDirection getDirection() { return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing; } @@ -43,7 +46,18 @@ class LinphoneCallLogImpl implements LinphoneCallLog { return new LinphoneAddressImpl(getTo(nativePtr)); } public CallStatus getStatus() { - throw new RuntimeException("not implemented yet"); + return LinphoneCallLog.CallStatus.fromInt(getStatus(nativePtr)); } + public long getNativePtr() { + return nativePtr; + } + + public String getStartDate() { + return getStartDate(nativePtr); + } + + public int getCallDuration() { + return getCallDuration(nativePtr); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 54f6383a0..75e885253 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,12 +20,10 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.util.Vector; class LinphoneCoreImpl implements LinphoneCore { - @SuppressWarnings("unused") private final LinphoneCoreListener mListener; //to make sure to keep a reference on this object private long nativePtr = 0; private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); @@ -108,7 +106,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setMediaEncryption(long nativePtr, int menc); private native boolean isMediaEncryptionMandatory(long nativePtr); private native void setMediaEncryptionMandatory(long nativePtr, boolean yesno); - + private native void removeCallLog(long nativePtr, long callLogPtr); + private native int getMissedCallsCount(long nativePtr); + private native void resetMissedCallsCount(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -704,4 +704,16 @@ class LinphoneCoreImpl implements LinphoneCore { { setCpuCountNative(count); } + + public int getMissedCallsCount() { + return getMissedCallsCount(nativePtr); + } + + public void removeCallLog(LinphoneCallLog log) { + removeCallLog(nativePtr, log.getNativePtr()); + } + + public void resetMissedCallsCount() { + resetMissedCallsCount(nativePtr); + } } diff --git a/tutorials/AndroidTutorialNotifier.java b/tutorials/AndroidTutorialNotifier.java deleted file mode 100644 index 7721f7dc1..000000000 --- a/tutorials/AndroidTutorialNotifier.java +++ /dev/null @@ -1,50 +0,0 @@ -/* -AndroidTutorialNotifier.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.tutorials; - -import android.os.Handler; -import android.widget.TextView; - -/** - * Write notifications to a TextView widget. - * This is an helper class, not a test activity. - * - * @author Guillaume Beraudo - * - */ -class AndroidTutorialNotifier extends TutorialNotifier { - - private Handler mHandler; - private TextView outputTextView; - - public AndroidTutorialNotifier(Handler mHandler, final TextView outputTextView) { - this.mHandler = mHandler; - this.outputTextView = outputTextView; - } - - - @Override - public void notify(final String s) { - mHandler.post(new Runnable() { - public void run() { - outputTextView.setText(s + "\n" + outputTextView.getText()); - } - }); - } -} diff --git a/tutorials/TutorialBuddyStatusActivity.java b/tutorials/TutorialBuddyStatusActivity.java deleted file mode 100644 index 1bf4f981f..000000000 --- a/tutorials/TutorialBuddyStatusActivity.java +++ /dev/null @@ -1,109 +0,0 @@ -/* -TutorialBuddyStatusActivity.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.tutorials; - -import org.linphone.R; -import org.linphone.core.LinphoneCoreException; - -import android.app.Activity; -import android.os.Bundle; -import android.os.Handler; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; - -/** - * Activity for displaying and starting the BuddyStatus example on Android phone. - * - * @author Guillaume Beraudo - * - */ -public class TutorialBuddyStatusActivity extends Activity { - - private static final String defaultSipAddress = "sip:"; - private TextView sipAddressWidget; - private TextView mySipAddressWidget; - private TextView mySipPasswordWidget; - - private TutorialBuddyStatus tutorial; - private Handler mHandler = new Handler() ; - private Button buttonCall; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.hello_world); - sipAddressWidget = (TextView) findViewById(R.id.AddressId); - sipAddressWidget.setText(defaultSipAddress); - - mySipAddressWidget = (TextView) findViewById(R.id.MyAddressId); - mySipAddressWidget.setVisibility(View.VISIBLE); - mySipPasswordWidget = (TextView) findViewById(R.id.Password); - mySipPasswordWidget.setVisibility(TextView.VISIBLE); - - - // Output text to the outputText widget - final TextView outputText = (TextView) findViewById(R.id.OutputText); - final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); - - - // Create BuddyStatus object - tutorial = new TutorialBuddyStatus(notifier); - - - - // Assign call action to call button - buttonCall = (Button) findViewById(R.id.CallButton); - buttonCall.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - TutorialLaunchingThread thread = new TutorialLaunchingThread(); - buttonCall.setEnabled(false); - thread.start(); - } - }); - - // Assign stop action to stop button - Button buttonStop = (Button) findViewById(R.id.ButtonStop); - buttonStop.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - tutorial.stopMainLoop(); - } - }); - } - - - private class TutorialLaunchingThread extends Thread { - @Override - public void run() { - super.run(); - try { - String myIdentity = mySipAddressWidget.getText().length()>0?mySipAddressWidget.getText().toString():null; - String myPassword = mySipPasswordWidget.getText().length()>0?mySipPasswordWidget.getText().toString():null; - tutorial.launchTutorial(sipAddressWidget.getText().toString(), myIdentity, myPassword); - mHandler.post(new Runnable() { - public void run() { - buttonCall.setEnabled(true); - } - }); - } catch (LinphoneCoreException e) { - e.printStackTrace(); - } - } - } -} diff --git a/tutorials/TutorialChatRoomActivity.java b/tutorials/TutorialChatRoomActivity.java deleted file mode 100644 index f7dab4ce7..000000000 --- a/tutorials/TutorialChatRoomActivity.java +++ /dev/null @@ -1,98 +0,0 @@ -/* -TutorialChatRoomActivity.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.tutorials; - -import org.linphone.R; -import org.linphone.core.LinphoneCoreException; - -import android.app.Activity; -import android.os.Bundle; -import android.os.Handler; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; - -/** - * Activity for displaying and starting the chatroom example on Android phone. - * - * @author Guillaume Beraudo - * - */ -public class TutorialChatRoomActivity extends Activity { - - private static final String defaultSipAddress = "sip:"; - private TextView sipAddressWidget; - private TutorialChatRoom tutorial; - private Handler mHandler = new Handler() ; - private Button buttonCall; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.hello_world); - sipAddressWidget = (TextView) findViewById(R.id.AddressId); - sipAddressWidget.setText(defaultSipAddress); - - // Output text to the outputText widget - final TextView outputText = (TextView) findViewById(R.id.OutputText); - final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); - - - // Create HelloWorld object - tutorial = new TutorialChatRoom(notifier); - - - - // Assign call action to call button - buttonCall = (Button) findViewById(R.id.CallButton); - buttonCall.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - TutorialLaunchingThread thread = new TutorialLaunchingThread(); - buttonCall.setEnabled(false); - thread.start(); - } - }); - - // Assign stop action to stop button - Button buttonStop = (Button) findViewById(R.id.ButtonStop); - buttonStop.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - tutorial.stopMainLoop(); - } - }); - } - - - private class TutorialLaunchingThread extends Thread { - @Override - public void run() { - super.run(); - try { - tutorial.launchTutorial(sipAddressWidget.getText().toString()); - mHandler.post(new Runnable() { - public void run() { - buttonCall.setEnabled(true); - } - }); - } catch (LinphoneCoreException e) { - e.printStackTrace(); - } - } - } -} diff --git a/tutorials/TutorialHelloWorldActivity.java b/tutorials/TutorialHelloWorldActivity.java deleted file mode 100644 index 60bd872c7..000000000 --- a/tutorials/TutorialHelloWorldActivity.java +++ /dev/null @@ -1,98 +0,0 @@ -/* -TutorialHelloWorldActivity.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.tutorials; - -import org.linphone.R; -import org.linphone.core.LinphoneCoreException; - -import android.app.Activity; -import android.os.Bundle; -import android.os.Handler; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; - -/** - * Activity for displaying and starting the HelloWorld example on Android phone. - * - * @author Guillaume Beraudo - * - */ -public class TutorialHelloWorldActivity extends Activity { - - private static final String defaultSipAddress = "sip:"; - private TextView sipAddressWidget; - private TutorialHelloWorld tutorial; - private Handler mHandler = new Handler() ; - private Button buttonCall; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.hello_world); - sipAddressWidget = (TextView) findViewById(R.id.AddressId); - sipAddressWidget.setText(defaultSipAddress); - - // Output text to the outputText widget - final TextView outputText = (TextView) findViewById(R.id.OutputText); - final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); - - - // Create HelloWorld object - tutorial = new TutorialHelloWorld(notifier); - - - - // Assign call action to call button - buttonCall = (Button) findViewById(R.id.CallButton); - buttonCall.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - TutorialLaunchingThread thread = new TutorialLaunchingThread(); - buttonCall.setEnabled(false); - thread.start(); - } - }); - - // Assign stop action to stop button - Button buttonStop = (Button) findViewById(R.id.ButtonStop); - buttonStop.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - tutorial.stopMainLoop(); - } - }); - } - - - private class TutorialLaunchingThread extends Thread { - @Override - public void run() { - super.run(); - try { - tutorial.launchTutorial(sipAddressWidget.getText().toString()); - mHandler.post(new Runnable() { - public void run() { - buttonCall.setEnabled(true); - } - }); - } catch (LinphoneCoreException e) { - e.printStackTrace(); - } - } - } -} diff --git a/tutorials/TutorialRegistrationActivity.java b/tutorials/TutorialRegistrationActivity.java deleted file mode 100644 index 94670480c..000000000 --- a/tutorials/TutorialRegistrationActivity.java +++ /dev/null @@ -1,103 +0,0 @@ -/* -TutorialRegistrationActivity.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.tutorials; - -import org.linphone.R; -import org.linphone.core.LinphoneCoreException; - -import android.os.Bundle; -import android.os.Handler; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; - -/** - * Activity for displaying and starting the registration example on Android phone. - * - * @author Guillaume Beraudo - * - */ -public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { - - private static final String defaultSipAddress = "sip:"; - private static final String defaultSipPassword = ""; - private TextView sipAddressWidget; - private TextView sipPasswordWidget; - private TutorialRegistration tutorial; - private Button buttonCall; - private Handler mHandler = new Handler(); - private TextView outputText; - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.hello_world); - sipAddressWidget = (TextView) findViewById(R.id.AddressId); - sipAddressWidget.setText(defaultSipAddress); - sipPasswordWidget = (TextView) findViewById(R.id.Password); - sipPasswordWidget.setVisibility(TextView.VISIBLE); - sipPasswordWidget.setText(defaultSipPassword); - - // Output text to the outputText widget - outputText = (TextView) findViewById(R.id.OutputText); - final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); - - - // Create Tutorial object - tutorial = new TutorialRegistration(notifier); - - - - // Assign call action to call button - buttonCall = (Button) findViewById(R.id.CallButton); - buttonCall.setText("Register"); - buttonCall.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - TutorialLaunchingThread thread = new TutorialLaunchingThread(); - buttonCall.setEnabled(false); - thread.start(); - } - }); - - - Button buttonStop = (Button) findViewById(R.id.ButtonStop); - buttonStop.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - tutorial.stopMainLoop(); - } - }); - } - - - private class TutorialLaunchingThread extends Thread { - @Override - public void run() { - super.run(); - try { - tutorial.launchTutorial( - sipAddressWidget.getText().toString(), - sipPasswordWidget.getText().toString()); - } catch (LinphoneCoreException e) { - e.printStackTrace(); - outputText.setText(e.getMessage() +"\n"+outputText.getText()); - } - } - } -} From 9e3835ff16a7f5fdaf02e7e767bb9de01850e487 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 21 Jun 2012 10:39:50 +0200 Subject: [PATCH 307/769] fix makefile (include linphone_tunnel.cc always) --- build/android/common.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/android/common.mk b/build/android/common.mk index 38b6c22cd..c85318ee4 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -43,7 +43,8 @@ LOCAL_SRC_FILES := \ callbacks.c \ linphonecall.c \ conference.c \ - ec-calibrator.c + ec-calibrator.c \ + linphone_tunnel.cc ifndef MY_LOG_DOMAIN MY_LOG_DOMAIN = \"Linphone\" @@ -91,7 +92,7 @@ LOCAL_STATIC_LIBRARIES := \ ifeq ($(BUILD_TUNNEL),1) LOCAL_CFLAGS +=-DTUNNEL_ENABLED LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../tunnel/include $(LOCAL_PATH)/../../tunnel/src -LOCAL_SRC_FILES += linphone_tunnel.cc TunnelManager.cc +LOCAL_SRC_FILES += TunnelManager.cc ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) LOCAL_SHARED_LIBRARIES += libtunnelclient else From f5555cc7ff8f7673899c129a2502436c1dbff6f6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 21 Jun 2012 12:13:10 +0200 Subject: [PATCH 308/769] enhance documentation --- coreapi/linphonecall.c | 27 +++++++++------ coreapi/linphonecore.c | 21 ++++++++++-- coreapi/linphonecore.h | 76 ++++++++++++++++++++++++++++++++++-------- 3 files changed, 98 insertions(+), 26 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ac8460291..ec006dd58 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -68,14 +68,6 @@ LinphoneCore *linphone_call_get_core(const LinphoneCall *call){ return call->core; } -const LinphoneCallStats *linphone_call_get_audio_stats(const LinphoneCall *call) { - return &call->stats[LINPHONE_CALL_STATS_AUDIO]; -} - -const LinphoneCallStats *linphone_call_get_video_stats(const LinphoneCall *call) { - return &call->stats[LINPHONE_CALL_STATS_VIDEO]; -} - const char* linphone_call_get_authentication_token(LinphoneCall *call){ return call->auth_token; } @@ -1518,7 +1510,7 @@ bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call){ **/ /** - * Returns the measured sound volume played locally (received from remote) + * Returns the measured sound volume played locally (received from remote). * It is expressed in dbm0. **/ float linphone_call_get_play_volume(LinphoneCall *call){ @@ -1533,7 +1525,7 @@ float linphone_call_get_play_volume(LinphoneCall *call){ } /** - * Returns the measured sound volume recorded locally (sent to remote) + * Returns the measured sound volume recorded locally (sent to remote). * It is expressed in dbm0. **/ float linphone_call_get_record_volume(LinphoneCall *call){ @@ -1583,6 +1575,21 @@ float linphone_call_get_average_quality(LinphoneCall *call){ return -1; } +/** + * Access last known statistics for audio stream, for a given call. +**/ +const LinphoneCallStats *linphone_call_get_audio_stats(const LinphoneCall *call) { + return &call->stats[LINPHONE_CALL_STATS_AUDIO]; +} + +/** + * Access last known statistics for video stream, for a given call. +**/ +const LinphoneCallStats *linphone_call_get_video_stats(const LinphoneCall *call) { + return &call->stats[LINPHONE_CALL_STATS_VIDEO]; +} + + /** * @} **/ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 41b9e2dda..d48c2fa28 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3473,7 +3473,6 @@ LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc) * @ingroup call_logs **/ const MSList * linphone_core_get_call_logs(LinphoneCore *lc){ - lc->missed_calls=0; return lc->call_logs; } @@ -3489,17 +3488,31 @@ void linphone_core_clear_call_logs(LinphoneCore *lc){ call_logs_write_to_config_file(lc); } +/** + * Returns number of missed calls. + * Once checked, this counter can be reset with linphone_core_reset_missed_calls_count(). +**/ int linphone_core_get_missed_calls_count(LinphoneCore *lc) { return lc->missed_calls; } +/** + * Resets the counter of missed calls. +**/ void linphone_core_reset_missed_calls_count(LinphoneCore *lc) { lc->missed_calls=0; } -void linphone_core_remove_call_log(LinphoneCore *lc, void *data) { - lc->call_logs = ms_list_remove(lc->call_logs, data); +/** + * Remove a specific call log from call history list. + * This function destroys the call log object. It must not be accessed anymore by the application after calling this function. + * @param lc the linphone core object + * @param a LinphoneCallLog object. +**/ +void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCallLog *cl){ + lc->call_logs = ms_list_remove(lc->call_logs, cl); call_logs_write_to_config_file(lc); + linphone_call_log_destroy(cl); } static void toggle_video_preview(LinphoneCore *lc, bool_t val){ @@ -3572,6 +3585,7 @@ bool_t linphone_core_video_enabled(LinphoneCore *lc){ * This policy defines whether: * - video shall be initiated by default for outgoing calls * - video shall be accepter by default for incoming calls + * @ingroup media_parameters **/ void linphone_core_set_video_policy(LinphoneCore *lc, const LinphoneVideoPolicy *policy){ lc->video_policy=*policy; @@ -3584,6 +3598,7 @@ void linphone_core_set_video_policy(LinphoneCore *lc, const LinphoneVideoPolicy /** * Get the default policy for video. * See linphone_core_set_video_policy() for more details. + * @ingroup media_parameters **/ const LinphoneVideoPolicy *linphone_core_get_video_policy(LinphoneCore *lc){ return &lc->video_policy; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index c9c6fc1a1..79d6204a0 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -157,12 +157,19 @@ typedef struct _LinphoneCallLog{ struct _LinphoneCore *lc; } LinphoneCallLog; + +/** + * Enum describing type of media encryption types. +**/ enum LinphoneMediaEncryption { LinphoneMediaEncryptionNone, LinphoneMediaEncryptionSRTP, LinphoneMediaEncryptionZRTP }; +/** + * Enum describing type of media encryption types. +**/ typedef enum LinphoneMediaEncryption LinphoneMediaEncryption; /*public: */ @@ -174,13 +181,13 @@ const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl); const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl); char * linphone_call_log_to_str(LinphoneCallLog *cl); +struct _LinphoneCallParams; /** * The LinphoneCallParams is an object containing various call related parameters. * It can be used to retrieve parameters from a currently running call or modify the call's characteristics * dynamically. **/ -struct _LinphoneCallParams; typedef struct _LinphoneCallParams LinphoneCallParams; const PayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp); @@ -209,12 +216,17 @@ enum _LinphoneReason{ LinphoneReasonNotAnswered }; +/** + * Enum describing failure reasons. + * @ingroup initializing +**/ typedef enum _LinphoneReason LinphoneReason; const char *linphone_reason_to_string(LinphoneReason err); /** * Structure describing policy regarding video streams establishments. + * @ingroup media_parameters **/ struct _LinphoneVideoPolicy{ bool_t automatically_initiate; /** Date: Thu, 21 Jun 2012 16:44:23 +0200 Subject: [PATCH 309/769] Some issues fixed + chat notification + account assistant started --- LinphoneCoreImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 75e885253..f732782d9 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -710,10 +710,18 @@ class LinphoneCoreImpl implements LinphoneCore { } public void removeCallLog(LinphoneCallLog log) { - removeCallLog(nativePtr, log.getNativePtr()); + removeCallLog(nativePtr, ((LinphoneCallLogImpl) log).getNativePtr()); } public void resetMissedCallsCount() { resetMissedCallsCount(nativePtr); } + + private native void tunnelSetHttpProxy(long nativePtr, String proxy_host, int port, + String username, String password); + @Override + public void tunnelSetHttpProxy(String proxy_host, int port, + String username, String password) { + tunnelSetHttpProxy(nativePtr, proxy_host, port, username, password); + } } From 1434b9748e100cdb27a4112c408ae1aaffa73120 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 26 Jun 2012 10:43:54 +0200 Subject: [PATCH 310/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 415269b15..715331b75 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 415269b15fb64aec82328332602591abac2d782d +Subproject commit 715331b7581aea11aac476cfc549d53640fdc703 From d93727e87c3d872951a74de1681b7475bcfb2614 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 26 Jun 2012 11:03:17 +0200 Subject: [PATCH 311/769] Fix compilation issue --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 5d0b61b70..79c7facf0 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -657,7 +657,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_resetMissedCallsCount(JN extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeCallLog(JNIEnv* env ,jobject thiz ,jlong lc, jlong log) { - linphone_core_remove_call_log((LinphoneCore*)lc, (void*) log); + linphone_core_remove_call_log((LinphoneCore*)lc, (LinphoneCallLog*) log); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv* env From f5169e0066c86530d23fedc11f8dd94ef20d9c7f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 26 Jun 2012 13:11:07 +0200 Subject: [PATCH 312/769] ignore tunnel transmissions errors (usually when not ready) for SIP --- coreapi/TunnelManager.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index 44d12251c..e3c7e6595 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -31,15 +31,16 @@ Mutex TunnelManager::sMutex; int TunnelManager::eXosipSendto(int fd,const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen,void* userdata){ TunnelManager* lTunnelMgr=(TunnelManager*)userdata; - int err; + sMutex.lock(); if (lTunnelMgr->mSipSocket==NULL){ sMutex.unlock(); - return len;//let ignore the error + return len; } - err=lTunnelMgr->mSipSocket->sendto(buf,len,to,tolen); + lTunnelMgr->mSipSocket->sendto(buf,len,to,tolen); sMutex.unlock(); - return err; + //ignore the error in all cases, retransmissions might be successful. + return len; } int TunnelManager::eXosipRecvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen,void* userdata){ From ace189f5f2e6364eb1e85a2244d00131f9119cb5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 26 Jun 2012 23:12:38 +0200 Subject: [PATCH 313/769] change the way call log dates are stored in linphonerc --- coreapi/linphonecore.c | 51 +++++++++++++++++++++++++++++------------- coreapi/linphonecore.h | 1 + coreapi/lpconfig.c | 19 ++++++++++++++++ coreapi/lpconfig.h | 17 ++++++++++++++ 4 files changed, 73 insertions(+), 15 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d48c2fa28..174f6c9c6 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define _GNU_SOURCE + #include "linphonecore.h" #include "sipsetup.h" #include "lpconfig.h" @@ -85,23 +87,24 @@ static size_t my_strftime(char *s, size_t max, const char *fmt, const struct t #endif /*_WIN32_WCE*/ } -static void set_call_log_date(LinphoneCallLog *cl, const struct tm *loctime){ - my_strftime(cl->start_date,sizeof(cl->start_date),"%c",loctime); +static void set_call_log_date(LinphoneCallLog *cl, time_t start_time){ + struct tm loctime; +#ifdef WIN32 +#if !defined(_WIN32_WCE) + loctime=*localtime(&start_time); + /*FIXME*/ +#endif /*_WIN32_WCE*/ +#else + localtime_r(&start_time,&loctime); +#endif + my_strftime(cl->start_date,sizeof(cl->start_date),"%c",&loctime); } LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){ LinphoneCallLog *cl=ms_new0(LinphoneCallLog,1); - struct tm loctime; cl->dir=call->dir; -#ifdef WIN32 -#if !defined(_WIN32_WCE) - loctime=*localtime(&call->start_time); - /*FIXME*/ -#endif /*_WIN32_WCE*/ -#else - localtime_r(&call->start_time,&loctime); -#endif - set_call_log_date(cl,&loctime); + cl->start_date_time=call->start_time; + set_call_log_date(cl,cl->start_date_time); cl->from=from; cl->to=to; cl->status=LinphoneCallAborted; /*default status*/ @@ -120,6 +123,7 @@ void call_logs_write_to_config_file(LinphoneCore *lc){ for(i=0,elem=lc->call_logs;elem!=NULL;elem=elem->next,++i){ LinphoneCallLog *cl=(LinphoneCallLog*)elem->data; snprintf(logsection,sizeof(logsection),"call_log_%i",i); + lp_config_clean_section(cfg,logsection); lp_config_set_int(cfg,logsection,"dir",cl->dir); lp_config_set_int(cfg,logsection,"status",cl->status); tmp=linphone_address_as_string(cl->from); @@ -128,7 +132,7 @@ void call_logs_write_to_config_file(LinphoneCore *lc){ tmp=linphone_address_as_string(cl->to); lp_config_set_string(cfg,logsection,"to",tmp); ms_free(tmp); - lp_config_set_string(cfg,logsection,"start_date",cl->start_date); + lp_config_set_int64(cfg,logsection,"start_date_time",(int64_t)cl->start_date_time); lp_config_set_int(cfg,logsection,"duration",cl->duration); if (cl->refkey) lp_config_set_string(cfg,logsection,"refkey",cl->refkey); lp_config_set_float(cfg,logsection,"quality",cl->quality); @@ -140,10 +144,17 @@ void call_logs_write_to_config_file(LinphoneCore *lc){ } } +static time_t string_to_time(const char *date){ + struct tm tmtime={0}; + strptime(date,"%c",&tmtime); + return mktime(&tmtime); +} + static void call_logs_read_from_config_file(LinphoneCore *lc){ char logsection[32]; int i; const char *tmp; + uint64_t sec; LpConfig *cfg=lc->config; for(i=0;;++i){ snprintf(logsection,sizeof(logsection),"call_log_%i",i); @@ -155,8 +166,18 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){ if (tmp) cl->from=linphone_address_new(tmp); tmp=lp_config_get_string(cfg,logsection,"to",NULL); if (tmp) cl->to=linphone_address_new(tmp); - tmp=lp_config_get_string(cfg,logsection,"start_date",NULL); - if (tmp) strncpy(cl->start_date,tmp,sizeof(cl->start_date)); + sec=lp_config_get_int64(cfg,logsection,"start_date_time",0); + if (sec) { + /*new call log format with date expressed in seconds */ + cl->start_date_time=(time_t)sec; + set_call_log_date(cl,cl->start_date_time); + }else{ + tmp=lp_config_get_string(cfg,logsection,"start_date",NULL); + if (tmp) { + strncpy(cl->start_date,tmp,sizeof(cl->start_date)); + cl->start_date_time=string_to_time(cl->start_date); + } + } cl->duration=lp_config_get_int(cfg,logsection,"duration",0); tmp=lp_config_get_string(cfg,logsection,"refkey",NULL); if (tmp) cl->refkey=ms_strdup(tmp); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 79d6204a0..81044fff5 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -155,6 +155,7 @@ typedef struct _LinphoneCallLog{ float quality; int video_enabled; struct _LinphoneCore *lc; + time_t start_date_time; /**Start date of the call in seconds as expressed in a time_t */ } LinphoneCallLog; diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index d12166ec4..4cd7202cc 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -277,6 +277,18 @@ int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, i else return default_value; } +int64_t lp_config_get_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t default_value){ + const char *str=lp_config_get_string(lpconfig,section,key,NULL); + if (str!=NULL) { +#ifdef WIN32 + return (int64_t)_atoi64(str); +#else + return atoll(str); +#endif + } + else return default_value; +} + float lp_config_get_float(LpConfig *lpconfig,const char *section, const char *key, float default_value){ const char *str=lp_config_get_string(lpconfig,section,key,NULL); float ret=default_value; @@ -312,6 +324,13 @@ void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key, lp_config_set_string(lpconfig,section,key,tmp); } +void lp_config_set_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t value){ + char tmp[30]; + snprintf(tmp,sizeof(tmp),"%lli",(long long)value); + lp_config_set_string(lpconfig,section,key,tmp); +} + + void lp_config_set_float(LpConfig *lpconfig,const char *section, const char *key, float value){ char tmp[30]; snprintf(tmp,sizeof(tmp),"%f",value); diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index ed7a66b1e..c1821d2aa 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -66,6 +66,16 @@ int lp_config_read_file(LpConfig *lpconfig, const char *filename); * The default integer value is returned if the config item isn't found. **/ int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, int default_value); + +/** + * Retrieves a configuration item as a 64 bit integer, given its section, key, and default value. + * + * @ingroup misc + * The default integer value is returned if the config item isn't found. +**/ +int64_t lp_config_get_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t default_value); + + int lp_config_read_file(LpConfig *lpconfig, const char *filename); /** * Retrieves a configuration item as a float, given its section, key, and default value. @@ -86,6 +96,13 @@ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *ke * @ingroup misc **/ void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key, int value); +/** + * Sets a 64 bits integer config item + * + * @ingroup misc +**/ +void lp_config_set_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t value); + /** * Sets a float config item * From fb9d2bebd321c5fde40a0d4604bbaea1a6403978 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 27 Jun 2012 10:16:00 +0200 Subject: [PATCH 314/769] takeSnapshot and zoomVideo methods exported throught JNI --- coreapi/linphonecore_jni.cc | 13 +++++++++++++ java/common/org/linphone/core/LinphoneCall.java | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 79c7facf0..3d59daffd 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1199,6 +1199,19 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog( JNIEnv* en return (jlong)linphone_call_get_call_log((LinphoneCall*)ptr); } +extern "C" void Java_org_linphone_core_LinphoneCallImpl_takeSnapshot( JNIEnv* env + ,jobject thiz + ,jlong ptr, jstring path) { + const char* filePath = path != NULL ? env->GetStringUTFChars(path, NULL) : NULL; + linphone_call_take_video_snapshot((LinphoneCall*)ptr, filePath); +} + +extern "C" void Java_org_linphone_core_LinphoneCallImpl_zoomVideo( JNIEnv* env + ,jobject thiz + ,jlong ptr, jfloat zoomFactor, jfloat cx, jfloat cy) { + linphone_call_zoom_video((LinphoneCall*)ptr, zoomFactor, cx, cy); +} + extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isIncoming( JNIEnv* env ,jobject thiz ,jlong ptr) { diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index 4d8e23d80..c42ebb740 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -244,4 +244,14 @@ public interface LinphoneCall { boolean isInConference(); float getPlayVolume(); + + /** + * Take a photo of currently received video and write it into a jpeg file. + */ + void takeSnapshot(String path); + + /** + * Scale the video by factor, and center it using cx,cy point + */ + void zoomVideo(float factor, float cx, float cy); } From f2d72a7e63909af11f5e87b0f268252e0efc83d3 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 27 Jun 2012 10:19:59 +0200 Subject: [PATCH 315/769] linphone updated + takeSnapshot and zoomVideo implementation added --- LinphoneCallImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 008b19df4..27ed253ef 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -155,4 +155,14 @@ class LinphoneCallImpl implements LinphoneCall { public float getPlayVolume() { return getPlayVolume(nativePtr); } + + private native void takeSnapshot(long nativePtr, String path); + public void takeSnapshot(String path) { + takeSnapshot(nativePtr, path); + } + + private native void zoomVideo(long nativePtr, float factor, float cx, float cy); + public void zoomVideo(float factor, float cx, float cy) { + zoomVideo(nativePtr, factor, cx, cy); + } } From e2510af6ae112852306d58f43967b172faa5c3d4 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 27 Jun 2012 10:58:35 +0200 Subject: [PATCH 316/769] Fix zoom JNI export --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 3d59daffd..1c320ce7b 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1209,7 +1209,7 @@ extern "C" void Java_org_linphone_core_LinphoneCallImpl_takeSnapshot( JNIEnv* e extern "C" void Java_org_linphone_core_LinphoneCallImpl_zoomVideo( JNIEnv* env ,jobject thiz ,jlong ptr, jfloat zoomFactor, jfloat cx, jfloat cy) { - linphone_call_zoom_video((LinphoneCall*)ptr, zoomFactor, cx, cy); + linphone_call_zoom_video((LinphoneCall*)ptr, zoomFactor, &cx, &cy); } extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isIncoming( JNIEnv* env From 31e9e71fc28edb5292020773330298b3eccab4ae Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 27 Jun 2012 12:26:54 +0200 Subject: [PATCH 317/769] fix missing strptime for windows, make call logs full backward compatible --- coreapi/linphonecore.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 174f6c9c6..97296ea6e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -132,11 +132,13 @@ void call_logs_write_to_config_file(LinphoneCore *lc){ tmp=linphone_address_as_string(cl->to); lp_config_set_string(cfg,logsection,"to",tmp); ms_free(tmp); - lp_config_set_int64(cfg,logsection,"start_date_time",(int64_t)cl->start_date_time); + if (cl->start_date_time) + lp_config_set_int64(cfg,logsection,"start_date_time",(int64_t)cl->start_date_time); + else lp_config_set_string(cfg,logsection,"start_date",cl->start_date); lp_config_set_int(cfg,logsection,"duration",cl->duration); if (cl->refkey) lp_config_set_string(cfg,logsection,"refkey",cl->refkey); lp_config_set_float(cfg,logsection,"quality",cl->quality); - lp_config_set_int(cfg,logsection,"video_enabled", cl->video_enabled); + lp_config_set_int(cfg,logsection,"video_enabled", cl->video_enabled); } for(;imax_call_logs;++i){ snprintf(logsection,sizeof(logsection),"call_log_%i",i); @@ -145,9 +147,13 @@ void call_logs_write_to_config_file(LinphoneCore *lc){ } static time_t string_to_time(const char *date){ +#ifndef WIN32 struct tm tmtime={0}; strptime(date,"%c",&tmtime); return mktime(&tmtime); +#else + return 0; +#endif } static void call_logs_read_from_config_file(LinphoneCore *lc){ @@ -182,7 +188,7 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){ tmp=lp_config_get_string(cfg,logsection,"refkey",NULL); if (tmp) cl->refkey=ms_strdup(tmp); cl->quality=lp_config_get_float(cfg,logsection,"quality",-1); - cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0); + cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0); lc->call_logs=ms_list_append(lc->call_logs,cl); }else break; } From fc2940d526e93ea733fcebf4baa28631aa215564 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 27 Jun 2012 14:45:26 +0200 Subject: [PATCH 318/769] ms2 updated --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 715331b75..84b9ef050 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 715331b7581aea11aac476cfc549d53640fdc703 +Subproject commit 84b9ef050c6abd26446901c2532573f2589a435b From 8b74551ac814e7382c2ae9d15b8388e2b62b18bf Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 27 Jun 2012 16:09:03 +0200 Subject: [PATCH 319/769] improve display of call logs for i18n dates. --- gtk/calllogs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gtk/calllogs.c b/gtk/calllogs.c index bd5969ec8..63c00b9a5 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -58,6 +58,14 @@ void linphone_gtk_call_log_update(GtkWidget *w){ gchar *logtxt, *minutes, *seconds; gchar quality[20]; const char *status=NULL; + gchar *start_date=NULL; + + if (cl->start_date_time){ + GDateTime *dt=g_date_time_new_from_unix_local(cl->start_date_time); + start_date=g_date_time_format(dt,"%c"); + g_date_time_unref(dt); + } + display=linphone_address_get_display_name (la); if (display==NULL){ @@ -91,14 +99,15 @@ void linphone_gtk_call_log_update(GtkWidget *w){ _("%s\t%s\t" "Quality: %s\n%s\t%s %s\t"), display, addr, cl->quality!=-1 ? quality : _("n/a"), - cl->start_date, minutes, seconds); + start_date ? start_date : cl->start_date, minutes, seconds); else logtxt=g_markup_printf_escaped( _("%s\t%s\t" "\n%s\t%s"), display, addr, - cl->start_date, status); + start_date ? start_date : cl->start_date, status); g_free(minutes); g_free(seconds); + if (start_date) g_free(start_date); gtk_list_store_append (store,&iter); gtk_list_store_set (store,&iter, 0, cl->dir==LinphoneCallOutgoing ? GTK_STOCK_GO_UP : GTK_STOCK_GO_DOWN, From 20c23f8b8e267f5c82d7cd8595300f6875614676 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 28 Jun 2012 09:59:53 +0200 Subject: [PATCH 320/769] fix for old glib version --- gtk/calllogs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/calllogs.c b/gtk/calllogs.c index 63c00b9a5..9494dbfa2 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -60,12 +60,13 @@ void linphone_gtk_call_log_update(GtkWidget *w){ const char *status=NULL; gchar *start_date=NULL; +#if GLIB_CHECK_VERSION(2,26,0) if (cl->start_date_time){ GDateTime *dt=g_date_time_new_from_unix_local(cl->start_date_time); start_date=g_date_time_format(dt,"%c"); g_date_time_unref(dt); } - +#endif display=linphone_address_get_display_name (la); if (display==NULL){ From cf9332d400cf4ac1b50e679bdd27ab851b5ceea7 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 28 Jun 2012 13:17:55 +0200 Subject: [PATCH 321/769] add notifyReceived + refreshRegisters to java api --- java/common/org/linphone/core/LinphoneCore.java | 8 ++++++++ java/common/org/linphone/core/LinphoneCoreListener.java | 9 +++++++++ mediastreamer2 | 2 +- oRTP | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index f4bcc7ef8..6f0ce2c65 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -180,6 +180,9 @@ public interface LinphoneCore { this.tcp = t.tcp; this.tls = t.tls; } + public String toString() { + return "udp["+udp+"] tcp["+tcp+"] tls["+tls+"]"; + } } /** * Media (RTP) encryption enum-like. @@ -776,4 +779,9 @@ public interface LinphoneCore { * Set missed calls count to zero */ public void resetMissedCallsCount(); + /** + * re-initiates registration if network is up. + */ + public void refreshRegisters(); + } diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index cfe43895e..400e942c3 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -103,5 +103,14 @@ public interface LinphoneCoreListener { * @param data */ void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data); + /** + * Report Notified message received for this identity. + * @param lc LinphoneCore + * @param call LinphoneCall in case the notify is part of a dialog, may be null + * @param from LinphoneAddress the message comes from + * @param event String the raw body of the notify event. + * + */ + void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event); } diff --git a/mediastreamer2 b/mediastreamer2 index 84b9ef050..75eb1fcf8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 84b9ef050c6abd26446901c2532573f2589a435b +Subproject commit 75eb1fcf8d6097e51bcb507be339dd397c6b4dd5 diff --git a/oRTP b/oRTP index 2590e21d8..41d13b7e4 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 2590e21d864b43d6ac3a2ece0cf3b4d0e208e866 +Subproject commit 41d13b7e491c7fc418987b63ff6ef80c7e8895a4 From 9f5ad3739e58f8296a8e6ad6667ba865304d5d33 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 28 Jun 2012 13:26:35 +0200 Subject: [PATCH 322/769] Revert "add notifyReceived + refreshRegisters to java api" This reverts commit cf9332d400cf4ac1b50e679bdd27ab851b5ceea7. --- java/common/org/linphone/core/LinphoneCore.java | 8 -------- java/common/org/linphone/core/LinphoneCoreListener.java | 9 --------- mediastreamer2 | 2 +- oRTP | 2 +- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 6f0ce2c65..f4bcc7ef8 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -180,9 +180,6 @@ public interface LinphoneCore { this.tcp = t.tcp; this.tls = t.tls; } - public String toString() { - return "udp["+udp+"] tcp["+tcp+"] tls["+tls+"]"; - } } /** * Media (RTP) encryption enum-like. @@ -779,9 +776,4 @@ public interface LinphoneCore { * Set missed calls count to zero */ public void resetMissedCallsCount(); - /** - * re-initiates registration if network is up. - */ - public void refreshRegisters(); - } diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index 400e942c3..cfe43895e 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -103,14 +103,5 @@ public interface LinphoneCoreListener { * @param data */ void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data); - /** - * Report Notified message received for this identity. - * @param lc LinphoneCore - * @param call LinphoneCall in case the notify is part of a dialog, may be null - * @param from LinphoneAddress the message comes from - * @param event String the raw body of the notify event. - * - */ - void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event); } diff --git a/mediastreamer2 b/mediastreamer2 index 75eb1fcf8..84b9ef050 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 75eb1fcf8d6097e51bcb507be339dd397c6b4dd5 +Subproject commit 84b9ef050c6abd26446901c2532573f2589a435b diff --git a/oRTP b/oRTP index 41d13b7e4..2590e21d8 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 41d13b7e491c7fc418987b63ff6ef80c7e8895a4 +Subproject commit 2590e21d864b43d6ac3a2ece0cf3b4d0e208e866 From 7d105b10d934e194796bdaaabdfd9f185261d309 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 28 Jun 2012 13:31:51 +0200 Subject: [PATCH 323/769] add notifyReceived + refreshRegisters to java api 2 --- java/common/org/linphone/core/LinphoneCore.java | 8 ++++++++ java/common/org/linphone/core/LinphoneCoreListener.java | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index f4bcc7ef8..6f0ce2c65 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -180,6 +180,9 @@ public interface LinphoneCore { this.tcp = t.tcp; this.tls = t.tls; } + public String toString() { + return "udp["+udp+"] tcp["+tcp+"] tls["+tls+"]"; + } } /** * Media (RTP) encryption enum-like. @@ -776,4 +779,9 @@ public interface LinphoneCore { * Set missed calls count to zero */ public void resetMissedCallsCount(); + /** + * re-initiates registration if network is up. + */ + public void refreshRegisters(); + } diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index cfe43895e..400e942c3 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -103,5 +103,14 @@ public interface LinphoneCoreListener { * @param data */ void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data); + /** + * Report Notified message received for this identity. + * @param lc LinphoneCore + * @param call LinphoneCall in case the notify is part of a dialog, may be null + * @param from LinphoneAddress the message comes from + * @param event String the raw body of the notify event. + * + */ + void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event); } From f37b38d9e558cc91290c80b37556d7f4fb06b809 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 28 Jun 2012 13:36:54 +0200 Subject: [PATCH 324/769] Linphone submodule updated --- LinphoneCoreImpl.java | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index d02f69cfb..4a962e52e 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,7 +20,6 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.util.Vector; class LinphoneCoreImpl implements LinphoneCore { @@ -710,19 +709,24 @@ class LinphoneCoreImpl implements LinphoneCore { String username, String password) { tunnelSetHttpProxyNative(nativePtr,proxy_host, port, username, password); } - @Override + + private native void removeCallLog(long nativePtr, LinphoneCallLog log); public void removeCallLog(LinphoneCallLog log) { - // TODO Auto-generated method stub - + removeCallLog(nativePtr, log); } - @Override + + private native int getMissedCallsCount(long nativePtr); public int getMissedCallsCount() { - // TODO Auto-generated method stub - return 0; + return getMissedCallsCount(nativePtr); } - @Override + + private native void resetMissedCallsCount(long nativePtr); public void resetMissedCallsCount() { - // TODO Auto-generated method stub - + resetMissedCallsCount(nativePtr); + } + + private native void refreshRegisters(long nativePtr); + public void refreshRegisters() { + refreshRegisters(nativePtr); } } From 693ee8d265ab255785d7756d4fd855ec8f573451 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 28 Jun 2012 14:38:16 +0200 Subject: [PATCH 325/769] Fix java tutorials --- .../java/org/linphone/core/tutorials/TutorialBuddyStatus.java | 1 + .../help/java/org/linphone/core/tutorials/TutorialChatRoom.java | 1 + .../java/org/linphone/core/tutorials/TutorialHelloWorld.java | 2 +- .../java/org/linphone/core/tutorials/TutorialRegistration.java | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java index e7db170b8..58a75e56b 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java @@ -98,6 +98,7 @@ public class TutorialBuddyStatus implements LinphoneCoreListener { public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} + public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} public static void main(String[] args) { diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java index 5837876cb..c81823e8a 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java @@ -76,6 +76,7 @@ public class TutorialChatRoom implements LinphoneCoreListener { public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg){} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} + public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) { write("Message ["+message+"] received from ["+from.asString()+"]"); diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java index 30510fd84..6daa65711 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java @@ -70,7 +70,7 @@ public class TutorialHelloWorld implements LinphoneCoreListener { public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} - + public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} /* * Call state notification listener */ diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java index 8af45162c..674044471 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java @@ -81,6 +81,7 @@ public class TutorialRegistration implements LinphoneCoreListener { public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} + public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} public static void main(String[] args) { // Check tutorial was called with the right number of arguments From 9f02a12f4641989a225ee77bf6f403cd1c57d9e6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 28 Jun 2012 14:54:54 +0200 Subject: [PATCH 326/769] Added missing JNI method refreshRegisters --- coreapi/linphonecore_jni.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 1c320ce7b..c6e774d23 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -492,6 +492,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* linphone_core_clear_all_auth_info((LinphoneCore*)lc); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_refreshRegisters(JNIEnv* env, jobject thiz,jlong lc) { + linphone_core_refresh_registers((LinphoneCore*)lc); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addAuthInfo( JNIEnv* env ,jobject thiz ,jlong lc From cff354ab3cf2fc2311862af6bf1bcff1967f3760 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 29 Jun 2012 10:46:46 +0200 Subject: [PATCH 327/769] Linphone submodule updated + mjpeg encoder build added --- LinphoneCallImpl.java | 10 ++++++++++ LinphoneCoreImpl.java | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 008b19df4..5d886d43e 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -155,4 +155,14 @@ class LinphoneCallImpl implements LinphoneCall { public float getPlayVolume() { return getPlayVolume(nativePtr); } + + private native void takeSnapshot(long nativePtr, String path); + public void takeSnapshot(String path) { + takeSnapshot(nativePtr, path); + } + + private native void zoomVideo(long nativePtr, float factor, float cx, float cy); + public void zoomVideo(float factor, float cx, float cy) { + zoomVideo(nativePtr, factor, cx, cy); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index f732782d9..88084d237 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -724,4 +724,9 @@ class LinphoneCoreImpl implements LinphoneCore { String username, String password) { tunnelSetHttpProxy(nativePtr, proxy_host, port, username, password); } + + private native void refreshRegisters(long nativePtr); + public void refreshRegisters() { + refreshRegisters(nativePtr); + } } From 3860e1c493cba9a8a546a866499469eb3b137ebc Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 29 Jun 2012 11:49:32 +0200 Subject: [PATCH 328/769] attempt workaround for GtkEntry bug under windows and chinese language. --- gtk/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gtk/main.c b/gtk/main.c index 2a6c307b6..fa04a24e0 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -77,6 +77,7 @@ static gboolean iconified=FALSE; static gchar *workingdir=NULL; static char *progpath=NULL; gchar *linphone_logfile=NULL; +static gboolean workaround_gtk_entry_chinese_bug=FALSE; static GOptionEntry linphone_options[]={ { @@ -347,6 +348,11 @@ GtkWidget *linphone_gtk_create_widget(const char *filename, const char *widget_n return w; } +static void entry_unmapped(GtkWidget *entry){ + g_message("Entry is unmapped, calling unrealize to workaround chinese bug."); + gtk_widget_unrealize(entry); +} + GtkWidget *linphone_gtk_get_widget(GtkWidget *window, const char *name){ GtkBuilder *builder=(GtkBuilder*)g_object_get_data(G_OBJECT(window),"builder"); GObject *w; @@ -358,6 +364,15 @@ GtkWidget *linphone_gtk_get_widget(GtkWidget *window, const char *name){ if (w==NULL){ g_error("No widget named %s found in xml interface.",name); } + if (workaround_gtk_entry_chinese_bug){ + if (strcmp(G_OBJECT_TYPE_NAME(w),"GtkEntry")==0){ + if (g_object_get_data(G_OBJECT(w),"entry_bug_workaround")==NULL){ + g_object_set_data(G_OBJECT(w),"entry_bug_workaround",GINT_TO_POINTER(1)); + g_message("%s is a GtkEntry",name); + g_signal_connect(G_OBJECT(w),"unmap",(GCallback)entry_unmapped,NULL); + } + } + } return GTK_WIDGET(w); } @@ -1765,6 +1780,9 @@ int main(int argc, char *argv[]){ char tmp[128]; snprintf(tmp,sizeof(tmp),"LANG=%s",lang); _putenv(tmp); + if (strncmp(lang,"zh",2)==0){ + workaround_gtk_entry_chinese_bug=TRUE; + } #else setenv("LANG",lang,1); #endif From 179727a5f65c4f9043b8534e59be8ecf508073ad Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Fri, 29 Jun 2012 18:30:02 +0200 Subject: [PATCH 329/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 84b9ef050..e7b1615cb 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 84b9ef050c6abd26446901c2532573f2589a435b +Subproject commit e7b1615cb545ad7a9cc00bdb31d703a1be64087f From 9496394c88dbdf6e6dd120b5657a2846b603d612 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 4 Jul 2012 11:40:17 +0200 Subject: [PATCH 330/769] update ms2: use VOICE_COMMUNICATION source for android recorder if sdk version > 10 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e7b1615cb..3ad17dab4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e7b1615cb545ad7a9cc00bdb31d703a1be64087f +Subproject commit 3ad17dab4138c1a4fa1536388caced23a5610e6a From 57d9f33e253493cdd1b58dcb0c825181bd23f42b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 10 Jul 2012 10:13:31 +0200 Subject: [PATCH 331/769] fix double g_thread initialization in wizard --- gtk/setupwizard.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gtk/setupwizard.c b/gtk/setupwizard.c index ae1bcfa6a..39673da99 100644 --- a/gtk/setupwizard.c +++ b/gtk/setupwizard.c @@ -538,11 +538,6 @@ GtkWidget * linphone_gtk_create_assistant(void){ ok = create_pixbuf(linphone_gtk_get_ui_config("ok","ok.png")); notok = create_pixbuf(linphone_gtk_get_ui_config("notok","notok.png")); -#if !GLIB_CHECK_VERSION(2, 31, 0) - g_thread_init (NULL); -#endif - gdk_threads_init (); - GtkWidget *p1=create_intro(); GtkWidget *p2=create_setup_signin_choice(); GtkWidget *p31=create_account_informations_page(); @@ -605,3 +600,4 @@ GtkWidget * linphone_gtk_create_assistant(void){ return w; } + From ae4b03f1dfd6ff4690e5b170536db2d9525b3c05 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 16 Jul 2012 11:17:43 +0200 Subject: [PATCH 332/769] Increase incoming timeout to 30s. --- coreapi/linphonecore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 97296ea6e..9c69fc88a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -570,7 +570,7 @@ static void sip_config_read(LinphoneCore *lc) linphone_core_set_guess_hostname(lc,tmp); - tmp=lp_config_get_int(lc->config,"sip","inc_timeout",15); + tmp=lp_config_get_int(lc->config,"sip","inc_timeout",30); linphone_core_set_inc_timeout(lc,tmp); /* get proxies config */ @@ -1855,6 +1855,7 @@ void linphone_core_iterate(LinphoneCore *lc){ elapsed=curtime-call->start_time; ms_message("incoming call ringing for %i seconds",elapsed); if (elapsed>lc->sip_conf.inc_timeout){ + ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout); call->log->status=LinphoneCallMissed; call->reason=LinphoneReasonNotAnswered; linphone_core_terminate_call(lc,call); From 333520bf850a6484390e3596da7fc73d8c3f67f5 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 16 Jul 2012 11:19:06 +0200 Subject: [PATCH 333/769] Fix _sdp_message_get_mline_dir on recvonly attribute. --- coreapi/sal_eXosip2_sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index f67fb9cfd..32f031864 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -116,7 +116,7 @@ static int _sdp_message_get_mline_dir(sdp_message_t *sdp, int mline){ }else if (keywordcmp("sendonly",attr->a_att_field)==0){ return SalStreamSendOnly; }else if (keywordcmp("recvonly",attr->a_att_field)==0){ - return SalStreamSendOnly; + return SalStreamRecvOnly; }else if (keywordcmp("inactive",attr->a_att_field)==0){ return SalStreamInactive; } From 5273d7c70f80927554e446e2ecf9f938641efa47 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 17 Jul 2012 18:58:34 +0200 Subject: [PATCH 334/769] better eclispe discovery --- .cproject | 362 ++++++++++++++++++++++------------------------------ .project | 2 +- Makefile.am | 5 +- 3 files changed, 159 insertions(+), 210 deletions(-) diff --git a/.cproject b/.cproject index 3ab1fad71..63cf57632 100644 --- a/.cproject +++ b/.cproject @@ -22,7 +22,7 @@ - + @@ -35,221 +35,167 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - make - all - true - true - true - - - make - CFLAGS="-g" - install - true - true - true - - - make - CFLAGS="-g" - install - true - true - true - - - make - all - true - true - true - - - make - all - true - true - true - - - + + + + + + + make + all + true + true + true + + + make + CFLAGS="-g" + install + true + true + true + + + make + CFLAGS="-g" + install + true + true + true + + + make + all + true + true + true + + + make + all + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project index 2fbbd2688..dcc5fd75c 100644 --- a/.project +++ b/.project @@ -23,7 +23,7 @@ org.eclipse.cdt.make.core.buildArguments - CFLAGS="-g -Werror -Wall" + CFLAGS="-g -Werror -Wall" CXXFLAGS="-g" org.eclipse.cdt.make.core.buildCommand diff --git a/Makefile.am b/Makefile.am index 5be271da4..6faebc4fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -229,4 +229,7 @@ clean-local: rm -rf $(BUNDLEDIR) discovery: touch specs.cpp - $(CC) $(CFLAGS) $(MEDIASTREAMER2_CFLAGS) $(ORTP_CFLAGS) -E -P -v -dD specs.cpp + $(CC) --include $(top_builddir)/config.h \ + --include $(top_builddir)/mediastreamer2/mediastreamer-config.h \ + --include $(top_builddir)/oRTP/ortp-config.h \ + $(TUNNEL_CFLAGS) $(CFLAGS) $(MEDIASTREAMER2_CFLAGS) $(ORTP_CFLAGS) -E -P -v -dD specs.cpp From c4bf7958ab6272155547c1f12e06189e1f84275c Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 19 Jul 2012 14:46:00 +0200 Subject: [PATCH 335/769] make sure only one transport is configured --- coreapi/linphonecore.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 9c69fc88a..40b2a647d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -532,10 +532,13 @@ static void sip_config_read(LinphoneCore *lc) if (tr.udp_port>0 && random_port){ tr.udp_port=random_port; + tr.tls_port=tr.tcp_port=0; /*make sure only one transport is active at a time*/ }else if (tr.tcp_port>0 && random_port){ tr.tcp_port=random_port; + tr.tls_port=tr.udp_port=0; /*make sure only one transport is active at a time*/ }else if (tr.tls_port>0 && random_port){ tr.tls_port=random_port; + tr.udp_port=tr.tcp_port=0; /*make sure only one transport is active at a time*/ } #ifdef __linux From fd852f01c6f63abb082dcb48f8ba4e88ebe04daa Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 17 Jul 2012 12:23:33 +0200 Subject: [PATCH 336/769] Add configuration parameter to enable ICE. --- console/commands.c | 13 +++ coreapi/linphonecore.h | 3 +- gtk/parameters.ui | 178 ++++++++++++++++++++++++----------------- gtk/propertybox.c | 8 ++ 4 files changed, 127 insertions(+), 75 deletions(-) diff --git a/console/commands.c b/console/commands.c index 776d2b260..472531795 100644 --- a/console/commands.c +++ b/console/commands.c @@ -850,6 +850,16 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args) { linphone_core_set_firewall_policy(lc,LinphonePolicyNoFirewall); } + else if (strcmp(args,"ice")==0) + { + setting = linphone_core_get_stun_server(lc); + if ( ! setting ) + { + linphonec_out("No stun server address is defined, use 'stun
' first\n"); + return 1; + } + linphone_core_set_firewall_policy(lc,LinphonePolicyUseIce); + } else if (strcmp(args,"stun")==0) { setting = linphone_core_get_stun_server(lc); @@ -883,6 +893,9 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args) case LinphonePolicyUseNatAddress: linphonec_out("Using supplied nat address %s.\n", setting ? setting : linphone_core_get_nat_address(lc)); break; + case LinphonePolicyUseIce: + linphonec_out("Using ice with stun server %s to discover firewall address\n", setting ? setting : linphone_core_get_stun_server(lc)); + break; } return 1; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 81044fff5..10f6108c9 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -740,7 +740,8 @@ typedef struct _LCCallbackObj typedef enum _LinphoneFirewallPolicy{ LinphonePolicyNoFirewall, LinphonePolicyUseNatAddress, - LinphonePolicyUseStun + LinphonePolicyUseStun, + LinphonePolicyUseIce } LinphoneFirewallPolicy; typedef enum _LinphoneWaitingState{ diff --git a/gtk/parameters.ui b/gtk/parameters.ui index b8f4adbdc..9fc8538c0 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -1,6 +1,7 @@ + 500 3001 @@ -206,10 +207,10 @@ Set Maximum Transmission Unit: + False True True False - False True @@ -225,6 +226,8 @@ True False False + True + True adjustment1 @@ -244,10 +247,10 @@ Send DTMFs as SIP info + False True True False - False True @@ -260,11 +263,11 @@ Use IPv6 instead of IPv4 + False True True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True @@ -335,6 +338,8 @@ True False False + True + True adjustment7
@@ -379,9 +384,9 @@ edit + False True True - False @@ -422,6 +427,10 @@ True True • + False + False + True + True adjustment_audio_port True @@ -438,6 +447,10 @@ True True • + False + False + True + True adjustment_video_port True @@ -483,10 +496,10 @@ Direct connection to the Internet + False True True False - False True True @@ -504,10 +517,10 @@ Behind NAT / Firewall (specify gateway IP below) + False True True False - False True True no_nat @@ -545,6 +558,8 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK False False + True + True @@ -568,20 +583,51 @@ - + + Behind NAT / Firewall (use STUN to resolve) + False + True + True + False + True + no_nat + + + + True + True + 2 + + + + + Behind NAT / Firewall (use ICE) + False + True + True + False + True + no_nat + + + + True + True + 3 + + + + True False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - Behind NAT / Firewall (use STUN to resolve) + True - True - False - False - True - True - no_nat - + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Stun server: + right True @@ -590,39 +636,17 @@ - + True - False + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Stun server: - right - - - True - True - 0 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - - - - True - True - 1 - - + ◠+ True + False + False + True + True + True @@ -632,9 +656,9 @@ - False - False - 2 + True + True + 4 @@ -719,6 +743,9 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 6 2 + + + True @@ -740,11 +767,11 @@ gtk-media-play + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True @@ -783,6 +810,8 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK False False + True + True @@ -915,10 +944,10 @@ Enable echo cancellation + False True True False - False True @@ -929,9 +958,6 @@ 6 - - - @@ -1134,6 +1160,8 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK False False + True + True @@ -1172,6 +1200,8 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK False False + True + True
@@ -1189,6 +1219,8 @@ False False False + True + True
1 @@ -1245,9 +1277,6 @@ True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - -
@@ -1264,10 +1293,10 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True True True - False @@ -1311,11 +1340,11 @@ + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1359,11 +1388,11 @@ + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1407,11 +1436,11 @@ + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1455,9 +1484,9 @@ + False True True - False @@ -1544,11 +1573,11 @@ virtual network ! GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1713,9 +1742,6 @@ virtual network ! True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True - - - @@ -1733,11 +1759,11 @@ virtual network ! gtk-go-up + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True @@ -1750,11 +1776,11 @@ virtual network ! gtk-go-down + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True @@ -1766,11 +1792,11 @@ virtual network ! + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1814,11 +1840,11 @@ virtual network ! + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1922,6 +1948,8 @@ virtual network ! 0 stands for "unlimited" False False + True + True adjustment5 @@ -1942,6 +1970,8 @@ virtual network ! 0 stands for "unlimited" False False + True + True adjustment6 @@ -1977,10 +2007,10 @@ virtual network ! Enable adaptive rate control + False True True False - False 0 True @@ -2132,10 +2162,10 @@ virtual network ! Show advanced settings + False True True False - False True @@ -2212,11 +2242,11 @@ virtual network ! end + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 809207a2a..6870e2786 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -171,6 +171,11 @@ void linphone_gtk_use_stun_toggled(GtkWidget *w){ linphone_core_set_firewall_policy(linphone_gtk_get_core(),LinphonePolicyUseStun); } +void linphone_gtk_use_ice_toggled(GtkWidget *w){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) + linphone_core_set_firewall_policy(linphone_gtk_get_core(),LinphonePolicyUseIce); +} + void linphone_gtk_mtu_changed(GtkWidget *w){ if (GTK_WIDGET_SENSITIVE(w)) linphone_core_set_mtu(linphone_gtk_get_core(),gtk_spin_button_get_value(GTK_SPIN_BUTTON(w))); @@ -956,6 +961,9 @@ void linphone_gtk_show_parameters(void){ case LinphonePolicyUseStun: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"use_stun")),TRUE); break; + case LinphonePolicyUseIce: + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"use_ice")),TRUE); + break; } mtu=linphone_core_get_mtu(lc); if (mtu<=0){ From 47b52bbcdbeb81bdfcbaedbed5e53e3f4f5f3723 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 17 Jul 2012 15:02:44 +0200 Subject: [PATCH 337/769] Allocate ICE session and check lists for each stream when ICE is enabled. --- coreapi/linphonecall.c | 33 +++++++++++++++++++++++++++++++-- coreapi/private.h | 2 ++ coreapi/sal.h | 2 ++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ec006dd58..f533711cf 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -245,6 +245,10 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].crypto[1].algo = 0; md->streams[i].crypto[2].algo = 0; } + if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce){ + md->streams[i].ice_check_list = ice_check_list_new(); + ice_session_add_check_list(call->ice_session, md->streams[i].ice_check_list); + } } linphone_address_destroy(addr); @@ -338,10 +342,19 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr linphone_core_get_local_ip(lc,linphone_address_get_domain(to),call->localip); linphone_call_init_common(call,from,to); call->params=*params; + if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) call->ice_session=ice_session_new(); call->localdesc=create_local_media_description (lc,call); call->camera_active=params->has_video; - if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun) - linphone_core_run_stun_tests(call->core,call); + switch (linphone_core_get_firewall_policy(call->core)) { + case LinphonePolicyUseStun: + linphone_core_run_stun_tests(call->core,call); + break; + case LinphonePolicyUseIce: + ms_error("Gather ICE candidates"); + break; + default: + break; + } discover_mtu(lc,linphone_address_get_domain (to)); if (params->referer){ sal_call_set_referer(call->op,params->referer->op); @@ -525,6 +538,10 @@ static void linphone_call_destroy(LinphoneCall *obj) sal_op_release(obj->op); obj->op=NULL; } + if (obj->ice_session!=NULL) { + ice_session_destroy(obj->ice_session); + obj->ice_session=NULL; + } if (obj->resultdesc!=NULL) { sal_media_description_unref(obj->resultdesc); obj->resultdesc=NULL; @@ -937,6 +954,11 @@ void linphone_call_init_media_streams(LinphoneCall *call){ RtpTransport *artcp=lc->rtptf->audio_rtcp_func(lc->rtptf->audio_rtcp_func_data, call->audio_port+1); rtp_session_set_transports(audiostream->session,artp,artcp); } + if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){ + rtp_session_set_pktinfo(audiostream->session,TRUE); + audiostream->ice_check_list = call->localdesc->streams[0].ice_check_list; + ice_check_list_register_success_cb(audiostream->ice_check_list, audio_stream_set_remote_from_ice, audiostream); + } call->audiostream_app_evq = ortp_ev_queue_new(); rtp_session_register_event_queue(audiostream->session,call->audiostream_app_evq); @@ -957,6 +979,11 @@ void linphone_call_init_media_streams(LinphoneCall *call){ RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); } + if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){ + rtp_session_set_pktinfo(call->videostream->session,TRUE); + call->videostream->ice_check_list = call->localdesc->streams[1].ice_check_list; + ice_check_list_register_success_cb(call->videostream->ice_check_list, video_stream_set_remote_from_ice, call->videostream); + } call->videostream_app_evq = ortp_ev_queue_new(); rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq); #ifdef TEST_EXT_RENDERER @@ -1436,6 +1463,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ if (call->endpoint){ linphone_call_remove_from_conf(call); } + if (call->audiostream->ice_check_list) ice_check_list_destroy(call->audiostream->ice_check_list); audio_stream_stop(call->audiostream); call->audiostream=NULL; } @@ -1446,6 +1474,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ rtp_session_unregister_event_queue(call->videostream->session,call->videostream_app_evq); ortp_ev_queue_flush(call->videostream_app_evq); ortp_ev_queue_destroy(call->videostream_app_evq); + if (call->videostream->ice_check_list) ice_check_list_destroy(call->videostream->ice_check_list); video_stream_stop(call->videostream); call->videostream=NULL; } diff --git a/coreapi/private.h b/coreapi/private.h index 1ab7a6a7d..dd8b2b3bd 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -35,6 +35,7 @@ extern "C" { #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "mediastreamer2/ice.h" #include "mediastreamer2/mediastream.h" #include "mediastreamer2/msconference.h" @@ -135,6 +136,7 @@ struct _LinphoneCall bool_t was_automatically_paused; CallCallbackObj nextVideoFrameDecoded; LinphoneCallStats stats[2]; + IceSession *ice_session; }; diff --git a/coreapi/sal.h b/coreapi/sal.h index d2d9cbe51..65eb5e0b4 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define sal_h #include "mediastreamer2/mscommon.h" +#include "mediastreamer2/ice.h" #include "ortp/ortp_srtp.h" /*Dirty hack, keep in sync with mediastreamer2/include/mediastream.h */ @@ -135,6 +136,7 @@ typedef struct SalStreamDescription{ SalSrtpCryptoAlgo crypto[SAL_CRYPTO_ALGO_MAX]; unsigned int crypto_local_tag; int max_rate; + IceCheckList *ice_check_list; } SalStreamDescription; #define SAL_MEDIA_DESCRIPTION_MAX_STREAMS 4 From c87250cb9a82eebed43c095ad2c965d27d89b368 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 17 Jul 2012 16:46:36 +0200 Subject: [PATCH 338/769] Gather ICE server reflexive candidates when starting an outgoing call. --- coreapi/linphonecall.c | 2 +- coreapi/misc.c | 101 +++++++++++++++++++++++++++++++++++++++++ coreapi/private.h | 1 + 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f533711cf..0be2c9608 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -350,7 +350,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr linphone_core_run_stun_tests(call->core,call); break; case LinphonePolicyUseIce: - ms_error("Gather ICE candidates"); + linphone_core_gather_ice_candidates(call->core,call); break; default: break; diff --git a/coreapi/misc.c b/coreapi/misc.c index a749bf279..632ddfe75 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -562,6 +562,107 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ } } +void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) +{ + char addr[64]; + int port; + int id; + ortp_socket_t audio_socks[2]; + ortp_socket_t video_socks[2]; + bool_t audio_responses[2]; + bool_t video_responses[2]; + struct sockaddr_storage ss; + socklen_t ss_len; + struct timeval init, cur; + double elapsed; + int loops = 0; + const LinphoneCallParams *params = linphone_call_get_current_params(call); + const char *server = linphone_core_get_stun_server(lc); + + if (server == NULL) return; + if (lc->sip_conf.ipv6_enabled){ + ms_warning("stun support is not implemented for ipv6"); + return; + } + + if (parse_hostname_to_addr(server, &ss, &ss_len) < 0) { + ms_error("Fail to parser stun server address: %s", server); + return; + } + if (lc->vtable.display_status != NULL) + lc->vtable.display_status(lc, _("ICE local candidates gathering in progress...")); + + audio_responses[0] = audio_responses[1] = FALSE; + video_responses[0] = video_responses[1] = FALSE; + audio_socks[0] = create_socket(call->audio_port); + if (audio_socks[0] == -1) return; + audio_socks[1] = create_socket(call->audio_port + 1); + if (audio_socks[1] == -1) return; + if (params->has_video) { + video_socks[0] = create_socket(call->video_port); + if (video_socks[0] == -1) return; + video_socks[1] = create_socket(call->video_port + 1); + if (video_socks[1] == -1) return; + } else { + video_socks[0] = video_socks[1] = -1; + } + + gettimeofday(&init, NULL); + do { + if (loops % 20 == 0) { + ms_message("Sending stun requests..."); + if (audio_responses[0] == FALSE) sendStunRequest(audio_socks[0], (struct sockaddr*)&ss, ss_len, 1, FALSE); + if (audio_responses[1] == FALSE) sendStunRequest(audio_socks[1], (struct sockaddr*)&ss, ss_len, 1, FALSE); + if (params->has_video) { + if (video_responses[0] == FALSE) sendStunRequest(video_socks[0], (struct sockaddr*)&ss, ss_len, 2, FALSE); + if (video_responses[1] == FALSE) sendStunRequest(video_socks[1], (struct sockaddr*)&ss, ss_len, 2, FALSE); + } + } +#ifdef WIN32 + Sleep(10); +#else + usleep(10000); +#endif + + if (recvStunResponse(audio_socks[0], addr, &port, &id) > 0) { + ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 1, NULL); + audio_responses[0] = TRUE; + } + if (recvStunResponse(audio_socks[1], addr, &port, &id) > 0) { + ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 2, NULL); + audio_responses[1] = TRUE; + } + if (params->has_video) { + if (recvStunResponse(video_socks[0], addr, &port, &id) > 0) { + ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 1, NULL); + video_responses[0] = TRUE; + } + if (recvStunResponse(video_socks[1], addr, &port, &id) > 0) { + ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 2, NULL); + video_responses[1] = TRUE; + } + } + + gettimeofday(&cur, NULL); + elapsed = ((cur.tv_sec - init.tv_sec) * 1000.0) + ((cur.tv_usec - init.tv_usec) / 1000.0); + if (elapsed > 2000) { + ms_message("Stun responses timeout, going ahead."); + break; + } + loops++; + } while (!((audio_responses[0] == TRUE) && (audio_responses[1] == TRUE) + && (!params->has_video || ((video_responses[0] == TRUE) && (video_responses[1] == TRUE))))); + + close_socket(audio_socks[0]); + close_socket(audio_socks[1]); + ice_dump_candidates(call->localdesc->streams[0].ice_check_list); + if (params->has_video) { + if (video_socks[0] != -1) close_socket(video_socks[0]); + if (video_socks[1] != -1) close_socket(video_socks[1]); + ice_dump_candidates(call->localdesc->streams[1].ice_check_list); + } +} + LinphoneCall * is_a_linphone_call(void *user_pointer){ LinphoneCall *call=(LinphoneCall*)user_pointer; if (call==NULL) return NULL; diff --git a/coreapi/private.h b/coreapi/private.h index dd8b2b3bd..2a2cd7816 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -220,6 +220,7 @@ MSList *linphone_find_friend(MSList *fl, const LinphoneAddress *fri, LinphoneFri void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, const PayloadType *pt); void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); +void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_send_initial_subscribes(LinphoneCore *lc); void linphone_core_write_friends_config(LinphoneCore* lc); From 1d3aab598e5603d64b081b0fd8fbb2840d6af0dd Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 17 Jul 2012 17:10:03 +0200 Subject: [PATCH 339/769] Gather ICE host candidates when starting an outgoing call. --- coreapi/misc.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 632ddfe75..36424f566 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -564,6 +564,7 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) { + char local_addr[64]; char addr[64]; int port; int id; @@ -571,6 +572,8 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ortp_socket_t video_socks[2]; bool_t audio_responses[2]; bool_t video_responses[2]; + IceCandidate *audio_ice_bases[2]; + IceCandidate *video_ice_bases[2]; struct sockaddr_storage ss; socklen_t ss_len; struct timeval init, cur; @@ -594,6 +597,8 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) audio_responses[0] = audio_responses[1] = FALSE; video_responses[0] = video_responses[1] = FALSE; + audio_ice_bases[0] = audio_ice_bases[1] = NULL; + video_ice_bases[0] = video_ice_bases[1] = NULL; audio_socks[0] = create_socket(call->audio_port); if (audio_socks[0] == -1) return; audio_socks[1] = create_socket(call->audio_port + 1); @@ -606,6 +611,16 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) } else { video_socks[0] = video_socks[1] = -1; } + if (linphone_core_get_local_ip_for(AF_INET, NULL, local_addr) < 0) { + ms_error("Fail to get local ip"); + return; + } + audio_ice_bases[0] = ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "host", local_addr, call->audio_port, 1, NULL); + audio_ice_bases[1] = ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); + if (params->has_video) { + video_ice_bases[0] = ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "host", local_addr, call->video_port, 1, NULL); + video_ice_bases[1] = ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "host", local_addr, call->video_port + 1, 2, NULL); + } gettimeofday(&init, NULL); do { @@ -625,20 +640,20 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) #endif if (recvStunResponse(audio_socks[0], addr, &port, &id) > 0) { - ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 1, NULL); + ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 1, audio_ice_bases[0]); audio_responses[0] = TRUE; } if (recvStunResponse(audio_socks[1], addr, &port, &id) > 0) { - ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 2, NULL); + ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 2, audio_ice_bases[1]); audio_responses[1] = TRUE; } if (params->has_video) { if (recvStunResponse(video_socks[0], addr, &port, &id) > 0) { - ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 1, NULL); + ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 1, video_ice_bases[0]); video_responses[0] = TRUE; } if (recvStunResponse(video_socks[1], addr, &port, &id) > 0) { - ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 2, NULL); + ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 2, video_ice_bases[1]); video_responses[1] = TRUE; } } From e594edfe34499c6bd0c8a008351ba32181692bdd Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 17 Jul 2012 17:14:47 +0200 Subject: [PATCH 340/769] Compute ICE foundations and choose default candidates when ICE candidate gathering is finished. --- coreapi/misc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index 36424f566..64b6df71a 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -668,6 +668,9 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) } while (!((audio_responses[0] == TRUE) && (audio_responses[1] == TRUE) && (!params->has_video || ((video_responses[0] == TRUE) && (video_responses[1] == TRUE))))); + ice_session_compute_candidates_foundations(call->ice_session); + ice_session_choose_default_candidates(call->ice_session); + close_socket(audio_socks[0]); close_socket(audio_socks[1]); ice_dump_candidates(call->localdesc->streams[0].ice_check_list); From 38af09c6b5fdbc22322e4191d2398035912ee52f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 18 Jul 2012 11:14:47 +0200 Subject: [PATCH 341/769] Fix ICE candidates gathering for video stream. --- coreapi/misc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 64b6df71a..6fa68e6dc 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -579,7 +579,6 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) struct timeval init, cur; double elapsed; int loops = 0; - const LinphoneCallParams *params = linphone_call_get_current_params(call); const char *server = linphone_core_get_stun_server(lc); if (server == NULL) return; @@ -603,7 +602,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) if (audio_socks[0] == -1) return; audio_socks[1] = create_socket(call->audio_port + 1); if (audio_socks[1] == -1) return; - if (params->has_video) { + if (call->params.has_video) { video_socks[0] = create_socket(call->video_port); if (video_socks[0] == -1) return; video_socks[1] = create_socket(call->video_port + 1); @@ -617,7 +616,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) } audio_ice_bases[0] = ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "host", local_addr, call->audio_port, 1, NULL); audio_ice_bases[1] = ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); - if (params->has_video) { + if (call->params.has_video) { video_ice_bases[0] = ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "host", local_addr, call->video_port, 1, NULL); video_ice_bases[1] = ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "host", local_addr, call->video_port + 1, 2, NULL); } @@ -628,7 +627,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ms_message("Sending stun requests..."); if (audio_responses[0] == FALSE) sendStunRequest(audio_socks[0], (struct sockaddr*)&ss, ss_len, 1, FALSE); if (audio_responses[1] == FALSE) sendStunRequest(audio_socks[1], (struct sockaddr*)&ss, ss_len, 1, FALSE); - if (params->has_video) { + if (call->params.has_video) { if (video_responses[0] == FALSE) sendStunRequest(video_socks[0], (struct sockaddr*)&ss, ss_len, 2, FALSE); if (video_responses[1] == FALSE) sendStunRequest(video_socks[1], (struct sockaddr*)&ss, ss_len, 2, FALSE); } @@ -647,7 +646,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 2, audio_ice_bases[1]); audio_responses[1] = TRUE; } - if (params->has_video) { + if (call->params.has_video) { if (recvStunResponse(video_socks[0], addr, &port, &id) > 0) { ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 1, video_ice_bases[0]); video_responses[0] = TRUE; @@ -666,7 +665,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) } loops++; } while (!((audio_responses[0] == TRUE) && (audio_responses[1] == TRUE) - && (!params->has_video || ((video_responses[0] == TRUE) && (video_responses[1] == TRUE))))); + && (!call->params.has_video || ((video_responses[0] == TRUE) && (video_responses[1] == TRUE))))); ice_session_compute_candidates_foundations(call->ice_session); ice_session_choose_default_candidates(call->ice_session); @@ -674,7 +673,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) close_socket(audio_socks[0]); close_socket(audio_socks[1]); ice_dump_candidates(call->localdesc->streams[0].ice_check_list); - if (params->has_video) { + if (call->params.has_video) { if (video_socks[0] != -1) close_socket(video_socks[0]); if (video_socks[1] != -1) close_socket(video_socks[1]); ice_dump_candidates(call->localdesc->streams[1].ice_check_list); From 47441a8d385e4cd4645b0a6ffaf158249514d5a6 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 18 Jul 2012 11:15:34 +0200 Subject: [PATCH 342/769] Add ICE attributes in the SDP content. --- coreapi/sal_eXosip2_sdp.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 32f031864..96cfa5ebc 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -158,6 +158,14 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) sdp_message_t_time_descr_add (local, osip_strdup ("0"), osip_strdup ("0")); if (desc->bandwidth>0) sdp_message_b_bandwidth_add (local, -1, osip_strdup ("AS"), int_2char(desc->bandwidth)); + if (desc->streams[0].ice_check_list != NULL) { + char buffer[512]; + snprintf(buffer ,sizeof(buffer), "%s", ice_session_local_pwd(desc->streams[0].ice_check_list->session)); + sdp_message_a_attribute_add(local, -1, osip_strdup("ice-pwd"), osip_strdup(buffer)); + snprintf(buffer ,sizeof(buffer), "%s", ice_session_local_ufrag(desc->streams[0].ice_check_list->session)); + sdp_message_a_attribute_add(local, -1, osip_strdup("ice-ufrag"), osip_strdup(buffer)); + } + return local; } @@ -197,6 +205,22 @@ static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt, boo } } +static void add_ice_candidates(sdp_message_t *msg, int lineno, const SalStreamDescription *desc) +{ + char buffer[1024]; + IceCandidate *candidate; + int i; + + if (desc->ice_check_list != NULL) { + for (i = 0; i < ms_list_size(desc->ice_check_list->local_candidates); i++) { + candidate = ms_list_nth_data(desc->ice_check_list->local_candidates, i); + snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", + candidate->foundation, candidate->componentID, candidate->priority, candidate->taddr.ip, candidate->taddr.port, ice_candidate_type(candidate)); + sdp_message_a_attribute_add(msg, lineno, osip_strdup("candidate"), osip_strdup(buffer)); + } + } +} + static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription *desc){ const char *mt=NULL; @@ -305,8 +329,10 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription break; } if (dir) sdp_message_a_attribute_add (msg, lineno, osip_strdup (dir),NULL); + add_ice_candidates(msg, lineno, desc); } + sdp_message_t *media_description_to_sdp(const SalMediaDescription *desc){ int i; sdp_message_t *msg=create_generic_sdp(desc); From 17ea4603099299f60a63007906671eef04e65657 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 18 Jul 2012 11:47:05 +0200 Subject: [PATCH 343/769] Good connection address and media ports in the SDP when using ICE. --- coreapi/sal_eXosip2_sdp.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 96cfa5ebc..55df9d6b2 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -130,6 +130,7 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) int inet6; char sessid[16]; char sessver[16]; + const char *addr = desc->addr; snprintf(sessid,16,"%i",desc->session_id); snprintf(sessver,16,"%i",desc->session_ver); @@ -143,11 +144,17 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) osip_strdup ("IN"), inet6 ? osip_strdup("IP6") : osip_strdup ("IP4"), osip_strdup (desc->addr)); sdp_message_s_name_set (local, osip_strdup ("Talk")); + if (desc->streams[0].ice_check_list != NULL) { + const IceCandidate *candidate = ice_check_list_default_local_candidate(desc->streams[0].ice_check_list); + if (candidate != NULL) { + addr=candidate->taddr.ip; + } + } if(!sal_media_description_has_dir (desc,SalStreamSendOnly)) { sdp_message_c_connection_add (local, -1, osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"), - osip_strdup (desc->addr), NULL, NULL); + osip_strdup (addr), NULL, NULL); } else { @@ -208,7 +215,7 @@ static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt, boo static void add_ice_candidates(sdp_message_t *msg, int lineno, const SalStreamDescription *desc) { char buffer[1024]; - IceCandidate *candidate; + const IceCandidate *candidate; int i; if (desc->ice_check_list != NULL) { @@ -241,13 +248,19 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription mt=desc->typeother; break; } - if (desc->candidates[0].addr[0]!='\0'){ + addr=desc->addr; + port=desc->port; + if (desc->ice_check_list != NULL) { + const IceCandidate *candidate = ice_check_list_default_local_candidate(desc->ice_check_list); + if (candidate != NULL) { + addr=candidate->taddr.ip; + port=candidate->taddr.port; + } + } else if (desc->candidates[0].addr[0]!='\0'){ addr=desc->candidates[0].addr; port=desc->candidates[0].port; - }else{ - addr=desc->addr; - port=desc->port; } + /*only add a c= line within the stream description if address are differents*/ if (strcmp(addr,sdp_message_c_addr_get(msg, -1, 0))!=0){ bool_t inet6; From f8f3db359cc60880654c99e9f60d6ad36294b195 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 18 Jul 2012 12:29:05 +0200 Subject: [PATCH 344/769] Define ICE session role explicitly. --- coreapi/misc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index 6fa68e6dc..fd3a8716e 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -614,6 +614,11 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ms_error("Fail to get local ip"); return; } + if (call->dir == LinphoneCallOutgoing) { + ice_session_set_role(call->ice_session, IR_Controlling); + } else { + ice_session_set_role(call->ice_session, IR_Controlled); + } audio_ice_bases[0] = ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "host", local_addr, call->audio_port, 1, NULL); audio_ice_bases[1] = ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); if (call->params.has_video) { From afe90f2be97003f185d2469b31d20b09452a7483 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 18 Jul 2012 14:17:06 +0200 Subject: [PATCH 345/769] Create ICE session when receiving an incoming call if this is necessary. --- coreapi/linphonecall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 0be2c9608..4e9e4b118 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -388,6 +388,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; + if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) call->ice_session=ice_session_new(); call->localdesc=create_local_media_description (lc,call); call->camera_active=call->params.has_video; if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun) From c93c092cf3cde2fe015a3103633630d83af2ee5b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 18 Jul 2012 15:41:58 +0200 Subject: [PATCH 346/769] Parse ICE attributes when receiving SDP. --- coreapi/sal.h | 3 +++ coreapi/sal_eXosip2_sdp.c | 52 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/coreapi/sal.h b/coreapi/sal.h index 65eb5e0b4..8bd2523fd 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -152,6 +152,9 @@ typedef struct SalMediaDescription{ SalStreamDescription streams[SAL_MEDIA_DESCRIPTION_MAX_STREAMS]; } SalMediaDescription; +#define SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES 5 +#define SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES 10 + SalMediaDescription *sal_media_description_new(); void sal_media_description_ref(SalMediaDescription *md); void sal_media_description_unref(SalMediaDescription *md); diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 55df9d6b2..08deb7d5c 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -389,7 +389,10 @@ static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ int i,j; const char *mtype,*proto,*port,*addr,*number; + const char *ice_ufrag, *ice_pwd; sdp_bandwidth_t *sbw=NULL; + sdp_attribute_t *attr; + int media_attribute_nb; addr=sdp_message_c_addr_get (msg, -1, 0); if (addr) @@ -433,7 +436,8 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ for(j=0;(sbw=sdp_message_bandwidth_get(msg,i,j))!=NULL;++j){ if (strcasecmp(sbw->b_bwtype,"AS")==0) stream->bandwidth=atoi(sbw->b_bandwidth); } - stream->dir=_sdp_message_get_mline_dir(msg,i); + stream->dir=_sdp_message_get_mline_dir(msg,i); + media_attribute_nb = 0; /* for each payload type */ for (j=0;((number=sdp_message_m_payload_get (msg, i,j)) != NULL); j++){ const char *rtpmap,*fmtp; @@ -442,9 +446,11 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ payload_type_set_number(pt,ptn); /* get the rtpmap associated to this codec, if any */ rtpmap=sdp_message_a_attr_value_get_with_pt(msg, i,ptn,"rtpmap"); + if (rtpmap != NULL) media_attribute_nb++; if (payload_type_fill_from_rtpmap(pt,rtpmap)==0){ /* get the fmtp, if any */ fmtp=sdp_message_a_attr_value_get_with_pt(msg, i, ptn,"fmtp"); + if (fmtp != NULL) media_attribute_nb++; payload_type_set_send_fmtp(pt,fmtp); stream->payloads=ms_list_append(stream->payloads,pt); ms_message("Found payload %s/%i fmtp=%s",pt->mime_type,pt->clock_rate, @@ -455,7 +461,6 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ /* read crypto lines if any */ if (stream->proto == SalProtoRtpSavp) { int k, valid_count = 0; - sdp_attribute_t *attr; memset(&stream->crypto, 0, sizeof(stream->crypto)); for (k=0;valid_count < SAL_CRYPTO_ALGO_MAX && (attr=sdp_message_attribute_get(msg,i,k))!=NULL;k++){ @@ -494,6 +499,49 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ } ms_message("Found: %d valid crypto lines", valid_count); } + + /* Get ICE candidate attributes if any */ + ice_ufrag = ice_pwd = NULL; + for (j = 0; (j < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES) && ((attr = sdp_message_attribute_get(msg, i, media_attribute_nb + j)) != NULL); j++) { + if ((keywordcmp("candidate", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + char ip[64]; + char foundation[32]; + char type[6]; + unsigned int priority; + unsigned int componentID; + unsigned int port; + int nb; + + /* Allocate the ICE check list if it has not been done yet. */ + if (desc->streams[i].ice_check_list == NULL) desc->streams[i].ice_check_list = ice_check_list_new(); + nb = sscanf(attr->a_att_value, "%s %u UDP %u %s %u typ %s", + foundation, &componentID, &priority, ip, &port, type); + if (nb == 6) { + ice_add_remote_candidate(desc->streams[i].ice_check_list, type, ip, port, componentID, priority, foundation); + } + } else if ((keywordcmp("ice-ufrag", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + ice_ufrag = attr->a_att_value; + } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + ice_pwd = attr->a_att_value; + } + } + if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { + ice_check_list_set_remote_credentials(desc->streams[i].ice_check_list, ice_ufrag, ice_pwd); + } + if (desc->streams[i].ice_check_list) ice_dump_candidates(desc->streams[i].ice_check_list); + } + /* Get ICE remote ufrag and remote pwd */ + ice_ufrag = ice_pwd = NULL; + for (i = 0; (i < SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES) && ((attr = sdp_message_attribute_get(msg, -1, i)) != NULL); i++) { + if ((keywordcmp("ice-ufrag", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + ice_ufrag = attr->a_att_value; + } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + ice_pwd = attr->a_att_value; + } + } + if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { + ms_error("ufrag: %s, pwd: %s", ice_ufrag, ice_pwd); + //ice_session_set_remote_credentials(session, ice_ufrag, ice_pwd); } desc->nstreams=i; return 0; From 3020133c80812309e30ed471c991be46af824b46 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 18 Jul 2012 16:24:03 +0200 Subject: [PATCH 347/769] Allocate ICE session when parsing SDP on incoming call. --- coreapi/linphonecall.c | 4 ++-- coreapi/sal_eXosip2_sdp.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4e9e4b118..b1f5ee494 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -245,7 +245,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].crypto[1].algo = 0; md->streams[i].crypto[2].algo = 0; } - if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce){ + if ((call->dir == LinphoneCallOutgoing) && (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce)){ md->streams[i].ice_check_list = ice_check_list_new(); ice_session_add_check_list(call->ice_session, md->streams[i].ice_check_list); } @@ -388,7 +388,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; - if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) call->ice_session=ice_session_new(); + if (((SalOpBase *)op)->remote_media->streams[0].ice_check_list != NULL) call->ice_session=((SalOpBase *)op)->remote_media->streams[0].ice_check_list->session; call->localdesc=create_local_media_description (lc,call); call->camera_active=call->params.has_video; if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 08deb7d5c..710c58072 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -390,6 +390,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ int i,j; const char *mtype,*proto,*port,*addr,*number; const char *ice_ufrag, *ice_pwd; + IceSession *ice_session = NULL; sdp_bandwidth_t *sbw=NULL; sdp_attribute_t *attr; int media_attribute_nb; @@ -512,8 +513,13 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ unsigned int port; int nb; + /* Allocate the ICE session if it has not been done yet. */ + if (ice_session == NULL) ice_session = ice_session_new(); /* Allocate the ICE check list if it has not been done yet. */ - if (desc->streams[i].ice_check_list == NULL) desc->streams[i].ice_check_list = ice_check_list_new(); + if (desc->streams[i].ice_check_list == NULL) { + desc->streams[i].ice_check_list = ice_check_list_new(); + ice_session_add_check_list(ice_session, desc->streams[i].ice_check_list); + } nb = sscanf(attr->a_att_value, "%s %u UDP %u %s %u typ %s", foundation, &componentID, &priority, ip, &port, type); if (nb == 6) { @@ -539,9 +545,9 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ ice_pwd = attr->a_att_value; } } - if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { - ms_error("ufrag: %s, pwd: %s", ice_ufrag, ice_pwd); - //ice_session_set_remote_credentials(session, ice_ufrag, ice_pwd); + if ((ice_session != NULL) && (ice_ufrag != NULL) && (ice_pwd != NULL)) { + ice_session_set_remote_credentials(ice_session, ice_ufrag, ice_pwd); + ice_dump_session(ice_session); } desc->nstreams=i; return 0; From 2ef1e7c9cdfd521d2cc1c6c941096a3910ea731a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 18 Jul 2012 16:51:49 +0200 Subject: [PATCH 348/769] Gather ICE candidates on incoming call. --- coreapi/linphonecall.c | 20 ++++++++++++++++---- coreapi/misc.c | 35 ++++++++++++++++++++--------------- coreapi/sal_eXosip2_sdp.c | 16 +++++++++++++--- 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b1f5ee494..c36b341ec 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -342,7 +342,10 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr linphone_core_get_local_ip(lc,linphone_address_get_domain(to),call->localip); linphone_call_init_common(call,from,to); call->params=*params; - if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) call->ice_session=ice_session_new(); + if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) { + call->ice_session=ice_session_new(); + ice_session_set_role(call->ice_session, IR_Controlling); + } call->localdesc=create_local_media_description (lc,call); call->camera_active=params->has_video; switch (linphone_core_get_firewall_policy(call->core)) { @@ -388,11 +391,20 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; - if (((SalOpBase *)op)->remote_media->streams[0].ice_check_list != NULL) call->ice_session=((SalOpBase *)op)->remote_media->streams[0].ice_check_list->session; + if (sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list != NULL) + call->ice_session=sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list->session; call->localdesc=create_local_media_description (lc,call); call->camera_active=call->params.has_video; - if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun) - linphone_core_run_stun_tests(call->core,call); + switch (linphone_core_get_firewall_policy(call->core)) { + case LinphonePolicyUseStun: + linphone_core_run_stun_tests(call->core,call); + break; + case LinphonePolicyUseIce: + linphone_core_gather_ice_candidates(call->core, call); + break; + default: + break; + } discover_mtu(lc,linphone_address_get_domain(from)); return call; } diff --git a/coreapi/misc.c b/coreapi/misc.c index fd3a8716e..f7e6feb64 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -574,6 +574,8 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) bool_t video_responses[2]; IceCandidate *audio_ice_bases[2]; IceCandidate *video_ice_bases[2]; + IceCheckList *audio_check_list; + IceCheckList *video_check_list; struct sockaddr_storage ss; socklen_t ss_len; struct timeval init, cur; @@ -598,6 +600,14 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) video_responses[0] = video_responses[1] = FALSE; audio_ice_bases[0] = audio_ice_bases[1] = NULL; video_ice_bases[0] = video_ice_bases[1] = NULL; + if (call->dir == LinphoneCallOutgoing) { + audio_check_list = call->localdesc->streams[0].ice_check_list; + video_check_list = call->localdesc->streams[1].ice_check_list; + } else { + SalMediaDescription *md = sal_call_get_remote_media_description(call->op); + audio_check_list = md->streams[0].ice_check_list; + video_check_list = md->streams[1].ice_check_list; + } audio_socks[0] = create_socket(call->audio_port); if (audio_socks[0] == -1) return; audio_socks[1] = create_socket(call->audio_port + 1); @@ -614,16 +624,11 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ms_error("Fail to get local ip"); return; } - if (call->dir == LinphoneCallOutgoing) { - ice_session_set_role(call->ice_session, IR_Controlling); - } else { - ice_session_set_role(call->ice_session, IR_Controlled); - } - audio_ice_bases[0] = ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "host", local_addr, call->audio_port, 1, NULL); - audio_ice_bases[1] = ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); + audio_ice_bases[0] = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); + audio_ice_bases[1] = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); if (call->params.has_video) { - video_ice_bases[0] = ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "host", local_addr, call->video_port, 1, NULL); - video_ice_bases[1] = ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "host", local_addr, call->video_port + 1, 2, NULL); + video_ice_bases[0] = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); + video_ice_bases[1] = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); } gettimeofday(&init, NULL); @@ -644,20 +649,20 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) #endif if (recvStunResponse(audio_socks[0], addr, &port, &id) > 0) { - ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 1, audio_ice_bases[0]); + ice_add_local_candidate(audio_check_list, "srflx", addr, port, 1, audio_ice_bases[0]); audio_responses[0] = TRUE; } if (recvStunResponse(audio_socks[1], addr, &port, &id) > 0) { - ice_add_local_candidate(call->localdesc->streams[0].ice_check_list, "srflx", addr, port, 2, audio_ice_bases[1]); + ice_add_local_candidate(audio_check_list, "srflx", addr, port, 2, audio_ice_bases[1]); audio_responses[1] = TRUE; } if (call->params.has_video) { if (recvStunResponse(video_socks[0], addr, &port, &id) > 0) { - ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 1, video_ice_bases[0]); + ice_add_local_candidate(video_check_list, "srflx", addr, port, 1, video_ice_bases[0]); video_responses[0] = TRUE; } if (recvStunResponse(video_socks[1], addr, &port, &id) > 0) { - ice_add_local_candidate(call->localdesc->streams[1].ice_check_list, "srflx", addr, port, 2, video_ice_bases[1]); + ice_add_local_candidate(video_check_list, "srflx", addr, port, 2, video_ice_bases[1]); video_responses[1] = TRUE; } } @@ -677,11 +682,11 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) close_socket(audio_socks[0]); close_socket(audio_socks[1]); - ice_dump_candidates(call->localdesc->streams[0].ice_check_list); + ice_dump_candidates(audio_check_list); if (call->params.has_video) { if (video_socks[0] != -1) close_socket(video_socks[0]); if (video_socks[1] != -1) close_socket(video_socks[1]); - ice_dump_candidates(call->localdesc->streams[1].ice_check_list); + ice_dump_candidates(video_check_list); } } diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 710c58072..4faad395f 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -394,6 +394,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ sdp_bandwidth_t *sbw=NULL; sdp_attribute_t *attr; int media_attribute_nb; + bool_t ice_lite = FALSE; addr=sdp_message_c_addr_get (msg, -1, 0); if (addr) @@ -543,11 +544,20 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ ice_ufrag = attr->a_att_value; } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { ice_pwd = attr->a_att_value; + } else if (keywordcmp("ice-lite", attr->a_att_field) == 0) { + ice_lite = TRUE; } } - if ((ice_session != NULL) && (ice_ufrag != NULL) && (ice_pwd != NULL)) { - ice_session_set_remote_credentials(ice_session, ice_ufrag, ice_pwd); - ice_dump_session(ice_session); + if (ice_session != NULL) { + if (ice_lite == TRUE) { + ice_session_set_role(ice_session, IR_Controlling); + } else { + ice_session_set_role(ice_session, IR_Controlled); + } + if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { + ice_session_set_remote_credentials(ice_session, ice_ufrag, ice_pwd); + ice_dump_session(ice_session); + } } desc->nstreams=i; return 0; From 91c9eff049cb492c4fcdbe977f0d2fc3927b53c6 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 19 Jul 2012 09:43:28 +0200 Subject: [PATCH 349/769] Copy ICE check list pointers between media descriptions. --- coreapi/linphonecall.c | 14 ++++++++++---- coreapi/misc.c | 10 ++-------- coreapi/offeranswer.c | 3 +++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index c36b341ec..28bc348b2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -249,6 +249,12 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].ice_check_list = ice_check_list_new(); ice_session_add_check_list(call->ice_session, md->streams[i].ice_check_list); } + if ((call->dir == LinphoneCallIncoming) && (sal_call_get_remote_media_description(call->op)->streams[i].ice_check_list != NULL)) { + md->streams[i].ice_check_list = sal_call_get_remote_media_description(call->op)->streams[i].ice_check_list; + } + } + if ((call->dir == LinphoneCallIncoming) && (md->streams[0].ice_check_list != NULL)) { + call->ice_session=md->streams[0].ice_check_list->session; } linphone_address_destroy(addr); @@ -391,8 +397,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; - if (sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list != NULL) - call->ice_session=sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list->session; call->localdesc=create_local_media_description (lc,call); call->camera_active=call->params.has_video; switch (linphone_core_get_firewall_policy(call->core)) { @@ -969,7 +973,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){ } if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){ rtp_session_set_pktinfo(audiostream->session,TRUE); - audiostream->ice_check_list = call->localdesc->streams[0].ice_check_list; + if (call->dir == LinphoneCallOutgoing) audiostream->ice_check_list = call->localdesc->streams[0].ice_check_list; + else audiostream->ice_check_list = sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list; ice_check_list_register_success_cb(audiostream->ice_check_list, audio_stream_set_remote_from_ice, audiostream); } @@ -994,7 +999,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){ } if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){ rtp_session_set_pktinfo(call->videostream->session,TRUE); - call->videostream->ice_check_list = call->localdesc->streams[1].ice_check_list; + if (call->dir == LinphoneCallOutgoing) call->videostream->ice_check_list = call->localdesc->streams[1].ice_check_list; + else call->videostream->ice_check_list = sal_call_get_remote_media_description(call->op)->streams[1].ice_check_list; ice_check_list_register_success_cb(call->videostream->ice_check_list, video_stream_set_remote_from_ice, call->videostream); } call->videostream_app_evq = ortp_ev_queue_new(); diff --git a/coreapi/misc.c b/coreapi/misc.c index f7e6feb64..2ef0e04bf 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -600,14 +600,8 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) video_responses[0] = video_responses[1] = FALSE; audio_ice_bases[0] = audio_ice_bases[1] = NULL; video_ice_bases[0] = video_ice_bases[1] = NULL; - if (call->dir == LinphoneCallOutgoing) { - audio_check_list = call->localdesc->streams[0].ice_check_list; - video_check_list = call->localdesc->streams[1].ice_check_list; - } else { - SalMediaDescription *md = sal_call_get_remote_media_description(call->op); - audio_check_list = md->streams[0].ice_check_list; - video_check_list = md->streams[1].ice_check_list; - } + audio_check_list = call->localdesc->streams[0].ice_check_list; + video_check_list = call->localdesc->streams[1].ice_check_list; audio_socks[0] = create_socket(call->audio_port); if (audio_socks[0] == -1) return; audio_socks[1] = create_socket(call->audio_port + 1); diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 5a2b4f527..7b6ce018f 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -223,6 +223,7 @@ static void initiate_outgoing(const SalStreamDescription *local_offer, if (!match_crypto_algo(local_offer->crypto, remote_answer->crypto, &result->crypto[0], &result->crypto_local_tag, FALSE)) result->port = 0; } + result->ice_check_list = remote_answer->ice_check_list; } @@ -249,6 +250,7 @@ static void initiate_incoming(const SalStreamDescription *local_cap, result->port = 0; } + result->ice_check_list = local_cap->ice_check_list; } /** @@ -309,6 +311,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities if (rs->type==SalOther){ strncpy(result->streams[i].typeother,rs->typeother,sizeof(rs->typeother)-1); } + result->streams[i].ice_check_list = remote_offer->streams[i].ice_check_list; } } result->nstreams=i; From 6857091ea9bf171dfcb85b11295f7ef7861b279c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 19 Jul 2012 14:13:37 +0200 Subject: [PATCH 350/769] Moved ICE session and check lists respectively from LinphoneCall and SalMediaDescription to SalOp. --- coreapi/linphonecall.c | 37 ++++++++------------- coreapi/misc.c | 19 ++++++----- coreapi/offeranswer.c | 3 -- coreapi/private.h | 1 - coreapi/sal.c | 10 ++++++ coreapi/sal.h | 4 ++- coreapi/sal_eXosip2.c | 37 ++++++++++++++------- coreapi/sal_eXosip2.h | 4 +-- coreapi/sal_eXosip2_sdp.c | 67 ++++++++++++++++++++------------------- 9 files changed, 100 insertions(+), 82 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 28bc348b2..5689f8dd3 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -201,7 +201,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li LinphoneAddress *addr=linphone_address_new(me); const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); - + IceSession *ice_session=sal_op_get_ice_session(call->op); md->session_id=session_id; md->session_ver=session_ver; @@ -245,16 +245,9 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].crypto[1].algo = 0; md->streams[i].crypto[2].algo = 0; } - if ((call->dir == LinphoneCallOutgoing) && (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce)){ - md->streams[i].ice_check_list = ice_check_list_new(); - ice_session_add_check_list(call->ice_session, md->streams[i].ice_check_list); + if ((call->dir == LinphoneCallOutgoing) && (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) && (ice_session != NULL)){ + ice_session_add_check_list(ice_session, ice_check_list_new()); } - if ((call->dir == LinphoneCallIncoming) && (sal_call_get_remote_media_description(call->op)->streams[i].ice_check_list != NULL)) { - md->streams[i].ice_check_list = sal_call_get_remote_media_description(call->op)->streams[i].ice_check_list; - } - } - if ((call->dir == LinphoneCallIncoming) && (md->streams[0].ice_check_list != NULL)) { - call->ice_session=md->streams[0].ice_check_list->session; } linphone_address_destroy(addr); @@ -349,8 +342,8 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr linphone_call_init_common(call,from,to); call->params=*params; if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) { - call->ice_session=ice_session_new(); - ice_session_set_role(call->ice_session, IR_Controlling); + sal_op_set_ice_session(call->op, ice_session_new()); + ice_session_set_role(sal_op_get_ice_session(call->op), IR_Controlling); } call->localdesc=create_local_media_description (lc,call); call->camera_active=params->has_video; @@ -555,10 +548,6 @@ static void linphone_call_destroy(LinphoneCall *obj) sal_op_release(obj->op); obj->op=NULL; } - if (obj->ice_session!=NULL) { - ice_session_destroy(obj->ice_session); - obj->ice_session=NULL; - } if (obj->resultdesc!=NULL) { sal_media_description_unref(obj->resultdesc); obj->resultdesc=NULL; @@ -939,6 +928,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; AudioStream *audiostream; + IceSession *ice_session = sal_op_get_ice_session(call->op); call->audiostream=audiostream=audio_stream_new(md->streams[0].port,linphone_core_ipv6_enabled(lc)); if (linphone_core_echo_limiter_enabled(lc)){ @@ -971,10 +961,9 @@ void linphone_call_init_media_streams(LinphoneCall *call){ RtpTransport *artcp=lc->rtptf->audio_rtcp_func(lc->rtptf->audio_rtcp_func_data, call->audio_port+1); rtp_session_set_transports(audiostream->session,artp,artcp); } - if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){ - rtp_session_set_pktinfo(audiostream->session,TRUE); - if (call->dir == LinphoneCallOutgoing) audiostream->ice_check_list = call->localdesc->streams[0].ice_check_list; - else audiostream->ice_check_list = sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list; + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ + rtp_session_set_pktinfo(audiostream->session, TRUE); + audiostream->ice_check_list = ice_session_check_list(ice_session, 0); ice_check_list_register_success_cb(audiostream->ice_check_list, audio_stream_set_remote_from_ice, audiostream); } @@ -997,10 +986,9 @@ void linphone_call_init_media_streams(LinphoneCall *call){ RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); } - if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){ - rtp_session_set_pktinfo(call->videostream->session,TRUE); - if (call->dir == LinphoneCallOutgoing) call->videostream->ice_check_list = call->localdesc->streams[1].ice_check_list; - else call->videostream->ice_check_list = sal_call_get_remote_media_description(call->op)->streams[1].ice_check_list; + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ + rtp_session_set_pktinfo(call->videostream->session, TRUE); + call->videostream->ice_check_list = ice_session_check_list(ice_session, 1); ice_check_list_register_success_cb(call->videostream->ice_check_list, video_stream_set_remote_from_ice, call->videostream); } call->videostream_app_evq = ortp_ev_queue_new(); @@ -1452,6 +1440,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut /*also reflect the change if the "wished" params, in order to avoid to propose SAVP or video again * further in the call, for example during pause,resume, conferencing reINVITEs*/ linphone_call_fix_call_parameters(call); + if (sal_op_get_ice_session(call->op) != NULL) ice_session_pair_candidates(sal_op_get_ice_session(call->op)); goto end; end: diff --git a/coreapi/misc.c b/coreapi/misc.c index 2ef0e04bf..1dadcb335 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -576,6 +576,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) IceCandidate *video_ice_bases[2]; IceCheckList *audio_check_list; IceCheckList *video_check_list; + IceSession *ice_session = sal_op_get_ice_session(call->op); struct sockaddr_storage ss; socklen_t ss_len; struct timeval init, cur; @@ -583,7 +584,11 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) int loops = 0; const char *server = linphone_core_get_stun_server(lc); - if (server == NULL) return; + if ((server == NULL) || (ice_session == NULL)) return; + audio_check_list = ice_session_check_list(ice_session, 0); + video_check_list = ice_session_check_list(ice_session, 1); + if (audio_check_list == NULL) return; + if (lc->sip_conf.ipv6_enabled){ ms_warning("stun support is not implemented for ipv6"); return; @@ -600,8 +605,6 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) video_responses[0] = video_responses[1] = FALSE; audio_ice_bases[0] = audio_ice_bases[1] = NULL; video_ice_bases[0] = video_ice_bases[1] = NULL; - audio_check_list = call->localdesc->streams[0].ice_check_list; - video_check_list = call->localdesc->streams[1].ice_check_list; audio_socks[0] = create_socket(call->audio_port); if (audio_socks[0] == -1) return; audio_socks[1] = create_socket(call->audio_port + 1); @@ -620,7 +623,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) } audio_ice_bases[0] = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); audio_ice_bases[1] = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); - if (call->params.has_video) { + if (call->params.has_video && (video_check_list != NULL)) { video_ice_bases[0] = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); video_ice_bases[1] = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); } @@ -650,7 +653,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ice_add_local_candidate(audio_check_list, "srflx", addr, port, 2, audio_ice_bases[1]); audio_responses[1] = TRUE; } - if (call->params.has_video) { + if (call->params.has_video && (video_check_list != NULL)) { if (recvStunResponse(video_socks[0], addr, &port, &id) > 0) { ice_add_local_candidate(video_check_list, "srflx", addr, port, 1, video_ice_bases[0]); video_responses[0] = TRUE; @@ -671,13 +674,13 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) } while (!((audio_responses[0] == TRUE) && (audio_responses[1] == TRUE) && (!call->params.has_video || ((video_responses[0] == TRUE) && (video_responses[1] == TRUE))))); - ice_session_compute_candidates_foundations(call->ice_session); - ice_session_choose_default_candidates(call->ice_session); + ice_session_compute_candidates_foundations(ice_session); + ice_session_choose_default_candidates(ice_session); close_socket(audio_socks[0]); close_socket(audio_socks[1]); ice_dump_candidates(audio_check_list); - if (call->params.has_video) { + if (call->params.has_video && (video_check_list != NULL)) { if (video_socks[0] != -1) close_socket(video_socks[0]); if (video_socks[1] != -1) close_socket(video_socks[1]); ice_dump_candidates(video_check_list); diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 7b6ce018f..5a2b4f527 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -223,7 +223,6 @@ static void initiate_outgoing(const SalStreamDescription *local_offer, if (!match_crypto_algo(local_offer->crypto, remote_answer->crypto, &result->crypto[0], &result->crypto_local_tag, FALSE)) result->port = 0; } - result->ice_check_list = remote_answer->ice_check_list; } @@ -250,7 +249,6 @@ static void initiate_incoming(const SalStreamDescription *local_cap, result->port = 0; } - result->ice_check_list = local_cap->ice_check_list; } /** @@ -311,7 +309,6 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities if (rs->type==SalOther){ strncpy(result->streams[i].typeother,rs->typeother,sizeof(rs->typeother)-1); } - result->streams[i].ice_check_list = remote_offer->streams[i].ice_check_list; } } result->nstreams=i; diff --git a/coreapi/private.h b/coreapi/private.h index 2a2cd7816..241da0223 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -136,7 +136,6 @@ struct _LinphoneCall bool_t was_automatically_paused; CallCallbackObj nextVideoFrameDecoded; LinphoneCallStats stats[2]; - IceSession *ice_session; }; diff --git a/coreapi/sal.c b/coreapi/sal.c index 874c3716d..37e56fade 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -232,6 +232,10 @@ void sal_op_set_user_pointer(SalOp *op, void *up){ ((SalOpBase*)op)->user_pointer=up; } +void sal_op_set_ice_session(SalOp *op, IceSession *ice_session){ + ((SalOpBase*)op)->ice_session=ice_session; +} + Sal *sal_op_get_sal(const SalOp *op){ return ((SalOpBase*)op)->root; } @@ -260,6 +264,10 @@ void *sal_op_get_user_pointer(const SalOp *op){ return ((SalOpBase*)op)->user_pointer; } +IceSession *sal_op_get_ice_session(const SalOp *op){ + return ((SalOpBase*)op)->ice_session; +} + const char *sal_op_get_proxy(const SalOp *op){ return ((SalOpBase*)op)->route; } @@ -308,6 +316,8 @@ void __sal_op_free(SalOp *op){ sal_media_description_unref(b->local_media); if (b->remote_media) sal_media_description_unref(b->remote_media); + if (b->ice_session) + ice_session_destroy(b->ice_session); ms_free(op); } diff --git a/coreapi/sal.h b/coreapi/sal.h index 8bd2523fd..8782226b8 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -136,7 +136,6 @@ typedef struct SalStreamDescription{ SalSrtpCryptoAlgo crypto[SAL_CRYPTO_ALGO_MAX]; unsigned int crypto_local_tag; int max_rate; - IceCheckList *ice_check_list; } SalStreamDescription; #define SAL_MEDIA_DESCRIPTION_MAX_STREAMS 4 @@ -176,6 +175,7 @@ typedef struct SalOpBase{ char *remote_ua; SalMediaDescription *local_media; SalMediaDescription *remote_media; + IceSession *ice_session; void *user_pointer; } SalOpBase; @@ -320,6 +320,7 @@ void sal_op_release(SalOp *h); void sal_op_authenticate(SalOp *h, const SalAuthInfo *info); void sal_op_cancel_authentication(SalOp *h); void sal_op_set_user_pointer(SalOp *h, void *up); +void sal_op_set_ice_session(SalOp *h, IceSession *ice_session); int sal_op_get_auth_requested(SalOp *h, const char **realm, const char **username); const char *sal_op_get_from(const SalOp *op); const char *sal_op_get_to(const SalOp *op); @@ -331,6 +332,7 @@ const char *sal_op_get_network_origin(const SalOp *op); /*returns far-end "User-Agent" string */ const char *sal_op_get_remote_ua(const SalOp *op); void *sal_op_get_user_pointer(const SalOp *op); +IceSession *sal_op_get_ice_session(const SalOp *op); /*Call API*/ int sal_call_set_local_media_description(SalOp *h, SalMediaDescription *desc); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 8333f1554..62eddddb8 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -502,8 +502,8 @@ static void set_sdp(osip_message_t *sip,sdp_message_t *msg){ osip_free(sdp); } -static void set_sdp_from_desc(osip_message_t *sip, const SalMediaDescription *desc){ - sdp_message_t *msg=media_description_to_sdp(desc); +static void set_sdp_from_desc(osip_message_t *sip, const SalMediaDescription *desc, const IceSession *ice_session){ + sdp_message_t *msg=media_description_to_sdp(desc, ice_session); if (msg==NULL) { ms_error("Fail to print sdp message !"); return; @@ -526,7 +526,7 @@ static void sdp_process(SalOp *h){ sdp_message_free(h->sdp_answer); } offer_answer_initiate_incoming(h->base.local_media,h->base.remote_media,h->result,h->base.root->one_matching_codec); - h->sdp_answer=media_description_to_sdp(h->result); + h->sdp_answer=media_description_to_sdp(h->result, sal_op_get_ice_session(h)); /*once we have generated the SDP answer, we modify the result description for processing by the upper layer. It should contains media parameters constraint from the remote offer, not our response*/ strcpy(h->result->addr,h->base.remote_media->addr); @@ -598,7 +598,7 @@ int sal_call(SalOp *h, const char *from, const char *to){ } if (h->base.local_media){ h->sdp_offering=TRUE; - set_sdp_from_desc(invite,h->base.local_media); + set_sdp_from_desc(invite,h->base.local_media,sal_op_get_ice_session(h)); }else h->sdp_offering=FALSE; if (h->replaces){ osip_message_set_header(invite,"Replaces",h->replaces); @@ -666,7 +666,7 @@ int sal_call_accept(SalOp * h){ if (h->base.local_media){ /*this is the case where we received an invite without SDP*/ if (h->sdp_offering) { - set_sdp_from_desc(msg,h->base.local_media); + set_sdp_from_desc(msg,h->base.local_media,sal_op_get_ice_session(h)); }else{ if (h->sdp_answer==NULL) sdp_process(h); if (h->sdp_answer){ @@ -988,6 +988,7 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ osip_call_info_t *call_info; char *tmp; sdp_message_t *sdp=eXosip_get_sdp_info(ev->request); + IceSession *ice_session; set_network_origin(op,ev->request); set_remote_ua(op,ev->request); @@ -996,7 +997,9 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ if (sdp){ op->sdp_offering=FALSE; op->base.remote_media=sal_media_description_new(); - sdp_to_media_description(sdp,op->base.remote_media); + ice_session=sal_op_get_ice_session(op); + sdp_to_media_description(sdp,op->base.remote_media,&ice_session); + sal_op_set_ice_session(op,ice_session); sdp_message_free(sdp); }else op->sdp_offering=TRUE; @@ -1032,6 +1035,7 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ static void handle_reinvite(Sal *sal, eXosip_event_t *ev){ SalOp *op=find_op(sal,ev); sdp_message_t *sdp; + IceSession *ice_session; if (op==NULL) { ms_warning("Reinvite for non-existing operation !"); @@ -1051,7 +1055,9 @@ static void handle_reinvite(Sal *sal, eXosip_event_t *ev){ if (sdp){ op->sdp_offering=FALSE; op->base.remote_media=sal_media_description_new(); - sdp_to_media_description(sdp,op->base.remote_media); + ice_session=sal_op_get_ice_session(op); + sdp_to_media_description(sdp,op->base.remote_media,&ice_session); + sal_op_set_ice_session(op,ice_session); sdp_message_free(sdp); }else { @@ -1063,6 +1069,7 @@ static void handle_reinvite(Sal *sal, eXosip_event_t *ev){ static void handle_ack(Sal *sal, eXosip_event_t *ev){ SalOp *op=find_op(sal,ev); sdp_message_t *sdp; + IceSession *ice_session; if (op==NULL) { ms_warning("ack for non-existing call !"); @@ -1079,7 +1086,9 @@ static void handle_ack(Sal *sal, eXosip_event_t *ev){ if (op->base.remote_media) sal_media_description_unref(op->base.remote_media); op->base.remote_media=sal_media_description_new(); - sdp_to_media_description(sdp,op->base.remote_media); + ice_session=sal_op_get_ice_session(op); + sdp_to_media_description(sdp,op->base.remote_media,&ice_session); + sal_op_set_ice_session(op,ice_session); sdp_process(op); sdp_message_free(sdp); } @@ -1139,13 +1148,16 @@ static int call_proceeding(Sal *sal, eXosip_event_t *ev){ static void call_ringing(Sal *sal, eXosip_event_t *ev){ sdp_message_t *sdp; SalOp *op=find_op(sal,ev); + IceSession *ice_session; if (call_proceeding(sal, ev)==-1) return; set_remote_ua(op,ev->response); sdp=eXosip_get_sdp_info(ev->response); if (sdp){ op->base.remote_media=sal_media_description_new(); - sdp_to_media_description(sdp,op->base.remote_media); + ice_session=sal_op_get_ice_session(op); + sdp_to_media_description(sdp,op->base.remote_media,&ice_session); + sal_op_set_ice_session(op,ice_session); sdp_message_free(sdp); if (op->base.local_media) sdp_process(op); } @@ -1157,6 +1169,7 @@ static void call_accepted(Sal *sal, eXosip_event_t *ev){ osip_message_t *msg=NULL; SalOp *op=find_op(sal,ev); const char *contact; + IceSession *ice_session; if (op==NULL || op->terminated==TRUE) { ms_warning("This call has been already terminated."); @@ -1172,7 +1185,9 @@ static void call_accepted(Sal *sal, eXosip_event_t *ev){ sdp=eXosip_get_sdp_info(ev->response); if (sdp){ op->base.remote_media=sal_media_description_new(); - sdp_to_media_description(sdp,op->base.remote_media); + ice_session=sal_op_get_ice_session(op); + sdp_to_media_description(sdp,op->base.remote_media,&ice_session); + sal_op_set_ice_session(op,ice_session); sdp_message_free(sdp); if (op->base.local_media) sdp_process(op); } @@ -2410,7 +2425,7 @@ int sal_call_update(SalOp *h, const char *subject){ } if (h->base.local_media){ h->sdp_offering=TRUE; - set_sdp_from_desc(reinvite,h->base.local_media); + set_sdp_from_desc(reinvite,h->base.local_media,sal_op_get_ice_session(h)); }else h->sdp_offering=FALSE; eXosip_lock(); err = eXosip_call_send_request(h->did, reinvite); diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index ccc95d56a..e3264f74d 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -sdp_message_t *media_description_to_sdp(const SalMediaDescription *sal); -int sdp_to_media_description(sdp_message_t *sdp, SalMediaDescription *desc); +sdp_message_t *media_description_to_sdp(const SalMediaDescription *sal, const IceSession *ice_session); +int sdp_to_media_description(sdp_message_t *sdp, SalMediaDescription *desc, IceSession **ice_session); struct Sal{ SalCallbacks callbacks; diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 4faad395f..16e709718 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -124,7 +124,7 @@ static int _sdp_message_get_mline_dir(sdp_message_t *sdp, int mline){ return SalStreamSendRecv; } -static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) +static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const IceSession *ice_session) { sdp_message_t *local; int inet6; @@ -144,8 +144,8 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) osip_strdup ("IN"), inet6 ? osip_strdup("IP6") : osip_strdup ("IP4"), osip_strdup (desc->addr)); sdp_message_s_name_set (local, osip_strdup ("Talk")); - if (desc->streams[0].ice_check_list != NULL) { - const IceCandidate *candidate = ice_check_list_default_local_candidate(desc->streams[0].ice_check_list); + if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { + const IceCandidate *candidate = ice_check_list_default_local_candidate(ice_session_check_list(ice_session, 0)); if (candidate != NULL) { addr=candidate->taddr.ip; } @@ -165,11 +165,11 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) sdp_message_t_time_descr_add (local, osip_strdup ("0"), osip_strdup ("0")); if (desc->bandwidth>0) sdp_message_b_bandwidth_add (local, -1, osip_strdup ("AS"), int_2char(desc->bandwidth)); - if (desc->streams[0].ice_check_list != NULL) { + if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { char buffer[512]; - snprintf(buffer ,sizeof(buffer), "%s", ice_session_local_pwd(desc->streams[0].ice_check_list->session)); + snprintf(buffer ,sizeof(buffer), "%s", ice_session_local_pwd(ice_session)); sdp_message_a_attribute_add(local, -1, osip_strdup("ice-pwd"), osip_strdup(buffer)); - snprintf(buffer ,sizeof(buffer), "%s", ice_session_local_ufrag(desc->streams[0].ice_check_list->session)); + snprintf(buffer ,sizeof(buffer), "%s", ice_session_local_ufrag(ice_session)); sdp_message_a_attribute_add(local, -1, osip_strdup("ice-ufrag"), osip_strdup(buffer)); } @@ -212,15 +212,15 @@ static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt, boo } } -static void add_ice_candidates(sdp_message_t *msg, int lineno, const SalStreamDescription *desc) +static void add_ice_candidates(sdp_message_t *msg, int lineno, const SalStreamDescription *desc, const IceCheckList *ice_cl) { char buffer[1024]; const IceCandidate *candidate; int i; - if (desc->ice_check_list != NULL) { - for (i = 0; i < ms_list_size(desc->ice_check_list->local_candidates); i++) { - candidate = ms_list_nth_data(desc->ice_check_list->local_candidates, i); + if (ice_cl != NULL) { + for (i = 0; i < ms_list_size(ice_cl->local_candidates); i++) { + candidate = ms_list_nth_data(ice_cl->local_candidates, i); snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", candidate->foundation, candidate->componentID, candidate->priority, candidate->taddr.ip, candidate->taddr.port, ice_candidate_type(candidate)); sdp_message_a_attribute_add(msg, lineno, osip_strdup("candidate"), osip_strdup(buffer)); @@ -229,7 +229,7 @@ static void add_ice_candidates(sdp_message_t *msg, int lineno, const SalStreamDe } -static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription *desc){ +static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription *desc, const IceCheckList *ice_cl){ const char *mt=NULL; const MSList *elem; const char *addr; @@ -250,8 +250,8 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription } addr=desc->addr; port=desc->port; - if (desc->ice_check_list != NULL) { - const IceCandidate *candidate = ice_check_list_default_local_candidate(desc->ice_check_list); + if (ice_cl != NULL) { + const IceCandidate *candidate = ice_check_list_default_local_candidate(ice_cl); if (candidate != NULL) { addr=candidate->taddr.ip; port=candidate->taddr.port; @@ -342,15 +342,18 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription break; } if (dir) sdp_message_a_attribute_add (msg, lineno, osip_strdup (dir),NULL); - add_ice_candidates(msg, lineno, desc); + add_ice_candidates(msg, lineno, desc, ice_cl); } -sdp_message_t *media_description_to_sdp(const SalMediaDescription *desc){ +sdp_message_t *media_description_to_sdp(const SalMediaDescription *desc, const IceSession *ice_session){ + IceCheckList *ice_cl = NULL; int i; - sdp_message_t *msg=create_generic_sdp(desc); + sdp_message_t *msg=create_generic_sdp(desc, ice_session); for(i=0;instreams;++i){ - add_line(msg,i,&desc->streams[i]); + if (ice_session != NULL) ice_cl = ice_session_check_list(ice_session, i); + else ice_cl = NULL; + add_line(msg,i,&desc->streams[i], ice_cl); } return msg; } @@ -386,11 +389,10 @@ static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){ return 0; } -int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ +int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceSession **ice_session){ int i,j; const char *mtype,*proto,*port,*addr,*number; const char *ice_ufrag, *ice_pwd; - IceSession *ice_session = NULL; sdp_bandwidth_t *sbw=NULL; sdp_attribute_t *attr; int media_attribute_nb; @@ -515,16 +517,15 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ int nb; /* Allocate the ICE session if it has not been done yet. */ - if (ice_session == NULL) ice_session = ice_session_new(); + if (*ice_session == NULL) *ice_session = ice_session_new(); /* Allocate the ICE check list if it has not been done yet. */ - if (desc->streams[i].ice_check_list == NULL) { - desc->streams[i].ice_check_list = ice_check_list_new(); - ice_session_add_check_list(ice_session, desc->streams[i].ice_check_list); + if (ice_session_check_list(*ice_session, i) == NULL) { + ice_session_add_check_list(*ice_session, ice_check_list_new()); } nb = sscanf(attr->a_att_value, "%s %u UDP %u %s %u typ %s", foundation, &componentID, &priority, ip, &port, type); if (nb == 6) { - ice_add_remote_candidate(desc->streams[i].ice_check_list, type, ip, port, componentID, priority, foundation); + ice_add_remote_candidate(ice_session_check_list(*ice_session, i), type, ip, port, componentID, priority, foundation); } } else if ((keywordcmp("ice-ufrag", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { ice_ufrag = attr->a_att_value; @@ -532,10 +533,12 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ ice_pwd = attr->a_att_value; } } - if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { - ice_check_list_set_remote_credentials(desc->streams[i].ice_check_list, ice_ufrag, ice_pwd); + if ((*ice_session != NULL) && ice_session_check_list(*ice_session, i)) { + if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { + ice_check_list_set_remote_credentials(ice_session_check_list(*ice_session, i), ice_ufrag, ice_pwd); + } + ice_dump_candidates(ice_session_check_list(*ice_session, i)); } - if (desc->streams[i].ice_check_list) ice_dump_candidates(desc->streams[i].ice_check_list); } /* Get ICE remote ufrag and remote pwd */ ice_ufrag = ice_pwd = NULL; @@ -548,15 +551,15 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ ice_lite = TRUE; } } - if (ice_session != NULL) { + if (*ice_session != NULL) { if (ice_lite == TRUE) { - ice_session_set_role(ice_session, IR_Controlling); + ice_session_set_role(*ice_session, IR_Controlling); } else { - ice_session_set_role(ice_session, IR_Controlled); + ice_session_set_role(*ice_session, IR_Controlled); } if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { - ice_session_set_remote_credentials(ice_session, ice_ufrag, ice_pwd); - ice_dump_session(ice_session); + ice_session_set_remote_credentials(*ice_session, ice_ufrag, ice_pwd); + ice_dump_session(*ice_session); } } desc->nstreams=i; From 6066dbc5291cd86b5efafb899ee8df1b1cb856a1 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Jul 2012 09:58:59 +0200 Subject: [PATCH 351/769] Fix ICE roles. --- coreapi/sal_eXosip2_sdp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 16e709718..50c0047c3 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -396,6 +396,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS sdp_bandwidth_t *sbw=NULL; sdp_attribute_t *attr; int media_attribute_nb; + bool_t ice_session_just_created = FALSE; bool_t ice_lite = FALSE; addr=sdp_message_c_addr_get (msg, -1, 0); @@ -517,7 +518,10 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS int nb; /* Allocate the ICE session if it has not been done yet. */ - if (*ice_session == NULL) *ice_session = ice_session_new(); + if (*ice_session == NULL) { + *ice_session = ice_session_new(); + ice_session_just_created = TRUE; + } /* Allocate the ICE check list if it has not been done yet. */ if (ice_session_check_list(*ice_session, i) == NULL) { ice_session_add_check_list(*ice_session, ice_check_list_new()); @@ -552,10 +556,12 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS } } if (*ice_session != NULL) { - if (ice_lite == TRUE) { - ice_session_set_role(*ice_session, IR_Controlling); - } else { - ice_session_set_role(*ice_session, IR_Controlled); + if (ice_session_just_created == TRUE) { + if (ice_lite == TRUE) { + ice_session_set_role(*ice_session, IR_Controlling); + } else { + ice_session_set_role(*ice_session, IR_Controlled); + } } if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { ice_session_set_remote_credentials(*ice_session, ice_ufrag, ice_pwd); From ca3536d4e107e1d08a69635c47ad26debe6262ba Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Jul 2012 10:05:41 +0200 Subject: [PATCH 352/769] Fix number of media streams in 200 OK SDP. --- coreapi/sal_eXosip2_sdp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 50c0047c3..c589262f0 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -544,6 +544,8 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS ice_dump_candidates(ice_session_check_list(*ice_session, i)); } } + desc->nstreams=i; + /* Get ICE remote ufrag and remote pwd */ ice_ufrag = ice_pwd = NULL; for (i = 0; (i < SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES) && ((attr = sdp_message_attribute_get(msg, -1, i)) != NULL); i++) { @@ -568,6 +570,5 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS ice_dump_session(*ice_session); } } - desc->nstreams=i; return 0; } From 4c527f64665c9e3cb869ce9e42c39a8b7d06924b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Jul 2012 12:15:56 +0200 Subject: [PATCH 353/769] The ICE check lists are destroyed automatically when destroying the ICE session. --- coreapi/linphonecall.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5689f8dd3..90f7675eb 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1471,7 +1471,6 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ if (call->endpoint){ linphone_call_remove_from_conf(call); } - if (call->audiostream->ice_check_list) ice_check_list_destroy(call->audiostream->ice_check_list); audio_stream_stop(call->audiostream); call->audiostream=NULL; } @@ -1482,7 +1481,6 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ rtp_session_unregister_event_queue(call->videostream->session,call->videostream_app_evq); ortp_ev_queue_flush(call->videostream_app_evq); ortp_ev_queue_destroy(call->videostream_app_evq); - if (call->videostream->ice_check_list) ice_check_list_destroy(call->videostream->ice_check_list); video_stream_stop(call->videostream); call->videostream=NULL; } From 83bc61b27b9a379b4ee1f2c4390d94d3b4209af7 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Jul 2012 14:46:41 +0200 Subject: [PATCH 354/769] Callback registering is now useless (use event queues instead). --- coreapi/linphonecall.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 90f7675eb..4f4dd1c60 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -964,7 +964,6 @@ void linphone_call_init_media_streams(LinphoneCall *call){ if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ rtp_session_set_pktinfo(audiostream->session, TRUE); audiostream->ice_check_list = ice_session_check_list(ice_session, 0); - ice_check_list_register_success_cb(audiostream->ice_check_list, audio_stream_set_remote_from_ice, audiostream); } call->audiostream_app_evq = ortp_ev_queue_new(); @@ -989,7 +988,6 @@ void linphone_call_init_media_streams(LinphoneCall *call){ if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ rtp_session_set_pktinfo(call->videostream->session, TRUE); call->videostream->ice_check_list = ice_session_check_list(ice_session, 1); - ice_check_list_register_success_cb(call->videostream->ice_check_list, video_stream_set_remote_from_ice, call->videostream); } call->videostream_app_evq = ortp_ev_queue_new(); rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq); From 5f622db086efc2dd804ea067ebf47728a373f21d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Jul 2012 15:38:57 +0200 Subject: [PATCH 355/769] Send RE-INVITE when the ICE session processing finishes successfully. --- coreapi/linphonecall.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4f4dd1c60..1c30329a3 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1704,6 +1704,8 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse evd->packet = NULL; if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { + linphone_core_update_call(lc, call, &call->current_params); } ortp_event_destroy(ev); } @@ -1740,6 +1742,8 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse evd->packet = NULL; if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { + linphone_core_update_call(lc, call, &call->current_params); } ortp_event_destroy(ev); } From 4a0f37147cd41128571ff3d57c82d76c5fa13e0b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Jul 2012 17:23:57 +0200 Subject: [PATCH 356/769] Only the Controlling ICE agent sends the re-invite. --- coreapi/linphonecall.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 1c30329a3..a3e5a5781 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1705,7 +1705,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - linphone_core_update_call(lc, call, &call->current_params); + if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { + linphone_core_update_call(lc, call, &call->current_params); + } } ortp_event_destroy(ev); } @@ -1743,7 +1745,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - linphone_core_update_call(lc, call, &call->current_params); + if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { + linphone_core_update_call(lc, call, &call->current_params); + } } ortp_event_destroy(ev); } From ba85ea0b32cb771189ac8d9912e8eacebc29383c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Jul 2012 17:24:38 +0200 Subject: [PATCH 357/769] Fix putting media specific c= line in the SDP. --- coreapi/sal_eXosip2_sdp.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index c589262f0..17e1428e1 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -261,17 +261,6 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription port=desc->candidates[0].port; } - /*only add a c= line within the stream description if address are differents*/ - if (strcmp(addr,sdp_message_c_addr_get(msg, -1, 0))!=0){ - bool_t inet6; - if (strchr(addr,':')!=NULL){ - inet6=TRUE; - }else inet6=FALSE; - sdp_message_c_connection_add (msg, lineno, - osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"), - osip_strdup (addr), NULL, NULL); - } - if (desc->proto == SalProtoRtpSavp) { int i; @@ -312,6 +301,18 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription osip_strdup ("RTP/AVP")); } + + /*only add a c= line within the stream description if address are differents*/ + if (strcmp(addr,sdp_message_c_addr_get(msg, -1, 0))!=0){ + bool_t inet6; + if (strchr(addr,':')!=NULL){ + inet6=TRUE; + }else inet6=FALSE; + sdp_message_c_connection_add (msg, lineno, + osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"), + osip_strdup (addr), NULL, NULL); + } + if (desc->bandwidth>0) sdp_message_b_bandwidth_add (msg, lineno, osip_strdup ("AS"), int_2char(desc->bandwidth)); if (desc->ptime>0) sdp_message_a_attribute_add(msg,lineno,osip_strdup("ptime"), From 1ed0fa066e2c2c2502c3f45de742df5b78f75aef Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 23 Jul 2012 10:52:53 +0200 Subject: [PATCH 358/769] Re-Invite when ICE processing is finished successfully. --- coreapi/linphonecall.c | 4 +++- coreapi/sal_eXosip2_sdp.c | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a3e5a5781..1ca85fa53 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1438,7 +1438,9 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut /*also reflect the change if the "wished" params, in order to avoid to propose SAVP or video again * further in the call, for example during pause,resume, conferencing reINVITEs*/ linphone_call_fix_call_parameters(call); - if (sal_op_get_ice_session(call->op) != NULL) ice_session_pair_candidates(sal_op_get_ice_session(call->op)); + if ((sal_op_get_ice_session(call->op) != NULL) && (ice_session_state(sal_op_get_ice_session(call->op)) != IS_Completed)) { + ice_session_pair_candidates(sal_op_get_ice_session(call->op)); + } goto end; end: diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 17e1428e1..c7e80d4ca 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -145,7 +145,13 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const osip_strdup (desc->addr)); sdp_message_s_name_set (local, osip_strdup ("Talk")); if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { - const IceCandidate *candidate = ice_check_list_default_local_candidate(ice_session_check_list(ice_session, 0)); + const IceCandidate *candidate = NULL; + if (ice_session_state(ice_session) == IS_Completed) { + candidate = ice_check_list_nominated_valid_local_candidate(ice_session_check_list(ice_session, 0)); + } + else { + candidate = ice_check_list_default_local_candidate(ice_session_check_list(ice_session, 0)); + } if (candidate != NULL) { addr=candidate->taddr.ip; } @@ -167,10 +173,20 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const int_2char(desc->bandwidth)); if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { char buffer[512]; - snprintf(buffer ,sizeof(buffer), "%s", ice_session_local_pwd(ice_session)); - sdp_message_a_attribute_add(local, -1, osip_strdup("ice-pwd"), osip_strdup(buffer)); - snprintf(buffer ,sizeof(buffer), "%s", ice_session_local_ufrag(ice_session)); - sdp_message_a_attribute_add(local, -1, osip_strdup("ice-ufrag"), osip_strdup(buffer)); + switch (ice_session_state(ice_session)) { + case IS_Running: + case IS_Stopped: + snprintf(buffer, sizeof(buffer), "%s", ice_session_local_pwd(ice_session)); + sdp_message_a_attribute_add(local, -1, osip_strdup("ice-pwd"), osip_strdup(buffer)); + snprintf(buffer, sizeof(buffer), "%s", ice_session_local_ufrag(ice_session)); + sdp_message_a_attribute_add(local, -1, osip_strdup("ice-ufrag"), osip_strdup(buffer)); + break; + case IS_Completed: + sdp_message_a_attribute_add(local, -1, osip_strdup("nortpproxy"), osip_strdup("yes")); + break; + default: + break; + } } return local; @@ -251,7 +267,12 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription addr=desc->addr; port=desc->port; if (ice_cl != NULL) { - const IceCandidate *candidate = ice_check_list_default_local_candidate(ice_cl); + const IceCandidate *candidate = NULL; + if (ice_check_list_state(ice_cl) == ICL_Completed) { + candidate = ice_check_list_nominated_valid_local_candidate(ice_cl); + } else { + candidate = ice_check_list_default_local_candidate(ice_cl); + } if (candidate != NULL) { addr=candidate->taddr.ip; port=candidate->taddr.port; @@ -343,7 +364,9 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription break; } if (dir) sdp_message_a_attribute_add (msg, lineno, osip_strdup (dir),NULL); - add_ice_candidates(msg, lineno, desc, ice_cl); + if (ice_check_list_state(ice_cl) == ICL_Running) { + add_ice_candidates(msg, lineno, desc, ice_cl); + } } From 3d0f4b369b42a8ad993a30e4a30d937f35b58393 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 23 Jul 2012 12:03:17 +0200 Subject: [PATCH 359/769] Add RTCP attribute for each media stream when ICE is activated. --- coreapi/sal_eXosip2_sdp.c | 55 +++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index c7e80d4ca..4101a818e 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -145,15 +145,11 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const osip_strdup (desc->addr)); sdp_message_s_name_set (local, osip_strdup ("Talk")); if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { - const IceCandidate *candidate = NULL; if (ice_session_state(ice_session) == IS_Completed) { - candidate = ice_check_list_nominated_valid_local_candidate(ice_session_check_list(ice_session, 0)); + ice_check_list_nominated_valid_local_candidate(ice_session_check_list(ice_session, 0), &addr, NULL, NULL, NULL); } else { - candidate = ice_check_list_default_local_candidate(ice_session_check_list(ice_session, 0)); - } - if (candidate != NULL) { - addr=candidate->taddr.ip; + ice_check_list_default_local_candidate(ice_session_check_list(ice_session, 0), &addr, NULL, NULL, NULL); } } if(!sal_media_description_has_dir (desc,SalStreamSendOnly)) @@ -248,9 +244,11 @@ static void add_ice_candidates(sdp_message_t *msg, int lineno, const SalStreamDe static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription *desc, const IceCheckList *ice_cl){ const char *mt=NULL; const MSList *elem; - const char *addr; + const char *rtp_addr; + const char *rtcp_addr; const char *dir="sendrecv"; - int port; + int rtp_port; + int rtcp_port; bool_t strip_well_known_rtpmaps; switch (desc->type) { @@ -264,29 +262,25 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription mt=desc->typeother; break; } - addr=desc->addr; - port=desc->port; + rtp_addr=rtcp_addr=desc->addr; + rtp_port=desc->port; + rtcp_port=desc->port+1; if (ice_cl != NULL) { - const IceCandidate *candidate = NULL; if (ice_check_list_state(ice_cl) == ICL_Completed) { - candidate = ice_check_list_nominated_valid_local_candidate(ice_cl); + ice_check_list_nominated_valid_local_candidate(ice_cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); } else { - candidate = ice_check_list_default_local_candidate(ice_cl); - } - if (candidate != NULL) { - addr=candidate->taddr.ip; - port=candidate->taddr.port; + ice_check_list_default_local_candidate(ice_cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); } } else if (desc->candidates[0].addr[0]!='\0'){ - addr=desc->candidates[0].addr; - port=desc->candidates[0].port; + rtp_addr=desc->candidates[0].addr; + rtp_port=desc->candidates[0].port; } if (desc->proto == SalProtoRtpSavp) { int i; sdp_message_m_media_add (msg, osip_strdup (mt), - int_2char (port), NULL, + int_2char (rtp_port), NULL, osip_strdup ("RTP/SAVP")); /* add crypto lines */ @@ -318,20 +312,20 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription } else { sdp_message_m_media_add (msg, osip_strdup (mt), - int_2char (port), NULL, + int_2char (rtp_port), NULL, osip_strdup ("RTP/AVP")); } /*only add a c= line within the stream description if address are differents*/ - if (strcmp(addr,sdp_message_c_addr_get(msg, -1, 0))!=0){ + if (strcmp(rtp_addr,sdp_message_c_addr_get(msg, -1, 0))!=0){ bool_t inet6; - if (strchr(addr,':')!=NULL){ + if (strchr(rtp_addr,':')!=NULL){ inet6=TRUE; }else inet6=FALSE; sdp_message_c_connection_add (msg, lineno, osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"), - osip_strdup (addr), NULL, NULL); + osip_strdup (rtp_addr), NULL, NULL); } if (desc->bandwidth>0) sdp_message_b_bandwidth_add (msg, lineno, osip_strdup ("AS"), @@ -364,8 +358,17 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription break; } if (dir) sdp_message_a_attribute_add (msg, lineno, osip_strdup (dir),NULL); - if (ice_check_list_state(ice_cl) == ICL_Running) { - add_ice_candidates(msg, lineno, desc, ice_cl); + if (ice_cl != NULL) { + if (strcmp(rtp_addr, rtcp_addr) != 0) { + char buffer[1024]; + snprintf(buffer, sizeof(buffer), "%u IN IP4 %s", rtcp_port, rtcp_addr); + sdp_message_a_attribute_add(msg, lineno, osip_strdup("rtcp"), osip_strdup(buffer)); + } else { + sdp_message_a_attribute_add(msg, lineno, osip_strdup("rtcp"), int_2char(rtcp_port)); + } + if (ice_check_list_state(ice_cl) == ICL_Running) { + add_ice_candidates(msg, lineno, desc, ice_cl); + } } } From 55cb3fa3ed9cf344004adf26c386adc20a0078df Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 23 Jul 2012 13:37:10 +0200 Subject: [PATCH 360/769] Parse the rtcp attribute in the SDP if present. --- coreapi/linphonecall.c | 32 +++++++++++----------- coreapi/offeranswer.c | 24 ++++++++--------- coreapi/sal.c | 8 +++--- coreapi/sal.h | 6 +++-- coreapi/sal_eXosip2.c | 6 ++--- coreapi/sal_eXosip2_sdp.c | 57 +++++++++++++++++++++++++-------------- 6 files changed, 76 insertions(+), 57 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 1ca85fa53..825e56797 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -211,8 +211,8 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->bandwidth=linphone_core_get_download_bandwidth(lc); /*set audio capabilities */ - strncpy(md->streams[0].addr,call->localip,sizeof(md->streams[0].addr)); - md->streams[0].port=call->audio_port; + strncpy(md->streams[0].rtp_addr,call->localip,sizeof(md->streams[0].rtp_addr)); + md->streams[0].rtp_port=call->audio_port; md->streams[0].proto=(call->params.media_encryption == LinphoneMediaEncryptionSRTP) ? SalProtoRtpSavp : SalProtoRtpAvp; md->streams[0].type=SalAudio; @@ -226,7 +226,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li if (call->params.has_video){ md->nstreams++; - md->streams[1].port=call->video_port; + md->streams[1].rtp_port=call->video_port; md->streams[1].proto=md->streams[0].proto; md->streams[1].type=SalVideo; l=make_codec_list(lc,lc->codecs_conf.video_codecs,0,NULL); @@ -607,7 +607,7 @@ const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall * } static bool_t is_video_active(const SalStreamDescription *sd){ - return sd->port!=0 && sd->dir!=SalStreamInactive; + return sd->rtp_port!=0 && sd->dir!=SalStreamInactive; } /** @@ -930,7 +930,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ AudioStream *audiostream; IceSession *ice_session = sal_op_get_ice_session(call->op); - call->audiostream=audiostream=audio_stream_new(md->streams[0].port,linphone_core_ipv6_enabled(lc)); + call->audiostream=audiostream=audio_stream_new(md->streams[0].rtp_port,linphone_core_ipv6_enabled(lc)); if (linphone_core_echo_limiter_enabled(lc)){ const char *type=lp_config_get_string(lc->config,"sound","el_type","mic"); if (strcasecmp(type,"mic")==0) @@ -971,9 +971,9 @@ void linphone_call_init_media_streams(LinphoneCall *call){ #ifdef VIDEO_ENABLED - if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){ + if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].rtp_port>0){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); - call->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc)); + call->videostream=video_stream_new(md->streams[1].rtp_port,linphone_core_ipv6_enabled(lc)); video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0)); if (video_recv_buf_size>0) rtp_session_set_recv_buf_size(call->videostream->session,video_recv_buf_size); @@ -1189,7 +1189,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna stream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpAvp,SalAudio); - if (stream && stream->dir!=SalStreamInactive && stream->port!=0){ + if (stream && stream->dir!=SalStreamInactive && stream->rtp_port!=0){ MSSndCard *playcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard; MSSndCard *captcard=lc->sound_conf.capt_sndcard; @@ -1208,7 +1208,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna } /*Replace soundcard filters by inactive file players or recorders when placed in recvonly or sendonly mode*/ - if (stream->port==0 || stream->dir==SalStreamRecvOnly){ + if (stream->rtp_port==0 || stream->dir==SalStreamRecvOnly){ captcard=NULL; playfile=NULL; }else if (stream->dir==SalStreamSendOnly){ @@ -1242,9 +1242,9 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna audio_stream_start_full( call->audiostream, call->audio_profile, - stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr, - stream->port, - linphone_core_rtcp_enabled(lc) ? (stream->port+1) : 0, + stream->rtp_addr[0]!='\0' ? stream->rtp_addr : call->resultdesc->addr, + stream->rtp_port, + linphone_core_rtcp_enabled(lc) ? (stream->rtp_port+1) : 0, used_pt, jitt_comp, playfile, @@ -1312,8 +1312,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna lc->previewstream=NULL; } - if (vstream!=NULL && vstream->dir!=SalStreamInactive && vstream->port!=0) { - const char *addr=vstream->addr[0]!='\0' ? vstream->addr : call->resultdesc->addr; + if (vstream!=NULL && vstream->dir!=SalStreamInactive && vstream->rtp_port!=0) { + const char *addr=vstream->rtp_addr[0]!='\0' ? vstream->rtp_addr : call->resultdesc->addr; call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt); if (used_pt!=-1){ call->current_params.video_codec = rtp_profile_get_payload(call->video_profile, used_pt); @@ -1359,8 +1359,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); video_stream_set_device_rotation(call->videostream, lc->device_rotation); video_stream_start(call->videostream, - call->video_profile, addr, vstream->port, - linphone_core_rtcp_enabled(lc) ? (vstream->port+1) : 0, + call->video_profile, addr, vstream->rtp_port, + linphone_core_rtcp_enabled(lc) ? (vstream->rtp_port+1) : 0, used_pt, lc->rtp_conf.audio_jitt_comp, cam); video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); } diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 5a2b4f527..62782921c 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -203,25 +203,25 @@ static SalStreamDir compute_dir_incoming(SalStreamDir local, SalStreamDir offere static void initiate_outgoing(const SalStreamDescription *local_offer, const SalStreamDescription *remote_answer, SalStreamDescription *result){ - if (remote_answer->port!=0) + if (remote_answer->rtp_port!=0) result->payloads=match_payloads(local_offer->payloads,remote_answer->payloads,TRUE,FALSE); result->proto=remote_answer->proto; result->type=local_offer->type; result->dir=compute_dir_outgoing(local_offer->dir,remote_answer->dir); if (result->payloads && !only_telephone_event(result->payloads)){ - strcpy(result->addr,remote_answer->addr); - result->port=remote_answer->port; + strcpy(result->rtp_addr,remote_answer->rtp_addr); + result->rtp_port=remote_answer->rtp_port; result->bandwidth=remote_answer->bandwidth; result->ptime=remote_answer->ptime; }else{ - result->port=0; + result->rtp_port=0; } if (result->proto == SalProtoRtpSavp) { /* verify crypto algo */ memset(result->crypto, 0, sizeof(result->crypto)); if (!match_crypto_algo(local_offer->crypto, remote_answer->crypto, &result->crypto[0], &result->crypto_local_tag, FALSE)) - result->port = 0; + result->rtp_port = 0; } } @@ -233,20 +233,20 @@ static void initiate_incoming(const SalStreamDescription *local_cap, result->proto=remote_offer->proto; result->type=local_cap->type; result->dir=compute_dir_incoming(local_cap->dir,remote_offer->dir); - if (result->payloads && !only_telephone_event(result->payloads) && (remote_offer->port!=0 || remote_offer->port==SalStreamSendOnly)){ - strcpy(result->addr,local_cap->addr); + if (result->payloads && !only_telephone_event(result->payloads) && (remote_offer->rtp_port!=0 || remote_offer->rtp_port==SalStreamSendOnly)){ + strcpy(result->rtp_addr,local_cap->rtp_addr); memcpy(result->candidates,local_cap->candidates,sizeof(result->candidates)); - result->port=local_cap->port; + result->rtp_port=local_cap->rtp_port; result->bandwidth=local_cap->bandwidth; - result->ptime=local_cap->ptime; + result->ptime=local_cap->ptime; }else{ - result->port=0; + result->rtp_port=0; } if (result->proto == SalProtoRtpSavp) { /* select crypto algo */ memset(result->crypto, 0, sizeof(result->crypto)); if (!match_crypto_algo(local_cap->crypto, remote_offer->crypto, &result->crypto[0], &result->crypto_local_tag, TRUE)) - result->port = 0; + result->rtp_port = 0; } } @@ -303,7 +303,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities else { /* create an inactive stream for the answer, as there where no matching stream a local capability */ result->streams[i].dir=SalStreamInactive; - result->streams[i].port=0; + result->streams[i].rtp_port=0; result->streams[i].type=rs->type; result->streams[i].proto=rs->proto; if (rs->type==SalOther){ diff --git a/coreapi/sal.c b/coreapi/sal.c index 37e56fade..de812c4fb 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -87,7 +87,7 @@ bool_t sal_media_description_empty(const SalMediaDescription *md){ int i; for(i=0;instreams;++i){ const SalStreamDescription *ss=&md->streams[i]; - if (ss->port!=0) return FALSE; + if (ss->rtp_port!=0) return FALSE; } return TRUE; } @@ -114,7 +114,7 @@ static bool_t has_dir(const SalMediaDescription *md, SalStreamDir stream_dir){ const SalStreamDescription *ss=&md->streams[i]; if (ss->dir==stream_dir) return TRUE; /*compatibility check for phones that only used the null address and no attributes */ - if (ss->dir==SalStreamSendRecv && stream_dir==SalStreamSendOnly && (is_null_address(md->addr) || is_null_address(ss->addr))) + if (ss->dir==SalStreamSendRecv && stream_dir==SalStreamSendOnly && (is_null_address(md->addr) || is_null_address(ss->rtp_addr))) return TRUE; } return FALSE; @@ -180,8 +180,8 @@ static bool_t payload_list_equals(const MSList *l1, const MSList *l2){ bool_t sal_stream_description_equals(const SalStreamDescription *sd1, const SalStreamDescription *sd2){ if (sd1->proto!=sd2->proto) return FALSE; if (sd1->type!=sd2->type) return FALSE; - if (strcmp(sd1->addr,sd2->addr)!=0) return FALSE; - if (sd1->port!=sd2->port) return FALSE; + if (strcmp(sd1->rtp_addr,sd2->rtp_addr)!=0) return FALSE; + if (sd1->rtp_port!=sd2->rtp_port) return FALSE; if (!payload_list_equals(sd1->payloads,sd2->payloads)) return FALSE; if (sd1->bandwidth!=sd2->bandwidth) return FALSE; if (sd1->ptime!=sd2->ptime) return FALSE; diff --git a/coreapi/sal.h b/coreapi/sal.h index 8782226b8..8a51fa4a4 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -126,8 +126,10 @@ typedef struct SalStreamDescription{ SalMediaProto proto; SalStreamType type; char typeother[32]; - char addr[64]; - int port; + char rtp_addr[64]; + char rtcp_addr[64]; + int rtp_port; + int rtcp_port; MSList *payloads; //result->bandwidth=h->base.remote_media->bandwidth; for(i=0;iresult->nstreams;++i){ - if (h->result->streams[i].port>0){ - strcpy(h->result->streams[i].addr,h->base.remote_media->streams[i].addr); + if (h->result->streams[i].rtp_port>0){ + strcpy(h->result->streams[i].rtp_addr,h->base.remote_media->streams[i].rtp_addr); h->result->streams[i].ptime=h->base.remote_media->streams[i].ptime; h->result->streams[i].bandwidth=h->base.remote_media->streams[i].bandwidth; - h->result->streams[i].port=h->base.remote_media->streams[i].port; + h->result->streams[i].rtp_port=h->base.remote_media->streams[i].rtp_port; if (h->result->streams[i].proto == SalProtoRtpSavp) { h->result->streams[i].crypto[0] = h->base.remote_media->streams[i].crypto[0]; diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 4101a818e..7cf668ca1 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -130,7 +130,7 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const int inet6; char sessid[16]; char sessver[16]; - const char *addr = desc->addr; + const char *rtp_addr = desc->addr; snprintf(sessid,16,"%i",desc->session_id); snprintf(sessver,16,"%i",desc->session_ver); @@ -146,17 +146,17 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const sdp_message_s_name_set (local, osip_strdup ("Talk")); if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { if (ice_session_state(ice_session) == IS_Completed) { - ice_check_list_nominated_valid_local_candidate(ice_session_check_list(ice_session, 0), &addr, NULL, NULL, NULL); + ice_check_list_nominated_valid_local_candidate(ice_session_check_list(ice_session, 0), &rtp_addr, NULL, NULL, NULL); } else { - ice_check_list_default_local_candidate(ice_session_check_list(ice_session, 0), &addr, NULL, NULL, NULL); + ice_check_list_default_local_candidate(ice_session_check_list(ice_session, 0), &rtp_addr, NULL, NULL, NULL); } } if(!sal_media_description_has_dir (desc,SalStreamSendOnly)) { sdp_message_c_connection_add (local, -1, osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"), - osip_strdup (addr), NULL, NULL); + osip_strdup (rtp_addr), NULL, NULL); } else { @@ -262,9 +262,9 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription mt=desc->typeother; break; } - rtp_addr=rtcp_addr=desc->addr; - rtp_port=desc->port; - rtcp_port=desc->port+1; + rtp_addr=rtcp_addr=desc->rtp_addr; + rtp_port=desc->rtp_port; + rtcp_port=desc->rtcp_port; if (ice_cl != NULL) { if (ice_check_list_state(ice_cl) == ICL_Completed) { ice_check_list_nominated_valid_local_candidate(ice_cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); @@ -418,21 +418,21 @@ static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceSession **ice_session){ int i,j; - const char *mtype,*proto,*port,*addr,*number; + const char *mtype,*proto,*rtp_port,*rtp_addr,*number; const char *ice_ufrag, *ice_pwd; sdp_bandwidth_t *sbw=NULL; sdp_attribute_t *attr; int media_attribute_nb; bool_t ice_session_just_created = FALSE; bool_t ice_lite = FALSE; - - addr=sdp_message_c_addr_get (msg, -1, 0); - if (addr) - strncpy(desc->addr,addr,sizeof(desc->addr)); + + rtp_addr=sdp_message_c_addr_get (msg, -1, 0); + if (rtp_addr) + strncpy(desc->addr,rtp_addr,sizeof(desc->addr)); for(j=0;(sbw=sdp_message_bandwidth_get(msg,-1,j))!=NULL;++j){ if (strcasecmp(sbw->b_bwtype,"AS")==0) desc->bandwidth=atoi(sbw->b_bandwidth); } - + /* for each m= line */ for (i=0; !sdp_message_endof_media (msg, i) && iproto=SalProtoUnknown; if (proto){ if (strcasecmp(proto,"RTP/AVP")==0) @@ -450,11 +450,11 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS stream->proto=SalProtoRtpSavp; } } - addr = sdp_message_c_addr_get (msg, i, 0); - if (addr != NULL) - strncpy(stream->addr,addr,sizeof(stream->addr)); - if (port) - stream->port=atoi(port); + rtp_addr = sdp_message_c_addr_get (msg, i, 0); + if (rtp_addr != NULL) + strncpy(stream->rtp_addr,rtp_addr,sizeof(stream->rtp_addr)); + if (rtp_port) + stream->rtp_port=atoi(rtp_port); stream->ptime=_sdp_message_get_a_ptime(msg,i); if (strcasecmp("audio", mtype) == 0){ @@ -489,7 +489,24 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS pt->send_fmtp ? pt->send_fmtp : ""); } } - + + /* Get media specific RTCP attribute */ + stream->rtcp_port = stream->rtp_port + 1; + snprintf(stream->rtcp_addr, sizeof(stream->rtcp_addr), stream->rtp_addr); + for (j = 0; ((attr = sdp_message_attribute_get(msg, i, j)) != NULL); j++) { + if ((keywordcmp("rtcp", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + char tmp[256]; + int nb = sscanf(attr->a_att_value, "%d IN IP4 %s", &stream->rtcp_port, tmp); + if (nb == 1) { + /* SDP rtcp attribute only contains the port */ + } else if (nb == 2) { + strncpy(stream->rtcp_addr, tmp, sizeof(stream->rtcp_addr)); + } else { + ms_warning("sdp has a strange a= line (%s) nb=%i", attr->a_att_value, nb); + } + } + } + /* read crypto lines if any */ if (stream->proto == SalProtoRtpSavp) { int k, valid_count = 0; From f97f51d4f38eaaa4380ff281d258021e9c00f65c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 23 Jul 2012 14:28:19 +0200 Subject: [PATCH 361/769] Specify local RTCP port explicitly. --- console/sipomatic.c | 2 +- coreapi/conference.c | 2 +- coreapi/linphonecall.c | 11 +++++++---- coreapi/offeranswer.c | 4 ++++ coreapi/sal.c | 2 ++ coreapi/sal_eXosip2.c | 2 ++ media_api/mediaflow.c | 2 +- 7 files changed, 18 insertions(+), 7 deletions(-) diff --git a/console/sipomatic.c b/console/sipomatic.c index e0d3f67e7..e7a1c6a88 100644 --- a/console/sipomatic.c +++ b/console/sipomatic.c @@ -97,7 +97,7 @@ void call_accept(Call *call) osip_message_set_content_type(msg,"application/sdp"); osip_message_set_body(msg,call->sdpc->answerstr,strlen(call->sdpc->answerstr)); eXosip_call_send_answer(call->tid,200,msg); - call->audio_stream=audio_stream_new(call->audio.localport,call->root->ipv6); + call->audio_stream=audio_stream_new(call->audio.localport,call->audio.localport+1,call->root->ipv6); audio_stream_start_with_files(call->audio_stream, call->profile, call->audio.remaddr,call->audio.remoteport,call->audio.remoteport+1, call->audio.pt,20,hellofile,record_file); diff --git a/coreapi/conference.c b/coreapi/conference.c index d4abc1a91..1b6903fd0 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -104,7 +104,7 @@ static RtpProfile *make_dummy_profile(int samplerate){ static void add_local_endpoint(LinphoneConference *conf,LinphoneCore *lc){ /*create a dummy audiostream in order to extract the local part of it */ /* network address and ports have no meaning and are not used here. */ - AudioStream *st=audio_stream_new(65000,FALSE); + AudioStream *st=audio_stream_new(65000,65001,FALSE); MSSndCard *playcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard; MSSndCard *captcard=lc->sound_conf.capt_sndcard; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 825e56797..432adc348 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -212,7 +212,9 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li /*set audio capabilities */ strncpy(md->streams[0].rtp_addr,call->localip,sizeof(md->streams[0].rtp_addr)); + strncpy(md->streams[0].rtcp_addr,call->localip,sizeof(md->streams[0].rtcp_addr)); md->streams[0].rtp_port=call->audio_port; + md->streams[0].rtcp_port=call->audio_port+1; md->streams[0].proto=(call->params.media_encryption == LinphoneMediaEncryptionSRTP) ? SalProtoRtpSavp : SalProtoRtpAvp; md->streams[0].type=SalAudio; @@ -227,6 +229,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li if (call->params.has_video){ md->nstreams++; md->streams[1].rtp_port=call->video_port; + md->streams[1].rtcp_port=call->video_port+1; md->streams[1].proto=md->streams[0].proto; md->streams[1].type=SalVideo; l=make_codec_list(lc,lc->codecs_conf.video_codecs,0,NULL); @@ -930,7 +933,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ AudioStream *audiostream; IceSession *ice_session = sal_op_get_ice_session(call->op); - call->audiostream=audiostream=audio_stream_new(md->streams[0].rtp_port,linphone_core_ipv6_enabled(lc)); + call->audiostream=audiostream=audio_stream_new(md->streams[0].rtp_port,md->streams[0].rtcp_port,linphone_core_ipv6_enabled(lc)); if (linphone_core_echo_limiter_enabled(lc)){ const char *type=lp_config_get_string(lc->config,"sound","el_type","mic"); if (strcasecmp(type,"mic")==0) @@ -973,7 +976,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].rtp_port>0){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); - call->videostream=video_stream_new(md->streams[1].rtp_port,linphone_core_ipv6_enabled(lc)); + call->videostream=video_stream_new(md->streams[1].rtp_port,md->streams[1].rtcp_port,linphone_core_ipv6_enabled(lc)); video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0)); if (video_recv_buf_size>0) rtp_session_set_recv_buf_size(call->videostream->session,video_recv_buf_size); @@ -1244,7 +1247,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna call->audio_profile, stream->rtp_addr[0]!='\0' ? stream->rtp_addr : call->resultdesc->addr, stream->rtp_port, - linphone_core_rtcp_enabled(lc) ? (stream->rtp_port+1) : 0, + linphone_core_rtcp_enabled(lc) ? (stream->rtcp_port) : 0, used_pt, jitt_comp, playfile, @@ -1360,7 +1363,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna video_stream_set_device_rotation(call->videostream, lc->device_rotation); video_stream_start(call->videostream, call->video_profile, addr, vstream->rtp_port, - linphone_core_rtcp_enabled(lc) ? (vstream->rtp_port+1) : 0, + linphone_core_rtcp_enabled(lc) ? (vstream->rtcp_port) : 0, used_pt, lc->rtp_conf.audio_jitt_comp, cam); video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); } diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 62782921c..118f2420a 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -211,7 +211,9 @@ static void initiate_outgoing(const SalStreamDescription *local_offer, if (result->payloads && !only_telephone_event(result->payloads)){ strcpy(result->rtp_addr,remote_answer->rtp_addr); + strcpy(result->rtcp_addr,remote_answer->rtcp_addr); result->rtp_port=remote_answer->rtp_port; + result->rtcp_port=remote_answer->rtcp_port; result->bandwidth=remote_answer->bandwidth; result->ptime=remote_answer->ptime; }else{ @@ -235,8 +237,10 @@ static void initiate_incoming(const SalStreamDescription *local_cap, result->dir=compute_dir_incoming(local_cap->dir,remote_offer->dir); if (result->payloads && !only_telephone_event(result->payloads) && (remote_offer->rtp_port!=0 || remote_offer->rtp_port==SalStreamSendOnly)){ strcpy(result->rtp_addr,local_cap->rtp_addr); + strcpy(result->rtcp_addr,local_cap->rtcp_addr); memcpy(result->candidates,local_cap->candidates,sizeof(result->candidates)); result->rtp_port=local_cap->rtp_port; + result->rtcp_port=local_cap->rtcp_port; result->bandwidth=local_cap->bandwidth; result->ptime=local_cap->ptime; }else{ diff --git a/coreapi/sal.c b/coreapi/sal.c index de812c4fb..5b592b8d3 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -182,6 +182,8 @@ bool_t sal_stream_description_equals(const SalStreamDescription *sd1, const SalS if (sd1->type!=sd2->type) return FALSE; if (strcmp(sd1->rtp_addr,sd2->rtp_addr)!=0) return FALSE; if (sd1->rtp_port!=sd2->rtp_port) return FALSE; + if (strcmp(sd1->rtcp_addr,sd2->rtcp_addr)!=0) return FALSE; + if (sd1->rtcp_port!=sd2->rtcp_port) return FALSE; if (!payload_list_equals(sd1->payloads,sd2->payloads)) return FALSE; if (sd1->bandwidth!=sd2->bandwidth) return FALSE; if (sd1->ptime!=sd2->ptime) return FALSE; diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index fe5e1b8e7..42f11eca0 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -535,9 +535,11 @@ static void sdp_process(SalOp *h){ for(i=0;iresult->nstreams;++i){ if (h->result->streams[i].rtp_port>0){ strcpy(h->result->streams[i].rtp_addr,h->base.remote_media->streams[i].rtp_addr); + strcpy(h->result->streams[i].rtcp_addr,h->base.remote_media->streams[i].rtcp_addr); h->result->streams[i].ptime=h->base.remote_media->streams[i].ptime; h->result->streams[i].bandwidth=h->base.remote_media->streams[i].bandwidth; h->result->streams[i].rtp_port=h->base.remote_media->streams[i].rtp_port; + h->result->streams[i].rtcp_port=h->base.remote_media->streams[i].rtcp_port; if (h->result->streams[i].proto == SalProtoRtpSavp) { h->result->streams[i].crypto[0] = h->base.remote_media->streams[i].crypto[0]; diff --git a/media_api/mediaflow.c b/media_api/mediaflow.c index 8ccdadb71..e0e6be403 100644 --- a/media_api/mediaflow.c +++ b/media_api/mediaflow.c @@ -109,7 +109,7 @@ MSFilter *set_MSFilter(EndPoint *endpoint, int type, FlowDirections *fdir){ switch(endpoint->protocol){ case MEDIA_RTP: rtps = rtp_session_new(RTP_SESSION_RECVONLY); - rtp_session_set_local_addr(rtps,"0.0.0.0",8000); + rtp_session_set_local_addr(rtps,"0.0.0.0",8000,8001); rtp_session_set_scheduling_mode(rtps,0); rtp_session_set_blocking_mode(rtps,0); From ebdfca041b1a6b7479c688693f6092b2075424b6 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 23 Jul 2012 15:26:18 +0200 Subject: [PATCH 362/769] Specify remote RTCP address explicitly. --- coreapi/conference.c | 1 + coreapi/linphonecall.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/coreapi/conference.c b/coreapi/conference.c index 1b6903fd0..5ca465254 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -114,6 +114,7 @@ static void add_local_endpoint(LinphoneConference *conf,LinphoneCore *lc){ audio_stream_start_full(st, conf->local_dummy_profile, "127.0.0.1", 65000, + "127.0.0.1", 65001, 0, 40, diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 432adc348..f42a9ba06 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1247,6 +1247,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna call->audio_profile, stream->rtp_addr[0]!='\0' ? stream->rtp_addr : call->resultdesc->addr, stream->rtp_port, + stream->rtcp_addr[0]!='\0' ? stream->rtcp_addr : call->resultdesc->addr, linphone_core_rtcp_enabled(lc) ? (stream->rtcp_port) : 0, used_pt, jitt_comp, @@ -1316,7 +1317,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna } if (vstream!=NULL && vstream->dir!=SalStreamInactive && vstream->rtp_port!=0) { - const char *addr=vstream->rtp_addr[0]!='\0' ? vstream->rtp_addr : call->resultdesc->addr; + const char *rtp_addr=vstream->rtp_addr[0]!='\0' ? vstream->rtp_addr : call->resultdesc->addr; + const char *rtcp_addr=vstream->rtcp_addr[0]!='\0' ? vstream->rtcp_addr : call->resultdesc->addr; call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt); if (used_pt!=-1){ call->current_params.video_codec = rtp_profile_get_payload(call->video_profile, used_pt); @@ -1362,8 +1364,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); video_stream_set_device_rotation(call->videostream, lc->device_rotation); video_stream_start(call->videostream, - call->video_profile, addr, vstream->rtp_port, - linphone_core_rtcp_enabled(lc) ? (vstream->rtcp_port) : 0, + call->video_profile, rtp_addr, vstream->rtp_port, + rtcp_addr, linphone_core_rtcp_enabled(lc) ? (vstream->rtcp_port) : 0, used_pt, lc->rtp_conf.audio_jitt_comp, cam); video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); } From 0121763b41b4ee42b0d5722908af7edf8b04cb7e Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 24 Jul 2012 11:37:48 +0200 Subject: [PATCH 363/769] ms2 update --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 3ad17dab4..cb0ef89e9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3ad17dab4138c1a4fa1536388caced23a5610e6a +Subproject commit cb0ef89e9fd1ef936fd4168fd89f41616caed382 From d3b07fe32d066237f471f20f00290a6ee4fcecff Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 24 Jul 2012 15:04:19 +0200 Subject: [PATCH 364/769] Eliminate ICE redundant candidates. --- coreapi/misc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index 1dadcb335..82f1dd1c1 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -675,6 +675,7 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) && (!call->params.has_video || ((video_responses[0] == TRUE) && (video_responses[1] == TRUE))))); ice_session_compute_candidates_foundations(ice_session); + ice_session_eliminate_redundant_candidates(ice_session); ice_session_choose_default_candidates(ice_session); close_socket(audio_socks[0]); From b11704376f70949b23338b43377a2d05715a1311 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 24 Jul 2012 16:03:55 +0200 Subject: [PATCH 365/769] Good timing handling for STUN request during ICE candidates gathering. --- coreapi/misc.c | 116 ++++++++++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 49 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 82f1dd1c1..2f887bf0c 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -564,22 +564,25 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) { + typedef struct _st_gathering { + ortp_socket_t sock; + bool_t response; + IceCandidate *base; + struct timeval transmission_time; + } gathering_t; + char local_addr[64]; char addr[64]; int port; int id; - ortp_socket_t audio_socks[2]; - ortp_socket_t video_socks[2]; - bool_t audio_responses[2]; - bool_t video_responses[2]; - IceCandidate *audio_ice_bases[2]; - IceCandidate *video_ice_bases[2]; + gathering_t audio_gatherings[2]; + gathering_t video_gatherings[2]; IceCheckList *audio_check_list; IceCheckList *video_check_list; IceSession *ice_session = sal_op_get_ice_session(call->op); struct sockaddr_storage ss; socklen_t ss_len; - struct timeval init, cur; + struct timeval init, cur, diff; double elapsed; int loops = 0; const char *server = linphone_core_get_stun_server(lc); @@ -601,42 +604,57 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) if (lc->vtable.display_status != NULL) lc->vtable.display_status(lc, _("ICE local candidates gathering in progress...")); - audio_responses[0] = audio_responses[1] = FALSE; - video_responses[0] = video_responses[1] = FALSE; - audio_ice_bases[0] = audio_ice_bases[1] = NULL; - video_ice_bases[0] = video_ice_bases[1] = NULL; - audio_socks[0] = create_socket(call->audio_port); - if (audio_socks[0] == -1) return; - audio_socks[1] = create_socket(call->audio_port + 1); - if (audio_socks[1] == -1) return; + audio_gatherings[0].response = audio_gatherings[1].response = FALSE; + video_gatherings[0].response = video_gatherings[1].response = FALSE; + audio_gatherings[0].base = audio_gatherings[1].base = NULL; + video_gatherings[0].base = video_gatherings[1].base = NULL; + audio_gatherings[0].sock = create_socket(call->audio_port); + if (audio_gatherings[0].sock == -1) return; + audio_gatherings[1].sock = create_socket(call->audio_port + 1); + if (audio_gatherings[1].sock == -1) return; if (call->params.has_video) { - video_socks[0] = create_socket(call->video_port); - if (video_socks[0] == -1) return; - video_socks[1] = create_socket(call->video_port + 1); - if (video_socks[1] == -1) return; + video_gatherings[0].sock = create_socket(call->video_port); + if (video_gatherings[0].sock == -1) return; + video_gatherings[1].sock = create_socket(call->video_port + 1); + if (video_gatherings[1].sock == -1) return; } else { - video_socks[0] = video_socks[1] = -1; + video_gatherings[0].sock = video_gatherings[1].sock = -1; } if (linphone_core_get_local_ip_for(AF_INET, NULL, local_addr) < 0) { ms_error("Fail to get local ip"); return; } - audio_ice_bases[0] = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); - audio_ice_bases[1] = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); + audio_gatherings[0].base = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); + audio_gatherings[1].base = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); if (call->params.has_video && (video_check_list != NULL)) { - video_ice_bases[0] = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); - video_ice_bases[1] = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); + video_gatherings[0].base = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); + video_gatherings[1].base = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); } gettimeofday(&init, NULL); + audio_gatherings[0].transmission_time = cur = init; + diff.tv_sec = 0, diff.tv_usec = 20000; + timeradd(&audio_gatherings[0].transmission_time, &diff, &audio_gatherings[1].transmission_time); + timeradd(&audio_gatherings[1].transmission_time, &diff, &video_gatherings[0].transmission_time); + timeradd(&video_gatherings[0].transmission_time, &diff, &video_gatherings[1].transmission_time); + diff.tv_sec = 0, diff.tv_usec = 100000; do { - if (loops % 20 == 0) { - ms_message("Sending stun requests..."); - if (audio_responses[0] == FALSE) sendStunRequest(audio_socks[0], (struct sockaddr*)&ss, ss_len, 1, FALSE); - if (audio_responses[1] == FALSE) sendStunRequest(audio_socks[1], (struct sockaddr*)&ss, ss_len, 1, FALSE); - if (call->params.has_video) { - if (video_responses[0] == FALSE) sendStunRequest(video_socks[0], (struct sockaddr*)&ss, ss_len, 2, FALSE); - if (video_responses[1] == FALSE) sendStunRequest(video_socks[1], (struct sockaddr*)&ss, ss_len, 2, FALSE); + if ((audio_gatherings[0].response == FALSE) && timercmp(&cur, &audio_gatherings[0].transmission_time, >=)) { + timeradd(&audio_gatherings[0].transmission_time, &diff, &audio_gatherings[0].transmission_time); + sendStunRequest(audio_gatherings[0].sock, (struct sockaddr*)&ss, ss_len, 1, FALSE); + } + if ((audio_gatherings[1].response == FALSE) && timercmp(&cur, &audio_gatherings[1].transmission_time, >=)) { + timeradd(&audio_gatherings[1].transmission_time, &diff, &audio_gatherings[1].transmission_time); + sendStunRequest(audio_gatherings[1].sock, (struct sockaddr*)&ss, ss_len, 1, FALSE); + } + if (call->params.has_video) { + if ((video_gatherings[0].response == FALSE) && timercmp(&cur, &video_gatherings[0].transmission_time, >=)) { + timeradd(&video_gatherings[0].transmission_time, &diff, &video_gatherings[0].transmission_time); + sendStunRequest(video_gatherings[0].sock, (struct sockaddr*)&ss, ss_len, 2, FALSE); + } + if ((video_gatherings[1].response == FALSE) && timercmp(&cur, &video_gatherings[1].transmission_time, >=)) { + timeradd(&video_gatherings[1].transmission_time, &diff, &video_gatherings[1].transmission_time); + sendStunRequest(video_gatherings[1].sock, (struct sockaddr*)&ss, ss_len, 2, FALSE); } } #ifdef WIN32 @@ -645,22 +663,22 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) usleep(10000); #endif - if (recvStunResponse(audio_socks[0], addr, &port, &id) > 0) { - ice_add_local_candidate(audio_check_list, "srflx", addr, port, 1, audio_ice_bases[0]); - audio_responses[0] = TRUE; + if (recvStunResponse(audio_gatherings[0].sock, addr, &port, &id) > 0) { + ice_add_local_candidate(audio_check_list, "srflx", addr, port, 1, audio_gatherings[0].base); + audio_gatherings[0].response = TRUE; } - if (recvStunResponse(audio_socks[1], addr, &port, &id) > 0) { - ice_add_local_candidate(audio_check_list, "srflx", addr, port, 2, audio_ice_bases[1]); - audio_responses[1] = TRUE; + if (recvStunResponse(audio_gatherings[1].sock, addr, &port, &id) > 0) { + ice_add_local_candidate(audio_check_list, "srflx", addr, port, 2, audio_gatherings[1].base); + audio_gatherings[1].response = TRUE; } if (call->params.has_video && (video_check_list != NULL)) { - if (recvStunResponse(video_socks[0], addr, &port, &id) > 0) { - ice_add_local_candidate(video_check_list, "srflx", addr, port, 1, video_ice_bases[0]); - video_responses[0] = TRUE; + if (recvStunResponse(video_gatherings[0].sock, addr, &port, &id) > 0) { + ice_add_local_candidate(video_check_list, "srflx", addr, port, 1, video_gatherings[0].base); + video_gatherings[0].response = TRUE; } - if (recvStunResponse(video_socks[1], addr, &port, &id) > 0) { - ice_add_local_candidate(video_check_list, "srflx", addr, port, 2, video_ice_bases[1]); - video_responses[1] = TRUE; + if (recvStunResponse(video_gatherings[1].sock, addr, &port, &id) > 0) { + ice_add_local_candidate(video_check_list, "srflx", addr, port, 2, video_gatherings[1].base); + video_gatherings[1].response = TRUE; } } @@ -671,19 +689,19 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) break; } loops++; - } while (!((audio_responses[0] == TRUE) && (audio_responses[1] == TRUE) - && (!call->params.has_video || ((video_responses[0] == TRUE) && (video_responses[1] == TRUE))))); + } while (!((audio_gatherings[0].response == TRUE) && (audio_gatherings[1].response == TRUE) + && (!call->params.has_video || ((video_gatherings[0].response == TRUE) && (video_gatherings[1].response == TRUE))))); ice_session_compute_candidates_foundations(ice_session); ice_session_eliminate_redundant_candidates(ice_session); ice_session_choose_default_candidates(ice_session); - close_socket(audio_socks[0]); - close_socket(audio_socks[1]); + close_socket(audio_gatherings[0].sock); + close_socket(audio_gatherings[1].sock); ice_dump_candidates(audio_check_list); if (call->params.has_video && (video_check_list != NULL)) { - if (video_socks[0] != -1) close_socket(video_socks[0]); - if (video_socks[1] != -1) close_socket(video_socks[1]); + if (video_gatherings[0].sock != -1) close_socket(video_gatherings[0].sock); + if (video_gatherings[1].sock != -1) close_socket(video_gatherings[1].sock); ice_dump_candidates(video_check_list); } } From 20c2ba6ff2fa6d54c909a1e4c40711a9b4967752 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 25 Jul 2012 11:18:05 +0200 Subject: [PATCH 366/769] ICE API change. --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f42a9ba06..2a25b3cc1 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1444,7 +1444,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut * further in the call, for example during pause,resume, conferencing reINVITEs*/ linphone_call_fix_call_parameters(call); if ((sal_op_get_ice_session(call->op) != NULL) && (ice_session_state(sal_op_get_ice_session(call->op)) != IS_Completed)) { - ice_session_pair_candidates(sal_op_get_ice_session(call->op)); + ice_session_start_connectivity_checks(sal_op_get_ice_session(call->op)); } goto end; From dc308bc2c6b696105d332df8d02024df3e76b743 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 25 Jul 2012 12:54:25 +0200 Subject: [PATCH 367/769] Only include ICE candidates matching the default destination for each component of the stream in RE-INVITE for Completed check lists. --- 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 7cf668ca1..a85b5ef5a 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -224,18 +224,35 @@ static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt, boo } } -static void add_ice_candidates(sdp_message_t *msg, int lineno, const SalStreamDescription *desc, const IceCheckList *ice_cl) +static void add_candidate_attribute(sdp_message_t *msg, int lineno, const IceCandidate *candidate) { char buffer[1024]; + + snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", + candidate->foundation, candidate->componentID, candidate->priority, candidate->taddr.ip, candidate->taddr.port, ice_candidate_type(candidate)); + sdp_message_a_attribute_add(msg, lineno, osip_strdup("candidate"), osip_strdup(buffer)); +} + +static void add_ice_candidates(sdp_message_t *msg, int lineno, const IceCheckList *ice_cl, const char *rtp_addr, int rtp_port, const char *rtcp_addr, int rtcp_port) +{ const IceCandidate *candidate; int i; - if (ice_cl != NULL) { - for (i = 0; i < ms_list_size(ice_cl->local_candidates); i++) { - candidate = ms_list_nth_data(ice_cl->local_candidates, i); - snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", - candidate->foundation, candidate->componentID, candidate->priority, candidate->taddr.ip, candidate->taddr.port, ice_candidate_type(candidate)); - sdp_message_a_attribute_add(msg, lineno, osip_strdup("candidate"), osip_strdup(buffer)); + for (i = 0; i < ms_list_size(ice_cl->local_candidates); i++) { + candidate = ms_list_nth_data(ice_cl->local_candidates, i); + switch (ice_check_list_state(ice_cl)) { + case ICL_Running: + add_candidate_attribute(msg, lineno, candidate); + break; + case ICL_Completed: + /* Only include the candidates matching the default destination for each component of the stream as specified in RFC5245 section 9.1.2.2. */ + if (((candidate->taddr.port == rtp_port) && (strlen(candidate->taddr.ip) == strlen(rtp_addr)) && (strcmp(candidate->taddr.ip, rtp_addr) == 0)) + || ((candidate->taddr.port == rtcp_port) && (strlen(candidate->taddr.ip) == strlen(rtcp_addr)) && (strcmp(candidate->taddr.ip, rtcp_addr) == 0))) { + add_candidate_attribute(msg, lineno, candidate); + } + break; + default: + break; } } } @@ -366,9 +383,7 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription } else { sdp_message_a_attribute_add(msg, lineno, osip_strdup("rtcp"), int_2char(rtcp_port)); } - if (ice_check_list_state(ice_cl) == ICL_Running) { - add_ice_candidates(msg, lineno, desc, ice_cl); - } + add_ice_candidates(msg, lineno, ice_cl, rtp_addr, rtp_port, rtcp_addr, rtcp_port); } } From a45b6fbd73ab227baa95d23f2c032a2905115e3f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 25 Jul 2012 15:32:51 +0200 Subject: [PATCH 368/769] Add raddr and rport values in ICE candidate attributes in the SDP. --- coreapi/sal_eXosip2_sdp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index a85b5ef5a..8c9279aa1 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -227,9 +227,21 @@ static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt, boo static void add_candidate_attribute(sdp_message_t *msg, int lineno, const IceCandidate *candidate) { char buffer[1024]; + int nb; - snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", + nb = snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", candidate->foundation, candidate->componentID, candidate->priority, candidate->taddr.ip, candidate->taddr.port, ice_candidate_type(candidate)); + if (nb < 0) { + ms_error("Cannot add ICE candidate attribute!"); + return; + } + if (candidate->type != ICT_HostCandidate) { + nb = snprintf(buffer + nb, sizeof(buffer) - nb, " raddr %s rport %d", candidate->base->taddr.ip, candidate->base->taddr.port); + if (nb < 0) { + ms_error("Cannot add ICE candidate attribute!"); + return; + } + } sdp_message_a_attribute_add(msg, lineno, osip_strdup("candidate"), osip_strdup(buffer)); } From 46a38951859ad9401d652ca8793b4b12dd4cf6e3 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 25 Jul 2012 16:21:35 +0200 Subject: [PATCH 369/769] Fix SIGSEV when pausing call --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index c6e774d23..e17cd929a 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -241,7 +241,7 @@ public: return; } LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc); - env->CallVoidMethod(lcData->listener,lcData->displayStatusId,lcData->core,env->NewStringUTF(message)); + env->CallVoidMethod(lcData->listener,lcData->displayStatusId,lcData->core,message ? env->NewStringUTF(message) : NULL); } static void displayMessageCb(LinphoneCore *lc, const char *message) { From 0ec0c0afa1832f037512a94a00c63d99b6b0daec Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 25 Jul 2012 16:41:31 +0200 Subject: [PATCH 370/769] Add remote-candidates attributes in the SDP in RE-INVITE when ICE process has processed successfully. --- coreapi/sal_eXosip2_sdp.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 8c9279aa1..ca7600e3d 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -269,6 +269,32 @@ static void add_ice_candidates(sdp_message_t *msg, int lineno, const IceCheckLis } } +static void add_ice_remote_candidates(sdp_message_t *msg, int lineno, const IceCheckList *ice_cl) +{ + char buffer[1024]; + const char *rtp_addr = NULL; + const char *rtcp_addr = NULL; + int rtp_port; + int rtcp_port; + int nb; + + if ((ice_session_role(ice_cl->session) == IR_Controlling) && (ice_check_list_state(ice_cl) == ICL_Completed)) { + ice_check_list_nominated_valid_remote_candidate(ice_cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); + nb = snprintf(buffer, sizeof(buffer), "1 %s %d", rtp_addr, rtp_port); + if (nb < 0) { + ms_error("Cannot add ICE remote-candidates attribute!"); + return; + } + if (rtcp_addr != NULL) { + nb = snprintf(buffer + nb, sizeof(buffer) - nb, " 2 %s %d", rtcp_addr, rtcp_port); + if (nb < 0) { + ms_error("Cannot add ICE remote-candidates attribute!"); + return; + } + } + sdp_message_a_attribute_add(msg, lineno, osip_strdup("remote-candidates"), osip_strdup(buffer)); + } +} static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription *desc, const IceCheckList *ice_cl){ const char *mt=NULL; @@ -396,6 +422,7 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription sdp_message_a_attribute_add(msg, lineno, osip_strdup("rtcp"), int_2char(rtcp_port)); } add_ice_candidates(msg, lineno, ice_cl, rtp_addr, rtp_port, rtcp_addr, rtcp_port); + add_ice_remote_candidates(msg, lineno, ice_cl); } } From 78565bae79d273468c755d9b1634e2ccceece95c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 25 Jul 2012 17:21:16 +0200 Subject: [PATCH 371/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index cb0ef89e9..a9df77b27 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit cb0ef89e9fd1ef936fd4168fd89f41616caed382 +Subproject commit a9df77b2734b2628eb030f0c0768681b6573ae8b From 75e09c9613844a8999d8ad3b3b908c3b27a7a10a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 25 Jul 2012 17:23:51 +0200 Subject: [PATCH 372/769] Updated builtin echo canceller devices list --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index a9df77b27..985da5aee 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a9df77b2734b2628eb030f0c0768681b6573ae8b +Subproject commit 985da5aeec14582ecde457ab7ff6382e01d470b6 From 3cca370ef1c283b861a45d6de276e6fc9354c7cc Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 26 Jul 2012 09:55:32 +0200 Subject: [PATCH 373/769] Handle received ICE remote-candidates attribute in SDP. --- coreapi/sal_eXosip2_sdp.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index ca7600e3d..688d32c08 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -473,7 +473,7 @@ static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceSession **ice_session){ int i,j; const char *mtype,*proto,*rtp_port,*rtp_addr,*number; - const char *ice_ufrag, *ice_pwd; + const char *ice_ufrag, *ice_pwd, *ice_remote_candidates=NULL; sdp_bandwidth_t *sbw=NULL; sdp_attribute_t *attr; int media_attribute_nb; @@ -629,6 +629,8 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS if (nb == 6) { ice_add_remote_candidate(ice_session_check_list(*ice_session, i), type, ip, port, componentID, priority, foundation); } + } else if ((keywordcmp("remote-candidates", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + ice_remote_candidates = attr->a_att_value; } else if ((keywordcmp("ice-ufrag", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { ice_ufrag = attr->a_att_value; } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { @@ -636,6 +638,26 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS } } if ((*ice_session != NULL) && ice_session_check_list(*ice_session, i)) { + if (ice_remote_candidates != NULL) { + char ip[64]; + unsigned int port; + unsigned int componentID; + int offset; + + while (3 == sscanf(ice_remote_candidates, "%u %s %u%n", &componentID, ip, &port, &offset)) { + if (componentID == 1) { + if ((stream->rtp_addr == NULL) || (stream->rtp_addr[0] == '\0')) rtp_addr = desc->addr; + else rtp_addr = stream->rtp_addr; + ice_add_losing_pair(ice_session_check_list(*ice_session, i), componentID, ip, port, rtp_addr, stream->rtp_port); + } else if (componentID == 2) { + if ((stream->rtcp_addr == NULL) || (stream->rtcp_addr[0] == '\0')) rtp_addr = desc->addr; + else rtp_addr = stream->rtcp_addr; + ice_add_losing_pair(ice_session_check_list(*ice_session, i), componentID, ip, port, rtp_addr, stream->rtcp_port); + } + ice_remote_candidates += offset; + if (ice_remote_candidates[offset] == ' ') ice_remote_candidates += 1; + } + } if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { ice_check_list_set_remote_credentials(ice_session_check_list(*ice_session, i), ice_ufrag, ice_pwd); } From df347a9733ddaf66f4d7eb6870de022606d67e63 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 26 Jul 2012 10:49:12 +0200 Subject: [PATCH 374/769] Handle case where ICE is activated and the configured STUN server do not reply. --- coreapi/misc.c | 18 +++++++++++++----- coreapi/sal_eXosip2_sdp.c | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 2f887bf0c..51f217c70 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -692,17 +692,25 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) } while (!((audio_gatherings[0].response == TRUE) && (audio_gatherings[1].response == TRUE) && (!call->params.has_video || ((video_gatherings[0].response == TRUE) && (video_gatherings[1].response == TRUE))))); - ice_session_compute_candidates_foundations(ice_session); - ice_session_eliminate_redundant_candidates(ice_session); - ice_session_choose_default_candidates(ice_session); + if ((audio_gatherings[0].response == FALSE) || (audio_gatherings[1].response == FALSE) + || (call->params.has_video && ((video_gatherings[0].response == FALSE) || (video_gatherings[1].response == FALSE)))) { + /* Failed some STUN checks, deactivate ICE. */ + ice_session_destroy(ice_session); + ice_session = NULL; + sal_op_set_ice_session(call->op, ice_session); + } else { + ice_session_compute_candidates_foundations(ice_session); + ice_session_eliminate_redundant_candidates(ice_session); + ice_session_choose_default_candidates(ice_session); + } close_socket(audio_gatherings[0].sock); close_socket(audio_gatherings[1].sock); - ice_dump_candidates(audio_check_list); + if (ice_session != NULL) ice_dump_candidates(audio_check_list); if (call->params.has_video && (video_check_list != NULL)) { if (video_gatherings[0].sock != -1) close_socket(video_gatherings[0].sock); if (video_gatherings[1].sock != -1) close_socket(video_gatherings[1].sock); - ice_dump_candidates(video_check_list); + if (ice_session != NULL) ice_dump_candidates(video_check_list); } } diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 688d32c08..fee5a5313 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -373,7 +373,7 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription } /*only add a c= line within the stream description if address are differents*/ - if (strcmp(rtp_addr,sdp_message_c_addr_get(msg, -1, 0))!=0){ + if (rtp_addr[0]!='\0' && strcmp(rtp_addr,sdp_message_c_addr_get(msg, -1, 0))!=0){ bool_t inet6; if (strchr(rtp_addr,':')!=NULL){ inet6=TRUE; From cec1d35fed0b43835433d0377e79da0cc40e688a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 26 Jul 2012 11:28:26 +0200 Subject: [PATCH 375/769] Handle the case where ICE is activated locally but the remote does not support it. --- coreapi/linphonecall.c | 10 +++++++--- coreapi/sal_eXosip2_sdp.c | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 2a25b3cc1..7c9ef7bf6 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -396,13 +396,17 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro call->localdesc=create_local_media_description (lc,call); call->camera_active=call->params.has_video; switch (linphone_core_get_firewall_policy(call->core)) { - case LinphonePolicyUseStun: - linphone_core_run_stun_tests(call->core,call); - break; case LinphonePolicyUseIce: linphone_core_gather_ice_candidates(call->core, call); break; + case LinphonePolicyUseStun: + linphone_core_run_stun_tests(call->core,call); + /* No break to also destroy ice session in this case. */ default: + if (sal_op_get_ice_session(call->op) != NULL) { + ice_session_destroy(sal_op_get_ice_session(call->op)); + sal_op_set_ice_session(call->op, NULL); + } break; } discover_mtu(lc,linphone_address_get_domain(from)); diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index fee5a5313..8038d1f4e 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -689,6 +689,11 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS ice_session_set_remote_credentials(*ice_session, ice_ufrag, ice_pwd); ice_dump_session(*ice_session); } + if ((ice_session_just_created == FALSE) && ((ice_ufrag == NULL) || (ice_pwd == NULL))) { + /* We started with ICE activated but the peer apparently do not support ICE, so stop using it. */ + ice_session_destroy(*ice_session); + *ice_session = NULL; + } } return 0; } From dc4c62047478ceb132264b69e9f7c55da6e6e1e4 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 26 Jul 2012 12:21:37 +0200 Subject: [PATCH 376/769] Include ice-ufrag and ice-pwd attributes in RE-INVITE. --- coreapi/sal_eXosip2_sdp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 8038d1f4e..3d5017955 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -170,6 +170,9 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { char buffer[512]; switch (ice_session_state(ice_session)) { + case IS_Completed: + sdp_message_a_attribute_add(local, -1, osip_strdup("nortpproxy"), osip_strdup("yes")); + /* No break to also include the ice-ufrag and ice-pwd attributes when ICE session is completed. */ case IS_Running: case IS_Stopped: snprintf(buffer, sizeof(buffer), "%s", ice_session_local_pwd(ice_session)); @@ -177,9 +180,6 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const snprintf(buffer, sizeof(buffer), "%s", ice_session_local_ufrag(ice_session)); sdp_message_a_attribute_add(local, -1, osip_strdup("ice-ufrag"), osip_strdup(buffer)); break; - case IS_Completed: - sdp_message_a_attribute_add(local, -1, osip_strdup("nortpproxy"), osip_strdup("yes")); - break; default: break; } From 771cff42526e5758e1a16f1faf1bcc87549a7f96 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 26 Jul 2012 15:38:02 +0200 Subject: [PATCH 377/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 985da5aee..9ede70899 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 985da5aeec14582ecde457ab7ff6382e01d470b6 +Subproject commit 9ede708999a083165190982d31b358963faf5b7a From 14fc5446d03d5cf7a62e8884fa99fd7bbe175ecb Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 26 Jul 2012 16:17:46 +0200 Subject: [PATCH 378/769] Fix Decline/Missed call log --- coreapi/linphonecall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ec006dd58..3793cb32b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -489,9 +489,10 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const call->state=cstate; } if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){ - switch(call->reason){ + switch(call->reason){ case LinphoneReasonDeclined: call->log->status=LinphoneCallDeclined; + break; case LinphoneReasonNotAnswered: call->log->status=LinphoneCallMissed; break; From 682e19e665feb606d6c2a0c623b49466053b3165 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 27 Jul 2012 12:10:35 +0200 Subject: [PATCH 379/769] Specify default ICE remote candidates. --- coreapi/sal_eXosip2_sdp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 3d5017955..dff2de574 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -627,7 +627,20 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS nb = sscanf(attr->a_att_value, "%s %u UDP %u %s %u typ %s", foundation, &componentID, &priority, ip, &port, type); if (nb == 6) { - ice_add_remote_candidate(ice_session_check_list(*ice_session, i), type, ip, port, componentID, priority, foundation); + char *default_ip = desc->addr; + unsigned int default_port = stream->rtp_port; + bool_t is_default_candidate = FALSE; + if (componentID == 1) { + if ((stream->rtp_addr == NULL) || (stream->rtp_addr[0] == '\0')) default_ip = desc->addr; + else default_ip = stream->rtp_addr; + default_port = stream->rtp_port; + } else if (componentID == 2) { + if ((stream->rtcp_addr == NULL) || (stream->rtcp_addr[0] == '\0')) default_ip = desc->addr; + else default_ip = stream->rtcp_addr; + default_port = stream->rtcp_port; + } + if ((port == default_port) && (strlen(ip) == strlen(default_ip)) && (strcmp(ip, default_ip) == 0)) is_default_candidate = TRUE; + ice_add_remote_candidate(ice_session_check_list(*ice_session, i), type, ip, port, componentID, priority, foundation, is_default_candidate); } } else if ((keywordcmp("remote-candidates", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { ice_remote_candidates = attr->a_att_value; From 72360e58a53ed53145247b0b1b280b83430c3dca Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 27 Jul 2012 15:33:28 +0200 Subject: [PATCH 380/769] Check for ICE mismatch and add the ice-mismatch attribute in the SDP if there is a mismatch. --- coreapi/sal_eXosip2_sdp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index dff2de574..baac6583a 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -250,6 +250,10 @@ static void add_ice_candidates(sdp_message_t *msg, int lineno, const IceCheckLis const IceCandidate *candidate; int i; + if ((ice_check_list_state(ice_cl) == ICL_Failed) && ice_check_list_is_mismatch(ice_cl)) { + sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-mismatch"), NULL); + return; + } for (i = 0; i < ms_list_size(ice_cl->local_candidates); i++) { candidate = ms_list_nth_data(ice_cl->local_candidates, i); switch (ice_check_list_state(ice_cl)) { @@ -697,6 +701,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS } else { ice_session_set_role(*ice_session, IR_Controlled); } + ice_session_check_mismatch(*ice_session); } if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { ice_session_set_remote_credentials(*ice_session, ice_ufrag, ice_pwd); From 3c3051a0becc08909bc97daea182a03ec25e46f0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 27 Jul 2012 16:02:31 +0200 Subject: [PATCH 381/769] Set the state of an ICE check list to Failed if an ice-mismatch attribute is received for it. --- coreapi/sal_eXosip2_sdp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index baac6583a..bf6c196a9 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -652,6 +652,8 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS ice_ufrag = attr->a_att_value; } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { ice_pwd = attr->a_att_value; + } else if (keywordcmp("ice-mismatch", attr->a_att_field) == 0) { + ice_check_list_set_state(ice_session_check_list(*ice_session, i), ICL_Failed); } } if ((*ice_session != NULL) && ice_session_check_list(*ice_session, i)) { From d36cc880b8a04eb7fac4baf44581e68c7d02b812 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 31 Jul 2012 11:28:44 +0200 Subject: [PATCH 382/769] merge patch to indicate whether video is active in linphonec --- console/linphonec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console/linphonec.c b/console/linphonec.c index 7d5c0cdd2..6220a0599 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -346,7 +346,7 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L linphonec_out("Resuming call %i with %s.\n", id, from); break; case LinphoneCallStreamsRunning: - linphonec_out("Media streams established with %s for call %i.\n", from,id); + linphonec_out("Media streams established with %s for call %i (%s).\n", from,id,( linphone_call_params_video_enabled( linphone_call_get_current_params(call)) ? "video":"audio")); break; case LinphoneCallPausing: linphonec_out("Pausing call %i with %s.\n", id, from); From 6d0083a1f45eab2aadf73dcd1c349d5a58d1b6c1 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 31 Jul 2012 09:05:47 +0200 Subject: [PATCH 383/769] Asynchronous ICE candidates gathering. --- coreapi/linphonecall.c | 38 ++++++++--- coreapi/linphonecore.c | 21 +++++++ coreapi/misc.c | 140 +++++------------------------------------ coreapi/private.h | 3 +- 4 files changed, 68 insertions(+), 134 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7c9ef7bf6..75518a143 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -350,15 +350,8 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr } call->localdesc=create_local_media_description (lc,call); call->camera_active=params->has_video; - switch (linphone_core_get_firewall_policy(call->core)) { - case LinphonePolicyUseStun: - linphone_core_run_stun_tests(call->core,call); - break; - case LinphonePolicyUseIce: - linphone_core_gather_ice_candidates(call->core,call); - break; - default: - break; + if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) { + linphone_core_run_stun_tests(call->core,call); } discover_mtu(lc,linphone_address_get_domain (to)); if (params->referer){ @@ -971,6 +964,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ rtp_session_set_pktinfo(audiostream->session, TRUE); audiostream->ice_check_list = ice_session_check_list(ice_session, 0); + ice_check_list_set_rtp_session(audiostream->ice_check_list, audiostream->session); } call->audiostream_app_evq = ortp_ev_queue_new(); @@ -995,6 +989,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ rtp_session_set_pktinfo(call->videostream->session, TRUE); call->videostream->ice_check_list = ice_session_check_list(ice_session, 1); + ice_check_list_set_rtp_session(call->videostream->ice_check_list, call->videostream->session); } call->videostream_app_evq = ortp_ev_queue_new(); rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq); @@ -1457,6 +1452,13 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut linphone_address_destroy(me); } +void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call){ + audio_stream_start_ice_gathering(call->audiostream); + if (call->videostream) { + video_stream_start_ice_gathering(call->videostream); + } +} + static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){ audio_stream_get_local_rtp_stats (st,&log->local_stats); log->quality=audio_stream_get_average_quality_rating(st); @@ -1719,6 +1721,15 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { linphone_core_update_call(lc, call, &call->current_params); } + } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { + if (call->state==LinphoneCallOutgoingInit) { + linphone_call_stop_media_streams(call); + if (evd->info.ice_processing_successful==FALSE) { + ice_session_destroy(sal_op_get_ice_session(call->op)); + sal_op_set_ice_session(call->op, NULL); + } + linphone_core_start_invite(call->core,call,NULL); + } } ortp_event_destroy(ev); } @@ -1759,6 +1770,15 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { linphone_core_update_call(lc, call, &call->current_params); } + } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { + if (call->state==LinphoneCallOutgoingInit) { + linphone_call_stop_media_streams(call); + if (evd->info.ice_processing_successful==FALSE) { + ice_session_destroy(sal_op_get_ice_session(call->op)); + sal_op_set_ice_session(call->op, NULL); + } + linphone_core_start_invite(call->core,call,NULL); + } } ortp_event_destroy(ev); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 40b2a647d..060259a48 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1852,6 +1852,12 @@ void linphone_core_iterate(LinphoneCore *lc){ linphone_call_background_tasks(call,one_second_elapsed); if (call->state==LinphoneCallOutgoingInit && (curtime-call->start_time>=2)){ /*start the call even if the OPTIONS reply did not arrive*/ + if (sal_op_get_ice_session(call->op) != NULL) { + /* ICE candidates gathering has not finished yet, proceed with the call without ICE anyway. */ + ice_session_destroy(sal_op_get_ice_session(call->op)); + sal_op_set_ice_session(call->op, NULL); + linphone_call_stop_media_streams(call); + } linphone_core_start_invite(lc,call,NULL); } if (call->state==LinphoneCallIncomingReceived){ @@ -2281,6 +2287,21 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const /* this call becomes now the current one*/ lc->current_call=call; linphone_call_set_state (call,LinphoneCallOutgoingInit,"Starting outgoing call"); + if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) { + /* Defer the start of the call after the ICE gathering process. */ + linphone_call_init_media_streams(call); + linphone_call_start_media_streams_for_ice_gathering(call); + call->start_time=time(NULL); + if (linphone_core_gather_ice_candidates(lc,call)<0) { + /* Ice candidates gathering failed, proceed with the call anyway. */ + ice_session_destroy(sal_op_get_ice_session(call->op)); + sal_op_set_ice_session(call->op, NULL); + linphone_call_stop_media_streams(call); + } else { + if (real_url!=NULL) ms_free(real_url); + return call; + } + } if (dest_proxy!=NULL || lc->sip_conf.ping_with_options==FALSE){ linphone_core_start_invite(lc,call,dest_proxy); }else{ diff --git a/coreapi/misc.c b/coreapi/misc.c index 51f217c70..0e4be8e11 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -562,156 +562,48 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ } } -void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) +int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) { - typedef struct _st_gathering { - ortp_socket_t sock; - bool_t response; - IceCandidate *base; - struct timeval transmission_time; - } gathering_t; - char local_addr[64]; - char addr[64]; - int port; - int id; - gathering_t audio_gatherings[2]; - gathering_t video_gatherings[2]; + struct sockaddr_storage ss; + socklen_t ss_len; IceCheckList *audio_check_list; IceCheckList *video_check_list; IceSession *ice_session = sal_op_get_ice_session(call->op); - struct sockaddr_storage ss; - socklen_t ss_len; - struct timeval init, cur, diff; - double elapsed; - int loops = 0; const char *server = linphone_core_get_stun_server(lc); - if ((server == NULL) || (ice_session == NULL)) return; + if ((server == NULL) || (ice_session == NULL)) return -1; audio_check_list = ice_session_check_list(ice_session, 0); video_check_list = ice_session_check_list(ice_session, 1); - if (audio_check_list == NULL) return; + if (audio_check_list == NULL) return -1; if (lc->sip_conf.ipv6_enabled){ ms_warning("stun support is not implemented for ipv6"); - return; + return -1; } if (parse_hostname_to_addr(server, &ss, &ss_len) < 0) { ms_error("Fail to parser stun server address: %s", server); - return; + return -1; } if (lc->vtable.display_status != NULL) lc->vtable.display_status(lc, _("ICE local candidates gathering in progress...")); - audio_gatherings[0].response = audio_gatherings[1].response = FALSE; - video_gatherings[0].response = video_gatherings[1].response = FALSE; - audio_gatherings[0].base = audio_gatherings[1].base = NULL; - video_gatherings[0].base = video_gatherings[1].base = NULL; - audio_gatherings[0].sock = create_socket(call->audio_port); - if (audio_gatherings[0].sock == -1) return; - audio_gatherings[1].sock = create_socket(call->audio_port + 1); - if (audio_gatherings[1].sock == -1) return; - if (call->params.has_video) { - video_gatherings[0].sock = create_socket(call->video_port); - if (video_gatherings[0].sock == -1) return; - video_gatherings[1].sock = create_socket(call->video_port + 1); - if (video_gatherings[1].sock == -1) return; - } else { - video_gatherings[0].sock = video_gatherings[1].sock = -1; - } + /* Gather local host candidates. */ if (linphone_core_get_local_ip_for(AF_INET, NULL, local_addr) < 0) { ms_error("Fail to get local ip"); - return; + return -1; } - audio_gatherings[0].base = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); - audio_gatherings[1].base = ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); + ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); + ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); if (call->params.has_video && (video_check_list != NULL)) { - video_gatherings[0].base = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); - video_gatherings[1].base = ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); + ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); + ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); } - gettimeofday(&init, NULL); - audio_gatherings[0].transmission_time = cur = init; - diff.tv_sec = 0, diff.tv_usec = 20000; - timeradd(&audio_gatherings[0].transmission_time, &diff, &audio_gatherings[1].transmission_time); - timeradd(&audio_gatherings[1].transmission_time, &diff, &video_gatherings[0].transmission_time); - timeradd(&video_gatherings[0].transmission_time, &diff, &video_gatherings[1].transmission_time); - diff.tv_sec = 0, diff.tv_usec = 100000; - do { - if ((audio_gatherings[0].response == FALSE) && timercmp(&cur, &audio_gatherings[0].transmission_time, >=)) { - timeradd(&audio_gatherings[0].transmission_time, &diff, &audio_gatherings[0].transmission_time); - sendStunRequest(audio_gatherings[0].sock, (struct sockaddr*)&ss, ss_len, 1, FALSE); - } - if ((audio_gatherings[1].response == FALSE) && timercmp(&cur, &audio_gatherings[1].transmission_time, >=)) { - timeradd(&audio_gatherings[1].transmission_time, &diff, &audio_gatherings[1].transmission_time); - sendStunRequest(audio_gatherings[1].sock, (struct sockaddr*)&ss, ss_len, 1, FALSE); - } - if (call->params.has_video) { - if ((video_gatherings[0].response == FALSE) && timercmp(&cur, &video_gatherings[0].transmission_time, >=)) { - timeradd(&video_gatherings[0].transmission_time, &diff, &video_gatherings[0].transmission_time); - sendStunRequest(video_gatherings[0].sock, (struct sockaddr*)&ss, ss_len, 2, FALSE); - } - if ((video_gatherings[1].response == FALSE) && timercmp(&cur, &video_gatherings[1].transmission_time, >=)) { - timeradd(&video_gatherings[1].transmission_time, &diff, &video_gatherings[1].transmission_time); - sendStunRequest(video_gatherings[1].sock, (struct sockaddr*)&ss, ss_len, 2, FALSE); - } - } -#ifdef WIN32 - Sleep(10); -#else - usleep(10000); -#endif - - if (recvStunResponse(audio_gatherings[0].sock, addr, &port, &id) > 0) { - ice_add_local_candidate(audio_check_list, "srflx", addr, port, 1, audio_gatherings[0].base); - audio_gatherings[0].response = TRUE; - } - if (recvStunResponse(audio_gatherings[1].sock, addr, &port, &id) > 0) { - ice_add_local_candidate(audio_check_list, "srflx", addr, port, 2, audio_gatherings[1].base); - audio_gatherings[1].response = TRUE; - } - if (call->params.has_video && (video_check_list != NULL)) { - if (recvStunResponse(video_gatherings[0].sock, addr, &port, &id) > 0) { - ice_add_local_candidate(video_check_list, "srflx", addr, port, 1, video_gatherings[0].base); - video_gatherings[0].response = TRUE; - } - if (recvStunResponse(video_gatherings[1].sock, addr, &port, &id) > 0) { - ice_add_local_candidate(video_check_list, "srflx", addr, port, 2, video_gatherings[1].base); - video_gatherings[1].response = TRUE; - } - } - - gettimeofday(&cur, NULL); - elapsed = ((cur.tv_sec - init.tv_sec) * 1000.0) + ((cur.tv_usec - init.tv_usec) / 1000.0); - if (elapsed > 2000) { - ms_message("Stun responses timeout, going ahead."); - break; - } - loops++; - } while (!((audio_gatherings[0].response == TRUE) && (audio_gatherings[1].response == TRUE) - && (!call->params.has_video || ((video_gatherings[0].response == TRUE) && (video_gatherings[1].response == TRUE))))); - - if ((audio_gatherings[0].response == FALSE) || (audio_gatherings[1].response == FALSE) - || (call->params.has_video && ((video_gatherings[0].response == FALSE) || (video_gatherings[1].response == FALSE)))) { - /* Failed some STUN checks, deactivate ICE. */ - ice_session_destroy(ice_session); - ice_session = NULL; - sal_op_set_ice_session(call->op, ice_session); - } else { - ice_session_compute_candidates_foundations(ice_session); - ice_session_eliminate_redundant_candidates(ice_session); - ice_session_choose_default_candidates(ice_session); - } - - close_socket(audio_gatherings[0].sock); - close_socket(audio_gatherings[1].sock); - if (ice_session != NULL) ice_dump_candidates(audio_check_list); - if (call->params.has_video && (video_check_list != NULL)) { - if (video_gatherings[0].sock != -1) close_socket(video_gatherings[0].sock); - if (video_gatherings[1].sock != -1) close_socket(video_gatherings[1].sock); - if (ice_session != NULL) ice_dump_candidates(video_check_list); - } + /* Gather local srflx candidates. */ + ice_session_gather_candidates(ice_session, ss, ss_len); + return 0; } LinphoneCall * is_a_linphone_call(void *user_pointer){ diff --git a/coreapi/private.h b/coreapi/private.h index 241da0223..33c6985dd 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -219,7 +219,7 @@ MSList *linphone_find_friend(MSList *fl, const LinphoneAddress *fri, LinphoneFri void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, const PayloadType *pt); void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); -void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); +int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_send_initial_subscribes(LinphoneCore *lc); void linphone_core_write_friends_config(LinphoneCore* lc); @@ -245,6 +245,7 @@ void linphone_call_init_stats(LinphoneCallStats *stats, int type); void linphone_call_init_media_streams(LinphoneCall *call); void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone); +void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); void linphone_call_stop_media_streams(LinphoneCall *call); const char * linphone_core_get_identity(LinphoneCore *lc); From 9a0097a9748862b91448bb71c10c619e122e739a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 31 Jul 2012 16:22:25 +0200 Subject: [PATCH 384/769] fix IOS camera localized name issue --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 9ede70899..c621a8ac6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 9ede708999a083165190982d31b358963faf5b7a +Subproject commit c621a8ac69a33ae72f176689fa837bc5f0fb8eff From 53d44ea8eea3d08f8e644887736db9bd21f9b35a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 31 Jul 2012 17:10:53 +0200 Subject: [PATCH 385/769] Add some checks to prevent crashes. --- gtk/incall_view.c | 1 + gtk/main.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/incall_view.c b/gtk/incall_view.c index d19dba8c2..7e8eb683f 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -557,6 +557,7 @@ void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_m guint taskid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(callview),"taskid")); gboolean in_conf=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call)); + if ((callview==NULL) || (status==NULL)) return; if (error_msg==NULL) gtk_label_set_markup(GTK_LABEL(status),_("Call ended.")); else{ diff --git a/gtk/main.c b/gtk/main.c index fa04a24e0..2955b3ecc 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -354,8 +354,10 @@ static void entry_unmapped(GtkWidget *entry){ } GtkWidget *linphone_gtk_get_widget(GtkWidget *window, const char *name){ - GtkBuilder *builder=(GtkBuilder*)g_object_get_data(G_OBJECT(window),"builder"); + GtkBuilder *builder; GObject *w; + if (window==NULL) return NULL; + builder=(GtkBuilder*)g_object_get_data(G_OBJECT(window),"builder"); if (builder==NULL){ g_error("Fail to retrieve builder from window !"); return NULL; From 950c65ffd9077845ddf9f69a84d588d92a627ad0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 31 Jul 2012 17:14:15 +0200 Subject: [PATCH 386/769] Defer ringing when ICE is activated to be able to gather local candidates. --- coreapi/callbacks.c | 70 ++--------------- coreapi/linphonecall.c | 174 +++++++++++++++++++++++------------------ coreapi/linphonecore.c | 72 +++++++++++++++++ coreapi/linphonecore.h | 2 + 4 files changed, 176 insertions(+), 142 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 8ec8f39b1..cd3290aa6 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -140,16 +140,10 @@ static bool_t already_a_call_pending(LinphoneCore *lc){ static void call_received(SalOp *h){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h)); - char *barmesg; LinphoneCall *call; const char *from,*to; - char *tmp; - LinphoneAddress *from_parsed; LinphoneAddress *from_addr, *to_addr; - SalMediaDescription *md; - bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE); bool_t prevent_colliding_calls=lp_config_get_int(lc->config,"sip","prevent_colliding_calls",TRUE); - const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc); /* first check if we can answer successfully to this invite */ if (lc->presence_mode==LinphoneStatusBusy || @@ -188,72 +182,18 @@ static void call_received(SalOp *h){ call=linphone_call_new_incoming(lc,from_addr,to_addr,h); sal_call_set_local_media_description(h,call->localdesc); - md=sal_call_get_final_media_description(h); - - if (md && sal_media_description_empty(md)){ - sal_call_decline(h,SalReasonMedia,NULL); - linphone_call_unref(call); - return; - } /* the call is acceptable so we can now add it to our list */ linphone_core_add_call(lc,call); - - from_parsed=linphone_address_new(sal_op_get_from(h)); - linphone_address_clean(from_parsed); - tmp=linphone_address_as_string(from_parsed); - linphone_address_destroy(from_parsed); - barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"), - (sal_call_autoanswer_asked(h)) ?_(" and asked autoanswer."):_(".")); - if (lc->vtable.show) lc->vtable.show(lc); - if (lc->vtable.display_status) - lc->vtable.display_status(lc,barmesg); - - /* play the ring if this is the only call*/ - if (ms_list_size(lc->calls)==1){ - lc->current_call=call; - if (lc->ringstream && lc->dmfs_playing_start_time!=0){ - ring_stop(lc->ringstream); - lc->ringstream=NULL; - lc->dmfs_playing_start_time=0; - } - if (lc->sound_conf.ring_sndcard!=NULL){ - if(lc->ringstream==NULL && lc->sound_conf.local_ring){ - MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard; - ms_message("Starting local ring..."); - lc->ringstream=ring_start(lc->sound_conf.local_ring,2000,ringcard); - } - else - { - ms_message("the local ring is already started"); - } - } - }else{ - /* else play a tone within the context of the current call */ - call->ringing_beep=TRUE; - linphone_core_play_tone(lc); - } - - linphone_call_ref(call); /*prevent the call from being destroyed while we are notifying, if the user declines within the state callback */ - linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call"); - - if (call->state==LinphoneCallIncomingReceived){ - sal_call_notify_ringing(h,propose_early_media || ringback_tone!=NULL); - if (propose_early_media || ringback_tone!=NULL){ - linphone_call_set_state(call,LinphoneCallIncomingEarlyMedia,"Incoming call early media"); - md=sal_call_get_final_media_description(h); - linphone_core_update_streams(lc,call,md); - } - if (sal_call_get_replaces(call->op)!=NULL && lp_config_get_int(lc->config,"sip","auto_answer_replacing_calls",1)){ - linphone_core_accept_call(lc,call); - } + if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) { + /* Defer ringing until the end of the ICE candidates gathering process. */ + ms_message("Defer ringing to gather ICE candidates"); + return; } - linphone_call_unref(call); - ms_free(barmesg); - ms_free(tmp); + linphone_core_notify_incoming_call(lc,call); } static void call_ringing(SalOp *h){ diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 75518a143..e2948f597 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -390,7 +390,14 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro call->camera_active=call->params.has_video; switch (linphone_core_get_firewall_policy(call->core)) { case LinphonePolicyUseIce: - linphone_core_gather_ice_candidates(call->core, call); + linphone_call_init_media_streams(call); + linphone_call_start_media_streams_for_ice_gathering(call); + if (linphone_core_gather_ice_candidates(call->core,call)<0) { + /* Ice candidates gathering failed, proceed with the call anyway. */ + ice_session_destroy(sal_op_get_ice_session(call->op)); + sal_op_set_ice_session(call->op, NULL); + linphone_call_stop_media_streams(call); + } break; case LinphonePolicyUseStun: linphone_core_run_stun_tests(call->core,call); @@ -1469,6 +1476,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ rtp_session_unregister_event_queue(call->audiostream->session,call->audiostream_app_evq); ortp_ev_queue_flush(call->audiostream_app_evq); ortp_ev_queue_destroy(call->audiostream_app_evq); + call->audiostream_app_evq=NULL; if (call->audiostream->ec){ const char *state_str=NULL; @@ -1690,98 +1698,110 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse } #ifdef VIDEO_ENABLED if (call->videostream!=NULL) { + OrtpEvent *ev; + // Beware that the application queue should not depend on treatments fron the // mediastreamer queue. video_stream_iterate(call->videostream); - if (call->videostream_app_evq){ - OrtpEvent *ev; - while (NULL != (ev=ortp_ev_queue_get(call->videostream_app_evq))){ - OrtpEventType evt=ortp_event_get_type(ev); - OrtpEventData *evd=ortp_event_get_data(ev); - if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){ - linphone_call_videostream_encryption_changed(call, evd->info.zrtp_stream_encrypted); - } else if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) { - call->stats[LINPHONE_CALL_STATS_VIDEO].round_trip_delay = rtp_session_get_round_trip_propagation(call->videostream->session); - if(call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp != NULL) - freemsg(call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp); - call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp = evd->packet; - evd->packet = NULL; - if (lc->vtable.call_stats_updated) - lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - } else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) { - memcpy(&call->stats[LINPHONE_CALL_STATS_VIDEO].jitter_stats, rtp_session_get_jitter_stats(call->videostream->session), sizeof(jitter_stats_t)); - if(call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp != NULL) - freemsg(call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp); - call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp = evd->packet; - evd->packet = NULL; - if (lc->vtable.call_stats_updated) - lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { - linphone_core_update_call(lc, call, &call->current_params); - } - } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { - if (call->state==LinphoneCallOutgoingInit) { - linphone_call_stop_media_streams(call); - if (evd->info.ice_processing_successful==FALSE) { - ice_session_destroy(sal_op_get_ice_session(call->op)); - sal_op_set_ice_session(call->op, NULL); - } - linphone_core_start_invite(call->core,call,NULL); - } + while (call->videostream_app_evq && (NULL != (ev=ortp_ev_queue_get(call->videostream_app_evq)))){ + OrtpEventType evt=ortp_event_get_type(ev); + OrtpEventData *evd=ortp_event_get_data(ev); + if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){ + linphone_call_videostream_encryption_changed(call, evd->info.zrtp_stream_encrypted); + } else if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) { + call->stats[LINPHONE_CALL_STATS_VIDEO].round_trip_delay = rtp_session_get_round_trip_propagation(call->videostream->session); + if(call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp != NULL) + freemsg(call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp); + call->stats[LINPHONE_CALL_STATS_VIDEO].received_rtcp = evd->packet; + evd->packet = NULL; + if (lc->vtable.call_stats_updated) + lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + } else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) { + memcpy(&call->stats[LINPHONE_CALL_STATS_VIDEO].jitter_stats, rtp_session_get_jitter_stats(call->videostream->session), sizeof(jitter_stats_t)); + if(call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp != NULL) + freemsg(call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp); + call->stats[LINPHONE_CALL_STATS_VIDEO].sent_rtcp = evd->packet; + evd->packet = NULL; + if (lc->vtable.call_stats_updated) + lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { + if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { + linphone_core_update_call(lc, call, &call->current_params); + } + } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { + IceSession *ice_session = sal_op_get_ice_session(call->op); + linphone_call_stop_media_streams(call); + if (evd->info.ice_processing_successful==TRUE) { + ice_session_compute_candidates_foundations(ice_session); + ice_session_eliminate_redundant_candidates(ice_session); + ice_session_choose_default_candidates(ice_session); + } else { + ice_session_destroy(ice_session); + sal_op_set_ice_session(call->op, NULL); + } + if (call->state==LinphoneCallOutgoingInit) { + linphone_core_start_invite(call->core,call,NULL); + } else { + linphone_core_notify_incoming_call(call->core,call); } - ortp_event_destroy(ev); } + ortp_event_destroy(ev); } } #endif if (call->audiostream!=NULL) { + OrtpEvent *ev; + // Beware that the application queue should not depend on treatments fron the // mediastreamer queue. audio_stream_iterate(call->audiostream); - if (call->audiostream_app_evq){ - OrtpEvent *ev; - while (NULL != (ev=ortp_ev_queue_get(call->audiostream_app_evq))){ - OrtpEventType evt=ortp_event_get_type(ev); - OrtpEventData *evd=ortp_event_get_data(ev); - if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){ - linphone_call_audiostream_encryption_changed(call, evd->info.zrtp_stream_encrypted); - } else if (evt == ORTP_EVENT_ZRTP_SAS_READY) { - linphone_call_audiostream_auth_token_ready(call, evd->info.zrtp_sas.sas, evd->info.zrtp_sas.verified); - } else if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) { - call->stats[LINPHONE_CALL_STATS_AUDIO].round_trip_delay = rtp_session_get_round_trip_propagation(call->audiostream->session); - if(call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp != NULL) - freemsg(call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp); - call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp = evd->packet; - evd->packet = NULL; - if (lc->vtable.call_stats_updated) - lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - } else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) { - memcpy(&call->stats[LINPHONE_CALL_STATS_AUDIO].jitter_stats, rtp_session_get_jitter_stats(call->audiostream->session), sizeof(jitter_stats_t)); - if(call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp != NULL) - freemsg(call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp); - call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp = evd->packet; - evd->packet = NULL; - if (lc->vtable.call_stats_updated) - lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { - linphone_core_update_call(lc, call, &call->current_params); - } - } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { - if (call->state==LinphoneCallOutgoingInit) { - linphone_call_stop_media_streams(call); - if (evd->info.ice_processing_successful==FALSE) { - ice_session_destroy(sal_op_get_ice_session(call->op)); - sal_op_set_ice_session(call->op, NULL); - } - linphone_core_start_invite(call->core,call,NULL); - } + while (call->audiostream_app_evq && (NULL != (ev=ortp_ev_queue_get(call->audiostream_app_evq)))){ + OrtpEventType evt=ortp_event_get_type(ev); + OrtpEventData *evd=ortp_event_get_data(ev); + if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){ + linphone_call_audiostream_encryption_changed(call, evd->info.zrtp_stream_encrypted); + } else if (evt == ORTP_EVENT_ZRTP_SAS_READY) { + linphone_call_audiostream_auth_token_ready(call, evd->info.zrtp_sas.sas, evd->info.zrtp_sas.verified); + } else if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) { + call->stats[LINPHONE_CALL_STATS_AUDIO].round_trip_delay = rtp_session_get_round_trip_propagation(call->audiostream->session); + if(call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp != NULL) + freemsg(call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp); + call->stats[LINPHONE_CALL_STATS_AUDIO].received_rtcp = evd->packet; + evd->packet = NULL; + if (lc->vtable.call_stats_updated) + lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + } else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) { + memcpy(&call->stats[LINPHONE_CALL_STATS_AUDIO].jitter_stats, rtp_session_get_jitter_stats(call->audiostream->session), sizeof(jitter_stats_t)); + if(call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp != NULL) + freemsg(call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp); + call->stats[LINPHONE_CALL_STATS_AUDIO].sent_rtcp = evd->packet; + evd->packet = NULL; + if (lc->vtable.call_stats_updated) + lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { + if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { + linphone_core_update_call(lc, call, &call->current_params); + } + } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { + IceSession *ice_session = sal_op_get_ice_session(call->op); + linphone_call_stop_media_streams(call); + if (evd->info.ice_processing_successful==TRUE) { + ice_session_compute_candidates_foundations(ice_session); + ice_session_eliminate_redundant_candidates(ice_session); + ice_session_choose_default_candidates(ice_session); + } else { + ice_session_destroy(sal_op_get_ice_session(call->op)); + sal_op_set_ice_session(call->op, NULL); + } + if (call->state==LinphoneCallOutgoingInit) { + linphone_core_start_invite(call->core,call,NULL); + } else { + linphone_core_notify_incoming_call(call->core,call); } - ortp_event_destroy(ev); } + ortp_event_destroy(ev); } } if (call->state==LinphoneCallStreamsRunning && one_second_elapsed && call->audiostream!=NULL && disconnect_timeout>0 ) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 060259a48..73ef52c3f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2373,6 +2373,78 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){ return FALSE; } +void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ + char *barmesg; + char *tmp; + LinphoneAddress *from_parsed; + SalMediaDescription *md; + bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE); + const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc); + + /* Regenerate final media description to include all ICE candidates. */ + md=sal_call_get_final_media_description(call->op); + + if (md && sal_media_description_empty(md)){ + sal_call_decline(call->op,SalReasonMedia,NULL); + linphone_call_unref(call); + return; + } + + from_parsed=linphone_address_new(sal_op_get_from(call->op)); + linphone_address_clean(from_parsed); + tmp=linphone_address_as_string(from_parsed); + linphone_address_destroy(from_parsed); + barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"), + (sal_call_autoanswer_asked(call->op)) ?_(" and asked autoanswer."):_(".")); + if (lc->vtable.show) lc->vtable.show(lc); + if (lc->vtable.display_status) + lc->vtable.display_status(lc,barmesg); + + /* play the ring if this is the only call*/ + if (ms_list_size(lc->calls)==1){ + lc->current_call=call; + if (lc->ringstream && lc->dmfs_playing_start_time!=0){ + ring_stop(lc->ringstream); + lc->ringstream=NULL; + lc->dmfs_playing_start_time=0; + } + if (lc->sound_conf.ring_sndcard!=NULL){ + if(lc->ringstream==NULL && lc->sound_conf.local_ring){ + MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard; + ms_message("Starting local ring..."); + lc->ringstream=ring_start(lc->sound_conf.local_ring,2000,ringcard); + } + else + { + ms_message("the local ring is already started"); + } + } + }else{ + /* else play a tone within the context of the current call */ + call->ringing_beep=TRUE; + linphone_core_play_tone(lc); + } + + linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call"); + + if (call->state==LinphoneCallIncomingReceived){ + sal_call_notify_ringing(call->op,propose_early_media || ringback_tone!=NULL); + + if (propose_early_media || ringback_tone!=NULL){ + linphone_call_set_state(call,LinphoneCallIncomingEarlyMedia,"Incoming call early media"); + md=sal_call_get_final_media_description(call->op); + linphone_core_update_streams(lc,call,md); + } + if (sal_call_get_replaces(call->op)!=NULL && lp_config_get_int(lc->config,"sip","auto_answer_replacing_calls",1)){ + linphone_core_accept_call(lc,call); + } + } + linphone_call_unref(call); + + ms_free(barmesg); + ms_free(tmp); +} + /** * @ingroup call_control * Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore. diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 10f6108c9..67e887c60 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -783,6 +783,8 @@ int linphone_core_transfer_call_to_another(LinphoneCore *lc, LinphoneCall *call, bool_t linphone_core_inc_invite_pending(LinphoneCore*lc); +void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call); + bool_t linphone_core_in_call(const LinphoneCore *lc); LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc); From 922caf698f8df8d5d57f5154b51d5903a29a6412 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 1 Aug 2012 09:30:27 +0200 Subject: [PATCH 387/769] Fix some crashes related to asynchronous ICE candidates gathering. --- coreapi/callbacks.c | 11 +++++++++-- coreapi/linphonecall.c | 25 +++++++++++++++++-------- coreapi/linphonecore.c | 6 ++---- coreapi/private.h | 1 + 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index cd3290aa6..dd17650f5 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -187,7 +187,7 @@ static void call_received(SalOp *h){ linphone_core_add_call(lc,call); linphone_call_ref(call); /*prevent the call from being destroyed while we are notifying, if the user declines within the state callback */ - if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) { + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && sal_op_get_ice_session(call->op)) { /* Defer ringing until the end of the ICE candidates gathering process. */ ms_message("Defer ringing to gather ICE candidates"); return; @@ -254,13 +254,20 @@ static void call_ringing(SalOp *h){ static void call_accepted(SalOp *op){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); + IceSession *ice_session=sal_op_get_ice_session(op); SalMediaDescription *md; if (call==NULL){ ms_warning("No call to accept."); return ; } - + + if (ice_session == NULL) { + /* Ensure the ICE check list pointers for the call streams are resetted to prevent crashes */ + if (call->audiostream != NULL) call->audiostream->ice_check_list = NULL; + if (call->videostream != NULL) call->videostream->ice_check_list = NULL; + } + md=sal_call_get_final_media_description(op); if (call->state==LinphoneCallOutgoingProgress || diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index e2948f597..52c01d455 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -394,8 +394,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_start_media_streams_for_ice_gathering(call); if (linphone_core_gather_ice_candidates(call->core,call)<0) { /* Ice candidates gathering failed, proceed with the call anyway. */ - ice_session_destroy(sal_op_get_ice_session(call->op)); - sal_op_set_ice_session(call->op, NULL); + linphone_call_delete_ice_session(call); linphone_call_stop_media_streams(call); } break; @@ -404,8 +403,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro /* No break to also destroy ice session in this case. */ default: if (sal_op_get_ice_session(call->op) != NULL) { - ice_session_destroy(sal_op_get_ice_session(call->op)); - sal_op_set_ice_session(call->op, NULL); + linphone_call_delete_ice_session(call); } break; } @@ -1466,6 +1464,16 @@ void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call){ } } +void linphone_call_delete_ice_session(LinphoneCall *call){ + IceSession *ice_session = sal_op_get_ice_session(call->op); + if (ice_session != NULL) { + ice_session_destroy(ice_session); + sal_op_set_ice_session(call->op, NULL); + if (call->audiostream != NULL) call->audiostream->ice_check_list = NULL; + if (call->videostream != NULL) call->videostream->ice_check_list = NULL; + } +} + static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){ audio_stream_get_local_rtp_stats (st,&log->local_stats); log->quality=audio_stream_get_average_quality_rating(st); @@ -1473,6 +1481,7 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){ void linphone_call_stop_media_streams(LinphoneCall *call){ if (call->audiostream!=NULL) { + call->audiostream->ice_check_list = NULL; rtp_session_unregister_event_queue(call->audiostream->session,call->audiostream_app_evq); ortp_ev_queue_flush(call->audiostream_app_evq); ortp_ev_queue_destroy(call->audiostream_app_evq); @@ -1497,9 +1506,11 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ #ifdef VIDEO_ENABLED if (call->videostream!=NULL){ + call->videostream->ice_check_list = NULL; rtp_session_unregister_event_queue(call->videostream->session,call->videostream_app_evq); ortp_ev_queue_flush(call->videostream_app_evq); ortp_ev_queue_destroy(call->videostream_app_evq); + call->videostream_app_evq=NULL; video_stream_stop(call->videostream); call->videostream=NULL; } @@ -1737,8 +1748,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse ice_session_eliminate_redundant_candidates(ice_session); ice_session_choose_default_candidates(ice_session); } else { - ice_session_destroy(ice_session); - sal_op_set_ice_session(call->op, NULL); + linphone_call_delete_ice_session(call); } if (call->state==LinphoneCallOutgoingInit) { linphone_core_start_invite(call->core,call,NULL); @@ -1792,8 +1802,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse ice_session_eliminate_redundant_candidates(ice_session); ice_session_choose_default_candidates(ice_session); } else { - ice_session_destroy(sal_op_get_ice_session(call->op)); - sal_op_set_ice_session(call->op, NULL); + linphone_call_delete_ice_session(call); } if (call->state==LinphoneCallOutgoingInit) { linphone_core_start_invite(call->core,call,NULL); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 73ef52c3f..da573d074 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1854,8 +1854,7 @@ void linphone_core_iterate(LinphoneCore *lc){ /*start the call even if the OPTIONS reply did not arrive*/ if (sal_op_get_ice_session(call->op) != NULL) { /* ICE candidates gathering has not finished yet, proceed with the call without ICE anyway. */ - ice_session_destroy(sal_op_get_ice_session(call->op)); - sal_op_set_ice_session(call->op, NULL); + linphone_call_delete_ice_session(call); linphone_call_stop_media_streams(call); } linphone_core_start_invite(lc,call,NULL); @@ -2294,8 +2293,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const call->start_time=time(NULL); if (linphone_core_gather_ice_candidates(lc,call)<0) { /* Ice candidates gathering failed, proceed with the call anyway. */ - ice_session_destroy(sal_op_get_ice_session(call->op)); - sal_op_set_ice_session(call->op, NULL); + linphone_call_delete_ice_session(call); linphone_call_stop_media_streams(call); } else { if (real_url!=NULL) ms_free(real_url); diff --git a/coreapi/private.h b/coreapi/private.h index 33c6985dd..1b826c574 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -247,6 +247,7 @@ void linphone_call_init_media_streams(LinphoneCall *call); void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone); void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); void linphone_call_stop_media_streams(LinphoneCall *call); +void linphone_call_delete_ice_session(LinphoneCall *call); const char * linphone_core_get_identity(LinphoneCore *lc); const char * linphone_core_get_route(LinphoneCore *lc); From 8e50e1c2bd05e1b3697714f209b610c0a6b57ba6 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 1 Aug 2012 11:31:36 +0200 Subject: [PATCH 388/769] Fix some more crashes related to asynchronous ICE candidates gathering. --- coreapi/linphonecall.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 52c01d455..47b23b47e 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1711,6 +1711,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse if (call->videostream!=NULL) { OrtpEvent *ev; + /* Ensure there is no dangling ICE check list. */ + if (sal_op_get_ice_session(call->op) == NULL) call->videostream->ice_check_list = NULL; + // Beware that the application queue should not depend on treatments fron the // mediastreamer queue. video_stream_iterate(call->videostream); @@ -1763,6 +1766,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse if (call->audiostream!=NULL) { OrtpEvent *ev; + /* Ensure there is no dangling ICE check list. */ + if (sal_op_get_ice_session(call->op) == NULL) call->audiostream->ice_check_list = NULL; + // Beware that the application queue should not depend on treatments fron the // mediastreamer queue. audio_stream_iterate(call->audiostream); From bb80550705c3f03e5c27671b2dc781f8c61f1d1c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 1 Aug 2012 11:34:51 +0200 Subject: [PATCH 389/769] Delete ICE session, when its state is Failed after receiving an answer from the peer (probably caused by ice-mismatch attributes). --- coreapi/sal_eXosip2_sdp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index bf6c196a9..1d25d1f51 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -709,7 +709,8 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS ice_session_set_remote_credentials(*ice_session, ice_ufrag, ice_pwd); ice_dump_session(*ice_session); } - if ((ice_session_just_created == FALSE) && ((ice_ufrag == NULL) || (ice_pwd == NULL))) { + if (((ice_session_just_created == FALSE) && ((ice_ufrag == NULL) || (ice_pwd == NULL))) + || (ice_session_state(*ice_session) == IS_Failed)) { /* We started with ICE activated but the peer apparently do not support ICE, so stop using it. */ ice_session_destroy(*ice_session); *ice_session = NULL; From deb7ed6d93904dd0acee486e24f8bf9fb7b5aa33 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 1 Aug 2012 14:03:28 +0200 Subject: [PATCH 390/769] Exported is_network_reachable method through JNI --- coreapi/linphonecore_jni.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e17cd929a..64837cab5 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -598,6 +598,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable linphone_core_set_network_reachable((LinphoneCore*)lc,isReachable); } +extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReachable( JNIEnv* env + ,jobject thiz + ,jlong lc) { + return linphone_core_is_network_reachabled((LinphoneCore*)lc); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env ,jobject thiz ,jlong lc From 981accf8bb9ce0bd8904860146f08d00b0b0edd3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 1 Aug 2012 15:11:39 +0200 Subject: [PATCH 391/769] Do not create an ICE check list if it has already been created. --- coreapi/linphonecall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 47b23b47e..edf381a9f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -248,7 +248,8 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].crypto[1].algo = 0; md->streams[i].crypto[2].algo = 0; } - if ((call->dir == LinphoneCallOutgoing) && (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) && (ice_session != NULL)){ + if ((call->dir == LinphoneCallOutgoing) && (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) + && (ice_session != NULL) && (ice_session_check_list(ice_session, i) == NULL)) { ice_session_add_check_list(ice_session, ice_check_list_new()); } } From 652471f66f15c87f8625fdf82c270d38ae5d7038 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 1 Aug 2012 15:16:47 +0200 Subject: [PATCH 392/769] Defer call update when adding video during communication if ICE is activated to wait for ICE candidates gathering to finish. --- console/commands.c | 5 +- coreapi/linphonecall.c | 119 +++++++++++++++++++++++++++-------------- coreapi/linphonecore.h | 9 ++++ coreapi/private.h | 2 + gtk/incall_view.c | 6 +-- 5 files changed, 92 insertions(+), 49 deletions(-) diff --git a/console/commands.c b/console/commands.c index 472531795..7bebdd82b 100644 --- a/console/commands.c +++ b/console/commands.c @@ -2503,10 +2503,7 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args){ linphone_call_enable_camera(call,activated); if ((activated && !linphone_call_params_video_enabled (cp))){ /*update the call to add the video stream*/ - LinphoneCallParams *ncp=linphone_call_params_copy(cp); - linphone_call_params_enable_video(ncp,TRUE); - linphone_core_update_call(lc,call,ncp); - linphone_call_params_destroy (ncp); + linphone_call_enable_video(call,TRUE); linphonec_out("Trying to bring up video stream...\n"); } } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index edf381a9f..c8b4c82d3 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -548,6 +548,26 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const } } +void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) +{ + LinphoneCore *lc=linphone_call_get_core(call); + LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); + + linphone_call_params_enable_video(params, enabled); + if ((enabled == TRUE) && (sal_op_get_ice_session(call->op))) { + /* Defer call update until the ICE candidates gathering process has finished. */ + ms_message("Defer call update to gather ICE candidates"); + call->params = *params; + update_local_media_description(lc, call); + linphone_call_init_video_stream(call); + video_stream_start_ice_gathering(call->videostream); + linphone_core_gather_ice_candidates(lc, call); + } else { + linphone_core_update_call(lc, call, params); + } + linphone_call_params_destroy(params); +} + static void linphone_call_destroy(LinphoneCall *obj) { if (obj->op!=NULL) { @@ -930,7 +950,7 @@ void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, Lin #endif } -void linphone_call_init_media_streams(LinphoneCall *call){ +void linphone_call_init_audio_stream(LinphoneCall *call){ LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; AudioStream *audiostream; @@ -975,15 +995,20 @@ void linphone_call_init_media_streams(LinphoneCall *call){ call->audiostream_app_evq = ortp_ev_queue_new(); rtp_session_register_event_queue(audiostream->session,call->audiostream_app_evq); +} +void linphone_call_init_video_stream(LinphoneCall *call){ #ifdef VIDEO_ENABLED + LinphoneCore *lc=call->core; + SalMediaDescription *md=call->localdesc; + IceSession *ice_session = sal_op_get_ice_session(call->op); if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].rtp_port>0){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); call->videostream=video_stream_new(md->streams[1].rtp_port,md->streams[1].rtcp_port,linphone_core_ipv6_enabled(lc)); video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0)); if (video_recv_buf_size>0) rtp_session_set_recv_buf_size(call->videostream->session,video_recv_buf_size); - + if( lc->video_conf.displaytype != NULL) video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype); video_stream_set_event_callback(call->videostream,video_stream_event_cb, call); @@ -1008,6 +1033,11 @@ void linphone_call_init_media_streams(LinphoneCall *call){ #endif } +void linphone_call_init_media_streams(LinphoneCall *call){ + linphone_call_init_audio_stream(call); + linphone_call_init_video_stream(call); +} + static int dtmf_tab[16]={'0','1','2','3','4','5','6','7','8','9','*','#','A','B','C','D'}; @@ -1687,6 +1717,49 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ linphone_core_terminate_call(lc,call); } +static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ + OrtpEventType evt=ortp_event_get_type(ev); + OrtpEventData *evd=ortp_event_get_data(ev); + + if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { + if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { + linphone_core_update_call(call->core, call, &call->current_params); + } + } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { + IceSession *ice_session = sal_op_get_ice_session(call->op); + LinphoneCallParams *params; + switch (call->state) { + case LinphoneCallStreamsRunning: + if (evd->info.ice_processing_successful==TRUE) { + ice_session_compute_candidates_foundations(ice_session); + ice_session_eliminate_redundant_candidates(ice_session); + ice_session_choose_default_candidates(ice_session); + } + params = linphone_call_params_copy(linphone_call_get_current_params(call)); + linphone_call_params_enable_video(params, TRUE); + linphone_core_update_call(call->core, call, params); + linphone_call_params_destroy(params); + break; + case LinphoneCallOutgoingInit: + default: + linphone_call_stop_media_streams(call); + if (evd->info.ice_processing_successful==TRUE) { + ice_session_compute_candidates_foundations(ice_session); + ice_session_eliminate_redundant_candidates(ice_session); + ice_session_choose_default_candidates(ice_session); + } else { + linphone_call_delete_ice_session(call); + } + if (call->state==LinphoneCallOutgoingInit) { + linphone_core_start_invite(call->core,call,NULL); + } else { + linphone_core_notify_incoming_call(call->core,call); + } + break; + } + } +} + void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed){ LinphoneCore* lc = call->core; int disconnect_timeout = linphone_core_get_nortp_timeout(call->core); @@ -1740,25 +1813,8 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse evd->packet = NULL; if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { - linphone_core_update_call(lc, call, &call->current_params); - } - } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { - IceSession *ice_session = sal_op_get_ice_session(call->op); - linphone_call_stop_media_streams(call); - if (evd->info.ice_processing_successful==TRUE) { - ice_session_compute_candidates_foundations(ice_session); - ice_session_eliminate_redundant_candidates(ice_session); - ice_session_choose_default_candidates(ice_session); - } else { - linphone_call_delete_ice_session(call); - } - if (call->state==LinphoneCallOutgoingInit) { - linphone_core_start_invite(call->core,call,NULL); - } else { - linphone_core_notify_incoming_call(call->core,call); - } + } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED)) { + handle_ice_events(call, ev); } ortp_event_destroy(ev); } @@ -1797,25 +1853,8 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse evd->packet = NULL; if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - } else if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { - linphone_core_update_call(lc, call, &call->current_params); - } - } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { - IceSession *ice_session = sal_op_get_ice_session(call->op); - linphone_call_stop_media_streams(call); - if (evd->info.ice_processing_successful==TRUE) { - ice_session_compute_candidates_foundations(ice_session); - ice_session_eliminate_redundant_candidates(ice_session); - ice_session_choose_default_candidates(ice_session); - } else { - linphone_call_delete_ice_session(call); - } - if (call->state==LinphoneCallOutgoingInit) { - linphone_core_start_invite(call->core,call,NULL); - } else { - linphone_core_notify_incoming_call(call->core,call); - } + } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED)) { + handle_ice_events(call, ev); } ortp_event_destroy(ev); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 67e887c60..6b00cbc09 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -390,6 +390,15 @@ void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val); **/ bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call); +/** + * Enable or disable video for this call. + * @param call + * @param enabled + * + * @ingroup media_parameters + */ +void linphone_call_enable_video(LinphoneCall *call, bool_t enabled); + /*keep this in sync with mediastreamer2/msvolume.h*/ /** diff --git a/coreapi/private.h b/coreapi/private.h index 1b826c574..61d1d4179 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -243,6 +243,8 @@ void linphone_core_play_tone(LinphoneCore *lc); void linphone_call_init_stats(LinphoneCallStats *stats, int type); +void linphone_call_init_audio_stream(LinphoneCall *call); +void linphone_call_init_video_stream(LinphoneCall *call); void linphone_call_init_media_streams(LinphoneCall *call); void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone); void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); diff --git a/gtk/incall_view.c b/gtk/incall_view.c index 7e8eb683f..45e98609b 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -221,12 +221,8 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){ static void video_button_clicked(GtkWidget *button, LinphoneCall *call){ gboolean adding=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),"adding_video")); - LinphoneCore *lc=linphone_call_get_core(call); - LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); gtk_widget_set_sensitive(button,FALSE); - linphone_call_params_enable_video(params,adding); - linphone_core_update_call(lc,call,params); - linphone_call_params_destroy(params); + linphone_call_enable_video(call,adding); } void linphone_gtk_update_video_button(LinphoneCall *call){ From 623e9e181346d7039e6f5a43beabaf1b4021b393 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 1 Aug 2012 15:56:34 +0200 Subject: [PATCH 393/769] Remove ICE check lists from media streams that are removed from the SDP. --- coreapi/sal_eXosip2_sdp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 1d25d1f51..1cd88cad7 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -680,6 +680,10 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { ice_check_list_set_remote_credentials(ice_session_check_list(*ice_session, i), ice_ufrag, ice_pwd); } + if (stream->rtp_port == 0) { + /* This stream has been deactivated by the peer, delete the check list. */ + ice_session_remove_check_list(*ice_session, ice_session_check_list(*ice_session, i)); + } ice_dump_candidates(ice_session_check_list(*ice_session, i)); } } @@ -697,6 +701,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS } } if (*ice_session != NULL) { + int nb_check_lists; if (ice_session_just_created == TRUE) { if (ice_lite == TRUE) { ice_session_set_role(*ice_session, IR_Controlling); @@ -705,6 +710,9 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS } ice_session_check_mismatch(*ice_session); } + while ((nb_check_lists = ice_session_nb_check_lists(*ice_session)) > desc->nstreams) { + ice_session_remove_check_list(*ice_session, ice_session_check_list(*ice_session, nb_check_lists - 1)); + } if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { ice_session_set_remote_credentials(*ice_session, ice_ufrag, ice_pwd); ice_dump_session(*ice_session); From 36d15495a07322de2ed4103263128218aeeaf50d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 1 Aug 2012 17:14:02 +0200 Subject: [PATCH 394/769] Drawable hdpi and mdpi + rotation issue fixed + memory leak fixed --- LinphoneCoreImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 88084d237..6f3683745 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -109,6 +109,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void removeCallLog(long nativePtr, long callLogPtr); private native int getMissedCallsCount(long nativePtr); private native void resetMissedCallsCount(long nativePtr); + private native boolean isNetworkReachable(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -441,7 +442,7 @@ class LinphoneCoreImpl implements LinphoneCore { return codecs; } public synchronized boolean isNetworkReachable() { - throw new RuntimeException("Not implemented"); + return isNetworkReachable(nativePtr); } public synchronized void enableKeepAlive(boolean enable) { enableKeepAlive(nativePtr,enable); From e5103d7a76c3574ebd2432eb52431a3f171842da Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 1 Aug 2012 16:06:19 +0200 Subject: [PATCH 395/769] Remove ICE check list from the session when removing video from the communication. --- coreapi/linphonecall.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index c8b4c82d3..b604c9de1 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -552,17 +552,26 @@ void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) { LinphoneCore *lc=linphone_call_get_core(call); LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); + IceSession *ice_session=sal_op_get_ice_session(call->op); linphone_call_params_enable_video(params, enabled); - if ((enabled == TRUE) && (sal_op_get_ice_session(call->op))) { - /* Defer call update until the ICE candidates gathering process has finished. */ - ms_message("Defer call update to gather ICE candidates"); - call->params = *params; - update_local_media_description(lc, call); - linphone_call_init_video_stream(call); - video_stream_start_ice_gathering(call->videostream); - linphone_core_gather_ice_candidates(lc, call); + if (enabled == TRUE) { + if (ice_session != NULL) { + /* Defer call update until the ICE candidates gathering process has finished. */ + ms_message("Defer call update to gather ICE candidates"); + call->params = *params; + update_local_media_description(lc, call); + linphone_call_init_video_stream(call); + video_stream_start_ice_gathering(call->videostream); + linphone_core_gather_ice_candidates(lc, call); + } else { + linphone_core_update_call(lc, call, params); + } } else { + if (ice_session != NULL) { + ice_session_remove_check_list(ice_session, call->videostream->ice_check_list); + call->videostream->ice_check_list = NULL; + } linphone_core_update_call(lc, call, params); } linphone_call_params_destroy(params); From 1be354174188f8fbb800cd7a981d88176f1cbd4d Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 1 Aug 2012 17:59:50 +0200 Subject: [PATCH 396/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index c621a8ac6..8daca1b79 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c621a8ac69a33ae72f176689fa837bc5f0fb8eff +Subproject commit 8daca1b79969ea90068ceb3a64cbbde974a9bf74 From 78fae7acaf65bf083a8d35ae0c0bdddc87b649cc Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 2 Aug 2012 09:20:51 +0200 Subject: [PATCH 397/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 8daca1b79..94eb4afe7 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 8daca1b79969ea90068ceb3a64cbbde974a9bf74 +Subproject commit 94eb4afe778c5fab72ca3e4defca42bc2a4d8118 From 1d59cffb49795a4d588a749efd49ca150a348374 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 2 Aug 2012 10:13:32 +0200 Subject: [PATCH 398/769] Fix settings issues --- LinphoneCoreImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 6f3683745..1f182b47f 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -46,6 +46,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native int getNumberOfCallLogs(long nativePtr); private native void delete(long nativePtr); private native void setNetworkStateReachable(long nativePtr,boolean isReachable); + private native boolean isNetworkStateReachable(long nativePtr); private native void setPlaybackGain(long nativeptr, float gain); private native float getPlaybackGain(long nativeptr); private native void muteMic(long nativePtr,boolean isMuted); @@ -109,7 +110,6 @@ class LinphoneCoreImpl implements LinphoneCore { private native void removeCallLog(long nativePtr, long callLogPtr); private native int getMissedCallsCount(long nativePtr); private native void resetMissedCallsCount(long nativePtr); - private native boolean isNetworkReachable(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -442,8 +442,9 @@ class LinphoneCoreImpl implements LinphoneCore { return codecs; } public synchronized boolean isNetworkReachable() { - return isNetworkReachable(nativePtr); + return isNetworkStateReachable(nativePtr); } + public synchronized void enableKeepAlive(boolean enable) { enableKeepAlive(nativePtr,enable); From 65c46c6cb81c4ae173fb975cb5c11067519491b0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 2 Aug 2012 12:16:25 +0200 Subject: [PATCH 399/769] Defer acceptation of video activation to gather ICE candidates if ICE is enabled. --- coreapi/linphonecall.c | 21 +++++++++++++++++---- gtk/main.c | 6 +----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b604c9de1..19e64b096 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -565,14 +565,22 @@ void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) video_stream_start_ice_gathering(call->videostream); linphone_core_gather_ice_candidates(lc, call); } else { - linphone_core_update_call(lc, call, params); + if (linphone_call_get_state(call) == LinphoneCallUpdatedByRemote) { + linphone_core_accept_call_update(lc, call, params); + } else { + linphone_core_update_call(lc, call, params); + } } } else { if (ice_session != NULL) { ice_session_remove_check_list(ice_session, call->videostream->ice_check_list); call->videostream->ice_check_list = NULL; } - linphone_core_update_call(lc, call, params); + if (linphone_call_get_state(call) == LinphoneCallUpdatedByRemote) { + linphone_core_accept_call_update(lc, call, params); + } else { + linphone_core_update_call(lc, call, params); + } } linphone_call_params_destroy(params); } @@ -1026,7 +1034,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){ RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); } - if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL) && (ice_session_check_list(ice_session, 1))){ rtp_session_set_pktinfo(call->videostream->session, TRUE); call->videostream->ice_check_list = ice_session_check_list(ice_session, 1); ice_check_list_set_rtp_session(call->videostream->ice_check_list, call->videostream->session); @@ -1739,6 +1747,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ LinphoneCallParams *params; switch (call->state) { case LinphoneCallStreamsRunning: + case LinphoneCallUpdatedByRemote: if (evd->info.ice_processing_successful==TRUE) { ice_session_compute_candidates_foundations(ice_session); ice_session_eliminate_redundant_candidates(ice_session); @@ -1746,7 +1755,11 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ } params = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_call_params_enable_video(params, TRUE); - linphone_core_update_call(call->core, call, params); + if (call->state == LinphoneCallStreamsRunning) { + linphone_core_update_call(call->core, call, params); + } else { /* LinphoneCallUpdatedByRemote */ + linphone_core_accept_call_update(call->core, call, params); + } linphone_call_params_destroy(params); break; case LinphoneCallOutgoingInit: diff --git a/gtk/main.c b/gtk/main.c index 2955b3ecc..054677654 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1080,11 +1080,7 @@ static void linphone_gtk_notify(LinphoneCall *call, const char *msg){ static void on_call_updated_response(GtkWidget *dialog, gint responseid, LinphoneCall *call){ if (linphone_call_get_state(call)==LinphoneCallUpdatedByRemote){ - LinphoneCore *lc=linphone_call_get_core(call); - LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); - linphone_call_params_enable_video(params,responseid==GTK_RESPONSE_YES); - linphone_core_accept_call_update(lc,call,params); - linphone_call_params_destroy(params); + linphone_call_enable_video(call, responseid==GTK_RESPONSE_YES); } linphone_call_unref(call); g_source_remove_by_user_data(dialog); From 042890cddef0e27b568bb03a00fa7894927c399f Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 2 Aug 2012 12:17:57 +0200 Subject: [PATCH 400/769] GetVersion method for linphoneCore exported --- coreapi/linphonecore_jni.cc | 5 +++++ java/common/org/linphone/core/LinphoneCore.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 64837cab5..894e4c1f8 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1769,3 +1769,8 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPolicy(JNIEnv *e extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCountNative(JNIEnv *env, jobject thiz, jint count) { ms_set_cpu_count(count); } + +extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* env,jobject thiz,jlong ptr) { + jstring jvalue =env->NewStringUTF(linphone_core_get_version()); + return jvalue; +} diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 6f0ce2c65..e06342178 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -784,4 +784,8 @@ public interface LinphoneCore { */ public void refreshRegisters(); + /** + * return the version code of linphone core + */ + public String getVersion(); } From e1e58fbe4c4ec1bae178920261da939470915782 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 2 Aug 2012 12:30:27 +0200 Subject: [PATCH 401/769] Using real useragent when creating an account --- LinphoneCoreImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 1f182b47f..e4f8dd062 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -110,6 +110,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void removeCallLog(long nativePtr, long callLogPtr); private native int getMissedCallsCount(long nativePtr); private native void resetMissedCallsCount(long nativePtr); + private native String getVersion(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -731,4 +732,9 @@ class LinphoneCoreImpl implements LinphoneCore { public void refreshRegisters() { refreshRegisters(nativePtr); } + + @Override + public String getVersion() { + return getVersion(nativePtr); + } } From 5f2640d57a48e122cb14ffa2df23304103e3d6a9 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 2 Aug 2012 12:45:15 +0200 Subject: [PATCH 402/769] Android Makefile changed to automatically update linphone version --- build/android/common.mk | 6 +++++- configure.ac | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build/android/common.mk b/build/android/common.mk index c85318ee4..40742b959 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -50,13 +50,17 @@ ifndef MY_LOG_DOMAIN MY_LOG_DOMAIN = \"Linphone\" endif +ifndef LINPHONE_VERSION +LINPHONE_VERSION = \"Devel\" +endif + LOCAL_CFLAGS += \ -D_BYTE_ORDER=_LITTLE_ENDIAN \ -DORTP_INET6 \ -DINET6 \ -DOSIP_MT \ -DENABLE_TRACE \ - -DLINPHONE_VERSION=\"3.4.0\" \ + -DLINPHONE_VERSION=\"$(LINPHONE_VERSION)\" \ -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ -DLOG_DOMAIN=$(MY_LOG_DOMAIN) diff --git a/configure.ac b/configure.ac index 235fb79b1..8dbf90482 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,8 @@ dnl Process this file with autoconf to produce a configure script. +dnl Keep this line, it is parsed by Android Makefile +LINPHONE_VERSION=3.5.2 -AC_INIT([linphone],[3.5.2],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[$LINPHONE_VERSION],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) From fa824200e39d50277abb0e92bd50571ecd37a363 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 2 Aug 2012 15:39:48 +0200 Subject: [PATCH 403/769] Prevent video stop on ICE reinvite when video connectivity checks are finished. --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index da573d074..921e1800e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2538,7 +2538,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const return -1; } if (params==NULL){ - call->params.has_video=lc->video_policy.automatically_accept; + call->params.has_video=lc->video_policy.automatically_accept || call->current_params.has_video; }else call->params=*params; From 93db3330b68ed6e0d6e21da915eb904dde151c3f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 2 Aug 2012 18:03:48 +0200 Subject: [PATCH 404/769] Prevent crash, video stream may not exist at this time. --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 19e64b096..d8fcb12c9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -572,7 +572,7 @@ void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) } } } else { - if (ice_session != NULL) { + if ((ice_session != NULL) && (call->videostream != NULL)) { ice_session_remove_check_list(ice_session, call->videostream->ice_check_list); call->videostream->ice_check_list = NULL; } From e6ef8b45a4d109f06b452276061303c0e2173dda Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Fri, 3 Aug 2012 09:41:00 +0200 Subject: [PATCH 405/769] Update MS2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 94eb4afe7..ec0a638d5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 94eb4afe778c5fab72ca3e4defca42bc2a4d8118 +Subproject commit ec0a638d5c487ca8b7916094d14ad3967db62ce3 From a58b548331c103bca50b33898b07e13f5745b1c4 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 3 Aug 2012 13:44:43 +0200 Subject: [PATCH 406/769] fix version number declaration --- configure.ac | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8dbf90482..235fb79b1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -dnl Keep this line, it is parsed by Android Makefile -LINPHONE_VERSION=3.5.2 -AC_INIT([linphone],[$LINPHONE_VERSION],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.5.2],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) From bde9b86e968531cfdef2677f54abfecf6e9876ab Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 3 Aug 2012 16:33:22 +0200 Subject: [PATCH 407/769] add API to set custom parameters in the SIP contact address of registers. --- coreapi/linphonecore.h | 2 ++ coreapi/private.h | 1 + coreapi/proxy.c | 34 ++++++++++++++++++++++++++++++++-- mediastreamer2 | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 81044fff5..a269bc476 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -474,6 +474,8 @@ const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj); int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj); bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj); void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj); +const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj); +void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params); struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj); bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg); diff --git a/coreapi/private.h b/coreapi/private.h index 1ab7a6a7d..bc035f215 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -270,6 +270,7 @@ struct _LinphoneProxyConfig char *reg_identity; char *reg_route; char *realm; + char *contact_params; int expires; int reg_time; SalOp *op; diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 1676e0918..8e066ea33 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -256,9 +256,10 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){ if (proxy==NULL) return NULL; host=linphone_address_get_domain (proxy); if (host!=NULL){ - LinphoneAddress *contact; char localip[LINPHONE_IPADDR_SIZE]; + char *tmp; LCSipTransports tr; + LinphoneAddress *contact; linphone_core_get_local_ip(obj->lc,host,localip); contact=linphone_address_new(obj->reg_identity); @@ -274,8 +275,12 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){ sal_address_set_param(contact,"transport","tls"); } } - ret=linphone_address_as_string(contact); + tmp=linphone_address_as_string_uri_only(contact); + if (obj->contact_params) + ret=ms_strdup_printf("<%s;%s>",tmp,obj->contact_params); + else ret=ms_strdup_printf("<%s>",tmp); linphone_address_destroy(contact); + ms_free(tmp); } linphone_address_destroy (proxy); return ret; @@ -511,6 +516,31 @@ bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj){ return obj->reg_sendregister; } +/** + * Set optional contact parameters that will be added to the contact information sent in the registration. + * @param obj the proxy config object + * @param contact_params a string contaning the additional parameters in text form, like "myparam=something;myparam2=something_else" + * + * The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or apple push id. + * As an example, the contact address in the SIP register sent will look like . +**/ +void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params){ + if (obj->contact_params) { + ms_free(obj->contact_params); + obj->contact_params=NULL; + } + if (contact_params){ + obj->contact_params=ms_strdup(contact_params); + } +} + +/** + * Returns previously set contact parameters. +**/ +const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj){ + return obj->contact_params; +} + struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj){ return obj->lc; } diff --git a/mediastreamer2 b/mediastreamer2 index 94eb4afe7..ec0a638d5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 94eb4afe778c5fab72ca3e4defca42bc2a4d8118 +Subproject commit ec0a638d5c487ca8b7916094d14ad3967db62ce3 From 3be24046c2cd689216166ca7339bee6a3e78ce4f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 6 Aug 2012 10:40:59 +0200 Subject: [PATCH 408/769] update documentation --- coreapi/linphonecore.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index a269bc476..3d10a26af 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -720,11 +720,11 @@ typedef struct _LinphoneVTable{ BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/ NotifyReceivedCb notify_recv; /**< Other notifications*/ CallStatsUpdated call_stats_updated; /** Date: Fri, 3 Aug 2012 10:53:49 +0200 Subject: [PATCH 409/769] Redesign ICE integration to prevent Sal from depending on ICE. - Move the ICE session from the Sal Op to the LinphoneCall. - Do not access directly to the ICE session to generate the SDP from the media description or to generate the media description from the SDP. Instead include ICE attributes in the media description. --- coreapi/callbacks.c | 5 +- coreapi/linphonecall.c | 63 ++++---- coreapi/linphonecore.c | 2 +- coreapi/misc.c | 9 +- coreapi/private.h | 1 + coreapi/sal.c | 10 -- coreapi/sal.h | 41 ++++- coreapi/sal_eXosip2.c | 37 ++--- coreapi/sal_eXosip2.h | 4 +- coreapi/sal_eXosip2_sdp.c | 326 ++++++++++++-------------------------- 10 files changed, 187 insertions(+), 311 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index dd17650f5..63327de66 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -187,7 +187,7 @@ static void call_received(SalOp *h){ linphone_core_add_call(lc,call); linphone_call_ref(call); /*prevent the call from being destroyed while we are notifying, if the user declines within the state callback */ - if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && sal_op_get_ice_session(call->op)) { + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)) { /* Defer ringing until the end of the ICE candidates gathering process. */ ms_message("Defer ringing to gather ICE candidates"); return; @@ -254,7 +254,6 @@ static void call_ringing(SalOp *h){ static void call_accepted(SalOp *op){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); - IceSession *ice_session=sal_op_get_ice_session(op); SalMediaDescription *md; if (call==NULL){ @@ -262,7 +261,7 @@ static void call_accepted(SalOp *op){ return ; } - if (ice_session == NULL) { + if (call->ice_session == NULL) { /* Ensure the ICE check list pointers for the call streams are resetted to prevent crashes */ if (call->audiostream != NULL) call->audiostream->ice_check_list = NULL; if (call->videostream != NULL) call->videostream->ice_check_list = NULL; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d8fcb12c9..4a06a7873 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -201,7 +201,6 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li LinphoneAddress *addr=linphone_address_new(me); const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); - IceSession *ice_session=sal_op_get_ice_session(call->op); md->session_id=session_id; md->session_ver=session_ver; @@ -249,8 +248,8 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].crypto[2].algo = 0; } if ((call->dir == LinphoneCallOutgoing) && (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) - && (ice_session != NULL) && (ice_session_check_list(ice_session, i) == NULL)) { - ice_session_add_check_list(ice_session, ice_check_list_new()); + && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, i) == NULL)) { + ice_session_add_check_list(call->ice_session, ice_check_list_new()); } } @@ -346,8 +345,8 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr linphone_call_init_common(call,from,to); call->params=*params; if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) { - sal_op_set_ice_session(call->op, ice_session_new()); - ice_session_set_role(sal_op_get_ice_session(call->op), IR_Controlling); + call->ice_session = ice_session_new(); + ice_session_set_role(call->ice_session, IR_Controlling); } call->localdesc=create_local_media_description (lc,call); call->camera_active=params->has_video; @@ -403,9 +402,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_core_run_stun_tests(call->core,call); /* No break to also destroy ice session in this case. */ default: - if (sal_op_get_ice_session(call->op) != NULL) { - linphone_call_delete_ice_session(call); - } + linphone_call_delete_ice_session(call); break; } discover_mtu(lc,linphone_address_get_domain(from)); @@ -552,11 +549,10 @@ void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) { LinphoneCore *lc=linphone_call_get_core(call); LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); - IceSession *ice_session=sal_op_get_ice_session(call->op); linphone_call_params_enable_video(params, enabled); if (enabled == TRUE) { - if (ice_session != NULL) { + if (call->ice_session != NULL) { /* Defer call update until the ICE candidates gathering process has finished. */ ms_message("Defer call update to gather ICE candidates"); call->params = *params; @@ -572,8 +568,8 @@ void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) } } } else { - if ((ice_session != NULL) && (call->videostream != NULL)) { - ice_session_remove_check_list(ice_session, call->videostream->ice_check_list); + if ((call->ice_session != NULL) && (call->videostream != NULL)) { + ice_session_remove_check_list(call->ice_session, call->videostream->ice_check_list); call->videostream->ice_check_list = NULL; } if (linphone_call_get_state(call) == LinphoneCallUpdatedByRemote) { @@ -610,6 +606,9 @@ static void linphone_call_destroy(LinphoneCall *obj) if (obj->auth_token) { ms_free(obj->auth_token); } + if (obj->ice_session) { + ice_session_destroy(obj->ice_session); + } ms_free(obj); } @@ -971,7 +970,6 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; AudioStream *audiostream; - IceSession *ice_session = sal_op_get_ice_session(call->op); call->audiostream=audiostream=audio_stream_new(md->streams[0].rtp_port,md->streams[0].rtcp_port,linphone_core_ipv6_enabled(lc)); if (linphone_core_echo_limiter_enabled(lc)){ @@ -1004,9 +1002,9 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ RtpTransport *artcp=lc->rtptf->audio_rtcp_func(lc->rtptf->audio_rtcp_func_data, call->audio_port+1); rtp_session_set_transports(audiostream->session,artp,artcp); } - if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)){ rtp_session_set_pktinfo(audiostream->session, TRUE); - audiostream->ice_check_list = ice_session_check_list(ice_session, 0); + audiostream->ice_check_list = ice_session_check_list(call->ice_session, 0); ice_check_list_set_rtp_session(audiostream->ice_check_list, audiostream->session); } @@ -1018,7 +1016,6 @@ void linphone_call_init_video_stream(LinphoneCall *call){ #ifdef VIDEO_ENABLED LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; - IceSession *ice_session = sal_op_get_ice_session(call->op); if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].rtp_port>0){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); @@ -1034,9 +1031,9 @@ void linphone_call_init_video_stream(LinphoneCall *call){ RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); } - if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL) && (ice_session_check_list(ice_session, 1))){ + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, 1))){ rtp_session_set_pktinfo(call->videostream->session, TRUE); - call->videostream->ice_check_list = ice_session_check_list(ice_session, 1); + call->videostream->ice_check_list = ice_session_check_list(call->ice_session, 1); ice_check_list_set_rtp_session(call->videostream->ice_check_list, call->videostream->session); } call->videostream_app_evq = ortp_ev_queue_new(); @@ -1495,8 +1492,8 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut /*also reflect the change if the "wished" params, in order to avoid to propose SAVP or video again * further in the call, for example during pause,resume, conferencing reINVITEs*/ linphone_call_fix_call_parameters(call); - if ((sal_op_get_ice_session(call->op) != NULL) && (ice_session_state(sal_op_get_ice_session(call->op)) != IS_Completed)) { - ice_session_start_connectivity_checks(sal_op_get_ice_session(call->op)); + if ((call->ice_session != NULL) && (ice_session_state(call->ice_session) != IS_Completed)) { + ice_session_start_connectivity_checks(call->ice_session); } goto end; @@ -1513,10 +1510,9 @@ void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call){ } void linphone_call_delete_ice_session(LinphoneCall *call){ - IceSession *ice_session = sal_op_get_ice_session(call->op); - if (ice_session != NULL) { - ice_session_destroy(ice_session); - sal_op_set_ice_session(call->op, NULL); + if (call->ice_session != NULL) { + ice_session_destroy(call->ice_session); + call->ice_session = NULL; if (call->audiostream != NULL) call->audiostream->ice_check_list = NULL; if (call->videostream != NULL) call->videostream->ice_check_list = NULL; } @@ -1739,19 +1735,18 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ OrtpEventData *evd=ortp_event_get_data(ev); if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - if (ice_session_role(sal_op_get_ice_session(call->op)) == IR_Controlling) { + if (ice_session_role(call->ice_session) == IR_Controlling) { linphone_core_update_call(call->core, call, &call->current_params); } } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { - IceSession *ice_session = sal_op_get_ice_session(call->op); LinphoneCallParams *params; switch (call->state) { case LinphoneCallStreamsRunning: case LinphoneCallUpdatedByRemote: if (evd->info.ice_processing_successful==TRUE) { - ice_session_compute_candidates_foundations(ice_session); - ice_session_eliminate_redundant_candidates(ice_session); - ice_session_choose_default_candidates(ice_session); + ice_session_compute_candidates_foundations(call->ice_session); + ice_session_eliminate_redundant_candidates(call->ice_session); + ice_session_choose_default_candidates(call->ice_session); } params = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_call_params_enable_video(params, TRUE); @@ -1766,9 +1761,9 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ default: linphone_call_stop_media_streams(call); if (evd->info.ice_processing_successful==TRUE) { - ice_session_compute_candidates_foundations(ice_session); - ice_session_eliminate_redundant_candidates(ice_session); - ice_session_choose_default_candidates(ice_session); + ice_session_compute_candidates_foundations(call->ice_session); + ice_session_eliminate_redundant_candidates(call->ice_session); + ice_session_choose_default_candidates(call->ice_session); } else { linphone_call_delete_ice_session(call); } @@ -1808,7 +1803,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse OrtpEvent *ev; /* Ensure there is no dangling ICE check list. */ - if (sal_op_get_ice_session(call->op) == NULL) call->videostream->ice_check_list = NULL; + if (call->ice_session == NULL) call->videostream->ice_check_list = NULL; // Beware that the application queue should not depend on treatments fron the // mediastreamer queue. @@ -1846,7 +1841,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse OrtpEvent *ev; /* Ensure there is no dangling ICE check list. */ - if (sal_op_get_ice_session(call->op) == NULL) call->audiostream->ice_check_list = NULL; + if (call->ice_session == NULL) call->audiostream->ice_check_list = NULL; // Beware that the application queue should not depend on treatments fron the // mediastreamer queue. diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 921e1800e..6f08e9260 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1852,7 +1852,7 @@ void linphone_core_iterate(LinphoneCore *lc){ linphone_call_background_tasks(call,one_second_elapsed); if (call->state==LinphoneCallOutgoingInit && (curtime-call->start_time>=2)){ /*start the call even if the OPTIONS reply did not arrive*/ - if (sal_op_get_ice_session(call->op) != NULL) { + if (call->ice_session != NULL) { /* ICE candidates gathering has not finished yet, proceed with the call without ICE anyway. */ linphone_call_delete_ice_session(call); linphone_call_stop_media_streams(call); diff --git a/coreapi/misc.c b/coreapi/misc.c index 0e4be8e11..a59aca886 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -569,12 +569,11 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) socklen_t ss_len; IceCheckList *audio_check_list; IceCheckList *video_check_list; - IceSession *ice_session = sal_op_get_ice_session(call->op); const char *server = linphone_core_get_stun_server(lc); - if ((server == NULL) || (ice_session == NULL)) return -1; - audio_check_list = ice_session_check_list(ice_session, 0); - video_check_list = ice_session_check_list(ice_session, 1); + if ((server == NULL) || (call->ice_session == NULL)) return -1; + audio_check_list = ice_session_check_list(call->ice_session, 0); + video_check_list = ice_session_check_list(call->ice_session, 1); if (audio_check_list == NULL) return -1; if (lc->sip_conf.ipv6_enabled){ @@ -602,7 +601,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) } /* Gather local srflx candidates. */ - ice_session_gather_candidates(ice_session, ss, ss_len); + ice_session_gather_candidates(call->ice_session, ss, ss_len); return 0; } diff --git a/coreapi/private.h b/coreapi/private.h index 61d1d4179..bc65e946e 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -136,6 +136,7 @@ struct _LinphoneCall bool_t was_automatically_paused; CallCallbackObj nextVideoFrameDecoded; LinphoneCallStats stats[2]; + IceSession *ice_session; }; diff --git a/coreapi/sal.c b/coreapi/sal.c index 5b592b8d3..a7bb00e3e 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -234,10 +234,6 @@ void sal_op_set_user_pointer(SalOp *op, void *up){ ((SalOpBase*)op)->user_pointer=up; } -void sal_op_set_ice_session(SalOp *op, IceSession *ice_session){ - ((SalOpBase*)op)->ice_session=ice_session; -} - Sal *sal_op_get_sal(const SalOp *op){ return ((SalOpBase*)op)->root; } @@ -266,10 +262,6 @@ void *sal_op_get_user_pointer(const SalOp *op){ return ((SalOpBase*)op)->user_pointer; } -IceSession *sal_op_get_ice_session(const SalOp *op){ - return ((SalOpBase*)op)->ice_session; -} - const char *sal_op_get_proxy(const SalOp *op){ return ((SalOpBase*)op)->route; } @@ -318,8 +310,6 @@ void __sal_op_free(SalOp *op){ sal_media_description_unref(b->local_media); if (b->remote_media) sal_media_description_unref(b->remote_media); - if (b->ice_session) - ice_session_destroy(b->ice_session); ms_free(op); } diff --git a/coreapi/sal.h b/coreapi/sal.h index 8a51fa4a4..dfb560472 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define sal_h #include "mediastreamer2/mscommon.h" -#include "mediastreamer2/ice.h" #include "ortp/ortp_srtp.h" /*Dirty hack, keep in sync with mediastreamer2/include/mediastream.h */ @@ -113,6 +112,33 @@ typedef struct SalEndpointCandidate{ #define SAL_ENDPOINT_CANDIDATE_MAX 2 +#define SAL_MEDIA_DESCRIPTION_MAX_ICE_ADDR_LEN 64 +#define SAL_MEDIA_DESCRIPTION_MAX_ICE_FOUNDATION_LEN 32 +#define SAL_MEDIA_DESCRIPTION_MAX_ICE_TYPE_LEN 6 + +typedef struct SalIceCandidate { + char addr[SAL_MEDIA_DESCRIPTION_MAX_ICE_ADDR_LEN]; + char raddr[SAL_MEDIA_DESCRIPTION_MAX_ICE_ADDR_LEN]; + char foundation[SAL_MEDIA_DESCRIPTION_MAX_ICE_FOUNDATION_LEN]; + char type[SAL_MEDIA_DESCRIPTION_MAX_ICE_TYPE_LEN]; + unsigned int componentID; + unsigned int priority; + int port; + int rport; +} SalIceCandidate; + +#define SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES 10 + +typedef struct SalIceRemoteCandidate { + char addr[SAL_MEDIA_DESCRIPTION_MAX_ICE_ADDR_LEN]; + int port; +} SalIceRemoteCandidate; + +#define SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES 2 + +#define SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN 256 +#define SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN 256 + typedef struct SalSrtpCryptoAlgo { unsigned int tag; enum ortp_srtp_crypto_suite_t algo; @@ -138,6 +164,11 @@ typedef struct SalStreamDescription{ SalSrtpCryptoAlgo crypto[SAL_CRYPTO_ALGO_MAX]; unsigned int crypto_local_tag; int max_rate; + SalIceCandidate ice_candidates[SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES]; + SalIceRemoteCandidate ice_remote_candidates[SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES]; + char ice_ufrag[SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN]; + char ice_pwd[SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN]; + bool_t ice_mismatch; } SalStreamDescription; #define SAL_MEDIA_DESCRIPTION_MAX_STREAMS 4 @@ -151,10 +182,13 @@ typedef struct SalMediaDescription{ unsigned int session_ver; unsigned int session_id; SalStreamDescription streams[SAL_MEDIA_DESCRIPTION_MAX_STREAMS]; + char ice_ufrag[SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN]; + char ice_pwd[SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN]; + bool_t ice_lite; + bool_t ice_completed; } SalMediaDescription; #define SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES 5 -#define SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES 10 SalMediaDescription *sal_media_description_new(); void sal_media_description_ref(SalMediaDescription *md); @@ -177,7 +211,6 @@ typedef struct SalOpBase{ char *remote_ua; SalMediaDescription *local_media; SalMediaDescription *remote_media; - IceSession *ice_session; void *user_pointer; } SalOpBase; @@ -322,7 +355,6 @@ void sal_op_release(SalOp *h); void sal_op_authenticate(SalOp *h, const SalAuthInfo *info); void sal_op_cancel_authentication(SalOp *h); void sal_op_set_user_pointer(SalOp *h, void *up); -void sal_op_set_ice_session(SalOp *h, IceSession *ice_session); int sal_op_get_auth_requested(SalOp *h, const char **realm, const char **username); const char *sal_op_get_from(const SalOp *op); const char *sal_op_get_to(const SalOp *op); @@ -334,7 +366,6 @@ const char *sal_op_get_network_origin(const SalOp *op); /*returns far-end "User-Agent" string */ const char *sal_op_get_remote_ua(const SalOp *op); void *sal_op_get_user_pointer(const SalOp *op); -IceSession *sal_op_get_ice_session(const SalOp *op); /*Call API*/ int sal_call_set_local_media_description(SalOp *h, SalMediaDescription *desc); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 42f11eca0..a9f3559b6 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -502,8 +502,8 @@ static void set_sdp(osip_message_t *sip,sdp_message_t *msg){ osip_free(sdp); } -static void set_sdp_from_desc(osip_message_t *sip, const SalMediaDescription *desc, const IceSession *ice_session){ - sdp_message_t *msg=media_description_to_sdp(desc, ice_session); +static void set_sdp_from_desc(osip_message_t *sip, const SalMediaDescription *desc){ + sdp_message_t *msg=media_description_to_sdp(desc); if (msg==NULL) { ms_error("Fail to print sdp message !"); return; @@ -526,7 +526,7 @@ static void sdp_process(SalOp *h){ sdp_message_free(h->sdp_answer); } offer_answer_initiate_incoming(h->base.local_media,h->base.remote_media,h->result,h->base.root->one_matching_codec); - h->sdp_answer=media_description_to_sdp(h->result, sal_op_get_ice_session(h)); + h->sdp_answer=media_description_to_sdp(h->result); /*once we have generated the SDP answer, we modify the result description for processing by the upper layer. It should contains media parameters constraint from the remote offer, not our response*/ strcpy(h->result->addr,h->base.remote_media->addr); @@ -600,7 +600,7 @@ int sal_call(SalOp *h, const char *from, const char *to){ } if (h->base.local_media){ h->sdp_offering=TRUE; - set_sdp_from_desc(invite,h->base.local_media,sal_op_get_ice_session(h)); + set_sdp_from_desc(invite,h->base.local_media); }else h->sdp_offering=FALSE; if (h->replaces){ osip_message_set_header(invite,"Replaces",h->replaces); @@ -668,7 +668,7 @@ int sal_call_accept(SalOp * h){ if (h->base.local_media){ /*this is the case where we received an invite without SDP*/ if (h->sdp_offering) { - set_sdp_from_desc(msg,h->base.local_media,sal_op_get_ice_session(h)); + set_sdp_from_desc(msg,h->base.local_media); }else{ if (h->sdp_answer==NULL) sdp_process(h); if (h->sdp_answer){ @@ -990,7 +990,6 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ osip_call_info_t *call_info; char *tmp; sdp_message_t *sdp=eXosip_get_sdp_info(ev->request); - IceSession *ice_session; set_network_origin(op,ev->request); set_remote_ua(op,ev->request); @@ -999,9 +998,7 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ if (sdp){ op->sdp_offering=FALSE; op->base.remote_media=sal_media_description_new(); - ice_session=sal_op_get_ice_session(op); - sdp_to_media_description(sdp,op->base.remote_media,&ice_session); - sal_op_set_ice_session(op,ice_session); + sdp_to_media_description(sdp,op->base.remote_media); sdp_message_free(sdp); }else op->sdp_offering=TRUE; @@ -1037,7 +1034,6 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ static void handle_reinvite(Sal *sal, eXosip_event_t *ev){ SalOp *op=find_op(sal,ev); sdp_message_t *sdp; - IceSession *ice_session; if (op==NULL) { ms_warning("Reinvite for non-existing operation !"); @@ -1057,9 +1053,7 @@ static void handle_reinvite(Sal *sal, eXosip_event_t *ev){ if (sdp){ op->sdp_offering=FALSE; op->base.remote_media=sal_media_description_new(); - ice_session=sal_op_get_ice_session(op); - sdp_to_media_description(sdp,op->base.remote_media,&ice_session); - sal_op_set_ice_session(op,ice_session); + sdp_to_media_description(sdp,op->base.remote_media); sdp_message_free(sdp); }else { @@ -1071,7 +1065,6 @@ static void handle_reinvite(Sal *sal, eXosip_event_t *ev){ static void handle_ack(Sal *sal, eXosip_event_t *ev){ SalOp *op=find_op(sal,ev); sdp_message_t *sdp; - IceSession *ice_session; if (op==NULL) { ms_warning("ack for non-existing call !"); @@ -1088,9 +1081,7 @@ static void handle_ack(Sal *sal, eXosip_event_t *ev){ if (op->base.remote_media) sal_media_description_unref(op->base.remote_media); op->base.remote_media=sal_media_description_new(); - ice_session=sal_op_get_ice_session(op); - sdp_to_media_description(sdp,op->base.remote_media,&ice_session); - sal_op_set_ice_session(op,ice_session); + sdp_to_media_description(sdp,op->base.remote_media); sdp_process(op); sdp_message_free(sdp); } @@ -1150,16 +1141,13 @@ static int call_proceeding(Sal *sal, eXosip_event_t *ev){ static void call_ringing(Sal *sal, eXosip_event_t *ev){ sdp_message_t *sdp; SalOp *op=find_op(sal,ev); - IceSession *ice_session; if (call_proceeding(sal, ev)==-1) return; set_remote_ua(op,ev->response); sdp=eXosip_get_sdp_info(ev->response); if (sdp){ op->base.remote_media=sal_media_description_new(); - ice_session=sal_op_get_ice_session(op); - sdp_to_media_description(sdp,op->base.remote_media,&ice_session); - sal_op_set_ice_session(op,ice_session); + sdp_to_media_description(sdp,op->base.remote_media); sdp_message_free(sdp); if (op->base.local_media) sdp_process(op); } @@ -1171,7 +1159,6 @@ static void call_accepted(Sal *sal, eXosip_event_t *ev){ osip_message_t *msg=NULL; SalOp *op=find_op(sal,ev); const char *contact; - IceSession *ice_session; if (op==NULL || op->terminated==TRUE) { ms_warning("This call has been already terminated."); @@ -1187,9 +1174,7 @@ static void call_accepted(Sal *sal, eXosip_event_t *ev){ sdp=eXosip_get_sdp_info(ev->response); if (sdp){ op->base.remote_media=sal_media_description_new(); - ice_session=sal_op_get_ice_session(op); - sdp_to_media_description(sdp,op->base.remote_media,&ice_session); - sal_op_set_ice_session(op,ice_session); + sdp_to_media_description(sdp,op->base.remote_media); sdp_message_free(sdp); if (op->base.local_media) sdp_process(op); } @@ -2427,7 +2412,7 @@ int sal_call_update(SalOp *h, const char *subject){ } if (h->base.local_media){ h->sdp_offering=TRUE; - set_sdp_from_desc(reinvite,h->base.local_media,sal_op_get_ice_session(h)); + set_sdp_from_desc(reinvite,h->base.local_media); }else h->sdp_offering=FALSE; eXosip_lock(); err = eXosip_call_send_request(h->did, reinvite); diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index e3264f74d..ccc95d56a 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -sdp_message_t *media_description_to_sdp(const SalMediaDescription *sal, const IceSession *ice_session); -int sdp_to_media_description(sdp_message_t *sdp, SalMediaDescription *desc, IceSession **ice_session); +sdp_message_t *media_description_to_sdp(const SalMediaDescription *sal); +int sdp_to_media_description(sdp_message_t *sdp, SalMediaDescription *desc); struct Sal{ SalCallbacks callbacks; diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 1cd88cad7..e03e65bae 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -124,7 +124,7 @@ static int _sdp_message_get_mline_dir(sdp_message_t *sdp, int mline){ return SalStreamSendRecv; } -static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const IceSession *ice_session) +static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) { sdp_message_t *local; int inet6; @@ -144,14 +144,6 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const osip_strdup ("IN"), inet6 ? osip_strdup("IP6") : osip_strdup ("IP4"), osip_strdup (desc->addr)); sdp_message_s_name_set (local, osip_strdup ("Talk")); - if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { - if (ice_session_state(ice_session) == IS_Completed) { - ice_check_list_nominated_valid_local_candidate(ice_session_check_list(ice_session, 0), &rtp_addr, NULL, NULL, NULL); - } - else { - ice_check_list_default_local_candidate(ice_session_check_list(ice_session, 0), &rtp_addr, NULL, NULL, NULL); - } - } if(!sal_media_description_has_dir (desc,SalStreamSendOnly)) { sdp_message_c_connection_add (local, -1, @@ -167,23 +159,9 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc, const sdp_message_t_time_descr_add (local, osip_strdup ("0"), osip_strdup ("0")); if (desc->bandwidth>0) sdp_message_b_bandwidth_add (local, -1, osip_strdup ("AS"), int_2char(desc->bandwidth)); - if ((ice_session != NULL) && (ice_session_check_list(ice_session, 0) != NULL)) { - char buffer[512]; - switch (ice_session_state(ice_session)) { - case IS_Completed: - sdp_message_a_attribute_add(local, -1, osip_strdup("nortpproxy"), osip_strdup("yes")); - /* No break to also include the ice-ufrag and ice-pwd attributes when ICE session is completed. */ - case IS_Running: - case IS_Stopped: - snprintf(buffer, sizeof(buffer), "%s", ice_session_local_pwd(ice_session)); - sdp_message_a_attribute_add(local, -1, osip_strdup("ice-pwd"), osip_strdup(buffer)); - snprintf(buffer, sizeof(buffer), "%s", ice_session_local_ufrag(ice_session)); - sdp_message_a_attribute_add(local, -1, osip_strdup("ice-ufrag"), osip_strdup(buffer)); - break; - default: - break; - } - } + if (desc->ice_completed == TRUE) sdp_message_a_attribute_add(local, -1, osip_strdup("nortpproxy"), osip_strdup("yes")); + if (desc->ice_pwd[0] != '\0') sdp_message_a_attribute_add(local, -1, osip_strdup("ice-pwd"), osip_strdup(desc->ice_pwd)); + if (desc->ice_ufrag[0] != '\0') sdp_message_a_attribute_add(local, -1, osip_strdup("ice-ufrag"), osip_strdup(desc->ice_ufrag)); return local; } @@ -224,83 +202,57 @@ static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt, boo } } -static void add_candidate_attribute(sdp_message_t *msg, int lineno, const IceCandidate *candidate) +static void add_ice_candidates(sdp_message_t *msg, int lineno, const SalStreamDescription *desc) { char buffer[1024]; + const SalIceCandidate *candidate; int nb; + int i; - nb = snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", - candidate->foundation, candidate->componentID, candidate->priority, candidate->taddr.ip, candidate->taddr.port, ice_candidate_type(candidate)); - if (nb < 0) { - ms_error("Cannot add ICE candidate attribute!"); - return; - } - if (candidate->type != ICT_HostCandidate) { - nb = snprintf(buffer + nb, sizeof(buffer) - nb, " raddr %s rport %d", candidate->base->taddr.ip, candidate->base->taddr.port); + for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES; i++) { + candidate = &desc->ice_candidates[i]; + if ((candidate->addr[0] == '\0') || (candidate->port == 0)) break; + nb = snprintf(buffer, sizeof(buffer), "%s %u UDP %u %s %d typ %s", + candidate->foundation, candidate->componentID, candidate->priority, candidate->addr, candidate->port, candidate->type); if (nb < 0) { ms_error("Cannot add ICE candidate attribute!"); return; } - } - sdp_message_a_attribute_add(msg, lineno, osip_strdup("candidate"), osip_strdup(buffer)); -} - -static void add_ice_candidates(sdp_message_t *msg, int lineno, const IceCheckList *ice_cl, const char *rtp_addr, int rtp_port, const char *rtcp_addr, int rtcp_port) -{ - const IceCandidate *candidate; - int i; - - if ((ice_check_list_state(ice_cl) == ICL_Failed) && ice_check_list_is_mismatch(ice_cl)) { - sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-mismatch"), NULL); - return; - } - for (i = 0; i < ms_list_size(ice_cl->local_candidates); i++) { - candidate = ms_list_nth_data(ice_cl->local_candidates, i); - switch (ice_check_list_state(ice_cl)) { - case ICL_Running: - add_candidate_attribute(msg, lineno, candidate); - break; - case ICL_Completed: - /* Only include the candidates matching the default destination for each component of the stream as specified in RFC5245 section 9.1.2.2. */ - if (((candidate->taddr.port == rtp_port) && (strlen(candidate->taddr.ip) == strlen(rtp_addr)) && (strcmp(candidate->taddr.ip, rtp_addr) == 0)) - || ((candidate->taddr.port == rtcp_port) && (strlen(candidate->taddr.ip) == strlen(rtcp_addr)) && (strcmp(candidate->taddr.ip, rtcp_addr) == 0))) { - add_candidate_attribute(msg, lineno, candidate); - } - break; - default: - break; - } - } -} - -static void add_ice_remote_candidates(sdp_message_t *msg, int lineno, const IceCheckList *ice_cl) -{ - char buffer[1024]; - const char *rtp_addr = NULL; - const char *rtcp_addr = NULL; - int rtp_port; - int rtcp_port; - int nb; - - if ((ice_session_role(ice_cl->session) == IR_Controlling) && (ice_check_list_state(ice_cl) == ICL_Completed)) { - ice_check_list_nominated_valid_remote_candidate(ice_cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); - nb = snprintf(buffer, sizeof(buffer), "1 %s %d", rtp_addr, rtp_port); - if (nb < 0) { - ms_error("Cannot add ICE remote-candidates attribute!"); - return; - } - if (rtcp_addr != NULL) { - nb = snprintf(buffer + nb, sizeof(buffer) - nb, " 2 %s %d", rtcp_addr, rtcp_port); + if (candidate->raddr[0] != '\0') { + nb = snprintf(buffer + nb, sizeof(buffer) - nb, " raddr %s rport %d", candidate->raddr, candidate->rport); if (nb < 0) { - ms_error("Cannot add ICE remote-candidates attribute!"); + ms_error("Cannot add ICE candidate attribute!"); return; } } - sdp_message_a_attribute_add(msg, lineno, osip_strdup("remote-candidates"), osip_strdup(buffer)); + sdp_message_a_attribute_add(msg, lineno, osip_strdup("candidate"), osip_strdup(buffer)); } } -static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription *desc, const IceCheckList *ice_cl){ +static void add_ice_remote_candidates(sdp_message_t *msg, int lineno, const SalStreamDescription *desc) +{ + char buffer[1024]; + char *ptr = buffer; + const SalIceRemoteCandidate *candidate; + int offset = 0; + int i; + + buffer[0] = '\0'; + for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; i++) { + candidate = &desc->ice_remote_candidates[i]; + if ((candidate->addr[0] != '\0') && (candidate->port != 0)) { + offset = snprintf(ptr, buffer + sizeof(buffer) - ptr, "%s%d %s %d", (i > 0) ? " " : "", i + 1, candidate->addr, candidate->port); + if (offset < 0) { + ms_error("Cannot add ICE remote-candidates attribute!"); + return; + } + ptr += offset; + } + } + if (buffer[0] != '\0') sdp_message_a_attribute_add(msg, lineno, osip_strdup("remote-candidates"), osip_strdup(buffer)); +} + +static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription *desc){ const char *mt=NULL; const MSList *elem; const char *rtp_addr; @@ -309,6 +261,7 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription int rtp_port; int rtcp_port; bool_t strip_well_known_rtpmaps; + bool_t different_rtp_and_rtcp_addr; switch (desc->type) { case SalAudio: @@ -321,16 +274,11 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription mt=desc->typeother; break; } - rtp_addr=rtcp_addr=desc->rtp_addr; + rtp_addr=desc->rtp_addr; + rtcp_addr=desc->rtcp_addr; rtp_port=desc->rtp_port; rtcp_port=desc->rtcp_port; - if (ice_cl != NULL) { - if (ice_check_list_state(ice_cl) == ICL_Completed) { - ice_check_list_nominated_valid_local_candidate(ice_cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); - } else { - ice_check_list_default_local_candidate(ice_cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); - } - } else if (desc->candidates[0].addr[0]!='\0'){ + if (desc->candidates[0].addr[0]!='\0'){ rtp_addr=desc->candidates[0].addr; rtp_port=desc->candidates[0].port; } @@ -417,28 +365,34 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription break; } if (dir) sdp_message_a_attribute_add (msg, lineno, osip_strdup (dir),NULL); - if (ice_cl != NULL) { - if (strcmp(rtp_addr, rtcp_addr) != 0) { - char buffer[1024]; - snprintf(buffer, sizeof(buffer), "%u IN IP4 %s", rtcp_port, rtcp_addr); - sdp_message_a_attribute_add(msg, lineno, osip_strdup("rtcp"), osip_strdup(buffer)); - } else { - sdp_message_a_attribute_add(msg, lineno, osip_strdup("rtcp"), int_2char(rtcp_port)); + if (rtp_port != 0) { + different_rtp_and_rtcp_addr = (rtcp_addr[0] != '\0') && (strcmp(rtp_addr, rtcp_addr) != 0); + if ((rtcp_port != (rtp_port + 1)) || (different_rtp_and_rtcp_addr == TRUE)) { + if (different_rtp_and_rtcp_addr == TRUE) { + char buffer[1024]; + snprintf(buffer, sizeof(buffer), "%u IN IP4 %s", rtcp_port, rtcp_addr); + sdp_message_a_attribute_add(msg, lineno, osip_strdup("rtcp"), osip_strdup(buffer)); + } else { + sdp_message_a_attribute_add(msg, lineno, osip_strdup("rtcp"), int_2char(rtcp_port)); + } } - add_ice_candidates(msg, lineno, ice_cl, rtp_addr, rtp_port, rtcp_addr, rtcp_port); - add_ice_remote_candidates(msg, lineno, ice_cl); + } + if (desc->ice_mismatch == TRUE) { + sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-mismatch"), NULL); + } else { + if (desc->ice_pwd[0] != '\0') sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-pwd"), osip_strdup(desc->ice_pwd)); + if (desc->ice_ufrag[0] != '\0') sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-ufrag"), osip_strdup(desc->ice_ufrag)); + add_ice_candidates(msg, lineno, desc); + add_ice_remote_candidates(msg, lineno, desc); } } -sdp_message_t *media_description_to_sdp(const SalMediaDescription *desc, const IceSession *ice_session){ - IceCheckList *ice_cl = NULL; +sdp_message_t *media_description_to_sdp(const SalMediaDescription *desc){ int i; - sdp_message_t *msg=create_generic_sdp(desc, ice_session); + sdp_message_t *msg=create_generic_sdp(desc); for(i=0;instreams;++i){ - if (ice_session != NULL) ice_cl = ice_session_check_list(ice_session, i); - else ice_cl = NULL; - add_line(msg,i,&desc->streams[i], ice_cl); + add_line(msg,i,&desc->streams[i]); } return msg; } @@ -474,15 +428,12 @@ static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){ return 0; } -int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceSession **ice_session){ +int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ int i,j; const char *mtype,*proto,*rtp_port,*rtp_addr,*number; - const char *ice_ufrag, *ice_pwd, *ice_remote_candidates=NULL; sdp_bandwidth_t *sbw=NULL; sdp_attribute_t *attr; - int media_attribute_nb; - bool_t ice_session_just_created = FALSE; - bool_t ice_lite = FALSE; + int nb_ice_candidates; rtp_addr=sdp_message_c_addr_get (msg, -1, 0); if (rtp_addr) @@ -491,10 +442,22 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS if (strcasecmp(sbw->b_bwtype,"AS")==0) desc->bandwidth=atoi(sbw->b_bandwidth); } + /* Get ICE remote ufrag and remote pwd, and ice_lite flag */ + for (i = 0; (i < SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES) && ((attr = sdp_message_attribute_get(msg, -1, i)) != NULL); i++) { + if ((keywordcmp("ice-ufrag", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + strncpy(desc->ice_ufrag, attr->a_att_value, sizeof(desc->ice_ufrag)); + } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + strncpy(desc->ice_pwd, attr->a_att_value, sizeof(desc->ice_pwd)); + } else if (keywordcmp("ice-lite", attr->a_att_field) == 0) { + desc->ice_lite = TRUE; + } + } + /* for each m= line */ for (i=0; !sdp_message_endof_media (msg, i) && istreams[i]; + nb_ice_candidates = 0; memset(stream,0,sizeof(*stream)); mtype = sdp_message_m_media_get(msg, i); @@ -527,7 +490,6 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS if (strcasecmp(sbw->b_bwtype,"AS")==0) stream->bandwidth=atoi(sbw->b_bandwidth); } stream->dir=_sdp_message_get_mline_dir(msg,i); - media_attribute_nb = 0; /* for each payload type */ for (j=0;((number=sdp_message_m_payload_get (msg, i,j)) != NULL); j++){ const char *rtpmap,*fmtp; @@ -536,11 +498,9 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS payload_type_set_number(pt,ptn); /* get the rtpmap associated to this codec, if any */ rtpmap=sdp_message_a_attr_value_get_with_pt(msg, i,ptn,"rtpmap"); - if (rtpmap != NULL) media_attribute_nb++; if (payload_type_fill_from_rtpmap(pt,rtpmap)==0){ /* get the fmtp, if any */ fmtp=sdp_message_a_attr_value_get_with_pt(msg, i, ptn,"fmtp"); - if (fmtp != NULL) media_attribute_nb++; payload_type_set_send_fmtp(pt,fmtp); stream->payloads=ms_list_append(stream->payloads,pt); ms_message("Found payload %s/%i fmtp=%s",pt->mime_type,pt->clock_rate, @@ -608,121 +568,37 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS } /* Get ICE candidate attributes if any */ - ice_ufrag = ice_pwd = NULL; - for (j = 0; (j < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES) && ((attr = sdp_message_attribute_get(msg, i, media_attribute_nb + j)) != NULL); j++) { + for (j = 0; (attr = sdp_message_attribute_get(msg, i, j)) != NULL; j++) { if ((keywordcmp("candidate", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { - char ip[64]; - char foundation[32]; - char type[6]; - unsigned int priority; - unsigned int componentID; - unsigned int port; - int nb; - - /* Allocate the ICE session if it has not been done yet. */ - if (*ice_session == NULL) { - *ice_session = ice_session_new(); - ice_session_just_created = TRUE; - } - /* Allocate the ICE check list if it has not been done yet. */ - if (ice_session_check_list(*ice_session, i) == NULL) { - ice_session_add_check_list(*ice_session, ice_check_list_new()); - } - nb = sscanf(attr->a_att_value, "%s %u UDP %u %s %u typ %s", - foundation, &componentID, &priority, ip, &port, type); - if (nb == 6) { - char *default_ip = desc->addr; - unsigned int default_port = stream->rtp_port; - bool_t is_default_candidate = FALSE; - if (componentID == 1) { - if ((stream->rtp_addr == NULL) || (stream->rtp_addr[0] == '\0')) default_ip = desc->addr; - else default_ip = stream->rtp_addr; - default_port = stream->rtp_port; - } else if (componentID == 2) { - if ((stream->rtcp_addr == NULL) || (stream->rtcp_addr[0] == '\0')) default_ip = desc->addr; - else default_ip = stream->rtcp_addr; - default_port = stream->rtcp_port; - } - if ((port == default_port) && (strlen(ip) == strlen(default_ip)) && (strcmp(ip, default_ip) == 0)) is_default_candidate = TRUE; - ice_add_remote_candidate(ice_session_check_list(*ice_session, i), type, ip, port, componentID, priority, foundation, is_default_candidate); - } + SalIceCandidate *candidate = &stream->ice_candidates[nb_ice_candidates]; + int nb = sscanf(attr->a_att_value, "%s %u UDP %u %s %d typ %s raddr %s rport %d", + candidate->foundation, &candidate->componentID, &candidate->priority, candidate->addr, &candidate->port, + candidate->type, candidate->raddr, &candidate->rport); + if ((nb == 6) || (nb == 8)) nb_ice_candidates++; + else memset(candidate, 0, sizeof(*candidate)); } else if ((keywordcmp("remote-candidates", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { - ice_remote_candidates = attr->a_att_value; - } else if ((keywordcmp("ice-ufrag", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { - ice_ufrag = attr->a_att_value; - } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { - ice_pwd = attr->a_att_value; - } else if (keywordcmp("ice-mismatch", attr->a_att_field) == 0) { - ice_check_list_set_state(ice_session_check_list(*ice_session, i), ICL_Failed); - } - } - if ((*ice_session != NULL) && ice_session_check_list(*ice_session, i)) { - if (ice_remote_candidates != NULL) { - char ip[64]; - unsigned int port; + SalIceRemoteCandidate candidate; unsigned int componentID; int offset; - - while (3 == sscanf(ice_remote_candidates, "%u %s %u%n", &componentID, ip, &port, &offset)) { - if (componentID == 1) { - if ((stream->rtp_addr == NULL) || (stream->rtp_addr[0] == '\0')) rtp_addr = desc->addr; - else rtp_addr = stream->rtp_addr; - ice_add_losing_pair(ice_session_check_list(*ice_session, i), componentID, ip, port, rtp_addr, stream->rtp_port); - } else if (componentID == 2) { - if ((stream->rtcp_addr == NULL) || (stream->rtcp_addr[0] == '\0')) rtp_addr = desc->addr; - else rtp_addr = stream->rtcp_addr; - ice_add_losing_pair(ice_session_check_list(*ice_session, i), componentID, ip, port, rtp_addr, stream->rtcp_port); + char *ptr = attr->a_att_value; + while (3 == sscanf(ptr, "%u %s %u%n", &componentID, candidate.addr, &candidate.port, &offset)) { + if ((componentID > 0) && (componentID <= SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES)) { + SalIceRemoteCandidate *remote_candidate = &stream->ice_remote_candidates[componentID - 1]; + strncpy(remote_candidate->addr, candidate.addr, sizeof(remote_candidate->addr)); + remote_candidate->port = candidate.port; } - ice_remote_candidates += offset; - if (ice_remote_candidates[offset] == ' ') ice_remote_candidates += 1; + ptr += offset; + if (ptr[offset] == ' ') ptr += 1; } + } else if ((keywordcmp("ice-ufrag", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + strncpy(stream->ice_ufrag, attr->a_att_value, sizeof(stream->ice_ufrag)); + } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { + strncpy(stream->ice_pwd, attr->a_att_value, sizeof(stream->ice_pwd)); + } else if (keywordcmp("ice-mismatch", attr->a_att_field) == 0) { + stream->ice_mismatch = TRUE; } - if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { - ice_check_list_set_remote_credentials(ice_session_check_list(*ice_session, i), ice_ufrag, ice_pwd); - } - if (stream->rtp_port == 0) { - /* This stream has been deactivated by the peer, delete the check list. */ - ice_session_remove_check_list(*ice_session, ice_session_check_list(*ice_session, i)); - } - ice_dump_candidates(ice_session_check_list(*ice_session, i)); } } desc->nstreams=i; - - /* Get ICE remote ufrag and remote pwd */ - ice_ufrag = ice_pwd = NULL; - for (i = 0; (i < SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES) && ((attr = sdp_message_attribute_get(msg, -1, i)) != NULL); i++) { - if ((keywordcmp("ice-ufrag", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { - ice_ufrag = attr->a_att_value; - } else if ((keywordcmp("ice-pwd", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { - ice_pwd = attr->a_att_value; - } else if (keywordcmp("ice-lite", attr->a_att_field) == 0) { - ice_lite = TRUE; - } - } - if (*ice_session != NULL) { - int nb_check_lists; - if (ice_session_just_created == TRUE) { - if (ice_lite == TRUE) { - ice_session_set_role(*ice_session, IR_Controlling); - } else { - ice_session_set_role(*ice_session, IR_Controlled); - } - ice_session_check_mismatch(*ice_session); - } - while ((nb_check_lists = ice_session_nb_check_lists(*ice_session)) > desc->nstreams) { - ice_session_remove_check_list(*ice_session, ice_session_check_list(*ice_session, nb_check_lists - 1)); - } - if ((ice_ufrag != NULL) && (ice_pwd != NULL)) { - ice_session_set_remote_credentials(*ice_session, ice_ufrag, ice_pwd); - ice_dump_session(*ice_session); - } - if (((ice_session_just_created == FALSE) && ((ice_ufrag == NULL) || (ice_pwd == NULL))) - || (ice_session_state(*ice_session) == IS_Failed)) { - /* We started with ICE activated but the peer apparently do not support ICE, so stop using it. */ - ice_session_destroy(*ice_session); - *ice_session = NULL; - } - } return 0; } From 5742b453cd3c1c636a53c0106e3e282654597cc4 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 3 Aug 2012 14:45:09 +0200 Subject: [PATCH 410/769] Handle conversion between media description and ice session. --- coreapi/callbacks.c | 7 +-- coreapi/linphonecall.c | 7 ++- coreapi/linphonecore.c | 14 ++++- coreapi/misc.c | 122 +++++++++++++++++++++++++++++++++++++++++ coreapi/offeranswer.c | 9 +++ coreapi/private.h | 2 + 6 files changed, 151 insertions(+), 10 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 63327de66..ba2789235 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -261,10 +261,9 @@ static void call_accepted(SalOp *op){ return ; } - if (call->ice_session == NULL) { - /* Ensure the ICE check list pointers for the call streams are resetted to prevent crashes */ - if (call->audiostream != NULL) call->audiostream->ice_check_list = NULL; - if (call->videostream != NULL) call->videostream->ice_check_list = NULL; + /* Handle remote ICE attributes if any. */ + if (call->ice_session != NULL) { + linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(op)); } md=sal_call_get_final_media_description(op); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4a06a7873..7a1781696 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -247,8 +247,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].crypto[1].algo = 0; md->streams[i].crypto[2].algo = 0; } - if ((call->dir == LinphoneCallOutgoing) && (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) - && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, i) == NULL)) { + if ((linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, i) == NULL)) { ice_session_add_check_list(call->ice_session, ice_check_list_new()); } } @@ -390,6 +389,9 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro call->camera_active=call->params.has_video; switch (linphone_core_get_firewall_policy(call->core)) { case LinphonePolicyUseIce: + call->ice_session = ice_session_new(); + ice_session_set_role(call->ice_session, IR_Controlled); + linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(op)); linphone_call_init_media_streams(call); linphone_call_start_media_streams_for_ice_gathering(call); if (linphone_core_gather_ice_candidates(call->core,call)<0) { @@ -402,7 +404,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_core_run_stun_tests(call->core,call); /* No break to also destroy ice session in this case. */ default: - linphone_call_delete_ice_session(call); break; } discover_mtu(lc,linphone_address_get_domain(from)); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6f08e9260..1a0a85752 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2123,6 +2123,8 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); if (!lc->sip_conf.sdp_200_ack){ call->media_pending=TRUE; + if (call->ice_session != NULL) + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); sal_call_set_local_media_description(call->op,call->localdesc); } real_url=linphone_address_as_string(call->log->to); @@ -2379,9 +2381,9 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE); const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc); - /* Regenerate final media description to include all ICE candidates. */ + if (call->ice_session != NULL) + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); md=sal_call_get_final_media_description(call->op); - if (md && sal_media_description_empty(md)){ sal_call_decline(call->op,SalReasonMedia,NULL); linphone_call_unref(call); @@ -2464,7 +2466,9 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho call->params=*params; call->camera_active=call->params.has_video; update_local_media_description(lc,call); - + if (call->ice_session != NULL) + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); + if (params->in_conference){ subject="Conference"; }else{ @@ -2548,6 +2552,10 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const } call->camera_active=call->params.has_video; update_local_media_description(lc,call); + if (call->ice_session != NULL) { + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); + linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); + } sal_call_set_local_media_description(call->op,call->localdesc); sal_call_accept(call->op); md=sal_call_get_final_media_description(call->op); diff --git a/coreapi/misc.c b/coreapi/misc.c index a59aca886..81db63ad0 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -605,6 +605,128 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) return 0; } +void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session) +{ + IceSessionState session_state = ice_session_state(session); + int i, j; + + if (session_state == IS_Completed) desc->ice_completed = TRUE; + else desc->ice_completed = FALSE; + strncpy(desc->ice_pwd, ice_session_local_pwd(session), sizeof(desc->ice_pwd)); + strncpy(desc->ice_ufrag, ice_session_local_ufrag(session), sizeof(desc->ice_ufrag)); + for (i = 0; i < desc->nstreams; i++) { + SalStreamDescription *stream = &desc->streams[i]; + IceCheckList *cl = ice_session_check_list(session, i); + if (cl == NULL) continue; + if ((strlen(ice_check_list_local_pwd(cl)) != strlen(desc->ice_pwd)) || (strcmp(ice_check_list_local_pwd(cl), desc->ice_pwd))) + strncpy(stream->ice_pwd, ice_check_list_local_pwd(cl), sizeof(stream->ice_pwd)); + else + memset(stream->ice_pwd, 0, sizeof(stream->ice_pwd)); + if ((strlen(ice_check_list_local_ufrag(cl)) != strlen(desc->ice_ufrag)) || (strcmp(ice_check_list_local_ufrag(cl), desc->ice_ufrag))) + strncpy(stream->ice_ufrag, ice_check_list_local_ufrag(cl), sizeof(stream->ice_ufrag)); + else + memset(stream->ice_pwd, 0, sizeof(stream->ice_pwd)); + if ((cl->state == ICL_Running) || (cl->state == ICL_Completed)) { + memset(stream->ice_candidates, 0, sizeof(stream->ice_candidates)); + for (j = 0; j < ms_list_size(cl->local_candidates); j++) { + SalIceCandidate *sal_candidate = &stream->ice_candidates[j]; + IceCandidate *ice_candidate = ms_list_nth_data(cl->local_candidates, j); + const char *default_addr = NULL; + int default_port = 0; + if (ice_candidate->componentID == 1) { + default_addr = stream->rtp_addr; + default_port = stream->rtp_port; + } else if (ice_candidate->componentID == 2) { + default_addr = stream->rtcp_addr; + default_port = stream->rtcp_port; + } else continue; + if (default_addr[0] == '\0') default_addr = desc->addr; + /* Only include the candidates matching the default destination for each component of the stream if the state is Completed as specified in RFC5245 section 9.1.2.2. */ + if ((cl->state == ICL_Completed) + && !((ice_candidate->taddr.port == default_port) && (strlen(ice_candidate->taddr.ip) == strlen(default_addr)) && (strcmp(ice_candidate->taddr.ip, default_addr) == 0))) + continue; + strncpy(sal_candidate->foundation, ice_candidate->foundation, sizeof(sal_candidate->foundation)); + sal_candidate->componentID = ice_candidate->componentID; + sal_candidate->priority = ice_candidate->priority; + strncpy(sal_candidate->type, ice_candidate_type(ice_candidate), sizeof(sal_candidate->type)); + strncpy(sal_candidate->addr, ice_candidate->taddr.ip, sizeof(sal_candidate->addr)); + sal_candidate->port = ice_candidate->taddr.port; + if ((ice_candidate->base != NULL) && (ice_candidate->base != ice_candidate)) { + strncpy(sal_candidate->raddr, ice_candidate->base->taddr.ip, sizeof(sal_candidate->raddr)); + sal_candidate->rport = ice_candidate->base->taddr.port; + } + } + } + if ((cl->state == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) { + const char *rtp_addr, *rtcp_addr; + int rtp_port, rtcp_port; + memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates)); + ice_check_list_nominated_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); + strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr)); + stream->ice_remote_candidates[0].port = rtp_port; + strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr)); + stream->ice_remote_candidates[1].port = rtcp_port; + } + } +} + +void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md) +{ + if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) { + int i, j; + ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); + for (i = 0; i < md->nstreams; i++) { + const SalStreamDescription *stream = &md->streams[i]; + IceCheckList *cl = ice_session_check_list(call->ice_session, i); + if (cl == NULL) { + cl = ice_check_list_new(); + ice_session_add_check_list(call->ice_session, cl); + switch (stream->type) { + case SalAudio: + if (call->audiostream != NULL) call->audiostream->ice_check_list = cl; + break; + case SalVideo: + if (call->videostream != NULL) call->videostream->ice_check_list = cl; + break; + default: + break; + } + } + if (stream->ice_mismatch == TRUE) { + ice_check_list_set_state(cl, ICL_Failed); + } else { + if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) + ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); + for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES; j++) { + const SalIceCandidate *candidate = &stream->ice_candidates[j]; + bool_t default_candidate = FALSE; + const char *addr = NULL; + int port = 0; + if (candidate->addr[0] == '\0') break; + if (candidate->componentID == 1) { + addr = stream->rtp_addr; + port = stream->rtp_port; + } + else if (candidate->componentID == 2) { + addr = stream->rtcp_addr; + port = stream->rtcp_port; + } + if (addr && (candidate->port == port) && (strlen(candidate->addr) == strlen(addr)) && (strcmp(candidate->addr, addr) == 0)) + default_candidate = TRUE; + ice_add_remote_candidate(cl, candidate->type, candidate->addr, candidate->port, candidate->componentID, + candidate->priority, candidate->foundation, default_candidate); + } + } + } + for (i = ice_session_nb_check_lists(call->ice_session); i > md->nstreams; i--) { + ice_session_remove_check_list(call->ice_session, ice_session_check_list(call->ice_session, i - 1)); + } + } + if ((ice_session_state(call->ice_session) == IS_Failed) || (ice_session_nb_check_lists(call->ice_session) == 0)) { + linphone_call_delete_ice_session(call); + } +} + LinphoneCall * is_a_linphone_call(void *user_pointer){ LinphoneCall *call=(LinphoneCall*)user_pointer; if (call==NULL) return NULL; diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 118f2420a..1d4ce1b9f 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -253,6 +253,11 @@ static void initiate_incoming(const SalStreamDescription *local_cap, result->rtp_port = 0; } + strcpy(result->ice_pwd, local_cap->ice_pwd); + strcpy(result->ice_ufrag, local_cap->ice_ufrag); + result->ice_mismatch = local_cap->ice_mismatch; + memcpy(result->ice_candidates, local_cap->ice_candidates, sizeof(result->ice_candidates)); + memcpy(result->ice_remote_candidates, local_cap->ice_remote_candidates, sizeof(result->ice_remote_candidates)); } /** @@ -321,5 +326,9 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities result->bandwidth=local_capabilities->bandwidth; result->session_ver=local_capabilities->session_ver; result->session_id=local_capabilities->session_id; + strcpy(result->ice_pwd, local_capabilities->ice_pwd); + strcpy(result->ice_ufrag, local_capabilities->ice_ufrag); + result->ice_lite = local_capabilities->ice_lite; + result->ice_completed = local_capabilities->ice_lite; return 0; } diff --git a/coreapi/private.h b/coreapi/private.h index bc65e946e..f68725473 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -221,6 +221,8 @@ void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, const PayloadType *pt); void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); +void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); +void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); void linphone_core_send_initial_subscribes(LinphoneCore *lc); void linphone_core_write_friends_config(LinphoneCore* lc); From 2a827ff58ab708adb76eb4df7e22a2d2ad2667a2 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 6 Aug 2012 17:08:06 +0200 Subject: [PATCH 411/769] Some fixes of bugs introduced with redesign of interaction between ICE and media descriptions. --- coreapi/linphonecore.c | 2 +- coreapi/misc.c | 27 +++++++++++++++++++++++---- coreapi/offeranswer.c | 2 +- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1a0a85752..c69a42a06 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2553,8 +2553,8 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const call->camera_active=call->params.has_video; update_local_media_description(lc,call); if (call->ice_session != NULL) { - linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); } sal_call_set_local_media_description(call->op,call->localdesc); sal_call_accept(call->op); diff --git a/coreapi/misc.c b/coreapi/misc.c index 81db63ad0..e97b1b06d 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -608,6 +608,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session) { IceSessionState session_state = ice_session_state(session); + int nb_candidates; int i, j; if (session_state == IS_Completed) desc->ice_completed = TRUE; @@ -617,6 +618,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * for (i = 0; i < desc->nstreams; i++) { SalStreamDescription *stream = &desc->streams[i]; IceCheckList *cl = ice_session_check_list(session, i); + nb_candidates = 0; if (cl == NULL) continue; if ((strlen(ice_check_list_local_pwd(cl)) != strlen(desc->ice_pwd)) || (strcmp(ice_check_list_local_pwd(cl), desc->ice_pwd))) strncpy(stream->ice_pwd, ice_check_list_local_pwd(cl), sizeof(stream->ice_pwd)); @@ -629,7 +631,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * if ((cl->state == ICL_Running) || (cl->state == ICL_Completed)) { memset(stream->ice_candidates, 0, sizeof(stream->ice_candidates)); for (j = 0; j < ms_list_size(cl->local_candidates); j++) { - SalIceCandidate *sal_candidate = &stream->ice_candidates[j]; + SalIceCandidate *sal_candidate = &stream->ice_candidates[nb_candidates]; IceCandidate *ice_candidate = ms_list_nth_data(cl->local_candidates, j); const char *default_addr = NULL; int default_port = 0; @@ -655,6 +657,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * strncpy(sal_candidate->raddr, ice_candidate->base->taddr.ip, sizeof(sal_candidate->raddr)); sal_candidate->rport = ice_candidate->base->taddr.port; } + nb_candidates++; } } if ((cl->state == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) { @@ -706,16 +709,32 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, if (candidate->componentID == 1) { addr = stream->rtp_addr; port = stream->rtp_port; - } - else if (candidate->componentID == 2) { + } else if (candidate->componentID == 2) { addr = stream->rtcp_addr; port = stream->rtcp_port; - } + } else continue; if (addr && (candidate->port == port) && (strlen(candidate->addr) == strlen(addr)) && (strcmp(candidate->addr, addr) == 0)) default_candidate = TRUE; ice_add_remote_candidate(cl, candidate->type, candidate->addr, candidate->port, candidate->componentID, candidate->priority, candidate->foundation, default_candidate); } + for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; j++) { + const SalIceRemoteCandidate *candidate = &stream->ice_remote_candidates[j]; + const char *addr = NULL; + int port = 0; + int componentID = j + 1; + if (candidate->addr[0] == '\0') break; + ms_error("handle remote-candidates attribute"); + if (componentID == 1) { + addr = stream->rtp_addr; + port = stream->rtp_port; + } else if (componentID == 2) { + addr = stream->rtcp_addr; + port = stream->rtcp_port; + } else continue; + if (addr[0] == '\0') addr = md->addr; + ice_add_losing_pair(ice_session_check_list(call->ice_session, i), j + 1, candidate->addr, candidate->port, addr, port); + } } } for (i = ice_session_nb_check_lists(call->ice_session); i > md->nstreams; i--) { diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 1d4ce1b9f..51773d324 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -329,6 +329,6 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities strcpy(result->ice_pwd, local_capabilities->ice_pwd); strcpy(result->ice_ufrag, local_capabilities->ice_ufrag); result->ice_lite = local_capabilities->ice_lite; - result->ice_completed = local_capabilities->ice_lite; + result->ice_completed = local_capabilities->ice_completed; return 0; } From 7baeffbff4b0018dfa09b542f8ea60def20b4c9d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 7 Aug 2012 10:53:07 +0200 Subject: [PATCH 412/769] Use correct contact address in RE-INVITE SIP messages. --- coreapi/sal_eXosip2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index a9f3559b6..76d7973d9 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -2406,6 +2406,10 @@ int sal_call_update(SalOp *h, const char *subject){ eXosip_unlock(); osip_message_set_subject(reinvite,subject); osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO"); + if (h->base.contact){ + _osip_list_set_empty(&reinvite->contacts,(void (*)(void*))osip_contact_free); + osip_message_set_contact(reinvite,h->base.contact); + } if (h->base.root->session_expires!=0){ osip_message_set_header(reinvite, "Session-expires", "200"); osip_message_set_supported(reinvite, "timer"); From e1c3d22d293f41702dc1e26aaa366a3e607c10a9 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 7 Aug 2012 11:44:14 +0200 Subject: [PATCH 413/769] Fix memory leak for android --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index ec0a638d5..e1beea6f7 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ec0a638d5c487ca8b7916094d14ad3967db62ce3 +Subproject commit e1beea6f700b39002facf7520b757c264d8d3c5e From aef56a9c3a82a0d9a26e64588c7641a51ffebd8b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 7 Aug 2012 11:45:47 +0200 Subject: [PATCH 414/769] Correctly handle content of SDP when ICE has completed for a specific media stream. --- coreapi/misc.c | 20 +++++++++++++++++--- coreapi/offeranswer.c | 1 + coreapi/sal.h | 1 + coreapi/sal_eXosip2_sdp.c | 3 +++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index e97b1b06d..a43451036 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -607,12 +607,19 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session) { + const char *rtp_addr, *rtcp_addr; IceSessionState session_state = ice_session_state(session); int nb_candidates; int i, j; - if (session_state == IS_Completed) desc->ice_completed = TRUE; - else desc->ice_completed = FALSE; + if (session_state == IS_Completed) { + desc->ice_completed = TRUE; + ice_check_list_nominated_valid_local_candidate(ice_session_check_list(session, 0), &rtp_addr, NULL, NULL, NULL); + strncpy(desc->addr, rtp_addr, sizeof(desc->addr)); + } + else { + desc->ice_completed = FALSE; + } strncpy(desc->ice_pwd, ice_session_local_pwd(session), sizeof(desc->ice_pwd)); strncpy(desc->ice_ufrag, ice_session_local_ufrag(session), sizeof(desc->ice_ufrag)); for (i = 0; i < desc->nstreams; i++) { @@ -620,6 +627,14 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * IceCheckList *cl = ice_session_check_list(session, i); nb_candidates = 0; if (cl == NULL) continue; + if (cl->state == ICL_Completed) { + stream->ice_completed = TRUE; + ice_check_list_nominated_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); + strncpy(stream->rtp_addr, rtp_addr, sizeof(stream->rtp_addr)); + strncpy(stream->rtcp_addr, rtcp_addr, sizeof(stream->rtcp_addr)); + } else { + stream->ice_completed = FALSE; + } if ((strlen(ice_check_list_local_pwd(cl)) != strlen(desc->ice_pwd)) || (strcmp(ice_check_list_local_pwd(cl), desc->ice_pwd))) strncpy(stream->ice_pwd, ice_check_list_local_pwd(cl), sizeof(stream->ice_pwd)); else @@ -661,7 +676,6 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * } } if ((cl->state == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) { - const char *rtp_addr, *rtcp_addr; int rtp_port, rtcp_port; memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates)); ice_check_list_nominated_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 51773d324..c93569976 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -256,6 +256,7 @@ static void initiate_incoming(const SalStreamDescription *local_cap, strcpy(result->ice_pwd, local_cap->ice_pwd); strcpy(result->ice_ufrag, local_cap->ice_ufrag); result->ice_mismatch = local_cap->ice_mismatch; + result->ice_completed = local_cap->ice_completed; memcpy(result->ice_candidates, local_cap->ice_candidates, sizeof(result->ice_candidates)); memcpy(result->ice_remote_candidates, local_cap->ice_remote_candidates, sizeof(result->ice_remote_candidates)); } diff --git a/coreapi/sal.h b/coreapi/sal.h index dfb560472..0d2b631d8 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -169,6 +169,7 @@ typedef struct SalStreamDescription{ char ice_ufrag[SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN]; char ice_pwd[SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN]; bool_t ice_mismatch; + bool_t ice_completed; } SalStreamDescription; #define SAL_MEDIA_DESCRIPTION_MAX_STREAMS 4 diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index e03e65bae..8c917570f 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -377,6 +377,9 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription } } } + if (desc->ice_completed == TRUE) { + sdp_message_a_attribute_add(msg, lineno, osip_strdup("nortpproxy"), osip_strdup("yes")); + } if (desc->ice_mismatch == TRUE) { sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-mismatch"), NULL); } else { From 3bf2dea3008ad2b0fa29c4539e57380c6ffd8d53 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 7 Aug 2012 13:44:18 +0200 Subject: [PATCH 415/769] Change of mediastream2 API. --- coreapi/linphonecall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7a1781696..d9c2f991f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -559,7 +559,7 @@ void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) call->params = *params; update_local_media_description(lc, call); linphone_call_init_video_stream(call); - video_stream_start_ice_gathering(call->videostream); + video_stream_prepare_video(call->videostream); linphone_core_gather_ice_candidates(lc, call); } else { if (linphone_call_get_state(call) == LinphoneCallUpdatedByRemote) { @@ -1504,9 +1504,9 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut } void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call){ - audio_stream_start_ice_gathering(call->audiostream); + audio_stream_prepare_sound(call->audiostream, NULL, NULL); if (call->videostream) { - video_stream_start_ice_gathering(call->videostream); + video_stream_prepare_video(call->videostream); } } From dbb1253c6d71c74f76bccc146eaf20f476436c35 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 7 Aug 2012 16:35:43 +0200 Subject: [PATCH 416/769] If ICE processing fails, delete the ICE session. --- coreapi/linphonecall.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d9c2f991f..f90f97036 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1736,8 +1736,17 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ OrtpEventData *evd=ortp_event_get_data(ev); if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - if (ice_session_role(call->ice_session) == IR_Controlling) { - linphone_core_update_call(call->core, call, &call->current_params); + switch (ice_session_state(call->ice_session)) { + case IS_Completed: + if (ice_session_role(call->ice_session) == IR_Controlling) { + linphone_core_update_call(call->core, call, &call->current_params); + } + break; + case IS_Failed: + linphone_call_delete_ice_session(call); + break; + default: + break; } } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { LinphoneCallParams *params; From e93d9096ff433d3195c177e4c767881406e71d88 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 7 Aug 2012 17:38:20 +0200 Subject: [PATCH 417/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e1beea6f7..863022b56 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e1beea6f700b39002facf7520b757c264d8d3c5e +Subproject commit 863022b56fab41d2ca45dd1d149cb0caab08b54b From e7317543b33334d1b15b86c9c9cc61ed3dff313e Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 8 Aug 2012 09:48:53 +0200 Subject: [PATCH 418/769] Updated linphone --- LinphoneCoreImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 4a962e52e..c742ea313 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -729,4 +729,9 @@ class LinphoneCoreImpl implements LinphoneCore { public void refreshRegisters() { refreshRegisters(nativePtr); } + @Override + public String getVersion() { + // TODO Auto-generated method stub + return null; + } } From 3611187779bcfa8d3f6cb159d400d80641623b6b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 8 Aug 2012 11:43:51 +0200 Subject: [PATCH 419/769] Use ICE selected pairs instead of nominated valid pairs. --- coreapi/linphonecall.c | 1 + coreapi/misc.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f90f97036..62f296745 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1739,6 +1739,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ switch (ice_session_state(call->ice_session)) { case IS_Completed: if (ice_session_role(call->ice_session) == IR_Controlling) { + ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); } break; diff --git a/coreapi/misc.c b/coreapi/misc.c index a43451036..90380beab 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -614,7 +614,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * if (session_state == IS_Completed) { desc->ice_completed = TRUE; - ice_check_list_nominated_valid_local_candidate(ice_session_check_list(session, 0), &rtp_addr, NULL, NULL, NULL); + ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, 0), &rtp_addr, NULL, NULL, NULL); strncpy(desc->addr, rtp_addr, sizeof(desc->addr)); } else { @@ -629,7 +629,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * if (cl == NULL) continue; if (cl->state == ICL_Completed) { stream->ice_completed = TRUE; - ice_check_list_nominated_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); + ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); strncpy(stream->rtp_addr, rtp_addr, sizeof(stream->rtp_addr)); strncpy(stream->rtcp_addr, rtcp_addr, sizeof(stream->rtcp_addr)); } else { @@ -678,7 +678,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * if ((cl->state == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) { int rtp_port, rtcp_port; memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates)); - ice_check_list_nominated_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); + ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr)); stream->ice_remote_candidates[0].port = rtp_port; strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr)); From d3851711b1dac71f15864b2473f944fd582908f8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 8 Aug 2012 13:14:06 +0200 Subject: [PATCH 420/769] Defer sending of answer of re-invite when there are some ICE losing candidate pairs. --- coreapi/linphonecall.c | 13 +++++++++++-- coreapi/linphonecore.c | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 62f296745..1b926071b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1785,6 +1785,15 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ } break; } + } else if (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) { + SalMediaDescription *md; + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); + sal_call_set_local_media_description(call->op,call->localdesc); + sal_call_accept(call->op); + md=sal_call_get_final_media_description(call->op); + if (md && !sal_media_description_empty(md)) + linphone_core_update_streams (call->core,call,md); + linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)"); } } @@ -1841,7 +1850,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse evd->packet = NULL; if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED)) { + } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED)) { handle_ice_events(call, ev); } ortp_event_destroy(ev); @@ -1881,7 +1890,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse evd->packet = NULL; if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED)) { + } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED)) { handle_ice_events(call, ev); } ortp_event_destroy(ev); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c69a42a06..00870f9b2 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2554,6 +2554,10 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const update_local_media_description(lc,call); if (call->ice_session != NULL) { linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); + if (ice_session_nb_losing_pairs(call->ice_session) > 0) { + /* Defer the sending of the answer until there are no losing pairs left. */ + return 0; + } linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); } sal_call_set_local_media_description(call->op,call->localdesc); From c6dfd648a9f16f47c1e82c4fcc9efa336227c08d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 8 Aug 2012 14:53:27 +0200 Subject: [PATCH 421/769] Restart ICE if requested by ICE itself. --- coreapi/linphonecall.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 1b926071b..ccc5ad1e3 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1794,6 +1794,10 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ if (md && !sal_media_description_empty(md)) linphone_core_update_streams (call->core,call,md); linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)"); + } else if (evt == ORTP_EVENT_ICE_RESTART_NEEDED) { + ice_session_restart(call->ice_session); + ice_session_set_role(call->ice_session, IR_Controlling); + linphone_core_update_call(call->core, call, &call->current_params); } } @@ -1850,7 +1854,8 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse evd->packet = NULL; if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED)) { + } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) + || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) || (evt == ORTP_EVENT_ICE_RESTART_NEEDED)) { handle_ice_events(call, ev); } ortp_event_destroy(ev); @@ -1890,7 +1895,8 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse evd->packet = NULL; if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED)) { + } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) + || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) || (evt == ORTP_EVENT_ICE_RESTART_NEEDED)) { handle_ice_events(call, ev); } ortp_event_destroy(ev); From 6eb710525846abca757126b515dbe97ae7bb2036 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 8 Aug 2012 15:18:04 +0200 Subject: [PATCH 422/769] Restart ICE if remote credentials have changed. --- coreapi/misc.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 90380beab..522786866 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -691,7 +691,27 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, { if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) { int i, j; - ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); + + /* Check for ICE restart and set remote credentials. */ + if ((ice_session_remote_ufrag(call->ice_session) == NULL) && (ice_session_remote_pwd(call->ice_session) == NULL)) { + ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); + } else if (ice_session_remote_credentials_changed(call->ice_session, md->ice_ufrag, md->ice_pwd)) { + ice_session_restart(call->ice_session); + ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); + } + for (i = 0; i < md->nstreams; i++) { + const SalStreamDescription *stream = &md->streams[i]; + IceCheckList *cl = ice_session_check_list(call->ice_session, i); + if (cl && (stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) { + if (ice_check_list_remote_credentials_changed(cl, stream->ice_ufrag, stream->ice_pwd)) { + ice_session_restart(call->ice_session); + ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); + break; + } + } + } + + /* Create ICE check lists if needed and parse ICE attributes. */ for (i = 0; i < md->nstreams; i++) { const SalStreamDescription *stream = &md->streams[i]; IceCheckList *cl = ice_session_check_list(call->ice_session, i); From bad089b4a75d1dfbf27c3d7362b4606051451ad8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 9 Aug 2012 09:32:23 +0200 Subject: [PATCH 423/769] Restore ice-mismatch that was broken during redesign of the interface between media descriptions and ICE. --- coreapi/misc.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 522786866..34c58f57f 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -643,6 +643,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * strncpy(stream->ice_ufrag, ice_check_list_local_ufrag(cl), sizeof(stream->ice_ufrag)); else memset(stream->ice_pwd, 0, sizeof(stream->ice_pwd)); + stream->ice_mismatch = ice_check_list_is_mismatch(cl); if ((cl->state == ICL_Running) || (cl->state == ICL_Completed)) { memset(stream->ice_candidates, 0, sizeof(stream->ice_candidates)); for (j = 0; j < ms_list_size(cl->local_candidates); j++) { @@ -687,6 +688,18 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * } } +static void get_default_addr_and_port(uint16_t componentID, const SalMediaDescription *md, const SalStreamDescription *stream, const char **addr, int *port) +{ + if (componentID == 1) { + *addr = stream->rtp_addr; + *port = stream->rtp_port; + } else if (componentID == 2) { + *addr = stream->rtcp_addr; + *port = stream->rtcp_port; + } else return; + if ((*addr)[0] == '\0') *addr = md->addr; +} + void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md) { if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) { @@ -740,13 +753,8 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const char *addr = NULL; int port = 0; if (candidate->addr[0] == '\0') break; - if (candidate->componentID == 1) { - addr = stream->rtp_addr; - port = stream->rtp_port; - } else if (candidate->componentID == 2) { - addr = stream->rtcp_addr; - port = stream->rtcp_port; - } else continue; + if ((candidate->componentID == 0) || (candidate->componentID > 2)) continue; + get_default_addr_and_port(candidate->componentID, md, stream, &addr, &port); if (addr && (candidate->port == port) && (strlen(candidate->addr) == strlen(addr)) && (strcmp(candidate->addr, addr) == 0)) default_candidate = TRUE; ice_add_remote_candidate(cl, candidate->type, candidate->addr, candidate->port, candidate->componentID, @@ -758,15 +766,7 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, int port = 0; int componentID = j + 1; if (candidate->addr[0] == '\0') break; - ms_error("handle remote-candidates attribute"); - if (componentID == 1) { - addr = stream->rtp_addr; - port = stream->rtp_port; - } else if (componentID == 2) { - addr = stream->rtcp_addr; - port = stream->rtcp_port; - } else continue; - if (addr[0] == '\0') addr = md->addr; + get_default_addr_and_port(componentID, md, stream, &addr, &port); ice_add_losing_pair(ice_session_check_list(call->ice_session, i), j + 1, candidate->addr, candidate->port, addr, port); } } @@ -774,6 +774,7 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, for (i = ice_session_nb_check_lists(call->ice_session); i > md->nstreams; i--) { ice_session_remove_check_list(call->ice_session, ice_session_check_list(call->ice_session, i - 1)); } + ice_session_check_mismatch(call->ice_session); } if ((ice_session_state(call->ice_session) == IS_Failed) || (ice_session_nb_check_lists(call->ice_session) == 0)) { linphone_call_delete_ice_session(call); From dc5b821d22ae39eda6a5c448a3f9e35e8b81f008 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 9 Aug 2012 11:04:23 +0200 Subject: [PATCH 424/769] fix makefile for android --- build/android/common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/android/common.mk b/build/android/common.mk index 40742b959..4fa833b59 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -51,7 +51,7 @@ MY_LOG_DOMAIN = \"Linphone\" endif ifndef LINPHONE_VERSION -LINPHONE_VERSION = \"Devel\" +LINPHONE_VERSION = "Devel" endif LOCAL_CFLAGS += \ From d0e7a66501d8476a483783dd35b61d8416e3a29a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 9 Aug 2012 12:00:39 +0200 Subject: [PATCH 425/769] Refactor code to prevent changing linphone_core API. --- console/commands.c | 5 ++- coreapi/linphonecall.c | 85 +++++++-------------------------------- coreapi/linphonecore.c | 91 ++++++++++++++++++++++++++++++------------ coreapi/linphonecore.h | 11 ----- coreapi/private.h | 3 ++ gtk/incall_view.c | 6 ++- gtk/main.c | 6 ++- 7 files changed, 97 insertions(+), 110 deletions(-) diff --git a/console/commands.c b/console/commands.c index 7bebdd82b..472531795 100644 --- a/console/commands.c +++ b/console/commands.c @@ -2503,7 +2503,10 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args){ linphone_call_enable_camera(call,activated); if ((activated && !linphone_call_params_video_enabled (cp))){ /*update the call to add the video stream*/ - linphone_call_enable_video(call,TRUE); + LinphoneCallParams *ncp=linphone_call_params_copy(cp); + linphone_call_params_enable_video(ncp,TRUE); + linphone_core_update_call(lc,call,ncp); + linphone_call_params_destroy (ncp); linphonec_out("Trying to bring up video stream...\n"); } } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ccc5ad1e3..4cd4a0734 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -546,42 +546,6 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const } } -void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) -{ - LinphoneCore *lc=linphone_call_get_core(call); - LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); - - linphone_call_params_enable_video(params, enabled); - if (enabled == TRUE) { - if (call->ice_session != NULL) { - /* Defer call update until the ICE candidates gathering process has finished. */ - ms_message("Defer call update to gather ICE candidates"); - call->params = *params; - update_local_media_description(lc, call); - linphone_call_init_video_stream(call); - video_stream_prepare_video(call->videostream); - linphone_core_gather_ice_candidates(lc, call); - } else { - if (linphone_call_get_state(call) == LinphoneCallUpdatedByRemote) { - linphone_core_accept_call_update(lc, call, params); - } else { - linphone_core_update_call(lc, call, params); - } - } - } else { - if ((call->ice_session != NULL) && (call->videostream != NULL)) { - ice_session_remove_check_list(call->ice_session, call->videostream->ice_check_list); - call->videostream->ice_check_list = NULL; - } - if (linphone_call_get_state(call) == LinphoneCallUpdatedByRemote) { - linphone_core_accept_call_update(lc, call, params); - } else { - linphone_core_update_call(lc, call, params); - } - } - linphone_call_params_destroy(params); -} - static void linphone_call_destroy(LinphoneCall *obj) { if (obj->op!=NULL) { @@ -1750,50 +1714,31 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ break; } } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { - LinphoneCallParams *params; + if (evd->info.ice_processing_successful==TRUE) { + ice_session_compute_candidates_foundations(call->ice_session); + ice_session_eliminate_redundant_candidates(call->ice_session); + ice_session_choose_default_candidates(call->ice_session); + } else { + linphone_call_delete_ice_session(call); + } switch (call->state) { case LinphoneCallStreamsRunning: + linphone_core_start_update_call(call->core, call); + break; case LinphoneCallUpdatedByRemote: - if (evd->info.ice_processing_successful==TRUE) { - ice_session_compute_candidates_foundations(call->ice_session); - ice_session_eliminate_redundant_candidates(call->ice_session); - ice_session_choose_default_candidates(call->ice_session); - } - params = linphone_call_params_copy(linphone_call_get_current_params(call)); - linphone_call_params_enable_video(params, TRUE); - if (call->state == LinphoneCallStreamsRunning) { - linphone_core_update_call(call->core, call, params); - } else { /* LinphoneCallUpdatedByRemote */ - linphone_core_accept_call_update(call->core, call, params); - } - linphone_call_params_destroy(params); + linphone_core_start_accept_call_update(call->core, call); break; case LinphoneCallOutgoingInit: + linphone_call_stop_media_streams(call); + linphone_core_start_invite(call->core, call, NULL); + break; default: linphone_call_stop_media_streams(call); - if (evd->info.ice_processing_successful==TRUE) { - ice_session_compute_candidates_foundations(call->ice_session); - ice_session_eliminate_redundant_candidates(call->ice_session); - ice_session_choose_default_candidates(call->ice_session); - } else { - linphone_call_delete_ice_session(call); - } - if (call->state==LinphoneCallOutgoingInit) { - linphone_core_start_invite(call->core,call,NULL); - } else { - linphone_core_notify_incoming_call(call->core,call); - } + linphone_core_notify_incoming_call(call->core, call); break; } } else if (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) { - SalMediaDescription *md; - linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); - sal_call_set_local_media_description(call->op,call->localdesc); - sal_call_accept(call->op); - md=sal_call_get_final_media_description(call->op); - if (md && !sal_media_description_empty(md)) - linphone_core_update_streams (call->core,call,md); - linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)"); + linphone_core_start_accept_call_update(call->core, call); } else if (evt == ORTP_EVENT_ICE_RESTART_NEEDED) { ice_session_restart(call->ice_session); ice_session_set_role(call->ice_session, IR_Controlling); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 00870f9b2..b8911702b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2445,6 +2445,24 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ ms_free(tmp); } +int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){ + const char *subject; + call->camera_active=call->params.has_video; + update_local_media_description(lc,call); + if (call->ice_session != NULL) + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); + + if (call->params.in_conference){ + subject="Conference"; + }else{ + subject="Media change"; + } + if (lc->vtable.display_status) + lc->vtable.display_status(lc,_("Modifying call parameters...")); + sal_call_set_local_media_description (call->op,call->localdesc); + return sal_call_update(call->op,subject); +} + /** * @ingroup call_control * Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore. @@ -2462,22 +2480,25 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){ int err=0; if (params!=NULL){ - const char *subject; - call->params=*params; - call->camera_active=call->params.has_video; - update_local_media_description(lc,call); - if (call->ice_session != NULL) - linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); - - if (params->in_conference){ - subject="Conference"; - }else{ - subject="Media change"; + if ((call->ice_session != NULL) && (call->videostream != NULL) && !params->has_video) { + ice_session_remove_check_list(call->ice_session, call->videostream->ice_check_list); + call->videostream->ice_check_list = NULL; } - if (lc->vtable.display_status) - lc->vtable.display_status(lc,_("Modifying call parameters...")); - sal_call_set_local_media_description (call->op,call->localdesc); - err=sal_call_update(call->op,subject); + if ((call->ice_session != NULL) && ((ice_session_state(call->ice_session) != IS_Completed) || (call->params.has_video != params->has_video))) { + /* Defer call update until the ICE candidates gathering process has finished. */ + ms_message("Defer call update to gather ICE candidates"); + call->params = *params; + update_local_media_description(lc, call); + if (call->params.has_video) { + linphone_call_init_video_stream(call); + video_stream_prepare_video(call->videostream); + if (linphone_core_gather_ice_candidates(lc,call)<0) { + /* Ice candidates gathering failed, proceed with the call anyway. */ + linphone_call_delete_ice_session(call); + } else return err; + } + } + err = linphone_core_start_update_call(lc, call); }else{ #ifdef VIDEO_ENABLED if (call->videostream!=NULL){ @@ -2515,6 +2536,24 @@ int linphone_core_defer_call_update(LinphoneCore *lc, LinphoneCall *call){ return -1; } +int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call){ + SalMediaDescription *md; + if (call->ice_session != NULL) { + if (ice_session_nb_losing_pairs(call->ice_session) > 0) { + /* Defer the sending of the answer until there are no losing pairs left. */ + return 0; + } + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); + } + sal_call_set_local_media_description(call->op,call->localdesc); + sal_call_accept(call->op); + md=sal_call_get_final_media_description(call->op); + if (md && !sal_media_description_empty(md)) + linphone_core_update_streams (lc,call,md); + linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)"); + return 0; +} + /** * @ingroup call_control * Accept call modifications initiated by other end. @@ -2535,7 +2574,7 @@ int linphone_core_defer_call_update(LinphoneCore *lc, LinphoneCall *call){ * @return 0 if sucessful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state). **/ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){ - SalMediaDescription *md; + bool_t old_has_video = call->params.has_video; if (call->state!=LinphoneCallUpdatedByRemote){ ms_error("linphone_core_accept_update(): invalid state %s to call this function.", linphone_call_state_to_string(call->state)); @@ -2554,18 +2593,18 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const update_local_media_description(lc,call); if (call->ice_session != NULL) { linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); - if (ice_session_nb_losing_pairs(call->ice_session) > 0) { - /* Defer the sending of the answer until there are no losing pairs left. */ - return 0; + if (!ice_session_candidates_gathered(call->ice_session)) { + if ((call->params.has_video) && (call->params.has_video != old_has_video)) { + linphone_call_init_video_stream(call); + video_stream_prepare_video(call->videostream); + if (linphone_core_gather_ice_candidates(lc,call)<0) { + /* Ice candidates gathering failed, proceed with the call anyway. */ + linphone_call_delete_ice_session(call); + } else return 0; + } } - linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); } - sal_call_set_local_media_description(call->op,call->localdesc); - sal_call_accept(call->op); - md=sal_call_get_final_media_description(call->op); - if (md && !sal_media_description_empty(md)) - linphone_core_update_streams (lc,call,md); - linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)"); + linphone_core_start_accept_call_update(lc, call); return 0; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 6b00cbc09..10f6108c9 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -390,15 +390,6 @@ void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val); **/ bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call); -/** - * Enable or disable video for this call. - * @param call - * @param enabled - * - * @ingroup media_parameters - */ -void linphone_call_enable_video(LinphoneCall *call, bool_t enabled); - /*keep this in sync with mediastreamer2/msvolume.h*/ /** @@ -792,8 +783,6 @@ int linphone_core_transfer_call_to_another(LinphoneCore *lc, LinphoneCall *call, bool_t linphone_core_inc_invite_pending(LinphoneCore*lc); -void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call); - bool_t linphone_core_in_call(const LinphoneCore *lc); LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc); diff --git a/coreapi/private.h b/coreapi/private.h index f68725473..05d5c3f13 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -261,7 +261,10 @@ void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float void linphone_core_stop_waiting(LinphoneCore *lc); int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy); +int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call); +int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call); void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call); +void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call); extern SalCallbacks linphone_sal_callbacks; void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error); bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc); diff --git a/gtk/incall_view.c b/gtk/incall_view.c index 45e98609b..7e8eb683f 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -221,8 +221,12 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){ static void video_button_clicked(GtkWidget *button, LinphoneCall *call){ gboolean adding=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),"adding_video")); + LinphoneCore *lc=linphone_call_get_core(call); + LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); gtk_widget_set_sensitive(button,FALSE); - linphone_call_enable_video(call,adding); + linphone_call_params_enable_video(params,adding); + linphone_core_update_call(lc,call,params); + linphone_call_params_destroy(params); } void linphone_gtk_update_video_button(LinphoneCall *call){ diff --git a/gtk/main.c b/gtk/main.c index 054677654..2955b3ecc 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1080,7 +1080,11 @@ static void linphone_gtk_notify(LinphoneCall *call, const char *msg){ static void on_call_updated_response(GtkWidget *dialog, gint responseid, LinphoneCall *call){ if (linphone_call_get_state(call)==LinphoneCallUpdatedByRemote){ - linphone_call_enable_video(call, responseid==GTK_RESPONSE_YES); + LinphoneCore *lc=linphone_call_get_core(call); + LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); + linphone_call_params_enable_video(params,responseid==GTK_RESPONSE_YES); + linphone_core_accept_call_update(lc,call,params); + linphone_call_params_destroy(params); } linphone_call_unref(call); g_source_remove_by_user_data(dialog); From ccfd3c7b2d94ef90b88b69a7867f92f33b01e14e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 9 Aug 2012 14:47:20 +0200 Subject: [PATCH 426/769] Update of ICE from remote media description may delete the ICE session, so check that the session exists after the update to prevent crashes. --- coreapi/linphonecall.c | 14 ++++++++------ coreapi/linphonecore.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4cd4a0734..36ffc4f81 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -392,12 +392,14 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro call->ice_session = ice_session_new(); ice_session_set_role(call->ice_session, IR_Controlled); linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(op)); - linphone_call_init_media_streams(call); - linphone_call_start_media_streams_for_ice_gathering(call); - if (linphone_core_gather_ice_candidates(call->core,call)<0) { - /* Ice candidates gathering failed, proceed with the call anyway. */ - linphone_call_delete_ice_session(call); - linphone_call_stop_media_streams(call); + if (call->ice_session != NULL) { + linphone_call_init_media_streams(call); + linphone_call_start_media_streams_for_ice_gathering(call); + if (linphone_core_gather_ice_candidates(call->core,call)<0) { + /* Ice candidates gathering failed, proceed with the call anyway. */ + linphone_call_delete_ice_session(call); + linphone_call_stop_media_streams(call); + } } break; case LinphonePolicyUseStun: diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b8911702b..3b8a274b7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2593,7 +2593,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const update_local_media_description(lc,call); if (call->ice_session != NULL) { linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); - if (!ice_session_candidates_gathered(call->ice_session)) { + if ((call->ice_session != NULL) &&!ice_session_candidates_gathered(call->ice_session)) { if ((call->params.has_video) && (call->params.has_video != old_has_video)) { linphone_call_init_video_stream(call); video_stream_prepare_video(call->videostream); From 4b8a215735463944ab8d32fcc264c583f505f830 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 9 Aug 2012 15:45:22 +0200 Subject: [PATCH 427/769] Can now use ICE and ping OPTIONS in parallel. --- coreapi/callbacks.c | 3 ++- coreapi/linphonecall.c | 2 +- coreapi/linphonecore.c | 33 ++++++++++++++++++++++++++++----- coreapi/private.h | 2 ++ 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index ba2789235..ab8f10f10 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -755,7 +755,8 @@ static void ping_reply(SalOp *op){ ms_message("ping reply !"); if (call){ if (call->state==LinphoneCallOutgoingInit){ - linphone_core_start_invite(call->core,call,NULL); + call->ping_replied=TRUE; + linphone_core_proceed_with_invite_if_ready(call->core,call,NULL); } } else diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 36ffc4f81..c5300bf99 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1732,7 +1732,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ break; case LinphoneCallOutgoingInit: linphone_call_stop_media_streams(call); - linphone_core_start_invite(call->core, call, NULL); + linphone_core_proceed_with_invite_if_ready(call->core, call, NULL); break; default: linphone_call_stop_media_streams(call); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3b8a274b7..9ba19020b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2105,6 +2105,27 @@ static char *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call , LinphonePr return NULL; } +int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy){ + bool_t ice_ready = FALSE; + bool_t ping_ready = FALSE; + + if (call->ice_session != NULL) { + if (ice_session_candidates_gathered(call->ice_session)) ice_ready = TRUE; + } else { + ice_ready = TRUE; + } + if (call->ping_op != NULL) { + if (call->ping_replied == TRUE) ping_ready = TRUE; + } else { + ping_ready = TRUE; + } + + if ((ice_ready == TRUE) && (ping_ready == TRUE)) { + return linphone_core_start_invite(lc, call, dest_proxy); + } + return 0; +} + int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy){ int err; char *contact; @@ -2247,6 +2268,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const char *real_url=NULL; LinphoneProxyConfig *dest_proxy=NULL; LinphoneCall *call; + bool_t use_ice = FALSE; linphone_core_preempt_sound_resources(lc); @@ -2298,18 +2320,19 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const linphone_call_delete_ice_session(call); linphone_call_stop_media_streams(call); } else { - if (real_url!=NULL) ms_free(real_url); - return call; + use_ice = TRUE; } } - if (dest_proxy!=NULL || lc->sip_conf.ping_with_options==FALSE){ - linphone_core_start_invite(lc,call,dest_proxy); - }else{ + + if (dest_proxy==NULL && lc->sip_conf.ping_with_options==TRUE){ /*defer the start of the call after the OPTIONS ping*/ + call->ping_replied=FALSE; call->ping_op=sal_op_new(lc->sal); sal_ping(call->ping_op,from,real_url); sal_op_set_user_pointer(call->ping_op,call); call->start_time=time(NULL); + }else{ + if (use_ice==FALSE) linphone_core_start_invite(lc,call,dest_proxy); } if (real_url!=NULL) ms_free(real_url); diff --git a/coreapi/private.h b/coreapi/private.h index 05d5c3f13..5c253b765 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -134,6 +134,7 @@ struct _LinphoneCall bool_t auth_token_verified; bool_t defer_update; bool_t was_automatically_paused; + bool_t ping_replied; CallCallbackObj nextVideoFrameDecoded; LinphoneCallStats stats[2]; IceSession *ice_session; @@ -260,6 +261,7 @@ void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose); void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses); void linphone_core_stop_waiting(LinphoneCore *lc); +int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy); int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy); int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call); int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call); From 6f9b9458f711961f389362410718390ac933873f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 9 Aug 2012 16:07:43 +0200 Subject: [PATCH 428/769] add config entry to finely select audio stream features --- coreapi/linphonecall.c | 2 ++ coreapi/linphonecore.c | 3 +++ coreapi/misc.c | 33 ++++++++++++++++++++++++++++++++- coreapi/private.h | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 3793cb32b..77fd9e20f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -933,6 +933,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){ audio_stream_enable_noise_gate(audiostream,enabled); } + audio_stream_set_features(audiostream,linphone_core_get_audio_features(lc)); + if (lc->rtptf){ RtpTransport *artp=lc->rtptf->audio_rtp_func(lc->rtptf->audio_rtp_func_data, call->audio_port); RtpTransport *artcp=lc->rtptf->audio_rtcp_func(lc->rtptf->audio_rtcp_func_data, call->audio_port+1); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 40b2a647d..62942726a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -485,6 +485,9 @@ static void sound_config_read(LinphoneCore *lc) linphone_core_set_playback_gain_db (lc,gain); linphone_core_set_remote_ringback_tone (lc,lp_config_get_string(lc->config,"sound","ringback_tone",NULL)); + + /*just parse requested stream feature once at start to print out eventual errors*/ + linphone_core_get_audio_features(lc); } static void sip_config_read(LinphoneCore *lc) diff --git a/coreapi/misc.c b/coreapi/misc.c index a749bf279..786347d63 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "private.h" +#include "lpconfig.h" #include "mediastreamer2/mediastream.h" #include #include @@ -574,6 +575,37 @@ LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer){ return cfg->magic==linphone_proxy_config_magic ? cfg : NULL; } +unsigned int linphone_core_get_audio_features(LinphoneCore *lc){ + unsigned int ret=0; + const char *features=lp_config_get_string(lc->config,"sound","features",NULL); + if (features){ + char tmp[256]={0}; + char name[256]; + char *p,*n; + strncpy(tmp,features,sizeof(tmp)-1); + for(p=tmp;*p!='\0';p++){ + if (*p==' ') continue; + n=strchr(p,'|'); + if (n) *n='\0'; + sscanf(p,"%s",name); + ms_message("Found audio feature %s",name); + if (strcasecmp(name,"PLC")==0) ret|=AUDIO_STREAM_FEATURE_PLC; + else if (strcasecmp(name,"EC")==0) ret|=AUDIO_STREAM_FEATURE_EC; + else if (strcasecmp(name,"EQUALIZER")==0) ret|=AUDIO_STREAM_FEATURE_EQUALIZER; + else if (strcasecmp(name,"VOL_SND")==0) ret|=AUDIO_STREAM_FEATURE_VOL_SND; + else if (strcasecmp(name,"VOL_RCV")==0) ret|=AUDIO_STREAM_FEATURE_VOL_RCV; + else if (strcasecmp(name,"DTMF")==0) ret|=AUDIO_STREAM_FEATURE_DTMF; + else if (strcasecmp(name,"DTMF_ECHO")==0) ret|=AUDIO_STREAM_FEATURE_DTMF_ECHO; + else if (strcasecmp(name,"ALL")==0) ret|=AUDIO_STREAM_FEATURE_ALL; + else if (strcasecmp(name,"NONE")==0) ret=0; + else ms_error("Unsupported audio feature %s requested in config file.",name); + if (!n) break; + p=n; + } + }else ret=AUDIO_STREAM_FEATURE_ALL; + return ret; +} + #ifdef HAVE_GETIFADDRS @@ -697,7 +729,6 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){ - void _linphone_core_configure_resolver(){ /*bionic declares _res but does not define nor export it !!*/ #ifdef ANDROID diff --git a/coreapi/private.h b/coreapi/private.h index bc035f215..24ee7f899 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -567,6 +567,7 @@ void linphone_call_remove_from_conf(LinphoneCall *call); void linphone_core_conference_check_uninit(LinphoneCore *lc); bool_t linphone_core_sound_resources_available(LinphoneCore *lc); void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall); +unsigned int linphone_core_get_audio_features(LinphoneCore *lc); void __linphone_core_invalidate_registers(LinphoneCore* lc); void _linphone_core_codec_config_write(LinphoneCore *lc); From c97efee37aea1ccae3c476a108e988e47f38faa4 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Fri, 10 Aug 2012 10:41:51 +0200 Subject: [PATCH 429/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 863022b56..b72c14600 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 863022b56fab41d2ca45dd1d149cb0caab08b54b +Subproject commit b72c14600003707dce7abd0c1003bd51a0d033c1 From 66f80b83ffbb230c6f579daad0e06c9d328dd701 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 10 Aug 2012 12:49:04 +0200 Subject: [PATCH 430/769] Fix compilation when video is not enabled. --- coreapi/linphonecall.c | 2 ++ coreapi/linphonecore.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index c5300bf99..74ef5487f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1471,9 +1471,11 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call){ audio_stream_prepare_sound(call->audiostream, NULL, NULL); +#ifdef VIDEO_ENABLED if (call->videostream) { video_stream_prepare_video(call->videostream); } +#endif } void linphone_call_delete_ice_session(LinphoneCall *call){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 9ba19020b..4e9198dc2 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2503,6 +2503,7 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){ int err=0; if (params!=NULL){ +#ifdef VIDEO_ENABLED if ((call->ice_session != NULL) && (call->videostream != NULL) && !params->has_video) { ice_session_remove_check_list(call->ice_session, call->videostream->ice_check_list); call->videostream->ice_check_list = NULL; @@ -2521,6 +2522,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho } else return err; } } +#endif err = linphone_core_start_update_call(lc, call); }else{ #ifdef VIDEO_ENABLED @@ -2616,6 +2618,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const update_local_media_description(lc,call); if (call->ice_session != NULL) { linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); +#ifdef VIDEO_ENABLED if ((call->ice_session != NULL) &&!ice_session_candidates_gathered(call->ice_session)) { if ((call->params.has_video) && (call->params.has_video != old_has_video)) { linphone_call_init_video_stream(call); @@ -2626,6 +2629,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const } else return 0; } } +#endif } linphone_core_start_accept_call_update(lc, call); return 0; From 32ef8c9994e18853ac25489a860a0906b54aba2a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 10 Aug 2012 17:23:54 +0200 Subject: [PATCH 431/769] Define ICE firewall policy for java. --- java/common/org/linphone/core/LinphoneCore.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index e06342178..6266f6646 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -140,6 +140,10 @@ public interface LinphoneCore { * Use stun server to discover RTP addresses and ports. */ static public FirewallPolicy UseStun = new FirewallPolicy(2,"UseStun"); + /** + * Use ICE. + */ + static public FirewallPolicy UseIce = new FirewallPolicy(3,"UseIce"); private final int mValue; private final String mStringValue; From adf9c369f993b4fd759a3df6efe05411952ead18 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 13 Aug 2012 09:48:57 +0200 Subject: [PATCH 432/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index b72c14600..0a55eafa6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b72c14600003707dce7abd0c1003bd51a0d033c1 +Subproject commit 0a55eafa62fa0742dbd812e04b48a5f14f7c1654 From 0203f32f0fcfcff02de7f0d17420bf550a15d752 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 13 Aug 2012 09:45:54 +0200 Subject: [PATCH 433/769] fix bug when telephone-event appears first in a remote SDP offer --- coreapi/offeranswer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 5a2b4f527..4b41f4ca3 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -21,9 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "offeranswer.h" static bool_t only_telephone_event(const MSList *l){ - PayloadType *p=(PayloadType*)l->data; - if (strcasecmp(p->mime_type,"telephone-event")!=0){ - return FALSE; + for(;l!=NULL;l=l->next){ + PayloadType *p=(PayloadType*)l->data; + if (strcasecmp(p->mime_type,"telephone-event")!=0){ + return FALSE; + } } return TRUE; } From bccc94646ad9162c16346cf72238d3d2f53ea485 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 13 Aug 2012 14:28:31 +0200 Subject: [PATCH 434/769] Restart ICE if the c= line is set to 0.0.0.0. --- coreapi/callbacks.c | 5 +++++ coreapi/linphonecore.c | 4 ++++ coreapi/misc.c | 44 ++++++++++++++++++++++++++++++++---------- 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index ab8f10f10..584191cc4 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -359,6 +359,11 @@ static void call_ack(SalOp *op){ static void call_accept_update(LinphoneCore *lc, LinphoneCall *call){ SalMediaDescription *md; + SalMediaDescription *rmd=sal_call_get_remote_media_description(call->op); + if ((rmd!=NULL) && (call->ice_session!=NULL)) { + linphone_core_update_ice_from_remote_media_description(call,rmd); + linphone_core_update_local_media_description_from_ice(call->localdesc,call->ice_session); + } sal_call_accept(call->op); md=sal_call_get_final_media_description(call->op); if (md && !sal_media_description_empty(md)) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 35e158f74..4b6c02c93 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2897,6 +2897,8 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call) return -1; } update_local_media_description(lc,call); + if (call->ice_session != NULL) + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); if (sal_media_description_has_dir(call->resultdesc,SalStreamSendRecv)){ sal_media_description_set_dir(call->localdesc,SalStreamSendOnly); subject="Call on hold"; @@ -2974,6 +2976,8 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call) if (call->audiostream) audio_stream_play(call->audiostream, NULL); update_local_media_description(lc,the_call); + if (call->ice_session != NULL) + linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); sal_call_set_local_media_description(call->op,call->localdesc); sal_media_description_set_dir(call->localdesc,SalStreamSendRecv); if (call->params.in_conference && !call->current_params.in_conference) subject="Conference"; diff --git a/coreapi/misc.c b/coreapi/misc.c index 5d56c9b51..3d3cb4477 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -703,14 +703,33 @@ static void get_default_addr_and_port(uint16_t componentID, const SalMediaDescri void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md) { + bool_t ice_restarted = FALSE; + if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) { int i, j; /* Check for ICE restart and set remote credentials. */ + if ((strcmp(md->addr, "0.0.0.0") == 0) || (strcmp(md->addr, "::0") == 0)) { + ice_session_restart(call->ice_session); + ice_restarted = TRUE; + } else { + for (i = 0; i < md->nstreams; i++) { + const SalStreamDescription *stream = &md->streams[i]; + IceCheckList *cl = ice_session_check_list(call->ice_session, i); + if (cl && (strcmp(stream->rtp_addr, "0.0.0.0") == 0)) { + ice_session_restart(call->ice_session); + ice_restarted = TRUE; + break; + } + } + } if ((ice_session_remote_ufrag(call->ice_session) == NULL) && (ice_session_remote_pwd(call->ice_session) == NULL)) { ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); } else if (ice_session_remote_credentials_changed(call->ice_session, md->ice_ufrag, md->ice_pwd)) { - ice_session_restart(call->ice_session); + if (ice_restarted == FALSE) { + ice_session_restart(call->ice_session); + ice_restarted = TRUE; + } ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); } for (i = 0; i < md->nstreams; i++) { @@ -718,7 +737,10 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, IceCheckList *cl = ice_session_check_list(call->ice_session, i); if (cl && (stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) { if (ice_check_list_remote_credentials_changed(cl, stream->ice_ufrag, stream->ice_pwd)) { - ice_session_restart(call->ice_session); + if (ice_restarted == FALSE) { + ice_session_restart(call->ice_session); + ice_restarted = TRUE; + } ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); break; } @@ -761,14 +783,16 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, ice_add_remote_candidate(cl, candidate->type, candidate->addr, candidate->port, candidate->componentID, candidate->priority, candidate->foundation, default_candidate); } - for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; j++) { - const SalIceRemoteCandidate *candidate = &stream->ice_remote_candidates[j]; - const char *addr = NULL; - int port = 0; - int componentID = j + 1; - if (candidate->addr[0] == '\0') break; - get_default_addr_and_port(componentID, md, stream, &addr, &port); - ice_add_losing_pair(ice_session_check_list(call->ice_session, i), j + 1, candidate->addr, candidate->port, addr, port); + if (ice_restarted == FALSE) { + for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; j++) { + const SalIceRemoteCandidate *candidate = &stream->ice_remote_candidates[j]; + const char *addr = NULL; + int port = 0; + int componentID = j + 1; + if (candidate->addr[0] == '\0') break; + get_default_addr_and_port(componentID, md, stream, &addr, &port); + ice_add_losing_pair(ice_session_check_list(call->ice_session, i), j + 1, candidate->addr, candidate->port, addr, port); + } } } } From 6f392caf464943b7cdefaa33f11bebbabe2f6eeb Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 13 Aug 2012 15:03:17 +0200 Subject: [PATCH 435/769] Do not set the c= line to 0.0.0.0 to pause a call when ICE is used. --- coreapi/sal_eXosip2_sdp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 8c917570f..9ca194199 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -144,7 +144,8 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc) osip_strdup ("IN"), inet6 ? osip_strdup("IP6") : osip_strdup ("IP4"), osip_strdup (desc->addr)); sdp_message_s_name_set (local, osip_strdup ("Talk")); - if(!sal_media_description_has_dir (desc,SalStreamSendOnly)) + /* Do not set the c= line to 0.0.0.0 if there is an ICE session. */ + if((desc->ice_ufrag[0] != '\0') || !sal_media_description_has_dir (desc,SalStreamSendOnly)) { sdp_message_c_connection_add (local, -1, osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"), From 7b5bddf359a8d9d3b20ad02efbb9355d2caaf052 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 14 Aug 2012 12:37:21 +0200 Subject: [PATCH 436/769] Deactivate symmetric RTP when ICE is in use. --- coreapi/linphonecall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5029e34f8..9e9ecee42 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -974,6 +974,7 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ } if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)){ rtp_session_set_pktinfo(audiostream->session, TRUE); + rtp_session_set_symmetric_rtp(audiostream->session, FALSE); audiostream->ice_check_list = ice_session_check_list(call->ice_session, 0); ice_check_list_set_rtp_session(audiostream->ice_check_list, audiostream->session); } @@ -1003,6 +1004,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){ } if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, 1))){ rtp_session_set_pktinfo(call->videostream->session, TRUE); + rtp_session_set_symmetric_rtp(call->videostream->session, FALSE); call->videostream->ice_check_list = ice_session_check_list(call->ice_session, 1); ice_check_list_set_rtp_session(call->videostream->ice_check_list, call->videostream->session); } From 98cfcb39f9d0e215efe1c53fbf4ab07dc067b458 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 16 Aug 2012 10:59:14 +0200 Subject: [PATCH 437/769] Better loop ending test. --- coreapi/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 3d3cb4477..4292a6f17 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -647,7 +647,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * stream->ice_mismatch = ice_check_list_is_mismatch(cl); if ((cl->state == ICL_Running) || (cl->state == ICL_Completed)) { memset(stream->ice_candidates, 0, sizeof(stream->ice_candidates)); - for (j = 0; j < ms_list_size(cl->local_candidates); j++) { + for (j = 0; j < MIN(ms_list_size(cl->local_candidates), SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES); j++) { SalIceCandidate *sal_candidate = &stream->ice_candidates[nb_candidates]; IceCandidate *ice_candidate = ms_list_nth_data(cl->local_candidates, j); const char *default_addr = NULL; From 42e4255c96907e67bb3c1dfc9de2a90b50dc0581 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 16 Aug 2012 12:00:49 +0200 Subject: [PATCH 438/769] Update ms2 and oRTP. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 0a55eafa6..d5014c8dc 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0a55eafa62fa0742dbd812e04b48a5f14f7c1654 +Subproject commit d5014c8dcf1dbce6448dfa4e7d8f940fec995cd2 diff --git a/oRTP b/oRTP index 2590e21d8..6146d4b20 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 2590e21d864b43d6ac3a2ece0cf3b4d0e208e866 +Subproject commit 6146d4b205abb12b0108558d22f69f0e6d9eab6b From 423777d8cfe8d0257e99db7309dfae9af560cd91 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 16 Aug 2012 14:27:21 +0200 Subject: [PATCH 439/769] Compilation fix. --- coreapi/sal_eXosip2_sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 9ca194199..e1e2341b5 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -514,7 +514,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){ /* Get media specific RTCP attribute */ stream->rtcp_port = stream->rtp_port + 1; - snprintf(stream->rtcp_addr, sizeof(stream->rtcp_addr), stream->rtp_addr); + snprintf(stream->rtcp_addr, sizeof(stream->rtcp_addr), "%s", stream->rtp_addr); for (j = 0; ((attr = sdp_message_attribute_get(msg, i, j)) != NULL); j++) { if ((keywordcmp("rtcp", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) { char tmp[256]; From 05601300f64c0f095ba0faeb9e2dd1c1e9483238 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 16 Aug 2012 15:23:59 +0200 Subject: [PATCH 440/769] Update ms2. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index d5014c8dc..43f7f795f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d5014c8dcf1dbce6448dfa4e7d8f940fec995cd2 +Subproject commit 43f7f795f22fd8b4cbab313d2adaf854c41575a7 From ff7c61809a89cc4deb3a01e93825906f3d313afb Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 17 Aug 2012 11:07:06 +0200 Subject: [PATCH 441/769] Update ms2 and oRTP. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 43f7f795f..ffcc02715 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 43f7f795f22fd8b4cbab313d2adaf854c41575a7 +Subproject commit ffcc02715248916653e7091fb5fa139b651fae94 diff --git a/oRTP b/oRTP index 6146d4b20..f2f27af98 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 6146d4b205abb12b0108558d22f69f0e6d9eab6b +Subproject commit f2f27af98f2a38daa1725641ddd8e435598a4e1b From 0a12fa9ce7af5c795722ce1f7ebad9bc85314d3b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 20 Aug 2012 14:36:09 +0200 Subject: [PATCH 442/769] Update ms2 and oRTP submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index ffcc02715..6016a3ce7 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ffcc02715248916653e7091fb5fa139b651fae94 +Subproject commit 6016a3ce7577d51689bec71a0188385862aec6d9 diff --git a/oRTP b/oRTP index f2f27af98..67b89aba8 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit f2f27af98f2a38daa1725641ddd8e435598a4e1b +Subproject commit 67b89aba8bfa08a4b827441c1f660b234c283443 From 2e5e82c03ddfe68fd23faf9d2176bc88eb695dee Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 20 Aug 2012 18:32:31 +0200 Subject: [PATCH 443/769] update ms2 (x11 bugfix) --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6016a3ce7..826e43fc6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6016a3ce7577d51689bec71a0188385862aec6d9 +Subproject commit 826e43fc66469d9cee126e81b38919dd2bc542c3 From aca7607beab7929dcd00c3e3f6136ee415c70433 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 21 Aug 2012 10:32:26 +0200 Subject: [PATCH 444/769] add dtmf_player_amp propertyo --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4b6c02c93..e9142ba41 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4246,7 +4246,7 @@ static MSFilter *get_dtmf_gen(LinphoneCore *lc){ return stream->dtmfgen; } if (lc->ringstream==NULL){ - float amp=0.1; + float amp=lp_config_get_float(lc->config,"sound","dtmf_player_amp",0.1); MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard; if (ringcard == NULL) return NULL; From 75040297c12e118cea0ec87d2bc3980c290f8e86 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 21 Aug 2012 10:55:20 +0200 Subject: [PATCH 445/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 826e43fc6..0778db71a 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 826e43fc66469d9cee126e81b38919dd2bc542c3 +Subproject commit 0778db71afdce04b55fe686f6a7c24aa909436c4 From e16ac3b3a6e6041ef8dc3d353f89d88ed32e74a8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 21 Aug 2012 13:20:40 +0200 Subject: [PATCH 446/769] Update ms2 and oRTP submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6016a3ce7..c67f981f4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6016a3ce7577d51689bec71a0188385862aec6d9 +Subproject commit c67f981f40c195005bfa289c25ba99faa16aadc9 diff --git a/oRTP b/oRTP index 67b89aba8..cba069472 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 67b89aba8bfa08a4b827441c1f660b234c283443 +Subproject commit cba069472f6a464c0d7372cd97be0215cf165995 From 125626d071204ca5369eb2f33c727e8e6e6418f7 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 21 Aug 2012 15:06:11 +0200 Subject: [PATCH 447/769] Fix enabling and disabling of video. --- coreapi/linphonecore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e9142ba41..437251eb7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2524,6 +2524,8 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho linphone_call_delete_ice_session(call); } else return err; } + } else { + call->params = *params; } #endif err = linphone_core_start_update_call(lc, call); From 4e34218a41abbbf175789a5ac37a75ebaa0307d0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 22 Aug 2012 09:21:58 +0200 Subject: [PATCH 448/769] Fix loading of liblinphone on x86 platform. --- LinphoneCoreFactoryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 7d0be46e3..a99509fa3 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -71,7 +71,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { //Main library if (!hasNeonInCpuFeatures()) { try { - if (!isArmv7()) { + if (!isArmv7() && !Version.isX86()) { System.loadLibrary("linphonearmv5"); } else { System.loadLibrary("linphonenoneon"); From 29100967ae8e680a2de6ce6a6ac2743ad1a1d904 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 22 Aug 2012 09:43:59 +0200 Subject: [PATCH 449/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index c67f981f4..0e7941097 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c67f981f40c195005bfa289c25ba99faa16aadc9 +Subproject commit 0e7941097d8aaf65e801dbfc1dcb9d20fb268e9d From ae54442d0f26ab54975cf297f256e21c082692a3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 22 Aug 2012 09:56:26 +0200 Subject: [PATCH 450/769] update version number --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 235fb79b1..eae637b84 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([linphone],[3.5.2],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.5.99.0],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) From da56c0838b6e301fca338faaac53cd026ec02d88 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 22 Aug 2012 11:09:36 +0200 Subject: [PATCH 451/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 0e7941097..900c1964b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0e7941097d8aaf65e801dbfc1dcb9d20fb268e9d +Subproject commit 900c1964b3b76ad542275977a0fe038c16138491 From c82d1dd37fd121a7d6fdeb38432f40fe21909183 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 22 Aug 2012 12:05:12 +0200 Subject: [PATCH 452/769] Allow starting video stream without starting audio stream. --- coreapi/linphonecall.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 9e9ecee42..340f02cc3 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1426,8 +1426,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut SalProtoRtpAvp,SalVideo); #endif - if(call->audiostream == NULL) - { + if ((call->audiostream == NULL) && (call->videostream == NULL)) { ms_fatal("start_media_stream() called without prior init !"); return; } @@ -1439,7 +1438,9 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut use_arc=FALSE; } #endif - linphone_call_start_audio_stream(call,cname,all_inputs_muted,send_ringbacktone,use_arc); + if (call->audiostream!=NULL) { + linphone_call_start_audio_stream(call,cname,all_inputs_muted,send_ringbacktone,use_arc); + } call->current_params.has_video=FALSE; if (call->videostream!=NULL) { linphone_call_start_video_stream(call,cname,all_inputs_muted); From 467d83da4c2b634d1648cfa44214e4446cefb0e7 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 22 Aug 2012 15:54:44 +0200 Subject: [PATCH 453/769] Do not include ICE candidates in the SDP for a media stream with the port set to 0. --- coreapi/sal_eXosip2_sdp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index e1e2341b5..6b1dd8855 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -384,10 +384,12 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription if (desc->ice_mismatch == TRUE) { sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-mismatch"), NULL); } else { - if (desc->ice_pwd[0] != '\0') sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-pwd"), osip_strdup(desc->ice_pwd)); - if (desc->ice_ufrag[0] != '\0') sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-ufrag"), osip_strdup(desc->ice_ufrag)); - add_ice_candidates(msg, lineno, desc); - add_ice_remote_candidates(msg, lineno, desc); + if (desc->rtp_port != 0) { + if (desc->ice_pwd[0] != '\0') sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-pwd"), osip_strdup(desc->ice_pwd)); + if (desc->ice_ufrag[0] != '\0') sdp_message_a_attribute_add(msg, lineno, osip_strdup("ice-ufrag"), osip_strdup(desc->ice_ufrag)); + add_ice_candidates(msg, lineno, desc); + add_ice_remote_candidates(msg, lineno, desc); + } } } From 1f9a43a8e8cb759070737338d4638ed01cec4ec0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 22 Aug 2012 15:56:59 +0200 Subject: [PATCH 454/769] Prevent crappy RTP and RTCP address if their extraction from ICE fails. --- coreapi/misc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 4292a6f17..a4db409d9 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -612,6 +612,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * IceSessionState session_state = ice_session_state(session); int nb_candidates; int i, j; + bool_t result; if (session_state == IS_Completed) { desc->ice_completed = TRUE; @@ -630,11 +631,17 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * if (cl == NULL) continue; if (cl->state == ICL_Completed) { stream->ice_completed = TRUE; - ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); + result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); + } else { + stream->ice_completed = FALSE; + result = ice_check_list_default_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); + } + if (result == TRUE) { strncpy(stream->rtp_addr, rtp_addr, sizeof(stream->rtp_addr)); strncpy(stream->rtcp_addr, rtcp_addr, sizeof(stream->rtcp_addr)); } else { - stream->ice_completed = FALSE; + memset(stream->rtp_addr, 0, sizeof(stream->rtp_addr)); + memset(stream->rtcp_addr, 0, sizeof(stream->rtcp_addr)); } if ((strlen(ice_check_list_local_pwd(cl)) != strlen(desc->ice_pwd)) || (strcmp(ice_check_list_local_pwd(cl), desc->ice_pwd))) strncpy(stream->ice_pwd, ice_check_list_local_pwd(cl), sizeof(stream->ice_pwd)); From 4e7aa3c6c6692878e681aa63560de433b3646342 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 22 Aug 2012 15:58:13 +0200 Subject: [PATCH 455/769] Set the state of an ICE check list to Failed if the peer has set the port of the media stream to 0. --- coreapi/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index a4db409d9..e5aa6ec2c 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -772,7 +772,7 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, break; } } - if (stream->ice_mismatch == TRUE) { + if ((stream->ice_mismatch == TRUE) || (stream->rtp_port == 0)) { ice_check_list_set_state(cl, ICL_Failed); } else { if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) From a0be0c1b3b977f2ebc1e7712c648ae9748788458 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 22 Aug 2012 18:58:38 +0200 Subject: [PATCH 456/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 900c1964b..b2e01872f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 900c1964b3b76ad542275977a0fe038c16138491 +Subproject commit b2e01872f8fe33db60a7913a26bc037b4d664846 From ced4134ba2756426e71ad5e1382e2682abad07fd Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 23 Aug 2012 08:27:09 +0200 Subject: [PATCH 457/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index b2e01872f..ec3580ad5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b2e01872f8fe33db60a7913a26bc037b4d664846 +Subproject commit ec3580ad58e5df9fbd4b75219d39042f49e1fd8c From 1438d4f5911aa692b862b04e421eb48de3147b00 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 23 Aug 2012 10:08:17 +0200 Subject: [PATCH 458/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index ec3580ad5..4ef6e73a9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ec3580ad58e5df9fbd4b75219d39042f49e1fd8c +Subproject commit 4ef6e73a944b089efc65604d92ef75fa95d27477 From 9b9106c1e798399a76b4a75cd75c30b691d5436d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 24 Aug 2012 10:40:37 +0200 Subject: [PATCH 459/769] fix bad function name --- coreapi/linphonecore.c | 2 +- coreapi/linphonecore.h | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 437251eb7..6ed23e7c8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4673,7 +4673,7 @@ void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t isReachable) { set_network_reachable(lc,isReachable, ms_time(NULL)); } -bool_t linphone_core_is_network_reachabled(LinphoneCore* lc) { +bool_t linphone_core_is_network_reachable(LinphoneCore* lc) { return lc->network_reachable; } ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 87686d6ff..984b09d56 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1096,17 +1096,15 @@ void linphone_core_set_mtu(LinphoneCore *lc, int mtu); /** * @ingroup network_parameters * This method is called by the application to notify the linphone core library when network is reachable. - * Calling this method with true trigger linphone to initiate a registration process for all proxy - * configuration with parameter register set to enable. - * This method disable the automatic registration mode. It means you must call this method after each network state changes - * + * Calling this method with true trigger linphone to initiate a registration process for all proxies. + * Calling this method disables the automatic network detection mode. It means you must call this method after each network state changes. */ void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t value); /** * @ingroup network_parameters - * return network state either as positioned by the application or by linphone + * return network state either as positioned by the application or by linphone itself. */ -bool_t linphone_core_is_network_reachabled(LinphoneCore* lc); +bool_t linphone_core_is_network_reachable(LinphoneCore* lc); /** * @ingroup network_parameters From 52766069426b9e6d2f24c15c5f3d2037d51826de Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 23 Aug 2012 09:57:10 +0200 Subject: [PATCH 460/769] Do not delete ICE session when it is in the Failed state. If the ICE session is deleted it can not be restarted later. However try to send a re-invite if the session state is Failed but some check lists have completed successfully. --- coreapi/linphonecall.c | 8 +++++++- coreapi/misc.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 340f02cc3..4ffb699b2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1718,7 +1718,13 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ } break; case IS_Failed: - linphone_call_delete_ice_session(call); + if (ice_session_has_completed_check_list(call->ice_session) == TRUE) { + if (ice_session_role(call->ice_session) == IR_Controlling) { + /* At least one ICE session has succeeded, so perform a call update. */ + ice_session_select_candidates(call->ice_session); + linphone_core_update_call(call->core, call, &call->current_params); + } + } break; default: break; diff --git a/coreapi/misc.c b/coreapi/misc.c index e5aa6ec2c..3f48b419b 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -808,7 +808,7 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, } ice_session_check_mismatch(call->ice_session); } - if ((ice_session_state(call->ice_session) == IS_Failed) || (ice_session_nb_check_lists(call->ice_session) == 0)) { + if (ice_session_nb_check_lists(call->ice_session) == 0) { linphone_call_delete_ice_session(call); } } From 011750b6cd288423a64b9185eabacb6976e92141 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 23 Aug 2012 12:28:15 +0200 Subject: [PATCH 461/769] Prevent gathering ICE candidates if not needed. --- coreapi/linphonecore.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6ed23e7c8..46c8b11c0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2507,25 +2507,22 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho int err=0; if (params!=NULL){ #ifdef VIDEO_ENABLED + bool_t has_video = call->params.has_video; if ((call->ice_session != NULL) && (call->videostream != NULL) && !params->has_video) { ice_session_remove_check_list(call->ice_session, call->videostream->ice_check_list); call->videostream->ice_check_list = NULL; } - if ((call->ice_session != NULL) && ((ice_session_state(call->ice_session) != IS_Completed) || (call->params.has_video != params->has_video))) { + call->params = *params; + if ((call->ice_session != NULL) && (ice_session_state(call->ice_session) != IS_Completed) && !has_video && params->has_video) { /* Defer call update until the ICE candidates gathering process has finished. */ ms_message("Defer call update to gather ICE candidates"); - call->params = *params; update_local_media_description(lc, call); - if (call->params.has_video) { - linphone_call_init_video_stream(call); - video_stream_prepare_video(call->videostream); - if (linphone_core_gather_ice_candidates(lc,call)<0) { - /* Ice candidates gathering failed, proceed with the call anyway. */ - linphone_call_delete_ice_session(call); - } else return err; - } - } else { - call->params = *params; + linphone_call_init_video_stream(call); + video_stream_prepare_video(call->videostream); + if (linphone_core_gather_ice_candidates(lc,call)<0) { + /* Ice candidates gathering failed, proceed with the call anyway. */ + linphone_call_delete_ice_session(call); + } else return err; } #endif err = linphone_core_start_update_call(lc, call); From 7b6314c381ec25d3bbb169c95c1fbbf98a5c251a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 23 Aug 2012 16:10:55 +0200 Subject: [PATCH 462/769] Set an ICE check list to the Failed state if the corresponding media stream has been deactivated by the peer. --- coreapi/callbacks.c | 3 +++ coreapi/misc.c | 11 +++++++++++ coreapi/private.h | 1 + 3 files changed, 15 insertions(+) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 584191cc4..95d5b81af 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -46,6 +46,9 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia call->media_pending=TRUE; } call->resultdesc=new_md; + if (call->ice_session != NULL) { + linphone_core_deactivate_ice_for_deactivated_media_streams(call, call->resultdesc); + } if (call->audiostream && call->audiostream->ticker){ /* we already started media: check if we really need to restart it*/ if (oldmd){ diff --git a/coreapi/misc.c b/coreapi/misc.c index 3f48b419b..a65793350 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -813,6 +813,17 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, } } +void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md) +{ + int i; + for (i = 0; i < md->nstreams; i++) { + IceCheckList *cl = ice_session_check_list(call->ice_session, i); + if (cl && (md->streams[i].rtp_port == 0)) { + if (cl->state != ICL_Completed) ice_check_list_set_state(cl, ICL_Failed); + } + } +} + LinphoneCall * is_a_linphone_call(void *user_pointer){ LinphoneCall *call=(LinphoneCall*)user_pointer; if (call==NULL) return NULL; diff --git a/coreapi/private.h b/coreapi/private.h index a68615e36..b102dc7b5 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -224,6 +224,7 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); +void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md); void linphone_core_send_initial_subscribes(LinphoneCore *lc); void linphone_core_write_friends_config(LinphoneCore* lc); From 3b8e54e6ec4448abc65fb1ffb65ee38f13ab5165 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 23 Aug 2012 16:13:07 +0200 Subject: [PATCH 463/769] Check if an ICE check list can be set to the Completed state after adding the losing pairs. --- coreapi/misc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index a65793350..e1943521b 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -791,6 +791,7 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, candidate->priority, candidate->foundation, default_candidate); } if (ice_restarted == FALSE) { + bool_t losing_pairs_added = FALSE; for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; j++) { const SalIceRemoteCandidate *candidate = &stream->ice_remote_candidates[j]; const char *addr = NULL; @@ -798,8 +799,10 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, int componentID = j + 1; if (candidate->addr[0] == '\0') break; get_default_addr_and_port(componentID, md, stream, &addr, &port); - ice_add_losing_pair(ice_session_check_list(call->ice_session, i), j + 1, candidate->addr, candidate->port, addr, port); + ice_add_losing_pair(cl, j + 1, candidate->addr, candidate->port, addr, port); + losing_pairs_added = TRUE; } + if (losing_pairs_added == TRUE) ice_check_list_check_completed(cl); } } } From 101278f2f0175817e0fad58a0b203b5fa2bfdf8a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 23 Aug 2012 16:57:52 +0200 Subject: [PATCH 464/769] Restart media streams when updating them even if only the video stream is running. --- coreapi/callbacks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 95d5b81af..161aaab24 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -49,7 +49,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia if (call->ice_session != NULL) { linphone_core_deactivate_ice_for_deactivated_media_streams(call, call->resultdesc); } - if (call->audiostream && call->audiostream->ticker){ + if ((call->audiostream && call->audiostream->ticker) || (call->videostream && call->videostream->ticker)){ /* we already started media: check if we really need to restart it*/ if (oldmd){ if (!media_parameters_changed(call,oldmd,new_md) && !call->playing_ringbacktone){ From 29e0c09557876f98ce93b625a966be8e75b377c8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 24 Aug 2012 09:24:24 +0200 Subject: [PATCH 465/769] Use accessor function to get ICE check list state. --- coreapi/misc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index e1943521b..bf5c53dcc 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -629,7 +629,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * IceCheckList *cl = ice_session_check_list(session, i); nb_candidates = 0; if (cl == NULL) continue; - if (cl->state == ICL_Completed) { + if (ice_check_list_state(cl) == ICL_Completed) { stream->ice_completed = TRUE; result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); } else { @@ -652,7 +652,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * else memset(stream->ice_pwd, 0, sizeof(stream->ice_pwd)); stream->ice_mismatch = ice_check_list_is_mismatch(cl); - if ((cl->state == ICL_Running) || (cl->state == ICL_Completed)) { + if ((ice_check_list_state(cl) == ICL_Running) || (ice_check_list_state(cl) == ICL_Completed)) { memset(stream->ice_candidates, 0, sizeof(stream->ice_candidates)); for (j = 0; j < MIN(ms_list_size(cl->local_candidates), SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES); j++) { SalIceCandidate *sal_candidate = &stream->ice_candidates[nb_candidates]; @@ -668,7 +668,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * } else continue; if (default_addr[0] == '\0') default_addr = desc->addr; /* Only include the candidates matching the default destination for each component of the stream if the state is Completed as specified in RFC5245 section 9.1.2.2. */ - if ((cl->state == ICL_Completed) + if ((ice_check_list_state(cl) == ICL_Completed) && !((ice_candidate->taddr.port == default_port) && (strlen(ice_candidate->taddr.ip) == strlen(default_addr)) && (strcmp(ice_candidate->taddr.ip, default_addr) == 0))) continue; strncpy(sal_candidate->foundation, ice_candidate->foundation, sizeof(sal_candidate->foundation)); @@ -684,7 +684,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * nb_candidates++; } } - if ((cl->state == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) { + if ((ice_check_list_state(cl) == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) { int rtp_port, rtcp_port; memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates)); ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); @@ -822,7 +822,7 @@ void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *ca for (i = 0; i < md->nstreams; i++) { IceCheckList *cl = ice_session_check_list(call->ice_session, i); if (cl && (md->streams[i].rtp_port == 0)) { - if (cl->state != ICL_Completed) ice_check_list_set_state(cl, ICL_Failed); + if (ice_check_list_state(cl) != ICL_Completed) ice_check_list_set_state(cl, ICL_Failed); } } } From af077522263bafdc21e85baf0ae52b4d2b1f061f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 24 Aug 2012 10:58:30 +0200 Subject: [PATCH 466/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 4ef6e73a9..54678a7ac 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 4ef6e73a944b089efc65604d92ef75fa95d27477 +Subproject commit 54678a7aca9ce71dc43660fc80364cd0a2076ca9 From 2e64b3b04573d6b26f337177bece4a9d266ae83d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 24 Aug 2012 11:14:33 +0200 Subject: [PATCH 467/769] update ms2 for bugfix and fix JNI --- coreapi/linphonecore_jni.cc | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 894e4c1f8..bf1a30bcd 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -601,7 +601,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReachable( JNIEnv* env ,jobject thiz ,jlong lc) { - return linphone_core_is_network_reachabled((LinphoneCore*)lc); + return linphone_core_is_network_reachable((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env diff --git a/mediastreamer2 b/mediastreamer2 index 54678a7ac..b184aec8e 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 54678a7aca9ce71dc43660fc80364cd0a2076ca9 +Subproject commit b184aec8e85e094df2b9c18e0ba4bf19aa873ec9 From cc241d02d5700a8ecc31f02603a1877a7ed8e39d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 27 Aug 2012 12:52:51 +0200 Subject: [PATCH 468/769] Update ms2. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index b184aec8e..d622cd514 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b184aec8e85e094df2b9c18e0ba4bf19aa873ec9 +Subproject commit d622cd51499ad0745e519eb129ea133fa8fd168b From 199108c92435cc0f7daf3dd8f6bdc6d9830b3af0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 27 Aug 2012 12:51:41 +0200 Subject: [PATCH 469/769] Add configuration of adaptive jitter compensation enabling. --- coreapi/linphonecall.c | 7 +++--- coreapi/linphonecore.c | 51 ++++++++++++++++++++++++++++++++++++++++-- coreapi/linphonecore.h | 12 ++++++++++ coreapi/private.h | 2 ++ 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4ffb699b2..f1823165f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1203,7 +1203,6 @@ static int find_crypto_index_from_tag(const SalSrtpCryptoAlgo crypto[],unsigned } static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cname, bool_t muted, bool_t send_ringbacktone, bool_t use_arc){ LinphoneCore *lc=call->core; - int jitt_comp=lc->rtp_conf.audio_jitt_comp; int used_pt=-1; /* look for savp stream first */ const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc, @@ -1263,6 +1262,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna if (playcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(playcard, stream->max_rate); if (captcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(captcard, stream->max_rate); audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc); + audio_stream_enable_adaptive_jittcomp(call->audiostream, linphone_core_audio_adaptive_jittcomp_enabled(lc)); audio_stream_start_full( call->audiostream, call->audio_profile, @@ -1271,7 +1271,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna stream->rtcp_addr[0]!='\0' ? stream->rtcp_addr : call->resultdesc->addr, linphone_core_rtcp_enabled(lc) ? (stream->rtcp_port) : 0, used_pt, - jitt_comp, + linphone_core_get_audio_jittcomp(lc), playfile, recfile, playcard, @@ -1351,6 +1351,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna video_stream_enable_adaptive_bitrate_control(call->videostream, linphone_core_adaptive_rate_control_enabled(lc)); + video_stream_enable_adaptive_jittcomp(call->videostream, linphone_core_video_adaptive_jittcomp_enabled(lc)); video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc)); video_stream_enable_self_view(call->videostream,lc->video_conf.selfview); if (lc->video_window_id!=0) @@ -1387,7 +1388,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna video_stream_start(call->videostream, call->video_profile, rtp_addr, vstream->rtp_port, rtcp_addr, linphone_core_rtcp_enabled(lc) ? (vstream->rtcp_port) : 0, - used_pt, lc->rtp_conf.audio_jitt_comp, cam); + used_pt, linphone_core_get_video_jittcomp(lc), cam); video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 46c8b11c0..3d05816ca 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -623,6 +623,7 @@ static void rtp_config_read(LinphoneCore *lc) int jitt_comp; int nortp_timeout; bool_t rtp_no_xmit_on_audio_mute; + bool_t adaptive_jitt_comp_enabled; port=lp_config_get_int(lc->config,"rtp","audio_rtp_port",7078); linphone_core_set_audio_port(lc,port); @@ -635,11 +636,15 @@ static void rtp_config_read(LinphoneCore *lc) linphone_core_set_audio_jittcomp(lc,jitt_comp); jitt_comp=lp_config_get_int(lc->config,"rtp","video_jitt_comp",60); if (jitt_comp==0) jitt_comp=60; - lc->rtp_conf.video_jitt_comp=jitt_comp; + linphone_core_set_video_jittcomp(lc,jitt_comp); nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30); linphone_core_set_nortp_timeout(lc,nortp_timeout); rtp_no_xmit_on_audio_mute=lp_config_get_int(lc->config,"rtp","rtp_no_xmit_on_audio_mute",FALSE); linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_no_xmit_on_audio_mute); + adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "audio_adaptive_jitt_comp_enabled", TRUE); + linphone_core_enable_audio_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled); + adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "video_adaptive_jitt_comp_enabled", TRUE); + linphone_core_enable_video_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled); } static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, const char *recv_fmtp){ @@ -1376,8 +1381,18 @@ const MSList * linphone_core_get_friend_list(const LinphoneCore *lc) return lc->friends; } +void linphone_core_enable_audio_adaptive_jittcomp(LinphoneCore* lc, bool_t val) +{ + lc->rtp_conf.audio_adaptive_jitt_comp_enabled = val; +} + +bool_t linphone_core_audio_adaptive_jittcomp_enabled(LinphoneCore* lc) +{ + return lc->rtp_conf.audio_adaptive_jitt_comp_enabled; +} + /** - * Returns the nominal jitter buffer size in milliseconds. + * Returns the nominal audio jitter buffer size in milliseconds. * * @ingroup media_parameters **/ @@ -1386,6 +1401,26 @@ int linphone_core_get_audio_jittcomp(LinphoneCore *lc) return lc->rtp_conf.audio_jitt_comp; } +void linphone_core_enable_video_adaptive_jittcomp(LinphoneCore* lc, bool_t val) +{ + lc->rtp_conf.video_adaptive_jitt_comp_enabled = val; +} + +bool_t linphone_core_video_adaptive_jittcomp_enabled(LinphoneCore* lc) +{ + return lc->rtp_conf.video_adaptive_jitt_comp_enabled; +} + +/** + * Returns the nominal video jitter buffer size in milliseconds. + * + * @ingroup media_parameters +**/ +int linphone_core_get_video_jittcomp(LinphoneCore *lc) +{ + return lc->rtp_conf.video_jitt_comp; +} + /** * Returns the UDP port used for audio streaming. * @@ -1433,6 +1468,16 @@ void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value) lc->rtp_conf.audio_jitt_comp=value; } +/** + * Sets the nominal video jitter buffer size in milliseconds. + * + * @ingroup media_parameters +**/ +void linphone_core_set_video_jittcomp(LinphoneCore *lc, int value) +{ + lc->rtp_conf.video_jitt_comp=value; +} + void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc,bool_t rtp_no_xmit_on_audio_mute){ lc->rtp_conf.rtp_no_xmit_on_audio_mute=rtp_no_xmit_on_audio_mute; } @@ -4474,6 +4519,8 @@ void rtp_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,"rtp","audio_jitt_comp",config->audio_jitt_comp); lp_config_set_int(lc->config,"rtp","video_jitt_comp",config->video_jitt_comp); lp_config_set_int(lc->config,"rtp","nortp_timeout",config->nortp_timeout); + lp_config_set_int(lc->config,"rtp","audio_jitt_comp_enabled",config->audio_adaptive_jitt_comp_enabled); + lp_config_set_int(lc->config,"rtp","video_jitt_comp_enabled",config->video_adaptive_jitt_comp_enabled); } void sound_config_uninit(LinphoneCore *lc) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 984b09d56..98bb03d46 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -903,10 +903,22 @@ void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *inf void linphone_core_clear_all_auth_info(LinphoneCore *lc); +void linphone_core_enable_audio_adaptive_jittcomp(LinphoneCore *lc, bool_t enable); + +bool_t linphone_core_audio_adaptive_jittcomp_enabled(LinphoneCore *lc); + int linphone_core_get_audio_jittcomp(LinphoneCore *lc); void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value); +void linphone_core_enable_video_adaptive_jittcomp(LinphoneCore *lc, bool_t enable); + +bool_t linphone_core_video_adaptive_jittcomp_enabled(LinphoneCore *lc); + +int linphone_core_get_video_jittcomp(LinphoneCore *lc); + +void linphone_core_set_video_jittcomp(LinphoneCore *lc, int value); + int linphone_core_get_audio_port(const LinphoneCore *lc); int linphone_core_get_video_port(const LinphoneCore *lc); diff --git a/coreapi/private.h b/coreapi/private.h index b102dc7b5..d1c15e41c 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -369,6 +369,8 @@ typedef struct rtp_config int nortp_timeout; bool_t rtp_no_xmit_on_audio_mute; /* stop rtp xmit when audio muted */ + bool_t audio_adaptive_jitt_comp_enabled; + bool_t video_adaptive_jitt_comp_enabled; }rtp_config_t; From 78b821254b077aee75ac299a40c6d28a234112a5 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 27 Aug 2012 17:09:18 +0200 Subject: [PATCH 470/769] Store number of channels for audio codecs in config file. --- coreapi/linphonecore.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3d05816ca..18bc4be19 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -647,14 +647,15 @@ static void rtp_config_read(LinphoneCore *lc) linphone_core_enable_video_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled); } -static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, const char *recv_fmtp){ +static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, int channels, const char *recv_fmtp){ PayloadType *candidate=NULL; int i; PayloadType *it; for(i=0;i<127;++i){ it=rtp_profile_get_payload(prof,i); if (it!=NULL && strcasecmp(mime_type,it->mime_type)==0 - && (clock_rate==it->clock_rate || clock_rate<=0) ){ + && (clock_rate==it->clock_rate || clock_rate<=0) + && (channels==it->channels || channels<=0) ){ if ( (recv_fmtp && it->recv_fmtp && strstr(recv_fmtp,it->recv_fmtp)!=NULL) || (recv_fmtp==NULL && it->recv_fmtp==NULL) ){ /*exact match*/ @@ -676,7 +677,7 @@ static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int c static bool_t get_codec(LpConfig *config, const char* type, int index, PayloadType **ret){ char codeckey[50]; const char *mime,*fmtp; - int rate,enabled; + int rate,channels,enabled; PayloadType *pt; *ret=NULL; @@ -686,8 +687,9 @@ static bool_t get_codec(LpConfig *config, const char* type, int index, PayloadTy rate=lp_config_get_int(config,codeckey,"rate",8000); fmtp=lp_config_get_string(config,codeckey,"recv_fmtp",NULL); + channels=lp_config_get_int(config,codeckey,"channels",0); enabled=lp_config_get_int(config,codeckey,"enabled",1); - pt=find_payload(&av_profile,mime,rate,fmtp); + pt=find_payload(&av_profile,mime,rate,channels,fmtp); if (pt && enabled ) pt->flags|=PAYLOAD_TYPE_ENABLED; //ms_message("Found codec %s/%i",pt->mime_type,pt->clock_rate); if (pt==NULL) ms_warning("Ignoring codec config %s/%i with fmtp=%s because unsupported", @@ -4559,6 +4561,7 @@ void _linphone_core_codec_config_write(LinphoneCore *lc){ sprintf(key,"audio_codec_%i",index); lp_config_set_string(lc->config,key,"mime",pt->mime_type); lp_config_set_int(lc->config,key,"rate",pt->clock_rate); + lp_config_set_int(lc->config,key,"channels",pt->channels); lp_config_set_int(lc->config,key,"enabled",linphone_core_payload_type_enabled(lc,pt)); index++; } From b064c7a0653fd4945d213bc8f8dabf36b5547f58 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 27 Aug 2012 17:11:51 +0200 Subject: [PATCH 471/769] Fix incorrect maximum number of payload types. --- coreapi/linphonecore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 18bc4be19..086e8c778 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -651,7 +651,7 @@ static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int c PayloadType *candidate=NULL; int i; PayloadType *it; - for(i=0;i<127;++i){ + for(i=0;imime_type)==0 && (clock_rate==it->clock_rate || clock_rate<=0) @@ -734,7 +734,7 @@ static int codec_compare(const PayloadType *a, const PayloadType *b){ static MSList *add_missing_codecs(SalStreamType mtype, MSList *l){ int i; - for(i=0;i<127;++i){ + for(i=0;itype!=PAYLOAD_VIDEO) @@ -1014,7 +1014,7 @@ static void linphone_core_assign_payload_type(LinphoneCore *lc, PayloadType *con /*look for a free number */ MSList *elem; int i; - for(i=lc->dyn_pt;i<=127;++i){ + for(i=lc->dyn_pt;ipayload_types;elem!=NULL;elem=elem->next){ PayloadType *it=(PayloadType*)elem->data; @@ -1043,7 +1043,7 @@ static void linphone_core_assign_payload_type(LinphoneCore *lc, PayloadType *con static void linphone_core_handle_static_payloads(LinphoneCore *lc){ RtpProfile *prof=&av_profile; int i; - for(i=0;i<128;++i){ + for(i=0;i Date: Tue, 28 Aug 2012 09:03:38 +0200 Subject: [PATCH 472/769] Change API of linphone_core_find_payload_type() to take the number of channels into account. --- coreapi/linphonecore.c | 12 +++++++----- coreapi/linphonecore.h | 2 +- coreapi/linphonecore_jni.cc | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 086e8c778..76b823d0f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4806,11 +4806,13 @@ const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc){ return lc->sound_conf.ringback_tone; } -static PayloadType* find_payload_type_from_list(const char* type, int rate,const MSList* from) { +static PayloadType* find_payload_type_from_list(const char* type, int rate, int channels, const MSList* from) { const MSList *elem; for(elem=from;elem!=NULL;elem=elem->next){ PayloadType *pt=(PayloadType*)elem->data; - if ((strcasecmp((char*)type, payload_type_get_mime(pt)) == 0) && (rate == -1 || rate==pt->clock_rate)) { + if ((strcasecmp((char*)type, payload_type_get_mime(pt)) == 0) + && (rate == -1 || rate==pt->clock_rate) + && (channels == 0 || channels==pt->channels)) { return pt; } } @@ -4823,12 +4825,12 @@ static PayloadType* find_payload_type_from_list(const char* type, int rate,const * This function searches in audio and video codecs for the given payload type name and clockrate. * Returns NULL if not found. */ -PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate) { - PayloadType* result = find_payload_type_from_list(type, rate, linphone_core_get_audio_codecs(lc)); +PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) { + PayloadType* result = find_payload_type_from_list(type, rate, channels, linphone_core_get_audio_codecs(lc)); if (result) { return result; } else { - result = find_payload_type_from_list(type, rate, linphone_core_get_video_codecs(lc)); + result = find_payload_type_from_list(type, rate, 0, linphone_core_get_video_codecs(lc)); if (result) { return result; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 98bb03d46..72477c903 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -869,7 +869,7 @@ bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *p int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable); -PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate) ; +PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) ; int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index bf1a30bcd..194626111 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -684,9 +684,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv* ,jobject thiz ,jlong lc ,jstring jmime - ,jint rate) { + ,jint rate + ,jint channels) { const char* mime = env->GetStringUTFChars(jmime, NULL); - jlong result = (jlong)linphone_core_find_payload_type((LinphoneCore*)lc,mime,rate); + jlong result = (jlong)linphone_core_find_payload_type((LinphoneCore*)lc,mime,rate,channels); env->ReleaseStringUTFChars(jmime, mime); return result; } From 976711219328335b36d21c3f3d233a8efce170e6 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 28 Aug 2012 09:51:26 +0200 Subject: [PATCH 473/769] Change API of findPayloadType() to take the number of channels into account. --- java/common/org/linphone/core/LinphoneCore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 6266f6646..dbe5611db 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -495,7 +495,7 @@ public interface LinphoneCore { * * return null if not found */ - PayloadType findPayloadType(String mime,int clockRate); + PayloadType findPayloadType(String mime, int clockRate, int channels); /** * not implemented yet * @param pt From c35f464e91a96a2f6dfcc0f23da44bd645daed07 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 28 Aug 2012 09:53:42 +0200 Subject: [PATCH 474/769] findPayloadType() now needs the number of channels in its parameters. --- LinphoneCoreImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index e4f8dd062..80dcaa48e 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -56,7 +56,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void sendDtmf(long nativePtr,char dtmf); private native void clearCallLogs(long nativePtr); private native boolean isMicMuted(long nativePtr); - private native long findPayloadType(long nativePtr, String mime, int clockRate); + private native long findPayloadType(long nativePtr, String mime, int clockRate, int channels); private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr); @@ -255,9 +255,9 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean isMicMuted() { return isMicMuted(nativePtr); } - public synchronized PayloadType findPayloadType(String mime, int clockRate) { + public synchronized PayloadType findPayloadType(String mime, int clockRate, int channels) { isValid(); - long playLoadType = findPayloadType(nativePtr, mime, clockRate); + long playLoadType = findPayloadType(nativePtr, mime, clockRate, channels); if (playLoadType == 0) { return null; } else { From bd6a9737485893b0bc08ffe75dfea6f71115b73c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 28 Aug 2012 15:37:48 +0200 Subject: [PATCH 475/769] use exosip_reset_transport when possible --- coreapi/linphonecore.c | 5 +---- coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 37 +++++++++++++++++++++++++++---------- m4/exosip.m4 | 4 ++++ 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 76b823d0f..de91532c9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4678,11 +4678,8 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t cu lc->netup_time=curtime; lc->network_reachable=isReachable; if(!isReachable) { - sal_unlisten_ports (lc->sal); - } else { - apply_transports(lc); + sal_reset_transports(lc->sal); } - } void linphone_core_refresh_registers(LinphoneCore* lc) { diff --git a/coreapi/sal.h b/coreapi/sal.h index 0d2b631d8..616b0aba9 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -321,6 +321,7 @@ void sal_auth_info_delete(const SalAuthInfo* auth_info); void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs); int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure); int sal_unlisten_ports(Sal *ctx); +int sal_reset_transports(Sal *ctx); ortp_socket_t sal_get_socket(Sal *ctx); void sal_set_user_agent(Sal *ctx, const char *user_agent); /*keepalive period in ms*/ diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 76d7973d9..aa9116aa5 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -353,6 +353,32 @@ int sal_unlisten_ports(Sal *ctx){ return 0; } +int sal_reset_transports(Sal *ctx){ +#ifdef HAVE_EXOSIP_RESET_TRANSPORTS + if (ctx->running){ + ms_message("Exosip transports reset."); + eXosip_reset_transports(); + } + return 0; +#else + ms_warning("sal_reset_transports() not implemented in this version."); + return -1; +#endif +} + + +static void set_tls_options(Sal *ctx){ + if (ctx->rootCa) { + eXosip_tls_ctx_t tlsCtx; + memset(&tlsCtx, 0, sizeof(tlsCtx)); + snprintf(tlsCtx.root_ca_cert, sizeof(tlsCtx.client.cert), "%s", ctx->rootCa); + eXosip_set_tls_ctx(&tlsCtx); + } +#ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE + eXosip_tls_verify_certificate(ctx->verify_server_certs); +#endif +} + int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure){ int err; bool_t ipv6; @@ -369,16 +395,7 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i proto= IPPROTO_TCP; keepalive=-1; eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE,&keepalive); - - if (ctx->rootCa) { - eXosip_tls_ctx_t tlsCtx; - memset(&tlsCtx, 0, sizeof(tlsCtx)); - snprintf(tlsCtx.root_ca_cert, sizeof(tlsCtx.client.cert), "%s", ctx->rootCa); - eXosip_set_tls_ctx(&tlsCtx); - } -#ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE - eXosip_tls_verify_certificate(ctx->verify_server_certs); -#endif + set_tls_options(ctx); break; default: ms_warning("unexpected proto, using datagram"); diff --git a/m4/exosip.m4 b/m4/exosip.m4 index 51419d48a..129b28570 100644 --- a/m4/exosip.m4 +++ b/m4/exosip.m4 @@ -50,6 +50,10 @@ AC_CHECK_LIB([eXosip2],[eXosip_trylock], [AC_DEFINE([HAVE_EXOSIP_TRYLOCK],[1],[Defined when eXosip_get_socket is available])], [], [-losipparser2 -losip2 ]) +AC_CHECK_LIB([eXosip2],[eXosip_reset_transports], + [AC_DEFINE([HAVE_EXOSIP_RESET_TRANSPORTS],[1],[Defined when eXosip_reset_transports is available])], + [], + [-losipparser2 -losip2 ]) dnl AC_CHECK_LIB([eXosip2],[eXosip_get_naptr], dnl [AC_DEFINE([HAVE_EXOSIP_NAPTR_SUPPORT],[1],[Defined when eXosip_get_naptr is available])], dnl [], From f28e7960a1076646013a3e5ba82a2f078f5fc9c4 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 29 Aug 2012 18:16:26 +0200 Subject: [PATCH 476/769] add sip message delivery notification --- coreapi/chat.c | 51 ++++++++++++++++++++++++++++++++--- coreapi/linphonecall.c | 3 +++ coreapi/linphonecore.h | 61 +++++++++++++++++++++++++++++++++++++++++- coreapi/private.h | 15 +++++++++++ coreapi/sal_eXosip2.c | 13 ++++++++- 5 files changed, 138 insertions(+), 5 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 9847c2c3b..3d336dbcd 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -48,8 +48,9 @@ if (cr->op) sal_op_release(cr->op); } - -void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg){ + + +static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage* msg){ const char *route=NULL; const char *identity=linphone_core_find_best_identity(cr->lc,cr->peer_url,&route); SalOp *op=NULL; @@ -62,6 +63,7 @@ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg){ call->state==LinphoneCallPausedByRemote){ ms_message("send SIP message through the existing call."); op = call->op; + call->pending_message=msg; } } if (op==NULL){ @@ -73,10 +75,14 @@ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg){ cr->op=NULL; } cr->op=op; + sal_op_set_user_pointer(op, msg); /*if out of call, directly store msg*/ } - sal_text_send(op,identity,cr->peer,msg); + sal_text_send(op,identity,cr->peer,msg->message); } +void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg) { + _linphone_chat_room_send_message(cr,linphone_chat_room_create_message(cr,msg)); +} bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, const LinphoneAddress *from){ if (linphone_address_get_username(cr->peer_url) && linphone_address_get_username(from) && strcmp(linphone_address_get_username(cr->peer_url),linphone_address_get_username(from))==0) return TRUE; @@ -123,3 +129,42 @@ void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr){ const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) { return cr->peer_url; } + +LinphoneChatMessage* linphone_chat_room_create_message(const LinphoneChatRoom *cr,const char* message) { + LinphoneChatMessage* msg = ms_new0(LinphoneChatMessage,1); + msg->chat_room=(LinphoneChatRoom*)cr; + msg->message=ms_strdup(message); + return msg; +} +void linphone_chat_message_destroy(LinphoneChatMessage* msg) { + if (msg->message) ms_free((void*)msg->message); + ms_free((void*)msg); +} +void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangeCb status_cb,void* ud) { + msg->cb=status_cb; + msg->cb_ud=ud; + _linphone_chat_room_send_message(cr, msg); +} + +const char* linphone_chat_message_state_to_string(const LinphoneChatMessageState state) { + switch (state) { + case LinphoneChatMessageStateIdle:return "LinphoneChatMessageStateIdle"; + case LinphoneChatMessageStateInProgress:return "LinphoneChatMessageStateInProgress"; + case LinphoneChatMessageStateDelivered:return "LinphoneChatMessageStateDelivered"; + case LinphoneChatMessageStateNotDelivered:return "LinphoneChatMessageStateNotDelivered"; + default: return "Unknown state"; + } + +} +/** + * user pointer set function + */ +void linphone_chat_message_set_user_data(LinphoneChatMessage* message,void* ud) { + message->message_userdata=ud; +} +/** + * user pointer get function + */ +void* linphone_chat_message_get_user_data(const LinphoneChatMessage* message) { + return message->message_userdata; +} \ No newline at end of file diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f1823165f..68e5936ed 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1915,3 +1915,6 @@ void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState stat } } +bool_t linphone_call_is_in_conference(const LinphoneCall *call) { + return call->params.in_conference; +} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 72477c903..4d5f5fd55 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -360,7 +360,14 @@ void *linphone_call_get_user_pointer(LinphoneCall *call); void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer); void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data); LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call); - +/** + * Return TRUE if this call is currently part of a conference + *@param call #LinphoneCall + *@return TRUE if part of a conference. + * + @ingroup call_control + */ +bool_t linphone_call_is_in_conference(const LinphoneCall *call); /** * Enables or disable echo cancellation for this call * @param call @@ -579,11 +586,19 @@ struct _LinphoneChatRoom; * @addtogroup chatroom * @{ */ + +/** + * A chat room message to old content to be sent. + *
Can be created by linphone_chat_room_create_message(). + */ +typedef struct _LinphoneChatMessage LinphoneChatMessage; + /** * A chat room is the place where text messages are exchanged. *
Can be created by linphone_core_create_chat_room(). */ typedef struct _LinphoneChatRoom LinphoneChatRoom; + /** * Create a new chat room for messaging from a sip uri like sip:joe@sip.linphone.org * @param lc #LinphoneCore object @@ -597,6 +612,12 @@ LinphoneChatRoom * linphone_core_create_chat_room(LinphoneCore *lc, const char * */ void linphone_chat_room_destroy(LinphoneChatRoom *cr); +/** + * create a message attached to a dedicated chat room; + */ +LinphoneChatMessage* linphone_chat_room_create_message(const LinphoneChatRoom *cr,const char* message); + + /** * get peer address \link linphone_core_create_chat_room() associated to \endlink this #LinphoneChatRoom @@ -610,6 +631,44 @@ const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) * @param msg message to be sent */ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg); +/** + *LinphoneChatMessageStatus used to notify if message has been succesfully delivered or not + */ +typedef enum _LinphoneChatMessageStates { + LinphoneChatMessageStateIdle, /** initial state*/ + LinphoneChatMessageStateInProgress, /*delivery in progress**/ + LinphoneChatMessageStateDelivered, /** message succesffully delivered an acknoleged by remote end point*/ + LinphoneChatMessageStateNotDelivered /** message was not delivered*/ +}LinphoneChatMessageState; + +/** + * to string function + */ +const char* linphone_chat_message_state_to_string(const LinphoneChatMessageState state); +/** + * user pointer set function + */ +void linphone_chat_message_set_user_data(LinphoneChatMessage* message,void*); +/** + * user pointer get function + */ +void* linphone_chat_message_get_user_data(const LinphoneChatMessage* message); + +/** + * Call back used to notify message delivery status + *@param msg #LinphoneChatMessage object + *@param status #LinphoneChatMessageStatus + *@param ud us user data + */ +typedef void (*LinphoneChatMessageStateChangeCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud); +/** + * send a message to peer member of this chat room. + * @param cr #LinphoneChatRoom object + * @param msg #LinphoneChatMessage message to be sent + * @param status_cb #LinphoneChatMessageStatus status call back invoked when to message is delivered or not. May be NULL + * @param ud user data for the status cb. + */ +void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangeCb status_cb,void* ud); void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud); void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr); diff --git a/coreapi/private.h b/coreapi/private.h index d1c15e41c..6c9ba8d29 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -86,6 +86,14 @@ typedef struct _CallCallbackObj static const int linphone_call_magic=0x3343; +struct _LinphoneChatMessage { + const char* message; + LinphoneChatRoom* chat_room; + LinphoneChatMessageStateChangeCb cb; + void* cb_ud; + void* message_userdata; +}; + struct _LinphoneCall { int magic; /*used to distinguish from proxy config*/ @@ -138,6 +146,7 @@ struct _LinphoneCall CallCallbackObj nextVideoFrameDecoded; LinphoneCallStats stats[2]; IceSession *ice_session; + LinphoneChatMessage* pending_message; }; @@ -277,6 +286,10 @@ LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer); static const int linphone_proxy_config_magic=0x7979; +/*chat*/ +void linphone_chat_message_destroy(LinphoneChatMessage* msg); +/**/ + struct _LinphoneProxyConfig { int magic; @@ -324,6 +337,8 @@ struct _LinphoneChatRoom{ void * user_data; }; + + struct _LinphoneFriend{ LinphoneAddress *uri; SalOp *insub; diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index aa9116aa5..b98a94640 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1952,7 +1952,8 @@ static bool_t registration_failure(Sal *sal, eXosip_event_t *ev){ static void other_request_reply(Sal *sal,eXosip_event_t *ev){ SalOp *op=find_op(sal,ev); - + LinphoneChatMessage* chat_msg; + ms_message("Processing reponse status [%i] for method [%s]",ev->response->status_code,osip_message_get_method(ev->request)); if (op==NULL){ ms_warning("other_request_reply(): Receiving response to unknown request."); return; @@ -1961,6 +1962,16 @@ static void other_request_reply(Sal *sal,eXosip_event_t *ev){ update_contact_from_response(op,ev->response); if (ev->request && strcmp(osip_message_get_method(ev->request),"OPTIONS")==0) sal->callbacks.ping_reply(op); + else if (ev->request && strcmp(osip_message_get_method(ev->request),"MESSAGE")==0) { + /*out of call message acknolegment*/ + chat_msg=(LinphoneChatMessage* )op->base.user_pointer; + if (chat_msg->cb) { + chat_msg->cb(chat_msg + ,(ev->response->status_code==200?LinphoneChatMessageStateDelivered:LinphoneChatMessageStateNotDelivered) + ,chat_msg->cb_ud); + } + linphone_chat_message_destroy(chat_msg); + } } } From 5139b557f8c922f16b4b2808d62cf63bdc293274 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 29 Aug 2012 19:21:31 +0200 Subject: [PATCH 477/769] set tls option immediate effect --- coreapi/sal_eXosip2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index aa9116aa5..fdaa639b2 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -462,6 +462,7 @@ void sal_set_root_ca(Sal* ctx, const char* rootCa) { if (ctx->rootCa) ms_free(ctx->rootCa); ctx->rootCa = ms_strdup(rootCa); + set_tls_options(ctx); } void sal_verify_server_certificates(Sal *ctx, bool_t verify){ From e1f018f274274d7574ebadd27659098453d8d1b5 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 30 Aug 2012 12:43:09 +0200 Subject: [PATCH 478/769] fix linphone_core_find_payload_type wildcard mode --- coreapi/linphonecore.c | 11 +++-------- coreapi/linphonecore.h | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index de91532c9..47f8a61ae 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4808,20 +4808,15 @@ static PayloadType* find_payload_type_from_list(const char* type, int rate, int for(elem=from;elem!=NULL;elem=elem->next){ PayloadType *pt=(PayloadType*)elem->data; if ((strcasecmp((char*)type, payload_type_get_mime(pt)) == 0) - && (rate == -1 || rate==pt->clock_rate) - && (channels == 0 || channels==pt->channels)) { + && (rate == LINPHONE_FIND_PAYLOAD_IGNORE_RATE || rate==pt->clock_rate) + && (channels == LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS || channels==pt->channels)) { return pt; } } return NULL; } -/** - * Get payload type from mime type and clock rate - * @ingroup media_parameters - * This function searches in audio and video codecs for the given payload type name and clockrate. - * Returns NULL if not found. - */ + PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) { PayloadType* result = find_payload_type_from_list(type, rate, channels, linphone_core_get_audio_codecs(lc)); if (result) { diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 4d5f5fd55..4895ccb93 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -928,6 +928,26 @@ bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *p int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable); +/** + * Wildcard value used by #linphone_core_find_payload_type to ignore rate in search algirithm + * @ingroup media_parameters + */ +#define LINPHONE_FIND_PAYLOAD_IGNORE_RATE -1 +/** + * Wildcard value used by #linphone_core_find_payload_type to ignore channel in search algirithm + * @ingroup media_parameters + */ +#define LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS -1 +/** + * Get payload type from mime type and clock rate + * @ingroup media_parameters + * This function searches in audio and video codecs for the given payload type name and clockrate. + * @param lc #LinphoneCore object + * @param type payload mime type (I.E SPEEX, PCMU, VP8) + * @param rate, can be #LINPHONE_FIND_PAYLOAD_IGNORE_RATE + * @param channels, number of channels, can be #LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS + * @return Returns NULL if not found. + */ PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) ; int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt); From 708b3866b139e64d7c1cd0e7b1c8b35360dc6ace Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 30 Aug 2012 15:29:26 +0200 Subject: [PATCH 479/769] Update oRTP and ms2 submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index d622cd514..1a267bd2f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d622cd51499ad0745e519eb129ea133fa8fd168b +Subproject commit 1a267bd2fb946b51b877a8cbc78f3445c11ab361 diff --git a/oRTP b/oRTP index cba069472..716ac0178 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit cba069472f6a464c0d7372cd97be0215cf165995 +Subproject commit 716ac0178612a7416c828fd74261e4dda44930de From 4e847d24ca5c3a5012cb62beee4248667428b24c Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 30 Aug 2012 16:27:16 +0200 Subject: [PATCH 480/769] add function LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc) to create proxy config with default values from section [default_values] --- coreapi/linphonecore.h | 8 ++++++++ coreapi/proxy.c | 29 +++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 4895ccb93..2972bc090 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -956,6 +956,14 @@ const char *linphone_core_get_payload_type_description(LinphoneCore *lc, Payload bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt); +/** + * @ingroup proxy + *Create a proxy config with default value from Linphone core. + *@param lc #LinphoneCore object + *@return #LinphoneProxyConfig with defualt value set + */ +LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc); + int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config); void linphone_core_clear_proxy_config(LinphoneCore *lc); diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 8e066ea33..11a55f59b 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -42,10 +42,17 @@ void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){ lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL)); } -void linphone_proxy_config_init(LinphoneProxyConfig *obj){ +#define DEFAULT_INT(config,name,default) \ + config?lp_config_get_int(config,"default_values",#name,default):default +#define DEFAULT_STRING(config,name,default) \ + config?lp_config_get_string(config,"default_values",#name,default):default + +static void linphone_proxy_config_init(LinphoneCore* lc,LinphoneProxyConfig *obj){ memset(obj,0,sizeof(LinphoneProxyConfig)); obj->magic=linphone_proxy_config_magic; - obj->expires=3600; + obj->expires=DEFAULT_INT((lc?lc->config:NULL),reg_expires,3600); + obj->dial_prefix=ms_strdup(DEFAULT_STRING((lc?lc->config:NULL),dial_prefix,'\0')); + obj->dial_escape_plus=DEFAULT_INT((lc?lc->config:NULL),dial_escape_plus,0); } /** @@ -54,15 +61,21 @@ void linphone_proxy_config_init(LinphoneProxyConfig *obj){ **/ /** - * Creates an empty proxy config. + * @deprecated, use #linphone_core_create_proxy_config instead + *Creates an empty proxy config. **/ -LinphoneProxyConfig *linphone_proxy_config_new(){ +LinphoneProxyConfig *linphone_proxy_config_new() { + return linphone_core_create_proxy_config(NULL); +} +LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc) { LinphoneProxyConfig *obj=NULL; obj=ms_new(LinphoneProxyConfig,1); - linphone_proxy_config_init(obj); + linphone_proxy_config_init(lc,obj); return obj; } + + /** * Destroys a proxy config. * @@ -701,13 +714,13 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config tmp=lp_config_get_string(config,key,"reg_route",NULL); if (tmp!=NULL) linphone_proxy_config_set_route(cfg,tmp); - linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",600)); + linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",DEFAULT_INT(config,reg_expires,600))); linphone_proxy_config_enableregister(cfg,lp_config_get_int(config,key,"reg_sendregister",0)); linphone_proxy_config_enable_publish(cfg,lp_config_get_int(config,key,"publish",0)); - linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",0)); - linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",NULL)); + linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",DEFAULT_INT(config,dial_escape_plus,0))); + linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",DEFAULT_STRING(config,dial_prefix,NULL))); tmp=lp_config_get_string(config,key,"type",NULL); if (tmp!=NULL && strlen(tmp)>0) From 335129ed8ad1abb545d9e1cae809eaed1b5608dc Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 31 Aug 2012 10:04:57 +0200 Subject: [PATCH 481/769] add dscp settings --- coreapi/linphonecall.c | 7 +++++++ mediastreamer2 | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 68e5936ed..929814b52 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -938,8 +938,11 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; AudioStream *audiostream; + int dscp=lp_config_get_int(lc->config,"rtp","audio_dscp",-1); call->audiostream=audiostream=audio_stream_new(md->streams[0].rtp_port,md->streams[0].rtcp_port,linphone_core_ipv6_enabled(lc)); + if (dscp!=-1) + audio_stream_set_dscp(audiostream,dscp); if (linphone_core_echo_limiter_enabled(lc)){ const char *type=lp_config_get_string(lc->config,"sound","el_type","mic"); if (strcasecmp(type,"mic")==0) @@ -990,7 +993,11 @@ void linphone_call_init_video_stream(LinphoneCall *call){ if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].rtp_port>0){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); + int dscp=lp_config_get_int(lc->config,"rtp","video_dscp",-1); + call->videostream=video_stream_new(md->streams[1].rtp_port,md->streams[1].rtcp_port,linphone_core_ipv6_enabled(lc)); + if (dscp!=-1) + video_stream_set_dscp(call->videostream,dscp); video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0)); if (video_recv_buf_size>0) rtp_session_set_recv_buf_size(call->videostream->session,video_recv_buf_size); diff --git a/mediastreamer2 b/mediastreamer2 index 1a267bd2f..06b53e9d7 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1a267bd2fb946b51b877a8cbc78f3445c11ab361 +Subproject commit 06b53e9d743ce42d9cf1d343514889a6a44a1ef5 From 5129e306ab832326e887431c38fc22ebaf6b7433 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 30 Aug 2012 15:26:28 +0200 Subject: [PATCH 482/769] Handle IPv6 addresses in parse_hostname_to_addr(). This is needed to correctly handle and IPv6 address set as gateway when using the nat firewall policy. --- coreapi/misc.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index bf5c53dcc..a22bbc1d9 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -408,19 +408,29 @@ static int sendStunRequest(int sock, const struct sockaddr *server, socklen_t ad int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen){ struct addrinfo hints,*res=NULL; + int family = PF_INET; + int port_int = 3478; int ret; - const char *port; + char port[6]; char host[NI_MAXHOST]; - char *p; - host[NI_MAXHOST-1]='\0'; - strncpy(host,server,sizeof(host)-1); - p=strchr(host,':'); - if (p) { - *p='\0'; - port=p+1; - }else port="3478"; + char *p1, *p2; + if ((sscanf(server, "[%64[^]]]:%d", host, &port_int) == 2) || (sscanf(server, "[%64[^]]]", host) == 1)) { + family = PF_INET6; + } else { + p1 = strchr(server, ':'); + p2 = strrchr(server, ':'); + if (p1 && p2 && (p1 != p2)) { + family = PF_INET6; + host[NI_MAXHOST-1]='\0'; + strncpy(host, server, sizeof(host) - 1); + } else if (sscanf(server, "%[^:]:%d", host, &port_int) != 2) { + host[NI_MAXHOST-1]='\0'; + strncpy(host, server, sizeof(host) - 1); + } + } + snprintf(port, sizeof(port), "%d", port_int); memset(&hints,0,sizeof(hints)); - hints.ai_family=PF_INET; + hints.ai_family=family; hints.ai_socktype=SOCK_DGRAM; hints.ai_protocol=IPPROTO_UDP; ret=getaddrinfo(host,port,&hints,&res); From 86d32db4d17cc50bb5005d2700ddd358810ce3ea Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 31 Aug 2012 11:32:50 +0200 Subject: [PATCH 483/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 06b53e9d7..beb4318d1 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 06b53e9d743ce42d9cf1d343514889a6a44a1ef5 +Subproject commit beb4318d1e5eb282adc82967a9c80e89cd406045 From 487b375da9f077cc68759c3b6b4d849ddccb903e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 31 Aug 2012 11:58:44 +0200 Subject: [PATCH 484/769] rework linphone_proxy_config_normalize_number() to work with different dialplans --- coreapi/Makefile.am | 6 ++- coreapi/proxy.c | 110 +++++++++++++++++++++++++++++------------ coreapi/test_numbers.c | 40 +++++++++++++++ 3 files changed, 124 insertions(+), 32 deletions(-) create mode 100644 coreapi/test_numbers.c diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 7a6040d1a..c706751ac 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -63,7 +63,7 @@ liblinphone_la_LIBADD= \ $(LIBSOUP_LIBS) if BUILD_TESTS -noinst_PROGRAMS=test_lsd test_ecc +noinst_PROGRAMS=test_lsd test_ecc test_numbers test_lsd_SOURCES=test_lsd.c @@ -72,6 +72,10 @@ test_lsd_LDADD=liblinphone.la $(liblinphone_la_LIBADD) test_ecc_SOURCES=test_ecc.c test_ecc_LDADD=liblinphone.la $(liblinphone_la_LIBADD) + +test_numbers_SOURCES=test_numbers.c + +test_numbers_LDADD=liblinphone.la $(liblinphone_la_LIBADD) endif diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 11a55f59b..bb01f14ee 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -24,7 +24,6 @@ Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org) #include "private.h" #include "mediastreamer2/mediastream.h" - #include @@ -332,7 +331,8 @@ void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj){ /** * Sets a dialing prefix to be automatically prepended when inviting a number with - * #linphone_core_invite. + * linphone_core_invite(); + * This dialing prefix shall usually be the country code of the country where the user is living. * **/ void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix){ @@ -353,7 +353,7 @@ const char *linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg } /** - * Sets whether liblinphone should replace "+" by "00" in dialed numbers (passed to + * Sets whether liblinphone should replace "+" by international calling prefix in dialed numbers (passed to * #linphone_core_invite ). * **/ @@ -369,13 +369,47 @@ void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg){ return cfg->dial_escape_plus; } +/* + * http://en.wikipedia.org/wiki/Telephone_numbering_plan + * http://en.wikipedia.org/wiki/Telephone_numbers_in_Europe + */ +typedef struct dial_plan{ + const char *country; + char ccc[8]; /*country calling code*/ + int nnl; /*maximum national number length*/ + const char * icp; /*international call prefix, ex: 00 in europe*/ +}dial_plan_t; +/* TODO: fill with information for all countries over the world*/ +static dial_plan_t const dial_plans[]={ + {"France" , "33" , 9 , "00" }, + {"United States", "1" , 10 , "011" }, + {"Turkey" , "90" , 10 , "00" }, + {"Switzerland" , "41" , 9 , "00" }, + {NULL , "" , 0 , NULL } +}; + +static dial_plan_t most_common_dialplan={ "generic" , "", 10, "00"}; + +static void lookup_dial_plan(const char *ccc, dial_plan_t *plan){ + int i; + for(i=0;dial_plans[i].country!=NULL;++i){ + if (strcmp(ccc,dial_plans[i].ccc)==0){ + *plan=dial_plans[i]; + return; + } + } + /*else return a generic "most common" dial plan*/ + *plan=most_common_dialplan; + strcpy(plan->ccc,ccc); +} static bool_t is_a_phone_number(const char *username){ const char *p; for(p=username;*p!='\0';++p){ if (isdigit(*p) || *p==' ' || + *p=='.' || *p=='-' || *p==')' || *p=='(' || @@ -399,14 +433,12 @@ static char *flatten_number(const char *number){ return result; } -static void copy_result(const char *src, char *dest, size_t destlen, bool_t escape_plus){ +static void replace_plus(const char *src, char *dest, size_t destlen, const char *icp){ int i=0; - if (escape_plus && src[0]=='+' && destlen>2){ - dest[0]='0'; - dest[1]='0'; + if (icp && src[0]=='+' && (destlen>(i=strlen(icp))) ){ src++; - i=2; + strcpy(dest,icp); } for(;(i10 || flatten[0]=='+' || proxy->dial_prefix==NULL || proxy->dial_prefix[0]=='\0'){ - ms_message("No need to add a prefix"); - /* prefix is already there */ - copy_result(flatten,result,result_len,proxy->dial_escape_plus); + + if (proxy->dial_prefix==NULL || proxy->dial_prefix[0]=='\0'){ + /*no prefix configured, nothing else to do*/ + strncpy(result,flatten,result_len); ms_free(flatten); return 0; - }else if (proxy->dial_prefix && proxy->dial_prefix[0]!='\0'){ - char *prefixed; - int skipped=0; - ms_message("Need to prefix with %s",proxy->dial_prefix); - if (numlen==10){ - /*remove initial number before prepending prefix*/ - skipped=1; + }else{ + dial_plan_t dialplan; + lookup_dial_plan(proxy->dial_prefix,&dialplan); + ms_message("Using dialplan '%s'",dialplan.country); + if (flatten[0]=='+' || strstr(flatten,dialplan.icp)==flatten){ + /* the number has international prefix or +, so nothing to do*/ + ms_message("Prefix already present."); + /*eventually replace the plus*/ + replace_plus(flatten,result,result_len,proxy->dial_escape_plus ? dialplan.icp : NULL); + ms_free(flatten); + return 0; + }else{ + int i=0; + int skip; + numlen=strlen(flatten); + /*keep at most national number significant digits */ + skip=numlen-dialplan.nnl; + if (skip<0) skip=0; + /*first prepend internation calling prefix or +*/ + if (proxy->dial_escape_plus){ + strncpy(result,dialplan.icp,result_len); + i+=strlen(dialplan.icp); + }else{ + strncpy(result,"+",result_len); + i+=1; + } + /*add prefix*/ + if (result_len-i>strlen(dialplan.ccc)){ + strcpy(result+i,dialplan.ccc); + i+=strlen(dialplan.ccc); + } + /*add user digits */ + strncpy(result+i,flatten+skip,result_len-i-1); + ms_free(flatten); } - prefixed=append_prefix(flatten+skipped,proxy->dial_prefix); - ms_free(flatten); - copy_result(prefixed,result,result_len,proxy->dial_escape_plus); - ms_free(prefixed); } }else strncpy(result,username,result_len); return 0; diff --git a/coreapi/test_numbers.c b/coreapi/test_numbers.c new file mode 100644 index 000000000..8cf4fb792 --- /dev/null +++ b/coreapi/test_numbers.c @@ -0,0 +1,40 @@ +/* +linphone +Copyright (C) 2012 Belledonne Communications SARL +Author: Simon MORLAT (simon.morlat@linphone.org) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +#include "linphonecore.h" + +int main(int argc , char *argv[]){ + LinphoneProxyConfig *cfg; + char normalized_number[32]; + if (argc<2){ + fprintf(stderr,"Usage:\n%s [] [--escape-plus]\nReturns normalized number.", argv[0]); + return -1; + } + linphone_core_enable_logs(stderr); + cfg=linphone_proxy_config_new(); + if (argc>2) + linphone_proxy_config_set_dial_prefix(cfg,argv[2]); + if (argc>3 && strcmp(argv[3],"--escape-plus")==0) + linphone_proxy_config_set_dial_escape_plus(cfg,TRUE); + linphone_proxy_config_normalize_number(cfg,argv[1],normalized_number,sizeof(normalized_number)); + printf("Normalized number is %s\n",normalized_number); + return 0; +} From feebeb262ec6908cf053c2850143ab45e71e77b9 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 31 Aug 2012 16:15:52 +0200 Subject: [PATCH 485/769] Fix domain in SIP REGISTER message when using IPv6 address for SIP registrar. --- coreapi/sal_eXosip2.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 076839a10..10d0459b4 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -2179,11 +2179,21 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){ if (h->rid==-1){ SalAddress *from_parsed=sal_address_new(from); char domain[256]; + char *uri, *domain_ptr = NULL; if (from_parsed==NULL) { ms_warning("sal_register() bad from %s",from); return -1; } - snprintf(domain,sizeof(domain),"sip:%s",sal_address_get_domain(from_parsed)); + /* Get domain using sal_address_as_string_uri_only() and stripping the username part instead of + using sal_address_get_domain() because to have a properly formatted domain with IPv6 proxy addresses. */ + uri = sal_address_as_string_uri_only(from_parsed); + if (uri) domain_ptr = strchr(uri, '@'); + if (domain_ptr) { + snprintf(domain,sizeof(domain),"sip:%s",domain_ptr+1); + } else { + snprintf(domain,sizeof(domain),"sip:%s",sal_address_get_domain(from_parsed)); + } + if (uri) ms_free(uri); sal_address_destroy(from_parsed); eXosip_lock(); h->rid=eXosip_register_build_initial_register(from,domain,NULL,expires,&msg); From ba4ff464b3e382cfc0ac2f806f383c11752a8d8c Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 31 Aug 2012 18:17:27 +0200 Subject: [PATCH 486/769] add access to country code from iso name --- coreapi/linphonecore_utils.h | 10 +++++++++- coreapi/proxy.c | 24 ++++++++++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index bd41ec2b9..964385683 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -86,7 +86,15 @@ typedef bool_t (*LinphoneCoreIterateHook)(void *data); void linphone_core_add_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data); void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data); - +/** + * @ingroup misc + *Function to get call country code from ISO 3166-1 alpha-2 code, ex: FR returns 33 + *@param iso country code alpha2 + *@return call country code or -1 if not found + */ +int linphone_dial_plan_lookup_ccc_from_iso(const char* iso); + + #ifdef __cplusplus } #endif diff --git a/coreapi/proxy.c b/coreapi/proxy.c index bb01f14ee..47fe08bdd 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -375,21 +375,33 @@ bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg */ typedef struct dial_plan{ const char *country; + const char* iso_country_code; /* ISO 3166-1 alpha-2 code, ex: FR for France*/ char ccc[8]; /*country calling code*/ int nnl; /*maximum national number length*/ const char * icp; /*international call prefix, ex: 00 in europe*/ + }dial_plan_t; /* TODO: fill with information for all countries over the world*/ static dial_plan_t const dial_plans[]={ - {"France" , "33" , 9 , "00" }, - {"United States", "1" , 10 , "011" }, - {"Turkey" , "90" , 10 , "00" }, - {"Switzerland" , "41" , 9 , "00" }, - {NULL , "" , 0 , NULL } + {"France" ,"FR" , "33" , 9 , "00" }, + {"United States" ,"US" , "1" , 10 , "011" }, + {"Turkey" ,"TR" , "90" , 10 , "00" }, + {"Switzerland" ,"XK" , "41" , 9 , "00" }, + {NULL ,NULL,"" , 0 , NULL } }; -static dial_plan_t most_common_dialplan={ "generic" , "", 10, "00"}; +static dial_plan_t most_common_dialplan={ "generic" ,"", "", 10, "00"}; + +int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) { + dial_plan_t* dial_plan; + for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) { + if (strcmp(iso, dial_plan->iso_country_code)==0) { + return atoi(dial_plan->ccc); + } + } + return -1; +} static void lookup_dial_plan(const char *ccc, dial_plan_t *plan){ int i; From cfb3b3dfd5eed379ce773f4d3c8f415f452f23f1 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 31 Aug 2012 22:07:00 +0200 Subject: [PATCH 487/769] edge optimization in progress --- coreapi/linphonecall.c | 35 ++++++++++++++++++++++++++++++----- coreapi/misc.c | 39 ++++++++++++++++++++++++++++++++------- coreapi/private.h | 15 +++++++++------ 3 files changed, 71 insertions(+), 18 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 929814b52..9136eb1e4 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -333,9 +333,17 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){ } } +static void update_sal_media_description_from_params(SalMediaDescription *md, const LinphoneCallParams *params){ + if (params->down_bw) + md->bandwidth=params->down_bw; + if (params->down_ptime) + md->streams[0].ptime=params->down_ptime; +} + LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params) { LinphoneCall *call=ms_new0(LinphoneCall,1); + int ping_time=-1; call->dir=LinphoneCallOutgoing; call->op=sal_op_new(lc->sal); sal_op_set_user_pointer(call->op,call); @@ -350,7 +358,11 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr call->localdesc=create_local_media_description (lc,call); call->camera_active=params->has_video; if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) { - linphone_core_run_stun_tests(call->core,call); + ping_time=linphone_core_run_stun_tests(call->core,call); + } + if (ping_time>=0) { + linphone_core_adapt_to_network(lc,ping_time,&call->params); + update_sal_media_description_from_params(call->localdesc,&call->params); } discover_mtu(lc,linphone_address_get_domain (to)); if (params->referer){ @@ -363,6 +375,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){ LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; + int ping_time=-1; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -385,7 +398,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; - call->localdesc=create_local_media_description (lc,call); + call->localdesc=create_local_media_description(lc,call); call->camera_active=call->params.has_video; switch (linphone_core_get_firewall_policy(call->core)) { case LinphonePolicyUseIce: @@ -403,11 +416,15 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro } break; case LinphonePolicyUseStun: - linphone_core_run_stun_tests(call->core,call); + ping_time=linphone_core_run_stun_tests(call->core,call); /* No break to also destroy ice session in this case. */ default: break; } + if (ping_time>=0) { + linphone_core_adapt_to_network(lc,ping_time,&call->params); + update_sal_media_description_from_params(call->localdesc,&call->params); + }; discover_mtu(lc,linphone_address_get_domain(from)); return call; } @@ -1137,6 +1154,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m int remote_bw=0; LinphoneCore *lc=call->core; int up_ptime=0; + const LinphoneCallParams *params=&call->params; *used_pt=-1; for(elem=desc->payloads;elem!=NULL;elem=elem->next){ @@ -1146,7 +1164,9 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m if ((pt->flags & PAYLOAD_TYPE_FLAG_CAN_SEND) && first) { if (desc->type==SalAudio){ linphone_core_update_allocated_audio_bandwidth_in_call(call,pt); - up_ptime=linphone_core_get_upload_ptime(lc); + if (params->up_ptime) + up_ptime=params->up_ptime; + else up_ptime=linphone_core_get_upload_ptime(lc); } *used_pt=payload_type_get_number(pt); first=FALSE; @@ -1161,7 +1181,12 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m } if (desc->type==SalAudio){ - bw=get_min_bandwidth(call->audio_bw,remote_bw); + int audio_bw=call->audio_bw; + if (params->up_bw){ + if (params->up_bw< audio_bw) + audio_bw=params->up_bw; + } + bw=get_min_bandwidth(audio_bw,remote_bw); }else bw=get_min_bandwidth(get_video_bandwidth(linphone_core_get_upload_bandwidth (lc),call->audio_bw),remote_bw); if (bw>0) pt->normal_bitrate=bw*1000; else if (desc->type==SalAudio){ diff --git a/coreapi/misc.c b/coreapi/misc.c index a22bbc1d9..a696cd7f4 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -466,12 +466,13 @@ static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id return len; } -void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ +/* this functions runs a simple stun test and return the number of milliseconds to complete the tests, or -1 if the test were failed.*/ +int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ const char *server=linphone_core_get_stun_server(lc); - + if (lc->sip_conf.ipv6_enabled){ ms_warning("stun support is not implemented for ipv6"); - return; + return -1; } if (server!=NULL){ struct sockaddr_storage ss; @@ -483,29 +484,31 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ bool_t cone_audio=FALSE,cone_video=FALSE; struct timeval init,cur; SalEndpointCandidate *ac,*vc; + double elapsed; + int ret=0; ac=&call->localdesc->streams[0].candidates[0]; vc=&call->localdesc->streams[1].candidates[0]; if (parse_hostname_to_addr(server,&ss,&ss_len)<0){ ms_error("Fail to parser stun server address: %s",server); - return; + return -1; } if (lc->vtable.display_status!=NULL) lc->vtable.display_status(lc,_("Stun lookup in progress...")); /*create the two audio and video RTP sockets, and send STUN message to our stun server */ sock1=create_socket(call->audio_port); - if (sock1==-1) return; + if (sock1==-1) return -1; if (video_enabled){ sock2=create_socket(call->video_port); - if (sock2==-1) return ; + if (sock2==-1) return -1; } got_audio=FALSE; got_video=FALSE; gettimeofday(&init,NULL); do{ - double elapsed; + int id; if (loops%20==0){ ms_message("Sending stun requests..."); @@ -544,10 +547,12 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ elapsed=((cur.tv_sec-init.tv_sec)*1000.0) + ((cur.tv_usec-init.tv_usec)/1000.0); if (elapsed>2000) { ms_message("Stun responses timeout, going ahead."); + ret=-1; break; } loops++; }while(!(got_audio && (got_video||sock2==-1) ) ); + if (ret==0) ret=(int)elapsed; if (!got_audio){ ms_error("No stun server response for audio port."); }else{ @@ -570,9 +575,29 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ } close_socket(sock1); if (sock2!=-1) close_socket(sock2); + return ret; + } + return -1; + +} + +void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params){ + if (lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){ + int threshold=lp_config_get_int(lc->config,"net","edge_ping_time",500); + + if (ping_time_ms>threshold){ + int edge_ptime=lp_config_get_int(lc->config,"net","edge_ptime",100); + int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",30); + /* we are in a 2G network*/ + params->up_bw=params->down_bw=edge_bw; + params->up_ptime=params->down_ptime=edge_ptime; + + }/*else use default settings */ } } + + int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) { char local_addr[64]; diff --git a/coreapi/private.h b/coreapi/private.h index 6c9ba8d29..b1b16ed03 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -69,8 +69,12 @@ struct _LinphoneCallParams{ LinphoneCall *referer; /*in case this call creation is consecutive to an incoming transfer, this points to the original call */ int audio_bw; /* bandwidth limit for audio stream */ LinphoneMediaEncryption media_encryption; - PayloadType *audio_codec; - PayloadType *video_codec; + PayloadType *audio_codec; /*audio codec currently in use */ + PayloadType *video_codec; /*video codec currently in use */ + int down_bw; + int up_bw; + int down_ptime; + int up_ptime; bool_t has_video; bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/ bool_t in_conference; /*in conference mode */ @@ -179,10 +183,7 @@ int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, sock int set_lock_file(); int get_lock_file(); int remove_lock_file(); -int do_registration(LinphoneCore *lc, bool_t doit); -void check_for_registration(LinphoneCore *lc); void check_sound_device(LinphoneCore *lc); -void linphone_core_verify_codecs(LinphoneCore *lc); void linphone_core_get_local_ip(LinphoneCore *lc, const char *to, char *result); bool_t host_has_ipv6_network(); bool_t lp_spawn_command_line_sync(const char *command, char **result,int *command_ret); @@ -229,7 +230,8 @@ MSList *linphone_find_friend(MSList *fl, const LinphoneAddress *fri, LinphoneFri void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, const PayloadType *pt); -void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); +int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); +void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params); int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); @@ -386,6 +388,7 @@ typedef struct rtp_config /* stop rtp xmit when audio muted */ bool_t audio_adaptive_jitt_comp_enabled; bool_t video_adaptive_jitt_comp_enabled; + bool_t pad; }rtp_config_t; From b86d76b490e97a58f9385d7d2f3e97a9b8475ce8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 3 Sep 2012 13:18:40 +0200 Subject: [PATCH 488/769] Fix crash. --- coreapi/sal_eXosip2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 10d0459b4..447ce34eb 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1954,12 +1954,12 @@ static bool_t registration_failure(Sal *sal, eXosip_event_t *ev){ static void other_request_reply(Sal *sal,eXosip_event_t *ev){ SalOp *op=find_op(sal,ev); LinphoneChatMessage* chat_msg; - ms_message("Processing reponse status [%i] for method [%s]",ev->response->status_code,osip_message_get_method(ev->request)); if (op==NULL){ ms_warning("other_request_reply(): Receiving response to unknown request."); return; } if (ev->response){ + ms_message("Processing reponse status [%i] for method [%s]",ev->response->status_code,osip_message_get_method(ev->request)); update_contact_from_response(op,ev->response); if (ev->request && strcmp(osip_message_get_method(ev->request),"OPTIONS")==0) sal->callbacks.ping_reply(op); From e5fc650e90633a93243e0d0b23343ff1bcb9e2f5 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 3 Sep 2012 16:28:38 +0200 Subject: [PATCH 489/769] Opaque parameter for sent chat update. --- java/common/org/linphone/core/LinphoneChatRoom.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/common/org/linphone/core/LinphoneChatRoom.java b/java/common/org/linphone/core/LinphoneChatRoom.java index a8ef5e215..f06e8fda5 100644 --- a/java/common/org/linphone/core/LinphoneChatRoom.java +++ b/java/common/org/linphone/core/LinphoneChatRoom.java @@ -34,6 +34,6 @@ public interface LinphoneChatRoom { * send a message to peer member of this chat room. * @param message to be sent */ - void sendMessage(String message); + void sendMessage(Object opaque, String message); } From 3cbabc10695909027c774303346aebdc0edf88eb Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 19 Jul 2012 15:22:51 +0200 Subject: [PATCH 490/769] add device identifier api --- coreapi/linphonecall.c | 4 ++++ coreapi/linphonecore.c | 7 +++++++ coreapi/linphonecore.h | 18 ++++++++++++++++++ coreapi/private.h | 1 + 4 files changed, 30 insertions(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 929814b52..786744fb2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -521,7 +521,11 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const switch(call->reason){ case LinphoneReasonDeclined: call->log->status=LinphoneCallDeclined; +<<<<<<< HEAD break; +======= + break; +>>>>>>> add device identifier api case LinphoneReasonNotAnswered: call->log->status=LinphoneCallMissed; break; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 47f8a61ae..d67ba6d56 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -5104,3 +5104,10 @@ void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, }else ms_warning("Could not apply zoom: video output wasn't activated."); } +void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) { + if (lc->device_id) ms_free(lc->device_id); + lc->device_id=ms_strdup(device_id); +} +const char* linphone_core_get_device_identifier(const LinphoneCore *lc) { + return lc->device_id; +} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 2972bc090..637630997 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -827,6 +827,24 @@ LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, /* function to be periodically called in a main loop */ void linphone_core_iterate(LinphoneCore *lc); +#if 0 /*not implemented yet*/ +/** + * @ingroup initializing + * Provide Linphone Core with an unique identifier. This be later used to identified contact address coming from this device. + * Value is not saved. + * @param lc object + * @param string identifying the device, can be EMEI or UDID + * + */ +void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id); +/** + * @ingroup initializing + * get Linphone unique identifier + * + */ +const char* linphone_core_get_device_identifier(const LinphoneCore *lc); + +#endif LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url); diff --git a/coreapi/private.h b/coreapi/private.h index 6c9ba8d29..2687ddc03 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -539,6 +539,7 @@ struct _LinphoneCore int device_rotation; int max_calls; LinphoneTunnel *tunnel; + char* device_id; }; LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc); From f252a1ad202aeb04f59c0e6b679e3cdaf94a5b3c Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 3 Sep 2012 18:13:02 +0200 Subject: [PATCH 491/769] add traces for ICE troubleshooting --- coreapi/linphonecall.c | 5 +---- coreapi/linphonecore.c | 3 ++- coreapi/misc.c | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 786744fb2..679d2da10 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -521,11 +521,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const switch(call->reason){ case LinphoneReasonDeclined: call->log->status=LinphoneCallDeclined; -<<<<<<< HEAD - break; -======= break; ->>>>>>> add device identifier api case LinphoneReasonNotAnswered: call->log->status=LinphoneCallMissed; break; @@ -1747,6 +1743,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ ice_session_eliminate_redundant_candidates(call->ice_session); ice_session_choose_default_candidates(call->ice_session); } else { + ms_warning("No STUN answer from [%s], disabling ICE",linphone_core_get_stun_server(call->core)); linphone_call_delete_ice_session(call); } switch (call->state) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d67ba6d56..e4f35e387 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1903,7 +1903,8 @@ void linphone_core_iterate(LinphoneCore *lc){ if (call->state==LinphoneCallOutgoingInit && (curtime-call->start_time>=2)){ /*start the call even if the OPTIONS reply did not arrive*/ if (call->ice_session != NULL) { - /* ICE candidates gathering has not finished yet, proceed with the call without ICE anyway. */ + ms_warning("ICE candidates gathering from [%s] has not finished yet, proceed with the call without ICE anyway." + ,linphone_core_get_stun_server(lc)); linphone_call_delete_ice_session(call); linphone_call_stop_media_streams(call); } diff --git a/coreapi/misc.c b/coreapi/misc.c index a22bbc1d9..b97f265be 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -611,6 +611,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); } + ms_message("ICE: gathering candidate from [%s]",server); /* Gather local srflx candidates. */ ice_session_gather_candidates(call->ice_session, ss, ss_len); return 0; From 5792504e34bee3cfa2b643a1a2a22fa1c46f5bef Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 4 Sep 2012 10:43:59 +0200 Subject: [PATCH 492/769] add readline dependency to README --- README.macos | 1 + 1 file changed, 1 insertion(+) diff --git a/README.macos b/README.macos index 3ec0d0429..aecd2922f 100644 --- a/README.macos +++ b/README.macos @@ -16,6 +16,7 @@ You need: $ port install libeXosip2 #WARNING: currently outdated in macport $ port install ffmpeg-devel $ port install libvpx + $ port install readline - Install srtp (optional) for call encryption $ port install srtp From 9e6b47328461d2eb307023d3d3b133bc3bc0c40f Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 4 Sep 2012 16:17:47 +0200 Subject: [PATCH 493/769] implement incoming chat notification on Mac --- gtk/chat.c | 14 +++++++++++++- gtk/linphone.h | 2 ++ gtk/main.c | 5 +++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gtk/chat.c b/gtk/chat.c index 0dafbdb9c..4138f6722 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -19,6 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphone.h" + +#ifdef HAVE_GTK_OSX +#include +#endif + GtkWidget * linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const char *with){ GtkWidget *w; GtkTextBuffer *b; @@ -37,6 +42,7 @@ GtkWidget * linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const char *with){ } void linphone_gtk_create_chatroom(const char *with){ + LinphoneChatRoom *cr=linphone_core_create_chat_room(linphone_gtk_get_core(),with); if (!cr) return; linphone_gtk_init_chatroom(cr,with); @@ -101,9 +107,15 @@ void linphone_gtk_send_text(GtkWidget *button){ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){ GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(room); - if (w==NULL){ + if (w==NULL){ w=linphone_gtk_init_chatroom(room,linphone_address_as_string_uri_only(from)); } + + #ifdef HAVE_GTK_OSX + /* Notify when a new message is send */ + linphone_gtk_status_icon_set_blinking(TRUE); + #endif + linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")), linphone_address_as_string_uri_only(from), message,FALSE); diff --git a/gtk/linphone.h b/gtk/linphone.h index d4cafe28f..f817969f7 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -97,6 +97,8 @@ void * linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, c void linphone_gtk_show_directory_search(void); +void linphone_gtk_status_icon_set_blinking(gboolean val); + /*functions controlling the different views*/ gboolean linphone_gtk_use_in_call_view(); LinphoneCall *linphone_gtk_get_currently_displayed_call(gboolean *is_conf); diff --git a/gtk/main.c b/gtk/main.c index 2955b3ecc..2085e3d20 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -65,10 +65,11 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call static void linphone_gtk_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t enabled, const char *token); static void linphone_gtk_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate); static gboolean linphone_gtk_auto_answer(LinphoneCall *call); -static void linphone_gtk_status_icon_set_blinking(gboolean val); +void linphone_gtk_status_icon_set_blinking(gboolean val); void _linphone_gtk_enable_video(gboolean val); + static gboolean verbose=0; static gboolean auto_answer = 0; static gchar * addr_to_call = NULL; @@ -1347,7 +1348,7 @@ static gboolean do_icon_blink(GtkStatusIcon *gi){ #endif -static void linphone_gtk_status_icon_set_blinking(gboolean val){ +void linphone_gtk_status_icon_set_blinking(gboolean val){ #ifdef HAVE_GTK_OSX static gint attention_id; GtkOSXApplication *theMacApp=(GtkOSXApplication*)g_object_new(GTK_TYPE_OSX_APPLICATION, NULL); From 5e4ac070cc9fbf979ef789bb5f85b48859c7f4eb Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 4 Sep 2012 22:02:34 +0200 Subject: [PATCH 494/769] implement edge detection, and automatic configuration of call parameters for low bitrates --- coreapi/linphonecall.c | 60 +++++++++++++++++++++++++-------------- coreapi/misc.c | 15 +++------- coreapi/offeranswer.c | 1 - coreapi/private.h | 8 +++++- coreapi/sal.h | 6 ---- coreapi/sal_eXosip2_sdp.c | 4 --- mediastreamer2 | 2 +- 7 files changed, 51 insertions(+), 45 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b60517136..9192a84b7 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -207,7 +207,10 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->nstreams=1; strncpy(md->addr,call->localip,sizeof(md->addr)); strncpy(md->username,username,sizeof(md->username)); - md->bandwidth=linphone_core_get_download_bandwidth(lc); + + if (call->params.down_bw) + md->bandwidth=call->params.down_bw; + else md->bandwidth=linphone_core_get_download_bandwidth(lc); /*set audio capabilities */ strncpy(md->streams[0].rtp_addr,call->localip,sizeof(md->streams[0].rtp_addr)); @@ -217,7 +220,10 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[0].proto=(call->params.media_encryption == LinphoneMediaEncryptionSRTP) ? SalProtoRtpSavp : SalProtoRtpAvp; md->streams[0].type=SalAudio; - md->streams[0].ptime=lc->net_conf.down_ptime; + if (call->params.down_ptime) + md->streams[0].ptime=call->params.down_ptime; + else + md->streams[0].ptime=lc->net_conf.down_ptime; l=make_codec_list(lc,lc->codecs_conf.audio_codecs,call->params.audio_bw,&md->streams[0].max_rate); pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event")); l=ms_list_append(l,pt); @@ -320,6 +326,21 @@ void linphone_call_init_stats(LinphoneCallStats *stats, int type) { stats->sent_rtcp = NULL; } +static void update_media_description_from_stun(SalMediaDescription *md, const StunCandidate *ac, const StunCandidate *vc){ + if (ac->port!=0){ + strcpy(md->streams[0].rtp_addr,ac->addr); + md->streams[0].rtp_port=ac->port; + if ((ac->addr[0]!='\0' && vc->addr[0]!='\0' && strcmp(ac->addr,vc->addr)==0) || md->nstreams==1){ + strcpy(md->addr,ac->addr); + } + } + if (vc->port!=0){ + strcpy(md->streams[1].rtp_addr,vc->addr); + md->streams[1].rtp_port=vc->port; + } + +} + static void discover_mtu(LinphoneCore *lc, const char *remote){ int mtu; if (lc->net_conf.mtu==0 ){ @@ -333,16 +354,12 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){ } } -static void update_sal_media_description_from_params(SalMediaDescription *md, const LinphoneCallParams *params){ - if (params->down_bw) - md->bandwidth=params->down_bw; - if (params->down_ptime) - md->streams[0].ptime=params->down_ptime; -} +#define STUN_CANDIDATE_INIT {{0},0} LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params) { LinphoneCall *call=ms_new0(LinphoneCall,1); + StunCandidate ac=STUN_CANDIDATE_INIT,vc=STUN_CANDIDATE_INIT; int ping_time=-1; call->dir=LinphoneCallOutgoing; call->op=sal_op_new(lc->sal); @@ -355,15 +372,16 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr call->ice_session = ice_session_new(); ice_session_set_role(call->ice_session, IR_Controlling); } - call->localdesc=create_local_media_description (lc,call); - call->camera_active=params->has_video; if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) { - ping_time=linphone_core_run_stun_tests(call->core,call); + ping_time=linphone_core_run_stun_tests(call->core,call,&ac, &vc); } if (ping_time>=0) { linphone_core_adapt_to_network(lc,ping_time,&call->params); - update_sal_media_description_from_params(call->localdesc,&call->params); } + call->localdesc=create_local_media_description(lc,call); + update_media_description_from_stun(call->localdesc,&ac,&vc); + call->camera_active=params->has_video; + discover_mtu(lc,linphone_address_get_domain (to)); if (params->referer){ sal_call_set_referer(call->op,params->referer->op); @@ -376,6 +394,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; int ping_time=-1; + StunCandidate ac=STUN_CANDIDATE_INIT,vc=STUN_CANDIDATE_INIT; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -398,8 +417,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; - call->localdesc=create_local_media_description(lc,call); - call->camera_active=call->params.has_video; switch (linphone_core_get_firewall_policy(call->core)) { case LinphonePolicyUseIce: call->ice_session = ice_session_new(); @@ -416,15 +433,18 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro } break; case LinphonePolicyUseStun: - ping_time=linphone_core_run_stun_tests(call->core,call); + ping_time=linphone_core_run_stun_tests(call->core,call,&ac, &vc); /* No break to also destroy ice session in this case. */ default: break; } if (ping_time>=0) { linphone_core_adapt_to_network(lc,ping_time,&call->params); - update_sal_media_description_from_params(call->localdesc,&call->params); }; + call->localdesc=create_local_media_description(lc,call); + update_media_description_from_stun(call->localdesc,&ac,&vc); + call->camera_active=call->params.has_video; + discover_mtu(lc,linphone_address_get_domain(from)); return call; } @@ -953,11 +973,10 @@ void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, Lin void linphone_call_init_audio_stream(LinphoneCall *call){ LinphoneCore *lc=call->core; - SalMediaDescription *md=call->localdesc; AudioStream *audiostream; int dscp=lp_config_get_int(lc->config,"rtp","audio_dscp",-1); - call->audiostream=audiostream=audio_stream_new(md->streams[0].rtp_port,md->streams[0].rtcp_port,linphone_core_ipv6_enabled(lc)); + call->audiostream=audiostream=audio_stream_new(call->audio_port,call->audio_port+1,linphone_core_ipv6_enabled(lc)); if (dscp!=-1) audio_stream_set_dscp(audiostream,dscp); if (linphone_core_echo_limiter_enabled(lc)){ @@ -1006,13 +1025,12 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ void linphone_call_init_video_stream(LinphoneCall *call){ #ifdef VIDEO_ENABLED LinphoneCore *lc=call->core; - SalMediaDescription *md=call->localdesc; - if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].rtp_port>0){ + if ((lc->video_conf.display || lc->video_conf.capture) && call->params.has_video){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); int dscp=lp_config_get_int(lc->config,"rtp","video_dscp",-1); - call->videostream=video_stream_new(md->streams[1].rtp_port,md->streams[1].rtcp_port,linphone_core_ipv6_enabled(lc)); + call->videostream=video_stream_new(call->video_port,call->video_port+1,linphone_core_ipv6_enabled(lc)); if (dscp!=-1) video_stream_set_dscp(call->videostream,dscp); video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0)); diff --git a/coreapi/misc.c b/coreapi/misc.c index a2a61ce85..1e7676bfa 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -467,7 +467,7 @@ static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id } /* this functions runs a simple stun test and return the number of milliseconds to complete the tests, or -1 if the test were failed.*/ -int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ +int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call, StunCandidate *ac, StunCandidate *vc){ const char *server=linphone_core_get_stun_server(lc); if (lc->sip_conf.ipv6_enabled){ @@ -483,13 +483,9 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ bool_t got_audio,got_video; bool_t cone_audio=FALSE,cone_video=FALSE; struct timeval init,cur; - SalEndpointCandidate *ac,*vc; double elapsed; int ret=0; - ac=&call->localdesc->streams[0].candidates[0]; - vc=&call->localdesc->streams[1].candidates[0]; - if (parse_hostname_to_addr(server,&ss,&ss_len)<0){ ms_error("Fail to parser stun server address: %s",server); return -1; @@ -569,28 +565,25 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ } } } - if ((ac->addr[0]!='\0' && vc->addr[0]!='\0' && strcmp(ac->addr,vc->addr)==0) - || sock2==-1){ - strcpy(call->localdesc->addr,ac->addr); - } close_socket(sock1); if (sock2!=-1) close_socket(sock2); return ret; } return -1; - } void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params){ if (lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){ + ms_message("Stun server ping time is %i ms",ping_time_ms); int threshold=lp_config_get_int(lc->config,"net","edge_ping_time",500); if (ping_time_ms>threshold){ int edge_ptime=lp_config_get_int(lc->config,"net","edge_ptime",100); - int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",30); + int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",20); /* we are in a 2G network*/ params->up_bw=params->down_bw=edge_bw; params->up_ptime=params->down_ptime=edge_ptime; + params->has_video=FALSE; }/*else use default settings */ } diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index f2cb836c2..541a1eee3 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -240,7 +240,6 @@ static void initiate_incoming(const SalStreamDescription *local_cap, if (result->payloads && !only_telephone_event(result->payloads) && (remote_offer->rtp_port!=0 || remote_offer->rtp_port==SalStreamSendOnly)){ strcpy(result->rtp_addr,local_cap->rtp_addr); strcpy(result->rtcp_addr,local_cap->rtcp_addr); - memcpy(result->candidates,local_cap->candidates,sizeof(result->candidates)); result->rtp_port=local_cap->rtp_port; result->rtcp_port=local_cap->rtcp_port; result->bandwidth=local_cap->bandwidth; diff --git a/coreapi/private.h b/coreapi/private.h index d5e98c956..2bf643d47 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -230,7 +230,13 @@ MSList *linphone_find_friend(MSList *fl, const LinphoneAddress *fri, LinphoneFri void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, const PayloadType *pt); -int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); + +typedef struct StunCandidate{ + char addr[64]; + int port; +}StunCandidate; + +int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call, StunCandidate *ac, StunCandidate *vc); void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params); int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); diff --git a/coreapi/sal.h b/coreapi/sal.h index 616b0aba9..8faa11375 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -105,11 +105,6 @@ typedef enum{ SalStreamInactive }SalStreamDir; -typedef struct SalEndpointCandidate{ - char addr[64]; - int port; -}SalEndpointCandidate; - #define SAL_ENDPOINT_CANDIDATE_MAX 2 #define SAL_MEDIA_DESCRIPTION_MAX_ICE_ADDR_LEN 64 @@ -159,7 +154,6 @@ typedef struct SalStreamDescription{ MSList *payloads; //rtcp_addr; rtp_port=desc->rtp_port; rtcp_port=desc->rtcp_port; - if (desc->candidates[0].addr[0]!='\0'){ - rtp_addr=desc->candidates[0].addr; - rtp_port=desc->candidates[0].port; - } if (desc->proto == SalProtoRtpSavp) { int i; diff --git a/mediastreamer2 b/mediastreamer2 index beb4318d1..18a6f4d86 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit beb4318d1e5eb282adc82967a9c80e89cd406045 +Subproject commit 18a6f4d8629593125cc7b707f5fdad1462b2dcd9 From acd370ea93fff73c76a74f1cbb3f1c8b64bdef72 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 5 Sep 2012 09:00:28 +0200 Subject: [PATCH 495/769] add linphone_core_get_calls_nb to linphonecore.h --- coreapi/linphonecore.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 637630997..7a1d27f09 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1267,6 +1267,8 @@ void linphone_core_set_rtp_transport_factories(LinphoneCore* lc, LinphoneRtpTran int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote); +int linphone_core_get_calls_nb(const LinphoneCore *lc); + const MSList *linphone_core_get_calls(LinphoneCore *lc); LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc); From fd4937409b089ba35c887dde134c2ab0864411ca Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 5 Sep 2012 11:51:26 +0200 Subject: [PATCH 496/769] Add java interface for chat. Add -D for exosip Remove obsolete media_api to avoid confusion --- build/android/common.mk | 1 + .../org/linphone/core/LinphoneChatRoom.java | 12 +- media_api/.gitignore | 3 - media_api/DESIGN.txt | 135 ------------- media_api/Makefile.am | 31 --- media_api/apitest.c | 36 ---- media_api/apitest.h | 0 media_api/basiccall.c | 170 ----------------- media_api/basiccall.h | 51 ----- media_api/callmember.c | 153 --------------- media_api/callmember.h | 59 ------ media_api/ccl | 1 - media_api/common.h | 31 --- media_api/media_api.c | 69 ------- media_api/media_api.h | 69 ------- media_api/mediaflow.c | 179 ------------------ media_api/mediaflow.h | 68 ------- 17 files changed, 12 insertions(+), 1056 deletions(-) delete mode 100644 media_api/.gitignore delete mode 100644 media_api/DESIGN.txt delete mode 100644 media_api/Makefile.am delete mode 100644 media_api/apitest.c delete mode 100644 media_api/apitest.h delete mode 100644 media_api/basiccall.c delete mode 100644 media_api/basiccall.h delete mode 100644 media_api/callmember.c delete mode 100644 media_api/callmember.h delete mode 100644 media_api/ccl delete mode 100644 media_api/common.h delete mode 100644 media_api/media_api.c delete mode 100644 media_api/media_api.h delete mode 100644 media_api/mediaflow.c delete mode 100644 media_api/mediaflow.h diff --git a/build/android/common.mk b/build/android/common.mk index 4fa833b59..4db1f6809 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -59,6 +59,7 @@ LOCAL_CFLAGS += \ -DORTP_INET6 \ -DINET6 \ -DOSIP_MT \ + -DHAVE_EXOSIP_RESET_TRANSPORTS \ -DENABLE_TRACE \ -DLINPHONE_VERSION=\"$(LINPHONE_VERSION)\" \ -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ diff --git a/java/common/org/linphone/core/LinphoneChatRoom.java b/java/common/org/linphone/core/LinphoneChatRoom.java index f06e8fda5..8c85b64bc 100644 --- a/java/common/org/linphone/core/LinphoneChatRoom.java +++ b/java/common/org/linphone/core/LinphoneChatRoom.java @@ -34,6 +34,16 @@ public interface LinphoneChatRoom { * send a message to peer member of this chat room. * @param message to be sent */ + void sendMessage(String message); + /** + * Send a message to peer member of this chat room. + * @param chat message + */ + void sendMessage(LinphoneChatMessage msg, LinphoneChatMessage.StateListener listener); + /** + * DEPRECATED + * @param opaque + * @param message + */ void sendMessage(Object opaque, String message); - } diff --git a/media_api/.gitignore b/media_api/.gitignore deleted file mode 100644 index e99558847..000000000 --- a/media_api/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.deps -Makefile -Makefile.in diff --git a/media_api/DESIGN.txt b/media_api/DESIGN.txt deleted file mode 100644 index f7c9cfc1f..000000000 --- a/media_api/DESIGN.txt +++ /dev/null @@ -1,135 +0,0 @@ -MEDIA API DESIGN DRAFT -********************** - - -The objective of the media_api is to construct and run the necessary -processing on audio and video data flows for a given call (two party call) or -conference. -The media_api must support calls where callmember can be remote as well -local hosted, in other words the media_api can be used inside linphone as -well as in sip conferencing server. The api must support multiples way of -getting media data: from disk, from rtp, from soundcard... -The media_api is object oriented in C, and is based on the mediastreamer library -to deal with audio or video signals, and on glib for types and usefull routines. - -The api must provide object and methods that describes the call, and then functions -that executes the processing (using the mediastreamer) that is necessary for the -call described. - -Proposed API: - -************************************************************************ -object: MediaFlow -This object reprensent a media that is shared between all members of the call, -for example voice. -methods: -MediaFlow *media_flow_new(char *id_string,gint type,gint duplex); -type can be FLOW_AUDIO, FLOW_VIDEO. -if duplex is 1, it means that the media flow is used by every member in both -receiving and sending mode. -id_string is just a string to identify the flow. - -void media_flow_destroy(MediaFlow *flow); -destructor - -************************************************************************** -object: CallMember -This object reprensent a member of a call. -methods: -CallMember *call_member_new(); - -gint call_member_setup_flow(CallMember *member, MediaFlow *flow, - char *rx_endpoint, char *tx_endpoint); - This is the most important function of the API. It describes the way each - call member receives and send a given media flow. - The MediaFlow "flow" is added to the list of flows used by the member "member". - rx_endpoint is a string that described how data is received by the call member. - It should be an url, for example "rtp://213.21.54.127:7080". In this case it - means that data will be received on port 7080 at ip address 213.21.54.127. - tx_endpoint is a string that described how data is sent by the call member. - The role of url is very important. They can be: - "rtp://213.21.54.127:7080" - "file://tmp/media.out" -a file on disk - "oss://0" -souncard 0 using oss api - "alsa://0" -soundcard 0 using alsa api. - In order to work, the call member must be part of a BasicCall, as well as - the flow must be part of the BasicCall too (using basic_call_add_flow()) - This function may (on the backend) create a MediaEndpoint object that stores - the rx_endpoint and tx_endpoint parameter. This object is added to: - -the list of MediaEndpoint maintained by the member (list per member) - -the list of MediaEndpoint maintained by the flow (list per flow) - - -************************************************************************** -object: BasicCall -This object handles simple calls (two party calls). It defines inside itself -two CallMember objects. -method: -BasicCall *basic_call_new(); - -CallMember *basic_call_get_member(BasicCall *call, gint member_number); - Returns a member of a BasicCall according to a number. - -void basic_call_add_flow(BasicCall *call, MediaFlow *flow); - Adds a flow to the call's list of flow. - -gint basic_call_start_flow(BasicCall *call, MediaFlow *flow); - This function construct the mediastreamer processing chain necessary to make - the call running, if not done, and runs it using ms_start() - -gint basic_call_stop_flow(BasicCall *call, MediaFlow *flow); - -gint basic_call_start_all_flows(BasicCall *call); - -void basic_call_destroy(BasicCall *call); - Destroy all data used by the call: call members, call flows. - -************************************************************************** -object: ConferenceCall -This object handles conference call (which are quite much complicated than basic -calls). But this object should have the same method as the BasicCall object. - -******************************************************************* - EXAMPLE -******************************************************************* - -Two party call between call member A on machine "linphone.org" and call member B on machine "home.com". -The media_api is running on "home.com". - - A (on linphone.org) B (on home.com) - ------->(send to rtp://home.com:7080 MSRTPReceiver------>Decode----->(send to oss:/0) - -------<(recv on rtp://linphone.org:7020 MSRTPSender<--------Encode<-----(read on oss://0) - -This is how to setup this call using the media_api: -BasicCall *call; -CallMember *memberA,*memberB; -MediaFlow *flow; - -/* create a basic call*/ -call=basic_call_new(); -/* get a pointer to the pre-define members of the call */ -memberA=basic_call_get_member(call,0); -memberB=basic_call_get_member(call,1); - -/* create a media flow */ -flow=media_flow_new("voice",FLOW_AUDIO,1); -/* tell that the flow is used by the call */ -basic_call_add_flow(call,flow); -/* tell how each member uses the flow (how is the interface ?)*/ -call_member_setup_flow(memberA,flow,"rtp://linphone.org:7020","rtp://home.com:7080"); -/* note: it is not efficient to do name resolution at this stage: that's why in reality numeric ip address -should be given instead of host name */ -call_member_setup_flow(memberB,flow,"oss://0","oss://0"); - -/* start the flow */ -basic_call_start_flow(call,flow); - -In case where the media api is running on another host called "toto" (in a media translator application for example), - the only thing that would change is the url given to memberB: tx="rtp://home.com:8820" for example and - rx="rtp://toto:9522". - -In the sipomatic application (the test application I use to test linphone (it answers to call and plays -a short annoucement)), I would write rx="file://path_to_annoucement.raw" and tx="file://dev/null" instead of -"oss://0". diff --git a/media_api/Makefile.am b/media_api/Makefile.am deleted file mode 100644 index 38dcf063f..000000000 --- a/media_api/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -## Process this file with automake to produce Makefile.in -if BUILD_MEDIA_API - -#the media_api library is the only one we have to build here -lib_LTLIBRARIES=libmedia_api.la - -#definition of the sources of libmedia_api -libmedia_api_la_SOURCES= basiccall.c callmember.c mediaflow.c - -# libmedia_api needs libmediastreamer -libmedia_api_la_LIBADD=$(top_srcdir)/mediastreamer/libmediastreamer.la - -#the media_api test program -bin_PROGRAMS=apitest - -apitest_SOURCES= apitest.c -# the test program links to libmedia_api -apitest_LDADD=libmedia_api.la - -endif - -DEFS=@DEFS@ @SOUNDDEFS@ -DDEBUG -DG_LOG_DOMAIN=\"MediaApi\" - -INCLUDES=-I$(top_srcdir)/mediastreamer \ - -I$(top_srcdir)/speex \ - -I$(top_srcdir)/gsmlib \ - $(ORTP_CFLAGS) \ - -I$(top_srcdir)/lpc10-1.5 \ - -I$(top_srcdir)/ffmpeg - - diff --git a/media_api/apitest.c b/media_api/apitest.c deleted file mode 100644 index cd4ac9e33..000000000 --- a/media_api/apitest.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "basiccall.h" -#include -static int flag = 1; -void stop(int sign){ - flag = 0; -} - - -int main(){ - BasicCall *call; - char *id; - CallMember *memberA, *memberB; - MediaFlow *flow, *flow1; - - signal(SIGINT, stop); - call = basic_call_new(); - memberA = basic_call_get_member(call,MemberA); - memberB = basic_call_get_member(call,MemberB); - - id = "test_voice"; - printf("\n"); - flow = media_flow_new(id, MEDIA_FLOW_VOICE); - - basic_call_add_flow(call, flow); - - call_member_setup_flow(memberA, flow, "file://temp", "oss://0"); - call_member_setup_flow(memberB, flow, "oss://0", "oss://0"); - - media_flow_setup_fd(flow, memberA, memberB, MEDIA_FLOW_HALF_DUPLEX); - basic_call_start_flow(call, flow); - - while(flag){ - sleep(1); - } - -} diff --git a/media_api/apitest.h b/media_api/apitest.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/media_api/basiccall.c b/media_api/basiccall.c deleted file mode 100644 index 8a0044754..000000000 --- a/media_api/basiccall.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - The objective of the media_api is to construct and run the necessary processing - on audio and video data flows for a given call (two party call) or conference. - Copyright (C) 2001 Sharath Udupa skuds@gmx.net - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "basiccall.h" -#include "../mediastreamer/mscodec.h" - -#define ONESYNC 10 -#define MULTISYNC 20 - -BasicCall *basic_call_new(){ - BasicCall *bc = (BasicCall*) g_malloc(sizeof(BasicCall)); - api_trace("basic_call_new: creating a basic call"); - bc->memberA = call_member_new("memberA"); - bc->memberB = call_member_new("memberB"); - return bc; -} - -CallMember *basic_call_get_member(BasicCall *call, int member_nu){ - api_trace("basic_call_get_member: called for %d",member_nu); - if(member_nu == MemberA){ - return call->memberA; - } - else if(member_nu == MemberB){ - return call->memberB; - } -} - -void basic_call_add_flow(BasicCall *call, MediaFlow *flow){ - api_trace("basic_call_add_flow: called for %s",flow->id); - call->flows = g_list_append( call->flows, flow); - return 1; -} - -int find_mediaflow(gconstpointer llist, gconstpointer flow){ - //MediaFlow *mf = (MediaFlow *) ((BasicCallFlow*)llist)->mediaFlow; - if(((MediaFlow*)flow)->id == ((MediaFlow*)llist)->id){ - return 0; - } - return 1; -} - -int basic_call_start_flow(BasicCall *call, MediaFlow *flow){ - int i=0; - int syncFlag=0; - int nFlowDirections; - MSSync *sync; - Members *source, *destination; - FlowDirections *fd; - GList *elem, *selem; - GList *snd_read = NULL, *snd_write = NULL, *filter = NULL; - - //Commented by Sharat - //This is initialized in media_api.c - //when should these functions be really called? - //ms_init(); - //ortp_init(); - - api_trace("basic_call_start_flow: called for flow %s", flow->id); - - elem = g_list_find_custom( call->flows, flow, &find_mediaflow); - if(elem == NULL){ - api_error("basic_call_start_flow: Called for unregistered mediaflow %s", flow->id); - } - - nFlowDirections = g_list_length(flow->flowDirections); - if(flow->type == MEDIA_FLOW_VOICE){ - syncFlag = ONESYNC; - sync = ms_timer_new(); - } - else{ - syncFlag = MULTISYNC; - } - - for(i=0;i< nFlowDirections; i++){ - - if(syncFlag == MULTISYNC){ - sync = ms_timer_new(); - } - fd = (FlowDirections*)g_list_nth_data(flow->flowDirections,i); - source = fd->source; - destination = fd->destination; - - media_flow_start_fd(fd, sync); - if(fd->type == MEDIA_FLOW_DUPLEX){ - switch(source->tx_endpoint->protocol){ - case MEDIA_ALSA: - case MEDIA_OSS: - snd_read = g_list_append(snd_read, fd->recv); - } - switch(destination->rx_endpoint->protocol){ - case MEDIA_ALSA: - case MEDIA_OSS: - snd_write = g_list_append(snd_write, fd->play); - } - - switch(destination->tx_endpoint->protocol){ - case MEDIA_ALSA: - case MEDIA_OSS: - snd_read = g_list_append(snd_read, fd->read); - } - - switch(source->rx_endpoint->protocol){ - case MEDIA_ALSA: - case MEDIA_OSS: - snd_write = g_list_append(snd_write, fd->send); - } - - } - else if(fd->type == MEDIA_FLOW_HALF_DUPLEX){ - - switch(source->tx_endpoint->protocol){ - case MEDIA_ALSA: - case MEDIA_OSS: - snd_read = g_list_append(snd_read, fd->recv); - } - switch(destination->rx_endpoint->protocol){ - case MEDIA_ALSA: - case MEDIA_OSS: - snd_write = g_list_append(snd_write, fd->play); - } - } - if(syncFlag == MULTISYNC){ - flow->sync = g_list_append(flow->sync, sync); - } - } - if(syncFlag == ONESYNC){ - ms_start(sync); - flow->sync = g_list_append(flow->sync, sync); - } - if(syncFlag == MULTISYNC){ - selem = flow->sync; - while(selem != NULL){ - ms_start(selem->data); - selem = g_list_next(selem); - } - } - filter = snd_read; - while(filter != NULL){ - ms_sound_read_start(MS_SOUND_READ((MSFilter*)filter->data)); - filter = g_list_next(filter); - } - - filter = snd_write; - while(filter != NULL){ - ms_sound_write_start(MS_SOUND_WRITE((MSFilter*)filter->data)); - filter = g_list_next(filter); - } - return 1; -} - -int basic_call_stop_flow(BasicCall *call, MediaFlow *flow){ - -} diff --git a/media_api/basiccall.h b/media_api/basiccall.h deleted file mode 100644 index 2351faccc..000000000 --- a/media_api/basiccall.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - The objective of the media_api is to construct and run the necessary processing - on audio and video data flows for a given call (two party call) or conference. - Copyright (C) 2001 Sharath Udupa skuds@gmx.net - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "common.h" -#include "mediaflow.h" -#include "callmember.h" - -//other includes required to be done here -#define MemberA 1 -#define MemberB 2 - - -struct _BasicCall{ - CallMember *memberA, *memberB; - GList *flows; //linked list of MediaFlows -}; - -typedef struct _BasicCall BasicCall; - - -BasicCall *basic_call_new(); - -CallMember *basic_call_get_member(BasicCall *call, int member_nu); - -void basic_call_add_flow(BasicCall *call, MediaFlow *flow); - -int basic_call_start_flow(BasicCall *call, MediaFlow *flow); - -int basic_call_stop_flow(BasicCall *call, MediaFlow *flow); - -int basic_call_start_all_flows(BasicCall *call); - -int basic_call_destroy(BasicCall *call); - diff --git a/media_api/callmember.c b/media_api/callmember.c deleted file mode 100644 index 643ba7b7c..000000000 --- a/media_api/callmember.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - The objective of the media_api is to construct and run the necessary processing - on audio and video data flows for a given call (two party call) or conference. - Copyright (C) 2001 Sharath Udupa skuds@gmx.net - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include "common.h" -#include "callmember.h" -#include "mediaflow.h" - - -CallMember *call_member_new(char *name){ - CallMember *member = (CallMember*) g_malloc(sizeof(CallMember)); - api_trace("call_member_new: creating %s", name); - member->name = name; - member->flows = NULL; - member->profile = NULL; - return member; -} - -int call_member_set_rtp_profile(CallMember *member, RtpProfile *profile){ - member->profile = profile; - return 1; -} - -int call_member_setup_flow(CallMember *member, MediaFlow *flow, char* rx, char *tx){ - Members *mem = (Members*) g_malloc(sizeof(Members)); - Flows *flows = (Flows*) g_malloc(sizeof(Flows)); - api_trace("call_member_setup_flow: setting up flow for: CallMember->%s , MediaFlow->%s", member->name, flow->id); - mem->member = member; - mem->rx_endpoint = parse_end_point(rx); - mem->tx_endpoint = parse_end_point(tx); - flow->members = g_list_append(flow->members, mem); - - flows->flow = flow; - flows->rx_endpoint = parse_end_point(rx); - flows->tx_endpoint = parse_end_point(tx); - member->flows = g_list_append(member->flows, flows); - return 1; -} - -EndPoint *parse_end_point(char *endpoint){ - EndPoint *result = (EndPoint*) g_malloc(sizeof(EndPoint)); - int i=0,len1,len2,len, tlen; - char *str2, temp[30], *host_str; - //api_trace("parse_end_point: parsing %s\n", endpoint); - result->pt = -1; - while(1){ - str2 = (char*) strpbrk(endpoint, ":"); - if(str2 == NULL){ - str2 = (char*) strpbrk(endpoint, ";"); - if(str2 == NULL){ - len = strlen(endpoint); - } - else{ - len1 = strlen(endpoint); - len2 = strlen(str2); - len = len1-len2; - } - } - else{ - len1 = strlen(endpoint); - len2 = strlen(str2); - len = len1-len2; - } - strncpy(temp,endpoint,len); - temp[len] = '\0'; - tlen = strlen(temp); - if((tlen >= 2)&&(temp[0] == '/')&&(temp[1] == '/')){ - host_str = remove_slash(temp); - } - switch(i){ - case 0: if(strcmp(temp,"rtp")==0){ - result->protocol=MEDIA_RTP; - } - else if(strcmp(temp,"oss")==0){ - result->protocol=MEDIA_OSS; - } - else if(strcmp(temp,"alsa")==0){ - result->protocol=MEDIA_ALSA; - } - else if(strcmp(temp,"file")==0){ - result->protocol=MEDIA_FILE; - } - break; - case 1: if(result->protocol==MEDIA_FILE){ - result->file=host_str; - } - else{ - result->host = host_str; - } - break; - case 2: result->port = to_digits(temp); - break; - case 3: result->pt = pt_digits(temp); - break; - default://result->options[result->nOptions++] = temp; - break; - } - if(str2 != NULL) endpoint = str2+1; - else break; - i++; - } - return result; -} - -int to_digits(char *str){ - int nu=0,a,len,i; - len = strlen(str); - for(i=0;i3)&&(str[0]=='p')&&(str[1]=='t')&&(str[2]=='=')){ - return to_digits(str+3); - } - else{ - api_warn("Wrong parameters passed in the endpoints"); - return 0; - //ERROR handling - } -} -char *remove_slash(char var[]){ - char *temp = (char*) g_malloc(10*sizeof(char)); - int len,i; - len=strlen(var); - for(i=2;i - -#define api_trace g_message -#define api_error g_error -#define api_warn g_warning - -#define MEDIA_FLOW_DUPLEX 1 -#define MEDIA_FLOW_HALF_DUPLEX 2 - -//Mediaflow type -#define MEDIA_FLOW_VIDEO 1 -#define MEDIA_FLOW_VOICE 2 - -//Mediaflow protocols -#define MEDIA_RTP 1 -#define MEDIA_OSS 2 -#define MEDIA_ALSA 3 -#define MEDIA_FILE 4 - -//Mediaflow codec function -#define MEDIA_API_DECODER 1 -#define MEDIA_API_ENCODER 2 - -#endif - - diff --git a/media_api/media_api.c b/media_api/media_api.c deleted file mode 100644 index 8746e9b0c..000000000 --- a/media_api/media_api.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - The objective of the media_api is to construct and run the necessary processing - on audio and video data flows for a given call (two party call) or conference. - Copyright (C) 2001 Sharath Udupa skuds@gmx.net - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "media_api.h" - -/* non-standard payload types for oRTP */ -PayloadType lpc1015={ - PAYLOAD_AUDIO_PACKETIZED, - 8000, - 0, - NULL, - 0, - 2400, - "1015/8000/1" -}; - -PayloadType speex_nb={ - PAYLOAD_AUDIO_PACKETIZED, - 8000, - 0, - NULL, - 0, - 15000, - "speex/8000/1" -}; - -PayloadType speex_nb_lbr={ - PAYLOAD_AUDIO_PACKETIZED, - 8000, - 0, - NULL, - 0, - 8000, - "speex-lbr/8000/1" -}; - -void media_api_init() -{ - ortp_init(); - ortp_set_debug_file("oRTP",NULL); - rtp_profile_set_payload(&av_profile,115,&lpc1015); - rtp_profile_set_payload(&av_profile,110,&speex_nb); - rtp_profile_set_payload(&av_profile,111,&speex_nb_lbr); - rtp_profile_set_payload(&av_profile,101,&telephone_event); - ms_init(); - ms_speex_codec_init(); -#ifdef HAVE_AVCODEC - ms_AVCodec_init(); -#endif -} - - diff --git a/media_api/media_api.h b/media_api/media_api.h deleted file mode 100644 index b7341fc4a..000000000 --- a/media_api/media_api.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - The objective of the media_api is to construct and run the necessary processing - on audio and video data flows for a given call (two party call) or conference. - Copyright (C) 2001 Sharath Udupa skuds@gmx.net - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef MEDIA_API_H -#define MEDIA_API_H - -/* some mediastreamer include files....*/ - -#include "ms.h" - -/* audio codecs ; all these header are not really required as we should use ms_codec_new..() to -create codec filters*/ -/*Commented by Sharath Udupa -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef BUILD_FFMPEG -#include -#include */ -#endif - -/* some usefull filters of the mediastreamer */ -#include "mscopy.h" -#include "msfdispatcher.h" -#include "msqdispatcher.h" - -/* some synchronisation sources */ -#include -#include - -/* some streams sources and sinks */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif - - - diff --git a/media_api/mediaflow.c b/media_api/mediaflow.c deleted file mode 100644 index e0e6be403..000000000 --- a/media_api/mediaflow.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - The objective of the media_api is to construct and run the necessary processing - on audio and video data flows for a given call (two party call) or conference. - Copyright (C) 2001 Sharath Udupa skuds@gmx.net - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "common.h" -#include "mediaflow.h" -#include "callmember.h" - - -MediaFlow *media_flow_new(char *id_string, int type){ - MediaFlow *flow = (MediaFlow *) g_malloc(sizeof(MediaFlow)); //malloc required? - api_trace("media_flow_new: creating %s",id_string); - flow->id = id_string; - flow->type = type; - flow->flowDirections = NULL; - flow->members = NULL; - return flow; -} - -int media_flow_destroy(MediaFlow *flow){ - g_free(flow); - return 1; -} - -int media_flow_setup_fd(MediaFlow *flow, CallMember* csource, CallMember *cdestination, int direction){ - GList *source, *destination; - char *dir; - FlowDirections *fd = (FlowDirections *) g_malloc(sizeof(FlowDirections)); - if(direction == MEDIA_FLOW_DUPLEX) dir = "DUPLEX"; - else if(direction == MEDIA_FLOW_HALF_DUPLEX) dir = "HALF_DUPLEX"; - api_trace("media_flow_setup_fd: setting up %s flow for %s , %s",dir, csource->name, cdestination->name); - source = g_list_find_custom(flow->members, csource, &find); - destination =g_list_find_custom(flow->members, cdestination, &find); - if(source == NULL){ - api_error("media_flow_setup_fd: Invalid source %s specified", csource->name); - } - if(destination == NULL){ - api_error("media_flow_setup_fd: Invalid destination %s specified", cdestination->name); - //ERROR handling to be done here - } - fd->source = (Members*)source->data; - fd->destination = (Members*)destination->data; - fd->type = direction; - flow->flowDirections = g_list_append(flow->flowDirections, fd); - return 1; -} - -int find(gconstpointer mem, gconstpointer cmember){ - if(!strcmp(((Members*)mem)->member->name, ((CallMember*)cmember)->name)){ - return 0; - } - return 1; -} - -int media_flow_start_fd(FlowDirections *fd, MSSync *sync){ - Members *source, *destination; - source = fd->source; - destination = fd->destination; - if(fd->type == MEDIA_FLOW_DUPLEX){ - fd->recv = set_MSFilter(source->tx_endpoint,1,fd); - fd->dec = set_CODECFilter(source->member->profile, source->tx_endpoint->pt,MEDIA_API_DECODER); - fd->play = set_MSFilter(destination->rx_endpoint,0,fd); - - ms_filter_add_link(fd->recv,fd->dec); - ms_filter_add_link(fd->dec,fd->play); - ms_sync_attach(sync, fd->recv); - - fd->read = set_MSFilter(destination->tx_endpoint,1,fd); - fd->enc = set_CODECFilter(destination->member->profile, destination->tx_endpoint->pt,MEDIA_API_ENCODER); - fd->send = set_MSFilter(source->rx_endpoint,0,fd); - - ms_filter_add_link(fd->read, fd->enc); - ms_filter_add_link(fd->enc, fd->send); - ms_sync_attach(sync, fd->read); - - } - else if(fd->type == MEDIA_FLOW_HALF_DUPLEX){ - - fd->recv = set_MSFilter(source->tx_endpoint,1,fd); - fd->dec = set_CODECFilter(sourcec->member->profile, source->tx_endpoint->pt,MEDIA_API_DECODER); - fd->play = set_MSFilter(destination->rx_endpoint,0,fd); - - ms_filter_add_link(fd->recv,fd->dec); - ms_filter_add_link(fd->dec,fd->play); - ms_sync_attach(sync, fd->recv); - } - return 1; -} - - -MSFilter *set_MSFilter(EndPoint *endpoint, int type, FlowDirections *fdir){ - MSFilter *filter; - RtpSession *rtps; - switch(endpoint->protocol){ - case MEDIA_RTP: - rtps = rtp_session_new(RTP_SESSION_RECVONLY); - rtp_session_set_local_addr(rtps,"0.0.0.0",8000,8001); - rtp_session_set_scheduling_mode(rtps,0); - rtp_session_set_blocking_mode(rtps,0); - - if(type == 1){ - filter = ms_rtp_recv_new(); - ms_rtp_recv_set_session(MS_RTP_RECV(filter), rtps); - fdir->rtpSessions = g_list_append(fdir->rtpSessions, rtps); - return filter; - } - else{ - //ms_rtp_send_new - } - case MEDIA_OSS: - if(type == 1){ - filter = ms_oss_read_new(); - ms_sound_read_set_device(MS_SOUND_READ(filter),0); - return filter; - } - else{ - filter = ms_oss_write_new(); - ms_sound_write_set_device(MS_SOUND_WRITE(filter),0); - return filter; - } - case MEDIA_FILE: - if(type == 1){ - filter = ms_read_new(endpoint->file); - return filter; - } - if(type == 0){ - filter = ms_write_new(endpoint->file); - return filter; - } - - } -} - -MSFilter *set_CODECFilter(RtpProfile *profile, int pt, int mode){ - PayloadType *payload; - - switch(mode){ - case MEDIA_API_DECODER: - payload = rtp_profile_get_payload(profile, pt); - if(payload == NULL){ - api_error("media_api: undefined payload in URL\n"); - return NULL; - } - return ms_decoder_new_with_string_id(payload->mime_type); - - //Commented this to include the new RtpProfile - /*if(pt != -1) return ms_decoder_new_with_pt(pt); - *else return ms_copy_new(); - */ - case MEDIA_API_ENCODER: - - payload = rtp_profile_get_payload(profile, pt); - if(payload == NULL){ - api_error("media_api: undefined payload in URL\n"); - return NULL; - } - return ms_encoder_new_with_string_id(payload->mime_type); - /*if(pt != -1) return ms_encoder_new_with_pt(pt); - *else return ms_copy_new(); - */ - } -} - - diff --git a/media_api/mediaflow.h b/media_api/mediaflow.h deleted file mode 100644 index 598df4d98..000000000 --- a/media_api/mediaflow.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - The objective of the media_api is to construct and run the necessary processing - on audio and video data flows for a given call (two party call) or conference. - Copyright (C) 2001 Sharath Udupa skuds@gmx.net - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a c:opy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -struct _MediaFlow{ - char *id; - int type; - GList *members; - GList *flowDirections; - GList *sync; //holds all the filters in this MediaFlow -}; - -typedef struct _MediaFlow MediaFlow; - -struct _Members{ - struct _CallMember *member; - struct _EndPoint *rx_endpoint; - struct _EndPoint *tx_endpoint; -}; - -typedef struct _Members Members; - -struct _FlowDirections{ - Members *source, *destination; - MSFilter *recv, - *dec, - *play; - MSFilter *read, //Filters used - *enc, //if type==DUPLEX - *send; - GList *rtpSessions; - int type; -}; - -typedef struct _FlowDirections FlowDirections; - - -MediaFlow *media_flow_new(char *id_string, int type); - -int media_flow_setup_fd(MediaFlow*, struct _CallMember *, struct _CallMember *, int); - -int media_flow_start_fd(FlowDirections *fd, MSSync *sync); - -int media_flow_destroy(MediaFlow *flow); - -/* Internal functions */ -int find(gconstpointer, gconstpointer); - -MSFilter *set_MSFilter(struct _EndPoint *, int, FlowDirections *); - -MSFilter *set_CODECFilter(RtpProfile* , int, int); - From 3cec3cea4c100222a5e702ff69e9c473e3e09c10 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 5 Sep 2012 11:52:18 +0200 Subject: [PATCH 497/769] update linphone submodule, add new interface for chat. --- LinphoneChatRoomImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/LinphoneChatRoomImpl.java b/LinphoneChatRoomImpl.java index 76874675d..3513f3283 100644 --- a/LinphoneChatRoomImpl.java +++ b/LinphoneChatRoomImpl.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import org.linphone.core.LinphoneChatMessage.StateListener; + class LinphoneChatRoomImpl implements LinphoneChatRoom { protected final long nativePtr; private native long getPeerAddress(long ptr); @@ -34,4 +36,14 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { public void sendMessage(String message) { sendMessage(nativePtr,message); } + @Override + public void sendMessage(LinphoneChatMessage msg, StateListener listener) { + // TODO To be implemened + + } + @Override + public void sendMessage(Object opaque, String message) { + // ignore, deprecated. + + } } From cc7a707754f028a36dd2dfee914b93f431419622 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 5 Sep 2012 14:19:50 +0200 Subject: [PATCH 498/769] forgot to commit a file --- .../linphone/core/LinphoneChatMessage.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 java/common/org/linphone/core/LinphoneChatMessage.java diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java new file mode 100644 index 000000000..77238d270 --- /dev/null +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -0,0 +1,53 @@ +package org.linphone.core; + +import java.util.Vector; + + +public interface LinphoneChatMessage { + interface StateListener{ + void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state); + } + static class State { + static private Vector values = new Vector(); + private final int mValue; + public final int value() {return mValue;} + + private final String mStringValue; + /** + * Idle + */ + public final static State Idle = new State(0,"Idle"); + /** + * Incoming call received. + */ + public final static State InProgress = new State(1,"InProgress"); + /** + * Outgoing call initialiazed. + */ + public final static State Delivered = new State(2,"Delivered"); + /** + * Outgoing call in progress. + */ + public final static State NotDelivered = new State(3,"NotDelivered"); + + private State(int value,String stringValue) { + mValue = value; + values.addElement(this); + mStringValue=stringValue; + } + + public static State fromInt(int value) { + + for (int i=0; i Date: Wed, 5 Sep 2012 16:34:27 +0200 Subject: [PATCH 499/769] fix ice mode with srtp --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 716ac0178..3d41a5c30 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 716ac0178612a7416c828fd74261e4dda44930de +Subproject commit 3d41a5c307868cb2898d4fee24ad575c565b1ae9 From 1b4e6a2a693936d5561ceecf0b1cfddf73117bbf Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 6 Sep 2012 14:34:58 +0200 Subject: [PATCH 500/769] Update ms2 and oRTP submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 18a6f4d86..0e62557bf 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 18a6f4d8629593125cc7b707f5fdad1462b2dcd9 +Subproject commit 0e62557bfedcb090b10c81697a41d6f1b3a85e1e diff --git a/oRTP b/oRTP index 3d41a5c30..efe109e84 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 3d41a5c307868cb2898d4fee24ad575c565b1ae9 +Subproject commit efe109e844b4049b5184d1246a42d83260529b94 From 180327c15fef603c8f2edff46ffe4cd61f199364 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 7 Sep 2012 08:56:47 +0200 Subject: [PATCH 501/769] Calculate ICE gathering time to adapt call params on edge network. --- coreapi/linphonecall.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 9192a84b7..da2a461e0 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1781,10 +1781,15 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ break; } } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { + int ping_time = -1; if (evd->info.ice_processing_successful==TRUE) { ice_session_compute_candidates_foundations(call->ice_session); ice_session_eliminate_redundant_candidates(call->ice_session); ice_session_choose_default_candidates(call->ice_session); + ping_time = ice_session_gathering_duration(call->ice_session); + if (ping_time >=0) { + ping_time /= ice_session_nb_check_lists(call->ice_session); + } } else { ms_warning("No STUN answer from [%s], disabling ICE",linphone_core_get_stun_server(call->core)); linphone_call_delete_ice_session(call); @@ -1797,10 +1802,16 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_start_accept_call_update(call->core, call); break; case LinphoneCallOutgoingInit: + if (ping_time >= 0) { + linphone_core_adapt_to_network(call->core, ping_time, &call->params); + } linphone_call_stop_media_streams(call); linphone_core_proceed_with_invite_if_ready(call->core, call, NULL); break; default: + if (ping_time >= 0) { + linphone_core_adapt_to_network(call->core, ping_time, &call->params); + } linphone_call_stop_media_streams(call); linphone_core_notify_incoming_call(call->core, call); break; From 5d93e79c71ef1bb6912b6e98ec60a51e0a5e89e9 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 7 Sep 2012 09:08:18 +0200 Subject: [PATCH 502/769] Update ms2 and oRTP submodules for ICE gathering duration calculation. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 0e62557bf..3078bac7e 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0e62557bfedcb090b10c81697a41d6f1b3a85e1e +Subproject commit 3078bac7ee1a234900b152f1f21aceb0f6a55645 diff --git a/oRTP b/oRTP index efe109e84..fe897fd4c 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit efe109e844b4049b5184d1246a42d83260529b94 +Subproject commit fe897fd4c6d96a211b3a4ae4f9005b03144d1a66 From 62ce92ff69c6920bbd71c4b4276fd5b4a843b3d2 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 7 Sep 2012 11:11:18 +0200 Subject: [PATCH 503/769] Exposed setContactParameters method in JNI --- coreapi/linphonecore_jni.cc | 5 +++++ java/common/org/linphone/core/LinphoneProxyConfig.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 194626111..f27ad0270 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -955,6 +955,11 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getProxy(JNIEn return NULL; } } +extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactParameters(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jparams) { + const char* params = env->GetStringUTFChars(jparams, NULL); + linphone_proxy_config_set_contact_parameters((LinphoneProxyConfig*)proxyCfg, params); + env->ReleaseStringUTFChars(jparams, params); +} extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) { if (jroute != NULL) { const char* route = env->GetStringUTFChars(jroute, NULL); diff --git a/java/common/org/linphone/core/LinphoneProxyConfig.java b/java/common/org/linphone/core/LinphoneProxyConfig.java index 666fa75a4..bf2907d26 100644 --- a/java/common/org/linphone/core/LinphoneProxyConfig.java +++ b/java/common/org/linphone/core/LinphoneProxyConfig.java @@ -133,4 +133,10 @@ public interface LinphoneProxyConfig { * @param delay expiration time in seconds */ void setExpires(int delay); + + /** + * Sets parameters for the contact + * @param parameters to add + */ + public void setContactParameters(String params); } From 4e5a4d36f1601f1383c20fce84bf84e5fa13d2b6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 7 Sep 2012 11:13:49 +0200 Subject: [PATCH 504/769] Sending regId to flexisip using proxyconfig contact params --- LinphoneProxyConfigImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index cf5b3a304..0b7aa7f6e 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -75,7 +75,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native int setRoute(long ptr,String uri); private native void enablePublish(long ptr,boolean enable); private native boolean publishEnabled(long ptr); - + private native void setContactParameters(long ptr, String params); public void enableRegister(boolean value) { enableRegister(nativePtr,value); @@ -143,4 +143,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public boolean publishEnabled() { return publishEnabled(nativePtr); } + @Override + public void setContactParameters(String params) { + setContactParameters(nativePtr, params); + } } From f815b0d5aaec61743302a1a5c48f62abe8224948 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 7 Sep 2012 13:04:27 +0200 Subject: [PATCH 505/769] remove adherence from Sal to liblinphone, improve notification of failed messageso --- coreapi/callbacks.c | 25 ++++++++++++++++++++++++- coreapi/chat.c | 6 ++++-- coreapi/private.h | 2 +- coreapi/sal.h | 8 ++++++++ coreapi/sal_eXosip2.c | 35 ++++++++++++++++++----------------- gtk/chat.c | 8 +++++++- 6 files changed, 62 insertions(+), 22 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 161aaab24..cd20cf6b9 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -801,6 +801,28 @@ static void notify_refer(SalOp *op, SalReferStatus status){ } } +static LinphoneChatMessageState chatStatusSal2Linphone(SalTextDeliveryStatus status){ + switch(status){ + case SalTextDeliveryInProgress: + return LinphoneChatMessageStateInProgress; + case SalTextDeliveryDone: + return LinphoneChatMessageStateDelivered; + case SalTextDeliveryFailed: + return LinphoneChatMessageStateNotDelivered; + } + return LinphoneChatMessageStateIdle; +} + +static void text_delivery_update(SalOp *op, SalTextDeliveryStatus status){ + LinphoneChatMessage *chat_msg=(LinphoneChatMessage* )sal_op_get_user_pointer(op); + if (chat_msg && chat_msg->cb) { + chat_msg->cb(chat_msg + ,chatStatusSal2Linphone(status) + ,chat_msg->cb_ud); + } + linphone_chat_message_destroy(chat_msg); +} + SalCallbacks linphone_sal_callbacks={ call_received, call_ringing, @@ -818,12 +840,13 @@ SalCallbacks linphone_sal_callbacks={ dtmf_received, refer_received, text_received, + text_delivery_update, notify, notify_presence, notify_refer, subscribe_received, subscribe_closed, - ping_reply + ping_reply, }; diff --git a/coreapi/chat.c b/coreapi/chat.c index 3d336dbcd..758293067 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -136,10 +136,12 @@ LinphoneChatMessage* linphone_chat_room_create_message(const LinphoneChatRoom *c msg->message=ms_strdup(message); return msg; } + void linphone_chat_message_destroy(LinphoneChatMessage* msg) { - if (msg->message) ms_free((void*)msg->message); - ms_free((void*)msg); + if (msg->message) ms_free(msg->message); + ms_free(msg); } + void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangeCb status_cb,void* ud) { msg->cb=status_cb; msg->cb_ud=ud; diff --git a/coreapi/private.h b/coreapi/private.h index 2bf643d47..6affd1599 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -91,7 +91,7 @@ typedef struct _CallCallbackObj static const int linphone_call_magic=0x3343; struct _LinphoneChatMessage { - const char* message; + char* message; LinphoneChatRoom* chat_room; LinphoneChatMessageStateChangeCb cb; void* cb_ud; diff --git a/coreapi/sal.h b/coreapi/sal.h index 8faa11375..e12cdaf0c 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -253,6 +253,12 @@ typedef enum SalSubscribeStatus{ SalSubscribeTerminated }SalSubscribeStatus; +typedef enum SalTextDeliveryStatus{ + SalTextDeliveryInProgress, + SalTextDeliveryDone, + SalTextDeliveryFailed +}SalTextDeliveryStatus; + typedef void (*SalOnCallReceived)(SalOp *op); typedef void (*SalOnCallRinging)(SalOp *op); typedef void (*SalOnCallAccepted)(SalOp *op); @@ -269,6 +275,7 @@ typedef void (*SalOnVfuRequest)(SalOp *op); typedef void (*SalOnDtmfReceived)(SalOp *op, char dtmf); typedef void (*SalOnRefer)(Sal *sal, SalOp *op, const char *referto); typedef void (*SalOnTextReceived)(Sal *sal, const char *from, const char *msg); +typedef void (*SalOnTextDeliveryUpdate)(SalOp *op, SalTextDeliveryStatus status); typedef void (*SalOnNotify)(SalOp *op, const char *from, const char *event); typedef void (*SalOnNotifyRefer)(SalOp *op, SalReferStatus state); typedef void (*SalOnNotifyPresence)(SalOp *op, SalSubscribeStatus ss, SalPresenceStatus status, const char *msg); @@ -293,6 +300,7 @@ typedef struct SalCallbacks{ SalOnDtmfReceived dtmf_received; SalOnRefer refer_received; SalOnTextReceived text_received; + SalOnTextDeliveryUpdate text_delivery_update; SalOnNotify notify; SalOnNotifyPresence notify_presence; SalOnNotifyRefer notify_refer; diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 447ce34eb..d3ce16929 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #include "sal_eXosip2.h" -#include "private.h" #include "offeranswer.h" #ifdef ANDROID @@ -98,12 +97,12 @@ static void sal_remove_register(Sal *sal, int rid){ } } -static SalOp * sal_find_other(Sal *sal, osip_message_t *response){ +static SalOp * sal_find_other(Sal *sal, osip_message_t *message){ const MSList *elem; SalOp *op; - osip_call_id_t *callid=osip_message_get_call_id(response); + osip_call_id_t *callid=osip_message_get_call_id(message); if (callid==NULL) { - ms_error("There is no call-id in this response !"); + ms_error("There is no call-id in this message !"); return NULL; } for(elem=sal->other_transactions;elem!=NULL;elem=elem->next){ @@ -931,9 +930,9 @@ void sal_op_authenticate(SalOp *h, const SalAuthInfo *info){ } void sal_op_cancel_authentication(SalOp *h) { if (h->rid >0) { - sal_op_get_sal(h)->callbacks.register_failure(h,SalErrorFailure, SalReasonForbidden,_("Authentication failure")); + sal_op_get_sal(h)->callbacks.register_failure(h,SalErrorFailure, SalReasonForbidden,"Authentication failure"); } else if (h->cid >0) { - sal_op_get_sal(h)->callbacks.call_failure(h,SalErrorFailure, SalReasonForbidden,_("Authentication failure"),0); + sal_op_get_sal(h)->callbacks.call_failure(h,SalErrorFailure, SalReasonForbidden,"Authentication failure",0); } else { ms_warning("Auth failure not handled"); } @@ -999,6 +998,7 @@ static SalOp *find_op(Sal *sal, eXosip_event_t *ev){ return sal_find_in_subscribe(sal,ev->nid); } if (ev->response) return sal_find_other(sal,ev->response); + else if (ev->request) return sal_find_other(sal,ev->request); return NULL; } @@ -1953,7 +1953,6 @@ static bool_t registration_failure(Sal *sal, eXosip_event_t *ev){ static void other_request_reply(Sal *sal,eXosip_event_t *ev){ SalOp *op=find_op(sal,ev); - LinphoneChatMessage* chat_msg; if (op==NULL){ ms_warning("other_request_reply(): Receiving response to unknown request."); return; @@ -1963,16 +1962,18 @@ static void other_request_reply(Sal *sal,eXosip_event_t *ev){ update_contact_from_response(op,ev->response); if (ev->request && strcmp(osip_message_get_method(ev->request),"OPTIONS")==0) sal->callbacks.ping_reply(op); - else if (ev->request && strcmp(osip_message_get_method(ev->request),"MESSAGE")==0) { - /*out of call message acknolegment*/ - chat_msg=(LinphoneChatMessage* )op->base.user_pointer; - if (chat_msg->cb) { - chat_msg->cb(chat_msg - ,(ev->response->status_code==200?LinphoneChatMessageStateDelivered:LinphoneChatMessageStateNotDelivered) - ,chat_msg->cb_ud); + } + if (ev->request && strcmp(osip_message_get_method(ev->request),"MESSAGE")==0) { + /*out of call message acknolegment*/ + SalTextDeliveryStatus status=SalTextDeliveryFailed; + if (ev->response){ + if (ev->response->status_code<200){ + status=SalTextDeliveryInProgress; + }else if (ev->response->status_code<300 && ev->response->status_code>=200){ + status=SalTextDeliveryDone; } - linphone_chat_message_destroy(chat_msg); } + sal->callbacks.text_delivery_update(op,status); } } @@ -2081,8 +2082,8 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){ if (ev->response && (ev->response->status_code == 407 || ev->response->status_code == 401)){ return process_authentication(sal,ev); } - case EXOSIP_SUBSCRIPTION_SERVERFAILURE: - case EXOSIP_SUBSCRIPTION_GLOBALFAILURE: + case EXOSIP_SUBSCRIPTION_SERVERFAILURE: + case EXOSIP_SUBSCRIPTION_GLOBALFAILURE: sal_exosip_subscription_closed(sal,ev); break; case EXOSIP_REGISTRATION_FAILURE: diff --git a/gtk/chat.c b/gtk/chat.c index 4138f6722..cb866a92f 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -90,6 +90,10 @@ const char* linphone_gtk_get_used_identity(){ else return linphone_core_get_primary_contact(lc); } +static void on_chat_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state, void *user_pointer){ + g_message("chat message state is %s",linphone_chat_message_state_to_string(state)); +} + void linphone_gtk_send_text(GtkWidget *button){ GtkWidget *w=gtk_widget_get_toplevel(button); GtkWidget *entry=linphone_gtk_get_widget(w,"text_entry"); @@ -97,10 +101,12 @@ void linphone_gtk_send_text(GtkWidget *button){ const gchar *entered; entered=gtk_entry_get_text(GTK_ENTRY(entry)); if (strlen(entered)>0) { + LinphoneChatMessage *msg; linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")), linphone_gtk_get_used_identity(), entered,TRUE); - linphone_chat_room_send_message(cr,entered); + msg=linphone_chat_room_create_message(cr,entered); + linphone_chat_room_send_message2(cr,msg,on_chat_state_changed,NULL); gtk_entry_set_text(GTK_ENTRY(entry),""); } } From 2c7cc3a261764fa65a31d177cba6c31b7ae249fd Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Mon, 10 Sep 2012 11:12:53 +0200 Subject: [PATCH 506/769] implement chat notification on Linux --- gtk/chat.c | 14 ++++++++++++-- gtk/linphone.h | 1 + gtk/main.c | 4 +++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gtk/chat.c b/gtk/chat.c index cb866a92f..aa1e7dff6 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -112,14 +112,24 @@ void linphone_gtk_send_text(GtkWidget *button){ } void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){ - GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(room); + GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(room); if (w==NULL){ w=linphone_gtk_init_chatroom(room,linphone_address_as_string_uri_only(from)); + g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(FALSE)); } #ifdef HAVE_GTK_OSX - /* Notify when a new message is send */ + /* Notified when a new message is sent */ linphone_gtk_status_icon_set_blinking(TRUE); + #else + if (!gtk_window_is_active((GtkWindow*)w)){ + if(!GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"is_notified"))){ + linphone_gtk_notify(NULL,message); + g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(TRUE)); + } + } else { + g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(FALSE)); + } #endif linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")), diff --git a/gtk/linphone.h b/gtk/linphone.h index f817969f7..97a4400c7 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -98,6 +98,7 @@ void * linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, c void linphone_gtk_show_directory_search(void); void linphone_gtk_status_icon_set_blinking(gboolean val); +void linphone_gtk_notify(LinphoneCall *call, const char *msg); /*functions controlling the different views*/ gboolean linphone_gtk_use_in_call_view(); diff --git a/gtk/main.c b/gtk/main.c index 2085e3d20..193803256 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1029,18 +1029,20 @@ static void make_notification(const char *title, const char *body){ #endif -static void linphone_gtk_notify(LinphoneCall *call, const char *msg){ +void linphone_gtk_notify(LinphoneCall *call, const char *msg){ #ifdef HAVE_NOTIFY if (!notify_is_initted()) if (!notify_init ("Linphone")) ms_error("Libnotify failed to init."); #endif if (!call) { + #ifdef HAVE_NOTIFY if (!notify_notification_show(notify_notification_new("Linphone",msg,NULL #ifdef HAVE_NOTIFY1 ,NULL #endif ),NULL)) + ms_error("Failed to send notification."); #else linphone_gtk_show_main_window(); From 1d4943a5ab805daeca6c73a161d6df1035160aef Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 10 Sep 2012 14:21:05 +0200 Subject: [PATCH 507/769] Update ms2 and oRTP submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 3078bac7e..5003efb68 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3078bac7ee1a234900b152f1f21aceb0f6a55645 +Subproject commit 5003efb6866d0482680a49a5101258d3aa5ebaba diff --git a/oRTP b/oRTP index fe897fd4c..cf067f6e6 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit fe897fd4c6d96a211b3a4ae4f9005b03144d1a66 +Subproject commit cf067f6e6f7509cd2576a4ac4e89b47ab9296495 From c8be820dad8cba85af0521043e88d649a31af236 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 10 Sep 2012 14:21:41 +0200 Subject: [PATCH 508/769] Link with the two splitted mediastreamer2 libraries. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index eae637b84..6e68f7ba1 100644 --- a/configure.ac +++ b/configure.ac @@ -502,7 +502,7 @@ AS_CASE($enable_external_mediastreamer, AC_CONFIG_SUBDIRS( mediastreamer2 ) MEDIASTREAMER_DIR=${top_srcdir}/mediastreamer2 MEDIASTREAMER_CFLAGS="-I\$(top_srcdir)/mediastreamer2/include" - MEDIASTREAMER_LIBS="\$(top_builddir)/mediastreamer2/src/libmediastreamer.la" + MEDIASTREAMER_LIBS="\$(top_builddir)/mediastreamer2/src/libmediastreamer_base.la \$(top_builddir)/mediastreamer2/src/libmediastreamer_voip.la" dnl need to temporary change quotes to allow square brackets changequote(<<, >>) MS2_VERSION=`grep -e '^.C_INIT(' $MEDIASTREAMER_DIR/configure.ac | sed -e 's:\([^(]\+\)(\[mediastreamer\],\[\(.*\)\]):\2:g'` From e4505317065b76a89665bd1bf07a66ee3972d771 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 10 Sep 2012 16:14:29 +0200 Subject: [PATCH 509/769] save contact parameters --- coreapi/proxy.c | 5 +++++ oRTP | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 47fe08bdd..ba9c0d752 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -740,6 +740,9 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC if (obj->reg_identity!=NULL){ lp_config_set_string(config,key,"reg_identity",obj->reg_identity); } + if (obj->contact_params!=NULL){ + lp_config_set_string(config,key,"contact_params",obj->contact_params); + } lp_config_set_int(config,key,"reg_expires",obj->expires); lp_config_set_int(config,key,"reg_sendregister",obj->reg_sendregister); lp_config_set_int(config,key,"publish",obj->publish); @@ -774,6 +777,8 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config tmp=lp_config_get_string(config,key,"reg_route",NULL); if (tmp!=NULL) linphone_proxy_config_set_route(cfg,tmp); + linphone_proxy_config_set_contact_parameters(cfg,lp_config_get_string(config,key,"contact_parameters",NULL)); + linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",DEFAULT_INT(config,reg_expires,600))); linphone_proxy_config_enableregister(cfg,lp_config_get_int(config,key,"reg_sendregister",0)); diff --git a/oRTP b/oRTP index cf067f6e6..385f742c5 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit cf067f6e6f7509cd2576a4ac4e89b47ab9296495 +Subproject commit 385f742c579e443862ee30cfbcd691a0a6a5e145 From 5501bf70155a9f073abee16e30391d60242e8c64 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 10 Sep 2012 17:20:27 +0200 Subject: [PATCH 510/769] Update ms2. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 5003efb68..e110f7668 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5003efb6866d0482680a49a5101258d3aa5ebaba +Subproject commit e110f7668c8d4afa52cf15a372e35cd996f72053 From c5f1290f25bf45a3871a02385af0fd6afeafba44 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 10 Sep 2012 21:25:21 +0200 Subject: [PATCH 511/769] fix config storage for ptimes (was not consistent) --- coreapi/linphonecall.c | 2 +- coreapi/linphonecore.c | 4 ++-- coreapi/private.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index da2a461e0..41b39cb8b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -223,7 +223,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li if (call->params.down_ptime) md->streams[0].ptime=call->params.down_ptime; else - md->streams[0].ptime=lc->net_conf.down_ptime; + md->streams[0].ptime=linphone_core_get_download_ptime(lc); l=make_codec_list(lc,lc->codecs_conf.audio_codecs,call->params.audio_bw,&md->streams[0].max_rate); pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event")); l=ms_list_append(l,pt); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e4f35e387..f8a33de57 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -967,14 +967,14 @@ int linphone_core_get_upload_bandwidth(const LinphoneCore *lc){ * Set audio packetization time linphone expects to receive from peer */ void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime) { - lc->net_conf.down_ptime=ptime; + lp_config_set_int(lc->config,"rtp","download_ptime",ptime); } /** * Get audio packetization time linphone expects to receive from peer */ int linphone_core_get_download_ptime(LinphoneCore *lc) { - return lc->net_conf.down_ptime; + return lp_config_get_int(lc->config,"rtp","download_ptime",0); } /** diff --git a/coreapi/private.h b/coreapi/private.h index 6affd1599..7fbc6d8cb 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -409,7 +409,6 @@ typedef struct net_config int upload_bw; int firewall_policy; int mtu; - int down_ptime; bool_t nat_sdp_only; }net_config_t; From 3e7882dabf2b486f60d5e0516c50ce195ebd0ac5 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 11 Sep 2012 11:05:03 +0200 Subject: [PATCH 512/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e110f7668..d52aa7726 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e110f7668c8d4afa52cf15a372e35cd996f72053 +Subproject commit d52aa7726ce5d11ea31ebd538ec1903790bbcbb6 From 742476710838e2799f336174dda666b4362fe066 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 11 Sep 2012 15:01:41 +0200 Subject: [PATCH 513/769] Update ms2 and oRTP submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index d52aa7726..a26e2588b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d52aa7726ce5d11ea31ebd538ec1903790bbcbb6 +Subproject commit a26e2588b64e6ad57da944f661758154c170250c diff --git a/oRTP b/oRTP index 385f742c5..4934d1de8 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 385f742c579e443862ee30cfbcd691a0a6a5e145 +Subproject commit 4934d1de87717914042bbed8445a33c192d9d1ef From 0eb64837704f796702869a5272ee80005cb1955d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 11 Sep 2012 15:16:44 +0200 Subject: [PATCH 514/769] Update ms2. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index a26e2588b..c6f2baffe 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a26e2588b64e6ad57da944f661758154c170250c +Subproject commit c6f2baffe88cae29cd846b95269c37b736626fab From c9d11c06b497c52581bc6bc1e18d1aec3e3d133a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 12 Sep 2012 10:44:45 +0200 Subject: [PATCH 515/769] Add missing include. --- coreapi/sal_eXosip2_sdp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 2b439c000..050a53a76 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "ortp/port.h" #include "ortp/b64.h" #include "ortp/ortp_srtp.h" #include "sal.h" From ce2057ac43fd9833225a3cfa374dc700c6e905b3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 12 Sep 2012 10:46:01 +0200 Subject: [PATCH 516/769] Update ms2 and oRTP submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index c6f2baffe..506462c5c 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c6f2baffe88cae29cd846b95269c37b736626fab +Subproject commit 506462c5c2043c595fd85a02506a824aa56839d2 diff --git a/oRTP b/oRTP index 4934d1de8..409c83fb5 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 4934d1de87717914042bbed8445a33c192d9d1ef +Subproject commit 409c83fb5216a641062fdc4934c4b81cb6e00c96 From 55c123625840c0c5fcd120711b672e625ad40b1d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 12 Sep 2012 11:37:05 +0200 Subject: [PATCH 517/769] Update ms2 and oRTP submodules one more time. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 506462c5c..85dee1377 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 506462c5c2043c595fd85a02506a824aa56839d2 +Subproject commit 85dee13777a3c62ec25d144b9fbd598c79495a48 diff --git a/oRTP b/oRTP index 409c83fb5..6a31e56e1 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 409c83fb5216a641062fdc4934c4b81cb6e00c96 +Subproject commit 6a31e56e1f32f8ca82592e1f4301cd799a9751ea From 76c56b7eb717c41b822ef4aca8f84b2cf0ea5832 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 12 Sep 2012 16:35:30 +0200 Subject: [PATCH 518/769] callback notif text delivered JNI --- coreapi/chat.c | 9 ++- coreapi/linphonecore.h | 3 +- coreapi/linphonecore_jni.cc | 59 ++++++++++++++++++- .../linphone/core/LinphoneChatMessage.java | 9 +++ .../org/linphone/core/LinphoneChatRoom.java | 10 +++- 5 files changed, 85 insertions(+), 5 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 758293067..ddc3f5bfc 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -119,6 +119,13 @@ void linphone_core_text_received(LinphoneCore *lc, const char *from, const char ms_free(cleanfrom); } +LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr){ + return cr->lc; +} + +LinphoneChatRoom* linphone_chat_message_get_chat_room(LinphoneChatMessage *msg){ + return msg->chat_room; +} void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud){ cr->user_data=ud; @@ -169,4 +176,4 @@ void linphone_chat_message_set_user_data(LinphoneChatMessage* message,void* ud) */ void* linphone_chat_message_get_user_data(const LinphoneChatMessage* message) { return message->message_userdata; -} \ No newline at end of file +} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 7a1d27f09..da55604d1 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -669,7 +669,8 @@ typedef void (*LinphoneChatMessageStateChangeCb)(LinphoneChatMessage* msg,Linpho * @param ud user data for the status cb. */ void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangeCb status_cb,void* ud); - +LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr); +LinphoneChatRoom* linphone_chat_message_get_chat_room(LinphoneChatMessage *msg); void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud); void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index f27ad0270..9d30dc33d 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -132,6 +132,9 @@ public: callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State")); callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;"); + chatMessageStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatMessage$State")); + chatMessageStateFromIntId = env->GetStaticMethodID(chatMessageStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneChatMessage$State;"); + /*callEncryption(LinphoneCore lc, LinphoneCall call, boolean encrypted,String auth_token);*/ callEncryptionChangedId=env->GetMethodID(listenerClass,"callEncryptionChanged","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;ZLjava/lang/String;)V"); @@ -176,6 +179,7 @@ public: env->DeleteGlobalRef(globalStateClass); env->DeleteGlobalRef(registrationStateClass); env->DeleteGlobalRef(callStateClass); + env->DeleteGlobalRef(chatMessageStateClass); env->DeleteGlobalRef(proxyClass); env->DeleteGlobalRef(callClass); env->DeleteGlobalRef(chatRoomClass); @@ -204,6 +208,9 @@ public: jmethodID callStateId; jmethodID callStateFromIntId; + jclass chatMessageStateClass; + jmethodID chatMessageStateFromIntId; + jmethodID callEncryptionChangedId; jclass ecCalibratorStatusClass; @@ -1358,16 +1365,64 @@ extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEn ,jlong ptr) { return (long) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr); } +extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatMessage(JNIEnv* env + ,jobject thiz + ,jlong ptr + ,jstring jmessage) { + const char* message = env->GetStringUTFChars(jmessage, NULL); + LinphoneChatMessage *chatMessage = linphone_chat_room_create_message((LinphoneChatRoom *)ptr, message); + env->ReleaseStringUTFChars(jmessage, message); + + return (jlong) chatMessage; +} +extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setUserData(JNIEnv* env + ,jobject thiz + ,jlong ptr + ) { + jobject ud = env->NewGlobalRef(thiz); + linphone_chat_message_set_user_data((LinphoneChatMessage*)ptr,(void*) ud); +} extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv* env ,jobject thiz ,jlong ptr ,jstring jmessage) { const char* message = env->GetStringUTFChars(jmessage, NULL); - linphone_chat_room_send_message((LinphoneChatRoom*)ptr,message); + linphone_chat_room_send_message((LinphoneChatRoom*)ptr, message); env->ReleaseStringUTFChars(jmessage, message); - } +static void chat_room_impl_callback(LinphoneChatMessage* msg, LinphoneChatMessageState state, void* ud) { + JNIEnv *env = 0; + jint result = jvm->AttachCurrentThread(&env,NULL); + if (result != 0) { + ms_error("cannot attach VM\n"); + return; + } + + jobject listener = (jobject) ud; + jclass clazz = (jclass) env->GetObjectClass(listener); + jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageStateChanged","(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneChatMessage$State;)V"); + + LinphoneCore *lc = linphone_chat_room_get_lc(linphone_chat_message_get_chat_room(msg)); + LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc); + env->CallVoidMethod( + listener, + method, + (jobject)linphone_chat_message_get_user_data(msg), + env->CallStaticObjectMethod(lcData->chatMessageStateClass,lcData->chatMessageStateFromIntId,(jint)state)); + + if (state == LinphoneChatMessageStateDelivered || state == LinphoneChatMessageStateNotDelivered) { + env->DeleteGlobalRef(listener); + } +} +extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage2(JNIEnv* env + ,jobject thiz + ,jlong ptr + ,jlong jmessage + ,jobject jlistener) { + jobject listener = env->NewGlobalRef(jlistener); + linphone_chat_room_send_message2((LinphoneChatRoom*)ptr, (LinphoneChatMessage*)jmessage, chat_room_impl_callback, (void*)listener); +} extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv* env ,jobject thiz ,jlong lc diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index 77238d270..5e107619f 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -8,6 +8,7 @@ public interface LinphoneChatMessage { void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state); } static class State { + @SuppressWarnings("rawtypes") static private Vector values = new Vector(); private final int mValue; public final int value() {return mValue;} @@ -30,6 +31,7 @@ public interface LinphoneChatMessage { */ public final static State NotDelivered = new State(3,"NotDelivered"); + @SuppressWarnings("unchecked") private State(int value,String stringValue) { mValue = value; values.addElement(this); @@ -47,7 +49,14 @@ public interface LinphoneChatMessage { public String toString() { return mStringValue; } + public int toInt() { + return mValue; + } } + + long getNativePtr(); + Object getUserData(); + void setUserData(); } diff --git a/java/common/org/linphone/core/LinphoneChatRoom.java b/java/common/org/linphone/core/LinphoneChatRoom.java index 8c85b64bc..102a03c21 100644 --- a/java/common/org/linphone/core/LinphoneChatRoom.java +++ b/java/common/org/linphone/core/LinphoneChatRoom.java @@ -39,11 +39,19 @@ public interface LinphoneChatRoom { * Send a message to peer member of this chat room. * @param chat message */ - void sendMessage(LinphoneChatMessage msg, LinphoneChatMessage.StateListener listener); + void sendMessage(LinphoneChatMessage message, LinphoneChatMessage.StateListener listener); /** * DEPRECATED * @param opaque * @param message */ void sendMessage(Object opaque, String message); + + /** + * Create a LinphoneChatMessage + * @param chatRoom chat room associated to the message + * @param message message to send + * @return LinphoneChatMessage object + */ + LinphoneChatMessage createLinphoneChatMessage(String message); } From 328c83b51c47cde5f4fec74e2556194097ed22d4 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 12 Sep 2012 16:45:59 +0200 Subject: [PATCH 519/769] GetMessage method for linphoneChatMessage --- coreapi/chat.c | 5 +++++ coreapi/linphonecore.h | 1 + coreapi/linphonecore_jni.cc | 9 +++++++-- java/common/org/linphone/core/LinphoneChatMessage.java | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index ddc3f5bfc..72cb42ce5 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -165,6 +165,11 @@ const char* linphone_chat_message_state_to_string(const LinphoneChatMessageState } } + +char* linphone_chat_message_get_message(LinphoneChatMessage* msg) { + return msg->message; +} + /** * user pointer set function */ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index da55604d1..0fb87e9c7 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -671,6 +671,7 @@ typedef void (*LinphoneChatMessageStateChangeCb)(LinphoneChatMessage* msg,Linpho void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangeCb status_cb,void* ud); LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr); LinphoneChatRoom* linphone_chat_message_get_chat_room(LinphoneChatMessage *msg); +char* linphone_chat_message_get_message(LinphoneChatMessage *msg); void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud); void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 9d30dc33d..57fd81e96 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1377,11 +1377,16 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatM } extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setUserData(JNIEnv* env ,jobject thiz - ,jlong ptr - ) { + ,jlong ptr) { jobject ud = env->NewGlobalRef(thiz); linphone_chat_message_set_user_data((LinphoneChatMessage*)ptr,(void*) ud); } +extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getMessage(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + jstring jvalue =env->NewStringUTF(linphone_chat_message_get_message((LinphoneChatMessage*)ptr)); + return jvalue; +} extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv* env ,jobject thiz ,jlong ptr diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index 5e107619f..31f8c122a 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -59,4 +59,6 @@ public interface LinphoneChatMessage { Object getUserData(); void setUserData(); + + String getMessage(); } From d74083cfaa2d757ab16588490c1844b090687f18 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 12 Sep 2012 16:56:12 +0200 Subject: [PATCH 520/769] GetPeerAdress added to LinphoneChatMessage --- coreapi/chat.c | 4 ++++ coreapi/linphonecore.h | 1 + coreapi/linphonecore_jni.cc | 5 +++++ .../org/linphone/core/LinphoneChatMessage.java | 12 ++++++++++++ 4 files changed, 22 insertions(+) diff --git a/coreapi/chat.c b/coreapi/chat.c index 72cb42ce5..cc36d7305 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -170,6 +170,10 @@ char* linphone_chat_message_get_message(LinphoneChatMessage* msg) { return msg->message; } +const LinphoneAddress* linphone_chat_message_get_peer_address(LinphoneChatMessage *msg) { + return linphone_chat_room_get_peer_address(msg->chat_room); +} + /** * user pointer set function */ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 0fb87e9c7..d4a0355b6 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -672,6 +672,7 @@ void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr); LinphoneChatRoom* linphone_chat_message_get_chat_room(LinphoneChatMessage *msg); char* linphone_chat_message_get_message(LinphoneChatMessage *msg); +const LinphoneAddress* linphone_chat_message_get_peer_address(LinphoneChatMessage *msg); void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud); void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 57fd81e96..4d95af693 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1387,6 +1387,11 @@ extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getMessage(JNI jstring jvalue =env->NewStringUTF(linphone_chat_message_get_message((LinphoneChatMessage*)ptr)); return jvalue; } +extern "C" long Java_org_linphone_core_LinphoneChatMessageImpl_getPeerAddress(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + return (long) linphone_chat_message_get_peer_address((LinphoneChatMessage*)ptr); +} extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv* env ,jobject thiz ,jlong ptr diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index 31f8c122a..726a8690e 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -60,5 +60,17 @@ public interface LinphoneChatMessage { void setUserData(); + /** + * get text associated to this LinphoneChatMessage + * + * @return text sent along with the message + */ String getMessage(); + + /** + * get peer address associated to this LinphoneChatMessage + * + * @return LinphoneAddress peer address + */ + LinphoneAddress getPeerAddress(); } From 8fc61e182ceb71ed50ff9ec327cbf932ee67fd51 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 12 Sep 2012 18:09:11 +0200 Subject: [PATCH 521/769] Display if chat message delivered or not --- LinphoneChatMessageImpl.java | 38 ++++++++++++++++++++++++++++++++++++ LinphoneChatRoomImpl.java | 11 +++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 LinphoneChatMessageImpl.java diff --git a/LinphoneChatMessageImpl.java b/LinphoneChatMessageImpl.java new file mode 100644 index 000000000..a6c54e10d --- /dev/null +++ b/LinphoneChatMessageImpl.java @@ -0,0 +1,38 @@ +package org.linphone.core; + +public class LinphoneChatMessageImpl implements LinphoneChatMessage { + protected final long nativePtr; + private native void setUserData(long ptr); + private native String getMessage(long ptr); + private native LinphoneAddress getPeerAddress(long ptr); + + protected LinphoneChatMessageImpl(long aNativePtr) { + nativePtr = aNativePtr; + setUserData(); + } + + public long getNativePtr() { + return nativePtr; + } + + @Override + public Object getUserData() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setUserData() { + setUserData(nativePtr); + } + + @Override + public String getMessage() { + return getMessage(nativePtr); + } + + @Override + public LinphoneAddress getPeerAddress() { + return getPeerAddress(nativePtr); + } +} diff --git a/LinphoneChatRoomImpl.java b/LinphoneChatRoomImpl.java index 3513f3283..806e8b68a 100644 --- a/LinphoneChatRoomImpl.java +++ b/LinphoneChatRoomImpl.java @@ -22,8 +22,10 @@ import org.linphone.core.LinphoneChatMessage.StateListener; class LinphoneChatRoomImpl implements LinphoneChatRoom { protected final long nativePtr; + private native long createLinphoneChatMessage(long ptr, String message); private native long getPeerAddress(long ptr); private native void sendMessage(long ptr, String message); + private native void sendMessage2(long ptr, long message, StateListener listener); protected LinphoneChatRoomImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -36,9 +38,10 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { public void sendMessage(String message) { sendMessage(nativePtr,message); } + @Override - public void sendMessage(LinphoneChatMessage msg, StateListener listener) { - // TODO To be implemened + public void sendMessage(LinphoneChatMessage message, StateListener listener) { + sendMessage2(nativePtr, message.getNativePtr(), listener); } @Override @@ -46,4 +49,8 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { // ignore, deprecated. } + @Override + public LinphoneChatMessage createLinphoneChatMessage(String message) { + return new LinphoneChatMessageImpl(createLinphoneChatMessage(nativePtr, message)); + } } From e0249febe75b7a31c211ee28a534018bd9c3dfcd Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 12 Sep 2012 18:13:30 +0200 Subject: [PATCH 522/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 85dee1377..d0aa4891f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 85dee13777a3c62ec25d144b9fbd598c79495a48 +Subproject commit d0aa4891f2a21f2a8f4171a213ad2c1faa83e25a From da4114607f0d080efb9bcee2fa0dbcc94a2f0d17 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 12 Sep 2012 21:17:29 +0200 Subject: [PATCH 523/769] Updated Android build, fixing LINPHONE_VIDEO=0 issue --- build/android/Android-no-neon.mk | 2 ++ build/android/Android.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/build/android/Android-no-neon.mk b/build/android/Android-no-neon.mk index 3d72ffc55..d0c87b4f8 100644 --- a/build/android/Android-no-neon.mk +++ b/build/android/Android-no-neon.mk @@ -26,11 +26,13 @@ include $(CLEAR_VARS) include $(linphone-root-dir)/submodules/linphone/build/android/common.mk +ifeq ($(LINPHONE_VIDEO),1) LOCAL_SHARED_LIBRARIES += \ libavcodecnoneon \ libswscale \ libavcore \ libavutil +endif LOCAL_MODULE := liblinphonenoneon ifeq ($(TARGET_ARCH_ABI),armeabi) diff --git a/build/android/Android.mk b/build/android/Android.mk index 549367611..b46664b61 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -26,11 +26,13 @@ include $(CLEAR_VARS) include $(linphone-root-dir)/submodules/linphone/build/android/common.mk +ifeq ($(LINPHONE_VIDEO),1) LOCAL_SHARED_LIBRARIES += \ libavcodec \ libswscale \ libavcore \ libavutil +endif LOCAL_MODULE := liblinphone From c2e7592a2a349104ed2aa4121e1e4d44633a0908 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 12 Sep 2012 22:25:51 +0200 Subject: [PATCH 524/769] store playback gain as a float (not a char) --- coreapi/private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/private.h b/coreapi/private.h index 7fbc6d8cb..3042342d2 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -421,10 +421,10 @@ typedef struct sound_config struct _MSSndCard * lsd_card; /* dummy playback card for Linphone Sound Daemon extension */ const char **cards; int latency; /* latency in samples of the current used sound device */ + float soft_play_lev; /*playback gain in db.*/ char rec_lev; char play_lev; char ring_lev; - char soft_play_lev; char source; char *local_ring; char *remote_ring; From e6b68c893c172f040826dc0856495cbd52802709 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 12 Sep 2012 22:59:54 +0200 Subject: [PATCH 525/769] deprecate LinphoneCore.adjustSoftareVolume(), because it does the same as setPlaybackGain()o --- LinphoneCoreImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 80dcaa48e..8a870cc0e 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -93,7 +93,6 @@ class LinphoneCoreImpl implements LinphoneCore { private native int getSignalingTransportPort(long nativePtr, int code); private native void setSignalingTransportPorts(long nativePtr, int udp, int tcp, int tls); private native void enableIpv6(long nativePtr,boolean enable); - private native void adjustSoftwareVolume(long nativePtr,int db); private native int pauseCall(long nativePtr, long callPtr); private native int pauseAllCalls(long nativePtr); private native int resumeCall(long nativePtr, long callPtr); @@ -474,7 +473,7 @@ class LinphoneCoreImpl implements LinphoneCore { enableIpv6(nativePtr,enable); } public synchronized void adjustSoftwareVolume(int i) { - adjustSoftwareVolume(nativePtr, i); + //deprecated, does the same as setPlaybackGain(). } public synchronized boolean pauseCall(LinphoneCall call) { From 7d2844a0c16f9c1505802d273f030016bb23226c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 13 Sep 2012 14:54:38 +0200 Subject: [PATCH 526/769] maximum time spent in linphone_core_refresh_registers for iOS. --- coreapi/sal_eXosip2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index d3ce16929..695d8568d 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -2222,12 +2222,26 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){ int sal_register_refresh(SalOp *op, int expires){ osip_message_t *msg=NULL; const char *contact=sal_op_get_contact(op); - + int tries=0; + if (op->rid==-1){ ms_error("Unexistant registration context, not possible to refresh."); return -1; } +#ifdef HAVE_EXOSIP_TRYLOCK + /*iOS hack: in the keep alive handler, we have no more than 10 seconds to refresh registers, otherwise the application is suspended forever. + * In order to prevent this case that can occur when the exosip thread is busy with DNS while network isn't in a good shape, we try to take + * the exosip lock in a non blocking way, and give up if it takes too long*/ + while (eXosip_trylock()!=0){ + ms_usleep(100000); + if (tries>30) {/*after 3 seconds, give up*/ + ms_warning("Could not obtain exosip lock in a reasonable time, giving up."); + return -1; + } + } +#else eXosip_lock(); +#endif eXosip_register_build_register(op->rid,expires,&msg); if (msg!=NULL){ if (contact) register_set_contact(msg,contact); From cb0fe631e18ad86f37739afeef5c2d6c60231421 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 13 Sep 2012 15:16:48 +0200 Subject: [PATCH 527/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index d0aa4891f..84dfa4d69 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d0aa4891f2a21f2a8f4171a213ad2c1faa83e25a +Subproject commit 84dfa4d69e62c2545fc4ad30561c03a6a1ad2701 From 8004607607c344a0f1dd09d1854848fca0e52d59 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 13 Sep 2012 17:42:54 +0200 Subject: [PATCH 528/769] add support of external-body for SIP message --- coreapi/callbacks.c | 8 +++- coreapi/chat.c | 76 ++++++++++++++++++++++++++++++---- coreapi/linphonecore.h | 65 ++++++++++++++++++++++++++--- coreapi/private.h | 4 +- coreapi/sal.h | 3 ++ coreapi/sal_eXosip2.c | 33 ++++++++++++++- coreapi/sal_eXosip2_presence.c | 14 ++++--- 7 files changed, 179 insertions(+), 24 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index cd20cf6b9..14ca748e1 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -732,9 +732,12 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ static void text_received(Sal *sal, const char *from, const char *msg){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal); - linphone_core_text_received(lc,from,msg); + linphone_core_message_received(lc,from,msg,NULL); +} +void message_external_body_received(Sal *sal, const char *from, const char *url) { + LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal); + linphone_core_message_received(lc,from,NULL,url); } - static void notify(SalOp *op, const char *from, const char *msg){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer (op); @@ -840,6 +843,7 @@ SalCallbacks linphone_sal_callbacks={ dtmf_received, refer_received, text_received, + message_external_body_received, text_delivery_update, notify, notify_presence, diff --git a/coreapi/chat.c b/coreapi/chat.c index cc36d7305..941cce423 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -55,6 +55,7 @@ static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatM const char *identity=linphone_core_find_best_identity(cr->lc,cr->peer_url,&route); SalOp *op=NULL; LinphoneCall *call; + char* content_type; if((call = linphone_core_get_call_by_remote_address(cr->lc,cr->peer))!=NULL){ if (call->state==LinphoneCallConnected || call->state==LinphoneCallStreamsRunning || @@ -77,7 +78,15 @@ static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatM cr->op=op; sal_op_set_user_pointer(op, msg); /*if out of call, directly store msg*/ } - sal_text_send(op,identity,cr->peer,msg->message); + if (msg->external_body_url) { + content_type=ms_strdup_printf("message/external-body; access-type=URL; URL=\"%s\"",msg->external_body_url); + sal_message_send(op,identity,cr->peer,content_type,NULL); + ms_free(content_type); + } else { + sal_text_send(op, identity, cr->peer, msg->message); + } + + } void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg) { @@ -89,16 +98,20 @@ bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, const LinphoneAddress *f return FALSE; } -void linphone_chat_room_text_received(LinphoneChatRoom *cr, LinphoneCore *lc, const LinphoneAddress *from, const char *msg){ - if (lc->vtable.text_received!=NULL) lc->vtable.text_received(lc, cr, from, msg); +void linphone_chat_room_message_received(LinphoneChatRoom *cr, LinphoneCore *lc, LinphoneChatMessage *msg){ + if (msg->message) + //legacy API + if (lc->vtable.text_received!=NULL) lc->vtable.text_received(lc, cr, msg->from, msg->message); + if (lc->vtable.message_received!=NULL) lc->vtable.message_received(lc, cr,msg); + } -void linphone_core_text_received(LinphoneCore *lc, const char *from, const char *msg){ +void linphone_core_message_received(LinphoneCore *lc, const char *from, const char *raw_msg,const char* external_url){ MSList *elem; LinphoneChatRoom *cr=NULL; LinphoneAddress *addr; char *cleanfrom; - + LinphoneChatMessage* msg; addr=linphone_address_new(from); linphone_address_clean(addr); for(elem=lc->chatrooms;elem!=NULL;elem=ms_list_next(elem)){ @@ -113,9 +126,13 @@ void linphone_core_text_received(LinphoneCore *lc, const char *from, const char /* create a new chat room */ cr=linphone_core_create_chat_room(lc,cleanfrom); } - + msg = linphone_chat_room_create_message(cr, raw_msg); + linphone_chat_message_set_from(msg, cr->peer_url); + if (external_url) { + linphone_chat_message_set_external_body_url(msg, external_url); + } linphone_address_destroy(addr); - linphone_chat_room_text_received(cr,lc,cr->peer_url,msg); + linphone_chat_room_message_received(cr,lc,msg); ms_free(cleanfrom); } @@ -140,12 +157,14 @@ const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) LinphoneChatMessage* linphone_chat_room_create_message(const LinphoneChatRoom *cr,const char* message) { LinphoneChatMessage* msg = ms_new0(LinphoneChatMessage,1); msg->chat_room=(LinphoneChatRoom*)cr; - msg->message=ms_strdup(message); + msg->message=message?ms_strdup(message):NULL; return msg; } void linphone_chat_message_destroy(LinphoneChatMessage* msg) { if (msg->message) ms_free(msg->message); + if (msg->external_body_url) ms_free(msg->external_body_url); + if (msg->from) linphone_address_destroy(msg->from); ms_free(msg); } @@ -186,3 +205,44 @@ void linphone_chat_message_set_user_data(LinphoneChatMessage* message,void* ud) void* linphone_chat_message_get_user_data(const LinphoneChatMessage* message) { return message->message_userdata; } + +const char* linphone_chat_message_get_external_body_url(const LinphoneChatMessage* message) { + return message->external_body_url; +} + +void linphone_chat_message_set_external_body_url(LinphoneChatMessage* message,const char* url) { + if (message->external_body_url) { + ms_free(message->external_body_url); + } + message->external_body_url=url?ms_strdup(url):NULL; +} +void linphone_chat_message_set_from(LinphoneChatMessage* message, const LinphoneAddress* from) { + if(message->from) linphone_address_destroy(message->from); + message->from=linphone_address_clone(from); + +} +LinphoneAddress* linphone_chat_message_get_from(const LinphoneChatMessage* message) { + return message->from; +} +const char * linphone_chat_message_get_text(const LinphoneChatMessage* message) { + return message->message; +} +LinphoneChatMessage* linphone_chat_message_clone(const LinphoneChatMessage* msg) { + /*struct _LinphoneChatMessage { + char* message; + LinphoneChatRoom* chat_room; + LinphoneChatMessageStateChangeCb cb; + void* cb_ud; + void* message_userdata; + char* external_body_url; + LinphoneAddress* from; + };*/ + LinphoneChatMessage* new_message = linphone_chat_room_create_message(msg->chat_room,msg->message); + if (msg->external_body_url) new_message->external_body_url=ms_strdup(msg->external_body_url); + new_message->cb=msg->cb; + new_message->cb_ud=msg->cb_ud; + new_message->message_userdata=msg->message_userdata; + new_message->cb=msg->cb; + if (msg->from) new_message->from=linphone_address_clone(msg->from); + return new_message; +} \ No newline at end of file diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d4a0355b6..009648be3 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -617,7 +617,6 @@ void linphone_chat_room_destroy(LinphoneChatRoom *cr); */ LinphoneChatMessage* linphone_chat_room_create_message(const LinphoneChatRoom *cr,const char* message); - /** * get peer address \link linphone_core_create_chat_room() associated to \endlink this #LinphoneChatRoom @@ -641,18 +640,61 @@ typedef enum _LinphoneChatMessageStates { LinphoneChatMessageStateNotDelivered /** message was not delivered*/ }LinphoneChatMessageState; + /** * to string function */ const char* linphone_chat_message_state_to_string(const LinphoneChatMessageState state); + +/** + * clone a chat message + *@param message #LinphoneChatMessage obj + *@return #LinphoneChatMessage + */ +LinphoneChatMessage* linphone_chat_message_clone(const LinphoneChatMessage* message); +/** + * set origine of the message + *@param message #LinphoneChatMessage obj + *@param from #LinphoneAddress origin of this message (copied) + */ +void linphone_chat_message_set_from(LinphoneChatMessage* message, const LinphoneAddress* from); + +/** + * get origine of the message + *@param message #LinphoneChatMessage obj + *@return #LinphoneAddress + */ +LinphoneAddress* linphone_chat_message_get_from(const LinphoneChatMessage* message); + +/** + * Linphone message can carry external body as defined by rfc2017 + * @param message #LinphoneChatMessage + * @return return external body url null if not present. + */ +const char* linphone_chat_message_get_external_body_url(const LinphoneChatMessage* message); + +/** + * Linphone message can carry external body as defined by rfc2017 + * + * @param #LinphoneChatMessage + * @param url ex: access-type=URL; URL="http://www.foo.com/file" + */ +void linphone_chat_message_set_external_body_url(LinphoneChatMessage* message,const char* url); + +/** + * get text part of this message + *@return text or NULL if no text. + */ +const char * linphone_chat_message_get_text(const LinphoneChatMessage* message); +/** + * user pointer get function + */ + +void* linphone_chat_message_get_user_data(const LinphoneChatMessage* message); /** * user pointer set function */ void linphone_chat_message_set_user_data(LinphoneChatMessage* message,void*); -/** - * user pointer get function - */ -void* linphone_chat_message_get_user_data(const LinphoneChatMessage* message); /** * Call back used to notify message delivery status @@ -744,6 +786,7 @@ typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, c typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl); /** * Callback prototype + * @deprecated use #MessageReceived instead. * * @param lc #LinphoneCore object * @param room #LinphoneChatRoom involved in this conversation. Can be be created by the framework in case \link #LinphoneAddress the from \endlink is not present in any chat room. @@ -751,6 +794,15 @@ typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog * @param message incoming message * */ typedef void (*TextMessageReceived)(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message); +/** + * Chat message callback prototype + * + * @param lc #LinphoneCore object + * @param room #LinphoneChatRoom involved in this conversation. Can be be created by the framework in case \link #LinphoneAddress the from \endlink is not present in any chat room. + * @param LinphoneChatMessage incoming message + * */ +typedef void (*MessageReceived)(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message); + /** Callback prototype */ typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int dtmf); /** Callback prototype */ @@ -774,7 +826,8 @@ typedef struct _LinphoneVTable{ NewSubscribtionRequestCb new_subscription_request; /**< Notify about pending subscription request */ AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */ CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */ - TextMessageReceived text_received; /**< A text message has been received */ + TextMessageReceived text_received; /** @deprecated, use #message_received instead
A text message has been received */ + MessageReceived message_received; /** a message is received, can be text or external body*/ DtmfReceived dtmf_received; /**< A dtmf has been received received */ ReferReceived refer_received; /**< An out of call refer was received */ CallEncryptionChangedCb call_encryption_changed; /**callbacks.text_received=(SalOnTextReceived)unimplemented_stub; if (ctx->callbacks.ping_reply==NULL) ctx->callbacks.ping_reply=(SalOnPingReply)unimplemented_stub; + if (ctx->callbacks.message_external_body==NULL) + ctx->callbacks.message_external_body=(SalOnMessageExternalBodyReceived)unimplemented_stub; } int sal_unlisten_ports(Sal *ctx){ @@ -1701,15 +1703,44 @@ static bool_t comes_from_local_if(osip_message_t *msg){ static void text_received(Sal *sal, eXosip_event_t *ev){ osip_body_t *body=NULL; char *from=NULL,*msg; + osip_content_type_t* content_type; + osip_uri_param_t* external_body_url; + char unquoted_external_body_url [256]; + int external_body_size=0; + content_type= osip_message_get_content_type(ev->request); + if (!content_type) { + ms_error("Could not get message because no content type"); + return; + } + osip_from_to_str(ev->request->from,&from); + if (content_type->type + && strcmp(content_type->type, "text")==0 + && content_type->subtype + && strcmp(content_type->subtype, "plain")==0 ) { osip_message_get_body(ev->request,0,&body); if (body==NULL){ ms_error("Could not get text message from SIP body"); return; } msg=body->body; - osip_from_to_str(ev->request->from,&from); sal->callbacks.text_received(sal,from,msg); + } if (content_type->type + && strcmp(content_type->type, "message")==0 + && content_type->subtype + && strcmp(content_type->subtype, "external-body")==0 ) { + + osip_content_type_param_get_byname(content_type, "URL", &external_body_url); + /*remove both first and last character*/ + strncpy(unquoted_external_body_url + ,&external_body_url->gvalue[1] + ,external_body_size=MIN(strlen(external_body_url->gvalue)-1,sizeof(unquoted_external_body_url))); + unquoted_external_body_url[external_body_size-1]='\0'; + sal->callbacks.message_external_body(sal,from,unquoted_external_body_url); + + } else { + ms_warning("Unsupported content type [%s/%s]",content_type->type,content_type->subtype); + } osip_free(from); } diff --git a/coreapi/sal_eXosip2_presence.c b/coreapi/sal_eXosip2_presence.c index f79866a0a..3559081db 100644 --- a/coreapi/sal_eXosip2_presence.c +++ b/coreapi/sal_eXosip2_presence.c @@ -81,7 +81,7 @@ void sal_remove_in_subscribe(Sal *sal, SalOp *op){ sal->in_subscribes=ms_list_remove(sal->in_subscribes,op); } -int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg){ +int sal_message_send(SalOp *op, const char *from, const char *to, const char* content_type, const char *msg){ osip_message_t *sip=NULL; if(op->cid == -1) @@ -97,8 +97,8 @@ int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg){ eXosip_message_build_request(&sip,"MESSAGE",sal_op_get_to(op), sal_op_get_from(op),sal_op_get_route(op)); if (sip!=NULL){ - osip_message_set_content_type(sip,"text/plain"); - osip_message_set_body(sip,msg,strlen(msg)); + osip_message_set_content_type(sip,content_type); + if (msg) osip_message_set_body(sip,msg,strlen(msg)); sal_add_other(op->base.root,op,sip); eXosip_message_send_request(sip); }else{ @@ -118,14 +118,16 @@ int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg){ eXosip_unlock(); return -1; } - osip_message_set_content_type(sip,"text/plain"); - osip_message_set_body(sip,msg,strlen(msg)); + osip_message_set_content_type(sip,content_type); + if (msg) osip_message_set_body(sip,msg,strlen(msg)); eXosip_call_send_request(op->did,sip); eXosip_unlock(); } return 0; } - +int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg) { + return sal_message_send(op,from,to,"text/plain",msg); +} /*presence Subscribe/notify*/ int sal_subscribe_presence(SalOp *op, const char *from, const char *to){ osip_message_t *msg=NULL; From b1db37d06eb5167a3efe97ab273abdbdf33087e0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 14 Sep 2012 09:59:27 +0200 Subject: [PATCH 529/769] Update ms2 and oRTP submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 84dfa4d69..a457709df 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 84dfa4d69e62c2545fc4ad30561c03a6a1ad2701 +Subproject commit a457709df8daa72544fc36283c0053c4f09d0249 diff --git a/oRTP b/oRTP index 6a31e56e1..cbe444a60 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 6a31e56e1f32f8ca82592e1f4301cd799a9751ea +Subproject commit cbe444a6098346311b412a5723190107e77d9c42 From 4d943c9bcc0c7739d51f19722c9754551d2ae3fe Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 14 Sep 2012 15:54:30 +0200 Subject: [PATCH 530/769] Updated JNI for LinphoneChatMessage --- coreapi/linphonecore_jni.cc | 38 +++++++++++++++++++ .../linphone/core/LinphoneChatMessage.java | 14 +++++++ .../linphone/core/LinphoneCoreListener.java | 11 +++++- 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 4d95af693..224c26503 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -109,6 +109,7 @@ public: vTable.call_state_changed = callStateChange; vTable.call_encryption_changed = callEncryptionChange; vTable.text_received = text_received; + vTable.message_received = message_received; vTable.new_subscription_request = new_subscription_request; vTable.notify_presence_recv = notify_presence_recv; @@ -158,6 +159,9 @@ public: callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl")); callCtrId = env->GetMethodID(callClass,"", "(J)V"); + chatMessageClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatMessageImpl")); + chatMessageCtrId = env->GetMethodID(chatMessageClass,"", "(J)V"); + chatRoomClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatRoomImpl")); chatRoomCtrId = env->GetMethodID(chatRoomClass,"", "(J)V"); @@ -182,6 +186,7 @@ public: env->DeleteGlobalRef(chatMessageStateClass); env->DeleteGlobalRef(proxyClass); env->DeleteGlobalRef(callClass); + env->DeleteGlobalRef(chatMessageClass); env->DeleteGlobalRef(chatRoomClass); env->DeleteGlobalRef(friendClass); @@ -195,6 +200,7 @@ public: jmethodID newSubscriptionRequestId; jmethodID notifyPresenceReceivedId; jmethodID textReceivedId; + jmethodID messageReceivedId; jclass globalStateClass; jmethodID globalStateId; @@ -223,6 +229,9 @@ public: jclass callClass; jmethodID callCtrId; + jclass chatMessageClass; + jmethodID chatMessageCtrId; + jclass chatRoomClass; jmethodID chatRoomCtrId; @@ -380,6 +389,21 @@ public: ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from) ,message ? env->NewStringUTF(message) : NULL); } + static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const LinphoneChatMessage *msg) { + JNIEnv *env = 0; + jint result = jvm->AttachCurrentThread(&env,NULL); + if (result != 0) { + ms_error("cannot attach VM\n"); + return; + } + LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc); + env->CallVoidMethod(lcData->listener + ,lcData->messageReceivedId + ,lcData->core + ,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room) + ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from) + ,env->NewObject(lcData->chatMessageClass,lcData->chatMessageCtrId,(jlong)msg)); + } static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) { JNIEnv *env = 0; jint result = jvm->AttachCurrentThread(&env,NULL); @@ -1387,6 +1411,20 @@ extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getMessage(JNI jstring jvalue =env->NewStringUTF(linphone_chat_message_get_message((LinphoneChatMessage*)ptr)); return jvalue; } +extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getExternalBodyUrl(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + jstring jvalue =env->NewStringUTF(linphone_chat_message_get_external_body_url((LinphoneChatMessage*)ptr)); + return jvalue; +} +extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setExternalBodyUrl(JNIEnv* env + ,jobject thiz + ,jlong ptr + ,jstring jurl) { + const char* url = env->GetStringUTFChars(jurl, NULL); + linphone_chat_message_set_external_body_url((LinphoneChatMessage *)ptr, url); + env->ReleaseStringUTFChars(jurl, url); +} extern "C" long Java_org_linphone_core_LinphoneChatMessageImpl_getPeerAddress(JNIEnv* env ,jobject thiz ,jlong ptr) { diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index 726a8690e..3b135fc65 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -73,4 +73,18 @@ public interface LinphoneChatMessage { * @return LinphoneAddress peer address */ LinphoneAddress getPeerAddress(); + + /** + * Linphone message can carry external body as defined by rfc2017 + * @param message #LinphoneChatMessage + * @return return external body url null if not present. + */ + String getExternalBodyUrl(); + + /** + * Linphone message can carry external body as defined by rfc2017 + * @param #LinphoneChatMessage + * @param url ex: access-type=URL; URL="http://www.foo.com/file" + */ + void setExternalBodyUrl(String url); } diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index 400e942c3..ab9dd1ac3 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -93,7 +93,16 @@ public interface LinphoneCoreListener { * @param from LinphoneAddress from * @param message incoming message */ - void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message); + void textReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, String message); + + /** + * invoked when a new linphone chat message is received + * @param lc LinphoneCore + * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. + * @param from LinphoneAddress from + * @param message incoming linphone chat message message + */ + void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, LinphoneChatMessage message); /** * Invoked when echo cancalation calibration is completed From 417d5d93e096c20ddf60da895682e412a779b572 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 14 Sep 2012 16:20:02 +0200 Subject: [PATCH 531/769] Fix JNI compil --- coreapi/linphonecore_jni.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 224c26503..440afcbc6 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -152,6 +152,7 @@ public: /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/ textReceivedId = env->GetMethodID(listenerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V"); + messageReceivedId = env->GetMethodID(listenerClass,"messageReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Lorg/linphone/core/LinphoneChatMessage;)V"); proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl")); proxyCtrId = env->GetMethodID(proxyClass,"", "(J)V"); @@ -389,7 +390,7 @@ public: ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from) ,message ? env->NewStringUTF(message) : NULL); } - static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const LinphoneChatMessage *msg) { + static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) { JNIEnv *env = 0; jint result = jvm->AttachCurrentThread(&env,NULL); if (result != 0) { @@ -401,7 +402,7 @@ public: ,lcData->messageReceivedId ,lcData->core ,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room) - ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from) + ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)msg->from) ,env->NewObject(lcData->chatMessageClass,lcData->chatMessageCtrId,(jlong)msg)); } static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) { From d676eb51df61e1b69c46980cc519ac63ba176e53 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 14 Sep 2012 17:38:18 +0200 Subject: [PATCH 532/769] implement dscp settings from config file and gtk interface --- coreapi/linphonecall.c | 4 +- coreapi/linphonecore.c | 72 +++++++++++++++++ coreapi/linphonecore.h | 9 +++ coreapi/lpconfig.c | 14 +++- coreapi/lpconfig.h | 8 ++ coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 8 ++ coreapi/sal_eXosip2.h | 1 + gtk/Makefile.am | 3 +- gtk/dscp_settings.ui | 178 +++++++++++++++++++++++++++++++++++++++++ gtk/parameters.ui | 93 +++++++++++++-------- gtk/propertybox.c | 52 ++++++++++++ 12 files changed, 407 insertions(+), 36 deletions(-) create mode 100644 gtk/dscp_settings.ui diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 41b39cb8b..5962badd3 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -974,7 +974,7 @@ void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, Lin void linphone_call_init_audio_stream(LinphoneCall *call){ LinphoneCore *lc=call->core; AudioStream *audiostream; - int dscp=lp_config_get_int(lc->config,"rtp","audio_dscp",-1); + int dscp=linphone_core_get_audio_dscp(lc); call->audiostream=audiostream=audio_stream_new(call->audio_port,call->audio_port+1,linphone_core_ipv6_enabled(lc)); if (dscp!=-1) @@ -1028,7 +1028,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){ if ((lc->video_conf.display || lc->video_conf.capture) && call->params.has_video){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); - int dscp=lp_config_get_int(lc->config,"rtp","video_dscp",-1); + int dscp=linphone_core_get_video_dscp(lc); call->videostream=video_stream_new(call->video_port,call->video_port+1,linphone_core_ipv6_enabled(lc)); if (dscp!=-1) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f8a33de57..6d81d8b71 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -615,6 +615,7 @@ static void sip_config_read(LinphoneCore *lc) sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period); sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0)); sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1)); + sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc)); } static void rtp_config_read(LinphoneCore *lc) @@ -5112,3 +5113,74 @@ void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) const char* linphone_core_get_device_identifier(const LinphoneCore *lc) { return lc->device_id; } + +/** + * Set the DSCP field for SIP signaling channel. + * + * @ingroup network_parameters + * * The DSCP defines the quality of service in IP packets. + * +**/ +void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp){ + sal_set_dscp(lc->sal,dscp); + if (linphone_core_ready(lc)) + lp_config_set_int_hex(lc->config,"sip","dscp",dscp); +} + +/** + * Get the DSCP field for SIP signaling channel. + * + * @ingroup network_parameters + * * The DSCP defines the quality of service in IP packets. + * +**/ +int linphone_core_get_sip_dscp(const LinphoneCore *lc){ + return lp_config_get_int(lc->config,"sip","dscp",0x1a); +} + +/** + * Set the DSCP field for outgoing audio streams. + * + * @ingroup network_parameters + * The DSCP defines the quality of service in IP packets. + * +**/ +void linphone_core_set_audio_dscp(LinphoneCore *lc, int dscp){ + if (linphone_core_ready(lc)) + lp_config_set_int_hex(lc->config,"rtp","audio_dscp",dscp); +} + +/** + * Get the DSCP field for outgoing audio streams. + * + * @ingroup network_parameters + * The DSCP defines the quality of service in IP packets. + * +**/ +int linphone_core_get_audio_dscp(const LinphoneCore *lc){ + return lp_config_get_int(lc->config,"rtp","audio_dscp",0x2e); +} + +/** + * Set the DSCP field for outgoing video streams. + * + * @ingroup network_parameters + * The DSCP defines the quality of service in IP packets. + * +**/ +void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp){ + if (linphone_core_ready(lc)) + lp_config_set_int_hex(lc->config,"rtp","video_dscp",dscp); + +} + +/** + * Get the DSCP field for outgoing video streams. + * + * @ingroup network_parameters + * The DSCP defines the quality of service in IP packets. + * +**/ +int linphone_core_get_video_dscp(const LinphoneCore *lc){ + return lp_config_get_int(lc->config,"rtp","video_dscp",0x2e); +} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 009648be3..ef24f2c78 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1389,6 +1389,15 @@ LinphoneTunnel *linphone_core_get_tunnel(LinphoneCore *lc); void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy); +void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp); +int linphone_core_get_sip_dscp(const LinphoneCore *lc); + +void linphone_core_set_audio_dscp(LinphoneCore *lc, int dscp); +int linphone_core_get_audio_dscp(const LinphoneCore *lc); + +void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp); +int linphone_core_get_video_dscp(const LinphoneCore *lc); + #ifdef __cplusplus } #endif diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 4cd7202cc..0efdc335e 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -273,7 +273,13 @@ const char *lp_config_get_string(LpConfig *lpconfig, const char *section, const int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, int default_value){ const char *str=lp_config_get_string(lpconfig,section,key,NULL); - if (str!=NULL) return atoi(str); + if (str!=NULL) { + int ret=0; + if (strstr(str,"0x")==str){ + sscanf(str,"%x",&ret); + }else ret=atoi(str); + return ret; + } else return default_value; } @@ -324,6 +330,12 @@ void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key, lp_config_set_string(lpconfig,section,key,tmp); } +void lp_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value){ + char tmp[30]; + snprintf(tmp,sizeof(tmp),"0x%x",value); + lp_config_set_string(lpconfig,section,key,tmp); +} + void lp_config_set_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t value){ char tmp[30]; snprintf(tmp,sizeof(tmp),"%lli",(long long)value); diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index c1821d2aa..a27f7e39a 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -96,6 +96,14 @@ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *ke * @ingroup misc **/ void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key, int value); + +/** + * Sets an integer config item, but store it as hexadecimal + * + * @ingroup misc +**/ +void lp_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value); + /** * Sets a 64 bits integer config item * diff --git a/coreapi/sal.h b/coreapi/sal.h index 9c3f6d61f..751cc6533 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -325,6 +325,7 @@ void sal_auth_info_delete(const SalAuthInfo* auth_info); void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs); int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure); int sal_unlisten_ports(Sal *ctx); +void sal_set_dscp(Sal *ctx, int dscp); int sal_reset_transports(Sal *ctx); ortp_socket_t sal_get_socket(Sal *ctx); void sal_set_user_agent(Sal *ctx, const char *user_agent); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 30b0f286d..821e4ab39 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -283,6 +283,7 @@ Sal * sal_init(){ sal->rootCa = 0; sal->verify_server_certs=TRUE; sal->expire_old_contact=FALSE; + sal->dscp=-1; return sal; } @@ -380,6 +381,12 @@ static void set_tls_options(Sal *ctx){ #endif } +void sal_set_dscp(Sal *ctx, int dscp){ + ctx->dscp=dscp; + if (dscp!=-1) + eXosip_set_option(EXOSIP_OPT_SET_DSCP,&ctx->dscp); +} + int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure){ int err; bool_t ipv6; @@ -406,6 +413,7 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i eXosip_set_option(EXOSIP_OPT_USE_RPORT,&use_rports); int dont_use_101 = !ctx->use_101; // Copy char to int to avoid bad alignment eXosip_set_option(EXOSIP_OPT_DONT_SEND_101,&dont_use_101); + sal_set_dscp(ctx,ctx->dscp); ipv6=strchr(addr,':')!=NULL; eXosip_enable_ipv6(ipv6); diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index ccc95d56a..71463854c 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -41,6 +41,7 @@ struct Sal{ int keepalive_period; void *up; /*user pointer*/ char* rootCa; /* File _or_ folder containing root CA */ + int dscp; bool_t one_matching_codec; bool_t double_reg; bool_t use_rports; diff --git a/gtk/Makefile.am b/gtk/Makefile.am index a4dceba61..ede08b900 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -9,7 +9,8 @@ UI_FILES= about.ui \ log.ui \ buddylookup.ui \ tunnel_config.ui \ - waiting.ui + waiting.ui \ + dscp_settings.ui PIXMAPS= \ stock_people.png diff --git a/gtk/dscp_settings.ui b/gtk/dscp_settings.ui new file mode 100644 index 000000000..4664768c6 --- /dev/null +++ b/gtk/dscp_settings.ui @@ -0,0 +1,178 @@ + + + + + + False + 5 + Dscp settings + True + dialog + + + + True + False + 2 + + + True + False + end + + + gtk-close + True + True + True + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 0 + none + + + True + False + 3 + 2 + True + + + True + True + • + True + False + False + True + True + + + 1 + 2 + + + + + True + True + • + True + False + False + True + True + + + 1 + 2 + 1 + 2 + + + + + True + True + • + True + False + False + True + True + + + 1 + 2 + 2 + 3 + + + + + True + False + SIP + + + + + True + False + Audio RTP stream + + + 1 + 2 + + + + + True + False + Video RTP stream + + + 2 + 3 + + + + + + + True + False + <b>Set DSCP values (in hexadecimal)</b> + True + + + + + False + False + 1 + + + + + + button2 + button1 + + + diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 9fc8538c0..7e76c385f 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -207,10 +207,10 @@ Set Maximum Transmission Unit: - False True True False + False True @@ -247,10 +247,10 @@ Send DTMFs as SIP info - False True True False + False True @@ -263,11 +263,11 @@ Use IPv6 instead of IPv4 - False True True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True @@ -315,7 +315,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 + 6 2 @@ -377,23 +377,24 @@ Tunnel - 4 - 5 + 5 + 6 - edit - False + gtk-edit True True + False + True 1 2 - 4 - 5 + 5 + 6 @@ -462,6 +463,34 @@ 3 + + + True + False + DSCP fields + + + 4 + 5 + + + + + gtk-edit + True + True + True + False + True + + + + 1 + 2 + 4 + 5 + +
@@ -496,10 +525,10 @@ Direct connection to the Internet - False True True False + False True True @@ -517,10 +546,10 @@ Behind NAT / Firewall (specify gateway IP below) - False True True False + False True True no_nat @@ -585,10 +614,10 @@ Behind NAT / Firewall (use STUN to resolve) - False True True False + False True no_nat @@ -602,10 +631,10 @@ Behind NAT / Firewall (use ICE) - False True True False + False True no_nat @@ -743,9 +772,6 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 6 2 - - - True @@ -767,11 +793,11 @@ gtk-media-play - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True @@ -944,10 +970,10 @@ Enable echo cancellation - False True True False + False True @@ -958,6 +984,9 @@ 6 + + + @@ -1293,10 +1322,10 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True True True + False @@ -1340,11 +1369,11 @@ - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1388,11 +1417,11 @@ - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1436,11 +1465,11 @@ - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1484,9 +1513,9 @@ - False True True + False @@ -1573,11 +1602,11 @@ virtual network ! GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1759,11 +1788,11 @@ virtual network ! gtk-go-up - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True @@ -1776,11 +1805,11 @@ virtual network ! gtk-go-down - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True @@ -1792,11 +1821,11 @@ virtual network ! - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1840,11 +1869,11 @@ virtual network ! - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -2007,10 +2036,10 @@ virtual network ! Enable adaptive rate control - False True True False + False 0 True @@ -2162,10 +2191,10 @@ virtual network ! Show advanced settings - False True True False + False True @@ -2242,11 +2271,11 @@ virtual network ! end - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 6870e2786..31c76f93b 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1131,3 +1131,55 @@ void linphone_gtk_tunnel_ok(GtkButton *button){ void linphone_gtk_tunnel_cancel(GtkButton *button){ } + +static void show_dscp(GtkWidget *entry, int val){ + char tmp[20]; + snprintf(tmp,sizeof(tmp),"0x%x",val); + gtk_entry_set_text(GTK_ENTRY(entry),tmp); + +} + +static int read_dscp(GtkWidget *entry){ + const char *val=gtk_entry_get_text(GTK_ENTRY(entry)); + const char *begin; + int ret=0; + if (val==NULL || val[0]=='\0') return 0; + /*skip potential 0x*/ + begin=strstr(val,"0x"); + if (begin) begin+=2; + else begin=val; + if (sscanf(begin,"%x",&ret)==1) + return ret; + return -1; +} + +void linphone_gtk_dscp_edit(){ + LinphoneCore *lc=linphone_gtk_get_core(); + GtkWidget *widget=linphone_gtk_create_window("dscp_settings"); + show_dscp(linphone_gtk_get_widget(widget,"sip_dscp"), + linphone_core_get_sip_dscp(lc)); + show_dscp(linphone_gtk_get_widget(widget,"audio_dscp"), + linphone_core_get_audio_dscp(lc)); + show_dscp(linphone_gtk_get_widget(widget,"video_dscp"), + linphone_core_get_video_dscp(lc)); + gtk_widget_show(widget); +} + +void linphone_gtk_dscp_edit_response(GtkWidget *dialog, guint response_id){ + LinphoneCore *lc=linphone_gtk_get_core(); + switch(response_id){ + case GTK_RESPONSE_OK: + linphone_core_set_sip_dscp(lc, + read_dscp(linphone_gtk_get_widget(dialog,"sip_dscp"))); + linphone_core_set_audio_dscp(lc, + read_dscp(linphone_gtk_get_widget(dialog,"audio_dscp"))); + linphone_core_set_video_dscp(lc, + read_dscp(linphone_gtk_get_widget(dialog,"video_dscp"))); + + break; + default: + break; + } + gtk_widget_destroy(dialog); +} + From efe7222f2efb7eae906b7337925fc080ce9d6b0e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 14 Sep 2012 17:59:57 +0200 Subject: [PATCH 533/769] save stun server and firewall policy immediately --- coreapi/linphonecore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6d81d8b71..42f11820c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3652,6 +3652,8 @@ void linphone_core_set_stun_server(LinphoneCore *lc, const char *server){ if (server) lc->net_conf.stun_server=ms_strdup(server); else lc->net_conf.stun_server=NULL; + if (linphone_core_ready(lc)) + lp_config_set_string(lc->config,"net","stun_server",lc->net_conf.stun_server); } const char * linphone_core_get_stun_server(const LinphoneCore *lc){ @@ -3716,6 +3718,8 @@ const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc) void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol){ lc->net_conf.firewall_policy=pol; if (lc->sip_conf.contact) update_primary_contact(lc); + if (linphone_core_ready(lc)) + lp_config_set_int(lc->config,"net","firewall_policy",pol); } LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc){ @@ -4449,7 +4453,6 @@ void net_config_uninit(LinphoneCore *lc) net_config_t *config=&lc->net_conf; if (config->stun_server!=NULL){ - lp_config_set_string(lc->config,"net","stun_server",config->stun_server); ms_free(lc->net_conf.stun_server); } if (config->nat_address!=NULL){ @@ -4459,7 +4462,6 @@ void net_config_uninit(LinphoneCore *lc) if (lc->net_conf.nat_address_ip !=NULL){ ms_free(lc->net_conf.nat_address_ip); } - lp_config_set_int(lc->config,"net","firewall_policy",config->firewall_policy); lp_config_set_int(lc->config,"net","mtu",config->mtu); } From e41b713dc3fa06515b5b67adf82908ddb251ad65 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 14 Sep 2012 18:26:44 +0200 Subject: [PATCH 534/769] fix compile warning --- coreapi/sal_eXosip2.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 821e4ab39..b09cae4ff 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -2261,21 +2261,23 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){ int sal_register_refresh(SalOp *op, int expires){ osip_message_t *msg=NULL; const char *contact=sal_op_get_contact(op); - int tries=0; if (op->rid==-1){ ms_error("Unexistant registration context, not possible to refresh."); return -1; } #ifdef HAVE_EXOSIP_TRYLOCK - /*iOS hack: in the keep alive handler, we have no more than 10 seconds to refresh registers, otherwise the application is suspended forever. - * In order to prevent this case that can occur when the exosip thread is busy with DNS while network isn't in a good shape, we try to take - * the exosip lock in a non blocking way, and give up if it takes too long*/ - while (eXosip_trylock()!=0){ - ms_usleep(100000); - if (tries>30) {/*after 3 seconds, give up*/ - ms_warning("Could not obtain exosip lock in a reasonable time, giving up."); - return -1; + { + int tries=0; + /*iOS hack: in the keep alive handler, we have no more than 10 seconds to refresh registers, otherwise the application is suspended forever. + * In order to prevent this case that can occur when the exosip thread is busy with DNS while network isn't in a good shape, we try to take + * the exosip lock in a non blocking way, and give up if it takes too long*/ + while (eXosip_trylock()!=0){ + ms_usleep(100000); + if (tries>30) {/*after 3 seconds, give up*/ + ms_warning("Could not obtain exosip lock in a reasonable time, giving up."); + return -1; + } } } #else From 8761f481d535f4cbb21e61b23d8409c3506357a4 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 15 Sep 2012 09:44:32 +0200 Subject: [PATCH 535/769] fix make distcheck --- po/POTFILES.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 01deec29e..ac50ac8aa 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1,4 @@ # List of source files containing translatable strings. -gtk/tunnel_config.ui gtk/calllogs.c gtk/conference.c gtk/logging.c @@ -25,6 +24,8 @@ gtk/loginframe.c [type: gettext/glade]gtk/parameters.ui [type: gettext/glade]gtk/buddylookup.ui [type: gettext/glade]gtk/waiting.ui +[type: gettext/glade]gtk/dscp_settings.ui +[type: gettext/glade]gtk/tunnel_config.ui coreapi/linphonecore.c coreapi/misc.c coreapi/presence.c From 249217a856fffe5c17f046bff6a6021f13d84590 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 13:28:58 +0200 Subject: [PATCH 536/769] add documentation regarding android echo problems in javadoc --- java/common/org/linphone/core/package.html | 84 +++++++++++++++++++++- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/java/common/org/linphone/core/package.html b/java/common/org/linphone/core/package.html index 65e82ddfe..d499e5d60 100644 --- a/java/common/org/linphone/core/package.html +++ b/java/common/org/linphone/core/package.html @@ -41,14 +41,18 @@ Liblinphone is a high level library for bringing SIP video call functionnality i LibLinphone package is organized in submodules. + +

Related Documentation

@@ -189,6 +193,80 @@ from a peer sip uri. System.out.println("Message ["+message+"] received from ["+from+"] "); } + + +

+Sound and echo cancellation settings +

+Sound levels +
+It is possible to tune the microphone input gain and speaker/receiver output gain by setting parameters into the linphonerc factory config file loaded when instanciating the {@link org.linphone.core.LinphoneCore LinphoneCore}. These gains are liblinphone's internal software gains and are unrelated to volume levels managed by the operating system. For example:
+
+[sound]
+#set the speaker or receiver playback gain in dbm0 (0 db = no change). 
+playback_gain_db=-3
+#set the microphone gain in linear scale:
+mic_gain=0.1
+
+
+ +
+ +Echo cancellation +
+On Android devices, echo is a problem, especially with low-end devices. The root cause is the unpredictable latency of Android's sound system. The liblinphone software {@link org.linphone.core.LinphoneCore#enableEchoCancellation echo canceller} that is operating well on desktop platforms (Mac, Linux, Windows) is unable to operate under Android platform. The situation is very heterogenous:
+
    +
  • On new (after 2011) high end devices, manufacturers often include a hardware echo cancellation. If available, liblinphone will make use of it and no software correction is required. + Source file linphone-android/submodules/linphone/mediastreamer2/java/src/org/linphone/mediastream/video/capture/hwconf/Hacks.java contains a method hasBuiltInEchoCanceller() that returns true if an hardware echo canceller is available, based on device model identifier. The current list is incomplete. +
  • +
  • On former models with decent CPU power (armv7), sound system behaves in a nearly predictive way so that it is possible to use {@link org.linphone.core.LinphoneCore#enableEchoLimiter echo limiter}. Echo limiter is a simple echo attenuation technique which consists in strongly attenuating the microphone input when speaker is playing voice, in order to cut the echo. The main drawback of echo limiter is that the conversation is perceived as half duplex by users, because they won't hear background noise from the remote side while they are speaking. +
  • +
  • On low class android devices or very old models (armv5 processor), no solution works. +
  • +
+ +
+In order to benefit from the best echo cancellation solution, we recommend applications to run the following algorithm, when it is run for the first time:
+First of {@link org.linphone.core.LinphoneCore#enableEchoCancellation echo canceller} should not be used, in any case. +
    +
  • Use the Hacks.hasBuiltInEchoCanceller() method to first check if the device has hardware echo canceller. If yes, then echo limiter must be turned off.
  • +
  • If no the hasBuiltInEchoCanceller() returned false, then it is possible to use the echo calibration procedure. If the calibration procedure fails, it means that + probably the phone performs hardware echo cancellation, so in this case echo limiter must be turned off.
  • +
  • If the echo calibration succeeded, then echo is present, so it is recommended to enable echo limiter. +
+ +
+Echo calibration procedure +
+The echo calibration procedure is a five second test which consists in playing small beeps to the speaker while the microphone input is recorded. +If the device is subject to echo (or doesn't have hardware echo cancellation), then beeps recorded by the microphone will be detected and a measurement of echo delay can be computed. +Echo calibration procedure can be started by calling {@link org.linphone.core.LinphoneCore#startEchoCalibration LinphoneCore.startEchoCalibration}. + +

+Echo limiter settings
+Echo limiter requires settings to be defined in linphonerc factory config file for correction operation. +Typical settings are: +
+
+[sound]
+el_type=mic
+#speaker energy threshold (linear scale) above which echo limiter decreases mic gain.
+el_thres=0.03
+#attenuation applied to mic gain (linear scale)
+el_force=100000
+#minimum time in milliseconds during which attenuation is applied
+el_sustain=600
+#double talk detection: threshold of ratio mic-energy/speaker-energy above which mic input is sent anyway.
+el_transmit_thres=1.7
+#noise gate floorgain (gain applied when no voice is detected).
+ng_floorgain=0.01
+
+
+ +Up to date settings must be found from linphone-android/res/raw/linphonerc file. + +
+ \ No newline at end of file From 9f14b4e9ddcf10ddfba0e82fe600c855a9f5c518 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 14:40:35 +0200 Subject: [PATCH 537/769] javadoc fixes --- .../org/linphone/core/LinphoneCall.java | 2 +- .../org/linphone/core/LinphoneCore.java | 8 ++--- .../linphone/core/LinphoneCoreListener.java | 34 +++++++++---------- java/common/org/linphone/core/package.html | 7 +++- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index c42ebb740..6fe6704de 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -21,7 +21,7 @@ package org.linphone.core; import java.util.Vector; /** - * Object representing a Call. calls are created using {@link LinphoneCore#invite(LinphoneAddress)} or passed to the application by listener {@link LinphoneCoreListener#callState(LinphoneCore, LinphoneCall, State, String)} + * Object representing a call. Calls are created using {@link LinphoneCore#invite(LinphoneAddress)} or passed to the application by listener {@link LinphoneCoreListener#callState} * */ diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index dbe5611db..9e2af91b7 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -373,7 +373,7 @@ public interface LinphoneCore { * Accept an incoming call. * * Basically the application is notified of incoming calls within the - * {@link LinphoneCoreListener#inviteReceived(LinphoneCore, String)} listener. + * {@link LinphoneCoreListener#callState} listener method. * The application can later respond positively to the call using * this method. * @throws LinphoneCoreException @@ -384,7 +384,7 @@ public interface LinphoneCore { * Accept an incoming call. * * Basically the application is notified of incoming calls within the - * {@link LinphoneCoreListener#inviteReceived(LinphoneCore, String)} listener. + * {@link LinphoneCoreListener#callState} listener method. * The application can later respond positively to the call using * this method. * @throws LinphoneCoreException @@ -395,7 +395,7 @@ public interface LinphoneCore { * Accept call modifications initiated by other end. * * Basically the application is notified of incoming calls within the - * {@link LinphoneCoreListener#inviteReceived(LinphoneCore, String)} listener. + * {@link LinphoneCoreListener#callState} listener method. * The application can later respond positively to the call using * this method. * @throws LinphoneCoreException @@ -407,7 +407,7 @@ public interface LinphoneCore { * Prevent LinphoneCore from performing an automatic answer * * Basically the application is notified of incoming calls within the - * {@link LinphoneCoreListener#inviteReceived(LinphoneCore, String)} listener. + * {@link LinphoneCoreListener#callState} listener method. * The application can later respond positively to the call using * this method. * @throws LinphoneCoreException diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index ab9dd1ac3..150141ffe 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -24,27 +24,10 @@ package org.linphone.core; *This interface holds all callbacks that the application should implement. None is mandatory. */ public interface LinphoneCoreListener { - - /**< Notifies the application that it should show up - * @return */ - void show(LinphoneCore lc); - /**< Ask the application some authentication information * @return */ void authInfoRequested(LinphoneCore lc,String realm,String username); - /**< Callback that notifies various events with human readable text. - * @return */ - void displayStatus(LinphoneCore lc,String message); - - /**< Callback to display a message to the user - * @return */ - void displayMessage(LinphoneCore lc,String message); - - /** Callback to display a warning to the user - * @return */ - void displayWarning(LinphoneCore lc,String message); - /** General State notification * @param state LinphoneCore.State * @return @@ -121,5 +104,22 @@ public interface LinphoneCoreListener { * */ void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event); + + + /**< @Deprecated Notifies the application that it should show up + * @return */ + void show(LinphoneCore lc); + /**< @Deprecated Callback that notifies various events with human readable text. + * @return */ + void displayStatus(LinphoneCore lc,String message); + + /**< @Deprecated Callback to display a message to the user + * @return */ + void displayMessage(LinphoneCore lc,String message); + + /** @Deprecated Callback to display a warning to the user + * @return */ + void displayWarning(LinphoneCore lc,String message); + } diff --git a/java/common/org/linphone/core/package.html b/java/common/org/linphone/core/package.html index d499e5d60..8371def49 100644 --- a/java/common/org/linphone/core/package.html +++ b/java/common/org/linphone/core/package.html @@ -159,7 +159,12 @@ Any subsequente modifications to {@link org.linphone.core.LinphoneFriend} must b my_friend.enableSubscribes(true); /*disable subscription for this friend*/ my_friend.done(); /*commit changes triggering an UNSUBSCRIBE message*/ - + Do not display status messages +-J Pass directly to the runtime system + +Provided by Standard doclet: +-d Destination directory for output files +-use Publishing presence status
Local presence status can be changed using function {@link org.linphone.core.LinphoneCore#setPresenceInfo }.New status is propagated to all friends {@link org.linphone.core.LinphoneCore#addFriend(LinphoneFriend lf) previously added } to LinphoneCore. From 5a7090ccb0d58a13983c00fb09e50fd7fa1d3461 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 14:50:02 +0200 Subject: [PATCH 538/769] fix parameters not written to config file immediately --- coreapi/linphonecore.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 42f11820c..152ccf80c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3872,6 +3872,8 @@ const LinphoneVideoPolicy *linphone_core_get_video_policy(LinphoneCore *lc){ **/ void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val){ lc->video_conf.show_local=val; + if (linphone_core_ready(lc)) + lp_config_set_int(lc->config,"video","show_local",val); } /** @@ -3897,6 +3899,9 @@ void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val){ if (call && call->videostream){ video_stream_enable_self_view(call->videostream,val); } + if (linphone_core_ready(lc)){ + lp_config_set_int(lc->config,"video","self_view",val); + } #endif } @@ -4529,7 +4534,7 @@ void rtp_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,"rtp","video_jitt_comp_enabled",config->video_adaptive_jitt_comp_enabled); } -void sound_config_uninit(LinphoneCore *lc) +static void sound_config_uninit(LinphoneCore *lc) { sound_config_t *config=&lc->sound_conf; ms_free(config->cards); @@ -4541,13 +4546,11 @@ void sound_config_uninit(LinphoneCore *lc) ms_snd_card_manager_destroy(); } -void video_config_uninit(LinphoneCore *lc) +static void video_config_uninit(LinphoneCore *lc) { lp_config_set_string(lc->config,"video","size",video_size_get_name(linphone_core_get_preferred_video_size(lc))); lp_config_set_int(lc->config,"video","display",lc->video_conf.display); lp_config_set_int(lc->config,"video","capture",lc->video_conf.capture); - lp_config_set_int(lc->config,"video","show_local",linphone_core_video_preview_enabled(lc)); - lp_config_set_int(lc->config,"video","self_view",linphone_core_self_view_enabled(lc)); if (lc->video_conf.cams) ms_free(lc->video_conf.cams); } From c4086e989a6e600d1a1ccbc2ea1b09c0cc71cba5 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 17 Sep 2012 14:46:55 +0200 Subject: [PATCH 539/769] Add ICE state to the call stats. --- coreapi/linphonecall.c | 5 +++++ coreapi/linphonecore.h | 19 +++++++++++++++++++ coreapi/misc.c | 40 ++++++++++++++++++++++++++++++++++++++++ coreapi/private.h | 1 + 4 files changed, 65 insertions(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5962badd3..9243be084 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -324,6 +324,7 @@ void linphone_call_init_stats(LinphoneCallStats *stats, int type) { stats->type = type; stats->received_rtcp = NULL; stats->sent_rtcp = NULL; + stats->ice_state = LinphoneIceStateNotActivated; } static void update_media_description_from_stun(SalMediaDescription *md, const StunCandidate *ac, const StunCandidate *vc){ @@ -1541,6 +1542,8 @@ void linphone_call_delete_ice_session(LinphoneCall *call){ call->ice_session = NULL; if (call->audiostream != NULL) call->audiostream->ice_check_list = NULL; if (call->videostream != NULL) call->videostream->ice_check_list = NULL; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateNotActivated; + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateNotActivated; } } @@ -1766,6 +1769,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ if (ice_session_role(call->ice_session) == IR_Controlling) { ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); + linphone_core_update_ice_state_in_call_stats(call); } break; case IS_Failed: @@ -1774,6 +1778,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ /* At least one ICE session has succeeded, so perform a call update. */ ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); + linphone_core_update_ice_state_in_call_stats(call); } } break; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index ef24f2c78..acf81f1df 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -261,6 +261,24 @@ typedef struct _LinphoneCall LinphoneCall; #define LINPHONE_CALL_STATS_AUDIO 0 #define LINPHONE_CALL_STATS_VIDEO 1 +/** + * Enum describing ICE states. + * @ingroup initializing +**/ +enum _LinphoneIceState{ + LinphoneIceStateNotActivated, /**< ICE has not been activated for this call */ + LinphoneIceStateInProgress, /**< ICE process is in progress */ + LinphoneIceStateHostConnection, /**< ICE has established a direct connection to the remote host */ + LinphoneIceStateReflexiveConnection, /**< ICE has established a connection to the remote host through one or several NATs */ + LinphoneIceStateRelayConnection /**< ICE has established a connection through a relay */ +}; + +/** + * Enum describing Ice states. + * @ingroup initializing +**/ +typedef enum _LinphoneIceState LinphoneIceState; + /** * The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams. * @@ -285,6 +303,7 @@ struct _LinphoneCallStats { mblk_t* received_rtcp; /**audio_port, 1, NULL); ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; if (call->params.has_video && (video_check_list != NULL)) { ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress; } ms_message("ICE: gathering candidate from [%s]",server); @@ -635,6 +637,44 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) return 0; } +void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call) +{ + IceCheckList *audio_check_list; + IceCheckList *video_check_list; + + if (call->ice_session == NULL) return; + audio_check_list = ice_session_check_list(call->ice_session, 0); + video_check_list = ice_session_check_list(call->ice_session, 1); + if (audio_check_list == NULL) return; + + switch (ice_check_list_selected_valid_candidate_type(audio_check_list)) { + case ICT_HostCandidate: + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateHostConnection; + break; + case ICT_ServerReflexiveCandidate: + case ICT_PeerReflexiveCandidate: + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateReflexiveConnection; + break; + case ICT_RelayedCandidate: + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateRelayConnection; + break; + } + if (call->params.has_video && (video_check_list != NULL)) { + switch (ice_check_list_selected_valid_candidate_type(video_check_list)) { + case ICT_HostCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateHostConnection; + break; + case ICT_ServerReflexiveCandidate: + case ICT_PeerReflexiveCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateReflexiveConnection; + break; + case ICT_RelayedCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateRelayConnection; + break; + } + } +} + void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session) { const char *rtp_addr, *rtcp_addr; diff --git a/coreapi/private.h b/coreapi/private.h index f26c6f106..f0b3b2c30 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -241,6 +241,7 @@ typedef struct StunCandidate{ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call, StunCandidate *ac, StunCandidate *vc); void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params); int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); +void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md); From dabbcea87b12e4fd3c31ec7bfd391928798b2192 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 17 Sep 2012 15:11:35 +0200 Subject: [PATCH 540/769] Update ms2 and oRTP submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index a457709df..88b9146cc 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a457709df8daa72544fc36283c0053c4f09d0249 +Subproject commit 88b9146ccbd33c9d8d3317be92078f6211498907 diff --git a/oRTP b/oRTP index cbe444a60..b7c5f78d8 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit cbe444a6098346311b412a5723190107e77d9c42 +Subproject commit b7c5f78d83f8a310ba3700e93174c7eb1234d2d3 From f2789756099a7e82d27b7de9a96606fa6ed73e31 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 15:59:36 +0200 Subject: [PATCH 541/769] deprecate method --- java/common/org/linphone/core/LinphoneCore.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 9e2af91b7..ce476c738 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -677,6 +677,10 @@ public interface LinphoneCore { void startEchoCalibration(Object data) throws LinphoneCoreException; void enableIpv6(boolean enable); + /** + * @deprecated + * @param i + */ void adjustSoftwareVolume(int i); boolean pauseCall(LinphoneCall call); From b70085becb6f6838589d0179172366db6de20069 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 15:57:11 +0200 Subject: [PATCH 542/769] set processing of tunnel udp mirror callback on main thread. --- coreapi/TunnelManager.cc | 68 +++++++++++++++++++++++++++------------ coreapi/TunnelManager.hh | 23 ++++++++++--- coreapi/linphone_tunnel.h | 27 ++++++++++++++-- 3 files changed, 91 insertions(+), 27 deletions(-) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index e3c7e6595..2165a2bf4 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -212,7 +212,6 @@ TunnelManager::TunnelManager(LinphoneCore* lc) :TunnelClientController() mExosipTransport.recvfrom=eXosipRecvfrom; mExosipTransport.sendto=eXosipSendto; mExosipTransport.select=eXosipSelect; - mStateChanged=false; linphone_core_add_iterate_hook(mCore,(LinphoneCoreIterateHook)sOnIterate,this); mTransportFactories.audio_rtcp_func=sCreateRtpTransport; mTransportFactories.audio_rtcp_func_data=this; @@ -242,7 +241,7 @@ void TunnelManager::stopClient(){ } } -void TunnelManager::processTunnelEvent(){ +void TunnelManager::processTunnelEvent(const Event &ev){ LinphoneProxyConfig* lProxy; linphone_core_get_default_proxy(mCore, &lProxy); @@ -325,15 +324,31 @@ void TunnelManager::enable(bool isEnable) { } void TunnelManager::tunnelCallback(bool connected, TunnelManager *zis){ - zis->mStateChanged=true; + Event ev; + ev.mType=TunnelEvent; + ev.mData.mConnected=connected; + zis->postEvent(ev); +} + +void TunnelManager::onIterate(){ + mMutex.lock(); + while(!mEvq.empty()){ + Event ev=mEvq.front(); + mEvq.pop(); + mMutex.unlock(); + if (ev.mType==TunnelEvent) + processTunnelEvent(ev); + else if (ev.mType==UdpMirrorClientEvent){ + processUdpMirrorEvent(ev); + } + mMutex.lock(); + } + mMutex.unlock(); } /*invoked from linphone_core_iterate() */ void TunnelManager::sOnIterate(TunnelManager *zis){ - if (zis->mStateChanged){ - zis->mStateChanged=false; - zis->processTunnelEvent(); - } + zis->onIterate(); } #ifdef ANDROID @@ -374,26 +389,39 @@ void TunnelManager::enableLogs(bool isEnabled,LogHandler logHandler) { bool TunnelManager::isEnabled() { return mEnabled; } -void TunnelManager::UdpMirrorClientListener(bool isUdpAvailable, void* data) { - TunnelManager* thiz = (TunnelManager*)data; - if (isUdpAvailable) { + +void TunnelManager::processUdpMirrorEvent(const Event &ev){ + if (ev.mData.mHaveUdp) { LOGI("Tunnel is not required, disabling"); - thiz->enable(false); - thiz->mAutoDetectStarted = false; + enable(false); + mAutoDetectStarted = false; } else { - if (++thiz->mCurrentUdpMirrorClient !=thiz->mUdpMirrorClients.end()) { - //1 enable tunnable but also try backup server + if (mCurrentUdpMirrorClient !=mUdpMirrorClients.end()) { + // enable tunnel but also try backup server LOGI("Tunnel is required, enabling; Trying backup udp mirror"); - UdpMirrorClient &lUdpMirrorClient=*thiz->mCurrentUdpMirrorClient; - lUdpMirrorClient.start(TunnelManager::UdpMirrorClientListener,(void*)thiz); + UdpMirrorClient &lUdpMirrorClient=*mCurrentUdpMirrorClient; + lUdpMirrorClient.start(TunnelManager::sUdpMirrorClientCallback,(void*)this); } else { LOGI("Tunnel is required, enabling; no backup udp mirror available"); - thiz->mAutoDetectStarted = false; + mAutoDetectStarted = false; } - thiz->enable(true); + enable(true); } - return; +} + +void TunnelManager::postEvent(const Event &ev){ + mMutex.lock(); + mEvq.push(ev); + mMutex.unlock(); +} + +void TunnelManager::sUdpMirrorClientCallback(bool isUdpAvailable, void* data) { + TunnelManager* thiz = (TunnelManager*)data; + Event ev; + ev.mType=UdpMirrorClientEvent; + ev.mData.mHaveUdp=isUdpAvailable; + thiz->postEvent(ev); } void TunnelManager::autoDetect() { @@ -409,7 +437,7 @@ void TunnelManager::autoDetect() { mAutoDetectStarted=true; mCurrentUdpMirrorClient =mUdpMirrorClients.begin(); UdpMirrorClient &lUdpMirrorClient=*mCurrentUdpMirrorClient; - lUdpMirrorClient.start(TunnelManager::UdpMirrorClientListener,(void*)this); + lUdpMirrorClient.start(TunnelManager::sUdpMirrorClientCallback,(void*)this); } diff --git a/coreapi/TunnelManager.hh b/coreapi/TunnelManager.hh index 1fb55429e..6df99192a 100644 --- a/coreapi/TunnelManager.hh +++ b/coreapi/TunnelManager.hh @@ -130,9 +130,21 @@ class UdpMirrorClient; LinphoneCore *getLinphoneCore(); virtual void setHttpProxy(const char *host,int port, const char *username, const char *passwd); private: + enum EventType{ + UdpMirrorClientEvent, + TunnelEvent, + }; + struct Event{ + EventType mType; + union EventData{ + bool mConnected; + bool mHaveUdp; + }mData; + }; typedef std::list UdpMirrorClientList; virtual bool isStarted(); virtual bool isReady() const; + void onIterate(); static int customSendto(struct _RtpTransport *t, mblk_t *msg , int flags, const struct sockaddr *to, socklen_t tolen); static int customRecvfrom(struct _RtpTransport *t, mblk_t *msg, int flags, struct sockaddr *from, socklen_t *fromlen); static int eXosipSendto(int fd,const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen,void* userdata); @@ -140,9 +152,11 @@ class UdpMirrorClient; static int eXosipSelect(int nfds, fd_set *s1, fd_set *s2, fd_set *s3, struct timeval *tv,void* userdata); static void tunnelCallback(bool connected, TunnelManager *zis); static void sOnIterate(TunnelManager *zis); - static void UdpMirrorClientListener(bool result, void* data); + static void sUdpMirrorClientCallback(bool result, void* data); void waitUnRegistration(); - void processTunnelEvent(); + void processTunnelEvent(const Event &ev); + void processUdpMirrorEvent(const Event &ev); + void postEvent(const Event &ev); LinphoneCore* mCore; LCSipTransports mRegularTransport; TunnelSocket *mSipSocket; @@ -150,19 +164,20 @@ class UdpMirrorClient; StateCallback mCallback; void * mCallbackData; bool mEnabled; - bool mStateChanged; + std::queue mEvq; std::list mServerAddrs; UdpMirrorClientList mUdpMirrorClients; UdpMirrorClientList::iterator mCurrentUdpMirrorClient; TunnelClient* mTunnelClient; void stopClient(); + Mutex mMutex; static Mutex sMutex; bool mAutoDetectStarted; LinphoneRtpTransportFactories mTransportFactories; std::string mHttpUserName; std::string mHttpPasswd; std::string mHttpProxyHost; - int mHttpProxyPort; + int mHttpProxyPort; }; /** diff --git a/coreapi/linphone_tunnel.h b/coreapi/linphone_tunnel.h index 5d78fe8f6..bb343008a 100644 --- a/coreapi/linphone_tunnel.h +++ b/coreapi/linphone_tunnel.h @@ -62,10 +62,10 @@ void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int po * @param tunnel object * @param host tunnel server ip address * @param port tunnel server tls port, recommended value is 443 - * @param remote_udp_mirror remote port on the tunnel server side used to test udp reachability + * @param remote_udp_mirror_port remote port on the tunnel server side used to test udp reachability * @param delay udp packet round trip delay in ms considered as acceptable. recommended value is 1000 ms. */ -void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror, int delay); +void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror_port, int delay); /** * @param tunnel object * returns a string of space separated list of host:port of tunnel server addresses @@ -98,16 +98,37 @@ bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel); **/ void linphone_tunnel_reconnect(LinphoneTunnel *tunnel); /** + * Start tunnel need detection. * @param tunnel object * In auto detect mode, the tunnel manager try to establish a real time rtp cummunication with the tunnel server on specified port. *
In case of success, the tunnel is automatically turned off. Otherwise, if no udp commmunication is feasible, tunnel mode is turned on. *
Call this method each time to run the auto detection algorithm */ void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel); + +/** + * Set an optional http proxy to go through when connecting to tunnel server. + * @param tunnel LinphoneTunnel object + * @param host Http proxy host. + * @param port http proxy port. + * @param username optional http proxy username if the proxy request authentication. Currently only basic authentication is supported. Use NULL if not needed. + * @param password optional http proxy password. Use NULL if not needed. + **/ void linphone_tunnel_set_http_proxy(LinphoneTunnel *tunnel, const char *host, int port, const char* username,const char* passwd); -void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd); + +/** + * Retrieve optional http proxy configuration previously set with linphone_tunnel_set_http_proxy(). + * @param tunnel LinphoneTunnel object + * @param host Http proxy host. + * @param port http proxy port. + * @param username optional http proxy username if the proxy request authentication. Currently only basic authentication is supported. Use NULL if not needed. + * @param password optional http proxy password. Use NULL if not needed. + **/ void linphone_tunnel_get_http_proxy(LinphoneTunnel*tunnel,const char **host, int *port, const char **username, const char **passwd); +void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd); + + void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled); /** From 35d223adee65f659e984d031b67f549e6fff2d1a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 16:02:29 +0200 Subject: [PATCH 543/769] fix bug with preview setting --- coreapi/linphonecore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 152ccf80c..a907f3255 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -844,6 +844,7 @@ static void video_config_read(LinphoneCore *lc){ ms_message("we are using a specific display:%s\n",lc->video_conf.displaytype); linphone_core_enable_video(lc,capture,display); + linphone_core_enable_video_preview(lc,lp_config_get_int(lc->config,"video","show_local",0)); linphone_core_enable_self_view(lc,self_view); linphone_core_set_video_policy(lc,&vpol); #endif From 7256d4b28e7288697536de357289315922bb74b2 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 16:23:22 +0200 Subject: [PATCH 544/769] set video preview window id effective immediately when possible --- coreapi/linphonecore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a907f3255..99482f620 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4096,6 +4096,8 @@ void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long LinphoneCall *call=linphone_core_get_current_call(lc); if (call!=NULL && call->videostream){ video_stream_set_native_preview_window_id(call->videostream,id); + }else if (lc->previewstream){ + video_preview_set_native_window_id(lc->previewstream,id); } #endif } From aaa06771f21ae7d895901eb8463976bb250b1c6f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 18:36:06 +0200 Subject: [PATCH 545/769] avoid using strtok --- coreapi/linphone_tunnel.cc | 39 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/coreapi/linphone_tunnel.cc b/coreapi/linphone_tunnel.cc index 6a47e83ab..f5a5d361f 100644 --- a/coreapi/linphone_tunnel.cc +++ b/coreapi/linphone_tunnel.cc @@ -173,17 +173,26 @@ void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel){ bcTunnel(tunnel)->autoDetect(); } -static void tunnel_add_servers_from_config(LinphoneTunnel *tunnel, char* confaddress){ - char *str1; - for(str1=confaddress;;str1=NULL){ - char *port; - char *address=strtok(str1," "); // Not thread safe - if (!address) break; - port=strchr(address, ':'); - if (!port) ms_fatal("Bad tunnel address %s",confaddress); - *port++='\0'; - linphone_tunnel_add_server(tunnel, address, atoi(port)); - } +static void tunnel_add_servers_from_config(LinphoneTunnel *tunnel, const char* confaddress){ + char *tmp=(char*)ms_malloc0(strlen(confaddress)+1); + const char *it=confaddress; + int adv; + do{ + int ret=sscanf(it,"%s%n",tmp,&adv); + if (ret>=1){ + it+=adv; + char *port=strchr(tmp,':'); + if (!port){ + ms_error("Tunnel server addresses incorrectly specified from config file: %s",it); + break; + }else{ + *port='\0'; + port++; + bcTunnel(tunnel)->addServer(tmp, atoi(port)); + } + }else break; + }while(1); + ms_free(tmp); } static void my_ortp_logv(OrtpLogLevel level, const char *fmt, va_list args){ @@ -197,13 +206,9 @@ static void my_ortp_logv(OrtpLogLevel level, const char *fmt, va_list args){ void linphone_tunnel_configure(LinphoneTunnel *tunnel){ bool_t enabled=(bool_t)lp_config_get_int(config(tunnel),"tunnel","enabled",FALSE); const char* addresses=lp_config_get_string(config(tunnel),"tunnel","server_addresses", NULL); - char *copy=addresses ? ms_strdup(addresses) : NULL; linphone_tunnel_enable_logs_with_handler(tunnel,TRUE,my_ortp_logv); - linphone_tunnel_clean_servers(tunnel); - if (copy){ - tunnel_add_servers_from_config(tunnel,copy); - ms_free(copy); - } + if (addresses) + tunnel_add_servers_from_config(tunnel,addresses); linphone_tunnel_enable(tunnel, enabled); } From da68646e0987d238ee30fdf5235b1024f3bd5dbf Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 17 Sep 2012 20:52:29 +0200 Subject: [PATCH 546/769] backward compat fixes --- .../org/linphone/core/tutorials/TutorialBuddyStatus.java | 7 +++++++ .../org/linphone/core/tutorials/TutorialChatRoom.java | 8 ++++++++ .../org/linphone/core/tutorials/TutorialHelloWorld.java | 8 ++++++++ .../org/linphone/core/tutorials/TutorialRegistration.java | 8 ++++++++ coreapi/linphonecore_jni.cc | 5 ++--- java/common/org/linphone/core/LinphoneChatRoom.java | 6 ------ java/common/org/linphone/core/LinphoneCore.java | 8 +++++++- java/common/org/linphone/core/LinphoneCoreListener.java | 3 +-- 8 files changed, 41 insertions(+), 12 deletions(-) diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java index 58a75e56b..1d86d482b 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore.EcCalibratorStatus; @@ -231,5 +232,11 @@ public class TutorialBuddyStatus implements LinphoneCoreListener { TutorialNotifier.notify(s); } + @Override + public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { + // TODO Auto-generated method stub + + } + } diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java index c81823e8a..91dc0f247 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore.EcCalibratorStatus; @@ -146,5 +147,12 @@ public class TutorialChatRoom implements LinphoneCoreListener { TutorialNotifier.notify(s); } + @Override + public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, + LinphoneChatMessage message) { + // TODO Auto-generated method stub + + } + } diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java index 6daa65711..354f97501 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore.EcCalibratorStatus; @@ -156,5 +157,12 @@ public class TutorialHelloWorld implements LinphoneCoreListener { TutorialNotifier.notify(s); } + @Override + public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, + LinphoneChatMessage message) { + // TODO Auto-generated method stub + + } + } diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java index 674044471..48e473d61 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore.EcCalibratorStatus; @@ -187,6 +188,13 @@ public class TutorialRegistration implements LinphoneCoreListener { TutorialNotifier.notify(s); } + @Override + public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, + LinphoneChatMessage message) { + // TODO Auto-generated method stub + + } + } diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 440afcbc6..eacb220e0 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -152,7 +152,7 @@ public: /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/ textReceivedId = env->GetMethodID(listenerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V"); - messageReceivedId = env->GetMethodID(listenerClass,"messageReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Lorg/linphone/core/LinphoneChatMessage;)V"); + messageReceivedId = env->GetMethodID(listenerClass,"messageReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneChatMessage;)V"); proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl")); proxyCtrId = env->GetMethodID(proxyClass,"", "(J)V"); @@ -161,7 +161,7 @@ public: callCtrId = env->GetMethodID(callClass,"", "(J)V"); chatMessageClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatMessageImpl")); - chatMessageCtrId = env->GetMethodID(chatMessageClass,"", "(J)V"); + if (chatMessageClass) chatMessageCtrId = env->GetMethodID(chatMessageClass,"", "(J)V"); chatRoomClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatRoomImpl")); chatRoomCtrId = env->GetMethodID(chatRoomClass,"", "(J)V"); @@ -402,7 +402,6 @@ public: ,lcData->messageReceivedId ,lcData->core ,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room) - ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)msg->from) ,env->NewObject(lcData->chatMessageClass,lcData->chatMessageCtrId,(jlong)msg)); } static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) { diff --git a/java/common/org/linphone/core/LinphoneChatRoom.java b/java/common/org/linphone/core/LinphoneChatRoom.java index 102a03c21..d6512f170 100644 --- a/java/common/org/linphone/core/LinphoneChatRoom.java +++ b/java/common/org/linphone/core/LinphoneChatRoom.java @@ -40,12 +40,6 @@ public interface LinphoneChatRoom { * @param chat message */ void sendMessage(LinphoneChatMessage message, LinphoneChatMessage.StateListener listener); - /** - * DEPRECATED - * @param opaque - * @param message - */ - void sendMessage(Object opaque, String message); /** * Create a LinphoneChatMessage diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index ce476c738..6ac821322 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -491,11 +491,17 @@ public interface LinphoneCore { */ void clearCallLogs(); /*** - * get payload type from mime type an clock rate + * get payload type from mime type, clock rate, and number of channels.- * * return null if not found */ PayloadType findPayloadType(String mime, int clockRate, int channels); + /*** + * get payload type from mime type and clock rate.. + * + * return null if not found + */ + PayloadType findPayloadType(String mime, int clockRate); /** * not implemented yet * @param pt diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index 150141ffe..a84f736d2 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -82,10 +82,9 @@ public interface LinphoneCoreListener { * invoked when a new linphone chat message is received * @param lc LinphoneCore * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. - * @param from LinphoneAddress from * @param message incoming linphone chat message message */ - void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, LinphoneChatMessage message); + void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message); /** * Invoked when echo cancalation calibration is completed From 239e4f553b425ab09ac097b8b2cfbb4d75cf2047 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 18 Sep 2012 12:24:31 +0200 Subject: [PATCH 547/769] do not use ICE while in tunnel mode --- coreapi/TunnelManager.cc | 9 ++++++--- coreapi/TunnelManager.hh | 1 + mediastreamer2 | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index 2165a2bf4..9b5dffd29 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -246,7 +246,8 @@ void TunnelManager::processTunnelEvent(const Event &ev){ linphone_core_get_default_proxy(mCore, &lProxy); if (mEnabled && mTunnelClient->isReady()){ - ms_message("Tunnel is up, registering now"); + ms_message("Tunnel is up, registering now"); + linphone_core_set_firewall_policy(mCore,LinphonePolicyNoFirewall); linphone_core_set_rtp_transport_factories(mCore,&mTransportFactories); eXosip_transport_hook_register(&mExosipTransport); //force transport to udp @@ -295,8 +296,9 @@ void TunnelManager::enable(bool isEnable) { ms_message("Turning tunnel [%s]",(isEnable?"on":"off")); if (isEnable && !mEnabled){ mEnabled=true; - //1 save transport + //1 save transport and firewall policy linphone_core_get_sip_transports(mCore, &mRegularTransport); + mPreviousFirewallPolicy=linphone_core_get_firewall_policy(mCore); //2 unregister waitUnRegistration(); //3 insert tunnel @@ -311,8 +313,9 @@ void TunnelManager::enable(bool isEnable) { linphone_core_set_rtp_transport_factories(mCore,NULL); eXosip_transport_hook_register(NULL); - //Restore transport + //Restore transport and firewall policy linphone_core_set_sip_transports(mCore, &mRegularTransport); + linphone_core_set_firewall_policy(mCore, mPreviousFirewallPolicy); //register LinphoneProxyConfig* lProxy; linphone_core_get_default_proxy(mCore, &lProxy); diff --git a/coreapi/TunnelManager.hh b/coreapi/TunnelManager.hh index 6df99192a..d4c1458fc 100644 --- a/coreapi/TunnelManager.hh +++ b/coreapi/TunnelManager.hh @@ -178,6 +178,7 @@ class UdpMirrorClient; std::string mHttpPasswd; std::string mHttpProxyHost; int mHttpProxyPort; + LinphoneFirewallPolicy mPreviousFirewallPolicy; }; /** diff --git a/mediastreamer2 b/mediastreamer2 index 88b9146cc..bc1d91a89 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 88b9146ccbd33c9d8d3317be92078f6211498907 +Subproject commit bc1d91a891a04858b43d6e08fa1136d2c3b9c6a2 From a1961faa44b1306e5c04285a00ec98ccd9328ff9 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 18 Sep 2012 15:32:29 +0200 Subject: [PATCH 548/769] Added JNI getFrom to LinphoneChatMessage --- coreapi/linphonecore_jni.cc | 9 +++++++-- java/common/org/linphone/core/LinphoneChatMessage.java | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index eacb220e0..fda8c861f 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1425,10 +1425,15 @@ extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setExternalBodyUr linphone_chat_message_set_external_body_url((LinphoneChatMessage *)ptr, url); env->ReleaseStringUTFChars(jurl, url); } -extern "C" long Java_org_linphone_core_LinphoneChatMessageImpl_getPeerAddress(JNIEnv* env +extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getFrom(JNIEnv* env ,jobject thiz ,jlong ptr) { - return (long) linphone_chat_message_get_peer_address((LinphoneChatMessage*)ptr); + return (jlong) linphone_chat_message_get_from((LinphoneChatMessage*)ptr); +} +extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getPeerAddress(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + return (jlong) linphone_chat_message_get_peer_address((LinphoneChatMessage*)ptr); } extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv* env ,jobject thiz diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index 3b135fc65..db75f9116 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -74,6 +74,13 @@ public interface LinphoneChatMessage { */ LinphoneAddress getPeerAddress(); + /** + * get from address associated to this LinphoneChatMessage + * + * @return LinphoneAddress from address + */ + LinphoneAddress getFrom(); + /** * Linphone message can carry external body as defined by rfc2017 * @param message #LinphoneChatMessage From 296b5671ae42dbfbb28e1c30e8c79ecdbe60ebc5 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 18 Sep 2012 08:21:51 +0200 Subject: [PATCH 549/769] add armv7s support for IOS Conflicts: mediastreamer2 --- configure.ac | 2 +- m4/exosip.m4 | 8 +------- mediastreamer2 | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 6e68f7ba1..4c4bab882 100644 --- a/configure.ac +++ b/configure.ac @@ -61,7 +61,7 @@ case $target in CONSOLE_FLAGS="-mconsole" mingw_found=yes ;; - armv6-apple-darwin|armv7-apple-darwin|i386-apple-darwin) + armv6-apple-darwin|armv7-apple-darwin|i386-apple-darwin|armv7s-apple-darwin) CFLAGS="$CFLAGS -DTARGET_OS_IPHONE " build_tests=no ios_found=yes diff --git a/m4/exosip.m4 b/m4/exosip.m4 index 129b28570..aa4b7a9c3 100644 --- a/m4/exosip.m4 +++ b/m4/exosip.m4 @@ -5,13 +5,7 @@ AC_REQUIRE([LP_CHECK_OSIP2]) case $host_alias in - i386-apple*) - OSIP_LIBS="$OSIP_LIBS -framework CoreFoundation -framework CFNetwork -lresolv" - ;; - armv6-apple*) - OSIP_LIBS="$OSIP_LIBS -framework CoreFoundation -framework CFNetwork -lresolv" - ;; - armv7-apple*) + i386-apple*|armv6-apple*|armv7-apple*|armv7s-apple*) OSIP_LIBS="$OSIP_LIBS -framework CoreFoundation -framework CFNetwork -lresolv" ;; x86_64-apple*) diff --git a/mediastreamer2 b/mediastreamer2 index bc1d91a89..02dc872f0 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bc1d91a891a04858b43d6e08fa1136d2c3b9c6a2 +Subproject commit 02dc872f0f85986b7691b4ac911da7825f185a3e From d0175b57d50cd3da78c1fae783787adffa4192bd Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 18 Sep 2012 15:57:21 +0200 Subject: [PATCH 550/769] Linphone updated --- LinphoneChatMessageImpl.java | 10 ++++++++-- LinphoneChatRoomImpl.java | 6 +----- LinphoneCoreImpl.java | 5 +++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/LinphoneChatMessageImpl.java b/LinphoneChatMessageImpl.java index a93aae85f..62fac1dc3 100644 --- a/LinphoneChatMessageImpl.java +++ b/LinphoneChatMessageImpl.java @@ -4,9 +4,10 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage { protected final long nativePtr; private native void setUserData(long ptr); private native String getMessage(long ptr); - private native LinphoneAddress getPeerAddress(long ptr); + private native long getPeerAddress(long ptr); private native String getExternalBodyUrl(long ptr); private native void setExternalBodyUrl(long ptr, String url); + private native long getFrom(long ptr); protected LinphoneChatMessageImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -35,7 +36,7 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage { @Override public LinphoneAddress getPeerAddress() { - return getPeerAddress(nativePtr); + return new LinphoneAddressImpl(getPeerAddress(nativePtr)); } @Override @@ -47,4 +48,9 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage { public void setExternalBodyUrl(String url) { setExternalBodyUrl(nativePtr, url); } + + @Override + public LinphoneAddress getFrom() { + return new LinphoneAddressImpl(getFrom(nativePtr)); + } } diff --git a/LinphoneChatRoomImpl.java b/LinphoneChatRoomImpl.java index 806e8b68a..83141ad1c 100644 --- a/LinphoneChatRoomImpl.java +++ b/LinphoneChatRoomImpl.java @@ -44,11 +44,7 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { sendMessage2(nativePtr, message.getNativePtr(), listener); } - @Override - public void sendMessage(Object opaque, String message) { - // ignore, deprecated. - - } + @Override public LinphoneChatMessage createLinphoneChatMessage(String message) { return new LinphoneChatMessageImpl(createLinphoneChatMessage(nativePtr, message)); diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 8a870cc0e..8677cb285 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -736,4 +736,9 @@ class LinphoneCoreImpl implements LinphoneCore { public String getVersion() { return getVersion(nativePtr); } + + @Override + public PayloadType findPayloadType(String mime, int clockRate) { + return null; + } } From 10849040c30e20062e9a7553c04d43cd0731632a Mon Sep 17 00:00:00 2001 From: Diorcet Yann Date: Tue, 18 Sep 2012 20:36:53 +0200 Subject: [PATCH 551/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 02dc872f0..f225ee612 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 02dc872f0f85986b7691b4ac911da7825f185a3e +Subproject commit f225ee612009009075ab6caf7ef91bb3a21fa25f From 3cd49ea4bdeb67924a43e6142deb5578ecb9d8a5 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 19 Sep 2012 10:31:14 +0200 Subject: [PATCH 552/769] Deactivate ICE if the remote does not support it. --- coreapi/misc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index d05a275ba..b4a8479c5 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -879,6 +879,10 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, ice_session_remove_check_list(call->ice_session, ice_session_check_list(call->ice_session, i - 1)); } ice_session_check_mismatch(call->ice_session); + } else { + /* Response from remote does not contain mandatory ICE attributes, delete the session. */ + linphone_call_delete_ice_session(call); + return; } if (ice_session_nb_check_lists(call->ice_session) == 0) { linphone_call_delete_ice_session(call); From 0b475524e734ae0b17326ee4398f96d7dd7da119 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 19 Sep 2012 17:14:49 +0200 Subject: [PATCH 553/769] add call statistics window to gtk --- coreapi/linphonecall.c | 17 +- coreapi/linphonecore.h | 2 + gtk/Makefile.am | 3 +- gtk/call_statistics.ui | 212 ++++ gtk/incall_view.c | 102 ++ gtk/main.ui | 2593 ++++++++++++++++++++++------------------ 6 files changed, 1756 insertions(+), 1173 deletions(-) create mode 100644 gtk/call_statistics.ui diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 9243be084..a714ad7f7 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1732,12 +1732,17 @@ const LinphoneCallStats *linphone_call_get_video_stats(const LinphoneCall *call) * @} **/ -static void display_bandwidth(RtpSession *as, RtpSession *vs){ +static void report_bandwidth(LinphoneCall *call, RtpSession *as, RtpSession *vs){ + call->stats[LINPHONE_CALL_STATS_AUDIO].download_bandwidth=(as!=NULL) ? (rtp_session_compute_recv_bandwidth(as)*1e-3) : 0; + call->stats[LINPHONE_CALL_STATS_AUDIO].upload_bandwidth=(as!=NULL) ? (rtp_session_compute_send_bandwidth(as)*1e-3) : 0; + call->stats[LINPHONE_CALL_STATS_VIDEO].download_bandwidth=(vs!=NULL) ? (rtp_session_compute_recv_bandwidth(vs)*1e-3) : 0; + call->stats[LINPHONE_CALL_STATS_VIDEO].upload_bandwidth=(vs!=NULL) ? (rtp_session_compute_send_bandwidth(vs)*1e-3) : 0; ms_message("bandwidth usage: audio=[d=%.1f,u=%.1f] video=[d=%.1f,u=%.1f] kbit/sec", - (as!=NULL) ? (rtp_session_compute_recv_bandwidth(as)*1e-3) : 0, - (as!=NULL) ? (rtp_session_compute_send_bandwidth(as)*1e-3) : 0, - (vs!=NULL) ? (rtp_session_compute_recv_bandwidth(vs)*1e-3) : 0, - (vs!=NULL) ? (rtp_session_compute_send_bandwidth(vs)*1e-3) : 0); + call->stats[LINPHONE_CALL_STATS_AUDIO].download_bandwidth, + call->stats[LINPHONE_CALL_STATS_AUDIO].upload_bandwidth , + call->stats[LINPHONE_CALL_STATS_VIDEO].download_bandwidth, + call->stats[LINPHONE_CALL_STATS_VIDEO].upload_bandwidth + ); } static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ @@ -1848,7 +1853,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse video_load=ms_ticker_get_average_load(call->videostream->ticker); vs=call->videostream->session; } - display_bandwidth(as,vs); + report_bandwidth(call,as,vs); ms_message("Thread processing load: audio=%f\tvideo=%f",audio_load,video_load); } #ifdef VIDEO_ENABLED diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index acf81f1df..9a5792a75 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -304,6 +304,8 @@ struct _LinphoneCallStats { mblk_t* sent_rtcp;/** + + + + + False + 5 + Call statistics + dialog + + + + True + False + 2 + + + True + False + end + + + + + + gtk-close + True + True + True + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 0 + none + + + True + False + 12 + + + True + False + 6 + 2 + True + + + True + False + Audio codec + + + + + + + + True + False + Video codec + + + 1 + 2 + + + + + + True + False + Audio IP bandwidth usage + + + 2 + 3 + + + + + + True + False + + + 1 + 2 + + + + + True + False + + + 1 + 2 + 1 + 2 + + + + + True + False + + + 1 + 2 + 2 + 3 + + + + + True + False + Media connectivity + + + 4 + 5 + + + + + + + + + + + + True + False + + + 1 + 2 + 4 + 5 + + + + + True + False + Video IP bandwidth usage + + + 3 + 4 + + + + + + True + False + + + 1 + 2 + 3 + 4 + + + + + + + + + True + False + <b>Call statistics and information</b> + True + + + + + False + False + 1 + + + + + + button1 + + + diff --git a/gtk/incall_view.c b/gtk/incall_view.c index 7e8eb683f..90c080be1 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -193,6 +193,100 @@ void linphone_gtk_enable_conference_button(LinphoneCore *lc, gboolean value){ } } +static void show_used_codecs(GtkWidget *callstats, LinphoneCall *call){ + const LinphoneCallParams *params=linphone_call_get_current_params(call); + if (params){ + const PayloadType *acodec=linphone_call_params_get_used_audio_codec(params); + const PayloadType *vcodec=linphone_call_params_get_used_video_codec(params); + GtkWidget *acodec_ui=linphone_gtk_get_widget(callstats,"audio_codec"); + GtkWidget *vcodec_ui=linphone_gtk_get_widget(callstats,"video_codec"); + if (acodec){ + + char tmp[64]={0}; + snprintf(tmp,sizeof(tmp)-1,"%s/%i/%i",acodec->mime_type,acodec->clock_rate,acodec->channels); + gtk_label_set_label(GTK_LABEL(acodec_ui),tmp); + }else gtk_label_set_label(GTK_LABEL(acodec_ui),_("Not used")); + if (vcodec){ + gtk_label_set_label(GTK_LABEL(vcodec_ui),vcodec->mime_type); + }else gtk_label_set_label(GTK_LABEL(vcodec_ui),_("Not used")); + } +} + +static const char *ice_state_to_string(LinphoneIceState ice_state){ + switch(ice_state){ + case LinphoneIceStateNotActivated: + return _("Ice not activated"); + case LinphoneIceStateInProgress: + return _("ICE in progress"); + case LinphoneIceStateReflexiveConnection: + return _("Going through one or more NATs"); + case LinphoneIceStateHostConnection: + return _("Direct"); + case LinphoneIceStateRelayConnection: + return _("Through a relay server"); + } + return "invalid"; +} + +static void _refresh_call_stats(GtkWidget *callstats, LinphoneCall *call){ + const LinphoneCallStats *as=linphone_call_get_audio_stats(call); + const LinphoneCallStats *vs=linphone_call_get_video_stats(call); + LinphoneIceState ice_state=as->ice_state; + gchar *tmp=g_strdup_printf(_("download: %f\nupload: %f (kbit/s)"), + as->download_bandwidth,as->upload_bandwidth); + gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"audio_bandwidth_usage")),tmp); + g_free(tmp); + tmp=g_strdup_printf(_("download: %f\nupload: %f (kbit/s)"), + vs->download_bandwidth,vs->upload_bandwidth); + gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_bandwidth_usage")),tmp); + g_free(tmp); + gtk_label_set_text(GTK_LABEL(linphone_gtk_get_widget(callstats,"media_connectivity")),ice_state_to_string(ice_state)); +} + +static gboolean refresh_call_stats(GtkWidget *callstats){ + LinphoneCall *call=(LinphoneCall*)g_object_get_data(G_OBJECT(callstats),"call"); + switch (linphone_call_get_state(call)){ + case LinphoneCallError: + case LinphoneCallEnd: + case LinphoneCallReleased: + gtk_widget_destroy(callstats); + return FALSE; + break; + case LinphoneCallStreamsRunning: + _refresh_call_stats(callstats,call); + break; + default: + break; + } + return TRUE; +} + +static void on_call_stats_destroyed(GtkWidget *call_view){ + GtkWidget *call_stats=(GtkWidget*)g_object_get_data(G_OBJECT(call_view),"call_stats"); + LinphoneCall *call=(LinphoneCall*)g_object_get_data(G_OBJECT(call_stats),"call"); + g_source_remove(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(call_stats),"tid"))); + g_object_set_data(G_OBJECT(call_view),"call_stats",NULL); + linphone_call_unref(call); +} + +static void linphone_gtk_show_call_stats(LinphoneCall *call){ + GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer(call); + GtkWidget *call_stats=(GtkWidget*)g_object_get_data(G_OBJECT(w),"call_stats"); + if (call_stats==NULL){ + guint tid; + call_stats=linphone_gtk_create_window("call_statistics"); + g_object_set_data(G_OBJECT(w),"call_stats",call_stats); + g_object_set_data(G_OBJECT(call_stats),"call",linphone_call_ref(call)); + tid=g_timeout_add(1000,(GSourceFunc)refresh_call_stats,call_stats); + g_object_set_data(G_OBJECT(call_stats),"tid",GINT_TO_POINTER(tid)); + g_signal_connect_swapped(G_OBJECT(call_stats),"destroy",(GCallback)on_call_stats_destroyed,(gpointer)w); + show_used_codecs(call_stats,call); + refresh_call_stats(call_stats); + gtk_widget_show(call_stats); + } + +} + void linphone_gtk_create_in_call_view(LinphoneCall *call){ GtkWidget *call_view=linphone_gtk_create_widget("main","in_call_frame"); GtkWidget *main_window=linphone_gtk_get_main_window (); @@ -217,6 +311,7 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){ linphone_gtk_enable_hold_button (call,FALSE,TRUE); linphone_gtk_enable_mute_button( GTK_BUTTON(linphone_gtk_get_widget(call_view,"incall_mute")),FALSE); + g_signal_connect_swapped(G_OBJECT(linphone_gtk_get_widget(call_view,"quality_indicator")),"button-press-event",(GCallback)linphone_gtk_show_call_stats,call); } static void video_button_clicked(GtkWidget *button, LinphoneCall *call){ @@ -506,6 +601,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){ GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration"); guint taskid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(callview),"taskid")); gboolean in_conf=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call)); + GtkWidget *call_stats=(GtkWidget*)g_object_get_data(G_OBJECT(callview),"call_stats"); display_peer_name_in_label(callee,linphone_call_get_remote_address (call)); @@ -524,6 +620,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){ linphone_gtk_in_call_view_enable_audio_view(call, !in_conf); linphone_gtk_in_call_view_show_encryption(call); if (in_conf) linphone_gtk_set_in_conference(call); + if (call_stats) show_used_codecs(call_stats,call); } void linphone_gtk_in_call_view_set_paused(LinphoneCall *call){ @@ -676,3 +773,8 @@ void linphone_gtk_enable_hold_button(LinphoneCall *call, gboolean sensitive, gbo gtk_widget_set_visible(GTK_WIDGET(button),sensitive); linphone_gtk_draw_hold_button(GTK_BUTTON(button),!holdon); } + +void linphone_gtk_call_statistics_closed(GtkWidget *call_stats){ + gtk_widget_destroy(call_stats); +} + diff --git a/gtk/main.ui b/gtk/main.ui index 9a458dbc0..a57b79966 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -1,27 +1,49 @@ - + + False True + False 0 none True + False 12 True + False True + False + + + True + False + <b>Callee name</b> + True + right + end + + + True + True + end + 0 + + True True + False False @@ -29,21 +51,10 @@ 1 - - - True - <b>Callee name</b> - True - right - end - - - end - 0 - - + True + True 0 @@ -52,6 +63,7 @@ 170 30 True + False False @@ -71,21 +83,26 @@ + False + False 0.5 none True + False 12 12 True + False True + False @@ -99,18 +116,23 @@ True + False label center + True + True 1 + False True + False gtk-dialog-authentication 1 @@ -123,6 +145,7 @@ True + False gtk-apply @@ -134,9 +157,12 @@ True + False label + True + True 2 @@ -146,7 +172,8 @@ True True True - + False + False @@ -163,14 +190,17 @@ + False True True + False half - + + True False 0 @@ -178,6 +208,7 @@ True + False False @@ -188,10 +219,12 @@ True + False gtk-missing-image 1 + True False 2 @@ -199,6 +232,7 @@ True + False False @@ -216,6 +250,7 @@ + False spread @@ -223,7 +258,8 @@ True True True - + False + False @@ -237,7 +273,8 @@ True True True - + False + False @@ -255,6 +292,7 @@ True + False True spread @@ -262,7 +300,8 @@ Pause True True - + False + False @@ -276,6 +315,7 @@ True True True + False False @@ -297,34 +337,45 @@ True + False True True + False In call True center + True + True 0 True + False Duration center + True + True 1 True + False + GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK Call quality rating + True + True 2 @@ -335,52 +386,1409 @@ True + False gtk-info True + False gtk-add True + False gtk-clear True + False gtk-connect True + False gtk-refresh True + False gtk-properties True + False gtk-home True + False gtk-execute True + False gtk-add True + False gtk-add True + False gtk-add True + False gtk-add + + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + False + + + True + False + False + _Options + True + + + + True + False + + + gtk-preferences + True + False + False + True + True + + + + + + gtk-disconnect + False + False + True + True + + + + + + True + False + + + + + True + False + False + Always start video + True + + + + + + True + False + False + Enable self-view + True + True + + + + + + True + False + + + + + gtk-quit + False + False + True + True + + + + + + + + + + True + False + False + _Help + True + + + True + False + + + gtk-about + True + False + False + True + True + + + + + + Show debug window + True + False + False + image1 + False + + + + + + _Homepage + True + False + False + True + image4 + False + + + + + + Check _Updates + False + False + True + image5 + False + + + + + + Account assistant + False + False + image12 + False + + + + + + + + + + False + True + 0 + + + + + True + False + + + True + False + + + True + False + + + True + True + True + False + + + + False + False + 0 + + + + + True + True + Initiate a new call + False + + + + False + False + 1 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + none + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + 5 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + True + Enter username, phone number, or full sip address + â— + False + False + True + True + + + + True + True + 0 + + + + + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + SIP address or phone number: + True + + + + + True + True + 2 + + + + + True + True + True + False + + + + False + False + 3 + + + + + False + True + 8 + 0 + + + + + True + True + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + False + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Lookup: + + + True + True + 12 + 0 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + â— + True + False + False + True + True + + + + True + True + 4 + 1 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + in + + + True + True + 8 + 2 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + model1 + 0 + + + + + 0 + + + + + True + True + 4 + 3 + + + + + False + True + 0 + + + + + True + True + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + 0 + + + + + + + + + True + True + 1 + + + + + False + 0 + none + + + False + + + True + True + â— + True + False + False + True + True + + + + + + + True + True + 0 + + + + + True + True + True + False + none + + + + True + False + + + True + False + gtk-find + + + True + True + 0 + + + + + True + False + Search + + + True + True + 1 + + + + + + + False + True + 1 + + + + + + + True + False + <b>Add contacts from directory</b> + True + + + + + False + False + 5 + 2 + + + + + True + False + + + Add contact + True + True + False + image10 + + + + False + False + 0 + + + + + False + False + 3 + + + + + True + True + 0 + + + + + + + True + False + + + True + False + gtk-directory + 1 + + + True + True + 0 + + + + + True + False + Contacts + + + True + True + 1 + + + + + False + + + + + True + False + + + True + False + 2 + + + True + False + end + + + gtk-clear + True + True + True + False + True + + + + False + False + 0 + + + + + + + + + + + False + True + end + 0 + + + + + True + True + never + + + True + True + False + + + + + + + True + True + 1 + + + + + True + True + 0 + + + + + 1 + + + + + True + False + + + True + False + gtk-refresh + 1 + + + True + True + 0 + + + + + True + False + 0.49000000953674316 + Recent calls + + + True + True + 1 + + + + + 1 + False + + + + + True + False + 0.5 + none + + + True + False + 0 + 0 + + + True + False + 0 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + 4 + 4 + True + + + D + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + 3 + 4 + + + + + # + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + 3 + 4 + + + + + 0 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 3 + 4 + + + + + * + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + + + + + C + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + 2 + 3 + + + + + 9 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + 2 + 3 + + + + + 8 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + + 7 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + + + + + B + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + 1 + 2 + + + + + 6 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + 1 + 2 + + + + + 5 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 1 + 2 + + + + + 4 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + + + + + A + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + + + + + 3 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + + + + + 2 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + + + + + 1 + 40 + 40 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + + + + + + + + + + + + 2 + + + + + True + False + + + True + False + gtk-missing-image + 1 + + + True + True + 0 + + + + + True + False + Keypad + + + True + True + 1 + + + + + 2 + False + + + + + True + True + 1 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + none + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + model3 + 0 + + + + + 0 + + + + + + + True + False + 5 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + My current identity: + True + + + True + True + 0 + + + + + True + True + False + none + + + + True + False + gtk-refresh + + + + + True + True + 1 + + + + + + + False + False + 2 + + + + + True + True + 0 + + + + + False + 0 + etched-out + + + True + False + 12 + + + True + False + + + True + False + gtk-missing-image + + + True + True + 0 + + + + + True + False + 0 + none + + + True + False + 12 + 12 + + + True + False + 4 + 2 + + + True + False + Username + + + + + True + False + Password + + + 1 + 2 + + + + + True + False + Internet connection: + + + 2 + 3 + + + + + True + True + â— + False + False + True + True + + + 1 + 2 + + + + + True + True + False + â— + False + False + True + True + + + 1 + 2 + 1 + 2 + + + + + True + False + model4 + 0 + + + + + 0 + + + + + 1 + 2 + 2 + 3 + + + + + Automatically log me in + True + True + False + False + True + + + 1 + 2 + 3 + 4 + + + + + + + + + + + + True + False + Login information + True + + + + + True + True + 10 + 1 + + + + + True + False + + + gtk-connect + True + True + True + False + True + + + + False + False + 0 + + + + + True + True + 2 + + + + + + + + + True + False + <b>Welcome !</b> + True + + + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + True + True + 0 + + + + + True + True + True + False + none + + + + False + True + 5 + 1 + + + + + False + False + 2 + + + + + @@ -434,1151 +1842,4 @@ - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - - - True - _Options - True - - - - True - - - gtk-preferences - True - True - True - - - - - - gtk-disconnect - True - True - - - - - - True - - - - - True - Always start video - True - - - - - - True - Enable self-view - True - True - - - - - - True - - - - - gtk-quit - True - True - - - - - - - - - - True - _Help - True - - - True - - - gtk-about - True - True - True - - - - - - Show debug window - True - image1 - False - - - - - - _Homepage - True - True - image4 - False - - - - - - Check _Updates - True - image5 - False - - - - - - Account assistant - image12 - False - - - - - - - - - - False - 0 - - - - - True - - - True - - - True - - - True - True - True - - - - False - False - 0 - - - - - True - True - Initiate a new call - - - - False - False - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - none - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - 5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - True - True - Enter username, phone number, or full sip address - - - - - 0 - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - SIP address or phone number: - True - - - - - 2 - - - - - True - True - True - - - - False - False - 3 - - - - - False - 8 - 0 - - - - - True - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Lookup: - - - 12 - 0 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - True - - - - 4 - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - in - - - 8 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - model1 - 0 - - - - - 0 - - - - - 4 - 3 - - - - - False - 0 - - - - - True - True - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - 0 - - - - - - - - - 1 - - - - - 0 - none - - - - - True - True - - True - - - - - - - 0 - - - - - True - True - True - none - - - - True - - - True - gtk-find - - - 0 - - - - - True - Search - - - 1 - - - - - - - False - 1 - - - - - - - True - <b>Add contacts from directory</b> - True - - - - - False - False - 5 - 2 - - - - - True - - - Add contact - True - True - image10 - - - - False - False - 0 - - - - - False - False - 3 - - - - - 0 - - - - - - - True - - - True - gtk-directory - 1 - - - 0 - - - - - True - Contacts - - - 1 - - - - - False - - - - - True - - - True - 2 - - - True - True - never - - - True - True - False - - - - - - - 1 - - - - - True - end - - - gtk-clear - True - True - True - True - - - - False - False - 0 - - - - - - - - - - - False - end - 0 - - - - - 0 - - - - - 1 - - - - - True - - - True - gtk-refresh - 1 - - - 0 - - - - - True - 0.49000000953674316 - Recent calls - - - 1 - - - - - 1 - False - - - - - True - 0.5 - none - - - True - 0 - 0 - - - True - 0 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - 4 - 4 - True - - - D - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 3 - 4 - 3 - 4 - - - - - # - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 2 - 3 - 3 - 4 - - - - - 0 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 3 - 4 - - - - - * - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 3 - 4 - - - - - C - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 3 - 4 - 2 - 3 - - - - - 9 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 2 - 3 - 2 - 3 - - - - - 8 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 2 - 3 - - - - - 7 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 2 - 3 - - - - - B - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 3 - 4 - 1 - 2 - - - - - 6 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 2 - 3 - 1 - 2 - - - - - 5 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 1 - 2 - - - - - 4 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - - - - - A - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 3 - 4 - - - - - 3 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 2 - 3 - - - - - 2 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - - - - - 1 - 40 - 40 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - - - - - - - - - - 2 - - - - - True - - - True - gtk-missing-image - 1 - - - 0 - - - - - True - Keypad - - - 1 - - - - - 2 - False - - - - - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - none - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - model3 - 0 - - - - - 0 - - - - - - - True - 5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - My current identity: - True - - - 0 - - - - - True - True - none - - - - True - gtk-refresh - - - - - 1 - - - - - - - False - False - 2 - - - - - 0 - - - - - 0 - etched-out - - - True - 12 - - - True - - - True - gtk-missing-image - - - 0 - - - - - True - 0 - none - - - True - 12 - 12 - - - True - 4 - 2 - - - True - Username - - - - - True - Password - - - 1 - 2 - - - - - True - Internet connection: - - - 2 - 3 - - - - - True - True - - - - 1 - 2 - - - - - True - True - False - - - - 1 - 2 - 1 - 2 - - - - - True - model4 - 0 - - - - - 0 - - - - - 1 - 2 - 2 - 3 - - - - - Automatically log me in - True - True - False - True - - - 1 - 2 - 3 - 4 - - - - - - - - - - - - True - Login information - True - - - - - 10 - 1 - - - - - True - - - gtk-connect - True - True - True - True - - - - False - False - 0 - - - - - 2 - - - - - - - - - True - <b>Welcome !</b> - True - - - - - 1 - - - - - 1 - - - - - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - - - 0 - - - - - True - True - True - none - - - - False - 5 - 1 - - - - - False - False - 2 - - - - - From cd0becf3297f9042e844acf3a32bbce6813149f3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 19 Sep 2012 17:43:22 +0200 Subject: [PATCH 554/769] add call statistics to translated ui files --- po/POTFILES.in | 1 + 1 file changed, 1 insertion(+) diff --git a/po/POTFILES.in b/po/POTFILES.in index ac50ac8aa..fdc209b3c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -25,6 +25,7 @@ gtk/loginframe.c [type: gettext/glade]gtk/buddylookup.ui [type: gettext/glade]gtk/waiting.ui [type: gettext/glade]gtk/dscp_settings.ui +[type: gettext/glade]gtk/call_statistics.ui [type: gettext/glade]gtk/tunnel_config.ui coreapi/linphonecore.c coreapi/misc.c From c6d9b71cb585f13078ecea36f387c3621da4f914 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 19 Sep 2012 17:58:05 +0200 Subject: [PATCH 555/769] Add ICE failed state. --- coreapi/linphonecall.c | 3 +-- coreapi/linphonecore.h | 1 + coreapi/misc.c | 43 +++++++++++++++++++++++++----------------- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a714ad7f7..7166d1c13 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1774,7 +1774,6 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ if (ice_session_role(call->ice_session) == IR_Controlling) { ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); - linphone_core_update_ice_state_in_call_stats(call); } break; case IS_Failed: @@ -1783,13 +1782,13 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ /* At least one ICE session has succeeded, so perform a call update. */ ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); - linphone_core_update_ice_state_in_call_stats(call); } } break; default: break; } + linphone_core_update_ice_state_in_call_stats(call); } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { int ping_time = -1; if (evd->info.ice_processing_successful==TRUE) { diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 9a5792a75..583d66356 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -267,6 +267,7 @@ typedef struct _LinphoneCall LinphoneCall; **/ enum _LinphoneIceState{ LinphoneIceStateNotActivated, /**< ICE has not been activated for this call */ + LinphoneIceStateFailed, /**< ICE processing has failed */ LinphoneIceStateInProgress, /**< ICE process is in progress */ LinphoneIceStateHostConnection, /**< ICE has established a direct connection to the remote host */ LinphoneIceStateReflexiveConnection, /**< ICE has established a connection to the remote host through one or several NATs */ diff --git a/coreapi/misc.c b/coreapi/misc.c index b4a8479c5..6da750a0d 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -641,37 +641,46 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call) { IceCheckList *audio_check_list; IceCheckList *video_check_list; + IceSessionState session_state; if (call->ice_session == NULL) return; audio_check_list = ice_session_check_list(call->ice_session, 0); video_check_list = ice_session_check_list(call->ice_session, 1); if (audio_check_list == NULL) return; - switch (ice_check_list_selected_valid_candidate_type(audio_check_list)) { - case ICT_HostCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateHostConnection; - break; - case ICT_ServerReflexiveCandidate: - case ICT_PeerReflexiveCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateReflexiveConnection; - break; - case ICT_RelayedCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateRelayConnection; - break; - } - if (call->params.has_video && (video_check_list != NULL)) { - switch (ice_check_list_selected_valid_candidate_type(video_check_list)) { + session_state = ice_session_state(call->ice_session); + if ((session_state == IS_Completed) || ((session_state == IS_Failed) && (ice_session_has_completed_check_list(call->ice_session) == TRUE))) { + switch (ice_check_list_selected_valid_candidate_type(audio_check_list)) { case ICT_HostCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateHostConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateHostConnection; break; case ICT_ServerReflexiveCandidate: case ICT_PeerReflexiveCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateReflexiveConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateReflexiveConnection; break; case ICT_RelayedCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateRelayConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateRelayConnection; break; } + if (call->params.has_video && (video_check_list != NULL)) { + switch (ice_check_list_selected_valid_candidate_type(video_check_list)) { + case ICT_HostCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateHostConnection; + break; + case ICT_ServerReflexiveCandidate: + case ICT_PeerReflexiveCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateReflexiveConnection; + break; + case ICT_RelayedCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateRelayConnection; + break; + } + } + } else { + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateFailed; + if (call->params.has_video && (video_check_list != NULL)) { + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateFailed; + } } } From 92600fc6bbd33cce321516342941da04d170bb4f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 19 Sep 2012 17:58:33 +0200 Subject: [PATCH 556/769] Add check to prevent crash. --- coreapi/misc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 6da750a0d..8cdf2bb27 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -694,8 +694,12 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * if (session_state == IS_Completed) { desc->ice_completed = TRUE; - ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, 0), &rtp_addr, NULL, NULL, NULL); - strncpy(desc->addr, rtp_addr, sizeof(desc->addr)); + result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, 0), &rtp_addr, NULL, NULL, NULL); + if (result == TRUE) { + strncpy(desc->addr, rtp_addr, sizeof(desc->addr)); + } else { + ms_warning("If ICE has completed successfully, rtp_addr should be set!"); + } } else { desc->ice_completed = FALSE; From e43709fd123d87c75cd7d4e8ae1c5cbfcdbbb9fd Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 19 Sep 2012 18:07:06 +0200 Subject: [PATCH 557/769] Handle LinphoneIceStateFailed. --- gtk/incall_view.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gtk/incall_view.c b/gtk/incall_view.c index 90c080be1..9798a718d 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -215,7 +215,9 @@ static void show_used_codecs(GtkWidget *callstats, LinphoneCall *call){ static const char *ice_state_to_string(LinphoneIceState ice_state){ switch(ice_state){ case LinphoneIceStateNotActivated: - return _("Ice not activated"); + return _("ICE not activated"); + case LinphoneIceStateFailed: + return _("ICE failed"); case LinphoneIceStateInProgress: return _("ICE in progress"); case LinphoneIceStateReflexiveConnection: From 011db1f6a2fb47fd97d49372a7c42c6a5d13cee7 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 20 Sep 2012 17:51:02 +0200 Subject: [PATCH 558/769] getCurrentParamsCopy can return null --- coreapi/linphonecore_jni.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index fda8c861f..d7294356c 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1562,6 +1562,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteParams(JNIEnv } extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JNIEnv *env, jobject thiz, jlong lc){ + if (linphone_call_get_current_params((LinphoneCall*)lc) == NULL) { + return (jlong) 0; + } return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc)); } From b94ed904fdfda543a16a6297014f8ff6aff4e876 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 20 Sep 2012 17:57:00 +0200 Subject: [PATCH 559/769] Previous fix cancelled, real fix applied --- coreapi/linphonecore_jni.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index d7294356c..16d44390c 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1558,13 +1558,13 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createDefaultCallParams } extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteParams(JNIEnv *env, jobject thiz, jlong lc){ + if (linphone_call_get_remote_params((LinphoneCall*)lc) == NULL) { + return (jlong) 0; + } return (jlong) linphone_call_params_copy(linphone_call_get_remote_params((LinphoneCall*)lc)); } extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JNIEnv *env, jobject thiz, jlong lc){ - if (linphone_call_get_current_params((LinphoneCall*)lc) == NULL) { - return (jlong) 0; - } return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc)); } From ade685701ff4c4c20f79b5c5225de48d25ca5f3e Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 20 Sep 2012 17:59:02 +0200 Subject: [PATCH 560/769] GetRemoteParams returns null if needed --- LinphoneCallImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index 5d886d43e..e73a8aacf 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -76,7 +76,11 @@ class LinphoneCallImpl implements LinphoneCall { return new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); } public LinphoneCallParams getRemoteParams() { - return new LinphoneCallParamsImpl(getRemoteParams(nativePtr)); + long remoteParamsPtr = getRemoteParams(nativePtr); + if (remoteParamsPtr == 0) { + return null; + } + return new LinphoneCallParamsImpl(remoteParamsPtr); } public void enableCamera(boolean enabled) { enableCamera(nativePtr, enabled); From b67d2dd4a71626a150e7d57156f548985c1a32cc Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 20 Sep 2012 21:30:42 +0200 Subject: [PATCH 561/769] fix: reuse stun discovered ip/port accross reinvites. --- coreapi/linphonecall.c | 42 +++++++++++++++++++----------------------- coreapi/misc.c | 4 +++- coreapi/private.h | 16 +++++++++------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7166d1c13..7f11028ab 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -193,6 +193,22 @@ static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, int bandw return l; } +static void update_media_description_from_stun(SalMediaDescription *md, const StunCandidate *ac, const StunCandidate *vc){ + if (ac->port!=0){ + strcpy(md->streams[0].rtp_addr,ac->addr); + md->streams[0].rtp_port=ac->port; + if ((ac->addr[0]!='\0' && vc->addr[0]!='\0' && strcmp(ac->addr,vc->addr)==0) || md->nstreams==1){ + strcpy(md->addr,ac->addr); + } + } + if (vc->port!=0){ + strcpy(md->streams[1].rtp_addr,vc->addr); + md->streams[1].rtp_port=vc->port; + } + +} + + static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, LinphoneCall *call, unsigned int session_id, unsigned int session_ver){ MSList *l; PayloadType *pt; @@ -257,7 +273,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li ice_session_add_check_list(call->ice_session, ice_check_list_new()); } } - + update_media_description_from_stun(md,&call->ac,&call->vc); linphone_address_destroy(addr); return md; } @@ -327,20 +343,6 @@ void linphone_call_init_stats(LinphoneCallStats *stats, int type) { stats->ice_state = LinphoneIceStateNotActivated; } -static void update_media_description_from_stun(SalMediaDescription *md, const StunCandidate *ac, const StunCandidate *vc){ - if (ac->port!=0){ - strcpy(md->streams[0].rtp_addr,ac->addr); - md->streams[0].rtp_port=ac->port; - if ((ac->addr[0]!='\0' && vc->addr[0]!='\0' && strcmp(ac->addr,vc->addr)==0) || md->nstreams==1){ - strcpy(md->addr,ac->addr); - } - } - if (vc->port!=0){ - strcpy(md->streams[1].rtp_addr,vc->addr); - md->streams[1].rtp_port=vc->port; - } - -} static void discover_mtu(LinphoneCore *lc, const char *remote){ int mtu; @@ -355,12 +357,9 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){ } } -#define STUN_CANDIDATE_INIT {{0},0} - LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params) { LinphoneCall *call=ms_new0(LinphoneCall,1); - StunCandidate ac=STUN_CANDIDATE_INIT,vc=STUN_CANDIDATE_INIT; int ping_time=-1; call->dir=LinphoneCallOutgoing; call->op=sal_op_new(lc->sal); @@ -374,13 +373,12 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr ice_session_set_role(call->ice_session, IR_Controlling); } if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) { - ping_time=linphone_core_run_stun_tests(call->core,call,&ac, &vc); + ping_time=linphone_core_run_stun_tests(call->core,call); } if (ping_time>=0) { linphone_core_adapt_to_network(lc,ping_time,&call->params); } call->localdesc=create_local_media_description(lc,call); - update_media_description_from_stun(call->localdesc,&ac,&vc); call->camera_active=params->has_video; discover_mtu(lc,linphone_address_get_domain (to)); @@ -395,7 +393,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; int ping_time=-1; - StunCandidate ac=STUN_CANDIDATE_INIT,vc=STUN_CANDIDATE_INIT; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -434,7 +431,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro } break; case LinphonePolicyUseStun: - ping_time=linphone_core_run_stun_tests(call->core,call,&ac, &vc); + ping_time=linphone_core_run_stun_tests(call->core,call); /* No break to also destroy ice session in this case. */ default: break; @@ -443,7 +440,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_core_adapt_to_network(lc,ping_time,&call->params); }; call->localdesc=create_local_media_description(lc,call); - update_media_description_from_stun(call->localdesc,&ac,&vc); call->camera_active=call->params.has_video; discover_mtu(lc,linphone_address_get_domain(from)); diff --git a/coreapi/misc.c b/coreapi/misc.c index 8cdf2bb27..15fc5374c 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -467,8 +467,10 @@ static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id } /* this functions runs a simple stun test and return the number of milliseconds to complete the tests, or -1 if the test were failed.*/ -int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call, StunCandidate *ac, StunCandidate *vc){ +int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ const char *server=linphone_core_get_stun_server(lc); + StunCandidate *ac=&call->ac; + StunCandidate *vc=&call->vc; if (lc->sip_conf.ipv6_enabled){ ms_warning("stun support is not implemented for ipv6"); diff --git a/coreapi/private.h b/coreapi/private.h index f0b3b2c30..1e93c19d7 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -99,7 +99,13 @@ struct _LinphoneChatMessage { char* external_body_url; LinphoneAddress* from; }; - + +typedef struct StunCandidate{ + char addr[64]; + int port; +}StunCandidate; + + struct _LinphoneCall { int magic; /*used to distinguish from proxy config*/ @@ -123,6 +129,7 @@ struct _LinphoneCall void * user_pointer; int audio_port; int video_port; + StunCandidate ac,vc; /*audio video ip/port discovered by STUN*/ struct _AudioStream *audiostream; /**/ struct _VideoStream *videostream; MSAudioEndpoint *endpoint; /*used for conferencing*/ @@ -233,12 +240,7 @@ MSList *linphone_find_friend(MSList *fl, const LinphoneAddress *fri, LinphoneFri void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, const PayloadType *pt); -typedef struct StunCandidate{ - char addr[64]; - int port; -}StunCandidate; - -int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call, StunCandidate *ac, StunCandidate *vc); +int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params); int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); From c476c7ec79263d33d8357e881c636a3b59f8ec1e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 19 Sep 2012 13:38:02 +0200 Subject: [PATCH 562/769] Add JNI to access call statistics. --- .../core/tutorials/TutorialBuddyStatus.java | 2 + .../core/tutorials/TutorialChatRoom.java | 2 + .../core/tutorials/TutorialHelloWorld.java | 2 + .../core/tutorials/TutorialRegistration.java | 2 + coreapi/linphonecore_jni.cc | 140 ++++++++++++++++++ .../org/linphone/core/LinphoneCall.java | 24 +++ .../org/linphone/core/LinphoneCallStats.java | 102 +++++++++++++ .../linphone/core/LinphoneCoreListener.java | 5 + 8 files changed, 279 insertions(+) create mode 100644 java/common/org/linphone/core/LinphoneCallStats.java diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java index 1d86d482b..bf253b727 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; @@ -97,6 +98,7 @@ public class TutorialBuddyStatus implements LinphoneCoreListener { public void globalState(LinphoneCore lc, GlobalState state, String message) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java index 91dc0f247..7514a1ddc 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; @@ -75,6 +76,7 @@ public class TutorialChatRoom implements LinphoneCoreListener { public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {} public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg){} + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java index 354f97501..4b63e8813 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; @@ -69,6 +70,7 @@ public class TutorialHelloWorld implements LinphoneCoreListener { public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {} public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java index 48e473d61..86b300143 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; @@ -80,6 +81,7 @@ public class TutorialRegistration implements LinphoneCoreListener { public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 16d44390c..38d36ae42 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -112,6 +112,7 @@ public: vTable.message_received = message_received; vTable.new_subscription_request = new_subscription_request; vTable.notify_presence_recv = notify_presence_recv; + vTable.call_stats_updated = callStatsUpdated; listenerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener)); @@ -133,6 +134,9 @@ public: callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State")); callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;"); + /*callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats);*/ + callStatsUpdatedId = env->GetMethodID(listenerClass, "callStatsUpdated", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCallStats;)V"); + chatMessageStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatMessage$State")); chatMessageStateFromIntId = env->GetStaticMethodID(chatMessageStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneChatMessage$State;"); @@ -172,6 +176,10 @@ public: addressClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAddressImpl")); addressCtrId =env->GetMethodID(addressClass,"", "(J)V"); + callStatsClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallStatsImpl")); + callStatsId = env->GetMethodID(callStatsClass, "", "(JJ)V"); + callSetAudioStatsId = env->GetMethodID(callClass, "setAudioStats", "(Lorg/linphone/core/LinphoneCallStats;)V"); + callSetVideoStatsId = env->GetMethodID(callClass, "setVideoStats", "(Lorg/linphone/core/LinphoneCallStats;)V"); } ~LinphoneCoreData() { @@ -184,6 +192,7 @@ public: env->DeleteGlobalRef(globalStateClass); env->DeleteGlobalRef(registrationStateClass); env->DeleteGlobalRef(callStateClass); + env->DeleteGlobalRef(callStatsClass); env->DeleteGlobalRef(chatMessageStateClass); env->DeleteGlobalRef(proxyClass); env->DeleteGlobalRef(callClass); @@ -202,6 +211,7 @@ public: jmethodID notifyPresenceReceivedId; jmethodID textReceivedId; jmethodID messageReceivedId; + jmethodID callStatsUpdatedId; jclass globalStateClass; jmethodID globalStateId; @@ -215,6 +225,11 @@ public: jmethodID callStateId; jmethodID callStateFromIntId; + jclass callStatsClass; + jmethodID callStatsId; + jmethodID callSetAudioStatsId; + jmethodID callSetVideoStatsId; + jclass chatMessageStateClass; jmethodID chatMessageStateFromIntId; @@ -424,6 +439,24 @@ public: } } + static void callStatsUpdated(LinphoneCore *lc, LinphoneCall* call, const LinphoneCallStats *stats) { + JNIEnv *env = 0; + jobject statsobj; + jobject callobj; + jint result = jvm->AttachCurrentThread(&env,NULL); + if (result != 0) { + ms_error("cannot attach VM\n"); + return; + } + LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc); + statsobj = env->NewObject(lcData->callStatsClass, lcData->callStatsId, (jlong)call, (jlong)stats); + callobj = lcData->getCall(env, call); + if (stats->type == LINPHONE_CALL_STATS_AUDIO) + env->CallVoidMethod(callobj, lcData->callSetAudioStatsId, statsobj); + else + env->CallVoidMethod(callobj, lcData->callSetVideoStatsId, statsobj); + env->CallVoidMethod(lcData->listener, lcData->callStatsUpdatedId, lcData->core, callobj, statsobj); + } }; @@ -1211,6 +1244,113 @@ extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEn return ((LinphoneCallLog*)ptr)->duration; } +/* CallStats */ +extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (int)((LinphoneCallStats *)stats_ptr)->type; +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { + const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + const report_block_t *srb = NULL; + + if (!stats->sent_rtcp) + return (jfloat)0.0; + /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ + if (stats->sent_rtcp->b_cont != NULL) + msgpullup(stats->sent_rtcp, -1); + if (rtcp_is_SR(stats->sent_rtcp)) + srb = rtcp_SR_get_report_block(stats->sent_rtcp, 0); + else if (rtcp_is_RR(stats->sent_rtcp)) + srb = rtcp_RR_get_report_block(stats->sent_rtcp, 0); + if (!srb) + return (jfloat)0.0; + return (jfloat)(100.0 * report_block_get_fraction_lost(srb) / 256.0); +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { + const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + const report_block_t *rrb = NULL; + + if (!stats->received_rtcp) + return (jfloat)0.0; + /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ + if (stats->received_rtcp->b_cont != NULL) + msgpullup(stats->received_rtcp, -1); + if (rtcp_is_RR(stats->received_rtcp)) + rrb = rtcp_RR_get_report_block(stats->received_rtcp, 0); + else if (rtcp_is_SR(stats->received_rtcp)) + rrb = rtcp_SR_get_report_block(stats->received_rtcp, 0); + if (!rrb) + return (jfloat)0.0; + return (jfloat)(100.0 * report_block_get_fraction_lost(rrb) / 256.0); +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + const LinphoneCall *call = (LinphoneCall *)call_ptr; + const LinphoneCallParams *params = linphone_call_get_current_params(call); + const PayloadType *pt; + const report_block_t *srb = NULL; + + if (!stats->sent_rtcp) + return (jfloat)0.0; + /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ + if (stats->sent_rtcp->b_cont != NULL) + msgpullup(stats->sent_rtcp, -1); + if (rtcp_is_SR(stats->sent_rtcp)) + srb = rtcp_SR_get_report_block(stats->sent_rtcp, 0); + else if (rtcp_is_RR(stats->sent_rtcp)) + srb = rtcp_RR_get_report_block(stats->sent_rtcp, 0); + if (!srb) + return (jfloat)0.0; + if (stats->type == LINPHONE_CALL_STATS_AUDIO) + pt = linphone_call_params_get_used_audio_codec(params); + else + pt = linphone_call_params_get_used_video_codec(params); + return (jfloat)((float)report_block_get_interarrival_jitter(srb) / (float)pt->clock_rate); +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + const LinphoneCall *call = (LinphoneCall *)call_ptr; + const LinphoneCallParams *params = linphone_call_get_current_params(call); + const PayloadType *pt; + const report_block_t *rrb = NULL; + + if (!stats->received_rtcp) + return (jfloat)0.0; + /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ + if (stats->received_rtcp->b_cont != NULL) + msgpullup(stats->received_rtcp, -1); + if (rtcp_is_SR(stats->received_rtcp)) + rrb = rtcp_SR_get_report_block(stats->received_rtcp, 0); + else if (rtcp_is_RR(stats->received_rtcp)) + rrb = rtcp_RR_get_report_block(stats->received_rtcp, 0); + if (!rrb) + return (jfloat)0.0; + if (stats->type == LINPHONE_CALL_STATS_AUDIO) + pt = linphone_call_params_get_used_audio_codec(params); + else + pt = linphone_call_params_get_used_video_codec(params); + return (jfloat)((float)report_block_get_interarrival_jitter(rrb) / (float)pt->clock_rate); +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getRoundTripDelay(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jfloat)((LinphoneCallStats *)stats_ptr)->round_trip_delay; +} +extern "C" jlong Java_org_linphone_core_LinphoneCallStatsImpl_getLatePacketsCumulativeNumber(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + LinphoneCall *call = (LinphoneCall *)call_ptr; + rtp_stats_t rtp_stats; + + memset(&rtp_stats, 0, sizeof(rtp_stats)); + if (stats->type == LINPHONE_CALL_STATS_AUDIO) + audio_stream_get_local_rtp_stats(call->audiostream, &rtp_stats); +#ifdef VIDEO_ENABLED + else + video_stream_get_local_rtp_stats(call->videostream, &rtp_stats); +#endif + return (jlong)rtp_stats.outoftime; +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getJitterBufferSize(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jfloat)((LinphoneCallStats *)stats_ptr)->jitter_stats.jitter_buffer_size_ms; +} + /*payloadType*/ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) { PayloadType* pt = (PayloadType*)ptr; diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index 6fe6704de..35e173d5a 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -159,6 +159,30 @@ public interface LinphoneCall { * @Return LinphoneCallLog **/ LinphoneCallLog getCallLog(); + + /** + * Set the audio statistics associated with this call. + * @return LinphoneCallStats + */ + void setAudioStats(LinphoneCallStats stats); + + /** + * Set the video statistics associated with this call. + * @return LinphoneCallStats + */ + void setVideoStats(LinphoneCallStats stats); + + /** + * Get the audio statistics associated with this call. + * @return LinphoneCallStats + */ + LinphoneCallStats getAudioStats(); + + /** + * Get the video statistics associated with this call. + * @return LinphoneCallStats + */ + LinphoneCallStats getVideoStats(); LinphoneCallParams getRemoteParams(); diff --git a/java/common/org/linphone/core/LinphoneCallStats.java b/java/common/org/linphone/core/LinphoneCallStats.java new file mode 100644 index 000000000..f391b2a91 --- /dev/null +++ b/java/common/org/linphone/core/LinphoneCallStats.java @@ -0,0 +1,102 @@ +/* +LinPhoneCallStats.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.util.Vector; + + +public interface LinphoneCallStats { + static public class MediaType { + static private Vector values = new Vector(); + /** + * Audio + */ + static public MediaType Audio = new MediaType(0, "Audio"); + /** + * Video + */ + static public MediaType Video = new MediaType(1, "Video"); + protected final int mValue; + private final String mStringValue; + + private MediaType(int value, String stringValue) { + mValue = value; + values.addElement(this); + mStringValue = stringValue; + } + public static MediaType fromInt(int value) { + for (int i = 0; i < values.size(); i++) { + MediaType mtype = (MediaType) values.elementAt(i); + if (mtype.mValue == value) return mtype; + } + throw new RuntimeException("MediaType not found [" + value + "]"); + } + public String toString() { + return mStringValue; + } + } + + /** + * Get the stats media type + * @return MediaType + */ + public MediaType getMediaType(); + + /** + * Get the sender loss rate since last report + * @return The sender loss rate + */ + public float getSenderLossRate(); + + /** + * Get the receiver loss rate since last report + * @return The receiver loss rate + */ + public float getReceiverLossRate(); + + /** + * Get the sender interarrival jitter + * @return The interarrival jitter at last emitted sender report + */ + public float getSenderInterarrivalJitter(); + + /** + * Get the receiver interarrival jitter + * @return The interarrival jitter at last received receiver report + */ + public float getReceiverInterarrivalJitter(); + + /** + * Get the round trip delay + * @return The round trip delay in seconds, -1 if the information is not available + */ + public float getRoundTripDelay(); + + /** + * Get the cumulative number of late packets + * @return The cumulative number of late packets + */ + public long getLatePacketsCumulativeNumber(); + + /** + * Get the jitter buffer size + * @return The jitter buffer size in milliseconds + */ + public float getJitterBufferSize(); +} diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index a84f736d2..c81dafec4 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -40,6 +40,11 @@ public interface LinphoneCoreListener { * */ void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message); + /** + * Call stats notification + */ + void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats); + /** * Callback to display change in encryption state. * @param encrypted true if all streams of the call are encrypted From 28cacd507485d88bb933d076ab968494f33f9074 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 21 Sep 2012 15:52:16 +0200 Subject: [PATCH 563/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index f225ee612..e5a4c5247 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f225ee612009009075ab6caf7ef91bb3a21fa25f +Subproject commit e5a4c52472dd1ec6d7eddacd69d2c0cf17288359 From adc966996b57d8c12a6efe583cabff2ce348be00 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 19 Sep 2012 17:24:38 +0200 Subject: [PATCH 564/769] Add JNI to access call statistics. --- LinphoneCallImpl.java | 15 +++++++ LinphoneCallStatsImpl.java | 83 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 LinphoneCallStatsImpl.java diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index e73a8aacf..cf471f52c 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -23,6 +23,9 @@ class LinphoneCallImpl implements LinphoneCall { protected final long nativePtr; boolean ownPtr = false; + private LinphoneCallStats audioStats; + private LinphoneCallStats videoStats; + native private void finalize(long nativePtr); native private long getCallLog(long nativePtr); private native boolean isIncoming(long nativePtr); @@ -58,6 +61,18 @@ class LinphoneCallImpl implements LinphoneCall { return null; } } + public void setAudioStats(LinphoneCallStats stats) { + audioStats = stats; + } + public void setVideoStats(LinphoneCallStats stats) { + videoStats = stats; + } + public LinphoneCallStats getAudioStats() { + return audioStats; + } + public LinphoneCallStats getVideoStats() { + return videoStats; + } public CallDirection getDirection() { return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing; } diff --git a/LinphoneCallStatsImpl.java b/LinphoneCallStatsImpl.java new file mode 100644 index 000000000..ffc19eddc --- /dev/null +++ b/LinphoneCallStatsImpl.java @@ -0,0 +1,83 @@ +/* +LinPhoneCallStatsImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + + +class LinphoneCallStatsImpl implements LinphoneCallStats { + private int mediaType; + private float senderLossRate; + private float receiverLossRate; + private float senderInterarrivalJitter; + private float receiverInterarrivalJitter; + private float roundTripDelay; + private long latePacketsCumulativeNumber; + private float jitterBufferSize; + + private native int getMediaType(long nativeStatsPtr); + private native float getSenderLossRate(long nativeStatsPtr); + private native float getReceiverLossRate(long nativeStatsPtr); + private native float getSenderInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr); + private native float getReceiverInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr); + private native float getRoundTripDelay(long nativeStatsPtr); + private native long getLatePacketsCumulativeNumber(long nativeStatsPtr, long nativeCallPtr); + private native float getJitterBufferSize(long nativeStatsPtr); + + protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) { + mediaType = getMediaType(nativeStatsPtr); + senderLossRate = getSenderLossRate(nativeStatsPtr); + receiverLossRate = getReceiverLossRate(nativeStatsPtr); + senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr, nativeCallPtr); + receiverInterarrivalJitter = getReceiverInterarrivalJitter(nativeStatsPtr, nativeCallPtr); + roundTripDelay = getRoundTripDelay(nativeStatsPtr); + latePacketsCumulativeNumber = getLatePacketsCumulativeNumber(nativeStatsPtr, nativeCallPtr); + jitterBufferSize = getJitterBufferSize(nativeStatsPtr); + } + + public MediaType getMediaType() { + return MediaType.fromInt(mediaType); + } + + public float getSenderLossRate() { + return senderLossRate; + } + + public float getReceiverLossRate() { + return receiverLossRate; + } + + public float getSenderInterarrivalJitter() { + return senderInterarrivalJitter; + } + + public float getReceiverInterarrivalJitter() { + return receiverInterarrivalJitter; + } + + public float getRoundTripDelay() { + return roundTripDelay; + } + + public long getLatePacketsCumulativeNumber() { + return latePacketsCumulativeNumber; + } + + public float getJitterBufferSize() { + return jitterBufferSize; + } +} From 3969da946c4512eae2f10877371049c7ed983180 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 24 Sep 2012 11:24:05 +0200 Subject: [PATCH 565/769] fix pango bug on macos x --- Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 6faebc4fc..8756019f4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -218,7 +218,9 @@ bundle: $(LIBICONV_HACK) MS2_PLUGINS_INSTALL_PREFIX=$(prefix) \ gtk-mac-bundler $(PACKAGE_BUNDLE_FILE) printf "[Pango]\nModuleFiles=./etc/pango/pango.modules\n" \ - > $(BUNDLEDIR)/Contents/Resources/etc/pango/pangorc + > $(BUNDLEDIR)/Contents/Resources/etc/pango/pangorc + cp -f $(BUNDLEDIR)/Contents/Resources/etc/pango/pango.modules $(BUNDLEDIR)/Contents/Resources/etc/pango/pango.modules.orig + sed -e 's:@executable_path/../Resources:../..:g' $(BUNDLEDIR)/Contents/Resources/etc/pango/pango.modules.orig > $(BUNDLEDIR)/Contents/Resources/etc/pango/pango.modules cp -f $(LIBICONV_HACK) $(BUNDLEDIR)/Contents/Resources/lib/. cd $(BUNDLEDIR)/.. && rm -f $(MACAPPZIP) && zip -r $(MACAPPZIP) $(MACAPPNAME) && cd - From e4309a8757f1a85b39d352fcc67e732a2e7e548e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 24 Sep 2012 12:41:13 +0200 Subject: [PATCH 566/769] fix get local address in case of 3G connectivity on ios --- coreapi/misc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 15fc5374c..df65b53f4 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -971,10 +971,15 @@ static int get_local_ip_with_getifaddrs(int type, char *address, int size) if (getifaddrs(&ifpstart) < 0) { return -1; } - +#ifndef __linux + #define UP_FLAG IFF_UP /* interface is up */ +#else + #define UP_FLAG IFF_RUNNING /* resources allocated */ +#endif + for (ifp = ifpstart; ifp != NULL; ifp = ifp->ifa_next) { if (ifp->ifa_addr && ifp->ifa_addr->sa_family == type - && (ifp->ifa_flags & IFF_RUNNING) && !(ifp->ifa_flags & IFF_LOOPBACK)) + && (ifp->ifa_flags & UP_FLAG) && !(ifp->ifa_flags & IFF_LOOPBACK)) { getnameinfo(ifp->ifa_addr, (type == AF_INET6) ? From e3d56d4124e3df25811d704db9b256242ed12328 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 24 Sep 2012 18:45:55 +0200 Subject: [PATCH 567/769] Select ICE candidates on completion even for the controlled agent. --- coreapi/linphonecall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7f11028ab..d3212a9f6 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1767,16 +1767,16 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { switch (ice_session_state(call->ice_session)) { case IS_Completed: + ice_session_select_candidates(call->ice_session); if (ice_session_role(call->ice_session) == IR_Controlling) { - ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); } break; case IS_Failed: if (ice_session_has_completed_check_list(call->ice_session) == TRUE) { + ice_session_select_candidates(call->ice_session); if (ice_session_role(call->ice_session) == IR_Controlling) { /* At least one ICE session has succeeded, so perform a call update. */ - ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); } } From c55a2c6b50d86e79535e256f6ea8e05985b9ddfd Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 24 Sep 2012 18:46:57 +0200 Subject: [PATCH 568/769] Delay creation of local media description so that edge network detection works with ICE activated. --- coreapi/callbacks.c | 1 - coreapi/linphonecall.c | 14 +++++++++----- coreapi/linphonecore.c | 7 +++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 14ca748e1..8954b85da 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -184,7 +184,6 @@ static void call_received(SalOp *h){ } call=linphone_call_new_incoming(lc,from_addr,to_addr,h); - sal_call_set_local_media_description(h,call->localdesc); /* the call is acceptable so we can now add it to our list */ linphone_core_add_call(lc,call); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d3212a9f6..3d32371a9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -269,11 +269,11 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].crypto[1].algo = 0; md->streams[i].crypto[2].algo = 0; } - if ((linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, i) == NULL)) { - ice_session_add_check_list(call->ice_session, ice_check_list_new()); - } } update_media_description_from_stun(md,&call->ac,&call->vc); + if (call->ice_session != NULL) { + linphone_core_update_local_media_description_from_ice(md, call->ice_session); + } linphone_address_destroy(addr); return md; } @@ -378,7 +378,6 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr if (ping_time>=0) { linphone_core_adapt_to_network(lc,ping_time,&call->params); } - call->localdesc=create_local_media_description(lc,call); call->camera_active=params->has_video; discover_mtu(lc,linphone_address_get_domain (to)); @@ -439,7 +438,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro if (ping_time>=0) { linphone_core_adapt_to_network(lc,ping_time,&call->params); }; - call->localdesc=create_local_media_description(lc,call); call->camera_active=call->params.has_video; discover_mtu(lc,linphone_address_get_domain(from)); @@ -1011,6 +1009,9 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)){ rtp_session_set_pktinfo(audiostream->session, TRUE); rtp_session_set_symmetric_rtp(audiostream->session, FALSE); + if (ice_session_check_list(call->ice_session, 0) == NULL) { + ice_session_add_check_list(call->ice_session, ice_check_list_new()); + } audiostream->ice_check_list = ice_session_check_list(call->ice_session, 0); ice_check_list_set_rtp_session(audiostream->ice_check_list, audiostream->session); } @@ -1044,6 +1045,9 @@ void linphone_call_init_video_stream(LinphoneCall *call){ if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, 1))){ rtp_session_set_pktinfo(call->videostream->session, TRUE); rtp_session_set_symmetric_rtp(call->videostream->session, FALSE); + if (ice_session_check_list(call->ice_session, 1) == NULL) { + ice_session_add_check_list(call->ice_session, ice_check_list_new()); + } call->videostream->ice_check_list = ice_session_check_list(call->ice_session, 1); ice_check_list_set_rtp_session(call->videostream->ice_check_list, call->videostream->session); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 99482f620..8e2b9ac98 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2195,10 +2195,9 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro linphone_call_init_media_streams(call); if (lc->ringstream==NULL) audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); + call->localdesc=create_local_media_description(lc,call); if (!lc->sip_conf.sdp_200_ack){ call->media_pending=TRUE; - if (call->ice_session != NULL) - linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); sal_call_set_local_media_description(call->op,call->localdesc); } real_url=linphone_address_as_string(call->log->to); @@ -2457,8 +2456,8 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE); const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc); - if (call->ice_session != NULL) - linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); + call->localdesc=create_local_media_description(lc,call); + sal_call_set_local_media_description(call->op,call->localdesc); md=sal_call_get_final_media_description(call->op); if (md && sal_media_description_empty(md)){ sal_call_decline(call->op,SalReasonMedia,NULL); From 88298e0d7ef5d0ed2b8ac8b18f23bf6a2901d246 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 24 Sep 2012 18:47:43 +0200 Subject: [PATCH 569/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e5a4c5247..fd8aa5fa1 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e5a4c52472dd1ec6d7eddacd69d2c0cf17288359 +Subproject commit fd8aa5fa14d1f683aef1a6108fd497dc3e42891a From 0c0f6271ed787c463ec5198c3cf8fcf22bc8c7d8 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 25 Sep 2012 10:52:51 +0200 Subject: [PATCH 570/769] Added lookupCCCFromIso method to JNI --- coreapi/linphonecore_jni.cc | 6 ++++++ java/common/org/linphone/core/LinphoneProxyConfig.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 38d36ae42..a11c158c8 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1074,6 +1074,12 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhone env->ReleaseStringUTFChars(jnumber, number); return normalizedNumber; } +extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jstring jiso) { + const char* iso = env->GetStringUTFChars(jiso, NULL); + int prefix = linphone_dial_plan_lookup_ccc_from_iso(iso); + env->ReleaseStringUTFChars(jiso, iso); + return (jint) prefix; +} extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIEnv* env ,jobject thiz ,jlong proxyCfg) { diff --git a/java/common/org/linphone/core/LinphoneProxyConfig.java b/java/common/org/linphone/core/LinphoneProxyConfig.java index bf2907d26..eee58c915 100644 --- a/java/common/org/linphone/core/LinphoneProxyConfig.java +++ b/java/common/org/linphone/core/LinphoneProxyConfig.java @@ -139,4 +139,10 @@ public interface LinphoneProxyConfig { * @param parameters to add */ public void setContactParameters(String params); + + /** + * Return the international prefix for the given country + * @param country iso code + */ + public int lookupCCCFromIso(String iso); } From 1799f1cb7e12b398e85981da900ec1f7d3f484e0 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 25 Sep 2012 10:54:42 +0200 Subject: [PATCH 571/769] Linphone updated --- LinphoneProxyConfigImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 0b7aa7f6e..2295bce03 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -77,6 +77,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native boolean publishEnabled(long ptr); private native void setContactParameters(long ptr, String params); + private native int lookupCCCFromIso(long nativePtr, String iso); + public void enableRegister(boolean value) { enableRegister(nativePtr,value); } @@ -147,4 +149,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public void setContactParameters(String params) { setContactParameters(nativePtr, params); } + @Override + public int lookupCCCFromIso(String iso) { + return lookupCCCFromIso(nativePtr, iso); + } } From df3f21cac0046a6c2880aacd9ed434c287ff44d9 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 25 Sep 2012 11:52:27 +0200 Subject: [PATCH 572/769] Fix LookupCCCFromIso --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index a11c158c8..e60090c40 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1074,7 +1074,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhone env->ReleaseStringUTFChars(jnumber, number); return normalizedNumber; } -extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jstring jiso) { +extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring jiso) { const char* iso = env->GetStringUTFChars(jiso, NULL); int prefix = linphone_dial_plan_lookup_ccc_from_iso(iso); env->ReleaseStringUTFChars(jiso, iso); From 13a3f5fe32d294524048f9e7e69800fe949c4825 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 25 Sep 2012 12:06:27 +0200 Subject: [PATCH 573/769] set gtk required version to 2.18 --- gtk/dscp_settings.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/dscp_settings.ui b/gtk/dscp_settings.ui index 4664768c6..22679a49b 100644 --- a/gtk/dscp_settings.ui +++ b/gtk/dscp_settings.ui @@ -1,6 +1,6 @@ - + False From c01c9b5ee74992ba2ea8841e22b61a5f58a5304c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 25 Sep 2012 14:15:27 +0200 Subject: [PATCH 574/769] fix contact address bug with ice fix edge detection with ice --- coreapi/callbacks.c | 2 +- coreapi/linphonecall.c | 26 +++++++++----------------- coreapi/linphonecore.c | 29 +++++++++++++++-------------- coreapi/private.h | 35 ++++++++++++++++++++--------------- 4 files changed, 45 insertions(+), 47 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 8954b85da..4e5661b35 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -534,7 +534,7 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de call->localdesc->streams[i].proto = SalProtoRtpAvp; memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto)); } - linphone_core_start_invite(lc, call, NULL); + linphone_core_start_invite(lc, call); } return; } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 3d32371a9..380f07a0c 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -217,6 +217,10 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li LinphoneAddress *addr=linphone_address_new(me); const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); + + if (call->ping_time>0) { + linphone_core_adapt_to_network(lc,call->ping_time,&call->params); + } md->session_id=session_id; md->session_ver=session_ver; @@ -360,7 +364,6 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params) { LinphoneCall *call=ms_new0(LinphoneCall,1); - int ping_time=-1; call->dir=LinphoneCallOutgoing; call->op=sal_op_new(lc->sal); sal_op_set_user_pointer(call->op,call); @@ -373,10 +376,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr ice_session_set_role(call->ice_session, IR_Controlling); } if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) { - ping_time=linphone_core_run_stun_tests(call->core,call); - } - if (ping_time>=0) { - linphone_core_adapt_to_network(lc,ping_time,&call->params); + call->ping_time=linphone_core_run_stun_tests(call->core,call); } call->camera_active=params->has_video; @@ -391,7 +391,6 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){ LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; - int ping_time=-1; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -430,14 +429,11 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro } break; case LinphonePolicyUseStun: - ping_time=linphone_core_run_stun_tests(call->core,call); + call->ping_time=linphone_core_run_stun_tests(call->core,call); /* No break to also destroy ice session in this case. */ default: break; } - if (ping_time>=0) { - linphone_core_adapt_to_network(lc,ping_time,&call->params); - }; call->camera_active=call->params.has_video; discover_mtu(lc,linphone_address_get_domain(from)); @@ -1767,6 +1763,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ OrtpEventType evt=ortp_event_get_type(ev); OrtpEventData *evd=ortp_event_get_data(ev); + int ping_time; if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { switch (ice_session_state(call->ice_session)) { @@ -1790,7 +1787,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ } linphone_core_update_ice_state_in_call_stats(call); } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { - int ping_time = -1; + if (evd->info.ice_processing_successful==TRUE) { ice_session_compute_candidates_foundations(call->ice_session); ice_session_eliminate_redundant_candidates(call->ice_session); @@ -1798,6 +1795,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ ping_time = ice_session_gathering_duration(call->ice_session); if (ping_time >=0) { ping_time /= ice_session_nb_check_lists(call->ice_session); + call->ping_time=ping_time; } } else { ms_warning("No STUN answer from [%s], disabling ICE",linphone_core_get_stun_server(call->core)); @@ -1811,16 +1809,10 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_start_accept_call_update(call->core, call); break; case LinphoneCallOutgoingInit: - if (ping_time >= 0) { - linphone_core_adapt_to_network(call->core, ping_time, &call->params); - } linphone_call_stop_media_streams(call); linphone_core_proceed_with_invite_if_ready(call->core, call, NULL); break; default: - if (ping_time >= 0) { - linphone_core_adapt_to_network(call->core, ping_time, &call->params); - } linphone_call_stop_media_streams(call); linphone_core_notify_incoming_call(call->core, call); break; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 8e2b9ac98..e90f595a2 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1910,7 +1910,7 @@ void linphone_core_iterate(LinphoneCore *lc){ linphone_call_delete_ice_session(call); linphone_call_stop_media_streams(call); } - linphone_core_start_invite(lc,call,NULL); + linphone_core_start_invite(lc,call); } if (call->state==LinphoneCallIncomingReceived){ elapsed=curtime-call->start_time; @@ -2174,16 +2174,17 @@ int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *c } if ((ice_ready == TRUE) && (ping_ready == TRUE)) { - return linphone_core_start_invite(lc, call, dest_proxy); + return linphone_core_start_invite(lc, call); } return 0; } -int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy){ +int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){ int err; char *contact; char *real_url,*barmsg; char *from; + LinphoneProxyConfig *dest_proxy=call->dest_proxy; /*try to be best-effort in giving real local or routable contact address */ contact=get_fixed_contact(lc,call,dest_proxy); @@ -2315,10 +2316,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const { const char *route=NULL; const char *from=NULL; - LinphoneProxyConfig *proxy=NULL; + LinphoneProxyConfig *proxy=NULL,*dest_proxy=NULL; LinphoneAddress *parsed_url2=NULL; char *real_url=NULL; - LinphoneProxyConfig *dest_proxy=NULL; LinphoneCall *call; bool_t use_ice = FALSE; @@ -2351,6 +2351,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const parsed_url2=linphone_address_new(from); call=linphone_call_new_outgoing(lc,parsed_url2,linphone_address_clone(addr),params); + call->dest_proxy=dest_proxy; sal_op_set_route(call->op,route); if(linphone_core_add_call(lc,call)!= 0) @@ -2376,7 +2377,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const } } - if (dest_proxy==NULL && lc->sip_conf.ping_with_options==TRUE){ + if (call->dest_proxy==NULL && lc->sip_conf.ping_with_options==TRUE){ /*defer the start of the call after the OPTIONS ping*/ call->ping_replied=FALSE; call->ping_op=sal_op_new(lc->sal); @@ -2384,7 +2385,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const sal_op_set_user_pointer(call->ping_op,call); call->start_time=time(NULL); }else{ - if (use_ice==FALSE) linphone_core_start_invite(lc,call,dest_proxy); + if (use_ice==FALSE) linphone_core_start_invite(lc,call); } if (real_url!=NULL) ms_free(real_url); @@ -2718,7 +2719,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call){ **/ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params) { - LinphoneProxyConfig *cfg=NULL,*dest_proxy=NULL; + LinphoneProxyConfig *cfg=NULL; const char *contact=NULL; SalOp *replaced; SalMediaDescription *new_md; @@ -2766,15 +2767,15 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, } linphone_core_get_default_proxy(lc,&cfg); - dest_proxy=cfg; - dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to); + call->dest_proxy=cfg; + call->dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to); - if (cfg!=dest_proxy && dest_proxy!=NULL) { + if (cfg!=call->dest_proxy && call->dest_proxy!=NULL) { ms_message("Overriding default proxy setting for this call:"); - ms_message("The used identity will be %s",linphone_proxy_config_get_identity(dest_proxy)); + ms_message("The used identity will be %s",linphone_proxy_config_get_identity(call->dest_proxy)); } /*try to be best-effort in giving real local or routable contact address*/ - contact=get_fixed_contact(lc,call,dest_proxy); + contact=get_fixed_contact(lc,call,call->dest_proxy); if (contact) sal_op_set_contact(call->op,contact); @@ -5084,7 +5085,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) { void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) { params->has_video=linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate; - params->media_encryption=linphone_core_get_media_encryption(lc); + params->media_encryption=linphone_core_get_media_encryption(lc); params->in_conference=FALSE; } diff --git a/coreapi/private.h b/coreapi/private.h index 1e93c19d7..d8e07c1b9 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -125,6 +125,7 @@ struct _LinphoneCall LinphoneCallState state; LinphoneCallState transfer_state; /*idle if no transfer*/ LinphoneReason reason; + LinphoneProxyConfig *dest_proxy; int refcnt; void * user_pointer; int audio_port; @@ -139,27 +140,31 @@ struct _LinphoneCall LinphoneCallParams remote_params; int up_bw; /*upload bandwidth setting at the time the call is started. Used to detect if it changes during a call */ int audio_bw; /*upload bandwidth used by audio */ - bool_t refer_pending; - bool_t media_pending; - bool_t audio_muted; - bool_t camera_active; - bool_t all_muted; /*this flag is set during early medias*/ - bool_t playing_ringbacktone; - bool_t owns_call_log; - bool_t ringing_beep; /* whether this call is ringing through an already existent current call*/ OrtpEvQueue *audiostream_app_evq; char *auth_token; OrtpEvQueue *videostream_app_evq; - bool_t videostream_encrypted; - bool_t audiostream_encrypted; - bool_t auth_token_verified; - bool_t defer_update; - bool_t was_automatically_paused; - bool_t ping_replied; CallCallbackObj nextVideoFrameDecoded; LinphoneCallStats stats[2]; IceSession *ice_session; LinphoneChatMessage* pending_message; + int ping_time; + bool_t refer_pending; + bool_t media_pending; + bool_t audio_muted; + bool_t camera_active; + + bool_t all_muted; /*this flag is set during early medias*/ + bool_t playing_ringbacktone; + bool_t owns_call_log; + bool_t ringing_beep; /* whether this call is ringing through an already existent current call*/ + + bool_t videostream_encrypted; + bool_t audiostream_encrypted; + bool_t auth_token_verified; + bool_t defer_update; + + bool_t was_automatically_paused; + bool_t ping_replied; }; @@ -285,7 +290,7 @@ void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float void linphone_core_stop_waiting(LinphoneCore *lc); int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy); -int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy); +int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call); int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call); int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call); void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call); From fda9d120e04fa83b7a3d7937a3acba1e51ef5857 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 15:09:15 +0200 Subject: [PATCH 575/769] Fix ICE gathering candidates for the video stream. --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 380f07a0c..38ed1de65 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1038,7 +1038,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){ RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); } - if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, 1))){ + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)){ rtp_session_set_pktinfo(call->videostream->session, TRUE); rtp_session_set_symmetric_rtp(call->videostream->session, FALSE); if (ice_session_check_list(call->ice_session, 1) == NULL) { From 3e48688f721f430d71ed02b453570f069265a964 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 15:22:00 +0200 Subject: [PATCH 576/769] Add comment about iterate() interval for ICE to work properly. --- coreapi/linphonecore.h | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 583d66356..892864fbb 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -904,6 +904,7 @@ LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config, void* userdata); /* function to be periodically called in a main loop */ +/* For ICE to work properly it should be called every 20ms */ void linphone_core_iterate(LinphoneCore *lc); #if 0 /*not implemented yet*/ /** From d2bf8846e3c40ce5b4dec886f2d0fc6d9698fc87 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 15:25:17 +0200 Subject: [PATCH 577/769] Update ms2 submodule for ICE improvements. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index fd8aa5fa1..6104d4268 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit fd8aa5fa14d1f683aef1a6108fd497dc3e42891a +Subproject commit 6104d42688b022b9d99c7ecc2261c3cff2978caf From 898a4ce91ee94e81b12e424599d641a58a47a2fb Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 17:21:01 +0200 Subject: [PATCH 578/769] Extend call statistics JNI. Add interface for download bandwidth, upload bandwidth and ICE state. --- coreapi/linphonecore_jni.cc | 9 +++ .../org/linphone/core/LinphoneCallStats.java | 62 +++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e60090c40..cb1c72335 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1254,6 +1254,15 @@ extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEn extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) { return (int)((LinphoneCallStats *)stats_ptr)->type; } +extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getIceState(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (int)((LinphoneCallStats *)stats_ptr)->ice_state; +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getDownloadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jfloat)((LinphoneCallStats *)stats_ptr)->download_bandwidth; +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getUploadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jfloat)((LinphoneCallStats *)stats_ptr)->upload_bandwidth; +} extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; const report_block_t *srb = NULL; diff --git a/java/common/org/linphone/core/LinphoneCallStats.java b/java/common/org/linphone/core/LinphoneCallStats.java index f391b2a91..15b4cfb34 100644 --- a/java/common/org/linphone/core/LinphoneCallStats.java +++ b/java/common/org/linphone/core/LinphoneCallStats.java @@ -51,6 +51,51 @@ public interface LinphoneCallStats { return mStringValue; } } + static public class IceState { + static private Vector values = new Vector(); + /** + * Not activated + */ + static public IceState NotActivated = new IceState(0, "Not activated"); + /** + * Failed + */ + static public IceState Failed = new IceState(1, "Failed"); + /** + * In progress + */ + static public IceState InProgress = new IceState(2, "In progress"); + /** + * Host connection + */ + static public IceState HostConnection = new IceState(3, "Host connection"); + /** + * Reflexive connection + */ + static public IceState ReflexiveConnection = new IceState(4, "Reflexive connection"); + /** + * Relay connection + */ + static public IceState RelayConnection = new IceState(5, "Relay connection"); + protected final int mValue; + private final String mStringValue; + + private IceState(int value, String stringValue) { + mValue = value; + values.addElement(this); + mStringValue = stringValue; + } + public static IceState fromInt(int value) { + for (int i = 0; i < values.size(); i++) { + IceState mstate = (IceState) values.elementAt(i); + if (mstate.mValue == value) return mstate; + } + throw new RuntimeException("IceState not found [" + value + "]"); + } + public String toString() { + return mStringValue; + } + } /** * Get the stats media type @@ -58,6 +103,23 @@ public interface LinphoneCallStats { */ public MediaType getMediaType(); + /** + * Get the ICE state + */ + public IceState getIceState(); + + /** + * Get the download bandwidth in kbit/s + * @return The download bandwidth + */ + public float getDownloadBandwidth(); + + /** + * Get the upload bandwidth in kbit/s + * @return The upload bandwidth + */ + public float getUploadBandwidth(); + /** * Get the sender loss rate since last report * @return The sender loss rate From 767a567bd6b173cd72660c3d39237b52c440892c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 17:22:59 +0200 Subject: [PATCH 579/769] Extend call statistics JNI. Add interface for download bandwidth, upload bandwidth and ICE state. --- LinphoneCallStatsImpl.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/LinphoneCallStatsImpl.java b/LinphoneCallStatsImpl.java index ffc19eddc..53fcb5ffd 100644 --- a/LinphoneCallStatsImpl.java +++ b/LinphoneCallStatsImpl.java @@ -21,6 +21,9 @@ package org.linphone.core; class LinphoneCallStatsImpl implements LinphoneCallStats { private int mediaType; + private int iceState; + private float downloadBandwidth; + private float uploadBandwidth; private float senderLossRate; private float receiverLossRate; private float senderInterarrivalJitter; @@ -30,6 +33,9 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { private float jitterBufferSize; private native int getMediaType(long nativeStatsPtr); + private native int getIceState(long nativeStatsPtr); + private native float getDownloadBandwidth(long nativeStatsPtr); + private native float getUploadBandwidth(long nativeStatsPtr); private native float getSenderLossRate(long nativeStatsPtr); private native float getReceiverLossRate(long nativeStatsPtr); private native float getSenderInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr); @@ -40,6 +46,9 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) { mediaType = getMediaType(nativeStatsPtr); + iceState = getIceState(nativeStatsPtr); + downloadBandwidth = getDownloadBandwidth(nativeStatsPtr); + uploadBandwidth = getUploadBandwidth(nativeStatsPtr); senderLossRate = getSenderLossRate(nativeStatsPtr); receiverLossRate = getReceiverLossRate(nativeStatsPtr); senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr, nativeCallPtr); @@ -53,6 +62,18 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { return MediaType.fromInt(mediaType); } + public IceState getIceState() { + return IceState.fromInt(iceState); + } + + public float getDownloadBandwidth() { + return downloadBandwidth; + } + + public float getUploadBandwidth() { + return uploadBandwidth; + } + public float getSenderLossRate() { return senderLossRate; } From 2043ec6a90a4f2e7f077391909c968b4f7c98e9e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 26 Sep 2012 12:44:13 +0200 Subject: [PATCH 580/769] remove GPL statements from source code. Use SDES tool same as user agent. Fix call parameters when video is disabled. --- coreapi/linphonecall.c | 11 +++++++---- coreapi/linphonecore.c | 12 ++++++++++++ coreapi/linphonecore.h | 4 ++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 38ed1de65..d43c457b6 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1231,8 +1231,6 @@ static void setup_ring_player(LinphoneCore *lc, LinphoneCall *call){ ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time); } -#define LINPHONE_RTCP_SDES_TOOL "Linphone-" LINPHONE_VERSION - static bool_t linphone_call_sound_resources_available(LinphoneCall *call){ LinphoneCore *lc=call->core; LinphoneCall *current=linphone_core_get_current_call(lc); @@ -1251,6 +1249,8 @@ static int find_crypto_index_from_tag(const SalSrtpCryptoAlgo crypto[],unsigned static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cname, bool_t muted, bool_t send_ringbacktone, bool_t use_arc){ LinphoneCore *lc=call->core; int used_pt=-1; + char rtcp_tool[128]={0}; + snprintf(rtcp_tool,sizeof(rtcp_tool)-1,"%s-%s",linphone_core_get_user_agent_name(),linphone_core_get_user_agent_version()); /* look for savp stream first */ const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpSavp,SalAudio); @@ -1336,7 +1336,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna if (send_ringbacktone){ setup_ring_player(lc,call); } - audio_stream_set_rtcp_information(call->audiostream, cname, LINPHONE_RTCP_SDES_TOOL); + audio_stream_set_rtcp_information(call->audiostream, cname, rtcp_tool); /* valid local tags are > 0 */ if (stream->proto == SalProtoRtpSavp) { @@ -1373,6 +1373,9 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna /* look for savp stream first */ const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpSavp,SalVideo); + char rtcp_tool[128]={0}; + snprintf(rtcp_tool,sizeof(rtcp_tool)-1,"%s-%s",linphone_core_get_user_agent_name(),linphone_core_get_user_agent_version()); + /* no savp audio stream, use avp */ if (!vstream) vstream=sal_media_description_find_stream(call->resultdesc, @@ -1436,7 +1439,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna call->video_profile, rtp_addr, vstream->rtp_port, rtcp_addr, linphone_core_rtcp_enabled(lc) ? (vstream->rtcp_port) : 0, used_pt, linphone_core_get_video_jittcomp(lc), cam); - video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); + video_stream_set_rtcp_information(call->videostream, cname,rtcp_tool); } if (vstream->proto == SalProtoRtpSavp) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e90f595a2..1a7b97de0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1596,6 +1596,14 @@ void linphone_core_set_user_agent(const char *name, const char *ver){ strncpy(_ua_version,ver,sizeof(_ua_version)); } +const char *linphone_core_get_user_agent_name(void){ + return _ua_name; +} + +const char *linphone_core_get_user_agent_version(void){ + return _ua_version; +} + static void transport_error(LinphoneCore *lc, const char* transport, int port){ char *msg=ortp_strdup_printf("Could not start %s transport on port %i, maybe this port is already used.",transport,port); ms_warning("%s",msg); @@ -2662,6 +2670,10 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const }else call->params=*params; + if (call->params.has_video && !linphone_core_video_enabled(lc)){ + ms_warning("linphone_core_accept_call_update(): requested video but video support is globally disabled. Refusing video."); + call->params.has_video=FALSE; + } if (call->current_params.in_conference) { ms_warning("Video isn't supported in conference"); call->params.has_video = FALSE; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 892864fbb..179ff0ce9 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -899,6 +899,8 @@ void linphone_core_disable_logs(void); /*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */ void linphone_core_set_user_agent(const char *ua_name, const char *version); const char *linphone_core_get_version(void); +const char *linphone_core_get_user_agent_name(void); +const char *linphone_core_get_user_agent_version(void); LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config, void* userdata); @@ -1421,6 +1423,8 @@ int linphone_core_get_audio_dscp(const LinphoneCore *lc); void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp); int linphone_core_get_video_dscp(const LinphoneCore *lc); + + #ifdef __cplusplus } #endif From e6d835fa745550a043e18a3b850d0cb353ef9ae8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 12:43:45 +0200 Subject: [PATCH 581/769] Add JNI for used codecs. --- coreapi/linphonecore_jni.cc | 8 ++++++++ .../org/linphone/core/LinphoneCallParams.java | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index cb1c72335..a237b1865 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -946,6 +946,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMediaEncryption(JNIEn linphone_core_set_media_encryption((LinphoneCore*)lc,(LinphoneMediaEncryption)menc); } +extern "C" long Java_org_linphone_core_LinphoneCallParamsImpl_getUsedAudioCodec(JNIEnv *env, jobject thiz, jlong cp) { + return (long)linphone_call_params_get_used_audio_codec((LinphoneCallParams *)cp); +} + +extern "C" long Java_org_linphone_core_LinphoneCallParamsImpl_getUsedVideoCodec(JNIEnv *env, jobject thiz, jlong cp) { + return (long)linphone_call_params_get_used_video_codec((LinphoneCallParams *)cp); +} + extern "C" int Java_org_linphone_core_LinphoneCallParamsImpl_getMediaEncryption(JNIEnv* env ,jobject thiz ,jlong cp diff --git a/java/common/org/linphone/core/LinphoneCallParams.java b/java/common/org/linphone/core/LinphoneCallParams.java index 5bf067337..2dd497c9c 100644 --- a/java/common/org/linphone/core/LinphoneCallParams.java +++ b/java/common/org/linphone/core/LinphoneCallParams.java @@ -34,7 +34,7 @@ public interface LinphoneCallParams { * @param value 0 to disable limitation */ void setAudioBandwidth(int value); - + /** * return selected media encryption * @return MediaEncryption.None MediaEncryption.SRTP or MediaEncryption.ZRTP @@ -45,5 +45,16 @@ public interface LinphoneCallParams { * @params menc: MediaEncryption.None, MediaEncryption.SRTP or MediaEncryption.ZRTP */ void setMediaEnctyption(MediaEncryption menc); - + + /** + * Get the currently used audio codec + * @return PayloadType or null + */ + PayloadType getUsedAudioCodec(); + + /** + * Get the currently used video codec + * @return PayloadType or null + */ + PayloadType getUsedVideoCodec(); } From f385c6d2f08c8a00fb96d7f73da5ec16dde3300e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 12:42:54 +0200 Subject: [PATCH 582/769] Add JNI for used codecs. --- LinphoneCallParamsImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java index bb7e9b1ab..3c4514017 100644 --- a/LinphoneCallParamsImpl.java +++ b/LinphoneCallParamsImpl.java @@ -32,6 +32,8 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native void audioBandwidth(long nativePtr, int bw); private native void setMediaEncryption(long nativePtr, int menc); private native int getMediaEncryption(long nativePtr); + private native long getUsedAudioCodec(long nativePtr); + private native long getUsedVideoCodec(long nativePtr); private native void destroy(long nativePtr); @@ -61,6 +63,18 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { setMediaEncryption(nativePtr, menc.mValue); } + public PayloadType getUsedAudioCodec() { + long ptr = getUsedAudioCodec(nativePtr); + if (ptr == 0) return null; + return new PayloadTypeImpl(ptr); + } + + public PayloadType getUsedVideoCodec() { + long ptr = getUsedVideoCodec(nativePtr); + if (ptr == 0) return null; + return new PayloadTypeImpl(ptr); + } + private native boolean localConferenceMode(long nativePtr); public boolean localConferenceMode() { return localConferenceMode(nativePtr); From b1f7136e1bb05c17c5e8445bf0ac0a7c6f0ec646 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 18 Sep 2012 09:45:38 +0200 Subject: [PATCH 583/769] Detect SSL support in exosip and disable TLS accordingly. --- coreapi/linphonecore.c | 15 +++++++++ coreapi/linphonecore.h | 2 ++ coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 8 +++++ coreapi/sal_eXosip2.h | 1 + gtk/parameters.ui | 3 +- gtk/propertybox.c | 75 ++++++++++++++++++++++++++++-------------- 7 files changed, 80 insertions(+), 25 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1a7b97de0..b2f7bb982 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -529,6 +529,10 @@ static void sip_config_read(LinphoneCore *lc) random_port=(0xDFFF&random())+1024; else random_port=0; + if (!sal_is_transport_enabled(lc->sal, SalTransportTLS)) { + tr.tls_port=0; + } + if (tr.udp_port==0 && tr.tcp_port==0 && tr.tls_port==0){ tr.udp_port=5060; } @@ -1689,6 +1693,17 @@ int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *tr){ return 0; } +/** + * Set a non null value to the enabled transports. +**/ +int linphone_core_get_transports_supported(LinphoneCore *lc, LCSipTransports *transports) { + transports->udp_port=sal_is_transport_enabled(lc->sal, SalTransportUDP); + transports->tcp_port=sal_is_transport_enabled(lc->sal, SalTransportTCP); + transports->tls_port=sal_is_transport_enabled(lc->sal, SalTransportTLS); + transports->dtls_port=sal_is_transport_enabled(lc->sal, SalTransportDTLS); + return 0; +} + /** * Sets the UDP port to be used by SIP. * diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 179ff0ce9..60629879f 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1132,6 +1132,8 @@ int linphone_core_get_sip_port(LinphoneCore *lc); int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports); int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports); + +int linphone_core_get_transports_supported(LinphoneCore *lc, LCSipTransports *transports); /** * * Give access to the UDP sip socket. Can be useful to configure this socket as persistent I.E kCFStreamNetworkServiceType set to kCFStreamNetworkServiceTypeVoIP) diff --git a/coreapi/sal.h b/coreapi/sal.h index 751cc6533..e8f0a2c7d 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -53,6 +53,7 @@ typedef enum { SalTransportDTLS /*DTLS*/ }SalTransport; +bool_t sal_is_transport_enabled(Sal *sal, SalTransport transport); const char* sal_transport_to_string(SalTransport transport); SalTransport sal_transport_parse(const char*); /* Address manipulation API*/ diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index b09cae4ff..ee6126ee9 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -284,6 +284,7 @@ Sal * sal_init(){ sal->verify_server_certs=TRUE; sal->expire_old_contact=FALSE; sal->dscp=-1; + sal->exosip_has_ssl=eXosip_tls_verify_certificate(0) != -1; return sal; } @@ -2521,3 +2522,10 @@ int sal_call_update(SalOp *h, const char *subject){ void sal_reuse_authorization(Sal *ctx, bool_t value) { ctx->reuse_authorization=value; } + +bool_t sal_is_transport_enabled(Sal *sal, SalTransport transport) { + if (transport == SalTransportTLS || transport == SalTransportDTLS) { + return sal->exosip_has_ssl; + } + return TRUE; +} diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index 71463854c..09a0020fb 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -49,6 +49,7 @@ struct Sal{ bool_t reuse_authorization; bool_t verify_server_certs; bool_t expire_old_contact; + bool_t exosip_has_ssl; }; struct SalOp{ diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 7e76c385f..c575566c4 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -321,13 +321,14 @@ True False - model8 + diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 31c76f93b..7beb299f8 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -875,6 +875,56 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ g_object_unref(G_OBJECT(model)); } +static void linphone_gtk_show_transports(GtkWidget *pb){ + LinphoneCore *lc=linphone_gtk_get_core(); + GtkWidget *combo=linphone_gtk_get_widget(pb,"proto_combo"); + GtkTreeModel *model; + GtkListStore *store; + GtkTreeIter iter; + GtkCellRenderer *renderer=gtk_cell_renderer_text_new(); + LCSipTransports enabled,tr; + + model=GTK_TREE_MODEL((store=gtk_list_store_new(1,G_TYPE_STRING))); + gtk_combo_box_set_model(GTK_COMBO_BOX(combo),model); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo),renderer,TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),renderer,"text",0,NULL); + + gtk_list_store_append(store,&iter); + gtk_list_store_set(store,&iter,0,_("UDP"),-1); + + gtk_list_store_append(store,&iter); + gtk_list_store_set(store,&iter,0,_("TCP"),-1); + + linphone_core_get_transports_supported(lc, &enabled); + if (enabled.tls_port != 0){ + gtk_list_store_append(store,&iter); + gtk_list_store_set(store,&iter,0,_("TLS"),-1); + } + + linphone_core_get_sip_transports(lc,&tr); + + if (tr.tcp_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tcp_port); + } + else if (tr.tls_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tls_port); + } + else { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.udp_port); + } + + g_signal_connect(G_OBJECT(combo),"changed",(GCallback)linphone_gtk_proto_changed,NULL); + g_object_unref(G_OBJECT(model)); +} + + + void linphone_gtk_parameters_destroyed(GtkWidget *pb){ GtkWidget *mw=linphone_gtk_get_main_window(); g_object_set_data(G_OBJECT(mw),"parameters",NULL); @@ -907,7 +957,6 @@ void linphone_gtk_show_parameters(void){ GtkWidget *codec_list; int mtu; int ui_advanced; - LCSipTransports tr; if (pb==NULL) { pb=linphone_gtk_create_window("parameters"); @@ -921,28 +970,8 @@ void linphone_gtk_show_parameters(void){ /* NETWORK CONFIG */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"ipv6_enabled")), linphone_core_ipv6_enabled(lc)); - linphone_core_get_sip_transports(lc,&tr); - if (tr.tcp_port > 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.tcp_port); - } - else if (tr.tls_port > 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.tls_port); - } - else { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.udp_port); - } - - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"audio_rtp_port")), - linphone_core_get_audio_port(lc)); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")), - linphone_core_get_video_port(lc)); + linphone_gtk_show_transports(pb); linphone_gtk_show_media_encryption(pb); @@ -1020,8 +1049,6 @@ void linphone_gtk_show_parameters(void){ linphone_gtk_ui_level_adapt(pb); g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_port")),"value-changed",(GCallback)linphone_gtk_update_my_port,NULL); - g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_combo")),"changed",(GCallback)linphone_gtk_proto_changed,NULL); - if (linphone_core_tunnel_available()){ gtk_widget_set_visible(GTK_WIDGET(linphone_gtk_get_widget(pb,"tunnel_edit_button")), TRUE); From 650cb5b160573528b6551da5822930364a495c04 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 14:00:47 +0200 Subject: [PATCH 584/769] Prevent using getifaddrs() to get the local IP during ICE gathering. --- coreapi/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index df65b53f4..be977400f 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -620,7 +620,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) lc->vtable.display_status(lc, _("ICE local candidates gathering in progress...")); /* Gather local host candidates. */ - if (linphone_core_get_local_ip_for(AF_INET, NULL, local_addr) < 0) { + if (linphone_core_get_local_ip_for(AF_INET, server, local_addr) < 0) { ms_error("Fail to get local ip"); return -1; } From 53cb74c7e541616963b073d527948da15382877a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 15:08:18 +0200 Subject: [PATCH 585/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6104d4268..3a0c909d4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6104d42688b022b9d99c7ecc2261c3cff2978caf +Subproject commit 3a0c909d402338d3848fe12e718f89dc712384bb From 5bb8f5cc8701089704650f5dcd85d336c3a38d6c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 26 Sep 2012 16:00:26 +0200 Subject: [PATCH 586/769] Revert "Detect SSL support in exosip and disable TLS accordingly." This reverts commit b1f7136e1bb05c17c5e8445bf0ac0a7c6f0ec646. --- coreapi/linphonecore.c | 15 --------- coreapi/linphonecore.h | 2 -- coreapi/sal.h | 1 - coreapi/sal_eXosip2.c | 8 ----- coreapi/sal_eXosip2.h | 1 - gtk/parameters.ui | 3 +- gtk/propertybox.c | 75 ++++++++++++++---------------------------- 7 files changed, 25 insertions(+), 80 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b2f7bb982..1a7b97de0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -529,10 +529,6 @@ static void sip_config_read(LinphoneCore *lc) random_port=(0xDFFF&random())+1024; else random_port=0; - if (!sal_is_transport_enabled(lc->sal, SalTransportTLS)) { - tr.tls_port=0; - } - if (tr.udp_port==0 && tr.tcp_port==0 && tr.tls_port==0){ tr.udp_port=5060; } @@ -1693,17 +1689,6 @@ int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *tr){ return 0; } -/** - * Set a non null value to the enabled transports. -**/ -int linphone_core_get_transports_supported(LinphoneCore *lc, LCSipTransports *transports) { - transports->udp_port=sal_is_transport_enabled(lc->sal, SalTransportUDP); - transports->tcp_port=sal_is_transport_enabled(lc->sal, SalTransportTCP); - transports->tls_port=sal_is_transport_enabled(lc->sal, SalTransportTLS); - transports->dtls_port=sal_is_transport_enabled(lc->sal, SalTransportDTLS); - return 0; -} - /** * Sets the UDP port to be used by SIP. * diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 60629879f..179ff0ce9 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1132,8 +1132,6 @@ int linphone_core_get_sip_port(LinphoneCore *lc); int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports); int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports); - -int linphone_core_get_transports_supported(LinphoneCore *lc, LCSipTransports *transports); /** * * Give access to the UDP sip socket. Can be useful to configure this socket as persistent I.E kCFStreamNetworkServiceType set to kCFStreamNetworkServiceTypeVoIP) diff --git a/coreapi/sal.h b/coreapi/sal.h index e8f0a2c7d..751cc6533 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -53,7 +53,6 @@ typedef enum { SalTransportDTLS /*DTLS*/ }SalTransport; -bool_t sal_is_transport_enabled(Sal *sal, SalTransport transport); const char* sal_transport_to_string(SalTransport transport); SalTransport sal_transport_parse(const char*); /* Address manipulation API*/ diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index ee6126ee9..b09cae4ff 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -284,7 +284,6 @@ Sal * sal_init(){ sal->verify_server_certs=TRUE; sal->expire_old_contact=FALSE; sal->dscp=-1; - sal->exosip_has_ssl=eXosip_tls_verify_certificate(0) != -1; return sal; } @@ -2522,10 +2521,3 @@ int sal_call_update(SalOp *h, const char *subject){ void sal_reuse_authorization(Sal *ctx, bool_t value) { ctx->reuse_authorization=value; } - -bool_t sal_is_transport_enabled(Sal *sal, SalTransport transport) { - if (transport == SalTransportTLS || transport == SalTransportDTLS) { - return sal->exosip_has_ssl; - } - return TRUE; -} diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index 09a0020fb..71463854c 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -49,7 +49,6 @@ struct Sal{ bool_t reuse_authorization; bool_t verify_server_certs; bool_t expire_old_contact; - bool_t exosip_has_ssl; }; struct SalOp{ diff --git a/gtk/parameters.ui b/gtk/parameters.ui index c575566c4..7e76c385f 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -321,14 +321,13 @@ True False - diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 7beb299f8..31c76f93b 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -875,56 +875,6 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ g_object_unref(G_OBJECT(model)); } -static void linphone_gtk_show_transports(GtkWidget *pb){ - LinphoneCore *lc=linphone_gtk_get_core(); - GtkWidget *combo=linphone_gtk_get_widget(pb,"proto_combo"); - GtkTreeModel *model; - GtkListStore *store; - GtkTreeIter iter; - GtkCellRenderer *renderer=gtk_cell_renderer_text_new(); - LCSipTransports enabled,tr; - - model=GTK_TREE_MODEL((store=gtk_list_store_new(1,G_TYPE_STRING))); - gtk_combo_box_set_model(GTK_COMBO_BOX(combo),model); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo),renderer,TRUE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),renderer,"text",0,NULL); - - gtk_list_store_append(store,&iter); - gtk_list_store_set(store,&iter,0,_("UDP"),-1); - - gtk_list_store_append(store,&iter); - gtk_list_store_set(store,&iter,0,_("TCP"),-1); - - linphone_core_get_transports_supported(lc, &enabled); - if (enabled.tls_port != 0){ - gtk_list_store_append(store,&iter); - gtk_list_store_set(store,&iter,0,_("TLS"),-1); - } - - linphone_core_get_sip_transports(lc,&tr); - - if (tr.tcp_port > 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.tcp_port); - } - else if (tr.tls_port > 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.tls_port); - } - else { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.udp_port); - } - - g_signal_connect(G_OBJECT(combo),"changed",(GCallback)linphone_gtk_proto_changed,NULL); - g_object_unref(G_OBJECT(model)); -} - - - void linphone_gtk_parameters_destroyed(GtkWidget *pb){ GtkWidget *mw=linphone_gtk_get_main_window(); g_object_set_data(G_OBJECT(mw),"parameters",NULL); @@ -957,6 +907,7 @@ void linphone_gtk_show_parameters(void){ GtkWidget *codec_list; int mtu; int ui_advanced; + LCSipTransports tr; if (pb==NULL) { pb=linphone_gtk_create_window("parameters"); @@ -970,8 +921,28 @@ void linphone_gtk_show_parameters(void){ /* NETWORK CONFIG */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"ipv6_enabled")), linphone_core_ipv6_enabled(lc)); + linphone_core_get_sip_transports(lc,&tr); - linphone_gtk_show_transports(pb); + if (tr.tcp_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tcp_port); + } + else if (tr.tls_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tls_port); + } + else { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.udp_port); + } + + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"audio_rtp_port")), + linphone_core_get_audio_port(lc)); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")), + linphone_core_get_video_port(lc)); linphone_gtk_show_media_encryption(pb); @@ -1049,6 +1020,8 @@ void linphone_gtk_show_parameters(void){ linphone_gtk_ui_level_adapt(pb); g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_port")),"value-changed",(GCallback)linphone_gtk_update_my_port,NULL); + g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_combo")),"changed",(GCallback)linphone_gtk_proto_changed,NULL); + if (linphone_core_tunnel_available()){ gtk_widget_set_visible(GTK_WIDGET(linphone_gtk_get_widget(pb,"tunnel_edit_button")), TRUE); From e0f197256c925230efcd7455ce802e7f8493aa4c Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 27 Sep 2012 10:19:53 +0200 Subject: [PATCH 587/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 3a0c909d4..54e1d72f8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3a0c909d402338d3848fe12e718f89dc712384bb +Subproject commit 54e1d72f83cdd3ad34ad459ac782373d8e0e1596 From 85ad456a10df3a23d9004e316ff928c3965ae4e7 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 15:29:47 +0200 Subject: [PATCH 588/769] Prevent deleting streams (and therefore RTP sessions) when switching form ICE gathering to the call. This prevents losing the first ICE connectivity checks if the restart of the streams is slow. --- coreapi/linphonecall.c | 35 +++++++++++++++++++++++++++++------ coreapi/linphonecore.c | 20 +++++++++++--------- coreapi/misc.c | 11 +++++++++++ coreapi/private.h | 4 ++++ 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d43c457b6..8c109c3d9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -413,6 +413,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; + call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(op)); switch (linphone_core_get_firewall_policy(call->core)) { case LinphonePolicyUseIce: call->ice_session = ice_session_new(); @@ -424,7 +425,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro if (linphone_core_gather_ice_candidates(call->core,call)<0) { /* Ice candidates gathering failed, proceed with the call anyway. */ linphone_call_delete_ice_session(call); - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); } } break; @@ -965,9 +966,11 @@ void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, Lin void linphone_call_init_audio_stream(LinphoneCall *call){ LinphoneCore *lc=call->core; AudioStream *audiostream; - int dscp=linphone_core_get_audio_dscp(lc); + int dscp; + if (call->audiostream != NULL) return; call->audiostream=audiostream=audio_stream_new(call->audio_port,call->audio_port+1,linphone_core_ipv6_enabled(lc)); + dscp=linphone_core_get_audio_dscp(lc); if (dscp!=-1) audio_stream_set_dscp(audiostream,dscp); if (linphone_core_echo_limiter_enabled(lc)){ @@ -1020,6 +1023,11 @@ void linphone_call_init_video_stream(LinphoneCall *call){ #ifdef VIDEO_ENABLED LinphoneCore *lc=call->core; + if (!call->params.has_video) { + linphone_call_stop_video_stream(call); + return; + } + if (call->videostream != NULL) return; if ((lc->video_conf.display || lc->video_conf.capture) && call->params.has_video){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); int dscp=linphone_core_get_video_dscp(lc); @@ -1535,6 +1543,15 @@ void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call){ #endif } +void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call){ + audio_stream_unprepare_sound(call->audiostream); +#ifdef VIDEO_ENABLED + if (call->videostream) { + video_stream_unprepare_video(call->videostream); + } +#endif +} + void linphone_call_delete_ice_session(LinphoneCall *call){ if (call->ice_session != NULL) { ice_session_destroy(call->ice_session); @@ -1551,7 +1568,7 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){ log->quality=audio_stream_get_average_quality_rating(st); } -void linphone_call_stop_media_streams(LinphoneCall *call){ +void linphone_call_stop_audio_stream(LinphoneCall *call) { if (call->audiostream!=NULL) { call->audiostream->ice_check_list = NULL; rtp_session_unregister_event_queue(call->audiostream->session,call->audiostream_app_evq); @@ -1574,8 +1591,9 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ audio_stream_stop(call->audiostream); call->audiostream=NULL; } +} - +void linphone_call_stop_video_stream(LinphoneCall *call) { #ifdef VIDEO_ENABLED if (call->videostream!=NULL){ call->videostream->ice_check_list = NULL; @@ -1587,6 +1605,11 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ call->videostream=NULL; } #endif +} + +void linphone_call_stop_media_streams(LinphoneCall *call){ + linphone_call_stop_audio_stream(call); + linphone_call_stop_video_stream(call); ms_event_queue_skip(call->core->msevq); if (call->audio_profile){ @@ -1812,11 +1835,11 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_start_accept_call_update(call->core, call); break; case LinphoneCallOutgoingInit: - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); linphone_core_proceed_with_invite_if_ready(call->core, call, NULL); break; default: - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); linphone_core_notify_incoming_call(call->core, call); break; } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1a7b97de0..b55c08ece 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1916,7 +1916,7 @@ void linphone_core_iterate(LinphoneCore *lc){ ms_warning("ICE candidates gathering from [%s] has not finished yet, proceed with the call without ICE anyway." ,linphone_core_get_stun_server(lc)); linphone_call_delete_ice_session(call); - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); } linphone_core_start_invite(lc,call); } @@ -2379,7 +2379,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const if (linphone_core_gather_ice_candidates(lc,call)<0) { /* Ice candidates gathering failed, proceed with the call anyway. */ linphone_call_delete_ice_session(call); - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); } else { use_ice = TRUE; } @@ -2678,6 +2678,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const ms_warning("Video isn't supported in conference"); call->params.has_video = FALSE; } + call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); call->camera_active=call->params.has_video; update_local_media_description(lc,call); if (call->ice_session != NULL) { @@ -2791,19 +2792,20 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, if (contact) sal_op_set_contact(call->op,contact); + if (params){ + call->params=*params; + call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); + call->camera_active=call->params.has_video; + update_local_media_description(lc,call); + sal_call_set_local_media_description(call->op,call->localdesc); + } + if (call->audiostream==NULL) linphone_call_init_media_streams(call); if (!was_ringing && call->audiostream->ticker==NULL){ audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); } - if (params){ - call->params=*params; - call->camera_active=call->params.has_video; - update_local_media_description(lc,call); - sal_call_set_local_media_description(call->op,call->localdesc); - } - sal_call_accept(call->op); if (lc->vtable.display_status!=NULL) lc->vtable.display_status(lc,_("Connected.")); diff --git a/coreapi/misc.c b/coreapi/misc.c index be977400f..5cb2a49f2 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -904,6 +904,17 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, } } +bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md) +{ + int i; + + for (i = 0; i < md->nstreams; i++) { + if ((md->streams[i].type == SalVideo) && (md->streams[i].rtp_port != 0)) + return TRUE; + } + return FALSE; +} + void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md) { int i; diff --git a/coreapi/private.h b/coreapi/private.h index d8e07c1b9..ea21a967a 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -251,6 +251,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); +bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md); void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md); void linphone_core_send_initial_subscribes(LinphoneCore *lc); @@ -280,8 +281,11 @@ void linphone_call_init_video_stream(LinphoneCall *call); void linphone_call_init_media_streams(LinphoneCall *call); void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone); void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); +void linphone_call_stop_audio_stream(LinphoneCall *call); +void linphone_call_stop_video_stream(LinphoneCall *call); void linphone_call_stop_media_streams(LinphoneCall *call); void linphone_call_delete_ice_session(LinphoneCall *call); +void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call); const char * linphone_core_get_identity(LinphoneCore *lc); const char * linphone_core_get_route(LinphoneCore *lc); From 79c2debc99f7f08616d0c1cf0a003df1242c008d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 27 Sep 2012 13:32:18 +0200 Subject: [PATCH 589/769] Fix for ICE state that can be wrong in some failing cases. --- coreapi/misc.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 5cb2a49f2..d5e34ce03 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -652,31 +652,39 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call) session_state = ice_session_state(call->ice_session); if ((session_state == IS_Completed) || ((session_state == IS_Failed) && (ice_session_has_completed_check_list(call->ice_session) == TRUE))) { - switch (ice_check_list_selected_valid_candidate_type(audio_check_list)) { - case ICT_HostCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateHostConnection; - break; - case ICT_ServerReflexiveCandidate: - case ICT_PeerReflexiveCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateReflexiveConnection; - break; - case ICT_RelayedCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateRelayConnection; - break; - } - if (call->params.has_video && (video_check_list != NULL)) { - switch (ice_check_list_selected_valid_candidate_type(video_check_list)) { + if (ice_check_list_state(audio_check_list) == ICL_Completed) { + switch (ice_check_list_selected_valid_candidate_type(audio_check_list)) { case ICT_HostCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateHostConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateHostConnection; break; case ICT_ServerReflexiveCandidate: case ICT_PeerReflexiveCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateReflexiveConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateReflexiveConnection; break; case ICT_RelayedCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateRelayConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateRelayConnection; break; } + } else { + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateFailed; + } + if (call->params.has_video && (video_check_list != NULL)) { + if (ice_check_list_state(video_check_list) == ICL_Completed) { + switch (ice_check_list_selected_valid_candidate_type(video_check_list)) { + case ICT_HostCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateHostConnection; + break; + case ICT_ServerReflexiveCandidate: + case ICT_PeerReflexiveCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateReflexiveConnection; + break; + case ICT_RelayedCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateRelayConnection; + break; + } + } else { + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateFailed; + } } } else { call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateFailed; From d9ec3f37bf5b2a4ac78d30ff3603882d5a1a42c2 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Oct 2012 15:06:22 +0200 Subject: [PATCH 590/769] fix indent --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d43c457b6..70ccac5ee 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1431,7 +1431,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna cam=get_nowebcam_device(); } if (!is_inactive){ - call->log->video_enabled = TRUE; + call->log->video_enabled = TRUE; video_stream_set_direction (call->videostream, dir); ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); video_stream_set_device_rotation(call->videostream, lc->device_rotation); From 4cd61b605d7e848ca735b6fb649b18a4cbfe3e7a Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 1 Oct 2012 15:41:10 +0200 Subject: [PATCH 591/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 54e1d72f8..373c92572 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 54e1d72f83cdd3ad34ad459ac782373d8e0e1596 +Subproject commit 373c9257215ca8cf436ee122e496ad778d685368 From 1469857acdf17f030b08089d397575e73ccebfa1 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 15:47:35 +0200 Subject: [PATCH 592/769] Update ms2 submodule for ICE. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 373c92572..1a7f7e73c 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 373c9257215ca8cf436ee122e496ad778d685368 +Subproject commit 1a7f7e73cdb2df7683ddb808458b53111057f921 From 37e69be09139dc82910fa176c648cd61c89c7561 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 15:48:43 +0200 Subject: [PATCH 593/769] Check that ICE gathering has already been completed before launching it again. --- coreapi/misc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index d5e34ce03..1c026948e 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -624,10 +624,13 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ms_error("Fail to get local ip"); return -1; } - ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); - ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; - if (call->params.has_video && (video_check_list != NULL)) { + if ((ice_check_list_state(audio_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_check_list) == FALSE)) { + ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); + ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; + } + if (call->params.has_video && (video_check_list != NULL) + && (ice_check_list_state(video_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(video_check_list) == FALSE)) { ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress; From 3b6eae74415cb14cb4fb96dd54725bde2f0d0abd Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 15:49:15 +0200 Subject: [PATCH 594/769] Add check to prevent crash if something wrong happens when sending Re-INVITE for ICE. --- coreapi/misc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 1c026948e..6f7aff698 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -783,10 +783,14 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * int rtp_port, rtcp_port; memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates)); ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); - strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr)); - stream->ice_remote_candidates[0].port = rtp_port; - strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr)); - stream->ice_remote_candidates[1].port = rtcp_port; + if ((rtp_addr != NULL) && (rtcp_addr != NULL)) { + strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr)); + stream->ice_remote_candidates[0].port = rtp_port; + strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr)); + stream->ice_remote_candidates[1].port = rtcp_port; + } else { + ms_error("ice: Selected valid remote candidates should be present if the check list is in the Completed state"); + } } } } From c6235d70a0b49c015ca1551d2946370b69b4882d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 15:53:09 +0200 Subject: [PATCH 595/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1a7f7e73c..28f57ace8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1a7f7e73cdb2df7683ddb808458b53111057f921 +Subproject commit 28f57ace8c7c1d20f93de338951bc471eb523ab1 From 9ac0fdee297a68c8137f664034429e1ada81c92e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Oct 2012 21:08:23 +0200 Subject: [PATCH 596/769] set high prio to calibrator thread --- coreapi/ec-calibrator.c | 5 ++++- mediastreamer2 | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index 2f4fa6500..5fbf7a1fb 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -29,7 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void ecc_init_filters(EcCalibrator *ecc){ unsigned int rate; - ecc->ticker=ms_ticker_new(); + MSTickerParams params={0}; + params.name="Echo calibrator"; + params.prio=MS_TICKER_PRIO_HIGH; + ecc->ticker=ms_ticker_new_with_params(¶ms); ecc->sndread=ms_snd_card_create_reader(ecc->play_card); ms_filter_call_method(ecc->sndread,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); diff --git a/mediastreamer2 b/mediastreamer2 index 28f57ace8..c3d6a0953 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 28f57ace8c7c1d20f93de338951bc471eb523ab1 +Subproject commit c3d6a095338c7d98647517b949e06e0b85f6443e From 438a8f4f73e54aa53cd9ac349f354601704a5862 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Oct 2012 21:15:22 +0200 Subject: [PATCH 597/769] update oRTP --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index b7c5f78d8..8a8843b1f 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit b7c5f78d83f8a310ba3700e93174c7eb1234d2d3 +Subproject commit 8a8843b1f3a56888492b298d5262a61369e15bb7 From fd97457fe72f30a1bf60c75aff6e714ac9d0efc1 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 2 Oct 2012 10:29:55 +0200 Subject: [PATCH 598/769] fix disable-video build --- coreapi/linphonecore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b55c08ece..93c1a8cf3 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2659,7 +2659,9 @@ int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call) * @return 0 if sucessful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state). **/ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){ +#ifdef VIDEO_ENABLED bool_t old_has_video = call->params.has_video; +#endif if (call->state!=LinphoneCallUpdatedByRemote){ ms_error("linphone_core_accept_update(): invalid state %s to call this function.", linphone_call_state_to_string(call->state)); From edec0b18e7adc3a3718a2b8a84efa006822ec12c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 2 Oct 2012 11:04:32 +0200 Subject: [PATCH 599/769] fix tunnel crash --- coreapi/TunnelManager.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index 9b5dffd29..71ecc5184 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -59,12 +59,12 @@ int TunnelManager::eXosipRecvfrom(int fd, void *buf, size_t len, int flags, stru int TunnelManager::eXosipSelect(int max_fds, fd_set *s1, fd_set *s2, fd_set *s3, struct timeval *tv,void* userdata){ struct timeval begin,cur; TunnelManager* lTunnelMgr=(TunnelManager*)userdata; - if (tv!=0 && tv->tv_sec){ + if (s1 && tv!=0 && tv->tv_sec){ /*this is the select from udp.c, the one that is interesting to us*/ NativeSocket udp_fd=(NativeSocket)eXosip_get_udp_socket(); NativeSocket controlfd=(NativeSocket)eXosip_get_control_fd(); - FD_ZERO(s1); + FD_ZERO(s1); gettimeofday(&begin,NULL); do{ struct timeval abit; @@ -258,7 +258,7 @@ void TunnelManager::processTunnelEvent(const Event &ev){ lTransport.tls_port=0; lTransport.dtls_port=0; - linphone_core_set_sip_transports(mCore, &lTransport); + linphone_core_set_sip_transports(mCore, &lTransport); //register if (lProxy) { linphone_proxy_config_done(lProxy); From b72f80fdc704f266f8e3950c2f88ab8357707ca7 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 2 Oct 2012 11:05:35 +0200 Subject: [PATCH 600/769] Add parameters check in call statistics JNI. --- coreapi/linphonecore_jni.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index a237b1865..ff654b8c3 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1275,7 +1275,7 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; const report_block_t *srb = NULL; - if (!stats->sent_rtcp) + if (!stats || !stats->sent_rtcp) return (jfloat)0.0; /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ if (stats->sent_rtcp->b_cont != NULL) @@ -1292,7 +1292,7 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRa const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; const report_block_t *rrb = NULL; - if (!stats->received_rtcp) + if (!stats || !stats->received_rtcp) return (jfloat)0.0; /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ if (stats->received_rtcp->b_cont != NULL) @@ -1308,11 +1308,14 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRa extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; const LinphoneCall *call = (LinphoneCall *)call_ptr; - const LinphoneCallParams *params = linphone_call_get_current_params(call); + const LinphoneCallParams *params; const PayloadType *pt; const report_block_t *srb = NULL; - if (!stats->sent_rtcp) + if (!stats || !call || !stats->sent_rtcp) + return (jfloat)0.0; + params = linphone_call_get_current_params(call); + if (!params) return (jfloat)0.0; /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ if (stats->sent_rtcp->b_cont != NULL) @@ -1332,11 +1335,14 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarr extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; const LinphoneCall *call = (LinphoneCall *)call_ptr; - const LinphoneCallParams *params = linphone_call_get_current_params(call); + const LinphoneCallParams *params; const PayloadType *pt; const report_block_t *rrb = NULL; - if (!stats->received_rtcp) + if (!stats || !call || !stats->received_rtcp) + return (jfloat)0.0; + params = linphone_call_get_current_params(call); + if (!params) return (jfloat)0.0; /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ if (stats->received_rtcp->b_cont != NULL) @@ -1361,6 +1367,8 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallStatsImpl_getLatePacketsCumu LinphoneCall *call = (LinphoneCall *)call_ptr; rtp_stats_t rtp_stats; + if (!stats || !call) + return (jlong)0; memset(&rtp_stats, 0, sizeof(rtp_stats)); if (stats->type == LINPHONE_CALL_STATS_AUDIO) audio_stream_get_local_rtp_stats(call->audiostream, &rtp_stats); From 48512d1e101a95f201722c7a85e3bd28955eba54 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 17:15:43 +0200 Subject: [PATCH 601/769] Delete LinphoneCallUpdated state and add LinphoneCallUpdating state. --- coreapi/callbacks.c | 11 +---------- coreapi/linphonecall.c | 10 ++++++---- coreapi/linphonecore.c | 5 +++-- coreapi/linphonecore.h | 2 +- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 4e5661b35..7f901195f 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -302,11 +302,7 @@ static void call_accepted(SalOp *op){ linphone_core_update_streams (lc,call,md); linphone_call_set_state(call,LinphoneCallPausedByRemote,"Call paused by remote"); }else{ - if (call->state==LinphoneCallStreamsRunning){ - /*media was running before, the remote as acceted a call modification (that is - a reinvite made by us. We must notify the application this reinvite was accepted*/ - linphone_call_set_state(call, LinphoneCallUpdated, "Call updated"); - }else{ + if (call->state!=LinphoneCallUpdating){ if (call->state==LinphoneCallResuming){ if (lc->vtable.display_status){ lc->vtable.display_status(lc,_("Call resumed.")); @@ -343,11 +339,6 @@ static void call_ack(SalOp *op){ if (call->media_pending){ SalMediaDescription *md=sal_call_get_final_media_description(op); if (md && !sal_media_description_empty(md)){ - if (call->state==LinphoneCallStreamsRunning){ - /*media was running before, the remote as acceted a call modification (that is - a reinvite made by us. We must notify the application this reinvite was accepted*/ - linphone_call_set_state(call, LinphoneCallUpdated, "Call updated"); - } linphone_core_update_streams (lc,call,md); linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)"); }else{ diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b2f53e5a5..9d82476bc 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -520,8 +520,8 @@ const char *linphone_call_state_to_string(LinphoneCallState cs){ return "LinphoneCallUpdatedByRemote"; case LinphoneCallIncomingEarlyMedia: return "LinphoneCallIncomingEarlyMedia"; - case LinphoneCallUpdated: - return "LinphoneCallUpdated"; + case LinphoneCallUpdating: + return "LinphoneCallUpdating"; case LinphoneCallReleased: return "LinphoneCallReleased"; } @@ -1828,7 +1828,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_call_delete_ice_session(call); } switch (call->state) { - case LinphoneCallStreamsRunning: + case LinphoneCallUpdating: linphone_core_start_update_call(call->core, call); break; case LinphoneCallUpdatedByRemote: @@ -1838,10 +1838,12 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_call_stop_media_streams_for_ice_gathering(call); linphone_core_proceed_with_invite_if_ready(call->core, call, NULL); break; - default: + case LinphoneCallIdle: linphone_call_stop_media_streams_for_ice_gathering(call); linphone_core_notify_incoming_call(call->core, call); break; + default: + break; } } else if (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) { linphone_core_start_accept_call_update(call->core, call); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 93c1a8cf3..dd0072d0a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2564,6 +2564,7 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){ int err=0; if (params!=NULL){ + linphone_call_set_state(call,LinphoneCallUpdating,"Updating call"); #ifdef VIDEO_ENABLED bool_t has_video = call->params.has_video; if ((call->ice_session != NULL) && (call->videostream != NULL) && !params->has_video) { @@ -2571,7 +2572,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho call->videostream->ice_check_list = NULL; } call->params = *params; - if ((call->ice_session != NULL) && (ice_session_state(call->ice_session) != IS_Completed) && !has_video && params->has_video) { + if ((call->ice_session != NULL) && !has_video && params->has_video) { /* Defer call update until the ICE candidates gathering process has finished. */ ms_message("Defer call update to gather ICE candidates"); update_local_media_description(lc, call); @@ -5030,7 +5031,7 @@ bool_t linphone_core_sound_resources_locked(LinphoneCore *lc){ case LinphoneCallConnected: case LinphoneCallRefered: case LinphoneCallIncomingEarlyMedia: - case LinphoneCallUpdated: + case LinphoneCallUpdating: return TRUE; default: break; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 179ff0ce9..53ad38e9e 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -343,7 +343,7 @@ typedef enum _LinphoneCallState{ LinphoneCallPausedByRemote, /** Date: Tue, 2 Oct 2012 11:41:58 +0200 Subject: [PATCH 602/769] Fix JNI newLinphoneAuthInfo --- coreapi/linphonecore_jni.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index ff654b8c3..3cd7b76cc 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1131,11 +1131,17 @@ extern "C" jlong Java_org_linphone_core_LinphoneAuthInfoImpl_newLinphoneAuthInfo , jstring jrealm) { const char* username = env->GetStringUTFChars(jusername, NULL); + const char* userid = env->GetStringUTFChars(juserid, NULL); const char* password = env->GetStringUTFChars(jpassword, NULL); - jlong auth = (jlong)linphone_auth_info_new(username,NULL,password,NULL,NULL); + const char* ha1 = env->GetStringUTFChars(jha1, NULL); + const char* realm = env->GetStringUTFChars(jrealm, NULL); + jlong auth = (jlong)linphone_auth_info_new(username,userid,password,ha1,realm); env->ReleaseStringUTFChars(jusername, username); + env->ReleaseStringUTFChars(juserid, userid); env->ReleaseStringUTFChars(jpassword, password); + env->ReleaseStringUTFChars(jha1, ha1); + env->ReleaseStringUTFChars(jrealm, realm); return auth; } From a977e46cbce85aeae1e26824e7e096b377346009 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 2 Oct 2012 15:30:06 +0200 Subject: [PATCH 603/769] add call id to LinphoneCallLogs --- coreapi/linphonecall.c | 1 + coreapi/linphonecore.c | 5 +++++ coreapi/linphonecore.h | 3 ++- coreapi/sal.c | 6 +++++- coreapi/sal.h | 2 ++ coreapi/sal_eXosip2.c | 6 +++++- java/common/org/linphone/core/LinphoneCallLog.java | 4 ++++ 7 files changed, 24 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b2f53e5a5..1351f0eb9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -411,6 +411,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_address_clean(from); linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip); linphone_call_init_common(call, from, to); + call->log->call_id=ms_strdup(sal_op_get_call_id(op)); /*must be known at that time*/ linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(op)); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 93c1a8cf3..66cb26eff 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -139,6 +139,7 @@ void call_logs_write_to_config_file(LinphoneCore *lc){ if (cl->refkey) lp_config_set_string(cfg,logsection,"refkey",cl->refkey); lp_config_set_float(cfg,logsection,"quality",cl->quality); lp_config_set_int(cfg,logsection,"video_enabled", cl->video_enabled); + lp_config_set_string(cfg,logsection,"call_id",cl->call_id); } for(;imax_call_logs;++i){ snprintf(logsection,sizeof(logsection),"call_log_%i",i); @@ -189,6 +190,8 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){ if (tmp) cl->refkey=ms_strdup(tmp); cl->quality=lp_config_get_float(cfg,logsection,"quality",-1); cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0); + cl->call_id=lp_config_get_string(cfg,logsection,"call_id",NULL); + if(cl->call_id) cl->call_id=ms_strdup(cl->call_id); lc->call_logs=ms_list_append(lc->call_logs,cl); }else break; } @@ -296,6 +299,7 @@ void linphone_call_log_destroy(LinphoneCallLog *cl){ if (cl->from!=NULL) linphone_address_destroy(cl->from); if (cl->to!=NULL) linphone_address_destroy(cl->to); if (cl->refkey!=NULL) ms_free(cl->refkey); + if (cl->call_id) ms_free((void*)cl->call_id); ms_free(cl); } @@ -2212,6 +2216,7 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){ real_url=linphone_address_as_string(call->log->to); from=linphone_address_as_string(call->log->from); err=sal_call(call->op,from,real_url); + call->log->call_id=ms_strdup(sal_op_get_call_id(call->op)); /*must be known at that time*/ if (lc->sip_conf.sdp_200_ack){ call->media_pending=TRUE; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 179ff0ce9..735f1a048 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -146,7 +146,7 @@ typedef struct _LinphoneCallLog{ LinphoneCallStatus status; /**< The status of the call*/ LinphoneAddress *from; /**origin; } - +const char* sal_op_get_call_id(const SalOp *op) { + return ((SalOpBase*)op)->call_id; +} void __sal_op_init(SalOp *b, Sal *sal){ memset(b,0,sizeof(SalOpBase)); ((SalOpBase*)b)->root=sal; @@ -310,6 +312,8 @@ void __sal_op_free(SalOp *op){ sal_media_description_unref(b->local_media); if (b->remote_media) sal_media_description_unref(b->remote_media); + if (b->call_id) + ms_free((void*)b->call_id); ms_free(op); } diff --git a/coreapi/sal.h b/coreapi/sal.h index 751cc6533..1bce846c6 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -207,6 +207,7 @@ typedef struct SalOpBase{ SalMediaDescription *local_media; SalMediaDescription *remote_media; void *user_pointer; + const char* call_id; } SalOpBase; @@ -373,6 +374,7 @@ const char *sal_op_get_network_origin(const SalOp *op); /*returns far-end "User-Agent" string */ const char *sal_op_get_remote_ua(const SalOp *op); void *sal_op_get_user_pointer(const SalOp *op); +const char* sal_op_get_call_id(const SalOp *op); /*Call API*/ int sal_call_set_local_media_description(SalOp *h, SalMediaDescription *desc); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index b09cae4ff..4b5c20539 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -603,6 +603,7 @@ int sal_call(SalOp *h, const char *from, const char *to){ int err; const char *route; osip_message_t *invite=NULL; + osip_call_id_t *callid; sal_op_set_from(h,from); sal_op_set_to(h,to); sal_exosip_fix_route(h); @@ -643,6 +644,8 @@ int sal_call(SalOp *h, const char *from, const char *to){ ms_error("Fail to send invite ! Error code %d", err); return -1; }else{ + callid=osip_message_get_call_id(invite); + osip_call_id_to_str(callid,(char **)(&h->base.call_id)); sal_add_call(h->base.root,h); } return 0; @@ -1018,6 +1021,8 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ osip_call_info_t *call_info; char *tmp; sdp_message_t *sdp=eXosip_get_sdp_info(ev->request); + osip_call_id_t *callid=osip_message_get_call_id(ev->request); + osip_call_id_to_str(callid,(char**)(&op->base.call_id)); set_network_origin(op,ev->request); set_remote_ua(op,ev->request); @@ -1054,7 +1059,6 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ op->tid=ev->tid; op->cid=ev->cid; op->did=ev->did; - sal_add_call(op->base.root,op); sal->callbacks.call_received(op); } diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index 40299e6d9..1abdb7bed 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -104,4 +104,8 @@ public interface LinphoneCallLog { * @return the call duration, in seconds */ public int getCallDuration(); + /** + * @return the call id from signaling + */ + public int getCallId(); } From 200a467069a98709ac94505a16f803526aee1732 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 2 Oct 2012 15:30:40 +0200 Subject: [PATCH 604/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index c3d6a0953..215e93d08 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c3d6a095338c7d98647517b949e06e0b85f6443e +Subproject commit 215e93d083e9bc8913803ca836d850d3144f76f6 From 61312092bbda523c8fa98c9804d123a5308d2e57 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 2 Oct 2012 15:51:46 +0200 Subject: [PATCH 605/769] Update ms2 submodule for ICE fix. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 215e93d08..cfe804f4d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 215e93d083e9bc8913803ca836d850d3144f76f6 +Subproject commit cfe804f4dbae7dc1b8cf6c63018b68b2fb52cd53 From 67ae4525c97cce6a0029d7180a9ff0bb66218ce0 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 2 Oct 2012 16:21:56 +0200 Subject: [PATCH 606/769] Some fixes --- LinphoneAuthInfoImpl.java | 2 +- LinphoneCallLogImpl.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/LinphoneAuthInfoImpl.java b/LinphoneAuthInfoImpl.java index 7f9e54dd2..7d50a2fa5 100644 --- a/LinphoneAuthInfoImpl.java +++ b/LinphoneAuthInfoImpl.java @@ -23,7 +23,7 @@ class LinphoneAuthInfoImpl implements LinphoneAuthInfo { private native long newLinphoneAuthInfo(String username, String userid, String passwd, String ha1,String realm); private native void delete(long ptr); protected LinphoneAuthInfoImpl(String username,String password, String realm) { - nativePtr = newLinphoneAuthInfo(username,null,password,null,realm); + nativePtr = newLinphoneAuthInfo(username,"",password,"",""); } protected void finalize() throws Throwable { delete(nativePtr); diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index 8972f0a76..ac03d3699 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -29,6 +29,7 @@ class LinphoneCallLogImpl implements LinphoneCallLog { private native int getStatus(long nativePtr); private native String getStartDate(long nativePtr); private native int getCallDuration(long nativePtr); + private native int getCallId(long nativePtr); LinphoneCallLogImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -60,4 +61,8 @@ class LinphoneCallLogImpl implements LinphoneCallLog { public int getCallDuration() { return getCallDuration(nativePtr); } + @Override + public int getCallId() { + return getCallId(nativePtr); + } } From 6a0b67f9b55df4db3b3a7ea70e6eaa560c1fd3da Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 2 Oct 2012 16:51:31 +0200 Subject: [PATCH 607/769] add low bandwidth call param --- coreapi/linphonecall.c | 3 +++ coreapi/linphonecore.h | 9 ++++++++- coreapi/misc.c | 2 +- coreapi/private.h | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a37096697..95bc62106 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -854,6 +854,9 @@ const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallP return cp->video_codec; } +bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp) { + return cp->low_bandwidth; +} /** * Returns whether video is enabled. **/ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 5196d93dc..0209a3774 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -204,7 +204,14 @@ bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp); void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw); void linphone_call_params_destroy(LinphoneCallParams *cp); - +/** + * @ingroup call_control + * Use to know if this call has been configured in low bandwidth mode. + * This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file + *
When enabled, this param may transform a call request with video in audio only mode. + * @return TRUE if low bandwidth has been configured/detected + */ +bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp); /** * Enum describing failure reasons. * @ingroup initializing diff --git a/coreapi/misc.c b/coreapi/misc.c index 6f7aff698..e85005f28 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -586,7 +586,7 @@ void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, Linphone params->up_bw=params->down_bw=edge_bw; params->up_ptime=params->down_ptime=edge_ptime; params->has_video=FALSE; - + params->low_bandwidth=TRUE; }/*else use default settings */ } } diff --git a/coreapi/private.h b/coreapi/private.h index ea21a967a..0cefb1476 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -79,7 +79,7 @@ struct _LinphoneCallParams{ bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/ bool_t in_conference; /*in conference mode */ bool_t pad; - + bool_t low_bandwidth; }; typedef struct _CallCallbackObj From 8bec813e52a4949f723b94918f4eb37ac5faad86 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 2 Oct 2012 17:06:38 +0200 Subject: [PATCH 608/769] JNI DTMF listener --- coreapi/linphonecore_jni.cc | 17 +++++++++++++++++ .../org/linphone/core/LinphoneCoreListener.java | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 3cd7b76cc..273d46aa9 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -110,6 +110,7 @@ public: vTable.call_encryption_changed = callEncryptionChange; vTable.text_received = text_received; vTable.message_received = message_received; + vTable.dtmf_received = dtmf_received; vTable.new_subscription_request = new_subscription_request; vTable.notify_presence_recv = notify_presence_recv; vTable.call_stats_updated = callStatsUpdated; @@ -157,6 +158,7 @@ public: /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/ textReceivedId = env->GetMethodID(listenerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V"); messageReceivedId = env->GetMethodID(listenerClass,"messageReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneChatMessage;)V"); + dtmfReceivedId = env->GetMethodID(listenerClass,"dtmfReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;I)V"); proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl")); proxyCtrId = env->GetMethodID(proxyClass,"", "(J)V"); @@ -211,6 +213,7 @@ public: jmethodID notifyPresenceReceivedId; jmethodID textReceivedId; jmethodID messageReceivedId; + jmethodID dtmfReceivedId; jmethodID callStatsUpdatedId; jclass globalStateClass; @@ -390,6 +393,20 @@ public: ,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend) ,url ? env->NewStringUTF(url) : NULL); } + static void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) { + JNIEnv *env = 0; + jint result = jvm->AttachCurrentThread(&env,NULL); + if (result != 0) { + ms_error("cannot attach VM\n"); + return; + } + LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc); + env->CallVoidMethod(lcData->listener + ,lcData->dtmfReceivedId + ,lcData->core + ,lcData->getCall(env,call) + ,dtmf); + } static void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) { JNIEnv *env = 0; jint result = jvm->AttachCurrentThread(&env,NULL); diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index c81dafec4..740bdc29c 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -91,6 +91,14 @@ public interface LinphoneCoreListener { */ void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message); + /** + * invoked when a new dtmf is received + * @param lc LinphoneCore + * @param call LinphoneCall involved in the dtmf sending + * @param dtmf value of the dtmf sent + */ + void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf); + /** * Invoked when echo cancalation calibration is completed * @param lc LinphoneCore From 5f348a03c29f71c9d536a7dd3baf257259de8f39 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 2 Oct 2012 17:31:39 +0200 Subject: [PATCH 609/769] dtmf should be notified from main thread --- coreapi/linphonecall.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 95bc62106..cb5397d78 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1078,8 +1078,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ static int dtmf_tab[16]={'0','1','2','3','4','5','6','7','8','9','*','#','A','B','C','D'}; -static void linphone_core_dtmf_received(RtpSession* s, int dtmf, void* user_data){ - LinphoneCore* lc = (LinphoneCore*)user_data; +static void linphone_core_dtmf_received(LinphoneCore *lc, int dtmf){ if (dtmf<0 || dtmf>15){ ms_warning("Bad dtmf value %i",dtmf); return; @@ -1169,7 +1168,7 @@ static void post_configure_audio_streams(LinphoneCall*call){ if (lc->vtable.dtmf_received!=NULL){ /* replace by our default action*/ audio_stream_play_received_dtmfs(call->audiostream,FALSE); - rtp_session_signal_connect(call->audiostream->session,"telephone-event",(RtpCallback)linphone_core_dtmf_received,(unsigned long)lc); + /*rtp_session_signal_connect(call->audiostream->session,"telephone-event",(RtpCallback)linphone_core_dtmf_received,(unsigned long)lc);*/ } } @@ -1955,6 +1954,8 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse } else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) || (evt == ORTP_EVENT_ICE_RESTART_NEEDED)) { handle_ice_events(call, ev); + } else if (evt==ORTP_EVENT_TELEPHONE_EVENT){ + linphone_core_dtmf_received(lc,evd->info.telephone_event); } ortp_event_destroy(ev); } From e53e2ca9e3e2008222223b98852f756b53bd10d1 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 3 Oct 2012 14:10:37 +0200 Subject: [PATCH 610/769] Update ms2 submodule for ICE. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index cfe804f4d..1789adc9a 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit cfe804f4dbae7dc1b8cf6c63018b68b2fb52cd53 +Subproject commit 1789adc9a8f80d71b3178cc2187a1514d542fa8d From 63c5dfed398a9465fdb1942e0364fa1fdfb9e71b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 3 Oct 2012 14:06:16 +0200 Subject: [PATCH 611/769] Unselect previous ICE valid pairs before adding losing pairs. --- coreapi/misc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index e85005f28..935ec54f3 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -898,6 +898,10 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, int componentID = j + 1; if (candidate->addr[0] == '\0') break; get_default_addr_and_port(componentID, md, stream, &addr, &port); + if (j == 0) { + /* If we receive a re-invite and we finished ICE processing on our side, use the candidates given by the remote. */ + ice_check_list_unselect_valid_pairs(cl); + } ice_add_losing_pair(cl, j + 1, candidate->addr, candidate->port, addr, port); losing_pairs_added = TRUE; } From 1adb23eb965463e78894d9339300c71e31babbee Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 3 Oct 2012 14:07:26 +0200 Subject: [PATCH 612/769] Add missing updates of ICE state in call statistics. --- coreapi/linphonecall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index cb5397d78..ded521b5f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -277,6 +277,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li update_media_description_from_stun(md,&call->ac,&call->vc); if (call->ice_session != NULL) { linphone_core_update_local_media_description_from_ice(md, call->ice_session); + linphone_core_update_ice_state_in_call_stats(call); } linphone_address_destroy(addr); return md; @@ -1850,6 +1851,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ } } else if (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) { linphone_core_start_accept_call_update(call->core, call); + linphone_core_update_ice_state_in_call_stats(call); } else if (evt == ORTP_EVENT_ICE_RESTART_NEEDED) { ice_session_restart(call->ice_session); ice_session_set_role(call->ice_session, IR_Controlling); From 65668542fd6bf19ebdc4246ede0a25cd5313ee6e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 3 Oct 2012 14:08:07 +0200 Subject: [PATCH 613/769] Allow logging of large trace messages. --- coreapi/linphonecore_jni.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 273d46aa9..b8d48de53 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -53,6 +53,9 @@ static JavaVM *jvm=0; #ifdef ANDROID static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){ int prio; + char str[4096]; + char *current; + char *next; switch(lev){ case ORTP_DEBUG: prio = ANDROID_LOG_DEBUG; break; case ORTP_MESSAGE: prio = ANDROID_LOG_INFO; break; @@ -61,7 +64,19 @@ static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_l case ORTP_FATAL: prio = ANDROID_LOG_FATAL; break; default: prio = ANDROID_LOG_DEFAULT; break; } - __android_log_vprint(prio, LOG_DOMAIN, fmt, args); + vsnprintf(str, sizeof(str) - 1, fmt, args); + str[sizeof(str) - 1] = '\0'; + if (strlen(str) < 512) { + __android_log_write(prio, LOG_DOMAIN, str); + } else { + current = str; + while ((next = strchr(current, '\n')) != NULL) { + *next = '\0'; + __android_log_write(prio, LOG_DOMAIN, current); + current = next + 1; + } + __android_log_write(prio, LOG_DOMAIN, current); + } } int dumbMethodForAllowingUsageOfCpuFeaturesFromStaticLibMediastream() { From 144982b065caab9aaf4b07b773429fe33200b017 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 3 Oct 2012 15:23:52 +0200 Subject: [PATCH 614/769] Update ms2 submodule for ICE. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1789adc9a..f8d9b2c40 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1789adc9a8f80d71b3178cc2187a1514d542fa8d +Subproject commit f8d9b2c400a7af1ae815725700cdae9a390fa75f From 55f676763afdad5a9c65b8a339652d9661cf71fb Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 3 Oct 2012 15:23:13 +0200 Subject: [PATCH 615/769] If the remote deactivates a media stream, remove the ICE check list for this stream. --- coreapi/misc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 935ec54f3..94110fc84 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -871,8 +871,10 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, break; } } - if ((stream->ice_mismatch == TRUE) || (stream->rtp_port == 0)) { + if (stream->ice_mismatch == TRUE) { ice_check_list_set_state(cl, ICL_Failed); + } else if (stream->rtp_port == 0) { + ice_session_remove_check_list(call->ice_session, ice_session_check_list(call->ice_session, i)); } else { if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); @@ -940,7 +942,9 @@ void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *ca for (i = 0; i < md->nstreams; i++) { IceCheckList *cl = ice_session_check_list(call->ice_session, i); if (cl && (md->streams[i].rtp_port == 0)) { - if (ice_check_list_state(cl) != ICL_Completed) ice_check_list_set_state(cl, ICL_Failed); + if (ice_check_list_state(cl) != ICL_Completed) { + ice_session_remove_check_list(call->ice_session, cl); + } } } } From 6b1a4479afcb9ed364374432d4991f56a876dc15 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 3 Oct 2012 16:05:38 +0200 Subject: [PATCH 616/769] Prevent double update of local media description + fix crash when edge detection deactivates video. --- coreapi/linphonecore.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b0cc2bb54..4525e2a18 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2537,7 +2537,6 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){ const char *subject; call->camera_active=call->params.has_video; - update_local_media_description(lc,call); if (call->ice_session != NULL) linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); @@ -2577,10 +2576,10 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho call->videostream->ice_check_list = NULL; } call->params = *params; + update_local_media_description(lc, call); if ((call->ice_session != NULL) && !has_video && params->has_video) { /* Defer call update until the ICE candidates gathering process has finished. */ ms_message("Defer call update to gather ICE candidates"); - update_local_media_description(lc, call); linphone_call_init_video_stream(call); video_stream_prepare_video(call->videostream); if (linphone_core_gather_ice_candidates(lc,call)<0) { From 789e4ce7cf1795f9e9fe11dc2d293313e97a7eca Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 3 Oct 2012 16:09:09 +0200 Subject: [PATCH 617/769] fix low bw mode --- coreapi/linphonecall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ded521b5f..a23e39f2f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1374,6 +1374,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna linphone_call_add_to_conf(call, mute); } call->current_params.in_conference=call->params.in_conference; + call->current_params.low_bandwidth=call->params.low_bandwidth; }else ms_warning("No audio stream accepted ?"); } } From 8af1e4767c3629aff8c14773a020dcd84b495bbc Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 3 Oct 2012 16:09:35 +0200 Subject: [PATCH 618/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index f8d9b2c40..0e9c3ddc0 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f8d9b2c400a7af1ae815725700cdae9a390fa75f +Subproject commit 0e9c3ddc0bc78b19a2ba88a1b97b0092a659c835 From 074f1ac939abcde916218cc3e5401fe1f19bc8ad Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 3 Oct 2012 22:03:04 +0200 Subject: [PATCH 619/769] update ms2 and ortp --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 0e9c3ddc0..0850a0add 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0e9c3ddc0bc78b19a2ba88a1b97b0092a659c835 +Subproject commit 0850a0addc99b3c998f948fc6118d30f77b9570f diff --git a/oRTP b/oRTP index 8a8843b1f..ddc4f7d04 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 8a8843b1f3a56888492b298d5262a61369e15bb7 +Subproject commit ddc4f7d041967305483761fc9c643d3bb290a5f1 From b09cb1daad42c6c3cfc1128bb74e92a5e8076c6e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 4 Oct 2012 15:10:51 +0200 Subject: [PATCH 620/769] update pref order codec list --- coreapi/linphonecore.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4525e2a18..7c11e83ae 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -704,25 +704,28 @@ static bool_t get_codec(LpConfig *config, const char* type, int index, PayloadTy } #define RANK_END 10000 -static const char *codec_pref_order[]={ - "SILK", - "speex", - "iLBC", - "amr", - "gsm", - "pcmu", - "pcma", - "VP8", - "H264", - "MP4V-ES", - "H263-1998", - NULL, + +typedef struct codec_desc{ + const char *name; + int rate; +}codec_desc_t; + +static codec_desc_t codec_pref_order[]={ + {"SILK", 16000}, + {"speex", 16000}, + {"speex", 8000}, + {"pcmu",8000}, + {"pcma",8000}, + {"VP8",90000}, + {"H264",90000}, + {"MP4V-ES",90000}, + {NULL,0} }; -static int find_codec_rank(const char *mime){ +static int find_codec_rank(const char *mime, int clock_rate){ int i; - for(i=0;codec_pref_order[i]!=NULL;++i){ - if (strcasecmp(codec_pref_order[i],mime)==0) + for(i=0;codec_pref_order[i].name!=NULL;++i){ + if (strcasecmp(codec_pref_order[i].name,mime)==0 && clock_rate==codec_pref_order[i].rate) return i; } return RANK_END; @@ -730,8 +733,8 @@ static int find_codec_rank(const char *mime){ static int codec_compare(const PayloadType *a, const PayloadType *b){ int ra,rb; - ra=find_codec_rank(a->mime_type); - rb=find_codec_rank(b->mime_type); + ra=find_codec_rank(a->mime_type,a->clock_rate); + rb=find_codec_rank(b->mime_type,b->clock_rate); if (ra>rb) return 1; if (ramime_type)){ if (ms_list_find(l,pt)==NULL){ /*unranked codecs are disabled by default*/ - if (find_codec_rank(pt->mime_type)!=RANK_END){ + if (find_codec_rank(pt->mime_type, pt->clock_rate)!=RANK_END){ payload_type_set_flag(pt,PAYLOAD_TYPE_ENABLED); } ms_message("Adding new codec %s/%i with fmtp %s", From c3894e57f8184d15ad7439f60db9190ea5405550 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 4 Oct 2012 17:03:11 +0200 Subject: [PATCH 621/769] Handle ICE running state in call statistics update. --- coreapi/misc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index 94110fc84..7367fc517 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -689,6 +689,11 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call) call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateFailed; } } + } else if (session_state == IS_Running) { + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; + if (call->params.has_video && (video_check_list != NULL)) { + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress; + } } else { call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateFailed; if (call->params.has_video && (video_check_list != NULL)) { From 591797379a5b544f509a557bae5391e86d46277f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 5 Oct 2012 11:31:25 +0200 Subject: [PATCH 622/769] Update ms2 submodule for ICE. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 0850a0add..2b1016e3e 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0850a0addc99b3c998f948fc6118d30f77b9570f +Subproject commit 2b1016e3e7b6ee5416721d66eba1504fbf260cb6 From d01fa0e643c4c2047daf311bf62b306286ff056c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 5 Oct 2012 10:24:44 +0200 Subject: [PATCH 623/769] Fix RTP streams route printing. --- coreapi/linphonecall.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a23e39f2f..88e7d01a9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1575,7 +1575,6 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){ void linphone_call_stop_audio_stream(LinphoneCall *call) { if (call->audiostream!=NULL) { - call->audiostream->ice_check_list = NULL; rtp_session_unregister_event_queue(call->audiostream->session,call->audiostream_app_evq); ortp_ev_queue_flush(call->audiostream_app_evq); ortp_ev_queue_destroy(call->audiostream_app_evq); @@ -1601,7 +1600,6 @@ void linphone_call_stop_audio_stream(LinphoneCall *call) { void linphone_call_stop_video_stream(LinphoneCall *call) { #ifdef VIDEO_ENABLED if (call->videostream!=NULL){ - call->videostream->ice_check_list = NULL; rtp_session_unregister_event_queue(call->videostream->session,call->videostream_app_evq); ortp_ev_queue_flush(call->videostream_app_evq); ortp_ev_queue_destroy(call->videostream_app_evq); From cb2b97aad073233e309d74bef39da53a9625ed87 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 5 Oct 2012 10:25:18 +0200 Subject: [PATCH 624/769] Clean ICE session deletion on call end. --- coreapi/linphonecall.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 88e7d01a9..fa58bb465 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -582,6 +582,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const static void linphone_call_destroy(LinphoneCall *obj) { + linphone_call_delete_ice_session(obj); if (obj->op!=NULL) { sal_op_release(obj->op); obj->op=NULL; @@ -605,9 +606,6 @@ static void linphone_call_destroy(LinphoneCall *obj) if (obj->auth_token) { ms_free(obj->auth_token); } - if (obj->ice_session) { - ice_session_destroy(obj->ice_session); - } ms_free(obj); } From 8c02cac3909d5c31aa036f377fd645288269b852 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 5 Oct 2012 11:27:48 +0200 Subject: [PATCH 625/769] Fix to prevent crashes. --- coreapi/misc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 7367fc517..ebb19b083 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -787,8 +787,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * if ((ice_check_list_state(cl) == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) { int rtp_port, rtcp_port; memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates)); - ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); - if ((rtp_addr != NULL) && (rtcp_addr != NULL)) { + if (ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port) == TRUE) { strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr)); stream->ice_remote_candidates[0].port = rtp_port; strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr)); From c7b3b58145d794b3da4b2ae4cd4a4eef8fd269c3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 5 Oct 2012 11:28:27 +0200 Subject: [PATCH 626/769] Clean ICE remote candidates in the media description when sending re-invite after an ICE restart. --- coreapi/misc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index ebb19b083..035017b51 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -795,6 +795,11 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * } else { ms_error("ice: Selected valid remote candidates should be present if the check list is in the Completed state"); } + } else { + for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; j++) { + stream->ice_remote_candidates[j].addr[0] = '\0'; + stream->ice_remote_candidates[j].port = 0; + } } } } From 1a4712e8cf92a8779214416fa2c40f9f7dc437e0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 5 Oct 2012 15:08:14 +0200 Subject: [PATCH 627/769] Update ms2 submodule for ICE. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 2b1016e3e..c80b4ff9d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2b1016e3e7b6ee5416721d66eba1504fbf260cb6 +Subproject commit c80b4ff9d80bfd06a7c6fff68cd82580e92c1d49 From 1cc0a418af4718014a614afdbe6f1cd7690a4ccf Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 5 Oct 2012 17:32:38 +0200 Subject: [PATCH 628/769] Few changes in JNI interface for linphone friends + fix issue in linphone_friend_destroy --- coreapi/friend.c | 2 +- coreapi/linphonecore_jni.cc | 15 +++++++++++++++ java/common/org/linphone/core/LinphoneCore.java | 13 ++++++++++--- java/common/org/linphone/core/LinphoneFriend.java | 5 ++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/coreapi/friend.c b/coreapi/friend.c index 05a1baeec..c6dee2440 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -396,8 +396,8 @@ void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend* fl){ MSList *el=ms_list_find(lc->friends,(void *)fl); if (el!=NULL){ - lc->friends=ms_list_remove_link(lc->friends,el); linphone_friend_destroy((LinphoneFriend*)el->data); + lc->friends=ms_list_remove_link(lc->friends,el); linphone_core_write_friends_config(lc); } } diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index b8d48de53..566269a76 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1592,6 +1592,21 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_done(JNIEnv* env ,jlong ptr) { linphone_friend_done((LinphoneFriend*)ptr); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeFriend(JNIEnv* env + ,jobject thiz + ,jlong ptr + ,jlong lf) { + linphone_core_remove_friend((LinphoneCore*)ptr, (LinphoneFriend*)lf); +} +extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JNIEnv* env + ,jobject thiz + ,jlong ptr + ,jstring jaddress) { + const char* address = env->GetStringUTFChars(jaddress, NULL); + LinphoneFriend *lf = linphone_core_get_friend_by_address((LinphoneCore*)ptr, address); + env->ReleaseStringUTFChars(jaddress, address); + return (jlong) lf; +} //LinphoneChatRoom extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env ,jobject thiz diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 6ac821322..732940fdd 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -20,9 +20,6 @@ package org.linphone.core; import java.util.Vector; -import org.linphone.core.LinphoneCallLog; -import org.linphone.core.LinphoneCallParams; - /** * Linphone core main object created by method {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)}. * @@ -802,4 +799,14 @@ public interface LinphoneCore { * return the version code of linphone core */ public String getVersion(); + + /** + * remove a linphone friend from linphone core and linphonerc + */ + void removeFriend(LinphoneFriend lf); + + /** + * return a linphone friend (if exists) that matches the sip address + */ + LinphoneFriend findFriendByAddress(String sipUri); } diff --git a/java/common/org/linphone/core/LinphoneFriend.java b/java/common/org/linphone/core/LinphoneFriend.java index d4f0e7503..e070f6921 100644 --- a/java/common/org/linphone/core/LinphoneFriend.java +++ b/java/common/org/linphone/core/LinphoneFriend.java @@ -123,5 +123,8 @@ public interface LinphoneFriend { */ String toString(); - + /** + * Return the native pointer for this object + */ + long getNativePtr(); } From 34d9c1df71cd92ae2bd9371112bd9d790ddff221 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 5 Oct 2012 17:35:40 +0200 Subject: [PATCH 629/769] Bigger contacts in contacts list + friend presence started --- LinphoneAuthInfoImpl.java | 1 - LinphoneCoreImpl.java | 16 ++++++++++++++++ LinphoneFriendImpl.java | 11 ++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/LinphoneAuthInfoImpl.java b/LinphoneAuthInfoImpl.java index 7d50a2fa5..45fd8a45e 100644 --- a/LinphoneAuthInfoImpl.java +++ b/LinphoneAuthInfoImpl.java @@ -43,7 +43,6 @@ class LinphoneAuthInfoImpl implements LinphoneAuthInfo { public void setPassword(String password) { // TODO Auto-generated method stub throw new RuntimeException("not implemeneted yet"); - } public void setRealm(String realm) { // TODO Auto-generated method stub diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 8677cb285..7b62ba835 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -741,4 +741,20 @@ class LinphoneCoreImpl implements LinphoneCore { public PayloadType findPayloadType(String mime, int clockRate) { return null; } + + private native void removeFriend(long ptr, long lf); + @Override + public void removeFriend(LinphoneFriend lf) { + removeFriend(nativePtr, lf.getNativePtr()); + } + + private native long getFriendByAddress(long ptr, String sipUri); + @Override + public LinphoneFriend findFriendByAddress(String sipUri) { + long ptr = getFriendByAddress(nativePtr, sipUri); + if (ptr == 0) { + return null; + } + return new LinphoneFriendImpl(ptr); + } } diff --git a/LinphoneFriendImpl.java b/LinphoneFriendImpl.java index bae44679f..6e7aa2db1 100644 --- a/LinphoneFriendImpl.java +++ b/LinphoneFriendImpl.java @@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; -class LinphoneFriendImpl implements LinphoneFriend { +import java.io.Serializable; + +class LinphoneFriendImpl implements LinphoneFriend, Serializable { protected final long nativePtr; private native long newLinphoneFriend(String friendUri); private native void setAddress(long nativePtr,long friend); @@ -48,14 +50,12 @@ class LinphoneFriendImpl implements LinphoneFriend { } public void setAddress(LinphoneAddress anAddress) { this.setAddress(nativePtr, ((LinphoneAddressImpl)anAddress).nativePtr); - } public LinphoneAddress getAddress() { return new LinphoneAddressImpl(getAddress(nativePtr)); } public void setIncSubscribePolicy(SubscribePolicy policy) { setIncSubscribePolicy(nativePtr,policy.mValue); - } public SubscribePolicy getIncSubscribePolicy() { return SubscribePolicy.fromInt(getIncSubscribePolicy(nativePtr)) ; @@ -66,7 +66,6 @@ class LinphoneFriendImpl implements LinphoneFriend { public boolean isSubscribesEnabled() { return isSubscribesEnabled(nativePtr); } - public OnlineStatus getStatus() { return OnlineStatus.fromInt(getStatus(nativePtr)); } @@ -76,5 +75,7 @@ class LinphoneFriendImpl implements LinphoneFriend { public void done() { done(nativePtr); } - + public long getNativePtr() { + return nativePtr; + } } From 23b788205b6af8ab4c1e6ca5b285b550364ac18f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 8 Oct 2012 12:36:03 +0200 Subject: [PATCH 630/769] Remove useless code. --- coreapi/callbacks.c | 3 --- coreapi/misc.c | 15 +-------------- coreapi/private.h | 1 - 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 7f901195f..52c6d4070 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -46,9 +46,6 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia call->media_pending=TRUE; } call->resultdesc=new_md; - if (call->ice_session != NULL) { - linphone_core_deactivate_ice_for_deactivated_media_streams(call, call->resultdesc); - } if ((call->audiostream && call->audiostream->ticker) || (call->videostream && call->videostream->ticker)){ /* we already started media: check if we really need to restart it*/ if (oldmd){ diff --git a/coreapi/misc.c b/coreapi/misc.c index 035017b51..b9176ebd4 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -883,7 +883,7 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, if (stream->ice_mismatch == TRUE) { ice_check_list_set_state(cl, ICL_Failed); } else if (stream->rtp_port == 0) { - ice_session_remove_check_list(call->ice_session, ice_session_check_list(call->ice_session, i)); + ice_session_remove_check_list(call->ice_session, cl); } else { if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); @@ -945,19 +945,6 @@ bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescr return FALSE; } -void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md) -{ - int i; - for (i = 0; i < md->nstreams; i++) { - IceCheckList *cl = ice_session_check_list(call->ice_session, i); - if (cl && (md->streams[i].rtp_port == 0)) { - if (ice_check_list_state(cl) != ICL_Completed) { - ice_session_remove_check_list(call->ice_session, cl); - } - } - } -} - LinphoneCall * is_a_linphone_call(void *user_pointer){ LinphoneCall *call=(LinphoneCall*)user_pointer; if (call==NULL) return NULL; diff --git a/coreapi/private.h b/coreapi/private.h index 0cefb1476..82ebf3633 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -252,7 +252,6 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md); -void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md); void linphone_core_send_initial_subscribes(LinphoneCore *lc); void linphone_core_write_friends_config(LinphoneCore* lc); From eaf16b1784450d7e1c12624ef23348c2bf799c6b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 8 Oct 2012 12:39:15 +0200 Subject: [PATCH 631/769] Deactivate video when the remote accepts the call but without video. --- coreapi/callbacks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 52c6d4070..7c7d4f003 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -266,6 +266,7 @@ static void call_accepted(SalOp *op){ } md=sal_call_get_final_media_description(op); + call->params.has_video &= linphone_core_media_description_contains_video_stream(md); if (call->state==LinphoneCallOutgoingProgress || call->state==LinphoneCallOutgoingRinging || From bdaa5ae91ac1ba1e3844fceb5f611ba37ddde964 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 8 Oct 2012 18:19:33 +0200 Subject: [PATCH 632/769] save video capture/display while setted --- Makefile.am | 2 -- coreapi/linphonecore.c | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8756019f4..4aa4332f2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -232,6 +232,4 @@ clean-local: discovery: touch specs.cpp $(CC) --include $(top_builddir)/config.h \ - --include $(top_builddir)/mediastreamer2/mediastreamer-config.h \ - --include $(top_builddir)/oRTP/ortp-config.h \ $(TUNNEL_CFLAGS) $(CFLAGS) $(MEDIASTREAMER2_CFLAGS) $(ORTP_CFLAGS) -E -P -v -dD specs.cpp diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7c11e83ae..ada16d69b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3840,7 +3840,10 @@ void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t di #endif lc->video_conf.capture=vcap_enabled; lc->video_conf.display=display_enabled; - + if (linphone_core_ready(lc)){ + lp_config_set_int(lc->config,"video","display",lc->video_conf.display); + lp_config_set_int(lc->config,"video","capture",lc->video_conf.capture); + } /* need to re-apply network bandwidth settings*/ linphone_core_set_download_bandwidth(lc, linphone_core_get_download_bandwidth(lc)); From f14bd7a95479355b9030162b18937f27a0145c1c Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 9 Oct 2012 11:30:48 +0200 Subject: [PATCH 633/769] Fix unused warning with LinphoneVideoPolicy --- coreapi/linphonecore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index ada16d69b..2e7ff6372 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -830,6 +830,7 @@ static void video_config_read(LinphoneCore *lc){ const char *str; #ifdef VIDEO_ENABLED LinphoneVideoPolicy vpol; + memset(&vpol, 0, sizeof(LinphoneVideoPolicy)); #endif build_video_devices_table(lc); From c9af7c47152e0910765b6ae5447d934f456d22cb Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 9 Oct 2012 12:59:17 +0200 Subject: [PATCH 634/769] Force AC_SUBST INTLLIBS --- configure.ac | 1 + mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4c4bab882..84081f46c 100644 --- a/configure.ac +++ b/configure.ac @@ -107,6 +107,7 @@ if test "$mingw_found" != "yes" ; then dnl AM_GNU_GETTEXT pollutes CPPFLAGS: workaround this. CPPFLAGS_save=$CPPFLAGS AM_GNU_GETTEXT([external]) + AC_SUBST(INTLLIBS) CPPFLAGS=$CPPFLAGS_save LIBS="$LIBS $LIBINTL" else diff --git a/mediastreamer2 b/mediastreamer2 index c80b4ff9d..57229c14d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c80b4ff9d80bfd06a7c6fff68cd82580e92c1d49 +Subproject commit 57229c14dedd530bc2775b5a25cad15b62da3ee9 From 3c9b9b7cefd6d17ee746c2fe8f3bdd9bd8699e81 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 9 Oct 2012 16:34:40 +0200 Subject: [PATCH 635/769] Fix function definition. --- LinphoneCallImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index cf471f52c..7e39cebc7 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -155,7 +155,7 @@ class LinphoneCallImpl implements LinphoneCall { return isAuthenticationTokenVerified(nativePtr); } - private native boolean setAuthenticationTokenVerified(long nativePtr, boolean verified); + private native void setAuthenticationTokenVerified(long nativePtr, boolean verified); public void setAuthenticationTokenVerified(boolean verified){ setAuthenticationTokenVerified(nativePtr, verified); } From d0ccd0894cea7a83495c87b18994b28208ec4f29 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 9 Oct 2012 16:37:09 +0200 Subject: [PATCH 636/769] Fix errors in JNI. --- coreapi/linphonecore_jni.cc | 217 ++++++++++++++++++------------------ 1 file changed, 110 insertions(+), 107 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 566269a76..e8b8a6e2b 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -531,7 +531,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* if (factoryConfig) env->ReleaseStringUTFChars(jfactoryConfig, factoryConfig); return nativePtr; } -extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env ,jobject thiz ,jlong lc) { LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)lc); @@ -539,7 +539,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env delete lcData; } -extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) { +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) { linphone_core_clear_proxy_config((LinphoneCore*)lc); } @@ -573,7 +573,7 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigList return jProxies; } -extern "C" int Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig( JNIEnv* env +extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig( JNIEnv* env ,jobject thiz ,jobject jproxyCfg ,jlong lc @@ -581,10 +581,10 @@ extern "C" int Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig( JNIEnv* LinphoneProxyConfig* proxy = (LinphoneProxyConfig*)pc; linphone_proxy_config_set_user_data(proxy, env->NewGlobalRef(jproxyCfg)); - return linphone_core_add_proxy_config((LinphoneCore*)lc,(LinphoneProxyConfig*)pc); + return (jint)linphone_core_add_proxy_config((LinphoneCore*)lc,(LinphoneProxyConfig*)pc); } -extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* env, jobject thiz,jlong lc) { +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* env, jobject thiz,jlong lc) { linphone_core_clear_all_auth_info((LinphoneCore*)lc); } @@ -637,13 +637,13 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall( JNIEnv* e ,jobject thiz ,jlong lc) { - return linphone_core_in_call((LinphoneCore*)lc); + return (jboolean)linphone_core_in_call((LinphoneCore*)lc); } extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInComingInvitePending( JNIEnv* env ,jobject thiz ,jlong lc) { - return linphone_core_inc_invite_pending((LinphoneCore*)lc); + return (jboolean)linphone_core_inc_invite_pending((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall( JNIEnv* env ,jobject thiz @@ -685,7 +685,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog( JNIEnv* en extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getNumberOfCallLogs( JNIEnv* env ,jobject thiz ,jlong lc) { - return ms_list_size(linphone_core_get_call_logs((LinphoneCore*)lc)); + return (jint)ms_list_size(linphone_core_get_call_logs((LinphoneCore*)lc)); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable( JNIEnv* env ,jobject thiz @@ -697,7 +697,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReachable( JNIEnv* env ,jobject thiz ,jlong lc) { - return linphone_core_is_network_reachable((LinphoneCore*)lc); + return (jboolean)linphone_core_is_network_reachable((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env @@ -707,10 +707,10 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* linphone_core_set_playback_gain_db((LinphoneCore*)lc,gain); } -extern "C" float Java_org_linphone_core_LinphoneCoreImpl_getPlaybackGain( JNIEnv* env +extern "C" jfloat Java_org_linphone_core_LinphoneCoreImpl_getPlaybackGain( JNIEnv* env ,jobject thiz ,jlong lc) { - return linphone_core_get_playback_gain_db((LinphoneCore*)lc); + return (jfloat)linphone_core_get_playback_gain_db((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_muteMic( JNIEnv* env @@ -748,10 +748,10 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_stopDtmf( JNIEnv* env linphone_core_stop_dtmf((LinphoneCore*)lc); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_getMissedCallsCount(JNIEnv* env +extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getMissedCallsCount(JNIEnv* env ,jobject thiz ,jlong lc) { - linphone_core_get_missed_calls_count((LinphoneCore*)lc); + return (jint)linphone_core_get_missed_calls_count((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_resetMissedCallsCount(JNIEnv* env @@ -774,7 +774,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv* e extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isMicMuted( JNIEnv* env ,jobject thiz ,jlong lc) { - return linphone_core_is_mic_muted((LinphoneCore*)lc); + return (jboolean)linphone_core_is_mic_muted((LinphoneCore*)lc); } extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv* env ,jobject thiz @@ -823,12 +823,12 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTy return jCodecs; } -extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env +extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env ,jobject thiz ,jlong lc ,jlong pt ,jboolean enable) { - return linphone_core_enable_payload_type((LinphoneCore*)lc,(PayloadType*)pt,enable); + return (jint)linphone_core_enable_payload_type((LinphoneCore*)lc,(PayloadType*)pt,enable); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableEchoCancellation(JNIEnv* env ,jobject thiz @@ -846,14 +846,14 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isEchoCancellationEn ,jobject thiz ,jlong lc ) { - return linphone_core_echo_cancellation_enabled((LinphoneCore*)lc); + return (jboolean)linphone_core_echo_cancellation_enabled((LinphoneCore*)lc); } extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isEchoLimiterEnabled(JNIEnv* env ,jobject thiz ,jlong lc ) { - return linphone_core_echo_limiter_enabled((LinphoneCore*)lc); + return (jboolean)linphone_core_echo_limiter_enabled((LinphoneCore*)lc); } extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv* env @@ -882,7 +882,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPresenceInfo(JNIEnv* if (alternative_contact) env->ReleaseStringUTFChars(jalternative_contact, alternative_contact); } -extern "C" long Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv* env +extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv* env ,jobject thiz ,jlong lc ,jstring jto) { @@ -890,7 +890,7 @@ extern "C" long Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv* const char* to = env->GetStringUTFChars(jto, NULL); LinphoneChatRoom* lResult = linphone_core_create_chat_room((LinphoneCore*)lc,to); env->ReleaseStringUTFChars(jto, to); - return (long)lResult; + return (jlong)lResult; } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableVideo(JNIEnv* env @@ -904,7 +904,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableVideo(JNIEnv* env extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isVideoEnabled(JNIEnv* env ,jobject thiz ,jlong lc) { - return linphone_core_video_enabled((LinphoneCore*)lc); + return (jboolean)linphone_core_video_enabled((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlayFile(JNIEnv* env ,jobject thiz @@ -951,67 +951,45 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableKeepAlive(JNIEnv* extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isKeepAliveEnabled(JNIEnv* env ,jobject thiz ,jlong lc) { - return linphone_core_keep_alive_enabled((LinphoneCore*)lc); + return (jboolean)linphone_core_keep_alive_enabled((LinphoneCore*)lc); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startEchoCalibration(JNIEnv* env ,jobject thiz ,jlong lc ,jobject data) { - return linphone_core_start_echo_calibration((LinphoneCore*)lc + return (jint)linphone_core_start_echo_calibration((LinphoneCore*)lc , LinphoneCoreData::ecCalibrationStatus , data?env->NewGlobalRef(data):NULL); } -extern "C" int Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryption(JNIEnv* env +extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryption(JNIEnv* env ,jobject thiz ,jlong lc ) { - return (int)linphone_core_get_media_encryption((LinphoneCore*)lc); + return (jint)linphone_core_get_media_encryption((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMediaEncryption(JNIEnv* env ,jobject thiz ,jlong lc - ,int menc) { + ,jint menc) { linphone_core_set_media_encryption((LinphoneCore*)lc,(LinphoneMediaEncryption)menc); } -extern "C" long Java_org_linphone_core_LinphoneCallParamsImpl_getUsedAudioCodec(JNIEnv *env, jobject thiz, jlong cp) { - return (long)linphone_call_params_get_used_audio_codec((LinphoneCallParams *)cp); -} - -extern "C" long Java_org_linphone_core_LinphoneCallParamsImpl_getUsedVideoCodec(JNIEnv *env, jobject thiz, jlong cp) { - return (long)linphone_call_params_get_used_video_codec((LinphoneCallParams *)cp); -} - -extern "C" int Java_org_linphone_core_LinphoneCallParamsImpl_getMediaEncryption(JNIEnv* env - ,jobject thiz - ,jlong cp - ) { - return (int)linphone_call_params_get_media_encryption((LinphoneCallParams*)cp); -} - extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_mediaEncryptionSupported(JNIEnv* env ,jobject thiz ,jlong lc, jint menc ) { - return linphone_core_media_encryption_supported((LinphoneCore*)lc,(LinphoneMediaEncryption)menc); + return (jboolean)linphone_core_media_encryption_supported((LinphoneCore*)lc,(LinphoneMediaEncryption)menc); } -extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setMediaEncryption(JNIEnv* env - ,jobject thiz - ,jlong cp - ,int jmenc) { - linphone_call_params_set_media_encryption((LinphoneCallParams*)cp,(LinphoneMediaEncryption)jmenc); -} - -extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryptionMandatory(JNIEnv* env +extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isMediaEncryptionMandatory(JNIEnv* env ,jobject thiz ,jlong lc ) { - return linphone_core_is_media_encryption_mandatory((LinphoneCore*)lc); + return (jboolean)linphone_core_is_media_encryption_mandatory((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMediaEncryptionMandatory(JNIEnv* env @@ -1045,9 +1023,9 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getIdentity(JN return NULL; } } -extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setProxy(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jproxy) { +extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setProxy(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jproxy) { const char* proxy = env->GetStringUTFChars(jproxy, NULL); - int err=linphone_proxy_config_set_server_addr((LinphoneProxyConfig*)proxyCfg,proxy); + jint err=linphone_proxy_config_set_server_addr((LinphoneProxyConfig*)proxyCfg,proxy); env->ReleaseStringUTFChars(jproxy, proxy); return err; } @@ -1064,14 +1042,14 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactParamet linphone_proxy_config_set_contact_parameters((LinphoneProxyConfig*)proxyCfg, params); env->ReleaseStringUTFChars(jparams, params); } -extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) { +extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) { if (jroute != NULL) { const char* route = env->GetStringUTFChars(jroute, NULL); - int err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route); + jint err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route); env->ReleaseStringUTFChars(jroute, route); return err; } else { - return linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL); + return (jint)linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL); } } extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getRoute(JNIEnv* env,jobject thiz,jlong proxyCfg) { @@ -1087,10 +1065,10 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enableRegister(JN linphone_proxy_config_enable_register((LinphoneProxyConfig*)proxyCfg,enableRegister); } extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegistered(JNIEnv* env,jobject thiz,jlong proxyCfg) { - return linphone_proxy_config_is_registered((LinphoneProxyConfig*)proxyCfg); + return (jboolean)linphone_proxy_config_is_registered((LinphoneProxyConfig*)proxyCfg); } extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegisterEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) { - return linphone_proxy_config_register_enabled((LinphoneProxyConfig*)proxyCfg); + return (jboolean)linphone_proxy_config_register_enabled((LinphoneProxyConfig*)proxyCfg); } extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_edit(JNIEnv* env,jobject thiz,jlong proxyCfg) { linphone_proxy_config_edit((LinphoneProxyConfig*)proxyCfg); @@ -1149,7 +1127,7 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enablePublish(JNI linphone_proxy_config_enable_publish((LinphoneProxyConfig*)proxyCfg,val); } extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_publishEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) { - return linphone_proxy_config_publish_enabled((LinphoneProxyConfig*)proxyCfg); + return (jboolean)linphone_proxy_config_publish_enabled((LinphoneProxyConfig*)proxyCfg); } //Auth Info @@ -1213,7 +1191,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDisplayName(JNI if (displayName) { return env->NewStringUTF(displayName); } else { - return 0; + return NULL; } } extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getUserName(JNIEnv* env @@ -1223,7 +1201,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getUserName(JNIEnv if (userName) { return env->NewStringUTF(userName); } else { - return 0; + return NULL; } } extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDomain(JNIEnv* env @@ -1233,7 +1211,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDomain(JNIEnv* if (domain) { return env->NewStringUTF(domain); } else { - return 0; + return NULL; } } @@ -1269,10 +1247,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getFrom(JNIEnv* env ,jlong ptr) { return (jlong)((LinphoneCallLog*)ptr)->from; } -extern "C" int Java_org_linphone_core_LinphoneCallLogImpl_getStatus(JNIEnv* env +extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getStatus(JNIEnv* env ,jobject thiz ,jlong ptr) { - return (jlong)((LinphoneCallLog*)ptr)->status; + return (jint)((LinphoneCallLog*)ptr)->status; } extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTo(JNIEnv* env ,jobject thiz @@ -1293,15 +1271,15 @@ extern "C" jstring Java_org_linphone_core_LinphoneCallLogImpl_getStartDate(JNIEn extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEnv* env ,jobject thiz ,jlong ptr) { - return ((LinphoneCallLog*)ptr)->duration; + return (jint)((LinphoneCallLog*)ptr)->duration; } /* CallStats */ -extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (int)((LinphoneCallStats *)stats_ptr)->type; +extern "C" jint Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jint)((LinphoneCallStats *)stats_ptr)->type; } -extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getIceState(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (int)((LinphoneCallStats *)stats_ptr)->ice_state; +extern "C" jint Java_org_linphone_core_LinphoneCallStatsImpl_getIceState(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jint)((LinphoneCallStats *)stats_ptr)->ice_state; } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getDownloadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) { return (jfloat)((LinphoneCallStats *)stats_ptr)->download_bandwidth; @@ -1438,7 +1416,7 @@ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_getMime(JNIEnv* env,j } extern "C" jint Java_org_linphone_core_PayloadTypeImpl_getRate(JNIEnv* env,jobject thiz, jlong ptr) { PayloadType* pt = (PayloadType*)ptr; - return payload_type_get_rate(pt); + return (jint)payload_type_get_rate(pt); } //LinphoneCall @@ -1494,7 +1472,7 @@ extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoCancellation( extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoCancellationEnabled( JNIEnv* env ,jobject thiz ,jlong ptr) { - return linphone_call_echo_cancellation_enabled((LinphoneCall*)ptr); + return (jboolean)linphone_call_echo_cancellation_enabled((LinphoneCall*)ptr); } extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoLimiter( JNIEnv* env @@ -1506,7 +1484,7 @@ extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoLimiter( JNIEn extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoLimiterEnabled( JNIEnv* env ,jobject thiz ,jlong ptr) { - return linphone_call_echo_limiter_enabled((LinphoneCall*)ptr); + return (jboolean)linphone_call_echo_limiter_enabled((LinphoneCall*)ptr); } extern "C" jobject Java_org_linphone_core_LinphoneCallImpl_getReplacedCall( JNIEnv* env @@ -1530,7 +1508,7 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallImpl_getAverageQuality( JNI //LinphoneFriend -extern "C" long Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env +extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env ,jobject thiz ,jstring jFriendUri) { LinphoneFriend* lResult; @@ -1542,7 +1520,7 @@ extern "C" long Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIE } else { lResult = linphone_friend_new(); } - return (long)lResult; + return (jlong)lResult; } extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv* env ,jobject thiz @@ -1550,10 +1528,10 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv* en ,jlong linphoneAddress) { linphone_friend_set_addr((LinphoneFriend*)ptr,(LinphoneAddress*)linphoneAddress); } -extern "C" long Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv* env +extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv* env ,jobject thiz ,jlong ptr) { - return (long)linphone_friend_get_address((LinphoneFriend*)ptr); + return (jlong)linphone_friend_get_address((LinphoneFriend*)ptr); } extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy(JNIEnv* env ,jobject thiz @@ -1564,7 +1542,7 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy( extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getIncSubscribePolicy(JNIEnv* env ,jobject thiz ,jlong ptr) { - return linphone_friend_get_inc_subscribe_policy((LinphoneFriend*)ptr); + return (jint)linphone_friend_get_inc_subscribe_policy((LinphoneFriend*)ptr); } extern "C" void Java_org_linphone_core_LinphoneFriendImpl_enableSubscribes(JNIEnv* env ,jobject thiz @@ -1575,12 +1553,12 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_enableSubscribes(JNIEn extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_isSubscribesEnabled(JNIEnv* env ,jobject thiz ,jlong ptr) { - return linphone_friend_subscribes_enabled((LinphoneFriend*)ptr); + return (jboolean)linphone_friend_subscribes_enabled((LinphoneFriend*)ptr); } -extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv* env +extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv* env ,jobject thiz ,jlong ptr) { - return linphone_friend_get_status((LinphoneFriend*)ptr); + return (jint)linphone_friend_get_status((LinphoneFriend*)ptr); } extern "C" void Java_org_linphone_core_LinphoneFriendImpl_edit(JNIEnv* env ,jobject thiz @@ -1608,10 +1586,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JNIE return (jlong) lf; } //LinphoneChatRoom -extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env +extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env ,jobject thiz ,jlong ptr) { - return (long) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr); + return (jlong) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr); } extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatMessage(JNIEnv* env ,jobject thiz @@ -1736,12 +1714,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDeviceRotation(JNIEnv } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, int enum_value){ +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, jint enum_value){ linphone_core_set_firewall_policy((LinphoneCore*)lc,(LinphoneFirewallPolicy)enum_value); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc){ - return linphone_core_get_firewall_policy((LinphoneCore*)lc); + return (jint)linphone_core_get_firewall_policy((LinphoneCore*)lc); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStunServer(JNIEnv *env, jobject thiz, jlong lc, jstring jserver){ @@ -1758,6 +1736,30 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv return jvalue; } +//CallParams + +extern "C" jlong Java_org_linphone_core_LinphoneCallParamsImpl_getUsedAudioCodec(JNIEnv *env, jobject thiz, jlong cp) { + return (jlong)linphone_call_params_get_used_audio_codec((LinphoneCallParams *)cp); +} + +extern "C" jlong Java_org_linphone_core_LinphoneCallParamsImpl_getUsedVideoCodec(JNIEnv *env, jobject thiz, jlong cp) { + return (jlong)linphone_call_params_get_used_video_codec((LinphoneCallParams *)cp); +} + +extern "C" jint Java_org_linphone_core_LinphoneCallParamsImpl_getMediaEncryption(JNIEnv* env + ,jobject thiz + ,jlong cp + ) { + return (jint)linphone_call_params_get_media_encryption((LinphoneCallParams*)cp); +} + +extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setMediaEncryption(JNIEnv* env + ,jobject thiz + ,jlong cp + ,jint jmenc) { + linphone_call_params_set_media_encryption((LinphoneCallParams*)cp,(LinphoneMediaEncryption)jmenc); +} + extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_audioBandwidth(JNIEnv *env, jobject thiz, jlong lcp, jint bw){ linphone_call_params_set_audio_bandwidth_limit((LinphoneCallParams*)lcp, bw); } @@ -1767,11 +1769,11 @@ extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableVideo(JNIEnv } extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_getVideoEnabled(JNIEnv *env, jobject thiz, jlong lcp){ - return linphone_call_params_video_enabled((LinphoneCallParams*)lcp); + return (jboolean)linphone_call_params_video_enabled((LinphoneCallParams*)lcp); } extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_localConferenceMode(JNIEnv *env, jobject thiz, jlong lcp){ - return linphone_call_params_local_conference_mode((LinphoneCallParams*)lcp); + return (jboolean)linphone_call_params_local_conference_mode((LinphoneCallParams*)lcp); } extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_destroy(JNIEnv *env, jobject thiz, jlong lc){ @@ -1792,12 +1794,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JN return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc)); } -extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){ +extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){ linphone_call_enable_camera((LinphoneCall *)lc, (bool_t) b); } extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_cameraEnabled(JNIEnv *env, jobject thiz, jlong lc){ - linphone_call_camera_enabled((LinphoneCall *)lc); + return (jboolean)linphone_call_camera_enabled((LinphoneCall *)lc); } extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_inviteAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong addr, jlong params){ @@ -1845,15 +1847,15 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadPtime(JNIEnv *e linphone_core_set_upload_ptime((LinphoneCore *)lc, (int) ptime); } -extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_getState(JNIEnv* env,jobject thiz,jlong ptr) { - return (int) linphone_proxy_config_get_state((const LinphoneProxyConfig *) ptr); +extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_getState(JNIEnv* env,jobject thiz,jlong ptr) { + return (jint) linphone_proxy_config_get_state((const LinphoneProxyConfig *) ptr); } extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setExpires(JNIEnv* env,jobject thiz,jlong ptr,jint delay) { linphone_proxy_config_expires((LinphoneProxyConfig *) ptr, (int) delay); } extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) { - linphone_call_get_duration((LinphoneCall *) ptr); + return (jint)linphone_call_get_duration((LinphoneCall *) ptr); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getSignalingTransportPort(JNIEnv* env,jobject thiz,jlong ptr, jint code) { @@ -1892,19 +1894,19 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_adjustSoftwareVolume(JNI } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_pauseCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) { - return linphone_core_pause_call((LinphoneCore *) pCore, (LinphoneCall *) pCall); + return (jint)linphone_core_pause_call((LinphoneCore *) pCore, (LinphoneCall *) pCall); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_pauseAllCalls(JNIEnv *env,jobject thiz,jlong pCore) { - return linphone_core_pause_all_calls((LinphoneCore *) pCore); + return (jint)linphone_core_pause_all_calls((LinphoneCore *) pCore); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_resumeCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) { - return linphone_core_resume_call((LinphoneCore *) pCore, (LinphoneCall *) pCall); + return (jint)linphone_core_resume_call((LinphoneCore *) pCore, (LinphoneCall *) pCall); } extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInConference(JNIEnv *env,jobject thiz,jlong pCore) { - return linphone_core_is_in_conference((LinphoneCore *) pCore); + return (jboolean)linphone_core_is_in_conference((LinphoneCore *) pCore); } extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_enterConference(JNIEnv *env,jobject thiz,jlong pCore) { - return 0 == linphone_core_enter_conference((LinphoneCore *) pCore); + return (jboolean)(0 == linphone_core_enter_conference((LinphoneCore *) pCore)); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_leaveConference(JNIEnv *env,jobject thiz,jlong pCore) { linphone_core_leave_conference((LinphoneCore *) pCore); @@ -1923,7 +1925,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateConference(JNIE linphone_core_terminate_conference((LinphoneCore *) pCore); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv *env,jobject thiz,jlong pCore) { - return linphone_core_get_conference_size((LinphoneCore *) pCore); + return (jint)linphone_core_get_conference_size((LinphoneCore *) pCore); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateAllCalls(JNIEnv *env,jobject thiz,jlong pCore) { linphone_core_terminate_all_calls((LinphoneCore *) pCore); @@ -1934,16 +1936,17 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,j return lcd->getCall(env,lCall); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,jobject thiz,jlong pCore) { - return ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore)); + return (jint)ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore)); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_transferCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jstring jReferTo) { +extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_transferCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jstring jReferTo) { const char* cReferTo=env->GetStringUTFChars(jReferTo, NULL); - linphone_core_transfer_call((LinphoneCore *) pCore, (LinphoneCall *) pCall, cReferTo); + jint err = linphone_core_transfer_call((LinphoneCore *) pCore, (LinphoneCall *) pCall, cReferTo); env->ReleaseStringUTFChars(jReferTo, cReferTo); + return err; } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_transferCallToAnother(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jlong pDestCall) { - linphone_core_transfer_call_to_another((LinphoneCore *) pCore, (LinphoneCall *) pCall, (LinphoneCall *) pDestCall); +extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_transferCallToAnother(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jlong pDestCall) { + return (jint)linphone_core_transfer_call_to_another((LinphoneCore *) pCore, (LinphoneCall *) pCall, (LinphoneCall *) pDestCall); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIEnv *env,jobject thiz,jlong pCore, jstring jFile) { @@ -1978,7 +1981,7 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_setVideoDevice(JNIEnv *e break; ms_message("Existing device %d : %s\n", i, devices[i]); if (i==id) { - return linphone_core_set_video_device(lc, devices[i]); + return (jint)linphone_core_set_video_device(lc, devices[i]); } } return -1; @@ -2014,7 +2017,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getAuthenticationToke } extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isAuthenticationTokenVerified(JNIEnv* env,jobject thiz,jlong ptr) { LinphoneCall *call = (LinphoneCall *) ptr; - return linphone_call_get_authentication_token_verified(call); + return (jboolean)linphone_call_get_authentication_token_verified(call); } extern "C" void Java_org_linphone_core_LinphoneCallImpl_setAuthenticationTokenVerified(JNIEnv* env,jobject thiz,jlong ptr,jboolean verified) { LinphoneCall *call = (LinphoneCall *) ptr; @@ -2023,11 +2026,11 @@ extern "C" void Java_org_linphone_core_LinphoneCallImpl_setAuthenticationTokenVe extern "C" jfloat Java_org_linphone_core_LinphoneCallImpl_getPlayVolume(JNIEnv* env, jobject thiz, jlong ptr) { LinphoneCall *call = (LinphoneCall *) ptr; - return linphone_call_get_play_volume(call); + return (jfloat)linphone_call_get_play_volume(call); } extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_soundResourcesLocked(JNIEnv* env,jobject thiz,jlong ptr){ - return linphone_core_sound_resources_locked((LinphoneCore *) ptr); + return (jboolean)linphone_core_sound_resources_locked((LinphoneCore *) ptr); } // Needed by Galaxy S (can't switch to/from speaker while playing and still keep mic working) @@ -2097,7 +2100,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUserAgent(JNIEnv *env } extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isTunnelAvailable(JNIEnv *env,jobject thiz){ - return linphone_core_tunnel_available(); + return (jboolean)linphone_core_tunnel_available(); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPolicy(JNIEnv *env, jobject thiz, jlong lc, jboolean autoInitiate, jboolean autoAccept){ From eb5ca31cfd8f7dbfde549a81455376b59ba121fe Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 10 Oct 2012 10:28:16 +0200 Subject: [PATCH 637/769] Fix bug 0000201: linphone crashes upon asking for video when low bandwidth detected. --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 2e7ff6372..2936ca0ba 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2581,7 +2581,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho } call->params = *params; update_local_media_description(lc, call); - if ((call->ice_session != NULL) && !has_video && params->has_video) { + if ((call->ice_session != NULL) && !has_video && call->params.has_video) { /* Defer call update until the ICE candidates gathering process has finished. */ ms_message("Defer call update to gather ICE candidates"); linphone_call_init_video_stream(call); From 39c0aeb136c6da2b118cc85e39a5f91b91a6ccb2 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 10 Oct 2012 13:45:05 +0200 Subject: [PATCH 638/769] Updated liblinphone + fix dialer address clear --- LinphoneCallLogImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index ac03d3699..05468626e 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -61,7 +61,6 @@ class LinphoneCallLogImpl implements LinphoneCallLog { public int getCallDuration() { return getCallDuration(nativePtr); } - @Override public int getCallId() { return getCallId(nativePtr); } From 27d9e15d2b830bf2acd1646b5d965f929b53ba1a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 11 Oct 2012 09:07:39 +0200 Subject: [PATCH 639/769] Update ms2 submodule for ICE. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 57229c14d..dcadb7e8c 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 57229c14dedd530bc2775b5a25cad15b62da3ee9 +Subproject commit dcadb7e8c2f14abfac2dc9d8308ceb20ef4b96ef From 55a3069dff9fac1862f0d57a3dcd19c284e27ebd Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 11 Oct 2012 08:55:46 +0200 Subject: [PATCH 640/769] Use average round trip time for edge detection instead of ICE gathering duration. --- coreapi/linphonecall.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index fa58bb465..d0667251d 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1819,9 +1819,8 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ ice_session_compute_candidates_foundations(call->ice_session); ice_session_eliminate_redundant_candidates(call->ice_session); ice_session_choose_default_candidates(call->ice_session); - ping_time = ice_session_gathering_duration(call->ice_session); + ping_time = ice_session_average_gathering_round_trip_time(call->ice_session); if (ping_time >=0) { - ping_time /= ice_session_nb_check_lists(call->ice_session); call->ping_time=ping_time; } } else { From 6f2d48c04e93a2f16497ed8a95ebb3a765663d9b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 11 Oct 2012 14:30:27 +0200 Subject: [PATCH 641/769] Fix tutorials compilation. --- .../java/org/linphone/core/tutorials/TutorialBuddyStatus.java | 1 + .../help/java/org/linphone/core/tutorials/TutorialChatRoom.java | 1 + .../java/org/linphone/core/tutorials/TutorialHelloWorld.java | 1 + .../java/org/linphone/core/tutorials/TutorialRegistration.java | 1 + 4 files changed, 4 insertions(+) diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java index bf253b727..dc1341d80 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java @@ -102,6 +102,7 @@ public class TutorialBuddyStatus implements LinphoneCoreListener { public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} + public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {} public static void main(String[] args) { diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java index 7514a1ddc..3e41dba00 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java @@ -80,6 +80,7 @@ public class TutorialChatRoom implements LinphoneCoreListener { public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} + public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) { write("Message ["+message+"] received from ["+from.asString()+"]"); diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java index 4b63e8813..d6b61cf8b 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java @@ -74,6 +74,7 @@ public class TutorialHelloWorld implements LinphoneCoreListener { public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} + public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {} /* * Call state notification listener */ diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java index 86b300143..fa18d51f8 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java @@ -85,6 +85,7 @@ public class TutorialRegistration implements LinphoneCoreListener { public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} + public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {} public static void main(String[] args) { // Check tutorial was called with the right number of arguments From d5f8a6f933f00bbdfcfb6a2b86674d87b854a940 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 11 Oct 2012 15:35:08 +0200 Subject: [PATCH 642/769] Add handling of ranges in the config file. --- coreapi/lpconfig.c | 25 +++++++++++++++++++++++++ coreapi/lpconfig.h | 14 ++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 0efdc335e..46d683c59 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -271,6 +271,25 @@ const char *lp_config_get_string(LpConfig *lpconfig, const char *section, const return default_string; } +bool_t lp_config_get_range(LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max) { + const char *str = lp_config_get_string(lpconfig, section, key, NULL); + if (str != NULL) { + char *minusptr = strchr(str, '-'); + if ((minusptr == NULL) || (minusptr == str)) { + *min = default_min; + *max = default_max; + return FALSE; + } + *min = atoi(str); + *max = atoi(minusptr + 1); + return TRUE; + } else { + *min = default_min; + *max = default_max; + return TRUE; + } +} + int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, int default_value){ const char *str=lp_config_get_string(lpconfig,section,key,NULL); if (str!=NULL) { @@ -324,6 +343,12 @@ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *ke lpconfig->modified++; } +void lp_config_set_range(LpConfig *lpconfig, const char *section, const char *key, int min_value, int max_value) { + char tmp[30]; + snprintf(tmp, sizeof(tmp), "%i-%i", min_value, max_value); + lp_config_set_string(lpconfig, section, key, tmp); +} + void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key, int value){ char tmp[30]; snprintf(tmp,sizeof(tmp),"%i",value); diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index a27f7e39a..b672e4cbf 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -59,6 +59,14 @@ int lp_config_read_file(LpConfig *lpconfig, const char *filename); **/ const char *lp_config_get_string(LpConfig *lpconfig, const char *section, const char *key, const char *default_string); int lp_config_read_file(LpConfig *lpconfig, const char *filename); +/** + * Retrieves a configuration item as a range, given its section, key, and default min and max values. + * + * @ingroup misc + * @return TRUE if the value is successfully parsed as a range, FALSE otherwise. + * If FALSE is returned, min and max are filled respectively with default_min and default_max values. + */ +bool_t lp_config_get_range(LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max); /** * Retrieves a configuration item as an integer, given its section, key, and default value. * @@ -90,6 +98,12 @@ float lp_config_get_float(LpConfig *lpconfig,const char *section, const char *ke * @ingroup misc **/ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *key, const char *value); +/** + * Sets a range config item + * + * @ingroup misc + */ +void lp_config_set_range(LpConfig *lpconfig, const char *section, const char *key, int min_value, int max_value); /** * Sets an integer config item * From 3910894b7cf4ae3d8c596fb7106919b5f4886470 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 11 Oct 2012 15:35:52 +0200 Subject: [PATCH 643/769] Allow random selection of media ports without configured ranges. --- coreapi/linphonecall.c | 96 ++++++++++++++++++++++++++++++++++++++---- coreapi/linphonecore.c | 83 ++++++++++++++++++++++++++++++------ coreapi/linphonecore.h | 8 ++++ coreapi/private.h | 6 ++- 4 files changed, 171 insertions(+), 22 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d0667251d..a930b1bed 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -298,17 +298,35 @@ SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCa return _create_local_media_description(lc,call,id,id); } -static int find_port_offset(LinphoneCore *lc){ +static int find_port_offset(LinphoneCore *lc, SalStreamType type){ int offset; MSList *elem; - int audio_port; + int tried_port; + int existing_port; bool_t already_used=FALSE; for(offset=0;offset<100;offset+=2){ - audio_port=linphone_core_get_audio_port (lc)+offset; + switch (type) { + default: + case SalAudio: + tried_port=linphone_core_get_audio_port (lc)+offset; + break; + case SalVideo: + tried_port=linphone_core_get_video_port (lc)+offset; + break; + } already_used=FALSE; for(elem=lc->calls;elem!=NULL;elem=elem->next){ LinphoneCall *call=(LinphoneCall*)elem->data; - if (call->audio_port==audio_port) { + switch (type) { + default: + case SalAudio: + existing_port = call->audio_port; + break; + case SalVideo: + existing_port = call->video_port; + break; + } + if (existing_port==tried_port) { already_used=TRUE; break; } @@ -322,8 +340,54 @@ static int find_port_offset(LinphoneCore *lc){ return offset; } +static int select_random_port(LinphoneCore *lc, SalStreamType type) { + MSList *elem; + int nb_tries; + int tried_port = 0; + int existing_port = 0; + int min_port = 0, max_port = 0; + bool_t already_used = FALSE; + + switch (type) { + default: + case SalAudio: + linphone_core_get_audio_port_range(lc, &min_port, &max_port); + break; + case SalVideo: + linphone_core_get_video_port_range(lc, &min_port, &max_port); + break; + } + tried_port = (rand() % (max_port - min_port) + min_port) & ~0x1; + if (tried_port < min_port) tried_port = min_port + 2; + for (nb_tries = 0; nb_tries < 100; nb_tries++) { + for (elem = lc->calls; elem != NULL; elem = elem->next) { + LinphoneCall *call = (LinphoneCall *)elem->data; + switch (type) { + default: + case SalAudio: + existing_port = call->audio_port; + break; + case SalVideo: + existing_port = call->video_port; + break; + } + if (existing_port == tried_port) { + already_used = TRUE; + break; + } + } + if (!already_used) break; + } + if (nb_tries == 100) { + ms_error("Could not find any free port!"); + return -1; + } + return tried_port; +} + static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){ int port_offset; + int min_port, max_port; call->magic=linphone_call_magic; call->refcnt=1; call->state=LinphoneCallIdle; @@ -333,10 +397,26 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, call->log=linphone_call_log_new(call, from, to); call->owns_call_log=TRUE; linphone_core_notify_all_friends(call->core,LinphoneStatusOnThePhone); - port_offset=find_port_offset (call->core); - if (port_offset==-1) return; - call->audio_port=linphone_core_get_audio_port(call->core)+port_offset; - call->video_port=linphone_core_get_video_port(call->core)+port_offset; + linphone_core_get_audio_port_range(call->core, &min_port, &max_port); + if (min_port == max_port) { + /* Used fixed RTP audio port. */ + port_offset=find_port_offset (call->core, SalAudio); + if (port_offset==-1) return; + call->audio_port=linphone_core_get_audio_port(call->core)+port_offset; + } else { + /* Select random RTP audio port in the specified range. */ + call->audio_port = select_random_port(call->core, SalAudio); + } + linphone_core_get_video_port_range(call->core, &min_port, &max_port); + if (min_port == max_port) { + /* Used fixed RTP video port. */ + port_offset=find_port_offset (call->core, SalVideo); + if (port_offset==-1) return; + call->video_port=linphone_core_get_video_port(call->core)+port_offset; + } else { + /* Select random RTP video port in the specified range. */ + call->video_port = select_random_port(call->core, SalVideo); + } linphone_call_init_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], LINPHONE_CALL_STATS_AUDIO); linphone_call_init_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], LINPHONE_CALL_STATS_VIDEO); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 2936ca0ba..db7a8ea7c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -624,18 +624,29 @@ static void sip_config_read(LinphoneCore *lc) static void rtp_config_read(LinphoneCore *lc) { - int port; + int min_port, max_port; int jitt_comp; int nortp_timeout; bool_t rtp_no_xmit_on_audio_mute; bool_t adaptive_jitt_comp_enabled; - port=lp_config_get_int(lc->config,"rtp","audio_rtp_port",7078); - linphone_core_set_audio_port(lc,port); + if (lp_config_get_range(lc->config, "rtp", "audio_rtp_port", &min_port, &max_port, 7078, 7078) == TRUE) { + if (min_port <= 0) min_port = 1; + if (max_port > 65535) max_port = 65535; + linphone_core_set_audio_port_range(lc, min_port, max_port); + } else { + min_port = lp_config_get_int(lc->config, "rtp", "audio_rtp_port", 7078); + linphone_core_set_audio_port(lc, min_port); + } - port=lp_config_get_int(lc->config,"rtp","video_rtp_port",9078); - if (port==0) port=9078; - linphone_core_set_video_port(lc,port); + if (lp_config_get_range(lc->config, "rtp", "video_rtp_port", &min_port, &max_port, 9078, 9078) == TRUE) { + if (min_port <= 0) min_port = 1; + if (max_port > 65535) max_port = 65535; + linphone_core_set_video_port_range(lc, min_port, max_port); + } else { + min_port = lp_config_get_int(lc->config, "rtp", "video_rtp_port", 9078); + linphone_core_set_video_port(lc, min_port); + } jitt_comp=lp_config_get_int(lc->config,"rtp","audio_jitt_comp",60); linphone_core_set_audio_jittcomp(lc,jitt_comp); @@ -1440,7 +1451,18 @@ int linphone_core_get_video_jittcomp(LinphoneCore *lc) **/ int linphone_core_get_audio_port(const LinphoneCore *lc) { - return lc->rtp_conf.audio_rtp_port; + return lc->rtp_conf.audio_rtp_min_port; +} + +/** + * Get the audio port range from which is randomly chosen the UDP port used for audio streaming. + * + * @ingroup network_parameters + */ +void linphone_core_get_audio_port_range(const LinphoneCore *lc, int *min_port, int *max_port) +{ + *min_port = lc->rtp_conf.audio_rtp_min_port; + *max_port = lc->rtp_conf.audio_rtp_max_port; } /** @@ -1449,7 +1471,18 @@ int linphone_core_get_audio_port(const LinphoneCore *lc) * @ingroup network_parameters **/ int linphone_core_get_video_port(const LinphoneCore *lc){ - return lc->rtp_conf.video_rtp_port; + return lc->rtp_conf.video_rtp_min_port; +} + +/** + * Get the video port range from which is randomly chosen the UDP port used for video streaming. + * + * @ingroup network_parameters + */ +void linphone_core_get_video_port_range(const LinphoneCore *lc, int *min_port, int *max_port) +{ + *min_port = lc->rtp_conf.video_rtp_min_port; + *max_port = lc->rtp_conf.video_rtp_max_port; } @@ -1501,7 +1534,16 @@ void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc,bool_t rtp_no_ **/ void linphone_core_set_audio_port(LinphoneCore *lc, int port) { - lc->rtp_conf.audio_rtp_port=port; + lc->rtp_conf.audio_rtp_min_port=lc->rtp_conf.audio_rtp_max_port=port; +} + +/** + * Sets the UDP port range from which to randomly select the port used for audio streaming. + */ +void linphone_core_set_audio_port_range(LinphoneCore *lc, int min_port, int max_port) +{ + lc->rtp_conf.audio_rtp_min_port=min_port; + lc->rtp_conf.audio_rtp_max_port=max_port; } /** @@ -1510,7 +1552,16 @@ void linphone_core_set_audio_port(LinphoneCore *lc, int port) * @ingroup network_parameters **/ void linphone_core_set_video_port(LinphoneCore *lc, int port){ - lc->rtp_conf.video_rtp_port=port; + lc->rtp_conf.video_rtp_min_port=lc->rtp_conf.video_rtp_max_port=port; +} + +/** + * Sets the UDP port range from which to randomly select the port used for video streaming. + */ +void linphone_core_set_video_port_range(LinphoneCore *lc, int min_port, int max_port) +{ + lc->rtp_conf.video_rtp_min_port=min_port; + lc->rtp_conf.video_rtp_max_port=max_port; } /** @@ -4556,8 +4607,16 @@ void sip_config_uninit(LinphoneCore *lc) void rtp_config_uninit(LinphoneCore *lc) { rtp_config_t *config=&lc->rtp_conf; - lp_config_set_int(lc->config,"rtp","audio_rtp_port",config->audio_rtp_port); - lp_config_set_int(lc->config,"rtp","video_rtp_port",config->video_rtp_port); + if (config->audio_rtp_min_port == config->audio_rtp_max_port) { + lp_config_set_int(lc->config, "rtp", "audio_rtp_port", config->audio_rtp_min_port); + } else { + lp_config_set_range(lc->config, "rtp", "audio_rtp_port", config->audio_rtp_min_port, config->audio_rtp_max_port); + } + if (config->video_rtp_min_port == config->video_rtp_max_port) { + lp_config_set_int(lc->config, "rtp", "video_rtp_port", config->video_rtp_min_port); + } else { + lp_config_set_range(lc->config, "rtp", "video_rtp_port", config->video_rtp_min_port, config->video_rtp_max_port); + } lp_config_set_int(lc->config,"rtp","audio_jitt_comp",config->audio_jitt_comp); lp_config_set_int(lc->config,"rtp","video_jitt_comp",config->video_jitt_comp); lp_config_set_int(lc->config,"rtp","nortp_timeout",config->nortp_timeout); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 0209a3774..1849c083b 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1115,14 +1115,22 @@ void linphone_core_set_video_jittcomp(LinphoneCore *lc, int value); int linphone_core_get_audio_port(const LinphoneCore *lc); +void linphone_core_get_audio_port_range(const LinphoneCore *lc, int *min_port, int *max_port); + int linphone_core_get_video_port(const LinphoneCore *lc); +void linphone_core_get_video_port_range(const LinphoneCore *lc, int *min_port, int *max_port); + int linphone_core_get_nortp_timeout(const LinphoneCore *lc); void linphone_core_set_audio_port(LinphoneCore *lc, int port); +void linphone_core_set_audio_port_range(LinphoneCore *lc, int min_port, int max_port); + void linphone_core_set_video_port(LinphoneCore *lc, int port); +void linphone_core_set_video_port_range(LinphoneCore *lc, int min_port, int max_port); + void linphone_core_set_nortp_timeout(LinphoneCore *lc, int port); void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc, bool_t use_info); diff --git a/coreapi/private.h b/coreapi/private.h index 82ebf3633..028b408f8 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -398,8 +398,10 @@ typedef struct sip_config typedef struct rtp_config { - int audio_rtp_port; - int video_rtp_port; + int audio_rtp_min_port; + int audio_rtp_max_port; + int video_rtp_min_port; + int video_rtp_max_port; int audio_jitt_comp; /*jitter compensation*/ int video_jitt_comp; /*jitter compensation*/ int nortp_timeout; From b8537ffbd3db0f1eb64b6ab2d83561508fd3f807 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 11 Oct 2012 15:49:45 +0200 Subject: [PATCH 644/769] remove size converter in case of IOS simulator --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index dcadb7e8c..95ef77fe1 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit dcadb7e8c2f14abfac2dc9d8308ceb20ef4b96ef +Subproject commit 95ef77fe123c23a71e3fe1cb8932efaf048f399c From 981faabdb46fa8223305eaae11d53acb6c1fcda5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 11 Oct 2012 01:44:14 +0200 Subject: [PATCH 645/769] improve calibrator. First tone frequency changed because it triggered false detection due to harmonics. --- coreapi/ec-calibrator.c | 42 +++++++++++++++++++++++++---------------- coreapi/private.h | 3 ++- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index 5fbf7a1fb..ab3bc80ac 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -36,41 +36,50 @@ static void ecc_init_filters(EcCalibrator *ecc){ ecc->sndread=ms_snd_card_create_reader(ecc->play_card); ms_filter_call_method(ecc->sndread,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); + ms_filter_call_method(ecc->sndread,MS_FILTER_GET_SAMPLE_RATE,&rate); + ecc->read_resampler=ms_filter_new(MS_RESAMPLE_ID); + ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_SAMPLE_RATE,&rate); + ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&ecc->rate); + + ecc->det=ms_filter_new(MS_TONE_DETECTOR_ID); ms_filter_call_method(ecc->det,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ecc->rec=ms_filter_new(MS_FILE_REC_ID); - ms_filter_link(ecc->sndread,0,ecc->det,0); + ms_filter_link(ecc->sndread,0,ecc->read_resampler,0); + ms_filter_link(ecc->read_resampler,0,ecc->det,0); ms_filter_link(ecc->det,0,ecc->rec,0); ecc->play=ms_filter_new(MS_FILE_PLAYER_ID); ecc->gen=ms_filter_new(MS_DTMF_GEN_ID); ms_filter_call_method(ecc->gen,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); - ecc->resampler=ms_filter_new(MS_RESAMPLE_ID); + ecc->write_resampler=ms_filter_new(MS_RESAMPLE_ID); ecc->sndwrite=ms_snd_card_create_writer(ecc->capt_card); - - ms_filter_link(ecc->play,0,ecc->gen,0); - ms_filter_link(ecc->gen,0,ecc->resampler,0); - ms_filter_link(ecc->resampler,0,ecc->sndwrite,0); - + ms_filter_call_method(ecc->sndwrite,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ms_filter_call_method(ecc->sndwrite,MS_FILTER_GET_SAMPLE_RATE,&rate); - ms_filter_call_method(ecc->resampler,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); - ms_filter_call_method(ecc->resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&rate); + ms_filter_call_method(ecc->write_resampler,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); + ms_filter_call_method(ecc->write_resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&rate); + + ms_filter_link(ecc->play,0,ecc->gen,0); + ms_filter_link(ecc->gen,0,ecc->write_resampler,0); + ms_filter_link(ecc->write_resampler,0,ecc->sndwrite,0); - ms_ticker_attach(ecc->ticker,ecc->play); ms_ticker_attach(ecc->ticker,ecc->sndread); + ms_ticker_attach(ecc->ticker,ecc->play); + } static void ecc_deinit_filters(EcCalibrator *ecc){ - ms_ticker_detach(ecc->ticker,ecc->play); ms_ticker_detach(ecc->ticker,ecc->sndread); + ms_ticker_detach(ecc->ticker,ecc->play); ms_filter_unlink(ecc->play,0,ecc->gen,0); - ms_filter_unlink(ecc->gen,0,ecc->resampler,0); - ms_filter_unlink(ecc->resampler,0,ecc->sndwrite,0); + ms_filter_unlink(ecc->gen,0,ecc->write_resampler,0); + ms_filter_unlink(ecc->write_resampler,0,ecc->sndwrite,0); - ms_filter_unlink(ecc->sndread,0,ecc->det,0); + ms_filter_unlink(ecc->sndread,0,ecc->read_resampler,0); + ms_filter_unlink(ecc->read_resampler,0,ecc->det,0); ms_filter_unlink(ecc->det,0,ecc->rec,0); ms_filter_destroy(ecc->sndread); @@ -78,7 +87,8 @@ static void ecc_deinit_filters(EcCalibrator *ecc){ ms_filter_destroy(ecc->rec); ms_filter_destroy(ecc->play); ms_filter_destroy(ecc->gen); - ms_filter_destroy(ecc->resampler); + ms_filter_destroy(ecc->read_resampler); + ms_filter_destroy(ecc->write_resampler); ms_filter_destroy(ecc->sndwrite); ms_ticker_destroy(ecc->ticker); @@ -113,7 +123,7 @@ static void ecc_play_tones(EcCalibrator *ecc){ ms_filter_call_method (ecc->det,MS_TONE_DETECTOR_ADD_SCAN,&expected_tone); - tone.frequency=1000; + tone.frequency=1300; tone.duration=1000; tone.amplitude=1.0; diff --git a/coreapi/private.h b/coreapi/private.h index 028b408f8..b44fe4a97 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -592,7 +592,8 @@ struct _EcCalibrator{ ms_thread_t thread; MSSndCard *play_card,*capt_card; MSFilter *sndread,*det,*rec; - MSFilter *play, *gen, *sndwrite,*resampler; + MSFilter *play, *gen, *sndwrite; + MSFilter *read_resampler,*write_resampler; MSTicker *ticker; LinphoneEcCalibrationCallback cb; void *cb_data; From 2be16cafc6ff49de073d3d12886fcae03c9a3b5d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 15 Oct 2012 09:56:16 +0200 Subject: [PATCH 646/769] Move linphone core java implementation files --- .../impl/org/linphone/core/LinphoneAddressImpl.java | 0 .../impl/org/linphone/core/LinphoneAuthInfoImpl.java | 0 .../impl/org/linphone/core/LinphoneCallImpl.java | 0 .../impl/org/linphone/core/LinphoneCallLogImpl.java | 0 .../impl/org/linphone/core/LinphoneCallParamsImpl.java | 0 .../impl/org/linphone/core/LinphoneCallStatsImpl.java | 0 .../impl/org/linphone/core/LinphoneChatMessageImpl.java | 0 .../impl/org/linphone/core/LinphoneChatRoomImpl.java | 0 .../impl/org/linphone/core/LinphoneCoreFactoryImpl.java | 0 .../impl/org/linphone/core/LinphoneCoreImpl.java | 0 .../impl/org/linphone/core/LinphoneFriendImpl.java | 0 .../impl/org/linphone/core/LinphoneProxyConfigImpl.java | 0 Log.java => java/impl/org/linphone/core/Log.java | 0 .../impl/org/linphone/core/PayloadTypeImpl.java | 0 {video => java/impl/org/linphone/core/video}/VideoUtil.java | 0 15 files changed, 0 insertions(+), 0 deletions(-) rename LinphoneAddressImpl.java => java/impl/org/linphone/core/LinphoneAddressImpl.java (100%) rename LinphoneAuthInfoImpl.java => java/impl/org/linphone/core/LinphoneAuthInfoImpl.java (100%) rename LinphoneCallImpl.java => java/impl/org/linphone/core/LinphoneCallImpl.java (100%) rename LinphoneCallLogImpl.java => java/impl/org/linphone/core/LinphoneCallLogImpl.java (100%) rename LinphoneCallParamsImpl.java => java/impl/org/linphone/core/LinphoneCallParamsImpl.java (100%) rename LinphoneCallStatsImpl.java => java/impl/org/linphone/core/LinphoneCallStatsImpl.java (100%) rename LinphoneChatMessageImpl.java => java/impl/org/linphone/core/LinphoneChatMessageImpl.java (100%) rename LinphoneChatRoomImpl.java => java/impl/org/linphone/core/LinphoneChatRoomImpl.java (100%) rename LinphoneCoreFactoryImpl.java => java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java (100%) rename LinphoneCoreImpl.java => java/impl/org/linphone/core/LinphoneCoreImpl.java (100%) rename LinphoneFriendImpl.java => java/impl/org/linphone/core/LinphoneFriendImpl.java (100%) rename LinphoneProxyConfigImpl.java => java/impl/org/linphone/core/LinphoneProxyConfigImpl.java (100%) rename Log.java => java/impl/org/linphone/core/Log.java (100%) rename PayloadTypeImpl.java => java/impl/org/linphone/core/PayloadTypeImpl.java (100%) rename {video => java/impl/org/linphone/core/video}/VideoUtil.java (100%) diff --git a/LinphoneAddressImpl.java b/java/impl/org/linphone/core/LinphoneAddressImpl.java similarity index 100% rename from LinphoneAddressImpl.java rename to java/impl/org/linphone/core/LinphoneAddressImpl.java diff --git a/LinphoneAuthInfoImpl.java b/java/impl/org/linphone/core/LinphoneAuthInfoImpl.java similarity index 100% rename from LinphoneAuthInfoImpl.java rename to java/impl/org/linphone/core/LinphoneAuthInfoImpl.java diff --git a/LinphoneCallImpl.java b/java/impl/org/linphone/core/LinphoneCallImpl.java similarity index 100% rename from LinphoneCallImpl.java rename to java/impl/org/linphone/core/LinphoneCallImpl.java diff --git a/LinphoneCallLogImpl.java b/java/impl/org/linphone/core/LinphoneCallLogImpl.java similarity index 100% rename from LinphoneCallLogImpl.java rename to java/impl/org/linphone/core/LinphoneCallLogImpl.java diff --git a/LinphoneCallParamsImpl.java b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java similarity index 100% rename from LinphoneCallParamsImpl.java rename to java/impl/org/linphone/core/LinphoneCallParamsImpl.java diff --git a/LinphoneCallStatsImpl.java b/java/impl/org/linphone/core/LinphoneCallStatsImpl.java similarity index 100% rename from LinphoneCallStatsImpl.java rename to java/impl/org/linphone/core/LinphoneCallStatsImpl.java diff --git a/LinphoneChatMessageImpl.java b/java/impl/org/linphone/core/LinphoneChatMessageImpl.java similarity index 100% rename from LinphoneChatMessageImpl.java rename to java/impl/org/linphone/core/LinphoneChatMessageImpl.java diff --git a/LinphoneChatRoomImpl.java b/java/impl/org/linphone/core/LinphoneChatRoomImpl.java similarity index 100% rename from LinphoneChatRoomImpl.java rename to java/impl/org/linphone/core/LinphoneChatRoomImpl.java diff --git a/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java similarity index 100% rename from LinphoneCoreFactoryImpl.java rename to java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java diff --git a/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java similarity index 100% rename from LinphoneCoreImpl.java rename to java/impl/org/linphone/core/LinphoneCoreImpl.java diff --git a/LinphoneFriendImpl.java b/java/impl/org/linphone/core/LinphoneFriendImpl.java similarity index 100% rename from LinphoneFriendImpl.java rename to java/impl/org/linphone/core/LinphoneFriendImpl.java diff --git a/LinphoneProxyConfigImpl.java b/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java similarity index 100% rename from LinphoneProxyConfigImpl.java rename to java/impl/org/linphone/core/LinphoneProxyConfigImpl.java diff --git a/Log.java b/java/impl/org/linphone/core/Log.java similarity index 100% rename from Log.java rename to java/impl/org/linphone/core/Log.java diff --git a/PayloadTypeImpl.java b/java/impl/org/linphone/core/PayloadTypeImpl.java similarity index 100% rename from PayloadTypeImpl.java rename to java/impl/org/linphone/core/PayloadTypeImpl.java diff --git a/video/VideoUtil.java b/java/impl/org/linphone/core/video/VideoUtil.java similarity index 100% rename from video/VideoUtil.java rename to java/impl/org/linphone/core/video/VideoUtil.java From 78a66ffc91e960f4cd3379495f02a00898235f3e Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 15 Oct 2012 11:39:55 +0200 Subject: [PATCH 647/769] Added audio and video port API to JNI --- coreapi/linphonecore_jni.cc | 16 +++++++++++++++ .../org/linphone/core/LinphoneCore.java | 20 +++++++++++++++++++ .../org/linphone/core/LinphoneCoreImpl.java | 20 +++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e8b8a6e2b..f84ca3bb0 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2114,6 +2114,22 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCountNative(JNIEnv ms_set_cpu_count(count); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAudioPort(JNIEnv *env, jobject thiz, jlong lc, jint port) { + linphone_core_set_audio_port((LinphoneCore *)lc, port); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPort(JNIEnv *env, jobject thiz, jlong lc, jint port) { + linphone_core_set_video_port((LinphoneCore *)lc, port); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAudioPortRange(JNIEnv *env, jobject thiz, jlong lc, jint min_port, jint max_port) { + linphone_core_set_audio_port_range((LinphoneCore *)lc, min_port, max_port); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPortRange(JNIEnv *env, jobject thiz, jlong lc, jint min_port, jint max_port) { + linphone_core_set_video_port_range((LinphoneCore *)lc, min_port, max_port); +} + extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* env,jobject thiz,jlong ptr) { jstring jvalue =env->NewStringUTF(linphone_core_get_version()); return jvalue; diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 732940fdd..50b8609f0 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -809,4 +809,24 @@ public interface LinphoneCore { * return a linphone friend (if exists) that matches the sip address */ LinphoneFriend findFriendByAddress(String sipUri); + + /** + * Sets the UDP port used for audio streaming. + **/ + void setAudioPort(int port); + + /** + * Sets the UDP port range from which to randomly select the port used for audio streaming. + */ + void setAudioPortRange(int minPort, int maxPort); + + /** + * Sets the UDP port used for video streaming. + **/ + void setVideoPort(int port); + + /** + * Sets the UDP port range from which to randomly select the port used for video streaming. + */ + void setVideoPortRange(int minPort, int maxPort); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 7b62ba835..91e6e18cd 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -110,6 +110,10 @@ class LinphoneCoreImpl implements LinphoneCore { private native int getMissedCallsCount(long nativePtr); private native void resetMissedCallsCount(long nativePtr); private native String getVersion(long nativePtr); + private native void setAudioPort(long nativePtr, int port); + private native void setVideoPort(long nativePtr, int port); + private native void setAudioPortRange(long nativePtr, int minPort, int maxPort); + private native void setVideoPortRange(long nativePtr, int minPort, int maxPort); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -757,4 +761,20 @@ class LinphoneCoreImpl implements LinphoneCore { } return new LinphoneFriendImpl(ptr); } + + public void setAudioPort(int port) { + setAudioPort(nativePtr, port); + } + + public void setVideoPort(int port) { + setVideoPort(nativePtr, port); + } + + public void setAudioPortRange(int minPort, int maxPort) { + setAudioPortRange(nativePtr, minPort, maxPort); + } + + public void setVideoPortRange(int minPort, int maxPort) { + setVideoPortRange(nativePtr, minPort, maxPort); + } } From 30032453d692bf5440a9b90f830c19f559a72005 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 15 Oct 2012 15:39:00 +0200 Subject: [PATCH 648/769] Added setIncomingTimeout to JNI --- coreapi/linphonecore_jni.cc | 4 ++++ java/common/org/linphone/core/LinphoneCore.java | 7 +++++++ java/impl/org/linphone/core/LinphoneCoreImpl.java | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index f84ca3bb0..080c8b009 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2130,6 +2130,10 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPortRange(JNIEnv linphone_core_set_video_port_range((LinphoneCore *)lc, min_port, max_port); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setIncomingTimeout(JNIEnv *env, jobject thiz, jlong lc, jint timeout) { + linphone_core_set_inc_timeout((LinphoneCore *)lc, timeout); +} + extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* env,jobject thiz,jlong ptr) { jstring jvalue =env->NewStringUTF(linphone_core_get_version()); return jvalue; diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 50b8609f0..f2ad09b90 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -829,4 +829,11 @@ public interface LinphoneCore { * Sets the UDP port range from which to randomly select the port used for video streaming. */ void setVideoPortRange(int minPort, int maxPort); + + /** + * Set the incoming call timeout in seconds. + * If an incoming call isn't answered for this timeout period, it is + * automatically declined. + **/ + void setIncomingTimeout(int timeout); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 91e6e18cd..6059915ea 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -114,6 +114,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setVideoPort(long nativePtr, int port); private native void setAudioPortRange(long nativePtr, int minPort, int maxPort); private native void setVideoPortRange(long nativePtr, int minPort, int maxPort); + private native void setIncomingTimeout(long nativePtr, int timeout); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -777,4 +778,8 @@ class LinphoneCoreImpl implements LinphoneCore { public void setVideoPortRange(int minPort, int maxPort) { setVideoPortRange(nativePtr, minPort, maxPort); } + + public void setIncomingTimeout(int timeout) { + setIncomingTimeout(nativePtr, timeout); + } } From cd9c2c4e09c4c385e6495af9393c87aaab370cc9 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 15 Oct 2012 15:34:25 +0200 Subject: [PATCH 649/769] fix bug in file config parser preventing to reset values. --- coreapi/lpconfig.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 46d683c59..bd2adfbb4 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -184,10 +184,10 @@ void lp_config_parse(LpConfig *lpconfig, FILE *file){ if (pos2==NULL) pos2=pos1+strlen(pos1); else { *pos2='\0'; /*replace the '\n' */ - pos2--; } /* remove ending white spaces */ - for (; pos2>pos1 && *pos2==' ';pos2--) *pos2='\0'; + for (; pos2>pos1 && pos2[-1]==' ';pos2--) pos2[-1]='\0'; + if (pos2-pos1>=0){ /* found a pair key,value */ if (cur!=NULL){ @@ -198,7 +198,7 @@ void lp_config_parse(LpConfig *lpconfig, FILE *file){ ms_free(item->value); item->value=strdup(pos1); } - /*printf("Found %s %s=%s\n",cur->name,key,pos1);*/ + /*printf("Found %s %s={%s}\n",cur->name,key,pos1);*/ }else{ ms_warning("found key,item but no sections"); } From 187aedb4056785ed99a86a089f302bb92e0b3e28 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 15 Oct 2012 17:10:54 +0200 Subject: [PATCH 650/769] Fix readline dependency --- console/linphonec.h | 4 ++-- m4/readline.m4 | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/console/linphonec.h b/console/linphonec.h index ba7d346f8..3265d42ac 100644 --- a/console/linphonec.h +++ b/console/linphonec.h @@ -29,13 +29,12 @@ #include "config.h" #endif +#ifdef HAVE_READLINE #ifdef HAVE_READLINE_H #include -#define HAVE_READLINE #else #ifdef HAVE_READLINE_READLINE_H #include -#define HAVE_READLINE #endif #endif #ifdef HAVE_HISTORY_H @@ -45,6 +44,7 @@ #include #endif #endif +#endif #undef PARAMS /************************************************************************** diff --git a/m4/readline.m4 b/m4/readline.m4 index 13a217fda..ebb7656cd 100644 --- a/m4/readline.m4 +++ b/m4/readline.m4 @@ -22,15 +22,22 @@ if test "$readline_prefix" != "none"; then AC_CHECK_HEADERS(readline.h readline/readline.h, readline_h_found=yes) AC_CHECK_HEADERS(history.h readline/history.h) - AC_CHECK_LIB(readline, readline, [readline_libs_found=yes],[],[]) - + for termcap_lib in "" -ltermcap -lcurses -lncurses; do + unset ac_cv_lib_readline_readline + AC_CHECK_LIB(readline, readline, [readline_libs_found=yes],[],[$termcap_lib]) + if test "x$readline_libs_found" = "xyes" ; then + READLINE_LIBS="$READLINE_LIBS -lreadline $termcap_lib" + break + fi + done + LIBS=$LIBS_save CPPFLAGS=$CPPFLAGS_save if test "$readline_libs_found$readline_h_found" != "yesyes" ; then AC_MSG_WARN([Could not find libreadline headers or library, linphonec will have limited prompt features]) else - READLINE_LIBS="$READLINE_LIBS -lreadline " + AC_DEFINE([HAVE_READLINE],1,[defined when compiling with readline support]) fi From ca80f9d9140d950891c8fb0e7ac31981186617f5 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 15 Oct 2012 17:13:11 +0200 Subject: [PATCH 651/769] Add pbuf nullity checks --- gtk/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gtk/main.c b/gtk/main.c index 193803256..b773a5b7f 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -279,8 +279,10 @@ static void linphone_gtk_configure_window(GtkWidget *w, const char *window_name) linphone_gtk_visibility_set(shown,window_name,w,TRUE); if (icon_path) { GdkPixbuf *pbuf=create_pixbuf(icon_path); - gtk_window_set_icon(GTK_WINDOW(w),pbuf); - g_object_unref(G_OBJECT(pbuf)); + if(pbuf != NULL) { + gtk_window_set_icon(GTK_WINDOW(w),pbuf); + g_object_unref(G_OBJECT(pbuf)); + } } } @@ -1526,8 +1528,10 @@ static void linphone_gtk_configure_main_window(){ } if (search_icon){ GdkPixbuf *pbuf=create_pixbuf(search_icon); - gtk_image_set_from_pixbuf(GTK_IMAGE(linphone_gtk_get_widget(w,"directory_search_button_icon")),pbuf); - g_object_unref(G_OBJECT(pbuf)); + if(pbuf != NULL) { + gtk_image_set_from_pixbuf(GTK_IMAGE(linphone_gtk_get_widget(w,"directory_search_button_icon")),pbuf); + g_object_unref(G_OBJECT(pbuf)); + } } if (home){ gchar *tmp; From 2448f16d92d0cb768eda7d0da98cd249ef411009 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 15 Oct 2012 23:40:51 +0200 Subject: [PATCH 652/769] add linphonerc option to put dates in REGISTER messages --- coreapi/linphonecore.c | 1 + coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 28 +++++++++++++++++++++++++++- coreapi/sal_eXosip2.h | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index db7a8ea7c..6ae5563ae 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -620,6 +620,7 @@ static void sip_config_read(LinphoneCore *lc) sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0)); sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1)); sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc)); + sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0)); } static void rtp_config_read(LinphoneCore *lc) diff --git a/coreapi/sal.h b/coreapi/sal.h index 1bce846c6..2913096ca 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -340,6 +340,7 @@ unsigned int sal_get_keepalive_period(Sal *ctx); void sal_use_session_timers(Sal *ctx, int expires); void sal_use_double_registrations(Sal *ctx, bool_t enabled); void sal_expire_old_registration_contacts(Sal *ctx, bool_t enabled); +void sal_use_dates(Sal *ctx, bool_t enabled); void sal_reuse_authorization(Sal *ctx, bool_t enabled); void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec); void sal_use_rport(Sal *ctx, bool_t use_rports); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 4b5c20539..1b5f5a2b7 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -283,6 +283,7 @@ Sal * sal_init(){ sal->rootCa = 0; sal->verify_server_certs=TRUE; sal->expire_old_contact=FALSE; + sal->add_dates=FALSE; sal->dscp=-1; return sal; } @@ -460,6 +461,10 @@ void sal_expire_old_registration_contacts(Sal *ctx, bool_t enabled){ ctx->expire_old_contact=enabled; } +void sal_use_dates(Sal *ctx, bool_t enabled){ + ctx->add_dates=enabled; +} + void sal_use_rport(Sal *ctx, bool_t use_rports){ ctx->use_rports=use_rports; } @@ -2215,6 +2220,25 @@ static void sal_register_add_route(osip_message_t *msg, const char *proxy){ osip_message_set_route(msg,tmp); } +static const char *days[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; +static const char *months[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; + +static void sal_register_set_date(osip_message_t *msg){ + char tmp[256]={0}; + time_t curtime=time(NULL); + struct tm *ret; +#ifndef WIN32 + struct tm gmt; + ret=gmtime_r(&curtime,&gmt); +#else + ret=gmtime(&curtime); +#endif + /*cannot use strftime because it is locale dependant*/ + snprintf(tmp,sizeof(tmp)-1,"%s, %i %s %i %02i:%02i:%02i GMT", + days[ret->tm_wday],ret->tm_mday,months[ret->tm_mon],1900+ret->tm_year,ret->tm_hour,ret->tm_min,ret->tm_sec); + osip_message_replace_header(msg,"Date",tmp); +} + 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); @@ -2255,8 +2279,10 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){ eXosip_register_build_register(h->rid,expires,&msg); sal_register_add_route(msg,proxy); } - if (msg) + if (msg){ + if (h->base.root->add_dates) sal_register_set_date(msg); eXosip_register_send_register(h->rid,msg); + } eXosip_unlock(); h->expires=expires; return (msg != NULL) ? 0 : -1; diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index 71463854c..29eee78ae 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -49,6 +49,7 @@ struct Sal{ bool_t reuse_authorization; bool_t verify_server_certs; bool_t expire_old_contact; + bool_t add_dates; }; struct SalOp{ From 36be073987bf502cdd867e7fc8f798e180acb6e0 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 15 Oct 2012 23:46:42 +0200 Subject: [PATCH 653/769] add linphonerc setting to disable sending of text chats through existing call dialogs if any. --- coreapi/chat.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 941cce423..31f360135 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -22,8 +22,9 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "linphonecore.h" - #include "private.h" +#include "linphonecore.h" +#include "private.h" +#include "lpconfig.h" LinphoneChatRoom * linphone_core_create_chat_room(LinphoneCore *lc, const char *to){ LinphoneAddress *parsed_url=NULL; @@ -56,15 +57,18 @@ static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatM SalOp *op=NULL; LinphoneCall *call; char* content_type; - if((call = linphone_core_get_call_by_remote_address(cr->lc,cr->peer))!=NULL){ - if (call->state==LinphoneCallConnected || - call->state==LinphoneCallStreamsRunning || - call->state==LinphoneCallPaused || - call->state==LinphoneCallPausing || - call->state==LinphoneCallPausedByRemote){ - ms_message("send SIP message through the existing call."); - op = call->op; - call->pending_message=msg; + + if (lp_config_get_int(cr->lc->config,"sip","chat_use_call_dialogs",1)){ + if((call = linphone_core_get_call_by_remote_address(cr->lc,cr->peer))!=NULL){ + if (call->state==LinphoneCallConnected || + call->state==LinphoneCallStreamsRunning || + call->state==LinphoneCallPaused || + call->state==LinphoneCallPausing || + call->state==LinphoneCallPausedByRemote){ + ms_message("send SIP message through the existing call."); + op = call->op; + call->pending_message=msg; + } } } if (op==NULL){ From 85535d345646cf60f75549bf4d5fcd0490504393 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 16 Oct 2012 14:22:40 +0200 Subject: [PATCH 654/769] move dates header addon to exosip --- coreapi/sal_eXosip2.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 1b5f5a2b7..b5f6cc10f 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -463,6 +463,14 @@ void sal_expire_old_registration_contacts(Sal *ctx, bool_t enabled){ void sal_use_dates(Sal *ctx, bool_t enabled){ ctx->add_dates=enabled; +#ifdef EXOSIP_OPT_REGISTER_WITH_DATE + { + int tmp=enabled; + eXosip_set_option(EXOSIP_OPT_REGISTER_WITH_DATE,&tmp); + } +#else + if (enabled) ms_warning("Exosip does not support EXOSIP_OPT_REGISTER_WITH_DATE option."); +#endif } void sal_use_rport(Sal *ctx, bool_t use_rports){ @@ -2220,24 +2228,6 @@ static void sal_register_add_route(osip_message_t *msg, const char *proxy){ osip_message_set_route(msg,tmp); } -static const char *days[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; -static const char *months[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; - -static void sal_register_set_date(osip_message_t *msg){ - char tmp[256]={0}; - time_t curtime=time(NULL); - struct tm *ret; -#ifndef WIN32 - struct tm gmt; - ret=gmtime_r(&curtime,&gmt); -#else - ret=gmtime(&curtime); -#endif - /*cannot use strftime because it is locale dependant*/ - snprintf(tmp,sizeof(tmp)-1,"%s, %i %s %i %02i:%02i:%02i GMT", - days[ret->tm_wday],ret->tm_mday,months[ret->tm_mon],1900+ret->tm_year,ret->tm_hour,ret->tm_min,ret->tm_sec); - osip_message_replace_header(msg,"Date",tmp); -} int sal_register(SalOp *h, const char *proxy, const char *from, int expires){ osip_message_t *msg; @@ -2280,7 +2270,6 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){ sal_register_add_route(msg,proxy); } if (msg){ - if (h->base.root->add_dates) sal_register_set_date(msg); eXosip_register_send_register(h->rid,msg); } eXosip_unlock(); From 1442b46eeaa2e9b1029c937e71f5ae3970bdfe34 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 12 Oct 2012 12:12:56 +0200 Subject: [PATCH 655/769] Add done no echo state for the echo canceller. --- coreapi/ec-calibrator.c | 30 ++++++++++++------- coreapi/linphonecore_utils.h | 7 +++-- .../org/linphone/core/LinphoneCore.java | 13 +++++--- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index ab3bc80ac..7fb001d3d 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -114,7 +114,6 @@ static void ecc_play_tones(EcCalibrator *ecc){ MSDtmfGenCustomTone tone; MSToneDetectorDef expected_tone; - ms_filter_set_notify_callback(ecc->det,on_tone_received,ecc); expected_tone.frequency=2000; @@ -142,20 +141,29 @@ static void ecc_play_tones(EcCalibrator *ecc){ ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_sleep(1); - if (ecc->sent_count==3 && ecc->recv_count==3){ - int delay=ecc->acc/3; - if (delay<0){ - ms_error("Quite surprising calibration result, delay=%i",delay); - ecc->status=LinphoneEcCalibratorFailed; - }else{ms_message("Echo calibration estimated delay to be %i ms",delay); - ecc->delay=delay; - ecc->status=LinphoneEcCalibratorDone; + if (ecc->sent_count==3) { + if (ecc->recv_count==3){ + int delay=ecc->acc/3; + if (delay<0){ + ms_error("Quite surprising calibration result, delay=%i",delay); + ecc->status=LinphoneEcCalibratorFailed; + }else{ + ms_message("Echo calibration estimated delay to be %i ms",delay); + ecc->delay=delay; + ecc->status=LinphoneEcCalibratorDone; + } + } else if (ecc->recv_count == 0) { + ms_message("Echo calibration succeeded, no echo has been detected"); + ecc->status = LinphoneEcCalibratorDoneNoEcho; + } else { + ecc->status = LinphoneEcCalibratorFailed; } }else{ - ms_error("Echo calibration failed, tones received = %i",ecc->recv_count); ecc->status=LinphoneEcCalibratorFailed; } - + if (ecc->status == LinphoneEcCalibratorFailed) { + ms_error("Echo calibration failed, tones received = %i",ecc->recv_count); + } } static void * ecc_thread(void *p){ diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index 964385683..fadfc1a36 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -56,9 +56,10 @@ void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj); * Enum describing the result of the echo canceller calibration process. **/ typedef enum { - LinphoneEcCalibratorInProgress, - LinphoneEcCalibratorDone, - LinphoneEcCalibratorFailed + LinphoneEcCalibratorInProgress, /**< The echo canceller calibration process is on going. */ + LinphoneEcCalibratorDone, /**< The echo canceller calibration has been performed and produced an echo delay measure. */ + LinphoneEcCalibratorFailed, /**< The echo canceller calibration process has failed. */ + LinphoneEcCalibratorDoneNoEcho /**< The echo canceller calibration has been performed and no echo has been detected. */ }LinphoneEcCalibratorStatus; diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index f2ad09b90..de1b4743c 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -234,18 +234,23 @@ public interface LinphoneCore { public static final int IN_PROGRESS_STATUS=0; public static final int DONE_STATUS=1; public static final int FAILED_STATUS=2; + public static final int DONE_NO_ECHO_STATUS=3; /** * Calibration in progress */ - static public EcCalibratorStatus InProgress = new EcCalibratorStatus(IN_PROGRESS_STATUS,"InProgress"); + static public EcCalibratorStatus InProgress = new EcCalibratorStatus(IN_PROGRESS_STATUS,"InProgress"); /** - * Calibration done + * Calibration done that produced an echo delay measure */ - static public EcCalibratorStatus Done = new EcCalibratorStatus(DONE_STATUS,"Done"); + static public EcCalibratorStatus Done = new EcCalibratorStatus(DONE_STATUS,"Done"); /** - * Calibration in progress + * Calibration failed */ static public EcCalibratorStatus Failed = new EcCalibratorStatus(FAILED_STATUS,"Failed"); + /** + * Calibration done with no echo detected + */ + static public EcCalibratorStatus DoneNoEcho = new EcCalibratorStatus(DONE_NO_ECHO_STATUS, "DoneNoEcho"); private final int mValue; private final String mStringValue; From 539f3396b2da95db8c5a24a11e6ac4dfc7bc8f90 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 15 Oct 2012 15:59:38 +0200 Subject: [PATCH 656/769] Define common macros to get default configuration values. --- coreapi/lpconfig.h | 14 ++++++++++++++ coreapi/proxy.c | 17 ++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index b672e4cbf..8f3cae0a1 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -49,6 +49,20 @@ typedef struct _LpConfig LpConfig; extern "C" { #endif + +#define LP_CONFIG_DEFAULT_STRING(config, name, default) \ + (config) ? (lp_config_get_string(config, "default_values", name, default)) : (default) + +#define LP_CONFIG_DEFAULT_INT(config, name, default) \ + (config) ? (lp_config_get_int(config, "default_values", name, default)) : (default) + +#define LP_CONFIG_DEFAULT_INT64(config, name, default) \ + (config) ? (lp_config_get_int64(config, "default_values", name, default)) : (default) + +#define LP_CONFIG_DEFAULT_FLOAT(config, name, default) \ + (config) ? (lp_config_get_float(config, "default_values", name, default)) : (default) + + LpConfig * lp_config_new(const char *filename); int lp_config_read_file(LpConfig *lpconfig, const char *filename); /** diff --git a/coreapi/proxy.c b/coreapi/proxy.c index ba9c0d752..718f7b0f5 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -41,17 +41,12 @@ void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){ lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL)); } -#define DEFAULT_INT(config,name,default) \ - config?lp_config_get_int(config,"default_values",#name,default):default -#define DEFAULT_STRING(config,name,default) \ - config?lp_config_get_string(config,"default_values",#name,default):default - static void linphone_proxy_config_init(LinphoneCore* lc,LinphoneProxyConfig *obj){ memset(obj,0,sizeof(LinphoneProxyConfig)); obj->magic=linphone_proxy_config_magic; - obj->expires=DEFAULT_INT((lc?lc->config:NULL),reg_expires,3600); - obj->dial_prefix=ms_strdup(DEFAULT_STRING((lc?lc->config:NULL),dial_prefix,'\0')); - obj->dial_escape_plus=DEFAULT_INT((lc?lc->config:NULL),dial_escape_plus,0); + obj->expires=LP_CONFIG_DEFAULT_INT((lc?lc->config:NULL),"reg_expires",3600); + obj->dial_prefix=ms_strdup(LP_CONFIG_DEFAULT_STRING((lc?lc->config:NULL),"dial_prefix",'\0')); + obj->dial_escape_plus=LP_CONFIG_DEFAULT_INT((lc?lc->config:NULL),"dial_escape_plus",0); } /** @@ -779,13 +774,13 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config linphone_proxy_config_set_contact_parameters(cfg,lp_config_get_string(config,key,"contact_parameters",NULL)); - linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",DEFAULT_INT(config,reg_expires,600))); + linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",LP_CONFIG_DEFAULT_INT(config,"reg_expires",600))); linphone_proxy_config_enableregister(cfg,lp_config_get_int(config,key,"reg_sendregister",0)); linphone_proxy_config_enable_publish(cfg,lp_config_get_int(config,key,"publish",0)); - linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",DEFAULT_INT(config,dial_escape_plus,0))); - linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",DEFAULT_STRING(config,dial_prefix,NULL))); + linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",LP_CONFIG_DEFAULT_INT(config,"dial_escape_plus",0))); + linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",LP_CONFIG_DEFAULT_STRING(config,"dial_prefix",NULL))); tmp=lp_config_get_string(config,key,"type",NULL); if (tmp!=NULL && strlen(tmp)>0) From 40c1c95eeb8fd0f2cf5e80e071043195f3aa4e93 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 15 Oct 2012 16:00:17 +0200 Subject: [PATCH 657/769] Set a default echo canceller delay if echo canceller calibration fails. --- coreapi/linphonecore.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6ae5563ae..7159edd6f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1935,6 +1935,10 @@ void linphone_core_iterate(LinphoneCore *lc){ if (ecs==LinphoneEcCalibratorDone){ int len=lp_config_get_int(lc->config,"sound","ec_tail_len",0); lp_config_set_int(lc->config, "sound", "ec_delay",MAX(lc->ecc->delay-(len/2),0)); + } else if (ecs == LinphoneEcCalibratorFailed) { + lp_config_set_int(lc->config, "sound", "ec_delay", LP_CONFIG_DEFAULT_INT(lc->config, "ec_delay", 250)); + } else if (ecs == LinphoneEcCalibratorDoneNoEcho) { + linphone_core_enable_echo_cancellation(lc, FALSE); } ec_calibrator_destroy(lc->ecc); lc->ecc=NULL; From 8631bb29cb35247f8690caccb6c31445ff6f9df2 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 16 Oct 2012 15:01:48 +0200 Subject: [PATCH 658/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 95ef77fe1..f321d7c76 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 95ef77fe123c23a71e3fe1cb8932efaf048f399c +Subproject commit f321d7c760d65048bebb5dae7f997285c257328b From aa49870d7117df201ea56838f34fe651b458d0ee Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 16 Oct 2012 14:59:32 +0200 Subject: [PATCH 659/769] remove op from chatroom --- coreapi/callbacks.c | 10 ++++++++++ coreapi/chat.c | 7 ------- coreapi/private.h | 1 - 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 7c7d4f003..e7f6a7b21 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -804,14 +804,24 @@ static LinphoneChatMessageState chatStatusSal2Linphone(SalTextDeliveryStatus sta return LinphoneChatMessageStateIdle; } +static int op_equals(LinphoneCall *a, SalOp *b) { + return a->op !=b; /*return 0 if equals*/ +} static void text_delivery_update(SalOp *op, SalTextDeliveryStatus status){ LinphoneChatMessage *chat_msg=(LinphoneChatMessage* )sal_op_get_user_pointer(op); + const MSList* calls = linphone_core_get_calls(chat_msg->chat_room->lc); + if (chat_msg && chat_msg->cb) { chat_msg->cb(chat_msg ,chatStatusSal2Linphone(status) ,chat_msg->cb_ud); } linphone_chat_message_destroy(chat_msg); + + if (!ms_list_find_custom((MSList*)calls, (MSCompareFunc) op_equals, op)) { + /*op was only create for messaging purpose, destroying*/ + sal_op_release(op); + } } SalCallbacks linphone_sal_callbacks={ diff --git a/coreapi/chat.c b/coreapi/chat.c index 31f360135..ea87c9740 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -46,8 +46,6 @@ lc->chatrooms=ms_list_remove(lc->chatrooms,(void *) cr); linphone_address_destroy(cr->peer_url); ms_free(cr->peer); - if (cr->op) - sal_op_release(cr->op); } @@ -75,11 +73,6 @@ static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatM /*sending out of calls*/ op = sal_op_new(cr->lc->sal); sal_op_set_route(op,route); - if (cr->op!=NULL){ - sal_op_release (cr->op); - cr->op=NULL; - } - cr->op=op; sal_op_set_user_pointer(op, msg); /*if out of call, directly store msg*/ } if (msg->external_body_url) { diff --git a/coreapi/private.h b/coreapi/private.h index b44fe4a97..07fd1c689 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -354,7 +354,6 @@ struct _LinphoneChatRoom{ struct _LinphoneCore *lc; char *peer; LinphoneAddress *peer_url; - SalOp *op; void * user_data; }; From 314a5559581b945d22fda5776669e0038c270f79 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 16 Oct 2012 16:22:16 +0200 Subject: [PATCH 660/769] Update echo canceller part of documentation. --- java/common/org/linphone/core/package.html | 38 ++++++++++++++-------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/java/common/org/linphone/core/package.html b/java/common/org/linphone/core/package.html index 8371def49..a3f08b288 100644 --- a/java/common/org/linphone/core/package.html +++ b/java/common/org/linphone/core/package.html @@ -220,25 +220,37 @@ mic_gain=0.1 Echo cancellation
-On Android devices, echo is a problem, especially with low-end devices. The root cause is the unpredictable latency of Android's sound system. The liblinphone software {@link org.linphone.core.LinphoneCore#enableEchoCancellation echo canceller} that is operating well on desktop platforms (Mac, Linux, Windows) is unable to operate under Android platform. The situation is very heterogenous:
+On Android devices, there are two types of devices regarding echo cancellation:
    -
  • On new (after 2011) high end devices, manufacturers often include a hardware echo cancellation. If available, liblinphone will make use of it and no software correction is required. - Source file linphone-android/submodules/linphone/mediastreamer2/java/src/org/linphone/mediastream/video/capture/hwconf/Hacks.java contains a method hasBuiltInEchoCanceller() that returns true if an hardware echo canceller is available, based on device model identifier. The current list is incomplete. -
  • -
  • On former models with decent CPU power (armv7), sound system behaves in a nearly predictive way so that it is possible to use {@link org.linphone.core.LinphoneCore#enableEchoLimiter echo limiter}. Echo limiter is a simple echo attenuation technique which consists in strongly attenuating the microphone input when speaker is playing voice, in order to cut the echo. The main drawback of echo limiter is that the conversation is perceived as half duplex by users, because they won't hear background noise from the remote side while they are speaking. -
  • -
  • On low class android devices or very old models (armv5 processor), no solution works. -
  • +
  • The new (after 2011) high end devices, on which manufacturers often include a hardware echo cancellation. If available, liblinphone will make use of it and no software correction is required. Source file linphone-android/submodules/linphone/mediastreamer2/java/src/org/linphone/mediastream/video/capture/hwconf/Hacks.java contains a method hasBuiltInEchoCanceller() that returns true if an hardware echo canceller is available, based on device model identifier. The current list is incomplete.
  • +
  • The other devices, on which it is recommended to enable the software echo canceller of liblinphone.

In order to benefit from the best echo cancellation solution, we recommend applications to run the following algorithm, when it is run for the first time:
-First of {@link org.linphone.core.LinphoneCore#enableEchoCancellation echo canceller} should not be used, in any case.
    -
  • Use the Hacks.hasBuiltInEchoCanceller() method to first check if the device has hardware echo canceller. If yes, then echo limiter must be turned off.
  • -
  • If no the hasBuiltInEchoCanceller() returned false, then it is possible to use the echo calibration procedure. If the calibration procedure fails, it means that - probably the phone performs hardware echo cancellation, so in this case echo limiter must be turned off.
  • -
  • If the echo calibration succeeded, then echo is present, so it is recommended to enable echo limiter. +
  • Use the Hacks.hasBuiltInEchoCanceller() method to first check if the device has hardware echo cancellation. If yes, then echo canceller must be turned off.
  • +
  • If no the hasBuiltInEchoCanceller() returned false, then it is possible to use the echo calibration procedure. This procedure can produce the following results: +
      +
    • success with no echo detected: it means that the device has an hardware echo canceller but is not (yet) referenced in our list of devices having hardware echo cancellation.
    • +
    • success with an estimated echo delay: the echo canceller should be enabled and configured with the delay found by the calibration.
    • +
    • failure: it means that some echo has been detected but the delay could not be estimated. In this case it is recommended to activate the echo canceller anyway with a default value for the delay of 250 ms.
    • +
    +
  • +
+In any case, the echo limiter should be disabled while using the earpiece, but enabled while using the speaker. It is also recommended to disable echo canceller while using the speaker. Therefore you should have the following situation: +
    +
  • While using the earpiece
  • +
      +
    • Echo canceller enabled (or disabled for devices that have hardware echo cancellation)
    • +
    • Echo limiter disabled
    • +
    +
  • While using the speaker
  • +
      +
    • Echo canceller disabled
    • +
    • Echo limiter enabled
    • +
    +

From aea4b642524ea42306f791c0202bfbbfd5ad5b97 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 16 Oct 2012 17:13:43 +0200 Subject: [PATCH 661/769] update android documentation --- java/common/org/linphone/core/package.html | 58 +++++++++++++--------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/java/common/org/linphone/core/package.html b/java/common/org/linphone/core/package.html index a3f08b288..3cb6670be 100644 --- a/java/common/org/linphone/core/package.html +++ b/java/common/org/linphone/core/package.html @@ -159,12 +159,7 @@ Any subsequente modifications to {@link org.linphone.core.LinphoneFriend} must b my_friend.enableSubscribes(true); /*disable subscription for this friend*/ my_friend.done(); /*commit changes triggering an UNSUBSCRIBE message*/ - Do not display status messages --J Pass directly to the runtime system - -Provided by Standard doclet: --d Destination directory for output files --use + Publishing presence status
Local presence status can be changed using function {@link org.linphone.core.LinphoneCore#setPresenceInfo }.New status is propagated to all friends {@link org.linphone.core.LinphoneCore#addFriend(LinphoneFriend lf) previously added } to LinphoneCore. @@ -220,48 +215,65 @@ mic_gain=0.1 Echo cancellation
-On Android devices, there are two types of devices regarding echo cancellation:
+On Android devices, there are two kind of situations regarding echo cancellation:
  • The new (after 2011) high end devices, on which manufacturers often include a hardware echo cancellation. If available, liblinphone will make use of it and no software correction is required. Source file linphone-android/submodules/linphone/mediastreamer2/java/src/org/linphone/mediastream/video/capture/hwconf/Hacks.java contains a method hasBuiltInEchoCanceller() that returns true if an hardware echo canceller is available, based on device model identifier. The current list is incomplete.
  • -
  • The other devices, on which it is recommended to enable the software echo canceller of liblinphone.
  • +
  • The other devices, for which it is recommended to enable the software echo canceller of liblinphone.

-In order to benefit from the best echo cancellation solution, we recommend applications to run the following algorithm, when it is run for the first time:
+Echo calibration tool +
+The echo calibration procedure is a five second audio test which consists in playing small beeps to the speaker while the microphone input is recorded. +If the device is subject to echo (or doesn't have hardware echo cancellation), then beeps recorded by the microphone will be detected and a measurement of echo delay can be computed. +Echo calibration procedure can be started by calling {@link org.linphone.core.LinphoneCore#startEchoCalibration LinphoneCore.startEchoCalibration}. +The measurement of the echo delay is important to save CPU computations by restricting the temporal area where the software echo canceller has to perform. +
+ +
+Echo limiter +
+The echo limiter is a liblinphone algorithm to clear out echo with a brute force method. It consists in cutting down the microphone signal when active signal is played by the speaker, to prevent voice to feed back into the microphone. This algorithm has disadvantages compared to the hardware or software echo cancellers because the remote user will be not hear any background noise when speaking, which is confusing. As a result the echo limiter method shall be used only under situation where echo canceller can't perform, that is loud signals with heavy saturations, which usually happens when using the device in speaker mode. Echo limiter can be enabled or disabled during a call with {@link org.linphone.core.LinphoneCall#enableEchoLimiter LinphoneCall.enableEchoLimiter()}. +
+ +
+Recommandations to applications for optimal audio performance +
+ +
+In order to benefit from the best echo cancellation solution, we recommend applications to run the following procedure, when they are run for the first time:
  • Use the Hacks.hasBuiltInEchoCanceller() method to first check if the device has hardware echo cancellation. If yes, then echo canceller must be turned off.
  • -
  • If no the hasBuiltInEchoCanceller() returned false, then it is possible to use the echo calibration procedure. This procedure can produce the following results: +
  • If hasBuiltInEchoCanceller() returned false, then it is recommended to run the echo calibration procedure. This procedure can produce the following results:
      -
    • success with no echo detected: it means that the device has an hardware echo canceller but is not (yet) referenced in our list of devices having hardware echo cancellation.
    • -
    • success with an estimated echo delay: the echo canceller should be enabled and configured with the delay found by the calibration.
    • -
    • failure: it means that some echo has been detected but the delay could not be estimated. In this case it is recommended to activate the echo canceller anyway with a default value for the delay of 250 ms.
    • +
    • success with no echo detected: it means that the device has an hardware echo canceller but is not (yet) referenced in our list of devices having hardware echo cancellation. Echo cancellation should be disabled with {@link org.linphone.core.LinphoneCore#enableEchoCancellation LinphoneCore.enableEchoCancellation(false)}
    • +
    • success with an estimated echo delay: the echo canceller should be enabled.
    • +
    • failure: it means that some echo has been detected but the delay could not be estimated. In this case it is recommended to activate the echo canceller. A typical for android minimum delay of 250 ms will be used as default.
-In any case, the echo limiter should be disabled while using the earpiece, but enabled while using the speaker. It is also recommended to disable echo canceller while using the speaker. Therefore you should have the following situation: + +During calls, the echo limiter should be disabled while using the earpiece, but enabled while using the speaker. It is also recommended to disable echo canceller while using the echo limiter, because the first one would be useless. Therefore you should have the following situations:
  • While using the earpiece
    • -
    • Echo canceller enabled (or disabled for devices that have hardware echo cancellation)
    • +
    • Echo canceller enabled, unless the device has hardware echo cancellation
    • Echo limiter disabled
  • While using the speaker
    • Echo canceller disabled
    • -
    • Echo limiter enabled
    • +
    • Echo limiter enabled, unless the device has hardware echo cancellation.
+Controlling echo limiter during a call has to be done with {@link org.linphone.core.LinphoneCall#enableEchoLimiter LinphoneCall.enableEchoLimiter()}. +Controlling echo canceller during a call has to be done with {@link org.linphone.core.LinphoneCall#enableEchoCancellation LinphoneCall.enableEchoCancellation()}. -
-Echo calibration procedure -
-The echo calibration procedure is a five second test which consists in playing small beeps to the speaker while the microphone input is recorded. -If the device is subject to echo (or doesn't have hardware echo cancellation), then beeps recorded by the microphone will be detected and a measurement of echo delay can be computed. -Echo calibration procedure can be started by calling {@link org.linphone.core.LinphoneCore#startEchoCalibration LinphoneCore.startEchoCalibration}.

-Echo limiter settings
+Echo limiter settings +
Echo limiter requires settings to be defined in linphonerc factory config file for correction operation. Typical settings are:

From b0729789bbf71fc82c243dafa8af253b30174af1 Mon Sep 17 00:00:00 2001
From: Simon Morlat 
Date: Tue, 16 Oct 2012 21:50:05 +0200
Subject: [PATCH 662/769] update ms2

---
 mediastreamer2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mediastreamer2 b/mediastreamer2
index f321d7c76..ac76a8396 160000
--- a/mediastreamer2
+++ b/mediastreamer2
@@ -1 +1 @@
-Subproject commit f321d7c760d65048bebb5dae7f997285c257328b
+Subproject commit ac76a839655828a9006777d08538df2e6622ae7e

From c6eaf5a2fe4f643fd416a77c529df8c288d12ff4 Mon Sep 17 00:00:00 2001
From: Ghislain MARY 
Date: Wed, 17 Oct 2012 09:57:32 +0200
Subject: [PATCH 663/769] Update ms2 submodule.

---
 mediastreamer2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mediastreamer2 b/mediastreamer2
index ac76a8396..23c75b195 160000
--- a/mediastreamer2
+++ b/mediastreamer2
@@ -1 +1 @@
-Subproject commit ac76a839655828a9006777d08538df2e6622ae7e
+Subproject commit 23c75b19523c172c97ba89c76cf7672fc804b14a

From e5d63effa20da11bb8c341d92f6446b6756fc1b8 Mon Sep 17 00:00:00 2001
From: Simon Morlat 
Date: Wed, 17 Oct 2012 14:35:34 +0200
Subject: [PATCH 664/769] document linphone_call_zoom_video and put it in the
 right place.

---
 coreapi/linphonecall.c | 35 +++++++++++++++++++++++++++++++++++
 coreapi/linphonecore.c | 23 -----------------------
 coreapi/linphonecore.h |  3 +--
 3 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c
index a930b1bed..32dc9d59c 100644
--- a/coreapi/linphonecall.c
+++ b/coreapi/linphonecall.c
@@ -2092,3 +2092,38 @@ void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState stat
 bool_t linphone_call_is_in_conference(const LinphoneCall *call) {
 	return call->params.in_conference;
 }
+
+
+/**
+ * Perform a zoom of the video displayed during a call.
+ * @param zoom_factor a floating point number describing the zoom factor. A value 1.0 corresponds to no zoom applied.
+ * @param cx a floating point number pointing the horizontal center of the zoom to be applied. This value should be between 0.0 and 1.0.
+ * @param cy a floating point number pointing the vertical center of the zoom to be applied. This value should be between 0.0 and 1.0.
+ * 
+ * cx and cy are updated in return in case their coordinates were to excentrated for the requested zoom factor. The zoom ensures that all the screen is fullfilled with the video.
+**/
+void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) {
+	VideoStream* vstream = call->videostream;
+	if (vstream) {
+		float zoom[3];
+		
+		if (zoom_factor < 1)
+			zoom_factor = 1;
+		float halfsize = 0.5 * 1.0 / zoom_factor;
+
+		if ((*cx - halfsize) < 0)
+			*cx = 0 + halfsize;
+		if ((*cx + halfsize) > 1)
+			*cx = 1 - halfsize;
+		if ((*cy - halfsize) < 0)
+			*cy = 0 + halfsize;
+		if ((*cy + halfsize) > 1)
+			*cy = 1 - halfsize;
+	
+		zoom[0] = zoom_factor;
+		zoom[1] = *cx;
+		zoom[2] = *cy;
+        	ms_filter_call_method(vstream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom);
+	}else ms_warning("Could not apply zoom: video output wasn't activated.");
+}
+
diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c
index 7159edd6f..d96a1905b 100644
--- a/coreapi/linphonecore.c
+++ b/coreapi/linphonecore.c
@@ -5181,30 +5181,7 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para
 	params->in_conference=FALSE;
 }
 
-void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) {
-	VideoStream* vstream = call->videostream;
-	if (vstream) {
-		float zoom[3];
-		
-		if (zoom_factor < 1)
-			zoom_factor = 1;
-		float halfsize = 0.5 * 1.0 / zoom_factor;
 
-		if ((*cx - halfsize) < 0)
-			*cx = 0 + halfsize;
-		if ((*cx + halfsize) > 1)
-			*cx = 1 - halfsize;
-		if ((*cy - halfsize) < 0)
-			*cy = 0 + halfsize;
-		if ((*cy + halfsize) > 1)
-			*cy = 1 - halfsize;
-	
-		zoom[0] = zoom_factor;
-		zoom[1] = *cx;
-		zoom[2] = *cy;
-        	ms_filter_call_method(vstream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom);
-	}else ms_warning("Could not apply zoom: video output wasn't activated.");
-}
 
 void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) {
 	if (lc->device_id) ms_free(lc->device_id);
diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h
index 1849c083b..ad52c559f 100644
--- a/coreapi/linphonecore.h
+++ b/coreapi/linphonecore.h
@@ -390,6 +390,7 @@ void *linphone_call_get_user_pointer(LinphoneCall *call);
 void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
 void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
 LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call);
+void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy);
 /**
  * Return TRUE if this call is currently part of a conference
  *@param call #LinphoneCall
@@ -1428,8 +1429,6 @@ typedef struct LinphoneTunnel LinphoneTunnel;
 */
 LinphoneTunnel *linphone_core_get_tunnel(LinphoneCore *lc);
 
-void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy);
-
 void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp);
 int linphone_core_get_sip_dscp(const LinphoneCore *lc);
 

From d79f3d3fa9e5da3fe13ae280cabe9f8a28b578fa Mon Sep 17 00:00:00 2001
From: Ghislain MARY 
Date: Wed, 17 Oct 2012 14:58:55 +0200
Subject: [PATCH 665/769] Add comment to warn about change of echo canceller
 calibration statuses.

---
 java/common/org/linphone/core/LinphoneCore.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java
index de1b4743c..562ae86cd 100644
--- a/java/common/org/linphone/core/LinphoneCore.java
+++ b/java/common/org/linphone/core/LinphoneCore.java
@@ -231,6 +231,8 @@ public interface LinphoneCore {
 	static public class EcCalibratorStatus {
 		
 		static private Vector values = new Vector();
+		/* Do not change the values of these constants or the strings associated with them to prevent breaking
+		   the collection of echo canceller calibration results during the wizard! */
 		public static final int IN_PROGRESS_STATUS=0;
 		public static final int DONE_STATUS=1;
 		public static final int FAILED_STATUS=2;

From d6a8aef9944b09b702e3449abf7fef23738529a4 Mon Sep 17 00:00:00 2001
From: Ghislain MARY 
Date: Thu, 18 Oct 2012 11:58:43 +0200
Subject: [PATCH 666/769] Fix terminology about speaker and receiver in the
 documentation.

---
 java/common/org/linphone/core/package.html | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/java/common/org/linphone/core/package.html b/java/common/org/linphone/core/package.html
index 3cb6670be..f4ba3711b 100644
--- a/java/common/org/linphone/core/package.html
+++ b/java/common/org/linphone/core/package.html
@@ -224,7 +224,7 @@ On Android devices, there are two kind of situations regarding echo cancellation
 
Echo calibration tool
-The echo calibration procedure is a five second audio test which consists in playing small beeps to the speaker while the microphone input is recorded. +The echo calibration procedure is a five second audio test which consists in playing small beeps to the receiver while the microphone input is recorded. If the device is subject to echo (or doesn't have hardware echo cancellation), then beeps recorded by the microphone will be detected and a measurement of echo delay can be computed. Echo calibration procedure can be started by calling {@link org.linphone.core.LinphoneCore#startEchoCalibration LinphoneCore.startEchoCalibration}. The measurement of the echo delay is important to save CPU computations by restricting the temporal area where the software echo canceller has to perform. @@ -233,7 +233,7 @@ The measurement of the echo delay is important to save CPU computations by restr
Echo limiter
-The echo limiter is a liblinphone algorithm to clear out echo with a brute force method. It consists in cutting down the microphone signal when active signal is played by the speaker, to prevent voice to feed back into the microphone. This algorithm has disadvantages compared to the hardware or software echo cancellers because the remote user will be not hear any background noise when speaking, which is confusing. As a result the echo limiter method shall be used only under situation where echo canceller can't perform, that is loud signals with heavy saturations, which usually happens when using the device in speaker mode. Echo limiter can be enabled or disabled during a call with {@link org.linphone.core.LinphoneCall#enableEchoLimiter LinphoneCall.enableEchoLimiter()}. +The echo limiter is a liblinphone algorithm to clear out echo with a brute force method. It consists in cutting down the microphone signal when active signal is played by the speaker/receiver, to prevent voice to feed back into the microphone. This algorithm has disadvantages compared to the hardware or software echo cancellers because the remote user will be not hear any background noise when speaking, which is confusing. As a result the echo limiter method shall be used only under situation where echo canceller can't perform, that is loud signals with heavy saturations, which usually happens when using the device in speaker mode. Echo limiter can be enabled or disabled during a call with {@link org.linphone.core.LinphoneCall#enableEchoLimiter LinphoneCall.enableEchoLimiter()}.

@@ -253,14 +253,14 @@ In order to benefit from the best echo cancellation solution, we recommend appli -During calls, the echo limiter should be disabled while using the earpiece, but enabled while using the speaker. It is also recommended to disable echo canceller while using the echo limiter, because the first one would be useless. Therefore you should have the following situations: +During calls, the echo limiter should be disabled while using the receiver, but enabled while using the hands-free speaker. It is also recommended to disable echo canceller while using the echo limiter, because the first one would be useless. Therefore you should have the following situations:
    -
  • While using the earpiece
  • +
  • While using the receiver
    • Echo canceller enabled, unless the device has hardware echo cancellation
    • Echo limiter disabled
    -
  • While using the speaker
  • +
  • While using the hands-free speaker
    • Echo canceller disabled
    • Echo limiter enabled, unless the device has hardware echo cancellation.
    • From 5ab96647bc209832a4e4997c4aa89ca1149516a4 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 18 Oct 2012 17:10:03 +0200 Subject: [PATCH 667/769] Allow configuration of port range for media ports. --- gtk/parameters.ui | 256 ++++++++++++++++++++++++++++++++-------------- gtk/propertybox.c | 124 ++++++++++++++++++++-- 2 files changed, 294 insertions(+), 86 deletions(-) diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 7e76c385f..d6d2e4927 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -48,7 +48,22 @@ 1 9.9999999995529656
- + + 65535 + 2 + 10 + + + 65535 + 2 + 10 + + + 65535 + 2 + 10 + + 65535 2 10 @@ -59,11 +74,6 @@ 1 10 - - 65535 - 2 - 10 - @@ -207,10 +217,10 @@ Set Maximum Transmission Unit: + False True True False - False True @@ -247,10 +257,10 @@ Send DTMFs as SIP info + False True True False - False True @@ -263,11 +273,11 @@ Use IPv6 instead of IPv4 + False True True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True @@ -384,9 +394,9 @@ gtk-edit + False True True - False True @@ -423,46 +433,6 @@ 2 - - - True - True - • - False - False - True - True - adjustment_audio_port - True - - - - 1 - 2 - 1 - 2 - - - - - True - True - • - False - False - True - True - adjustment_video_port - True - - - - 1 - 2 - 2 - 3 - - True @@ -477,10 +447,10 @@ gtk-edit + False True True True - False True @@ -491,6 +461,140 @@ 5 + + + True + False + + + True + True + • + False + False + True + True + adjustment_min_audio_port + True + + + + True + True + 0 + + + + + True + True + • + True + False + False + True + True + adjustment_max_audio_port + True + + + + True + True + 1 + + + + + Fixed + False + True + True + False + True + + + + True + True + 2 + + + + + 1 + 2 + 1 + 2 + + + + + True + False + + + True + True + • + False + False + True + True + adjustment_min_video_port + True + + + + True + True + 0 + + + + + True + True + • + True + False + False + True + True + adjustment_max_video_port + True + + + + True + True + 1 + + + + + Fixed + False + True + True + False + True + + + + True + True + 2 + + + + + 1 + 2 + 2 + 3 + + @@ -525,10 +629,10 @@ Direct connection to the Internet + False True True False - False True True @@ -546,10 +650,10 @@ Behind NAT / Firewall (specify gateway IP below) + False True True False - False True True no_nat @@ -614,10 +718,10 @@ Behind NAT / Firewall (use STUN to resolve) + False True True False - False True no_nat @@ -631,10 +735,10 @@ Behind NAT / Firewall (use ICE) + False True True False - False True no_nat @@ -772,6 +876,9 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 6 2 + + + True @@ -793,11 +900,11 @@ gtk-media-play + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True @@ -970,10 +1077,10 @@ Enable echo cancellation + False True True False - False True @@ -984,9 +1091,6 @@ 6 - - - @@ -1322,10 +1426,10 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True True True - False @@ -1369,11 +1473,11 @@ + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1417,11 +1521,11 @@ + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1465,11 +1569,11 @@ + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1513,9 +1617,9 @@ + False True True - False @@ -1602,11 +1706,11 @@ virtual network ! GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1788,11 +1892,11 @@ virtual network ! gtk-go-up + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True @@ -1805,11 +1909,11 @@ virtual network ! gtk-go-down + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True @@ -1821,11 +1925,11 @@ virtual network ! + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1869,11 +1973,11 @@ virtual network ! + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False @@ -1988,7 +2092,7 @@ virtual network ! 1 2 GTK_FILL - + @@ -2036,10 +2140,10 @@ virtual network ! Enable adaptive rate control + False True True False - False 0 True @@ -2050,7 +2154,7 @@ virtual network ! 2 3 GTK_FILL - + @@ -2065,7 +2169,7 @@ virtual network ! 2 3 GTK_FILL - + @@ -2191,10 +2295,10 @@ virtual network ! Show advanced settings + False True True False - False True @@ -2271,11 +2375,11 @@ virtual network ! end + False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 31c76f93b..03092a0a5 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -146,14 +146,74 @@ void linphone_gtk_ipv6_toggled(GtkWidget *w){ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); } -void linphone_gtk_audio_port_changed(GtkWidget *w){ - linphone_core_set_audio_port(linphone_gtk_get_core(), - (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w))); +void linphone_gtk_min_audio_port_changed(GtkWidget *w){ + GtkWidget *mw = linphone_gtk_get_main_window(); + GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); + GtkSpinButton *min_button = GTK_SPIN_BUTTON(w); + GtkSpinButton *max_button = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_max_rtp_port")); + gboolean fixed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_audio_port"))); + + if (fixed) { + linphone_core_set_audio_port(linphone_gtk_get_core(), (gint) gtk_spin_button_get_value(min_button)); + gtk_spin_button_set_value(max_button, gtk_spin_button_get_value(min_button)); + } else { + gint min_port = gtk_spin_button_get_value(min_button); + gint max_port = gtk_spin_button_get_value(max_button); + if (min_port > max_port) { + gtk_spin_button_set_value(max_button, min_port); + max_port = min_port; + } + linphone_core_set_audio_port_range(linphone_gtk_get_core(), min_port, max_port); + } } -void linphone_gtk_video_port_changed(GtkWidget *w){ - linphone_core_set_video_port(linphone_gtk_get_core(), - (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w))); +void linphone_gtk_max_audio_port_changed(GtkWidget *w){ + GtkWidget *mw = linphone_gtk_get_main_window(); + GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); + GtkSpinButton *min_button = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port")); + GtkSpinButton *max_button = GTK_SPIN_BUTTON(w); + gint min_port = gtk_spin_button_get_value(min_button); + gint max_port = gtk_spin_button_get_value(max_button); + if (max_port < min_port) { + gtk_spin_button_set_value(min_button, max_port); + min_port = max_port; + } + linphone_core_set_audio_port_range(linphone_gtk_get_core(), min_port, max_port); +} + +void linphone_gtk_min_video_port_changed(GtkWidget *w){ + GtkWidget *mw = linphone_gtk_get_main_window(); + GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); + GtkSpinButton *min_button = GTK_SPIN_BUTTON(w); + GtkSpinButton *max_button = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_max_rtp_port")); + gboolean fixed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_video_port"))); + + if (fixed) { + linphone_core_set_video_port(linphone_gtk_get_core(), (gint) gtk_spin_button_get_value(min_button)); + gtk_spin_button_set_value(max_button, gtk_spin_button_get_value(min_button)); + } else { + gint min_port = gtk_spin_button_get_value(min_button); + gint max_port = gtk_spin_button_get_value(max_button); + if (min_port > max_port) { + gtk_spin_button_set_value(max_button, min_port); + max_port = min_port; + } + linphone_core_set_video_port_range(linphone_gtk_get_core(), min_port, max_port); + } +} + +void linphone_gtk_max_video_port_changed(GtkWidget *w){ + GtkWidget *mw = linphone_gtk_get_main_window(); + GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); + GtkSpinButton *min_button = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port")); + GtkSpinButton *max_button = GTK_SPIN_BUTTON(w); + gint min_port = gtk_spin_button_get_value(min_button); + gint max_port = gtk_spin_button_get_value(max_button); + if (max_port < min_port) { + gtk_spin_button_set_value(min_button, max_port); + min_port = max_port; + } + linphone_core_set_video_port_range(linphone_gtk_get_core(), min_port, max_port); } void linphone_gtk_no_firewall_toggled(GtkWidget *w){ @@ -877,6 +937,7 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ void linphone_gtk_parameters_destroyed(GtkWidget *pb){ GtkWidget *mw=linphone_gtk_get_main_window(); + ms_error("linphone_gtk_paramters_destroyed"); g_object_set_data(G_OBJECT(mw),"parameters",NULL); } @@ -908,12 +969,15 @@ void linphone_gtk_show_parameters(void){ int mtu; int ui_advanced; LCSipTransports tr; + int min_port = 0, max_port = 0; if (pb==NULL) { pb=linphone_gtk_create_window("parameters"); g_object_set_data(G_OBJECT(mw),"parameters",pb); + ms_error("linphone_gtk_show_paramters: create"); }else { gtk_widget_show(pb); + ms_error("linphone_gtk_show_parameters: show"); return; } codec_list=linphone_gtk_get_widget(pb,"codec_list"); @@ -939,10 +1003,20 @@ void linphone_gtk_show_parameters(void){ tr.udp_port); } - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"audio_rtp_port")), - linphone_core_get_audio_port(lc)); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")), - linphone_core_get_video_port(lc)); + linphone_core_get_audio_port_range(lc, &min_port, &max_port); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port")), min_port); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_max_rtp_port")), max_port); + if (min_port == max_port) { + gtk_widget_set_sensitive(GTK_WIDGET(linphone_gtk_get_widget(pb, "audio_max_rtp_port")), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_audio_port")), TRUE); + } + linphone_core_get_video_port_range(lc, &min_port, &max_port); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port")), min_port); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_max_rtp_port")), max_port); + if (min_port == max_port) { + gtk_widget_set_sensitive(GTK_WIDGET(linphone_gtk_get_widget(pb, "video_max_rtp_port")), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_video_port")), TRUE); + } linphone_gtk_show_media_encryption(pb); @@ -1032,6 +1106,36 @@ void linphone_gtk_show_parameters(void){ } +void linphone_gtk_fixed_audio_port_toggle(void) { + GtkWidget *mw = linphone_gtk_get_main_window(); + GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); + gboolean fixed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_audio_port"))); + gint min_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port"))); + gint max_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_max_rtp_port"))); + gtk_widget_set_sensitive(GTK_WIDGET(linphone_gtk_get_widget(pb, "audio_max_rtp_port")), !fixed); + if (fixed) { + linphone_core_set_audio_port(linphone_gtk_get_core(), min_port); + } else { + linphone_core_set_audio_port_range(linphone_gtk_get_core(), min_port, max_port); + } +} + + +void linphone_gtk_fixed_video_port_toggle(void) { + GtkWidget *mw = linphone_gtk_get_main_window(); + GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); + gboolean fixed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_video_port"))); + gint min_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port"))); + gint max_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_max_rtp_port"))); + gtk_widget_set_sensitive(GTK_WIDGET(linphone_gtk_get_widget(pb, "video_max_rtp_port")), !fixed); + if (fixed) { + linphone_core_set_video_port(linphone_gtk_get_core(), min_port); + } else { + linphone_core_set_video_port_range(linphone_gtk_get_core(), min_port, max_port); + } +} + + void linphone_gtk_edit_tunnel_closed(GtkWidget *button){ GtkWidget *pb=gtk_widget_get_toplevel(button); gtk_widget_destroy(pb); From 353465b2850a7d8fa1be41e4859d22596b653464 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 19 Oct 2012 11:02:28 +0200 Subject: [PATCH 668/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 23c75b195..49f616a4b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 23c75b19523c172c97ba89c76cf7672fc804b14a +Subproject commit 49f616a4b8d32b1ab2adeaa68c8f614ef77276da From e829fa6e222f37de9c26e4e82f0227078f4b6629 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 19 Oct 2012 11:41:03 +0200 Subject: [PATCH 669/769] add int linphone_core_decline_call(LinphoneCore *lc, LinphoneCall * call, LinphoneReason reason) --- coreapi/linphonecall.c | 1 + coreapi/linphonecore.c | 33 +++++++++++++++++++++++++++++++-- coreapi/linphonecore.h | 5 ++++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 32dc9d59c..70395841a 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2096,6 +2096,7 @@ bool_t linphone_call_is_in_conference(const LinphoneCall *call) { /** * Perform a zoom of the video displayed during a call. + * @param call the call. * @param zoom_factor a floating point number describing the zoom factor. A value 1.0 corresponds to no zoom applied. * @param cx a floating point number pointing the horizontal center of the zoom to be applied. This value should be between 0.0 and 1.0. * @param cy a floating point number pointing the vertical center of the zoom to be applied. This value should be between 0.0 and 1.0. diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d96a1905b..c07380502 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2917,6 +2917,7 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){ linphone_call_stop_media_streams(call); if (lc->vtable.display_status!=NULL) lc->vtable.display_status(lc,_("Call ended") ); + linphone_call_set_state(call,LinphoneCallEnd,"Call terminated"); } int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri){ @@ -2924,7 +2925,6 @@ int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char sal_call_decline(call->op,SalReasonRedirect,redirect_uri); call->reason=LinphoneReasonDeclined; terminate_call(lc,call); - linphone_call_set_state(call,LinphoneCallEnd,"Call terminated"); }else{ ms_error("Bad state for call redirection."); return -1; @@ -2958,8 +2958,35 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call) } sal_call_terminate(call->op); terminate_call(lc,call); + return 0; +} - linphone_call_set_state(call,LinphoneCallEnd,"Call terminated"); +/** + * Decline a pending incoming call, with a reason. + * @param lc the linphone core + * @param call the LinphoneCall, must be in the IncomingReceived state. + * @param reason the reason for rejecting the call: LinphoneReasonDeclined or LinphoneReasonBusy +**/ +int linphone_core_decline_call(LinphoneCore *lc, LinphoneCall * call, LinphoneReason reason){ + SalReason sal_reason=SalReasonUnknown; + if (call->state!=LinphoneCallIncomingReceived && call->state!=LinphoneCallIncomingEarlyMedia){ + ms_error("linphone_core_decline_call(): Cannot decline a call that is in state %s",linphone_call_state_to_string(call->state)); + return -1; + } + switch(reason){ + case LinphoneReasonDeclined: + sal_reason=SalReasonDeclined; + break; + case LinphoneReasonBusy: + sal_reason=SalReasonBusy; + break; + default: + ms_error("linphone_core_decline_call(): unsupported reason %s",linphone_reason_to_string(reason)); + return -1; + break; + } + sal_call_decline(call->op,sal_reason,NULL); + terminate_call(lc,call); return 0; } @@ -4975,6 +5002,8 @@ const char *linphone_reason_to_string(LinphoneReason err){ return "User not found"; case LinphoneReasonNotAnswered: return "Not answered"; + case LinphoneReasonBusy: + return "Busy"; } return "unknown error"; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index ad52c559f..d0ecc11a3 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -222,7 +222,8 @@ enum _LinphoneReason{ LinphoneReasonBadCredentials, /** Date: Fri, 19 Oct 2012 15:22:44 +0200 Subject: [PATCH 670/769] Added getRate method to PayloadType interface --- java/common/org/linphone/core/PayloadType.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/common/org/linphone/core/PayloadType.java b/java/common/org/linphone/core/PayloadType.java index 952da57d2..648d77465 100644 --- a/java/common/org/linphone/core/PayloadType.java +++ b/java/common/org/linphone/core/PayloadType.java @@ -21,4 +21,6 @@ package org.linphone.core; public interface PayloadType { String getMime(); + + int getRate(); } From d6d01caf33ca4abb406dadb1975b1370f7e0cb63 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 19 Oct 2012 16:54:09 +0200 Subject: [PATCH 671/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 49f616a4b..d26d2090b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 49f616a4b8d32b1ab2adeaa68c8f614ef77276da +Subproject commit d26d2090b4b9ba1b9eec4244e2b3012ee0b12cbd From 8cdb6923d5fbaa2eea6fadd7ba9c3b093418a370 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 22 Oct 2012 21:54:58 +0200 Subject: [PATCH 672/769] add HAVE_EXOSIP_TRYLOCK to android makefile --- build/android/common.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/android/common.mk b/build/android/common.mk index 4db1f6809..704b06045 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -63,7 +63,8 @@ LOCAL_CFLAGS += \ -DENABLE_TRACE \ -DLINPHONE_VERSION=\"$(LINPHONE_VERSION)\" \ -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ - -DLOG_DOMAIN=$(MY_LOG_DOMAIN) + -DLOG_DOMAIN=$(MY_LOG_DOMAIN) \ + -DHAVE_EXOSIP_TRYLOCK=1 LOCAL_CFLAGS += -DIN_LINPHONE From dd45665ea0fc35273f1dfff0f571f7955320d94a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 22 Oct 2012 15:44:23 +0200 Subject: [PATCH 673/769] Do not restart the media streams if only network addresses have been changed in re-invite. --- coreapi/callbacks.c | 69 ++++++++++++++++++++++++++++++++++++++++++--- coreapi/sal.c | 52 +++++++++++++++++++--------------- coreapi/sal.h | 7 ++++- 3 files changed, 101 insertions(+), 27 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index e7f6a7b21..a4a4232c4 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -27,9 +27,63 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void register_failure(SalOp *op, SalError error, SalReason reason, const char *details); -static bool_t media_parameters_changed(LinphoneCall *call, SalMediaDescription *oldmd, SalMediaDescription *newmd){ - if (call->params.in_conference!=call->current_params.in_conference) return TRUE; - return !sal_media_description_equals(oldmd,newmd) || call->up_bw!=linphone_core_get_upload_bandwidth(call->core); +static int media_parameters_changed(LinphoneCall *call, SalMediaDescription *oldmd, SalMediaDescription *newmd) { + if (call->params.in_conference != call->current_params.in_conference) return SAL_MEDIA_DESCRIPTION_CHANGED; + if (call->up_bw != linphone_core_get_upload_bandwidth(call->core)) return SAL_MEDIA_DESCRIPTION_CHANGED; + return sal_media_description_equals(oldmd, newmd); +} + +void linphone_core_update_streams_destinations(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md) { + SalStreamDescription *old_audiodesc = NULL; + SalStreamDescription *old_videodesc = NULL; + SalStreamDescription *new_audiodesc = NULL; + SalStreamDescription *new_videodesc = NULL; + char *rtp_addr, *rtcp_addr; + int i; + + for (i = 0; i < old_md->nstreams; i++) { + if (old_md->streams[i].type == SalAudio) { + old_audiodesc = &old_md->streams[i]; + } else if (old_md->streams[i].type == SalVideo) { + old_videodesc = &old_md->streams[i]; + } + } + for (i = 0; i < new_md->nstreams; i++) { + if (new_md->streams[i].type == SalAudio) { + new_audiodesc = &new_md->streams[i]; + } else if (new_md->streams[i].type == SalVideo) { + new_videodesc = &new_md->streams[i]; + } + } + if (call->audiostream && new_audiodesc) { + rtp_addr = (new_audiodesc->rtp_addr[0] != '\0') ? new_audiodesc->rtp_addr : new_md->addr; + rtcp_addr = (new_audiodesc->rtcp_addr[0] != '\0') ? new_audiodesc->rtcp_addr : new_md->addr; + ms_message("Change audio stream destination: RTP=%s:%d RTCP=%s:%d", rtp_addr, new_audiodesc->rtp_port, rtcp_addr, new_audiodesc->rtcp_port); + rtp_session_set_remote_addr_full(call->audiostream->session, rtp_addr, new_audiodesc->rtp_port, rtcp_addr, new_audiodesc->rtcp_port); + } +#ifdef VIDEO_ENABLED + if (call->videostream && new_videodesc) { + rtp_addr = (new_videodesc->rtp_addr[0] != '\0') ? new_videodesc->rtp_addr : new_md->addr; + rtcp_addr = (new_videodesc->rtcp_addr[0] != '\0') ? new_videodesc->rtcp_addr : new_md->addr; + ms_message("Change video stream destination: RTP=%s:%d RTCP=%s:%d", rtp_addr, new_videodesc->rtp_port, rtcp_addr, new_videodesc->rtcp_port); + rtp_session_set_remote_addr_full(call->videostream->session, rtp_addr, new_videodesc->rtp_port, rtcp_addr, new_videodesc->rtcp_port); + } +#endif + + /* Copy address and port values from new_md to old_md since we will keep old_md as resultdesc */ + strcpy(old_md->addr, new_md->addr); + if (old_audiodesc && new_audiodesc) { + strcpy(old_audiodesc->rtp_addr, new_audiodesc->rtp_addr); + strcpy(old_audiodesc->rtcp_addr, new_audiodesc->rtcp_addr); + old_audiodesc->rtp_port = new_audiodesc->rtp_port; + old_audiodesc->rtcp_port = new_audiodesc->rtcp_port; + } + if (old_videodesc && new_videodesc) { + strcpy(old_videodesc->rtp_addr, new_videodesc->rtp_addr); + strcpy(old_videodesc->rtcp_addr, new_videodesc->rtcp_addr); + old_videodesc->rtp_port = new_videodesc->rtp_port; + old_videodesc->rtcp_port = new_videodesc->rtcp_port; + } } void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *new_md){ @@ -49,7 +103,8 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia if ((call->audiostream && call->audiostream->ticker) || (call->videostream && call->videostream->ticker)){ /* we already started media: check if we really need to restart it*/ if (oldmd){ - if (!media_parameters_changed(call,oldmd,new_md) && !call->playing_ringbacktone){ + int md_changed = media_parameters_changed(call, oldmd, new_md); + if ((md_changed == SAL_MEDIA_DESCRIPTION_UNCHANGED) && !call->playing_ringbacktone) { /*as nothing has changed, keep the oldmd */ call->resultdesc=oldmd; sal_media_description_unref(new_md); @@ -66,6 +121,12 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia } ms_message("No need to restart streams, SDP is unchanged."); return; + } else if ((md_changed == SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED) && !call->playing_ringbacktone) { + call->resultdesc = oldmd; + ms_message("Network parameters have changed, update them."); + linphone_core_update_streams_destinations(lc, call, oldmd, new_md); + sal_media_description_unref(new_md); + return; }else{ ms_message("Media descriptions are different, need to restart the streams."); } diff --git a/coreapi/sal.c b/coreapi/sal.c index b349ad0a4..229ee577f 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -177,32 +177,40 @@ static bool_t payload_list_equals(const MSList *l1, const MSList *l2){ return TRUE; } -bool_t sal_stream_description_equals(const SalStreamDescription *sd1, const SalStreamDescription *sd2){ - if (sd1->proto!=sd2->proto) return FALSE; - if (sd1->type!=sd2->type) return FALSE; - if (strcmp(sd1->rtp_addr,sd2->rtp_addr)!=0) return FALSE; - if (sd1->rtp_port!=sd2->rtp_port) return FALSE; - if (strcmp(sd1->rtcp_addr,sd2->rtcp_addr)!=0) return FALSE; - if (sd1->rtcp_port!=sd2->rtcp_port) return FALSE; - if (!payload_list_equals(sd1->payloads,sd2->payloads)) return FALSE; - if (sd1->bandwidth!=sd2->bandwidth) return FALSE; - if (sd1->ptime!=sd2->ptime) return FALSE; - /* compare candidates: TODO */ - if (sd1->dir!=sd2->dir) return FALSE; - return TRUE; +int sal_stream_description_equals(const SalStreamDescription *sd1, const SalStreamDescription *sd2) { + int result = SAL_MEDIA_DESCRIPTION_UNCHANGED; + + /* A different proto should result in SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED but the encryption change + needs a stream restart for now, so use SAL_MEDIA_DESCRIPTION_CODEC_CHANGED */ + if (sd1->proto != sd2->proto) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + + if (sd1->type != sd2->type) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + if (strcmp(sd1->rtp_addr, sd2->rtp_addr) != 0) result |= SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED; + if (sd1->rtp_port != sd2->rtp_port) { + if ((sd1->rtp_port == 0) || (sd2->rtp_port == 0)) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + else result |= SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED; + } + if (strcmp(sd1->rtcp_addr, sd2->rtcp_addr) != 0) result |= SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED; + if (sd1->rtcp_port != sd2->rtcp_port) result |= SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED; + if (!payload_list_equals(sd1->payloads, sd2->payloads)) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + if (sd1->bandwidth != sd2->bandwidth) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + if (sd1->ptime != sd2->ptime) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + if (sd1->dir != sd2->dir) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + + return result; } -bool_t sal_media_description_equals(const SalMediaDescription *md1, const SalMediaDescription *md2){ +int sal_media_description_equals(const SalMediaDescription *md1, const SalMediaDescription *md2) { + int result = SAL_MEDIA_DESCRIPTION_UNCHANGED; int i; - - if (strcmp(md1->addr,md2->addr)!=0) return FALSE; - if (md1->nstreams!=md2->nstreams) return FALSE; - if (md1->bandwidth!=md2->bandwidth) return FALSE; - for(i=0;instreams;++i){ - if (!sal_stream_description_equals(&md1->streams[i],&md2->streams[i])) - return FALSE; + + if (strcmp(md1->addr, md2->addr) != 0) result |= SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED; + if (md1->nstreams != md2->nstreams) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + if (md1->bandwidth != md2->bandwidth) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + for(i = 0; i < md1->nstreams; ++i){ + result |= sal_stream_description_equals(&md1->streams[i], &md2->streams[i]); } - return TRUE; + return result; } static void assign_string(char **str, const char *arg){ diff --git a/coreapi/sal.h b/coreapi/sal.h index 2913096ca..54a075ed6 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -53,6 +53,11 @@ typedef enum { SalTransportDTLS /*DTLS*/ }SalTransport; +#define SAL_MEDIA_DESCRIPTION_UNCHANGED 0x00 +#define SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED 0x01 +#define SAL_MEDIA_DESCRIPTION_CODEC_CHANGED 0x02 +#define SAL_MEDIA_DESCRIPTION_CHANGED (SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED | SAL_MEDIA_DESCRIPTION_CODEC_CHANGED) + const char* sal_transport_to_string(SalTransport transport); SalTransport sal_transport_parse(const char*); /* Address manipulation API*/ @@ -189,7 +194,7 @@ SalMediaDescription *sal_media_description_new(); void sal_media_description_ref(SalMediaDescription *md); void sal_media_description_unref(SalMediaDescription *md); bool_t sal_media_description_empty(const SalMediaDescription *md); -bool_t sal_media_description_equals(const SalMediaDescription *md1, const SalMediaDescription *md2); +int sal_media_description_equals(const SalMediaDescription *md1, const SalMediaDescription *md2); bool_t sal_media_description_has_dir(const SalMediaDescription *md, SalStreamDir dir); SalStreamDescription *sal_media_description_find_stream(SalMediaDescription *md, SalMediaProto proto, SalStreamType type); From 9d1c032211f27bd7fff5af4fd070666789548316 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 23 Oct 2012 10:47:24 +0200 Subject: [PATCH 674/769] Update ms2 submodule for Android video fix. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index d26d2090b..bc398d798 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d26d2090b4b9ba1b9eec4244e2b3012ee0b12cbd +Subproject commit bc398d79882c9bf136fbba0f5ceabe43ad9848fb From 6b89311813fd2721c48cd793176e02650eea69fb Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 23 Oct 2012 11:11:24 +0200 Subject: [PATCH 675/769] Include linphonecore_jni.h to check validity of JNI at compilation time. --- build/android/common.mk | 3 ++- coreapi/linphonecore_jni.cc | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build/android/common.mk b/build/android/common.mk index 704b06045..8772e9003 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -81,7 +81,8 @@ LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/../oRTP/include \ $(LOCAL_PATH)/../mediastreamer2/include \ $(LOCAL_PATH)/../../externals/exosip/include \ - $(LOCAL_PATH)/../../externals/osip/include + $(LOCAL_PATH)/../../externals/osip/include \ + $(LOCAL_PATH)/../../../gen LOCAL_LDLIBS += -llog -ldl diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 080c8b009..69f9b3cc4 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include +#include "linphonecore_jni.h" #include "linphonecore_utils.h" #include From a349f7993016cac9a598ac3cb1b76d6590901995 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 23 Oct 2012 13:34:41 +0200 Subject: [PATCH 676/769] Fix date header --- coreapi/sal_eXosip2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index b5f6cc10f..b83cc4f24 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -415,6 +415,7 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i int dont_use_101 = !ctx->use_101; // Copy char to int to avoid bad alignment eXosip_set_option(EXOSIP_OPT_DONT_SEND_101,&dont_use_101); sal_set_dscp(ctx,ctx->dscp); + sal_use_dates(ctx,ctx->add_dates); ipv6=strchr(addr,':')!=NULL; eXosip_enable_ipv6(ipv6); From 7a4fe143879e249570ae39552a82c5681f0cdf6c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 23 Oct 2012 15:29:25 +0200 Subject: [PATCH 677/769] Print version of linphone core on initialization. --- coreapi/linphonecore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c07380502..b5f35d59d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1099,6 +1099,7 @@ static void misc_config_read (LinphoneCore *lc) { static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config_path, void * userdata) { + ms_message("Initializing LinphoneCore %s", linphone_core_get_version()); memset (lc, 0, sizeof (LinphoneCore)); lc->data=userdata; lc->ringstream_autorelease=TRUE; From 2d9549f17d2680e0919a3975c05d10b86794817a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 25 Oct 2012 13:18:05 +0200 Subject: [PATCH 678/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index bc398d798..832672303 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bc398d79882c9bf136fbba0f5ceabe43ad9848fb +Subproject commit 83267230336a64dc4a005b29bf8baccf6a5fd2c2 From fe595857dddfadb85df51af67620f035e7651c7d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 25 Oct 2012 15:48:53 +0200 Subject: [PATCH 679/769] Include linphonecore_jni.h only if USE_JAVAH is defined. --- build/android/common.mk | 4 ++++ coreapi/linphonecore_jni.cc | 2 ++ 2 files changed, 6 insertions(+) diff --git a/build/android/common.mk b/build/android/common.mk index 8772e9003..c49d511bd 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -75,6 +75,10 @@ LOCAL_CFLAGS += -DHAVE_X264 endif endif +ifeq ($(USE_JAVAH),1) +LOCAL_CFLAGS += -DUSE_JAVAH +endif + LOCAL_C_INCLUDES += \ $(LOCAL_PATH) \ $(LOCAL_PATH)/include \ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 69f9b3cc4..5ebf57892 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -17,7 +17,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include +#ifdef USE_JAVAH #include "linphonecore_jni.h" +#endif #include "linphonecore_utils.h" #include From b7b4e75eda15c43883b7b01a2e308215e280428a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 25 Oct 2012 17:16:07 +0200 Subject: [PATCH 680/769] Include git version in liblinphone version if available. --- coreapi/.gitignore | 1 + coreapi/Makefile.am | 26 ++++++++++++++++++++++++-- coreapi/linphonecore.c | 10 +++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/coreapi/.gitignore b/coreapi/.gitignore index c5d084fa6..81d1b7647 100644 --- a/coreapi/.gitignore +++ b/coreapi/.gitignore @@ -5,3 +5,4 @@ Makefile.in *.lo *.la *.loT +liblinphone_gitversion.h diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index c706751ac..fa0c08b01 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -1,7 +1,15 @@ +GITVERSION_FILE=liblinphone_gitversion.h +GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp + +ECHO=/bin/echo SUBDIRS=. help -EXTRA_DIST=linphonecore_jni.cc +EXTRA_DIST=linphonecore_jni.cc $(GITVERSION_FILE) + +BUILT_SOURCES=$(GITVERSION_FILE) + +CLEANFILES=$(GITVERSION_FILE) ## Process this file with automake to produce Makefile.in linphone_includedir=$(includedir)/linphone @@ -41,7 +49,8 @@ liblinphone_la_SOURCES=\ lsd.c linphonecore_utils.h \ ec-calibrator.c \ conference.c \ - linphone_tunnel.cc + linphone_tunnel.cc \ + $(GITVERSION_FILE) if BUILD_WIZARD liblinphone_la_SOURCES+=sipwizard.c @@ -97,3 +106,16 @@ AM_CFLAGS+= -DBUILD_WIZARD endif AM_CXXFLAGS=$(AM_CFLAGS) + +$(GITVERSION_FILE): + if test -d $(top_srcdir)/.git ; then \ + $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION " > $(GITVERSION_FILE_TMP) &&\ + $(ECHO) \"`cd $(top_srcdir) && git describe`\" >> $(GITVERSION_FILE_TMP) &&\ + if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \ + cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \ + fi \ + && rm -f $(GITVERSION_FILE_TMP) ;\ + fi + if ! test -f $(srcdir)/$(GITVERSION_FILE) ; then \ + $(ECHO) -n "" > $(srcdir)/$(GITVERSION_FILE) ;\ + fi diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b5f35d59d..503a71c03 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -42,11 +42,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #endif +#include "liblinphone_gitversion.h" + /*#define UNSTANDART_GSM_11K 1*/ #define ROOT_CA_FILE PACKAGE_DATA_DIR "/linphone/rootca.pem" -static const char *liblinphone_version=LIBLINPHONE_VERSION; +static const char *liblinphone_version= +#ifdef LIBLINPHONE_GIT_VERSION + LIBLINPHONE_GIT_VERSION +#else + LIBLINPHONE_VERSION +#endif +; static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime); static void linphone_core_run_hooks(LinphoneCore *lc); static void linphone_core_free_hooks(LinphoneCore *lc); From 37681f0e663e199c5f7b4e541028a5d9bc52913e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 26 Oct 2012 10:40:14 +0200 Subject: [PATCH 681/769] Improve handling of git version. --- coreapi/Makefile.am | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index fa0c08b01..0c10c05da 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -1,5 +1,7 @@ GITVERSION_FILE=liblinphone_gitversion.h GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp +GITDESCRIBE=$(shell git describe) +GITREVISION=$(shell git rev-parse HEAD) ECHO=/bin/echo @@ -107,15 +109,17 @@ endif AM_CXXFLAGS=$(AM_CFLAGS) -$(GITVERSION_FILE): - if test -d $(top_srcdir)/.git ; then \ - $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION " > $(GITVERSION_FILE_TMP) &&\ - $(ECHO) \"`cd $(top_srcdir) && git describe`\" >> $(GITVERSION_FILE_TMP) &&\ - if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \ - cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \ - fi \ - && rm -f $(GITVERSION_FILE_TMP) ;\ +make_gitversion_h: + if test "$(GITDESCRIBE)" != "" ; then \ + $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(GITDESCRIBE)\"" > $(GITVERSION_FILE_TMP) ; \ + elif test "$(GITREVISION)" != "" ; then \ + $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(LINPHONE_VERSION)_$(GITREVISION)\"" > $(GITVERSION_FILE_TMP) ; \ + else \ + $(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \ fi - if ! test -f $(srcdir)/$(GITVERSION_FILE) ; then \ - $(ECHO) -n "" > $(srcdir)/$(GITVERSION_FILE) ;\ + if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \ + cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \ fi + rm -f $(GITVERSION_FILE_TMP) ; + +$(GITVERSION_FILE): make_gitversion_h From 01c990cb10406b35728bf33eb0753d3ea2ab9907 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 30 Oct 2012 13:48:06 +0100 Subject: [PATCH 682/769] Remove function static variables --- coreapi/linphonecore.c | 15 ++++++++------- coreapi/private.h | 3 +++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 503a71c03..b25523df1 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1192,6 +1192,9 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta sal_set_user_pointer(lc->sal,lc); sal_set_callbacks(lc->sal,&linphone_sal_callbacks); + lc->network_last_check = 0; + lc->network_last_status = FALSE; + sip_setup_register_all(); sound_config_read(lc); net_config_read(lc); @@ -1803,24 +1806,22 @@ void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val){ static void monitor_network_state(LinphoneCore *lc, time_t curtime){ - static time_t last_check=0; - static bool_t last_status=FALSE; char result[LINPHONE_IPADDR_SIZE]; - bool_t new_status=last_status; + bool_t new_status=lc->network_last_status; /* only do the network up checking every five seconds */ - if (last_check==0 || (curtime-last_check)>=5){ + if (lc->network_last_check==0 || (curtime-lc->network_last_check)>=5){ linphone_core_get_local_ip_for(lc->sip_conf.ipv6_enabled ? AF_INET6 : AF_INET,NULL,result); if (strcmp(result,"::1")!=0 && strcmp(result,"127.0.0.1")!=0){ new_status=TRUE; }else new_status=FALSE; - last_check=curtime; - if (new_status!=last_status) { + lc->network_last_check=curtime; + if (new_status!=lc->network_last_status) { if (new_status){ ms_message("New local ip address is %s",result); } set_network_reachable(lc,new_status, curtime); - last_status=new_status; + lc->network_last_status=new_status; } } } diff --git a/coreapi/private.h b/coreapi/private.h index 07fd1c689..e9165a501 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -556,6 +556,9 @@ struct _LinphoneCore bool_t network_reachable; bool_t use_preview_window; + time_t network_last_check; + bool_t network_last_status; + bool_t ringstream_autorelease; bool_t pad[3]; int device_rotation; From 31848a31cc9f6ab17a7b6b59bb3b216626973cc8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 30 Oct 2012 21:47:12 +0100 Subject: [PATCH 683/769] Fix typo in warning message. --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b25523df1..cc636a42a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4051,7 +4051,7 @@ int linphone_core_set_video_device(LinphoneCore *lc, const char *id){ if (id!=NULL){ lc->video_conf.device=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),id); if (lc->video_conf.device==NULL){ - ms_warning("Could not found video device %s",id); + ms_warning("Could not find video device %s",id); } } if (lc->video_conf.device==NULL) From e54f0596b8b17d0ff5b725e5ebb70b5e61f7f101 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 31 Oct 2012 10:52:43 +0100 Subject: [PATCH 684/769] Add in call timeout --- coreapi/linphonecore.c | 32 +++++++++++++++++++++++++++++++- coreapi/linphonecore.h | 4 ++++ coreapi/linphonecore_jni.cc | 4 ++++ coreapi/private.h | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b25523df1..353eaa1b6 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -591,6 +591,9 @@ static void sip_config_read(LinphoneCore *lc) tmp=lp_config_get_int(lc->config,"sip","inc_timeout",30); linphone_core_set_inc_timeout(lc,tmp); + tmp=lp_config_get_int(lc->config,"sip","in_call_timeout",0); + linphone_core_set_in_call_timeout(lc,tmp); + /* get proxies config */ for(i=0;; i++){ LinphoneProxyConfig *cfg=linphone_proxy_config_new_from_config_file(lc->config,i); @@ -1979,6 +1982,7 @@ void linphone_core_iterate(LinphoneCore *lc){ calls= lc->calls; while(calls!= NULL){ call = (LinphoneCall *)calls->data; + elapsed = curtime-call->start_time; /* get immediately a reference to next one in case the one we are going to examine is destroy and removed during linphone_core_start_invite() */ @@ -1995,7 +1999,6 @@ void linphone_core_iterate(LinphoneCore *lc){ linphone_core_start_invite(lc,call); } if (call->state==LinphoneCallIncomingReceived){ - elapsed=curtime-call->start_time; ms_message("incoming call ringing for %i seconds",elapsed); if (elapsed>lc->sip_conf.inc_timeout){ ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout); @@ -2004,6 +2007,12 @@ void linphone_core_iterate(LinphoneCore *lc){ linphone_core_terminate_call(lc,call); } } + if (lc->sip_conf.in_call_timeout > 0 && elapsed>lc->sip_conf.in_call_timeout) { + ms_message("in call timeout (%i)",lc->sip_conf.in_call_timeout); + call->log->status=LinphoneCallMissed; + call->reason=LinphoneReasonNotAnswered; + linphone_core_terminate_call(lc,call); + } } if (linphone_core_video_preview_enabled(lc)){ @@ -3208,6 +3217,26 @@ int linphone_core_get_inc_timeout(LinphoneCore *lc){ return lc->sip_conf.inc_timeout; } +/** + * Set the in call timeout in seconds. + * + * @ingroup call_control + * After this timeout period, the call is automatically hangup. +**/ +void linphone_core_set_in_call_timeout(LinphoneCore *lc, int seconds){ + lc->sip_conf.in_call_timeout=seconds; +} + +/** + * Returns the in call timeout + * + * @ingroup call_control + * See linphone_core_set_in_call_timeout() for details. +**/ +int linphone_core_get_in_call_timeout(LinphoneCore *lc){ + return lc->sip_conf.in_call_timeout; +} + void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away, const char *contact, LinphoneOnlineStatus presence_mode) @@ -4604,6 +4633,7 @@ void sip_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,"sip","guess_hostname",config->guess_hostname); lp_config_set_string(lc->config,"sip","contact",config->contact); lp_config_set_int(lc->config,"sip","inc_timeout",config->inc_timeout); + lp_config_set_int(lc->config,"sip","in_call_timeout",config->in_call_timeout); lp_config_set_int(lc->config,"sip","use_info",config->use_info); lp_config_set_int(lc->config,"sip","use_rfc2833",config->use_rfc2833); lp_config_set_int(lc->config,"sip","use_ipv6",config->ipv6_enabled); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d0ecc11a3..99ae480fc 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1164,6 +1164,10 @@ void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds); int linphone_core_get_inc_timeout(LinphoneCore *lc); +void linphone_core_set_in_call_timeout(LinphoneCore *lc, int seconds); + +int linphone_core_get_in_call_timeout(LinphoneCore *lc); + void linphone_core_set_stun_server(LinphoneCore *lc, const char *server); const char * linphone_core_get_stun_server(const LinphoneCore *lc); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 5ebf57892..85bd10259 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2137,6 +2137,10 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setIncomingTimeout(JNIEn linphone_core_set_inc_timeout((LinphoneCore *)lc, timeout); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setInCallTimeout(JNIEnv *env, jobject thiz, jlong lc, jint timeout) { + linphone_core_set_in_call_timeout((LinphoneCore *)lc, timeout); +} + extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* env,jobject thiz,jlong ptr) { jstring jvalue =env->NewStringUTF(linphone_core_get_version()); return jvalue; diff --git a/coreapi/private.h b/coreapi/private.h index e9165a501..e6ed960bc 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -382,6 +382,7 @@ typedef struct sip_config MSList *proxies; MSList *deleted_proxies; int inc_timeout; /*timeout after an un-answered incoming call is rejected*/ + int in_call_timeout; /*timeout after a call is hangup */ unsigned int keepalive_period; /* interval in ms between keep alive messages sent to the proxy server*/ LCSipTransports transports; bool_t use_info; From b8dd0174013ef5327bbac5d9f230d23a7d0c23d3 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 31 Oct 2012 11:19:39 +0100 Subject: [PATCH 685/769] Wrong call state on in call timeout --- coreapi/linphonecore.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 570482596..6330e1642 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2009,8 +2009,6 @@ void linphone_core_iterate(LinphoneCore *lc){ } if (lc->sip_conf.in_call_timeout > 0 && elapsed>lc->sip_conf.in_call_timeout) { ms_message("in call timeout (%i)",lc->sip_conf.in_call_timeout); - call->log->status=LinphoneCallMissed; - call->reason=LinphoneReasonNotAnswered; linphone_core_terminate_call(lc,call); } } From 1c1de407a7a4d5b67f3ae788e7a15b905e164f40 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 31 Oct 2012 11:13:02 +0100 Subject: [PATCH 686/769] Small fixes for BB. --- java/common/org/linphone/core/LinphoneCallLog.java | 2 +- java/common/org/linphone/core/LinphoneChatMessage.java | 4 +--- java/common/org/linphone/core/LinphoneCore.java | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index 1abdb7bed..8d0e4073a 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -38,7 +38,7 @@ public interface LinphoneCallLog { /** * Call success. */ - public final static CallStatus Sucess = new CallStatus(0,"Sucess"); + public final static CallStatus Success = new CallStatus(0,"Sucess"); /** * Call aborted. */ diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index db75f9116..74f0961ac 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -7,8 +7,7 @@ public interface LinphoneChatMessage { interface StateListener{ void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state); } - static class State { - @SuppressWarnings("rawtypes") + public static class State { static private Vector values = new Vector(); private final int mValue; public final int value() {return mValue;} @@ -31,7 +30,6 @@ public interface LinphoneChatMessage { */ public final static State NotDelivered = new State(3,"NotDelivered"); - @SuppressWarnings("unchecked") private State(int value,String stringValue) { mValue = value; values.addElement(this); diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 562ae86cd..5916316b8 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -189,21 +189,21 @@ public interface LinphoneCore { * Media (RTP) encryption enum-like. * */ - static public class MediaEncryption { + static public final class MediaEncryption { static private Vector values = new Vector(); /** * None */ - static public MediaEncryption None = new MediaEncryption(0,"None"); + static public final MediaEncryption None = new MediaEncryption(0,"None"); /** * SRTP */ - static public MediaEncryption SRTP = new MediaEncryption(1,"SRTP"); + static public final MediaEncryption SRTP = new MediaEncryption(1,"SRTP"); /** * ZRTP */ - static public MediaEncryption ZRTP = new MediaEncryption(2,"ZRTP"); + static public final MediaEncryption ZRTP = new MediaEncryption(2,"ZRTP"); protected final int mValue; private final String mStringValue; From 0d18c3124db2e9b224f83c2faf98d78914e31030 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 2 Nov 2012 17:13:30 +0100 Subject: [PATCH 687/769] Fix Android compilation. --- coreapi/linphonecore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6330e1642..d980e818e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -40,9 +40,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef HAVE_CONFIG_H #include "config.h" +#include "liblinphone_gitversion.h" +#else +#ifndef LIBLINPHONE_GIT_VERSION +#define LIBLINPHONE_GIT_VERSION "unknown" +#endif #endif -#include "liblinphone_gitversion.h" /*#define UNSTANDART_GSM_11K 1*/ From 5dd560b730e4393925a0179055c15825b7b74f5a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 5 Nov 2012 15:29:05 +0100 Subject: [PATCH 688/769] Added java interface + implem for incall timeout --- java/common/org/linphone/core/LinphoneCore.java | 6 ++++++ java/impl/org/linphone/core/LinphoneCoreImpl.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 5916316b8..49b15c369 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -843,4 +843,10 @@ public interface LinphoneCore { * automatically declined. **/ void setIncomingTimeout(int timeout); + + /** + * Set the call timeout in seconds. + * Once this time is elapsed (ringing included), the call is automatically hung up. + **/ + void setInCallTimeout(int timeout); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 6059915ea..072934204 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -115,6 +115,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setAudioPortRange(long nativePtr, int minPort, int maxPort); private native void setVideoPortRange(long nativePtr, int minPort, int maxPort); private native void setIncomingTimeout(long nativePtr, int timeout); + private native void setInCallTimeout(long nativePtr, int timeout); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -782,4 +783,9 @@ class LinphoneCoreImpl implements LinphoneCore { public void setIncomingTimeout(int timeout) { setIncomingTimeout(nativePtr, timeout); } + + public void setInCallTimeout(int timeout) + { + setInCallTimeout(nativePtr, timeout); + } } From 8bccb20574b2d070e58ef83b59c837beda492b67 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 5 Nov 2012 17:48:49 +0100 Subject: [PATCH 689/769] fix storage of inc timeout --- coreapi/linphonecore.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c07380502..c39dfcbd9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3186,6 +3186,9 @@ int linphone_core_send_publish(LinphoneCore *lc, **/ void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds){ lc->sip_conf.inc_timeout=seconds; + if (linphone_core_ready(lc)){ + lp_config_set_int(lc->config,"sip","inc_timeout",seconds); + } } /** From 00bd86e388f1fd6d7c5095a9b88324207703f57f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 6 Nov 2012 05:32:43 +0100 Subject: [PATCH 690/769] implement checking of duplicated messages. --- coreapi/callbacks.c | 30 ++++++++++++++++++++++++------ coreapi/linphonecore.c | 3 +++ coreapi/private.h | 1 + coreapi/sal.h | 11 ++++++++--- coreapi/sal_eXosip2.c | 30 ++++++++++++++++++------------ 5 files changed, 54 insertions(+), 21 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index a4a4232c4..f99c9b224 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -779,14 +779,33 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ } } -static void text_received(Sal *sal, const char *from, const char *msg){ - LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal); - linphone_core_message_received(lc,from,msg,NULL); +static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){ + MSList *elem=lc->last_recv_msg_ids; + int i; + bool_t is_duplicate=FALSE; + for(i=0;elem!=NULL;elem=elem->next,i++){ + if (strcmp((const char*)elem->data,msg_id)==0){ + is_duplicate=TRUE; + } + } + if (!is_duplicate){ + lc->last_recv_msg_ids=ms_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id)); + } + if (i>=10){ + ms_free(elem->data); + ms_list_remove_link(lc->last_recv_msg_ids,elem); + } + return is_duplicate; } -void message_external_body_received(Sal *sal, const char *from, const char *url) { + + +static void text_received(Sal *sal, const SalMessage *msg){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal); - linphone_core_message_received(lc,from,NULL,url); + if (is_duplicate_msg(lc,msg->message_id)==FALSE){ + linphone_core_message_received(lc,msg->from,msg->text,msg->url); + } } + static void notify(SalOp *op, const char *from, const char *msg){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer (op); @@ -902,7 +921,6 @@ SalCallbacks linphone_sal_callbacks={ dtmf_received, refer_received, text_received, - message_external_body_received, text_delivery_update, notify, notify_presence, diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d980e818e..8de92f23b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4823,6 +4823,9 @@ static void linphone_core_uninit(LinphoneCore *lc) ms_list_for_each(lc->call_logs,(void (*)(void*))linphone_call_log_destroy); lc->call_logs=ms_list_free(lc->call_logs); + + ms_list_for_each(lc->last_recv_msg_ids,ms_free); + lc->last_recv_msg_ids=ms_list_free(lc->last_recv_msg_ids); linphone_core_free_payload_types(lc); ortp_exit(); diff --git a/coreapi/private.h b/coreapi/private.h index e6ed960bc..12909190f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -566,6 +566,7 @@ struct _LinphoneCore int max_calls; LinphoneTunnel *tunnel; char* device_id; + MSList *last_recv_msg_ids; }; LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc); diff --git a/coreapi/sal.h b/coreapi/sal.h index 54a075ed6..e5eb1c190 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -188,6 +188,13 @@ typedef struct SalMediaDescription{ bool_t ice_completed; } SalMediaDescription; +typedef struct SalMessage{ + const char *from; + const char *text; + const char *url; + const char *message_id; +}SalMessage; + #define SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES 5 SalMediaDescription *sal_media_description_new(); @@ -280,8 +287,7 @@ typedef void (*SalOnRegisterFailure)(SalOp *op, SalError error, SalReason reason typedef void (*SalOnVfuRequest)(SalOp *op); typedef void (*SalOnDtmfReceived)(SalOp *op, char dtmf); typedef void (*SalOnRefer)(Sal *sal, SalOp *op, const char *referto); -typedef void (*SalOnTextReceived)(Sal *sal, const char *from, const char *msg); -typedef void (*SalOnMessageExternalBodyReceived)(Sal *sal, const char *from, const char *url); +typedef void (*SalOnTextReceived)(Sal *sal, const SalMessage *msg); typedef void (*SalOnTextDeliveryUpdate)(SalOp *op, SalTextDeliveryStatus status); typedef void (*SalOnNotify)(SalOp *op, const char *from, const char *event); typedef void (*SalOnNotifyRefer)(SalOp *op, SalReferStatus state); @@ -307,7 +313,6 @@ typedef struct SalCallbacks{ SalOnDtmfReceived dtmf_received; SalOnRefer refer_received; SalOnTextReceived text_received; - SalOnMessageExternalBodyReceived message_external_body; SalOnTextDeliveryUpdate text_delivery_update; SalOnNotify notify; SalOnNotifyPresence notify_presence; diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index b83cc4f24..2f6d4ae80 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -343,8 +343,6 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs){ ctx->callbacks.text_received=(SalOnTextReceived)unimplemented_stub; if (ctx->callbacks.ping_reply==NULL) ctx->callbacks.ping_reply=(SalOnPingReply)unimplemented_stub; - if (ctx->callbacks.message_external_body==NULL) - ctx->callbacks.message_external_body=(SalOnMessageExternalBodyReceived)unimplemented_stub; } int sal_unlisten_ports(Sal *ctx){ @@ -1728,11 +1726,13 @@ static bool_t comes_from_local_if(osip_message_t *msg){ static void text_received(Sal *sal, eXosip_event_t *ev){ osip_body_t *body=NULL; - char *from=NULL,*msg; + char *from=NULL,*msg=NULL; osip_content_type_t* content_type; osip_uri_param_t* external_body_url; char unquoted_external_body_url [256]; int external_body_size=0; + SalMessage salmsg; + char message_id[256]={0}; content_type= osip_message_get_content_type(ev->request); if (!content_type) { @@ -1744,13 +1744,12 @@ static void text_received(Sal *sal, eXosip_event_t *ev){ && strcmp(content_type->type, "text")==0 && content_type->subtype && strcmp(content_type->subtype, "plain")==0 ) { - osip_message_get_body(ev->request,0,&body); - if (body==NULL){ - ms_error("Could not get text message from SIP body"); - return; - } - msg=body->body; - sal->callbacks.text_received(sal,from,msg); + osip_message_get_body(ev->request,0,&body); + if (body==NULL){ + ms_error("Could not get text message from SIP body"); + return; + } + msg=body->body; } if (content_type->type && strcmp(content_type->type, "message")==0 && content_type->subtype @@ -1762,11 +1761,18 @@ static void text_received(Sal *sal, eXosip_event_t *ev){ ,&external_body_url->gvalue[1] ,external_body_size=MIN(strlen(external_body_url->gvalue)-1,sizeof(unquoted_external_body_url))); unquoted_external_body_url[external_body_size-1]='\0'; - sal->callbacks.message_external_body(sal,from,unquoted_external_body_url); - } else { ms_warning("Unsupported content type [%s/%s]",content_type->type,content_type->subtype); + osip_free(from); + return; } + snprintf(message_id,sizeof(message_id)-1,"%s%s",ev->request->call_id->number,ev->request->cseq->number); + + salmsg.from=from; + salmsg.text=msg; + salmsg.url=external_body_size>0 ? unquoted_external_body_url : NULL; + salmsg.message_id=message_id; + sal->callbacks.text_received(sal,&salmsg); osip_free(from); } From 871acb0039a7c7a3d7849e83134ae37a1861d856 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 6 Nov 2012 10:52:46 +0100 Subject: [PATCH 691/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 832672303..f743c8b4a 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 83267230336a64dc4a005b29bf8baccf6a5fd2c2 +Subproject commit f743c8b4ab7ec010a96aa53f2e179cea69bfb4e6 From b986d67c4f795fae27965383b6ff31d9f5b41815 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 6 Nov 2012 14:44:16 +0100 Subject: [PATCH 692/769] Add mic gain db getter/setter Save playback/mic at config uninit --- coreapi/linphonecall.c | 8 ++++---- coreapi/linphonecore.c | 40 ++++++++++++++++++++++++++++++++++++---- coreapi/linphonecore.h | 4 +++- coreapi/private.h | 1 + 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 70395841a..6f8c06ef2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "private.h" #include #include - +#include #include "mediastreamer2/mediastream.h" #include "mediastreamer2/msvolume.h" @@ -1189,7 +1189,7 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){ } void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted){ - float mic_gain=lp_config_get_float(lc->config,"sound","mic_gain",1); + float mic_gain=lc->sound_conf.soft_mic_lev; float thres = 0; float recv_gain; float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05); @@ -1197,7 +1197,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0); if (!muted) - audio_stream_set_mic_gain(st,mic_gain); + linphone_core_set_mic_gain_db (lc, mic_gain); else audio_stream_set_mic_gain(st,0); @@ -1231,7 +1231,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute } if (st->volrecv){ /* parameters for a limited noise-gate effect, using echo limiter threshold */ - float floorgain = 1/mic_gain; + float floorgain = 1/pow(10,(mic_gain)/10); int spk_agc=lp_config_get_int(lc->config,"sound","speaker_agc_enabled",0); ms_filter_call_method(st->volrecv, MS_VOLUME_ENABLE_AGC, &spk_agc); ms_filter_call_method(st->volrecv,MS_VOLUME_SET_NOISE_GATE_THRESHOLD,&ng_thres); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 8de92f23b..1af9b08ca 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "lpconfig.h" #include "private.h" +#include #include #include #include "mediastreamer2/mediastream.h" @@ -425,7 +426,6 @@ static void sound_config_read(LinphoneCore *lc) int tmp; const char *tmpbuf; const char *devid; - float gain=0; #ifdef __linux /*alsadev let the user use custom alsa device within linphone*/ devid=lp_config_get_string(lc->config,"sound","alsadev",NULL); @@ -497,8 +497,8 @@ static void sound_config_read(LinphoneCore *lc) linphone_core_enable_agc(lc, lp_config_get_int(lc->config,"sound","agc",0)); - gain=lp_config_get_float(lc->config,"sound","playback_gain_db",0); - linphone_core_set_playback_gain_db (lc,gain); + linphone_core_set_playback_gain_db (lc,lp_config_get_float(lc->config,"sound","playback_gain_db",0)); + linphone_core_set_mic_gain_db (lc,lp_config_get_float(lc->config,"sound","mic_gain_db",0)); linphone_core_set_remote_ringback_tone (lc,lp_config_get_string(lc->config,"sound","ringback_tone",NULL)); @@ -3307,6 +3307,36 @@ void linphone_core_set_ring_level(LinphoneCore *lc, int level){ if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_PLAYBACK,level); } +/** + * Allow to control microphone level: gain in db + * + * @ingroup media_parameters +**/ +void linphone_core_set_mic_gain_db (LinphoneCore *lc, float gaindb){ + float gain=gaindb; + LinphoneCall *call=linphone_core_get_current_call (lc); + AudioStream *st; + + lc->sound_conf.soft_mic_lev=gaindb; + + if (call==NULL || (st=call->audiostream)==NULL){ + ms_message("linphone_core_set_mic_gain_db(): no active call."); + return; + } + if (st->volrecv){ + ms_filter_call_method(st->volsend,MS_VOLUME_SET_DB_GAIN,&gain); + }else ms_warning("Could not apply gain: gain control wasn't activated."); +} + +/** + * Get microphone gain in db. + * + * @ingroup media_parameters +**/ +float linphone_core_get_mic_gain_db(LinphoneCore *lc) { + return lc->sound_conf.soft_mic_lev; +} + /** * Allow to control play level before entering sound card: gain in db * @@ -3718,7 +3748,7 @@ void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){ } if (st!=NULL){ audio_stream_set_mic_gain(st, - (val==TRUE) ? 0 : lp_config_get_float(lc->config,"sound","mic_gain",1)); + (val==TRUE) ? 0 : pow(10,lc->sound_conf.soft_mic_lev/10)); if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){ audio_stream_mute_rtp(st,val); } @@ -4704,6 +4734,8 @@ static void sound_config_uninit(LinphoneCore *lc) ms_free(config->cards); lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring); + lp_config_set_float(lc->config,"sound","playback_gain_db",config->soft_play_lev); + lp_config_set_float(lc->config,"sound","mic_gain_db",config->soft_mic_lev); if (config->local_ring) ms_free(config->local_ring); if (config->remote_ring) ms_free(config->remote_ring); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 99ae480fc..306f6b70b 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1196,9 +1196,11 @@ int linphone_core_get_rec_level(LinphoneCore *lc); void linphone_core_set_ring_level(LinphoneCore *lc, int level); void linphone_core_set_play_level(LinphoneCore *lc, int level); +void linphone_core_set_mic_gain_db(LinphoneCore *lc, float level); +float linphone_core_get_mic_gain_db(LinphoneCore *lc); void linphone_core_set_playback_gain_db(LinphoneCore *lc, float level); - float linphone_core_get_playback_gain_db(LinphoneCore *lc); + void linphone_core_set_rec_level(LinphoneCore *lc, int level); const char * linphone_core_get_ringer_device(LinphoneCore *lc); const char * linphone_core_get_playback_device(LinphoneCore *lc); diff --git a/coreapi/private.h b/coreapi/private.h index 12909190f..60587dbcd 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -437,6 +437,7 @@ typedef struct sound_config const char **cards; int latency; /* latency in samples of the current used sound device */ float soft_play_lev; /*playback gain in db.*/ + float soft_mic_lev; /*mic gain in db.*/ char rec_lev; char play_lev; char ring_lev; From 313505bcaea68c9468d89007e933b29dac226284 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 6 Nov 2012 15:09:47 +0100 Subject: [PATCH 693/769] Save in config the values when set playback/mic gains --- coreapi/linphonecore.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1af9b08ca..0f5f7a7db 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3319,6 +3319,10 @@ void linphone_core_set_mic_gain_db (LinphoneCore *lc, float gaindb){ lc->sound_conf.soft_mic_lev=gaindb; + if (linphone_core_ready(lc)){ + lp_config_set_int(lc->config,"sound","mic_gain_db",lc->sound_conf.soft_mic_lev); + } + if (call==NULL || (st=call->audiostream)==NULL){ ms_message("linphone_core_set_mic_gain_db(): no active call."); return; @@ -3348,6 +3352,9 @@ void linphone_core_set_playback_gain_db (LinphoneCore *lc, float gaindb){ AudioStream *st; lc->sound_conf.soft_play_lev=gaindb; + if (linphone_core_ready(lc)){ + lp_config_set_int(lc->config,"sound","playback_gain_db",lc->sound_conf.soft_play_lev); + } if (call==NULL || (st=call->audiostream)==NULL){ ms_message("linphone_core_set_playback_gain_db(): no active call."); From 42b4cb544661f129d2959ca9faf492b9b90cf197 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 6 Nov 2012 15:15:41 +0100 Subject: [PATCH 694/769] Fix previous commit --- coreapi/linphonecore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0f5f7a7db..9200aadf8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3320,7 +3320,7 @@ void linphone_core_set_mic_gain_db (LinphoneCore *lc, float gaindb){ lc->sound_conf.soft_mic_lev=gaindb; if (linphone_core_ready(lc)){ - lp_config_set_int(lc->config,"sound","mic_gain_db",lc->sound_conf.soft_mic_lev); + lp_config_set_float(lc->config,"sound","mic_gain_db",lc->sound_conf.soft_mic_lev); } if (call==NULL || (st=call->audiostream)==NULL){ @@ -3353,7 +3353,7 @@ void linphone_core_set_playback_gain_db (LinphoneCore *lc, float gaindb){ lc->sound_conf.soft_play_lev=gaindb; if (linphone_core_ready(lc)){ - lp_config_set_int(lc->config,"sound","playback_gain_db",lc->sound_conf.soft_play_lev); + lp_config_set_float(lc->config,"sound","playback_gain_db",lc->sound_conf.soft_play_lev); } if (call==NULL || (st=call->audiostream)==NULL){ From 7b502e170b23b4dcbdb170554a15de92ac188ff3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 7 Nov 2012 10:13:48 +0100 Subject: [PATCH 695/769] Fix findPayloadType() without channels parameter. --- java/impl/org/linphone/core/LinphoneCoreImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 072934204..138dc41f3 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -745,7 +745,7 @@ class LinphoneCoreImpl implements LinphoneCore { @Override public PayloadType findPayloadType(String mime, int clockRate) { - return null; + return findPayloadType(mime, clockRate, 1); } private native void removeFriend(long ptr, long lf); From 10f0be4a29ca9f568b6a1da994cd3caa1ed83e21 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 7 Nov 2012 17:44:37 +0100 Subject: [PATCH 696/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index f743c8b4a..32e01d97d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f743c8b4ab7ec010a96aa53f2e179cea69bfb4e6 +Subproject commit 32e01d97d819cba4e16bd603f1dab33ef2a3a281 From b35e4774658ab2fe666c4b7ec2f93d8ebe59d91a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 8 Nov 2012 23:38:24 +0100 Subject: [PATCH 697/769] fix big bug in receiving of text message --- coreapi/sal_eXosip2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 2f6d4ae80..460463794 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1750,7 +1750,7 @@ static void text_received(Sal *sal, eXosip_event_t *ev){ return; } msg=body->body; - } if (content_type->type + }else if (content_type->type && strcmp(content_type->type, "message")==0 && content_type->subtype && strcmp(content_type->subtype, "external-body")==0 ) { @@ -1796,7 +1796,7 @@ static void other_request(Sal *sal, eXosip_event_t *ev){ }else ms_warning("Ignored REFER not coming from this local loopback interface."); }else if (strncmp(ev->request->sip_method, "UPDATE", 6) == 0){ inc_update(sal,ev); - }else { + }else { char *tmp=NULL; size_t msglen=0; osip_message_to_str(ev->request,&tmp,&msglen); From 3ac2d110e563a3902697445839f4061939f29191 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 9 Nov 2012 09:34:09 +0100 Subject: [PATCH 698/769] Microphone gain & U/D bandwidth in JNI --- coreapi/linphonecore_jni.cc | 21 +++++++++++++++++++ .../org/linphone/core/LinphoneCore.java | 6 ++++++ .../org/linphone/core/LinphoneCoreImpl.java | 15 +++++++++++++ 3 files changed, 42 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 85bd10259..a66a07b61 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -703,6 +703,27 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReacha return (jboolean)linphone_core_is_network_reachable((LinphoneCore*)lc); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jint bandwidth) { + linphone_core_set_upload_bandwidth((LinphoneCore*)lc,bandwidth); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadBandwidth(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jint bandwidth) { + linphone_core_set_download_bandwidth((LinphoneCore*)lc,bandwidth); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMicrophoneGain(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jfloat gain) { + linphone_core_set_microphone_gain_db((LinphoneCore*)lc,gain); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env ,jobject thiz ,jlong lc diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 49b15c369..51b6d029a 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -849,4 +849,10 @@ public interface LinphoneCore { * Once this time is elapsed (ringing included), the call is automatically hung up. **/ void setInCallTimeout(int timeout); + + void setUploadBandwidth(int bandwidth); + + void setDownloadBandwidth(int bandwidth); + + void setMicrophoneGain(float gain); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 138dc41f3..0a28af7d8 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -788,4 +788,19 @@ class LinphoneCoreImpl implements LinphoneCore { { setInCallTimeout(nativePtr, timeout); } + + private native void setUploadBandwidth(long ptr, int bandwidth); + public void setUploadBandwidth(int bandwidth) { + setUploadBandwidth(nativePtr, bandwidth); + } + + private native void setDownloadBandwidth(long ptr, int bandwidth); + public void setDownloadBandwidth(int bandwidth) { + setUploadBandwidth(nativePtr, bandwidth); + } + + private native void setMicrophoneGain(long ptr, float gain); + public void setMicrophoneGain(float gain) { + setUploadBandwidth(nativePtr, gain); + } } From c33f8fa5858cfb060f9a84f0b25ebef7e8853871 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 9 Nov 2012 09:37:25 +0100 Subject: [PATCH 699/769] Fix previous commit --- coreapi/linphonecore_jni.cc | 14 -------------- java/common/org/linphone/core/LinphoneCore.java | 4 ---- java/impl/org/linphone/core/LinphoneCoreImpl.java | 12 +----------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index a66a07b61..e469a8fca 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -703,20 +703,6 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReacha return (jboolean)linphone_core_is_network_reachable((LinphoneCore*)lc); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEnv* env - ,jobject thiz - ,jlong lc - ,jint bandwidth) { - linphone_core_set_upload_bandwidth((LinphoneCore*)lc,bandwidth); -} - -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadBandwidth(JNIEnv* env - ,jobject thiz - ,jlong lc - ,jint bandwidth) { - linphone_core_set_download_bandwidth((LinphoneCore*)lc,bandwidth); -} - extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMicrophoneGain(JNIEnv* env ,jobject thiz ,jlong lc diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 51b6d029a..fb49d3cb1 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -850,9 +850,5 @@ public interface LinphoneCore { **/ void setInCallTimeout(int timeout); - void setUploadBandwidth(int bandwidth); - - void setDownloadBandwidth(int bandwidth); - void setMicrophoneGain(float gain); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 0a28af7d8..320939da0 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -789,18 +789,8 @@ class LinphoneCoreImpl implements LinphoneCore { setInCallTimeout(nativePtr, timeout); } - private native void setUploadBandwidth(long ptr, int bandwidth); - public void setUploadBandwidth(int bandwidth) { - setUploadBandwidth(nativePtr, bandwidth); - } - - private native void setDownloadBandwidth(long ptr, int bandwidth); - public void setDownloadBandwidth(int bandwidth) { - setUploadBandwidth(nativePtr, bandwidth); - } - private native void setMicrophoneGain(long ptr, float gain); public void setMicrophoneGain(float gain) { - setUploadBandwidth(nativePtr, gain); + setMicrophoneGain(nativePtr, gain); } } From 2123621e5648cf37dce82b5bf812c167cb2b16e7 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 9 Nov 2012 09:40:32 +0100 Subject: [PATCH 700/769] Fix microphone gain db --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e469a8fca..c3893e496 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -707,7 +707,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMicrophoneGain(JNIEnv ,jobject thiz ,jlong lc ,jfloat gain) { - linphone_core_set_microphone_gain_db((LinphoneCore*)lc,gain); + linphone_core_set_mic_gain_db((LinphoneCore*)lc,gain); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env From 72f307c5563bc1d8c1033d8ad0f560d4d1f87874 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 9 Nov 2012 10:49:15 +0100 Subject: [PATCH 701/769] Fix compilation if git is not installed. --- coreapi/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 0c10c05da..a984799b9 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -117,6 +117,9 @@ make_gitversion_h: else \ $(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \ fi + if test ! -f $(srcdir)/$(GITVERSION_FILE) ; then \ + cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \ + fi if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \ cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \ fi From bcfc9a02e033ccc01b600b28ac3517edb3643e36 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 12 Nov 2012 12:22:20 +0100 Subject: [PATCH 702/769] update ms2 --- coreapi/sal_eXosip2.c | 1 + mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 460463794..0363ddb2b 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1747,6 +1747,7 @@ static void text_received(Sal *sal, eXosip_event_t *ev){ osip_message_get_body(ev->request,0,&body); if (body==NULL){ ms_error("Could not get text message from SIP body"); + osip_free(from); return; } msg=body->body; diff --git a/mediastreamer2 b/mediastreamer2 index 32e01d97d..7541f5483 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 32e01d97d819cba4e16bd603f1dab33ef2a3a281 +Subproject commit 7541f5483ac6a427b04fb0f250a2a8149136e620 From 7b95eead97161c6016dc868a6a0a3f68dc39083d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 12 Nov 2012 21:26:29 +0100 Subject: [PATCH 703/769] sip dscp wasn't taken into account immediately. --- coreapi/linphonecore.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 381a60258..f3d0a0030 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -566,6 +566,8 @@ static void sip_config_read(LinphoneCore *lc) sal_set_root_ca(lc->sal, lp_config_get_string(lc->config,"sip","root_ca", ROOT_CA_FILE)); #endif linphone_core_verify_server_certificates(lc,lp_config_get_int(lc->config,"sip","verify_server_certs",TRUE)); + /*setting the dscp must be done before starting the transports, otherwise it is not taken into effect*/ + sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc)); /*start listening on ports*/ linphone_core_set_sip_transports(lc,&tr); @@ -634,7 +636,6 @@ static void sip_config_read(LinphoneCore *lc) sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period); sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0)); sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1)); - sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc)); sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0)); } @@ -5316,8 +5317,10 @@ const char* linphone_core_get_device_identifier(const LinphoneCore *lc) { **/ void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp){ sal_set_dscp(lc->sal,dscp); - if (linphone_core_ready(lc)) + if (linphone_core_ready(lc)){ lp_config_set_int_hex(lc->config,"sip","dscp",dscp); + apply_transports(lc); + } } /** From b2baba7e4d3c8866c1ebd098f1c2214df6d75c47 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 13 Nov 2012 17:13:59 +0100 Subject: [PATCH 704/769] Update ms2 submodule for WebRTC echo canceller. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7541f5483..e0cf802a9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7541f5483ac6a427b04fb0f250a2a8149136e620 +Subproject commit e0cf802a93c744350dfd12b15d48ccadf033291b From 8712757602d7fc6d80a1d0d61d9af70473782b00 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 14 Nov 2012 11:44:14 +0100 Subject: [PATCH 705/769] Update submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index e0cf802a9..709b5f4d6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e0cf802a93c744350dfd12b15d48ccadf033291b +Subproject commit 709b5f4d68b714619e0ef50cacbb4a63c5717d21 diff --git a/oRTP b/oRTP index ddc4f7d04..88ace8adf 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit ddc4f7d041967305483761fc9c643d3bb290a5f1 +Subproject commit 88ace8adfecde4d03ea9030d625f6949f4f5fab4 From 486492c448b36feccd15e59b3cc1c2bab7b03682 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 14 Nov 2012 14:02:30 +0100 Subject: [PATCH 706/769] update ms2 and ortp --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index e0cf802a9..9e76d92b8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e0cf802a93c744350dfd12b15d48ccadf033291b +Subproject commit 9e76d92b88d1359cbea328ef1350bd6c010eab7f diff --git a/oRTP b/oRTP index ddc4f7d04..88ace8adf 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit ddc4f7d041967305483761fc9c643d3bb290a5f1 +Subproject commit 88ace8adfecde4d03ea9030d625f6949f4f5fab4 From 6b32d7d6c6af200b9ae01640b9412e45722790d9 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 15 Nov 2012 11:30:31 +0100 Subject: [PATCH 707/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 709b5f4d6..70aaa23d9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 709b5f4d68b714619e0ef50cacbb4a63c5717d21 +Subproject commit 70aaa23d9cc52a97438301d8b8fb28312c6a50c9 From eeb4b52d1e8b12c0b1096775be41774dc6bd61b6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 16 Nov 2012 14:20:59 +0100 Subject: [PATCH 708/769] JNI glue for linphone_core_set_primary_contact --- coreapi/linphonecore_jni.cc | 16 ++++++++++++++++ java/common/org/linphone/core/LinphoneCore.java | 5 +++++ .../impl/org/linphone/core/LinphoneCoreImpl.java | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index c3893e496..55041b17a 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -542,6 +542,22 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env delete lcData; } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv* env, jobject thiz, jlong lc, jstring jdisplayname, jstring jusername) { + const char* displayname = env->GetStringUTFChars(jdisplayname, NULL); + const char* username = env->GetStringUTFChars(jusername, NULL); + + LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed((LinphoneCore*)lc); + if (parsed != NULL) { + linphone_address_set_display_name(parsed, displayname); + linphone_address_set_username(parsed, username); + char *contact = linphone_address_as_string(parsed); + linphone_core_set_primary_contact((LinphoneCore*)lc, contact); + } + + env->ReleaseStringUTFChars(jdisplayname, displayname); + env->ReleaseStringUTFChars(jusername, username); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) { linphone_core_clear_proxy_config((LinphoneCore*)lc); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index fb49d3cb1..450091843 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -851,4 +851,9 @@ public interface LinphoneCore { void setInCallTimeout(int timeout); void setMicrophoneGain(float gain); + + /** + * Set username and display name to use if no LinphoneProxyConfig configured + */ + void setPrimaryContact(String displayName, String username); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 320939da0..5e6864559 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -116,6 +116,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setVideoPortRange(long nativePtr, int minPort, int maxPort); private native void setIncomingTimeout(long nativePtr, int timeout); private native void setInCallTimeout(long nativePtr, int timeout); + private native void setPrimaryContact(long nativePtr, String displayName, String username); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -793,4 +794,8 @@ class LinphoneCoreImpl implements LinphoneCore { public void setMicrophoneGain(float gain) { setMicrophoneGain(nativePtr, gain); } + + public void setPrimaryContact(String displayName, String username) { + setPrimaryContact(nativePtr, displayName, username); + } } From 08dadabca9cd60b062521cb0fcf47f67d4ceb23d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 16 Nov 2012 15:26:08 +0100 Subject: [PATCH 709/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 70aaa23d9..5471aec78 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 70aaa23d9cc52a97438301d8b8fb28312c6a50c9 +Subproject commit 5471aec785f634aa363d6e9de530fc5614cf09d2 From 7c59efad878e252bdbabb4f3ed056a4fe3a59265 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 19 Nov 2012 14:04:08 +0100 Subject: [PATCH 710/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 5471aec78..1450b2cb8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5471aec785f634aa363d6e9de530fc5614cf09d2 +Subproject commit 1450b2cb8182f4c75f27aec893d7e365d3dc3d6b From fb9fa2aa00c65826f51532a0478a6a2704919ca7 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 19 Nov 2012 12:22:41 +0100 Subject: [PATCH 711/769] fix for lc->last_recv_msg_ids size limit --- coreapi/callbacks.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index f99c9b224..134c336ab 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -781,19 +781,21 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){ MSList *elem=lc->last_recv_msg_ids; + MSList *tail=NULL; int i; bool_t is_duplicate=FALSE; for(i=0;elem!=NULL;elem=elem->next,i++){ if (strcmp((const char*)elem->data,msg_id)==0){ is_duplicate=TRUE; } + tail=elem; } if (!is_duplicate){ lc->last_recv_msg_ids=ms_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id)); } if (i>=10){ - ms_free(elem->data); - ms_list_remove_link(lc->last_recv_msg_ids,elem); + ms_free(tail->data); + lc->last_recv_msg_ids=ms_list_remove_link(lc->last_recv_msg_ids,tail); } return is_duplicate; } From 2c5421f22e37952123d4cd06bf3b13da80a1e86f Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 19 Nov 2012 12:23:13 +0100 Subject: [PATCH 712/769] add more dial plan support --- coreapi/proxy.c | 233 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 226 insertions(+), 7 deletions(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 718f7b0f5..864a23441 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -378,14 +378,233 @@ typedef struct dial_plan{ }dial_plan_t; /* TODO: fill with information for all countries over the world*/ -static dial_plan_t const dial_plans[]={ - {"France" ,"FR" , "33" , 9 , "00" }, - {"United States" ,"US" , "1" , 10 , "011" }, - {"Turkey" ,"TR" , "90" , 10 , "00" }, - {"Switzerland" ,"XK" , "41" , 9 , "00" }, - {NULL ,NULL,"" , 0 , NULL } -}; +static dial_plan_t const dial_plans[]={ + {"Afghanistan" ,"AF" , "93" , 9 , "00" }, + {"Albania" ,"AL" , "355" , 9 , "00" }, + {"Algeria" ,"DZ" , "213" , 9 , "00" }, + {"American Samoa" ,"AS" , "1" , 10 , "011" }, + {"Andorra" ,"AD" , "376" , 6 , "00" }, + {"Angola" ,"AO" , "244" , 9 , "00" }, + {"Anguilla" ,"AI" , "1" , 10 , "011" }, + {"Antigua and Barbuda" ,"AG" , "1" , 10 , "011" }, + {"Argentina" ,"AR" , "54" , 10 , "00" }, + {"Armenia" ,"AM" , "374" , 8 , "00" }, + {"Aruba" ,"AW" , "297" , 7 , "011" }, + {"Australia" ,"AU" , "61" , 9 , "0011"}, + {"Austria" ,"AT" , "43" , 10 , "00" }, + {"Azerbaijan" ,"AZ" , "994" , 9 , "00" }, + {"Bahamas" ,"BS" , "1" , 10 , "011" }, + {"Bahrain" ,"BH" , "973" , 8 , "00" }, + {"Bangladesh" ,"BD" , "880" , 10 , "00" }, + {"Barbados" ,"BB" , "1" , 10 , "011" }, + {"Belarus" ,"BY" , "375" , 9 , "00" }, + {"Belgium" ,"BE" , "32" , 9 , "00" }, + {"Belize" ,"BZ" , "501" , 7 , "00" }, + {"Benin" ,"BJ" , "229" , 8 , "00" }, + {"Bermuda" ,"BM" , "1" , 10 , "011" }, + {"Bhutan" ,"BT" , "975" , 8 , "00" }, + {"Bolivia" ,"BO" , "591" , 8 , "00" }, + {"Bosnia and Herzegovina" ,"BA" , "387" , 8 , "00" }, + {"Botswana" ,"BW" , "267" , 8 , "00" }, + {"Brazil" ,"BR" , "55" , 10 , "00" }, + {"Brunei Darussalam" ,"BN" , "673" , 7 , "00" }, + {"Bulgaria" ,"BG" , "359" , 9 , "00" }, + {"Burkina Faso" ,"BF" , "226" , 8 , "00" }, + {"Burundi" ,"BI" , "257" , 8 , "011" }, + {"Cambodia" ,"KH" , "855" , 9 , "00" }, + {"Cameroon" ,"CM" , "237" , 8 , "00" }, + {"Canada" ,"CA" , "1" , 10 , "011" }, + {"Cape Verde" ,"CV" , "238" , 7 , "00" }, + {"Cayman Islands" ,"KY" , "1" , 10 , "011" }, + {"Central African Republic" ,"CF" , "236" , 8 , "00" }, + {"Chad" ,"TD" , "235" , 8 , "00" }, + {"Chile" ,"CL" , "56" , 9 , "00" }, + {"China" ,"CN" , "86" , 11 , "00" }, + {"Colombia" ,"CO" , "57" , 10 , "00" }, + {"Comoros" ,"KM" , "269" , 7 , "00" }, + {"Congo" ,"CG" , "242" , 9 , "00" }, + {"Congo Democratic Republic" ,"CD" , "243" , 9 , "00" }, + {"Cook Islands" ,"CK" , "682" , 5 , "00" }, + {"Costa Rica" ,"CR" , "506" , 8 , "00" }, + {"C™te d'Ivoire" ,"AD" , "225" , 8 , "00" }, + {"Croatia" ,"HR" , "385" , 9 , "00" }, + {"Cuba" ,"CU" , "53" , 8 , "119" }, + {"Cyprus" ,"CY" , "357" , 8 , "00" }, + {"Czech Republic" ,"CZ" , "420" , 9 , "00" }, + {"Denmark" ,"DK" , "45" , 8 , "00" }, + {"Djibouti" ,"DJ" , "253" , 8 , "00" }, + {"Dominica" ,"DM" , "1" , 10 , "011" }, + {"Dominican Republic" ,"DO" , "1" , 10 , "011" }, + {"Ecuador" ,"EC" , "593" , 9 , "00" }, + {"Egypt" ,"EG" , "20" , 10 , "00" }, + {"El Salvador" ,"SV" , "503" , 8 , "00" }, + {"Equatorial Guinea" ,"GQ" , "240" , 9 , "00" }, + {"Eritrea" ,"ER" , "291" , 7 , "00" }, + {"Estonia" ,"EE" , "372" , 8 , "00" }, + {"Ethiopia" ,"ET" , "251" , 9 , "00" }, + {"Falkland Islands" ,"FK" , "500" , 5 , "00" }, + {"Faroe Islands" ,"FO" , "298" , 6 , "00" }, + {"Fiji" ,"FJ" , "679" , 7 , "00" }, + {"Finland" ,"FI" , "358" , 9 , "00" }, + {"France" ,"FR" , "33" , 9 , "00" }, + {"French Guiana" ,"GF" , "594" , 9 , "00" }, + {"French Polynesia" ,"PF" , "689" , 6 , "00" }, + {"Gabon" ,"GA" , "241" , 8 , "00" }, + {"Gambia" ,"GM" , "220" , 7 , "00" }, + {"Georgia" ,"GE" , "995" , 9 , "00" }, + {"Germany" ,"DE" , "49" , 11 , "00" }, + {"Ghana" ,"GH" , "233" , 9 , "00" }, + {"Gibraltar" ,"GI" , "350" , 8 , "00" }, + {"Greece" ,"GR" , "30" ,10 , "00" }, + {"Greenland" ,"GL" , "299" , 6 , "00" }, + {"Grenada" ,"GD" , "1" , 10 , "011" }, + {"Guadeloupe" ,"GP" , "590" , 9 , "00" }, + {"Guam" ,"GU" , "1" , 10 , "011" }, + {"Guatemala" ,"GT" , "502" , 8 , "00" }, + {"Guinea" ,"GN" , "224" , 8 , "00" }, + {"Guinea-Bissau" ,"GW" , "245" , 7 , "00" }, + {"Guyana" ,"GY" , "592" , 7 , "001" }, + {"Haiti" ,"HT" , "509" , 8 , "00" }, + {"Honduras" ,"HN" , "504" , 8 , "00" }, + {"Hong Kong" ,"HK" , "852" , 8 , "001" }, + {"Hungary" ,"HU" , "36" , 9 , "00" }, + {"Iceland" ,"IS" , "354" , 9 , "00" }, + {"India" ,"IN" , "91" , 10 , "00" }, + {"Indonesia" ,"ID" , "62" , 10 , "001" }, + {"Iran" ,"IR" , "98" , 10 , "00" }, + {"Iraq" ,"IQ" , "964" , 10 , "00" }, + {"Ireland" ,"IE" , "353" , 9 , "00" }, + {"Israel" ,"IL" , "972" , 9 , "00" }, + {"Italy" ,"IT" , "39" , 10 , "00" }, + {"Jamaica" ,"JM" , "1" , 10 , "011" }, + {"Japan" ,"JP" , "81" , 10 , "010" }, + {"Jordan" ,"JO" , "962" , 9 , "00" }, + {"Kazakhstan" ,"KZ" , "7" , 10 , "00" }, + {"Kenya" ,"KE" , "254" , 9 , "000" }, + {"Kiribati" ,"KI" , "686" , 5 , "00" }, + {"Korea, North" ,"KP" , "850" , 12 , "99" }, + {"Korea, South" ,"KR" , "82" , 12 , "001" }, + {"Kuwait" ,"KW" , "965" , 8 , "00" }, + {"Kyrgyzstan" ,"KG" , "996" , 9 , "00" }, + {"Laos" ,"LA" , "856" , 10 , "00" }, + {"Latvia" ,"LV" , "371" , 8 , "00" }, + {"Lebanon" ,"LB" , "961" , 7 , "00" }, + {"Lesotho" ,"LS" , "266" , 8 , "00" }, + {"Liberia" ,"LR" , "231" , 8 , "00" }, + {"Libya" ,"LY" , "218" , 8 , "00" }, + {"Liechtenstein" ,"LI" , "423" , 7 , "00" }, + {"Lithuania" ,"LT" , "370" , 8 , "00" }, + {"Luxembourg" ,"LU" , "352" , 9 , "00" }, + {"Macau" ,"MO" , "853" , 8 , "00" }, + {"Macedonia" ,"MK" , "389" , 8 , "00" }, + {"Madagascar" ,"MG" , "261" , 9 , "00" }, + {"Malawi" ,"MW" , "265" , 9 , "00" }, + {"Malaysia" ,"MY" , "60" , 9 , "00" }, + {"Maldives" ,"MV" , "960" , 7 , "00" }, + {"Mali" ,"ML" , "223" , 8 , "00" }, + {"Malta" ,"MT" , "356" , 8 , "00" }, + {"Marshall Islands" ,"MH" , "692" , 7 , "011" }, + {"Martinique" ,"MQ" , "596" , 9 , "00" }, + {"Mauritania" ,"MR" , "222" , 8 , "00" }, + {"Mauritius" ,"MU" , "230" , 7 , "00" }, + {"Mayotte Island" ,"YT" , "262" , 9 , "00" }, + {"Mexico" ,"MX" , "52" , 10 , "00" }, + {"Micronesia" ,"FM" , "691" , 7 , "011" }, + {"Moldova" ,"MD" , "373" , 8 , "00" }, + {"Monaco" ,"MC" , "377" , 8 , "00" }, + {"Mongolia" ,"MN" , "976" , 8 , "001" }, + {"Montenegro" ,"ME" , "382" , 8 , "00" }, + {"Montserrat" ,"MS" , "664" , 10 , "011" }, + {"Morocco" ,"MA" , "212" , 9 , "00" }, + {"Mozambique" ,"MZ" , "258" , 9 , "00" }, + {"Myanmar" ,"MM" , "95" , 8 , "00" }, + {"Namibia" ,"NA" , "264" , 9 , "00" }, + {"Nauru" ,"NR" , "674" , 7 , "00" }, + {"Nepal" ,"NP" , "43" , 10 , "00" }, + {"Netherlands" ,"NL" , "31" , 9 , "00" }, + {"New Caledonia" ,"NC" , "687" , 6 , "00" }, + {"New Zealand" ,"NZ" , "64" , 10 , "00" }, + {"Nicaragua" ,"NI" , "505" , 8 , "00" }, + {"Niger" ,"NE" , "227" , 8 , "00" }, + {"Nigeria" ,"NG" , "234" , 10 , "009" }, + {"Niue" ,"NU" , "683" , 4 , "00" }, + {"Norfolk Island" ,"NF" , "672" , 5 , "00" }, + {"Northern Mariana Islands" ,"MP" , "1" , 10 , "011" }, + {"Norway" ,"NO" , "47" , 8 , "00" }, + {"Oman" ,"OM" , "968" , 8 , "00" }, + {"Pakistan" ,"PK" , "92" , 10 , "00" }, + {"Palau" ,"PW" , "680" , 7 , "011" }, + {"Palestine" ,"PS" , "970" , 9 , "00" }, + {"Panama" ,"PA" , "507" , 8 , "00" }, + {"Papua New Guinea" ,"PG" , "675" , 8 , "00" }, + {"Paraguay" ,"PY" , "595" , 9 , "00" }, + {"Peru" ,"PE" , "51" , 9 , "00" }, + {"Philippines" ,"PH" , "63" , 10 , "00" }, + {"Poland" ,"PL" , "48" , 9 , "00" }, + {"Portugal" ,"PT" , "351" , 9 , "00" }, + {"Puerto Rico" ,"PR" , "1" , 10 , "011" }, + {"Qatar" ,"QA" , "974" , 8 , "00" }, + {"RŽunion Island" ,"RE" , "262" , 9 , "011" }, + {"Romania" ,"RO" , "40" , 9 , "00" }, + {"Russian Federation" ,"RU" , "7" , 10 , "8" }, + {"Rwanda" ,"RW" , "250" , 9 , "00" }, + {"Saint Helena" ,"SH" , "290" , 4 , "00" }, + {"Saint Kitts and Nevis" ,"KN" , "1" , 10 , "011" }, + {"Saint Lucia" ,"LC" , "1" , 10 , "011" }, + {"Saint Pierre and Miquelon" ,"PM" , "508" , 6 , "00" }, + {"Saint Vincent and the Grenadines","VC" , "1" , 10 , "011" }, + {"Samoa" ,"WS" , "685" , 7 , "0" }, + {"San Marino" ,"SM" , "378" , 10 , "00" }, + {"S‹o TomŽ and Pr’ncipe" ,"ST" , "239" , 7 , "00" }, + {"Saudi Arabia" ,"SA" , "966" , 9 , "00" }, + {"Senegal" ,"SN" , "221" , 9 , "00" }, + {"Serbia" ,"RS" , "381" , 9 , "00" }, + {"Seychelles" ,"SC" , "248" , 7 , "00" }, + {"Sierra Leone" ,"SL" , "232" , 8 , "00" }, + {"Singapore" ,"SG" , "65" , 8 , "001" }, + {"Slovakia" ,"SK" , "421" , 9 , "00" }, + {"Slovenia" ,"SI" , "386" , 8 , "00" }, + {"Solomon Islands" ,"SB" , "677" , 7 , "00" }, + {"Somalia" ,"SO" , "252" , 8 , "00" }, + {"South Africa" ,"ZA" , "27" , 9 , "00" }, + {"Spain" ,"ES" , "34" , 9 , "00" }, + {"Sri Lanka" ,"LK" , "94" , 9 , "00" }, + {"Sudan" ,"SD" , "249" , 9 , "00" }, + {"Suriname" ,"SR" , "597" , 7 , "00" }, + {"Swaziland" ,"SZ" , "268" , 8 , "00" }, + {"Sweden" ,"SE" , "1" , 9 , "00" }, + {"Switzerland" ,"XK" , "41" , 9 , "00" }, + {"Syria" ,"SY" , "963" , 9 , "00" }, + {"Taiwan" ,"TW" , "886" , 9 , "810" }, + {"Tajikistan" ,"TJ" , "992" , 9 , "002" }, + {"Tanzania" ,"TZ" , "255" , 9 , "000" }, + {"Thailand" ,"TH" , "66" , 9 , "001" }, + {"Togo" ,"TG" , "228" , 8 , "00" }, + {"Tokelau" ,"TK" , "690" , 4 , "00" }, + {"Tonga" ,"TO" , "676" , 5 , "00" }, + {"Trinidad and Tobago" ,"TT" , "1" , 10 , "011" }, + {"Tunisia" ,"TN" , "216" , 8 , "00" }, + {"Turkey" ,"TR" , "90" , 10 , "00" }, + {"Turkmenistan" ,"TM" , "993" , 8 , "00" }, + {"Turks and Caicos Islands" ,"TC" , "1" , 7 , "0" }, + {"Tuvalu" ,"TV" , "688" , 5 , "00" }, + {"Uganda" ,"UG" , "256" , 9 , "000" }, + {"Ukraine" ,"UA" , "380" , 9 , "00" }, + {"United Arab Emirates" ,"AE" , "971" , 9 , "00" }, + {"United Kingdom" ,"UK" , "44" , 10 , "00" }, + {"United States" ,"US" , "1" , 10 , "011" }, + {"Uruguay" ,"UY" , "598" , 8 , "00" }, + {"Uzbekistan" ,"UZ" , "998" , 9 , "8" }, + {"Vanuatu" ,"VU" , "678" , 7 , "00" }, + {"Venezuela" ,"VE" , "58" , 10 , "00" }, + {"Vietnam" ,"VN" , "84" , 9 , "00" }, + {"Wallis and Futuna" ,"WF" , "681" , 5 , "00" }, + {"Yemen" ,"YE" , "967" , 9 , "00" }, + {"Zambia" ,"ZM" , "260" , 9 , "00" }, + {"Zimbabwe" ,"ZW" , "263" , 9 , "00" }, + {NULL ,NULL , "" , 0 , NULL } +}; static dial_plan_t most_common_dialplan={ "generic" ,"", "", 10, "00"}; int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) { From 2d019536da933d707059084f64ce4e073246b7db Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 20 Nov 2012 16:35:16 +0100 Subject: [PATCH 713/769] Update ms2 submodule for native Android sound module. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1450b2cb8..079789162 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1450b2cb8182f4c75f27aec893d7e365d3dc3d6b +Subproject commit 0797891627ac48cec1fe35940183cd052fdf85c9 From 362d77908ae82c67eb61f5038ff048f9125984b5 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 21 Nov 2012 12:16:17 +0100 Subject: [PATCH 714/769] Call zoom video: check output nullity --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 6f8c06ef2..e0b0174ad 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2105,7 +2105,7 @@ bool_t linphone_call_is_in_conference(const LinphoneCall *call) { **/ void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) { VideoStream* vstream = call->videostream; - if (vstream) { + if (vstream && vstream->output) { float zoom[3]; if (zoom_factor < 1) From 06d8cec790d74bfbd374db9b10bfec83207a71ba Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 22 Nov 2012 11:36:29 +0100 Subject: [PATCH 715/769] Add checks to prevent crashes. The getReceiverInterarrivalJitter() function may be called before the used audio codec is known in case of early media, so test that the payload type is valid before using it. --- coreapi/linphonecore_jni.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 55041b17a..03d5c0df0 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1372,6 +1372,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarr pt = linphone_call_params_get_used_audio_codec(params); else pt = linphone_call_params_get_used_video_codec(params); + if (!pt || (pt->clock_rate == 0)) + return (jfloat)0.0; return (jfloat)((float)report_block_get_interarrival_jitter(srb) / (float)pt->clock_rate); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { @@ -1399,6 +1401,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverIntera pt = linphone_call_params_get_used_audio_codec(params); else pt = linphone_call_params_get_used_video_codec(params); + if (!pt || (pt->clock_rate == 0)) + return (jfloat)0.0; return (jfloat)((float)report_block_get_interarrival_jitter(rrb) / (float)pt->clock_rate); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getRoundTripDelay(JNIEnv *env, jobject thiz, jlong stats_ptr) { From cfa2e64b0b6ccc78c8df7716676bfa73ef4ff634 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 22 Nov 2012 17:39:36 +0100 Subject: [PATCH 716/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 079789162..fd650dfd9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0797891627ac48cec1fe35940183cd052fdf85c9 +Subproject commit fd650dfd92c307a35f1820e157dba5d1b185ede6 From d0745a39f291758c8b6d1fedeb4dc064196bfb8e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 22 Nov 2012 22:01:16 +0100 Subject: [PATCH 717/769] better srtp management - have the choice to keep same keys accross reINVITEs - don't restart the stream for minor changes like removal of a recv-only codec. --- coreapi/linphonecall.c | 70 +++++++++++++++++++----------------------- coreapi/linphonecore.c | 14 ++++----- coreapi/private.h | 5 +-- coreapi/sal.c | 10 ++++++ 4 files changed, 49 insertions(+), 50 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index e0b0174ad..d8fdd8803 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -208,22 +208,23 @@ static void update_media_description_from_stun(SalMediaDescription *md, const St } - -static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, LinphoneCall *call, unsigned int session_id, unsigned int session_ver){ +void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call){ MSList *l; PayloadType *pt; + SalMediaDescription *old_md=call->localdesc; int i; const char *me=linphone_core_get_identity(lc); LinphoneAddress *addr=linphone_address_new(me); const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); + bool_t keep_srtp_keys=lp_config_get_int(lc->config,"sip","keep_srtp_keys",0); if (call->ping_time>0) { linphone_core_adapt_to_network(lc,call->ping_time,&call->params); } - md->session_id=session_id; - md->session_ver=session_ver; + md->session_id=(old_md ? old_md->session_id : (rand() & 0xfff)); + md->session_ver=(old_md ? (old_md->session_ver+1) : (rand() & 0xfff)); md->nstreams=1; strncpy(md->addr,call->localip,sizeof(md->addr)); strncpy(md->username,username,sizeof(md->username)); @@ -248,8 +249,6 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event")); l=ms_list_append(l,pt); md->streams[0].payloads=l; - - if (call->params.has_video){ md->nstreams++; @@ -263,15 +262,22 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li for(i=0; instreams; i++) { if (md->streams[i].proto == SalProtoRtpSavp) { - md->streams[i].crypto[0].tag = 1; - md->streams[i].crypto[0].algo = AES_128_SHA1_80; - if (!generate_b64_crypto_key(30, md->streams[i].crypto[0].master_key)) - md->streams[i].crypto[0].algo = 0; - md->streams[i].crypto[1].tag = 2; - md->streams[i].crypto[1].algo = AES_128_SHA1_32; - if (!generate_b64_crypto_key(30, md->streams[i].crypto[1].master_key)) - md->streams[i].crypto[1].algo = 0; - md->streams[i].crypto[2].algo = 0; + if (keep_srtp_keys && old_md && old_md->streams[i].proto==SalProtoRtpSavp){ + int j; + for(j=0;jstreams[i].crypto[j],&old_md->streams[i].crypto[j],sizeof(SalSrtpCryptoAlgo)); + } + }else{ + md->streams[i].crypto[0].tag = 1; + md->streams[i].crypto[0].algo = AES_128_SHA1_80; + if (!generate_b64_crypto_key(30, md->streams[i].crypto[0].master_key)) + md->streams[i].crypto[0].algo = 0; + md->streams[i].crypto[1].tag = 2; + md->streams[i].crypto[1].algo = AES_128_SHA1_32; + if (!generate_b64_crypto_key(30, md->streams[i].crypto[1].master_key)) + md->streams[i].crypto[1].algo = 0; + md->streams[i].crypto[2].algo = 0; + } } } update_media_description_from_stun(md,&call->ac,&call->vc); @@ -280,22 +286,8 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li linphone_core_update_ice_state_in_call_stats(call); } linphone_address_destroy(addr); - return md; -} - -void update_local_media_description(LinphoneCore *lc, LinphoneCall *call){ - SalMediaDescription *md=call->localdesc; - if (md== NULL) { - call->localdesc = create_local_media_description(lc,call); - } else { - call->localdesc = _create_local_media_description(lc,call,md->session_id,md->session_ver+1); - sal_media_description_unref(md); - } -} - -SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call){ - unsigned int id=rand() & 0xfff; - return _create_local_media_description(lc,call,id,id); + call->localdesc=md; + if (old_md) sal_media_description_unref(old_md); } static int find_port_offset(LinphoneCore *lc, SalStreamType type){ @@ -1026,11 +1018,11 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u ms_warning("Case is MS_VIDEO_DECODER_DECODING_ERRORS"); linphone_call_send_vfu_request(call); break; - case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED: - ms_message("First video frame decoded successfully"); - if (call->nextVideoFrameDecoded._func != NULL) - call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data); - break; + case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED: + ms_message("First video frame decoded successfully"); + if (call->nextVideoFrameDecoded._func != NULL) + call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data); + break; default: ms_warning("Unhandled event %i", event_id); break; @@ -1039,10 +1031,10 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u #endif void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data) { - call->nextVideoFrameDecoded._func = cb; - call->nextVideoFrameDecoded._user_data = user_data; + call->nextVideoFrameDecoded._func = cb; + call->nextVideoFrameDecoded._user_data = user_data; #ifdef VIDEO_ENABLED - ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION); + ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION); #endif } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f3d0a0030..01667ebcb 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2290,7 +2290,7 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){ linphone_call_init_media_streams(call); if (lc->ringstream==NULL) audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); - call->localdesc=create_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); if (!lc->sip_conf.sdp_200_ack){ call->media_pending=TRUE; sal_call_set_local_media_description(call->op,call->localdesc); @@ -2552,7 +2552,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE); const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc); - call->localdesc=create_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); sal_call_set_local_media_description(call->op,call->localdesc); md=sal_call_get_final_media_description(call->op); if (md && sal_media_description_empty(md)){ @@ -2658,7 +2658,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho call->videostream->ice_check_list = NULL; } call->params = *params; - update_local_media_description(lc, call); + linphone_call_make_local_media_description(lc, call); if ((call->ice_session != NULL) && !has_video && call->params.has_video) { /* Defer call update until the ICE candidates gathering process has finished. */ ms_message("Defer call update to gather ICE candidates"); @@ -2769,7 +2769,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const } call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); call->camera_active=call->params.has_video; - update_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); if (call->ice_session != NULL) { linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); #ifdef VIDEO_ENABLED @@ -2885,7 +2885,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, call->params=*params; call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); call->camera_active=call->params.has_video; - update_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); sal_call_set_local_media_description(call->op,call->localdesc); } @@ -3075,7 +3075,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call) ms_warning("Cannot pause this call, it is not active."); return -1; } - update_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); if (call->ice_session != NULL) linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); if (sal_media_description_has_dir(call->resultdesc,SalStreamSendRecv)){ @@ -3154,7 +3154,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call) prevents the participants to hear it while the 200OK comes back.*/ if (call->audiostream) audio_stream_play(call->audiostream, NULL); - update_local_media_description(lc,the_call); + linphone_call_make_local_media_description(lc,the_call); if (call->ice_session != NULL) linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); sal_call_set_local_media_description(call->op,call->localdesc); diff --git a/coreapi/private.h b/coreapi/private.h index 60587dbcd..5ebe8b5b7 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -582,10 +582,7 @@ int linphone_core_set_as_current_call(LinphoneCore *lc, LinphoneCall *call); int linphone_core_get_calls_nb(const LinphoneCore *lc); void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message); - -SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call); -void update_local_media_description(LinphoneCore *lc, LinphoneCall *call); - +void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *new_md); bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, PayloadType *pt, int bandwidth_limit); diff --git a/coreapi/sal.c b/coreapi/sal.c index 229ee577f..f46d9a556 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -162,6 +162,10 @@ static bool_t payload_type_equals(const PayloadType *p1, const PayloadType *p2){ return TRUE; } +static bool_t is_recv_only(PayloadType *p){ + return (p->flags & PAYLOAD_TYPE_FLAG_CAN_RECV) && ! (p->flags & PAYLOAD_TYPE_FLAG_CAN_SEND); +} + static bool_t payload_list_equals(const MSList *l1, const MSList *l2){ const MSList *e1,*e2; for(e1=l1,e2=l2;e1!=NULL && e2!=NULL; e1=e1->next,e2=e2->next){ @@ -170,6 +174,12 @@ static bool_t payload_list_equals(const MSList *l1, const MSList *l2){ if (!payload_type_equals(p1,p2)) return FALSE; } + if (e1!=NULL){ + /*skip possible recv-only payloads*/ + for(;e1!=NULL && is_recv_only((PayloadType*)e1->data);e1=e1->next){ + ms_message("Skipping recv-only payload type..."); + } + } if (e1!=NULL || e2!=NULL){ /*means one list is longer than the other*/ return FALSE; From 5a1372f8120bbea98faf7515e1259ae334683b4d Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 22 Nov 2012 22:02:41 +0100 Subject: [PATCH 718/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index fd650dfd9..55a86251d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit fd650dfd92c307a35f1820e157dba5d1b185ede6 +Subproject commit 55a86251dd3dd6516f5ecef45a39371826f69c9a From 96dc7aac83db689dfcad04791a36df256aa83f21 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 22 Nov 2012 23:11:13 +0100 Subject: [PATCH 719/769] write documentation of audio conferencing module. --- coreapi/conference.c | 87 +++++++++++++++++++++++++++++++++++++++- coreapi/help/doxygen.dox | 21 ++++++++++ coreapi/linphonecall.c | 4 ++ coreapi/linphonecore.h | 34 ++++++++-------- 4 files changed, 127 insertions(+), 19 deletions(-) diff --git a/coreapi/conference.c b/coreapi/conference.c index 5ca465254..9f1538f42 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -28,6 +28,12 @@ #include "mediastreamer2/msvolume.h" +/** + * @addtogroup conferencing + * @{ +**/ + + static int convert_conference_to_call(LinphoneCore *lc); static void conference_check_init(LinphoneConference *ctx, int samplerate){ @@ -131,6 +137,11 @@ static void add_local_endpoint(LinphoneConference *conf,LinphoneCore *lc){ } +/** + * Returns the sound volume (mic input) of the local participant of the conference. + * @param lc the linphone core + * @returns the measured input volume expressed in dbm0. + **/ float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){ LinphoneConference *conf=&lc->conf_ctx; AudioStream *st=conf->local_participant; @@ -143,6 +154,16 @@ float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){ return LINPHONE_VOLUME_DB_LOWEST; } +/** + * Merge a call into a conference. + * @param lc the linphone core + * @param call an established call, either in LinphoneCallStreamsRunning or LinphoneCallPaused state. + * + * If this is the first call that enters the conference, the virtual conference will be created automatically. + * If the local user was actively part of the call (ie not in paused state), then the local user is automatically entered into the conference. + * + * @returns 0 if successful, -1 otherwise. +**/ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){ LinphoneCallParams params; LinphoneConference *conf=&lc->conf_ctx; @@ -229,7 +250,18 @@ static int convert_conference_to_call(LinphoneCore *lc){ return err; } - +/** + * Remove a call from the conference. + * @param lc the linphone core + * @param call a call that has been previously merged into the conference. + * + * After removing the remote participant belonging to the supplied call, the call becomes a normal call in paused state. + * If one single remote participant is left alone in the conference after the removal, then it is + * automatically removed from the conference and put into a simple call, like before entering the conference. + * The conference's resources are then automatically destroyed. + * + * @returns 0 if successful, -1 otherwise. + **/ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){ char * str=linphone_call_get_remote_address_as_string(call); ms_message("Removing call %s from the conference", str); @@ -249,10 +281,21 @@ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){ return err; } +/** + * Indicates whether the local participant is part of the conference. + * @param lc the linphone core + * @returns TRUE if the local participant is in the conference, FALSE otherwise. +**/ bool_t linphone_core_is_in_conference(const LinphoneCore *lc){ return lc->conf_ctx.local_participant!=NULL; } +/** + * Moves the local participant out of the conference. + * @param lc the linphone core + * When the local participant is out of the conference, the remote participants can continue to talk normally. + * @returns 0 if successful, -1 otherwise. +**/ int linphone_core_leave_conference(LinphoneCore *lc){ LinphoneConference *conf=&lc->conf_ctx; if (linphone_core_is_in_conference(lc)) @@ -260,7 +303,17 @@ int linphone_core_leave_conference(LinphoneCore *lc){ return 0; } - +/** + * Moves the local participant inside the conference. + * @param lc the linphone core + * + * Makes the local participant to join the conference. + * Typically, the local participant is by default always part of the conference when joining an active call into a conference. + * However, by calling linphone_core_leave_conference() and linphone_core_enter_conference() the application can decide to temporarily + * move out and in the local participant from the conference. + * + * @returns 0 if successful, -1 otherwise +**/ int linphone_core_enter_conference(LinphoneCore *lc){ if (linphone_core_sound_resources_locked(lc)) { return -1; @@ -273,6 +326,14 @@ int linphone_core_enter_conference(LinphoneCore *lc){ return 0; } +/** + * Add all calls into a conference. + * @param lc the linphone core + * + * Merge all established calls (either in LinphoneCallStreamsRunning or LinphoneCallPaused) into a conference. + * + * @returns 0 if successful, -1 otherwise +**/ int linphone_core_add_all_to_conference(LinphoneCore *lc) { MSList *calls=lc->calls; while (calls) { @@ -286,6 +347,14 @@ int linphone_core_add_all_to_conference(LinphoneCore *lc) { return 0; } +/** + * Terminates the conference and the calls associated with it. + * @param lc the linphone core + * + * All the calls that were merged to the conference are terminated, and the conference resources are destroyed. + * + * @returns 0 if successful, -1 otherwise +**/ int linphone_core_terminate_conference(LinphoneCore *lc) { MSList *calls=lc->calls; while (calls) { @@ -298,9 +367,23 @@ int linphone_core_terminate_conference(LinphoneCore *lc) { return 0; } +/** + * Returns the number of participants to the conference, including the local participant. + * @param lc the linphone core + * + * Typically, after merging two calls into the conference, there is total of 3 participants: + * the local participant (or local user), and two remote participants that were the destinations of the two previously establised calls. + * + * @returns the number of participants to the conference +**/ int linphone_core_get_conference_size(LinphoneCore *lc) { if (lc->conf_ctx.conf == NULL) { return 0; } return ms_audio_conference_get_size(lc->conf_ctx.conf); } + +/** + * @} +**/ + diff --git a/coreapi/help/doxygen.dox b/coreapi/help/doxygen.dox index 87229f276..8b2e6b7b9 100644 --- a/coreapi/help/doxygen.dox +++ b/coreapi/help/doxygen.dox @@ -195,6 +195,27 @@ void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddre * This api is useful for manipulating SIP addresses ('from' or 'to' headers). **/ +/** + * @defgroup conferencing Making an audio conference. + * This API allows to create a conference entirely managed by the client. No server capabilities are required. + * The way such conference is created is by doing the following:
+ * The application shall makes "normal" calls to several destinations (using linphone_core_invite() ), one after another. + * While initiating the second call, the first one is automatically paused. + * Then, once the second call is established, the application has the possibility to merge the two calls to form a conference where each participant + * (the local participant, the remote destination of the first call, the remote destination of the second call) can talk together. + * This must be done by adding the two calls to the conference using \link linphone_call_add_to_conference() \endlink + * + * Once merged into a conference the LinphoneCall objects representing the calls that were established remain unchanged, except that + * they are tagged as part of the conference (see \link linphone_call_is_in_conference() \endlink ). The calls in a conference are in the LinphoneCallStreamsRunning state. + * + * Only a single conference can be created: the purpose of this feature is to allow the local user to create, take part and manage the conference. + * This API is not designed to create a conference server application. + * + * Up to 10 calls can be merged into the conference, however depending on the CPU usage required for doing the encoding/decoding of the streams of each participants, + * the effective limit can be lower. + * +**/ + /** * @defgroup misc Miscenalleous: logs, version strings, config storage **/ diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d8fdd8803..aa5075ddf 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2081,6 +2081,10 @@ void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState stat } } +/** + * Returns true if the call is part of the conference. + * @ingroup conferencing +**/ bool_t linphone_call_is_in_conference(const LinphoneCall *call) { return call->params.in_conference; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 306f6b70b..f3aa76253 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -663,13 +663,13 @@ const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) */ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg); /** - *LinphoneChatMessageStatus used to notify if message has been succesfully delivered or not + *LinphoneChatMessageState is used to notify if messages have been succesfully delivered or not. */ typedef enum _LinphoneChatMessageStates { - LinphoneChatMessageStateIdle, /** initial state*/ - LinphoneChatMessageStateInProgress, /*delivery in progress**/ - LinphoneChatMessageStateDelivered, /** message succesffully delivered an acknoleged by remote end point*/ - LinphoneChatMessageStateNotDelivered /** message was not delivered*/ + LinphoneChatMessageStateIdle, /** Date: Fri, 23 Nov 2012 10:38:00 +0100 Subject: [PATCH 720/769] add function to extract ccc from e164 number --- coreapi/linphonecore_utils.h | 10 ++++++++-- coreapi/proxy.c | 26 ++++++++++++++++++++++++++ coreapi/test_numbers.c | 8 ++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index fadfc1a36..cc0a6f692 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -94,8 +94,14 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook *@return call country code or -1 if not found */ int linphone_dial_plan_lookup_ccc_from_iso(const char* iso); - - +/** + * @ingroup misc + *Function to get call country code from an e164 number, ex: +33952650121 will return 33 + *@param e164 phone number + *@return call country code or -1 if not found + */ +int linphone_dial_plan_lookup_ccc_from_e164(const char* e164); + #ifdef __cplusplus } #endif diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 864a23441..15f10b744 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -607,6 +607,32 @@ static dial_plan_t const dial_plans[]={ }; static dial_plan_t most_common_dialplan={ "generic" ,"", "", 10, "00"}; +int linphone_dial_plan_lookup_ccc_from_e164(const char* e164) { + dial_plan_t* dial_plan; + dial_plan_t* elected_dial_plan=NULL; + unsigned int found; + unsigned int i=0; + if (e164[1]=='1') { + /*USA case*/ + return 1; + } + do { + found=0; + i++; + for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) { + if (strncmp(dial_plan->ccc,&e164[1],i) == 0) { + elected_dial_plan=dial_plan; + found++; + } + } + } while (found>1 || found==0); + if (found==1) { + return atoi(elected_dial_plan->ccc); + } else { + return -1; /*not found */ + } + +} int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) { dial_plan_t* dial_plan; for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) { diff --git a/coreapi/test_numbers.c b/coreapi/test_numbers.c index 8cf4fb792..da1f22b6f 100644 --- a/coreapi/test_numbers.c +++ b/coreapi/test_numbers.c @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphonecore.h" +#include "linphonecore_utils.h" int main(int argc , char *argv[]){ LinphoneProxyConfig *cfg; @@ -35,6 +36,13 @@ int main(int argc , char *argv[]){ if (argc>3 && strcmp(argv[3],"--escape-plus")==0) linphone_proxy_config_set_dial_escape_plus(cfg,TRUE); linphone_proxy_config_normalize_number(cfg,argv[1],normalized_number,sizeof(normalized_number)); + printf("Normalized number is %s\n",normalized_number); + /*check extracted ccc*/ + if (linphone_dial_plan_lookup_ccc_from_e164(normalized_number) != atoi(linphone_proxy_config_get_dial_prefix(cfg))) { + printf("Error ccc [%i] not correctly parsed\n",linphone_dial_plan_lookup_ccc_from_e164(normalized_number)); + } else { + printf("Extracted ccc is [%i] \n",linphone_dial_plan_lookup_ccc_from_e164(normalized_number)); + } return 0; } From 17c6593abc5bff8e8de850cbf96184c296a34d4f Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 26 Nov 2012 10:51:50 +0100 Subject: [PATCH 721/769] Add getter for zrtp_secrets_file, static_picture and root_ca --- coreapi/linphonecore.c | 25 +++++++++++++++++++++++++ coreapi/linphonecore.h | 6 ++++-- coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 4 ++++ mediastreamer2 | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 01667ebcb..0db7894b9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3659,6 +3659,17 @@ void linphone_core_set_root_ca(LinphoneCore *lc,const char *path){ sal_set_root_ca(lc->sal, path); } +/** + * Gets the path to a file or folder containing trusted root CAs (PEM format) + * + * @param lc The LinphoneCore object + * + * @ingroup media_parameters +**/ +const char *linphone_core_get_root_ca(LinphoneCore *lc){ + return sal_get_root_ca(lc->sal); +} + /** * Specify whether the tls server certificate must be verified when connecting to a SIP/TLS server. **/ @@ -4189,6 +4200,16 @@ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path) { return 0; } +const char *linphone_core_get_static_picture(LinphoneCore *lc) { + const char *path=NULL; +#ifdef VIDEO_ENABLED + path=ms_static_image_get_default_image(); +#else + ms_warning("Video support not compiled."); +#endif + return path; +} + int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps) { #ifdef VIDEO_ENABLED VideoStream *vs = NULL; @@ -5185,6 +5206,10 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){ lc->zrtp_secrets_cache=file ? ms_strdup(file) : NULL; } +const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc){ + return lc->zrtp_secrets_cache; +} + const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri) { if (uri == NULL) return NULL; MSList *calls=lc->calls; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index f3aa76253..f0cf69532 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1214,6 +1214,7 @@ void linphone_core_set_ring(LinphoneCore *lc, const char *path); const char *linphone_core_get_ring(const LinphoneCore *lc); void linphone_core_verify_server_certificates(LinphoneCore *lc, bool_t yesno); void linphone_core_set_root_ca(LinphoneCore *lc, const char *path); +const char *linphone_core_get_root_ca(LinphoneCore *lc); void linphone_core_set_ringback(LinphoneCore *lc, const char *path); const char * linphone_core_get_ringback(const LinphoneCore *lc); @@ -1282,8 +1283,9 @@ const char** linphone_core_get_video_devices(const LinphoneCore *lc); int linphone_core_set_video_device(LinphoneCore *lc, const char *id); const char *linphone_core_get_video_device(const LinphoneCore *lc); -/* Set static picture to be used when "Static picture" is the video device */ +/* Set and get static picture to be used when "Static picture" is the video device */ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path); +const char *linphone_core_get_static_picture(LinphoneCore *lc); /* Set and get frame rate for static picture */ int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps); @@ -1387,7 +1389,7 @@ void linphone_core_refresh_registers(LinphoneCore* lc); /* Path to the file storing secrets cache */ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file); - +const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc); const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri); diff --git a/coreapi/sal.h b/coreapi/sal.h index e5eb1c190..daa59217a 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -356,6 +356,7 @@ void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec); void sal_use_rport(Sal *ctx, bool_t use_rports); void sal_use_101(Sal *ctx, bool_t use_101); void sal_set_root_ca(Sal* ctx, const char* rootCa); +const char *sal_get_root_ca(Sal* ctx); void sal_verify_server_certificates(Sal *ctx, bool_t verify); int sal_iterate(Sal *sal); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 0363ddb2b..8dbf0173b 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -486,6 +486,10 @@ void sal_set_root_ca(Sal* ctx, const char* rootCa) { set_tls_options(ctx); } +const char *sal_get_root_ca(Sal* ctx) { + return ctx->rootCa; +} + void sal_verify_server_certificates(Sal *ctx, bool_t verify){ ctx->verify_server_certs=verify; #ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE diff --git a/mediastreamer2 b/mediastreamer2 index 55a86251d..07779d3e2 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 55a86251dd3dd6516f5ecef45a39371826f69c9a +Subproject commit 07779d3e25a58b7d252338cd0c327f1f7d9d5e6b From 0eb1172b2da375be499e93d2bb9ecf8779535ed1 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 26 Nov 2012 14:59:56 +0100 Subject: [PATCH 722/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 07779d3e2..7a58421b8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 07779d3e25a58b7d252338cd0c327f1f7d9d5e6b +Subproject commit 7a58421b895e6fbe17306e65467e716f6ba471f2 From 4315fafad9ebe1ccb0795a2c6c2997567e61c466 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 27 Nov 2012 13:39:46 +0100 Subject: [PATCH 723/769] Update oRTP and ms2 submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7a58421b8..e72a79873 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7a58421b895e6fbe17306e65467e716f6ba471f2 +Subproject commit e72a79873f6f04dd27829b49c60946cd86031c6c diff --git a/oRTP b/oRTP index 88ace8adf..0391dc349 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 88ace8adfecde4d03ea9030d625f6949f4f5fab4 +Subproject commit 0391dc3493e0e834b6b0668767546e95fc3b490c From c6bd038a6d2dcb179f643eaae6bcb8daf34a0976 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 27 Nov 2012 14:44:07 +0100 Subject: [PATCH 724/769] implement manual low banwdwidth mode. It is also possible to check whether peer is under low bandwidth by looking into the linphone_call_get_remote_params() --- coreapi/linphonecall.c | 31 ++++++++++++++++++++++++++++--- coreapi/linphonecore.h | 9 ++------- coreapi/misc.c | 24 +++++++++++++++++------- coreapi/private.h | 3 ++- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index aa5075ddf..089e7b809 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -219,9 +219,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall * SalMediaDescription *md=sal_media_description_new(); bool_t keep_srtp_keys=lp_config_get_int(lc->config,"sip","keep_srtp_keys",0); - if (call->ping_time>0) { - linphone_core_adapt_to_network(lc,call->ping_time,&call->params); - } + linphone_core_adapt_to_network(lc,call->ping_time,&call->params); md->session_id=(old_md ? old_md->session_id : (rand() & 0xfff)); md->session_ver=(old_md ? (old_md->session_ver+1) : (rand() & 0xfff)); @@ -746,6 +744,11 @@ const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){ }else if (vsd){ cp->has_video=is_video_active(vsd); } + if (!cp->has_video){ + if (md->bandwidth>0 && md->bandwidth<=linphone_core_get_edge_bw(call->core)){ + cp->low_bandwidth=TRUE; + } + } return cp; } } @@ -925,9 +928,31 @@ const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallP return cp->video_codec; } +/** + * @ingroup call_control + * Use to know if this call has been configured in low bandwidth mode. + * This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file. + * An application that would have reliable way to know network capacity may not use activate_edge_workarounds=1 but instead manually configure + * low bandwidth mode with linphone_call_params_enable_low_bandwidth(). + *
When enabled, this param may transform a call request with video in audio only mode. + * @return TRUE if low bandwidth has been configured/detected + */ bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp) { return cp->low_bandwidth; } + +/** + * @ingroup call_control + * Indicate low bandwith mode. + * Configuring a call to low bandwidth mode will result in the core to activate several settings for the call in order to ensure that bitrate usage + * is lowered to the minimum possible. Typically, ptime (packetization time) will be increased, audio codec's output bitrate will be targetted to 20kbit/s provided + * that it is achievable by the codec selected after SDP handshake. Video is automatically disabled. + * +**/ +void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled){ + cp->low_bandwidth=TRUE; +} + /** * Returns whether video is enabled. **/ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index f0cf69532..771ddff64 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -204,14 +204,9 @@ bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp); void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw); void linphone_call_params_destroy(LinphoneCallParams *cp); -/** - * @ingroup call_control - * Use to know if this call has been configured in low bandwidth mode. - * This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file - *
When enabled, this param may transform a call request with video in audio only mode. - * @return TRUE if low bandwidth has been configured/detected - */ bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp); +void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled); + /** * Enum describing failure reasons. * @ingroup initializing diff --git a/coreapi/misc.c b/coreapi/misc.c index b9176ebd4..d75722138 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -574,21 +574,31 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ return -1; } +int linphone_core_get_edge_bw(LinphoneCore *lc){ + int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",20); + return edge_bw; +} + +int linphone_core_get_edge_ptime(LinphoneCore *lc){ + int edge_ptime=lp_config_get_int(lc->config,"net","edge_ptime",100); + return edge_ptime; +} + void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params){ - if (lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){ + if (ping_time_ms>0 && lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){ ms_message("Stun server ping time is %i ms",ping_time_ms); int threshold=lp_config_get_int(lc->config,"net","edge_ping_time",500); if (ping_time_ms>threshold){ - int edge_ptime=lp_config_get_int(lc->config,"net","edge_ptime",100); - int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",20); - /* we are in a 2G network*/ - params->up_bw=params->down_bw=edge_bw; - params->up_ptime=params->down_ptime=edge_ptime; - params->has_video=FALSE; + /* we might be in a 2G network*/ params->low_bandwidth=TRUE; }/*else use default settings */ } + if (params->low_bandwidth){ + params->up_bw=params->down_bw=linphone_core_get_edge_bw(lc); + params->up_ptime=params->down_ptime=linphone_core_get_edge_ptime(lc); + params->has_video=FALSE; + } } diff --git a/coreapi/private.h b/coreapi/private.h index 5ebe8b5b7..925a30360 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -639,7 +639,8 @@ void _linphone_core_codec_config_write(LinphoneCore *lc); #endif void call_logs_write_to_config_file(LinphoneCore *lc); - +int linphone_core_get_edge_bw(LinphoneCore *lc); +int linphone_core_get_edge_ptime(LinphoneCore *lc); #ifdef __cplusplus } From 5b46fa5d4235c2f440cfa34819112c4fd85a826e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 29 Nov 2012 10:01:28 +0100 Subject: [PATCH 725/769] fix readme for zrtpcpp --- README.macos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.macos b/README.macos index aecd2922f..1648a3135 100644 --- a/README.macos +++ b/README.macos @@ -28,7 +28,7 @@ You need: - Install zrtpcpp (optional), for unbreakable call encryption $ port install cmake $ git clone git://git.linphone.org/zrtpcpp.git - $ cd zrtpcpp && cmake -Denable_ccrtp=false . && make + $ cd zrtpcpp && cmake -Denable-ccrtp=false . && make $ sudo make install - Install gtk. It is recommended to use the quartz backend for better integration. From 019c6f1c5589f7e5440f5daccc72e761e69c23b5 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 29 Nov 2012 16:40:14 +0100 Subject: [PATCH 726/769] Added SIPINFO/Rfc2833 JNI glue --- coreapi/linphonecore_jni.cc | 8 ++++++++ java/common/org/linphone/core/LinphoneCore.java | 10 ++++++++++ java/impl/org/linphone/core/LinphoneCoreImpl.java | 10 ++++++++++ 3 files changed, 28 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 03d5c0df0..46b04be9c 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1869,6 +1869,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEn linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseSipInfoForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jbool use){ + linphone_core_set_use_info_for_dtmf((LinphoneCore *)lc, (bool) use); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseRfc2833ForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jbool use){ + linphone_core_set_use_rfc2833_for_dtmf((LinphoneCore *)lc, (bool) use); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadPtime(JNIEnv *env, jobject thiz, jlong lc, jint ptime){ linphone_core_set_download_ptime((LinphoneCore *)lc, (int) ptime); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 450091843..c1da356bb 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -856,4 +856,14 @@ public interface LinphoneCore { * Set username and display name to use if no LinphoneProxyConfig configured */ void setPrimaryContact(String displayName, String username); + + /** + * Enable/Disable the use of SIP INFO for DTMFs + */ + void setUseSipInfoForDtmfs(boolean use); + + /** + * Enable/Disable the use of inband DTMFs + */ + void setUseRfc2833ForDtmfs(boolean use); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 5e6864559..c00c9a37c 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -798,4 +798,14 @@ class LinphoneCoreImpl implements LinphoneCore { public void setPrimaryContact(String displayName, String username) { setPrimaryContact(nativePtr, displayName, username); } + + private native void setUseSipInfoForDtmfs(long ptr, boolean use); + public void setUseSipInfoForDtmfs(boolean use) { + setUseSipInfoForDtmfs(nativePtr, use); + } + + private native void setUseRfc2833ForDtmfs(long ptr, boolean use); + public void setUseRfc2833ForDtmfs(boolean use) { + setUseRfc2833ForDtmfs(nativePtr, use); + } } From 07c4120600ac9e7060f619fa2b94a7b29cbe79da Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 29 Nov 2012 16:46:33 +0100 Subject: [PATCH 727/769] Fix typo mistake --- coreapi/linphonecore_jni.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 46b04be9c..1f924497b 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1869,11 +1869,11 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEn linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseSipInfoForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jbool use){ +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseSipInfoForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jboolean use){ linphone_core_set_use_info_for_dtmf((LinphoneCore *)lc, (bool) use); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseRfc2833ForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jbool use){ +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseRfc2833ForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jboolean use){ linphone_core_set_use_rfc2833_for_dtmf((LinphoneCore *)lc, (bool) use); } From 8648c08a0d446ed690ec5298d0f07d3945810d3d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 29 Nov 2012 17:21:27 +0100 Subject: [PATCH 728/769] update ortp and ms2, and set rfc2833 the default --- coreapi/linphonecore.c | 2 +- mediastreamer2 | 2 +- oRTP | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0db7894b9..998fd9ec9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -527,7 +527,7 @@ static void sip_config_read(LinphoneCore *lc) sal_reuse_authorization(lc->sal, lp_config_get_int(lc->config,"sip","reuse_authorization",0)); sal_expire_old_registration_contacts(lc->sal,lp_config_get_int(lc->config,"sip","expire_old_registration_contacts",0)); - tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",0); + tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",1); linphone_core_set_use_rfc2833_for_dtmf(lc,tmp); ipv6=lp_config_get_int(lc->config,"sip","use_ipv6",-1); diff --git a/mediastreamer2 b/mediastreamer2 index e72a79873..e613ba002 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e72a79873f6f04dd27829b49c60946cd86031c6c +Subproject commit e613ba002020f8862bf141a676bcff8d868d7160 diff --git a/oRTP b/oRTP index 0391dc349..0d318ef47 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 0391dc3493e0e834b6b0668767546e95fc3b490c +Subproject commit 0d318ef477b40f72b5838a836ddccc0e055c0719 From f5464e17d9b7562513408e6d718394242912dd6a Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 29 Nov 2012 17:23:30 +0100 Subject: [PATCH 729/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e72a79873..5ce886301 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e72a79873f6f04dd27829b49c60946cd86031c6c +Subproject commit 5ce886301c0408e4779513b4af5291c38e6aef7f From 43c255f7fbde840700d17a03c9dc69c026cca5bd Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 3 Dec 2012 14:48:05 +0100 Subject: [PATCH 730/769] fix low bandwidth mode --- coreapi/linphonecall.c | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 089e7b809..f08227905 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -950,7 +950,7 @@ bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp) * **/ void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled){ - cp->low_bandwidth=TRUE; + cp->low_bandwidth=enabled; } /** diff --git a/mediastreamer2 b/mediastreamer2 index 5ce886301..aacb8b5f5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5ce886301c0408e4779513b4af5291c38e6aef7f +Subproject commit aacb8b5f50769d3c2d5928ef8511b8906b070217 From a847ea825becae54e60c5c2606b26b9a6ae14892 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 3 Dec 2012 15:01:02 +0100 Subject: [PATCH 731/769] Update ms2 --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index aacb8b5f5..74af68056 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit aacb8b5f50769d3c2d5928ef8511b8906b070217 +Subproject commit 74af680568ced0a5c1ee5593d8dc2e4970b1b6bf diff --git a/oRTP b/oRTP index 0d318ef47..0391dc349 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 0d318ef477b40f72b5838a836ddccc0e055c0719 +Subproject commit 0391dc3493e0e834b6b0668767546e95fc3b490c From 243016a976f22ba31059aced9b5c748edb133e55 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 3 Dec 2012 15:02:21 +0100 Subject: [PATCH 732/769] Update oRTP --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 0391dc349..0d318ef47 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 0391dc3493e0e834b6b0668767546e95fc3b490c +Subproject commit 0d318ef477b40f72b5838a836ddccc0e055c0719 From dd1fc47a32555491f01a438baa328201ea16bc5d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 4 Dec 2012 10:33:17 +0100 Subject: [PATCH 733/769] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 74af68056..243cc4d3d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 74af680568ced0a5c1ee5593d8dc2e4970b1b6bf +Subproject commit 243cc4d3da14b68bb7d2919c93475c122995dfc7 From 3c4bd90ba3ebbfd600a3180d45a4514e8f641e5d Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 4 Dec 2012 11:51:50 +0100 Subject: [PATCH 734/769] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 243cc4d3d..2705c0f59 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 243cc4d3da14b68bb7d2919c93475c122995dfc7 +Subproject commit 2705c0f59dab3c49a8dc9200805897fe66c2986c From d7cf616e0722441e9acdde338f50b0c2f5f4a8ef Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 4 Dec 2012 14:04:10 +0100 Subject: [PATCH 735/769] Add getRemoteUserAgent() to the JNI. --- coreapi/linphonecore_jni.cc | 6 ++++++ java/common/org/linphone/core/LinphoneCall.java | 5 +++++ java/impl/org/linphone/core/LinphoneCallImpl.java | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 1f924497b..12b1a22fe 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1488,6 +1488,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress( JNIEn return (jlong)linphone_call_get_remote_address((LinphoneCall*)ptr); } +extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_get_remoteUserAgent(JNIEnv *env, jobject thiz, jlong ptr) { + LinphoneCall *call = (LinphoneCall *)ptr; + jstring jvalue = env->NewStringUTF(linphone_call_get_remote_user_agent(call)); + return jvalue; +} + extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState( JNIEnv* env ,jobject thiz ,jlong ptr) { diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index 35e173d5a..7c02334e9 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -268,6 +268,11 @@ public interface LinphoneCall { boolean isInConference(); float getPlayVolume(); + + /** + * Obtain the remote user agent string. + */ + String getRemoteUserAgent(); /** * Take a photo of currently received video and write it into a jpeg file. diff --git a/java/impl/org/linphone/core/LinphoneCallImpl.java b/java/impl/org/linphone/core/LinphoneCallImpl.java index 7e39cebc7..6a91438ac 100644 --- a/java/impl/org/linphone/core/LinphoneCallImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallImpl.java @@ -174,6 +174,11 @@ class LinphoneCallImpl implements LinphoneCall { public float getPlayVolume() { return getPlayVolume(nativePtr); } + + private native String getRemoteUserAgent(long nativePtr); + public String getRemoteUserAgent() { + return getRemoteUserAgent(nativePtr); + } private native void takeSnapshot(long nativePtr, String path); public void takeSnapshot(String path) { From ba478b89e88f5b60f6f3ee5bfe9c636cd8648f3e Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 4 Dec 2012 16:23:07 +0100 Subject: [PATCH 736/769] Fix crash on INVITE without SDP. --- coreapi/linphonecall.c | 8 +++++++- coreapi/linphonecore.c | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f08227905..5a18a0525 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -462,6 +462,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){ LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; + const SalMediaDescription *md; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -484,8 +485,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); call->log->call_id=ms_strdup(sal_op_get_call_id(op)); /*must be known at that time*/ linphone_core_init_default_params(lc, &call->params); + md=sal_call_get_remote_media_description(op); call->params.has_video &= !!lc->video_policy.automatically_accept; - call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(op)); + if (md) { + // It is licit to receive an INVITE without SDP + // In this case WE chose the media parameters according to policy. + call->params.has_video &= linphone_core_media_description_contains_video_stream(md); + } switch (linphone_core_get_firewall_policy(call->core)) { case LinphonePolicyUseIce: call->ice_session = ice_session_new(); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 998fd9ec9..e52bef3f7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2882,8 +2882,11 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, sal_op_set_contact(call->op,contact); if (params){ + const SalMediaDescription *md = sal_call_get_remote_media_description(call->op); call->params=*params; - call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); + // There might not be a md if the INVITE was lacking an SDP + // In this case we use the parameters as is. + if (md) call->params.has_video &= linphone_core_media_description_contains_video_stream(md); call->camera_active=call->params.has_video; linphone_call_make_local_media_description(lc,call); sal_call_set_local_media_description(call->op,call->localdesc); From 634cab3d53830c0c6c12a7eddbe444d4de6f8178 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 5 Dec 2012 11:06:03 +0100 Subject: [PATCH 737/769] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 2705c0f59..01dcf8bab 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2705c0f59dab3c49a8dc9200805897fe66c2986c +Subproject commit 01dcf8babee2166886008a4c0748fcb7d85e7c24 From b5e0067dda1d9d7782e8834e26531f1ff9473b4c Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 6 Dec 2012 10:39:15 +0100 Subject: [PATCH 738/769] Disable wizard if gtk < 2.22.0 --- configure.ac | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 84081f46c..19480a88e 100644 --- a/configure.ac +++ b/configure.ac @@ -457,12 +457,20 @@ if test "$build_wizard" != "false" ; then build_wizard=false fi ]) + PKG_CHECK_MODULES(LIBGTK, [gtk+-2.0 >= 2.22.0],[build_wizard=true], + [ + if test "$build_wizard" = "true" ; then + AC_MSG_ERROR([gtk+-2.0 < 2.22.0, assistant cannot be compiled.]) + else + build_wizard=false + fi + ]) fi AC_SUBST(LIBSOUP_CFLAGS) AC_SUBST(LIBSOUP_LIBS) AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard = xtrue) if test "$build_wizard" = "true" ; then - AC_DEFINE( BUILD_WIZARD, 1, [Define if wizard enabled] ) + AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] ) fi AC_CHECK_HEADERS(libudev.h) From d998fa1a5a92d2ef7ed52c4e68ff26f3a2790735 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 6 Dec 2012 10:56:08 +0100 Subject: [PATCH 739/769] Improve previous commit --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 19480a88e..15d041efe 100644 --- a/configure.ac +++ b/configure.ac @@ -457,7 +457,9 @@ if test "$build_wizard" != "false" ; then build_wizard=false fi ]) - PKG_CHECK_MODULES(LIBGTK, [gtk+-2.0 >= 2.22.0],[build_wizard=true], +fi +if test "$build_wizard" != "false" ; then + PKG_CHECK_MODULES(LIBGTKWIZARD, [gtk+-2.0 >= 2.22.0],[build_wizard=true], [ if test "$build_wizard" = "true" ; then AC_MSG_ERROR([gtk+-2.0 < 2.22.0, assistant cannot be compiled.]) From 0e5ffe272f8aba7d2b907f31cc596196a671a95c Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 6 Dec 2012 11:08:51 +0100 Subject: [PATCH 740/769] Improve wizard disabling with gtk < 2.22.0 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 15d041efe..61f173b95 100644 --- a/configure.ac +++ b/configure.ac @@ -449,7 +449,7 @@ AC_ARG_ENABLE(assistant, dnl check libsoup (needed for wizard) if test "$build_wizard" != "false" ; then - PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26],[build_wizard=true], + PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26],[], [ if test "$build_wizard" = "true" ; then AC_MSG_ERROR([Could not found libsoup, assistant cannot be compiled.]) @@ -459,7 +459,7 @@ if test "$build_wizard" != "false" ; then ]) fi if test "$build_wizard" != "false" ; then - PKG_CHECK_MODULES(LIBGTKWIZARD, [gtk+-2.0 >= 2.22.0],[build_wizard=true], + PKG_CHECK_MODULES(LIBGTKWIZARD, [gtk+-2.0 >= 2.22.0],[], [ if test "$build_wizard" = "true" ; then AC_MSG_ERROR([gtk+-2.0 < 2.22.0, assistant cannot be compiled.]) @@ -471,7 +471,7 @@ fi AC_SUBST(LIBSOUP_CFLAGS) AC_SUBST(LIBSOUP_LIBS) AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard = xtrue) -if test "$build_wizard" = "true" ; then +if test "$build_wizard" != "false" ; then AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] ) fi From 0e521c4099daa7c4a5c33feb51b1fcfa5418c217 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 6 Dec 2012 11:22:48 +0100 Subject: [PATCH 741/769] Improve previous commit --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 61f173b95..167ae8278 100644 --- a/configure.ac +++ b/configure.ac @@ -472,6 +472,7 @@ AC_SUBST(LIBSOUP_CFLAGS) AC_SUBST(LIBSOUP_LIBS) AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard = xtrue) if test "$build_wizard" != "false" ; then + build_wizard=true AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] ) fi From b31352ae9ea463c7099eeee29c0ecbaf9d7a0161 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 6 Dec 2012 12:01:46 +0100 Subject: [PATCH 742/769] Fix previous commit --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 167ae8278..4cfea5e64 100644 --- a/configure.ac +++ b/configure.ac @@ -470,7 +470,7 @@ if test "$build_wizard" != "false" ; then fi AC_SUBST(LIBSOUP_CFLAGS) AC_SUBST(LIBSOUP_LIBS) -AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard = xtrue) +AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard != xfalse) if test "$build_wizard" != "false" ; then build_wizard=true AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] ) From 0849cfcffa9bd30bdb30469afdfce513a86c149c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 10 Dec 2012 09:41:49 +0100 Subject: [PATCH 743/769] Fix typo in getRemoteUserAgent() method. --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 12b1a22fe..e6d449977 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1488,7 +1488,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress( JNIEn return (jlong)linphone_call_get_remote_address((LinphoneCall*)ptr); } -extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_get_remoteUserAgent(JNIEnv *env, jobject thiz, jlong ptr) { +extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getRemoteUserAgent(JNIEnv *env, jobject thiz, jlong ptr) { LinphoneCall *call = (LinphoneCall *)ptr; jstring jvalue = env->NewStringUTF(linphone_call_get_remote_user_agent(call)); return jvalue; From 4821958ecddd49fb8170e7b6ccc7c17d454f06e2 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 7 Dec 2012 14:26:59 +0100 Subject: [PATCH 744/769] Improve audio hack for Galaxy S. --- coreapi/linphonecore_jni.cc | 11 +-- .../org/linphone/core/LinphoneCore.java | 20 ++++-- .../org/linphone/core/LinphoneCoreImpl.java | 68 ++++++++++++++++--- mediastreamer2 | 2 +- 4 files changed, 82 insertions(+), 19 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e6d449977..99d46fb18 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2079,10 +2079,13 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_soundResourcesLocked // Needed by Galaxy S (can't switch to/from speaker while playing and still keep mic working) // Implemented directly in msandroid.cpp (sound filters for Android). -extern "C" void msandroid_hack_speaker_state(bool speakerOn); - -extern "C" void Java_org_linphone_LinphoneManager_hackSpeakerState(JNIEnv* env,jobject thiz,jboolean speakerOn){ - msandroid_hack_speaker_state(speakerOn); +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_forceSpeakerState(JNIEnv *env, jobject thiz, jlong ptr, jboolean speakerOn) { + LinphoneCore *lc = (LinphoneCore *)ptr; + LinphoneCall *call = linphone_core_get_current_call(lc); + if (call && call->audiostream && call->audiostream->soundread) { + bool_t on = speakerOn; + ms_filter_call_method(call->audiostream->soundread, MS_AUDIO_CAPTURE_FORCE_SPEAKER_STATE, &on); + } } // End Galaxy S hack functions diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index c1da356bb..ba3802aa8 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -278,6 +278,12 @@ public interface LinphoneCore { return mValue; } } + + /** + * Set the context of creation of the LinphoneCore. + */ + public void setContext(Object context); + /** * clear all added proxy configs */ @@ -417,7 +423,9 @@ public interface LinphoneCore { * @throws LinphoneCoreException */ public void deferCallUpdate(LinphoneCall aCall) throws LinphoneCoreException; - + + public void startRinging(); + /** * @return a list of LinphoneCallLog */ @@ -472,7 +480,7 @@ public interface LinphoneCore { * @return true is mic is muted */ boolean isMicMuted(); - + /** * Initiate a dtmf signal if in call * @param number @@ -524,7 +532,7 @@ public interface LinphoneCore { */ boolean isEchoCancellationEnabled(); /** - * Get echo limiter status (another method of doing echo suppressionn, more brute force) + * Get echo limiter status (another method of doing echo suppression, more brute force) * @return true if echo limiter is enabled */ boolean isEchoLimiterEnabled(); @@ -537,13 +545,13 @@ public interface LinphoneCore { */ Transports getSignalingTransportPorts(); /** - * not implemented + * Activates or deactivates the speaker. * @param value */ void enableSpeaker(boolean value); /** - * not implemented - * @return + * Tells whether the speaker is activated. + * @return true if speaker enabled, false otherwise */ boolean isSpeakerEnabled(); /** diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index c00c9a37c..83f6d20d3 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -18,14 +18,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import static android.media.AudioManager.MODE_IN_CALL; +import static android.media.AudioManager.MODE_RINGTONE; +import android.content.Context; +import android.media.AudioManager; + import java.io.File; import java.io.IOException; +import org.linphone.core.LinphoneCall.State; +import org.linphone.mediastream.video.capture.hwconf.Hacks; + class LinphoneCoreImpl implements LinphoneCore { private final LinphoneCoreListener mListener; //to make sure to keep a reference on this object private long nativePtr = 0; + private Context mContext = null; + private AudioManager mAudioManager = null; + private boolean mSpeakerEnabled = false; private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); private native void iterate(long nativePtr); private native long getDefaultProxyConfig(long nativePtr); @@ -130,14 +141,24 @@ class LinphoneCoreImpl implements LinphoneCore { protected void finalize() throws Throwable { } - + + private boolean contextInitialized() { + if (mContext == null) { + Log.e("Context of LinphoneCore has not been initialized, call setContext() after creating LinphoneCore."); + return false; + } + return true; + } + public void setContext(Object context) { + mContext = (Context)context; + mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); + } + public synchronized void addAuthInfo(LinphoneAuthInfo info) { isValid(); addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr); } - - public synchronized LinphoneProxyConfig getDefaultProxyConfig() { isValid(); long lNativePtr = getDefaultProxyConfig(nativePtr); @@ -201,7 +222,6 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void acceptCall(LinphoneCall aCall) { isValid(); acceptCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr); - } public synchronized LinphoneCallLog[] getCallLogs() { isValid(); @@ -235,6 +255,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void muteMic(boolean isMuted) { muteMic(nativePtr,isMuted); } + public synchronized LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException { long lAddress = interpretUrl(nativePtr,destination); if (lAddress != 0) { @@ -301,13 +322,37 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub } + + private void applyAudioHacks() { + if (Hacks.needGalaxySAudioHack()) { + /* The microphone gain is way too high on the Galaxy S so correct it here. */ + setMicrophoneGain(-9.0f); + } + } + private void setAudioModeIncallForGalaxyS() { + if (!contextInitialized()) return; + mAudioManager.setMode(MODE_IN_CALL); + } + public void routeAudioToSpeakerHelper(boolean speakerOn) { + if (!contextInitialized()) return; + if (Hacks.needGalaxySAudioHack()) + setAudioModeIncallForGalaxyS(); + mAudioManager.setSpeakerphoneOn(speakerOn); + } + private native void forceSpeakerState(long nativePtr, boolean speakerOn); public void enableSpeaker(boolean value) { - // TODO Auto-generated method stub - + final LinphoneCall call = getCurrentCall(); + mSpeakerEnabled = value; + applyAudioHacks(); + if (call != null && call.getState() == State.StreamsRunning && Hacks.needGalaxySAudioHack()) { + Log.d("Hack to have speaker=", value, " while on call"); + forceSpeakerState(nativePtr, value); + } else { + routeAudioToSpeakerHelper(value); + } } public boolean isSpeakerEnabled() { - // TODO Auto-generated method stub - return false; + return mSpeakerEnabled; } public synchronized void playDtmf(char number, int duration) { playDtmf(nativePtr,number, duration); @@ -697,6 +742,13 @@ class LinphoneCoreImpl implements LinphoneCore { throws LinphoneCoreException { deferCallUpdate(nativePtr, getCallPtr(aCall)); } + + public synchronized void startRinging() { + if (!contextInitialized()) return; + if (Hacks.needGalaxySAudioHack()) { + mAudioManager.setMode(MODE_RINGTONE); + } + } private native void setVideoPolicy(long nativePtr, boolean autoInitiate, boolean autoAccept); public synchronized void setVideoPolicy(boolean autoInitiate, boolean autoAccept) { diff --git a/mediastreamer2 b/mediastreamer2 index 01dcf8bab..07e0e720e 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 01dcf8babee2166886008a4c0748fcb7d85e7c24 +Subproject commit 07e0e720ee7a9d3c34d28430bc15319ad27b3d8b From a879204d2d1f0d430d144851eb8bd74a7ac1c822 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 10 Dec 2012 16:36:10 +0100 Subject: [PATCH 745/769] Fix some warnings. --- java/common/org/linphone/core/LinphoneCall.java | 2 +- java/common/org/linphone/core/LinphoneCallLog.java | 2 +- java/common/org/linphone/core/LinphoneCallStats.java | 4 ++-- java/common/org/linphone/core/LinphoneChatMessage.java | 2 +- java/common/org/linphone/core/LinphoneCore.java | 10 +++++----- java/common/org/linphone/core/LinphoneCoreFactory.java | 2 +- java/common/org/linphone/core/LinphoneFriend.java | 2 +- java/common/org/linphone/core/OnlineStatus.java | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index 7c02334e9..ac7b14d8d 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -32,7 +32,7 @@ public interface LinphoneCall { */ static class State { - static private Vector values = new Vector(); + static private Vector values = new Vector(); private final int mValue; public final int value() {return mValue;} diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index 8d0e4073a..821be24d0 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -32,7 +32,7 @@ public interface LinphoneCallLog { */ static class CallStatus { - static private Vector values = new Vector(); + static private Vector values = new Vector(); private final int mValue; private final String mStringValue; /** diff --git a/java/common/org/linphone/core/LinphoneCallStats.java b/java/common/org/linphone/core/LinphoneCallStats.java index 15b4cfb34..f1248c445 100644 --- a/java/common/org/linphone/core/LinphoneCallStats.java +++ b/java/common/org/linphone/core/LinphoneCallStats.java @@ -23,7 +23,7 @@ import java.util.Vector; public interface LinphoneCallStats { static public class MediaType { - static private Vector values = new Vector(); + static private Vector values = new Vector(); /** * Audio */ @@ -52,7 +52,7 @@ public interface LinphoneCallStats { } } static public class IceState { - static private Vector values = new Vector(); + static private Vector values = new Vector(); /** * Not activated */ diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index 74f0961ac..d403d94bd 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -8,7 +8,7 @@ public interface LinphoneChatMessage { void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state); } public static class State { - static private Vector values = new Vector(); + static private Vector values = new Vector(); private final int mValue; public final int value() {return mValue;} diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index ba3802aa8..8815085d0 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -31,7 +31,7 @@ public interface LinphoneCore { */ static public class GlobalState { - static private Vector values = new Vector(); + static private Vector values = new Vector(); /** * Off */ @@ -76,7 +76,7 @@ public interface LinphoneCore { */ static public class RegistrationState { - private static Vector values = new Vector(); + private static Vector values = new Vector(); /** * None */ @@ -124,7 +124,7 @@ public interface LinphoneCore { */ static public class FirewallPolicy { - static private Vector values = new Vector(); + static private Vector values = new Vector(); /** * No firewall is assumed. */ @@ -191,7 +191,7 @@ public interface LinphoneCore { */ static public final class MediaEncryption { - static private Vector values = new Vector(); + static private Vector values = new Vector(); /** * None */ @@ -230,7 +230,7 @@ public interface LinphoneCore { */ static public class EcCalibratorStatus { - static private Vector values = new Vector(); + static private Vector values = new Vector(); /* Do not change the values of these constants or the strings associated with them to prevent breaking the collection of echo canceller calibration results during the wizard! */ public static final int IN_PROGRESS_STATUS=0; diff --git a/java/common/org/linphone/core/LinphoneCoreFactory.java b/java/common/org/linphone/core/LinphoneCoreFactory.java index fe35b257f..04cef4aea 100644 --- a/java/common/org/linphone/core/LinphoneCoreFactory.java +++ b/java/common/org/linphone/core/LinphoneCoreFactory.java @@ -40,7 +40,7 @@ abstract public class LinphoneCoreFactory { public static final synchronized LinphoneCoreFactory instance() { try { if (theLinphoneCoreFactory == null) { - Class lFactoryClass = Class.forName(factoryName); + Class lFactoryClass = Class.forName(factoryName); theLinphoneCoreFactory = (LinphoneCoreFactory) lFactoryClass.newInstance(); } } catch (Exception e) { diff --git a/java/common/org/linphone/core/LinphoneFriend.java b/java/common/org/linphone/core/LinphoneFriend.java index e070f6921..417c582d9 100644 --- a/java/common/org/linphone/core/LinphoneFriend.java +++ b/java/common/org/linphone/core/LinphoneFriend.java @@ -37,7 +37,7 @@ public interface LinphoneFriend { static class SubscribePolicy { - static private Vector values = new Vector(); + static private Vector values = new Vector(); protected final int mValue; private final String mStringValue; /** diff --git a/java/common/org/linphone/core/OnlineStatus.java b/java/common/org/linphone/core/OnlineStatus.java index a1b36ab37..081084171 100644 --- a/java/common/org/linphone/core/OnlineStatus.java +++ b/java/common/org/linphone/core/OnlineStatus.java @@ -28,7 +28,7 @@ import java.util.Vector; public class OnlineStatus { - static private Vector values = new Vector(); + static private Vector values = new Vector(); /** * Offline */ From 3e7a110e0178ca23f7c887ddec23abb7dca5846a Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 10 Dec 2012 17:02:48 +0100 Subject: [PATCH 746/769] Fix autotool warnings --- Makefile.am | 30 +++++++++---------- configure.ac | 4 +-- console/Makefile.am | 39 +++++++++++++++---------- coreapi/Makefile.am | 13 ++++----- coreapi/help/Makefile.am | 26 ++++++++--------- coreapi/linphonecore.h | 1 - coreapi/plugins/buddylookup/Makefile.am | 10 +++---- m4/Makefile.am | 2 +- m4/intl.m4 | 2 +- m4/obsolete.m4 | 1 + m4/po.m4 | 2 +- mediastreamer2 | 2 +- oRTP | 2 +- share/Makefile.inc | 2 +- 14 files changed, 69 insertions(+), 67 deletions(-) create mode 100644 m4/obsolete.m4 diff --git a/Makefile.am b/Makefile.am index 4aa4332f2..7a9d755b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,13 +18,13 @@ OPTIONAL_SOUNDS=\ share/sounds/linphone/rings/rock.wav -INSTALLDIR=$(shell cd $(top_builddir) && pwd)/linphone-install +INSTALLDIR=$(abs_top_builddir)/linphone-install INSTALLDIR_WITH_PREFIX=$(INSTALLDIR)/$(prefix) -ZIPFILE=$(shell cd $(top_builddir) && pwd)/$(PACKAGE)-win32-$(VERSION).zip +ZIPFILE=$(abs_top_builddir)/$(PACKAGE)-win32-$(VERSION).zip ZIP_EXCLUDED=include lib \ $(OPTIONAL_SOUNDS) -SDK_ZIPFILE=$(shell cd $(top_builddir) && pwd)/lib$(PACKAGE)-win32-$(VERSION).zip +SDK_ZIPFILE=$(abs_top_builddir)/lib$(PACKAGE)-win32-$(VERSION).zip SDK_EXCLUDED= \ bin/linphone.exe \ lib/*.la \ @@ -38,11 +38,11 @@ SDK_EXCLUDED= \ GTK_PREFIX=/ GTK_THEME=Outcrop GTK_FILELIST=gtk+-2.22.1.filelist -GTK_FILELIST_PATH=$(shell cd $(top_srcdir) && pwd)/$(GTK_FILELIST) +GTK_FILELIST_PATH=$(abs_top_srcdir)/$(GTK_FILELIST) LINPHONEDEPS_FILELIST=linphone-deps.filelist -WINBINDIST_FILES=$(shell cat $(top_srcdir)/$(LINPHONEDEPS_FILELIST)) +WINBINDIST_FILES=`cat $(top_srcdir)/$(LINPHONEDEPS_FILELIST)` ISS_SCRIPT=linphone.iss -ISS_SCRIPT_PATH=$(shell cd $(top_srcdir) && pwd)/$(ISS_SCRIPT) +ISS_SCRIPT_PATH=$(abs_top_srcdir)/$(ISS_SCRIPT) #path to Inno Setup 5 compiler ISCC=ISCC.exe PACKAGE_WIN32_FILELIST=$(PACKAGE)-win32.filelist @@ -102,7 +102,7 @@ other-cherrypick: cd $(GTK_PREFIX) && \ for file in $(WINBINDIST_FILES) ; do \ if test -d $$file; then \ - mkdir -p $(INSTALLDIR_WITH_PREFIX)/$$file ;\ + $(MKDIR_P) $(INSTALLDIR_WITH_PREFIX)/$$file ;\ else \ cp $$file $(INSTALLDIR_WITH_PREFIX)/$$file ;\ fi \ @@ -119,18 +119,18 @@ gtk-cherrypick: cd $(GTK_PREFIX) && \ for file in `cat $(GTK_FILELIST_PATH)` ; do \ if test -d $$file; then \ - mkdir -p $(INSTALLDIR_WITH_PREFIX)/$$file ;\ + $(MKDIR_P) $(INSTALLDIR_WITH_PREFIX)/$$file ;\ else \ cp $$file $(INSTALLDIR_WITH_PREFIX)/$$file ;\ fi \ done && \ - mkdir -p $(INSTALLDIR_WITH_PREFIX)/share/themes && \ + $(MKDIR_P) $(INSTALLDIR_WITH_PREFIX)/share/themes && \ cp -rf share/themes/$(GTK_THEME) $(INSTALLDIR_WITH_PREFIX)/share/themes/. zip: rm -f $(ZIPFILE) rm -rf $(INSTALLDIR) - mkdir -p $(INSTALLDIR) + $(MKDIR_P) $(INSTALLDIR) make install DESTDIR=$(INSTALLDIR) #remove unwanted linphone stuff cd $(INSTALLDIR_WITH_PREFIX) && rm -rf $(ZIP_EXCLUDED) @@ -145,7 +145,7 @@ zip: sdk: rm -f $(SDK_ZIPFILE) rm -rf $(INSTALLDIR) - mkdir -p $(INSTALLDIR) + $(MKDIR_P) $(INSTALLDIR) make install DESTDIR=$(INSTALLDIR) # remove unwanted stuff (gtk interface) cd $(INSTALLDIR_WITH_PREFIX) && rm -rf $(SDK_EXCLUDED) @@ -182,12 +182,12 @@ newdate: cd gtk && $(MAKE) newdate if HAVE_MD5SUM -GEN_MD5=$(shell $(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$4'}) +GEN_MD5=`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$4'}` else -GEN_MD5=$(shell $(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$1'}) +GEN_MD5=`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$1'}` endif -Portfile: $(top_srcdir)/scripts/Portfile.tmpl dist +Portfile: $(top_srcdir)/scripts/Portfile.tmpl dist sed -e 's/\@VERSION\@/$(LINPHONE_VERSION)/g' \ -e 's/\@LINPHONE_MD5\@/$(GEN_MD5)/' < $< > $@ @@ -210,7 +210,7 @@ $(LIBICONV_HACK): bundle: $(LIBICONV_HACK) rm -rf $(INSTALLDIR) - mkdir -p $(INSTALLDIR) + $(MKDIR_P) $(INSTALLDIR) make install DESTDIR=$(INSTALLDIR) BUNDLE_PREFIX=$(BUNDLEPREFIX) \ LINPHONE_INSTALL_PREFIX=$(INSTALLDIR_WITH_PREFIX) \ diff --git a/configure.ac b/configure.ac index 4cfea5e64..8f45f73a7 100644 --- a/configure.ac +++ b/configure.ac @@ -32,9 +32,9 @@ AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)]) AM_INIT_AUTOMAKE AC_SUBST([LIBTOOL_DEPS]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],) +AC_SUBST([docdir], [${datadir}/doc]) AC_CONFIG_HEADER(config.h) AC_CONFIG_MACRO_DIR([m4]) -AC_SUBST([mkdir_p]) AC_ISC_POSIX AC_PROG_CC AC_PROG_CXX @@ -118,7 +118,7 @@ fi GETTEXT_PACKAGE=linphone AC_SUBST(GETTEXT_PACKAGE) -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",[The name of the gettext package name]) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext package name]) dnl AC_CHECK_LIB(intl,libintl_gettext) AC_CHECK_FUNCS([get_current_dir_name strndup stpcpy] ) diff --git a/console/Makefile.am b/console/Makefile.am index bbc310967..23a7635d1 100644 --- a/console/Makefile.am +++ b/console/Makefile.am @@ -1,25 +1,32 @@ ## Process this file with automake to produce Makefile.in -COMMON_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE -DENABLE_TRACE -D_ORTP_SOURCE $(VIDEO_CFLAGS) $(READLINE_CFLAGS) $(OSIP_CFLAGS) +AM_CPPFLAGS=\ + -I$(top_srcdir) \ + -I$(top_srcdir)/coreapi \ + -I$(top_srcdir)/exosip + +COMMON_CFLAGS=\ + -DIN_LINPHONE \ + -DENABLE_TRACE \ + -D_ORTP_SOURCE \ + $(STRICT_OPTIONS) \ + $(VIDEO_CFLAGS) \ + $(READLINE_CFLAGS) \ + $(OSIP_CFLAGS) \ + $(ORTP_CFLAGS) \ + $(MEDIASTREAMER_CFLAGS) if BUILD_CONSOLE -INCLUDES = \ - -I$(top_srcdir)\ - -I$(top_srcdir)/coreapi\ - $(ORTP_CFLAGS) \ - -I$(top_srcdir)/exosip \ - $(MEDIASTREAMER_CFLAGS) - -bin_PROGRAMS = linphonec linphonecsh +bin_PROGRAMS=linphonec linphonecsh if BUILD_WIN32 -bin_PROGRAMS += linphoned +bin_PROGRAMS+=linphoned endif -linphonec_SOURCES = linphonec.c linphonec.h commands.c +linphonec_SOURCES=linphonec.c linphonec.h commands.c linphonec_CFLAGS=$(COMMON_CFLAGS) $(CONSOLE_FLAGS) -linphonec_LDADD = $(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) \ +linphonec_LDADD=$(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) \ $(MEDIASTREAMER_LIBS) \ $(ORTP_LIBS) \ $(SPEEX_LIBS) \ @@ -28,15 +35,15 @@ linphonec_LDADD = $(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) \ if BUILD_WIN32 #special build of linphonec to detach from the windows console -linphoned_SOURCES = $(linphonec_SOURCES) +linphoned_SOURCES=$(linphonec_SOURCES) linphoned_CFLAGS=$(COMMON_CFLAGS) $(GUI_FLAGS) linphoned_LDADD=$(linphonec_LDADD) endif -linphonecsh_SOURCES = shell.c -linphonecsh_CFLAGS = $(CONSOLE_FLAGS) -linphonecsh_LDADD = $(ORTP_LIBS) +linphonecsh_SOURCES=shell.c +linphonecsh_CFLAGS=$(COMMON_CFLAGS) $(CONSOLE_FLAGS) +linphonecsh_LDADD=$(ORTP_LIBS) endif diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index a984799b9..790612cab 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -1,7 +1,7 @@ GITVERSION_FILE=liblinphone_gitversion.h GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp -GITDESCRIBE=$(shell git describe) -GITREVISION=$(shell git rev-parse HEAD) +GITDESCRIBE=`git describe` +GITREVISION=`git rev-parse HEAD` ECHO=/bin/echo @@ -22,10 +22,6 @@ if BUILD_TUNNEL linphone_include_HEADERS+=linphone_tunnel.h endif -INCLUDES = \ - -I$(top_srcdir) - - lib_LTLIBRARIES=liblinphone.la liblinphone_la_SOURCES=\ @@ -89,8 +85,11 @@ test_numbers_SOURCES=test_numbers.c test_numbers_LDADD=liblinphone.la $(liblinphone_la_LIBADD) endif +AM_CPPFLAGS=\ + -I$(top_srcdir) -AM_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE \ +AM_CFLAGS=\ + $(STRICT_OPTIONS) -DIN_LINPHONE \ $(ORTP_CFLAGS) \ $(MEDIASTREAMER_CFLAGS) \ $(OSIP_CFLAGS) \ diff --git a/coreapi/help/Makefile.am b/coreapi/help/Makefile.am index a68ab2f19..902d23c9c 100644 --- a/coreapi/help/Makefile.am +++ b/coreapi/help/Makefile.am @@ -1,21 +1,20 @@ -EXTRA_DIST = Doxyfile.in doxygen.dox +EXTRA_DIST=Doxyfile.in doxygen.dox -SOURCES= doxygen.dox $(top_srcdir)/coreapi/help/*.c $(top_srcdir)/coreapi/*.c $(top_srcdir)/coreapi/*.h +SOURCES=doxygen.dox $(top_srcdir)/coreapi/help/*.c $(top_srcdir)/coreapi/*.c $(top_srcdir)/coreapi/*.h -#html doc +# html doc if HAVE_DOXYGEN -# doxdir & pkgdocdir are not always defined by automake -docdir=$(datadir)/doc +# docdir & pkgdocdir are not always defined by automake pkgdocdir=$(docdir)/$(PACKAGE)-$(VERSION) doc_htmldir=$(pkgdocdir)/html doc_html_DATA = $(top_builddir)/coreapi/help/doc/html/html.tar $(doc_html_DATA): $(top_builddir)/coreapi/help/doc/html/index.html - cd $( Date: Tue, 11 Dec 2012 09:29:53 +0100 Subject: [PATCH 747/769] Fix shell substitutions --- Makefile.am | 6 +++--- coreapi/Makefile.am | 4 ++-- m4/Makefile.am | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7a9d755b2..33e4d377c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,7 +40,7 @@ GTK_THEME=Outcrop GTK_FILELIST=gtk+-2.22.1.filelist GTK_FILELIST_PATH=$(abs_top_srcdir)/$(GTK_FILELIST) LINPHONEDEPS_FILELIST=linphone-deps.filelist -WINBINDIST_FILES=`cat $(top_srcdir)/$(LINPHONEDEPS_FILELIST)` +WINBINDIST_FILES="`cat $(top_srcdir)/$(LINPHONEDEPS_FILELIST)`" ISS_SCRIPT=linphone.iss ISS_SCRIPT_PATH=$(abs_top_srcdir)/$(ISS_SCRIPT) #path to Inno Setup 5 compiler @@ -182,9 +182,9 @@ newdate: cd gtk && $(MAKE) newdate if HAVE_MD5SUM -GEN_MD5=`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$4'}` +GEN_MD5="`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$4'}`" else -GEN_MD5=`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$1'}` +GEN_MD5="`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$1'}`" endif Portfile: $(top_srcdir)/scripts/Portfile.tmpl dist diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 790612cab..dcaa9ba29 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -1,7 +1,7 @@ GITVERSION_FILE=liblinphone_gitversion.h GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp -GITDESCRIBE=`git describe` -GITREVISION=`git rev-parse HEAD` +GITDESCRIBE="`git describe`" +GITREVISION="`git rev-parse HEAD`" ECHO=/bin/echo diff --git a/m4/Makefile.am b/m4/Makefile.am index 8fb881339..992fa9386 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,2 +1,2 @@ -EXTRA_DIST=`ls $(srcdir)/*.m4` +EXTRA_DIST="`ls $(srcdir)/*.m4`" From 7f5682a95d8caa72dad7e1a328b0dbbc86be5648 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 11 Dec 2012 10:03:16 +0100 Subject: [PATCH 748/769] Revert "Fix shell substitutions" This reverts commit 7095521237d1dc3eb1ce545ad9243c2609ab42de. --- Makefile.am | 6 +++--- coreapi/Makefile.am | 4 ++-- m4/Makefile.am | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 33e4d377c..7a9d755b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,7 +40,7 @@ GTK_THEME=Outcrop GTK_FILELIST=gtk+-2.22.1.filelist GTK_FILELIST_PATH=$(abs_top_srcdir)/$(GTK_FILELIST) LINPHONEDEPS_FILELIST=linphone-deps.filelist -WINBINDIST_FILES="`cat $(top_srcdir)/$(LINPHONEDEPS_FILELIST)`" +WINBINDIST_FILES=`cat $(top_srcdir)/$(LINPHONEDEPS_FILELIST)` ISS_SCRIPT=linphone.iss ISS_SCRIPT_PATH=$(abs_top_srcdir)/$(ISS_SCRIPT) #path to Inno Setup 5 compiler @@ -182,9 +182,9 @@ newdate: cd gtk && $(MAKE) newdate if HAVE_MD5SUM -GEN_MD5="`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$4'}`" +GEN_MD5=`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$4'}` else -GEN_MD5="`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$1'}`" +GEN_MD5=`$(MD5SUM) linphone-$(VERSION).tar.gz | awk {'print $$1'}` endif Portfile: $(top_srcdir)/scripts/Portfile.tmpl dist diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index dcaa9ba29..790612cab 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -1,7 +1,7 @@ GITVERSION_FILE=liblinphone_gitversion.h GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp -GITDESCRIBE="`git describe`" -GITREVISION="`git rev-parse HEAD`" +GITDESCRIBE=`git describe` +GITREVISION=`git rev-parse HEAD` ECHO=/bin/echo diff --git a/m4/Makefile.am b/m4/Makefile.am index 992fa9386..8fb881339 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,2 +1,2 @@ -EXTRA_DIST="`ls $(srcdir)/*.m4`" +EXTRA_DIST=`ls $(srcdir)/*.m4` From 7d07ca75e745d5fc29e3f5687b5eed17a2e54135 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 11 Dec 2012 10:36:27 +0100 Subject: [PATCH 749/769] Apply the user agent as soon as it is changed. The user agent is no longer global and now depends on the linphone core (kind of, there is still a global variable behind to hold its value). --- coreapi/linphonecore.c | 3 ++- coreapi/linphonecore.h | 5 +++-- coreapi/linphonecore_jni.cc | 2 +- gtk/main.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e52bef3f7..e52fff00e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1671,9 +1671,10 @@ static void apply_user_agent(LinphoneCore *lc){ * * @ingroup misc **/ -void linphone_core_set_user_agent(const char *name, const char *ver){ +void linphone_core_set_user_agent(LinphoneCore *lc, const char *name, const char *ver){ strncpy(_ua_name,name,sizeof(_ua_name)-1); strncpy(_ua_version,ver,sizeof(_ua_version)); + apply_user_agent(lc); } const char *linphone_core_get_user_agent_name(void){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 17234a600..f1a9174c8 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -901,8 +901,6 @@ typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *contex void linphone_core_enable_logs(FILE *file); void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc); void linphone_core_disable_logs(void); -/*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */ -void linphone_core_set_user_agent(const char *ua_name, const char *version); const char *linphone_core_get_version(void); const char *linphone_core_get_user_agent_name(void); const char *linphone_core_get_user_agent_version(void); @@ -932,6 +930,9 @@ const char* linphone_core_get_device_identifier(const LinphoneCore *lc); #endif +/*sets the user-agent string in sip messages, ideally called just after linphone_core_new() or linphone_core_init() */ +void linphone_core_set_user_agent(LinphoneCore *lc, const char *ua_name, const char *version); + LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url); LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 99d46fb18..06188f411 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2141,7 +2141,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnable(JNIEnv *env extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUserAgent(JNIEnv *env,jobject thiz,jlong pCore, jstring name, jstring version){ const char* cname=env->GetStringUTFChars(name, NULL); const char* cversion=env->GetStringUTFChars(version, NULL); - linphone_core_set_user_agent(cname,cversion); + linphone_core_set_user_agent((LinphoneCore *)pCore,cname,cversion); env->ReleaseStringUTFChars(name, cname); env->ReleaseStringUTFChars(version, cversion); } diff --git a/gtk/main.c b/gtk/main.c index b773a5b7f..48bf27a08 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -239,8 +239,8 @@ static void linphone_gtk_init_liblinphone(const char *config_file, vtable.call_encryption_changed=linphone_gtk_call_encryption_changed; vtable.transfer_state_changed=linphone_gtk_transfer_state_changed; - linphone_core_set_user_agent("Linphone", LINPHONE_VERSION); the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL); + linphone_core_set_user_agent(the_core,"Linphone", LINPHONE_VERSION); linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL); linphone_core_set_zrtp_secrets_file(the_core,secrets_file); g_free(secrets_file); From 096f45348319fef1f8d4a3348252c689d03f5f00 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 11 Dec 2012 10:39:53 +0100 Subject: [PATCH 750/769] Fix m4 --- m4/Makefile.am | 43 +++++++++++++++++++++++++++++++++++++++++-- mediastreamer2 | 2 +- oRTP | 2 +- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/m4/Makefile.am b/m4/Makefile.am index 8fb881339..804180768 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,2 +1,41 @@ -EXTRA_DIST=`ls $(srcdir)/*.m4` - +EXTRA_DIST=\ + codeset.m4 \ + exosip.m4 \ + gettext.m4 \ + glibc2.m4 \ + glibc21.m4 \ + iconv.m4 \ + ilbc.m4 \ + intdiv0.m4 \ + intl.m4 \ + intldir.m4 \ + intmax.m4 \ + inttypes-pri.m4 \ + inttypes.m4 \ + inttypes_h.m4 \ + isc-posix.m4 \ + lcmessage.m4 \ + lib-ld.m4 \ + lib-link.m4 \ + lib-prefix.m4 \ + lock.m4 \ + longdouble.m4 \ + longlong.m4 \ + nls.m4 \ + obsolete.m4 \ + ortp.m4 \ + osip.m4 \ + po.m4 \ + printf-posix.m4 \ + progtest.m4 \ + readline.m4 \ + signed.m4 \ + size_max.m4 \ + stdint_h.m4 \ + uintmax_t.m4 \ + ulonglong.m4 \ + video.m4 \ + visibility.m4 \ + wchar_t.m4 \ + wint_t.m4 \ + xsize.m4 diff --git a/mediastreamer2 b/mediastreamer2 index 4448148a5..4f4ebb3a7 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 4448148a56924506ddecbeffb75251845251c750 +Subproject commit 4f4ebb3a7ad5755925f9612e95f7e34b677cf664 diff --git a/oRTP b/oRTP index 1b449a349..36ebc75f7 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 1b449a3491fb2397df129467bf58a64921d65e40 +Subproject commit 36ebc75f7dfef4f4a2b63df61a040211e7c7f6c8 From 1e75dc40229e1f8e6e5c6c121957722f11c03a3e Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 11 Dec 2012 10:59:40 +0100 Subject: [PATCH 751/769] Add JNI glue to enable/disable low bandwidth param in call --- coreapi/linphonecore_jni.cc | 5 ++++- java/common/org/linphone/core/LinphoneCallParams.java | 8 ++++++++ java/impl/org/linphone/core/LinphoneCallParamsImpl.java | 6 +++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 06188f411..d5835fe34 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1774,6 +1774,10 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv //CallParams +extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableLowBandwidth(JNIEnv *env, jobject thiz, jlong cp, jboolean enable) { + linphone_call_params_enable_low_bandwidth((LinphoneCallParams *)cp, enable); +} + extern "C" jlong Java_org_linphone_core_LinphoneCallParamsImpl_getUsedAudioCodec(JNIEnv *env, jobject thiz, jlong cp) { return (jlong)linphone_call_params_get_used_audio_codec((LinphoneCallParams *)cp); } @@ -1851,7 +1855,6 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_updateCall(JNIEnv *env, return (jint) linphone_core_update_call((LinphoneCore *)lc, (LinphoneCall *)call, (const LinphoneCallParams *)params); } - extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPreferredVideoSize(JNIEnv *env, jobject thiz, jlong lc, jint width, jint height){ MSVideoSize vsize; vsize.width = (int)width; diff --git a/java/common/org/linphone/core/LinphoneCallParams.java b/java/common/org/linphone/core/LinphoneCallParams.java index 2dd497c9c..730a99dc2 100644 --- a/java/common/org/linphone/core/LinphoneCallParams.java +++ b/java/common/org/linphone/core/LinphoneCallParams.java @@ -57,4 +57,12 @@ public interface LinphoneCallParams { * @return PayloadType or null */ PayloadType getUsedVideoCodec(); + + /** + * Indicate low bandwith mode. + * Configuring a call to low bandwidth mode will result in the core to activate several settings for the call in order to ensure that bitrate usage + * is lowered to the minimum possible. Typically, ptime (packetization time) will be increased, audio codec's output bitrate will be targetted to 20kbit/s provided + * that it is achievable by the codec selected after SDP handshake. Video is automatically disabled. + **/ + void enableLowBandwidth(boolean enable); } diff --git a/java/impl/org/linphone/core/LinphoneCallParamsImpl.java b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java index 3c4514017..be3495a8d 100644 --- a/java/impl/org/linphone/core/LinphoneCallParamsImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java @@ -35,7 +35,7 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native long getUsedAudioCodec(long nativePtr); private native long getUsedVideoCodec(long nativePtr); private native void destroy(long nativePtr); - + private native void enableLowBandwidth(long nativePtr, boolean enable); public boolean getVideoEnabled() { return getVideoEnabled(nativePtr); @@ -79,4 +79,8 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public boolean localConferenceMode() { return localConferenceMode(nativePtr); } + + public void enableLowBandwidth(boolean enable) { + enableLowBandwidth(nativePtr, enable); + } } From c7993cbbbd175555d087c37035e15bf9490d0247 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 11 Dec 2012 11:49:44 +0100 Subject: [PATCH 752/769] Update oRTP and ms2 --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 4f4ebb3a7..fd1190c60 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 4f4ebb3a7ad5755925f9612e95f7e34b677cf664 +Subproject commit fd1190c60660beb4b51abbb52c53d57195b5e194 diff --git a/oRTP b/oRTP index 36ebc75f7..59ff6bb7a 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 36ebc75f7dfef4f4a2b63df61a040211e7c7f6c8 +Subproject commit 59ff6bb7a0c5047526b802d264f6db4faa2bd5c2 From 5397f98c3ed03f05bc91fd1c18ef031d3153d1ad Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 11 Dec 2012 14:46:13 +0100 Subject: [PATCH 753/769] Update ms2 submodule for android video fix. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index fd1190c60..e99ba7728 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit fd1190c60660beb4b51abbb52c53d57195b5e194 +Subproject commit e99ba7728ddf6a075a0804afebf86eb547a1f41b From 58c708a10badf27965c00232de99904415f0b1a8 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 11 Dec 2012 17:00:04 +0100 Subject: [PATCH 754/769] Add JNI glue to get timestamp for logs --- coreapi/linphonecore_jni.cc | 5 +++++ java/common/org/linphone/core/LinphoneCallLog.java | 5 +++++ java/impl/org/linphone/core/LinphoneCallLogImpl.java | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index d5835fe34..63d94411e 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1294,6 +1294,11 @@ extern "C" jstring Java_org_linphone_core_LinphoneCallLogImpl_getStartDate(JNIEn jstring jvalue =env->NewStringUTF(((LinphoneCallLog*)ptr)->start_date); return jvalue; } +extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTimestamp(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + return static_cast (((LinphoneCallLog*)ptr)->start_date_time); +} extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEnv* env ,jobject thiz ,jlong ptr) { diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index 821be24d0..2e839234f 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -100,6 +100,11 @@ public interface LinphoneCallLog { */ public String getStartDate(); + /** + * @return a timestamp of the start date/time of the call in milliseconds since January 1st 1970 + */ + public long getTimestamp(); + /** * @return the call duration, in seconds */ diff --git a/java/impl/org/linphone/core/LinphoneCallLogImpl.java b/java/impl/org/linphone/core/LinphoneCallLogImpl.java index 05468626e..7582dbd46 100644 --- a/java/impl/org/linphone/core/LinphoneCallLogImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallLogImpl.java @@ -30,6 +30,7 @@ class LinphoneCallLogImpl implements LinphoneCallLog { private native String getStartDate(long nativePtr); private native int getCallDuration(long nativePtr); private native int getCallId(long nativePtr); + private native long getTimestamp(long nativePtr); LinphoneCallLogImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -64,4 +65,8 @@ class LinphoneCallLogImpl implements LinphoneCallLog { public int getCallId() { return getCallId(nativePtr); } + + public long getTimestamp() { + return getTimestamp(nativePtr); + } } From 28912d223403c8164b35d14d5b5925b61e4b65ac Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 11 Dec 2012 17:10:07 +0100 Subject: [PATCH 755/769] Need milliseconds, not seconds --- java/impl/org/linphone/core/LinphoneCallLogImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/impl/org/linphone/core/LinphoneCallLogImpl.java b/java/impl/org/linphone/core/LinphoneCallLogImpl.java index 7582dbd46..2419d74b3 100644 --- a/java/impl/org/linphone/core/LinphoneCallLogImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallLogImpl.java @@ -67,6 +67,6 @@ class LinphoneCallLogImpl implements LinphoneCallLog { } public long getTimestamp() { - return getTimestamp(nativePtr); + return getTimestamp(nativePtr) * 1000; // Need milliseconds, not seconds } } From ae3e9911b9aeeb369dbfd40e58d3aedbd448dff6 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 11 Dec 2012 17:09:21 +0100 Subject: [PATCH 756/769] Improve output of configure --help. --- configure.ac | 108 +++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/configure.ac b/configure.ac index 8f45f73a7..97474be2e 100644 --- a/configure.ac +++ b/configure.ac @@ -124,16 +124,16 @@ dnl AC_CHECK_LIB(intl,libintl_gettext) AC_CHECK_FUNCS([get_current_dir_name strndup stpcpy] ) AC_ARG_ENABLE(x11, - [ --disable-x11 Disable X11 support], - [case "${enableval}" in - yes) enable_x11=true ;; - no) enable_x11=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;; - esac],[enable_x11=true]) + [AS_HELP_STRING([--disable-x11], [Disable X11 support (default=no)])], + [case "${enableval}" in + yes) enable_x11=true ;; + no) enable_x11=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;; + esac],[enable_x11=true]) dnl conditionnal build of console interface. AC_ARG_ENABLE(console_ui, - [ --enable-console_ui=[yes/no] Turn on or off compilation of console interface [default=yes]], + [AS_HELP_STRING([--enable-console_ui=[yes/no]], [Turn on or off compilation of console interface (default=yes)])], [case "${enableval}" in yes) console_ui=true ;; no) console_ui=false ;; @@ -142,7 +142,7 @@ AC_ARG_ENABLE(console_ui, dnl conditionnal build of gtk interface. AC_ARG_ENABLE(gtk_ui, - [ --enable-gtk_ui=[yes/no] Turn on or off compilation of gtk interface [default=yes]], + [AS_HELP_STRING([--enable-gtk_ui=[yes/no]], [Turn on or off compilation of gtk interface (default=yes)])], [case "${enableval}" in yes) gtk_ui=true ;; no) gtk_ui=false ;; @@ -160,12 +160,12 @@ else fi AC_ARG_ENABLE(notify, - [ --enable-notify=[yes/no] Enable libnotify support [default=yes]], - [case "${enableval}" in - yes) notify=true ;; - no) notify=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-notify) ;; - esac],[notify=true]) + [AS_HELP_STRING([--enable-notify=[yes/no]], [Enable libnotify support (default=yes)])], + [case "${enableval}" in + yes) notify=true ;; + no) notify=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-notify) ;; + esac],[notify=true]) dnl conditionnal build of the notify library if test "$gtk_ui" = "true" ; then @@ -205,14 +205,14 @@ case "$host_cpu" in ;; esac -AC_ARG_WITH( configdir, - [ --with-configdir Set a APPDATA subdir where linphone is supposed to find its config (windows only) ], +AC_ARG_WITH(configdir, + [AS_HELP_STRING([--with-configdir], [Set a APPDATA subdir where linphone is supposed to find its config (windows only)])], [ configdir=${withval}],[ configdir="Linphone" ]) AC_DEFINE_UNQUOTED(LINPHONE_CONFIG_DIR,"$configdir",[Windows appdata subdir where linphonerc can be found]) AC_ARG_ENABLE(relativeprefix, - [ --enable-relativeprefix Build a linphone that finds its resources relatively to the directory where it is installed], + [AS_HELP_STRING([--enable-relativeprefix], [Build a linphone that finds its resources relatively to the directory where it is installed])], [case "${enableval}" in yes) relativeprefix=yes ;; no) relativeprefix=no ;; @@ -220,7 +220,7 @@ AC_ARG_ENABLE(relativeprefix, esac],[relativeprefix=guess]) AC_ARG_ENABLE(date, - [ --enable-date Use build date in internal version number], + [AS_HELP_STRING([--enable-date], [Use build date in internal version number])], [case "${enableval}" in yes) use_date=yes ;; no) use_date=no ;; @@ -234,7 +234,7 @@ fi dnl enable ipv6 support AC_ARG_ENABLE(ipv6, - [ --enable-ipv6 Turn on ipv6 support], + [AS_HELP_STRING([--enable-ipv6], [Turn on ipv6 support])], [case "${enableval}" in yes) ipv6=true;; no) ipv6=false;; @@ -248,7 +248,7 @@ AC_SUBST(IPV6_CFLAGS) dnl enable timestamp support AC_ARG_ENABLE(ntp-timestamp, - [ --enable-ntp-timestamp Turn on NTP timestamping on received packet], + [AS_HELP_STRING([--enable-ntp-timestamp], [Turn on NTP timestamping on received packet])], [case "${enableval}" in yes) ntptimestamp=true;; no) ntptimestamp=false;; @@ -256,17 +256,16 @@ AC_ARG_ENABLE(ntp-timestamp, esac],[ntptimestamp=false]) AC_ARG_ENABLE(debug, - [ --enable-debug=[yes/no] enables the display of traces showing the execution of the library. [default=yes]], - [case "${enableval}" in - yes) debug_enabled=yes;; - no) debug_enabled=no;; - *) AC_MSG_ERROR("Bad value for --enable-debug");; - esac], - [debug_enabled=no]) + [AS_HELP_STRING([--enable-debug=[yes/no]], [Enables the display of traces showing the execution of the library. (default=yes)])], + [case "${enableval}" in + yes) debug_enabled=yes;; + no) debug_enabled=no;; + *) AC_MSG_ERROR("Bad value for --enable-debug");; + esac],[debug_enabled=no]) dnl enable truespeech codec support AC_ARG_ENABLE(truespeech, - [ --enable-truespeech Turn on TrueSpeech support (x86 only)], + [AS_HELP_STRING([--enable-truespeech], [Turn on TrueSpeech support (x86 only)])], [case "${enableval}" in yes) truespeech=true;; no) truespeech=false;; @@ -280,11 +279,11 @@ AC_SUBST(TRUESPEECH_CFLAGS) AM_CONDITIONAL([BUILD_TRUESPEECH], [test x$truespeech = xtrue]) AC_ARG_ENABLE(nonstandard-gsm, - [ --enable-nonstandard-gsm Enable GSM codec at nonstandard rates (11025hz, 16000hz)], + [AS_HELP_STRING([--enable-nonstandard-gsm], [Enable GSM codec at nonstandard rates (11025hz, 16000hz)])], [case "${enableval}" in yes) exotic_gsm=yes - AC_DEFINE(ENABLE_NONSTANDARD_GSM,1,[Defined when using gsm at nonstandard rates]) - ;; + AC_DEFINE(ENABLE_NONSTANDARD_GSM,1,[Defined when using gsm at nonstandard rates]) + ;; no) exotic_gsm=no ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-nonstandard-gsm) ;; esac],[exotic_gsm=no]) @@ -292,7 +291,7 @@ AC_ARG_ENABLE(nonstandard-gsm, dnl support for RSVP (by Vincent Maury) AC_ARG_ENABLE(rsvp, -[ --enable-rsvp enable support for QoS reservations.], +[AS_HELP_STRING([--enable-rsvp], [Enable support for QoS reservations.])], AC_DEFINE(VINCENT_MAURY_RSVP,1,[Tell whether RSVP support should be compiled.]) ) @@ -331,12 +330,12 @@ LP_CHECK_OSIP2 dnl conditionnal build for ssl AC_ARG_ENABLE(ssl, - [ --enable-ssl Turn on ssl support compiling. Required for sip tls. default = false], - [case "${enableval}" in - yes) build_ssl=true ;; - no) build_ssl=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-ssl) ;; - esac],[build_ssl=false]) + [AS_HELP_STRING([--enable-ssl], [Turn on ssl support compiling. Required for sip tls. (default=false)])], + [case "${enableval}" in + yes) build_ssl=true ;; + no) build_ssl=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ssl) ;; + esac],[build_ssl=false]) if test "$build_ssl" = "true"; then PKG_CHECK_MODULES(OPENSSL, libssl >= 0.9.8) @@ -367,16 +366,16 @@ fi dnl conditionnal build of video support AC_ARG_ENABLE(video, - [ --enable-video Turn on video support compiling], - [case "${enableval}" in - yes) video=true ;; - no) video=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;; - esac],[video=true]) - + [AS_HELP_STRING([--enable-video], [Turn on video support compiling])], + [case "${enableval}" in + yes) video=true ;; + no) video=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;; + esac],[video=true]) + AC_ARG_WITH( ffmpeg, - [ --with-ffmpeg Sets the installation prefix of ffmpeg, needed for video support. [default=/usr] ], - [ ffmpegdir=${withval}],[ ffmpegdir=/usr ]) + [AS_HELP_STRING([--with-ffmpeg], [Sets the installation prefix of ffmpeg, needed for video support. (default=/usr)])], + [ ffmpegdir=${withval}],[ ffmpegdir=/usr ]) if test "$video" = "true"; then @@ -393,7 +392,7 @@ if test "$video" = "true"; then fi AC_ARG_ENABLE(alsa, - [ --enable-alsa Turn on alsa native support compiling], + [AS_HELP_STRING([--enable-alsa], [Turn on alsa native support compiling])], [case "${enableval}" in yes) alsa=true ;; no) alsa=false ;; @@ -401,7 +400,7 @@ AC_ARG_ENABLE(alsa, esac],[alsa=true]) AC_ARG_ENABLE(zrtp, - [ --enable-zrtp Turn on zrtp support ], + [AS_HELP_STRING([--enable-zrtp], [Turn on zrtp support])], [case "${enableval}" in yes) zrtp=true ;; no) zrtp=false ;; @@ -410,7 +409,7 @@ AC_ARG_ENABLE(zrtp, AC_ARG_ENABLE(portaudio, - [ --enable-portaudio Turn on portaudio native support compiling], + [AS_HELP_STRING([--enable-portaudio], [Turn on portaudio native support compiling])], [case "${enableval}" in yes) portaudio=true ;; no) portaudio=false ;; @@ -440,7 +439,7 @@ if test "$has_sighandler_t" = "yes" ; then fi AC_ARG_ENABLE(assistant, - [ --enable-assistant Turn on assistant compiling], + [AS_HELP_STRING([--enable-assistant], [Turn on assistant compiling])], [case "${enableval}" in yes) build_wizard=true ;; no) build_wizard=false ;; @@ -531,7 +530,7 @@ AC_SUBST([MS2_DIR]) AC_ARG_ENABLE(tunnel, - [ --enable-tunnel=[yes/no] Turn on compilation of tunnel support [default=no]], + [AS_HELP_STRING([--enable-tunnel=[yes/no]], [Turn on compilation of tunnel support (default=no)])], [case "${enableval}" in yes) enable_tunnel=true ;; no) enable_tunnel=false ;; @@ -575,7 +574,7 @@ LINPHONE_PLUGINS_DIR="${package_prefix}/lib/liblinphone/plugins" AC_SUBST(LINPHONE_PLUGINS_DIR) AC_ARG_ENABLE(external-ortp, - [ --enable-external-ortp Use external oRTP library], + [AS_HELP_STRING([--enable-external-ortp], [Use external oRTP library])], [case "${enableval}" in yes) external_ortp=true ;; no) external_ortp=false ;; @@ -606,7 +605,7 @@ AC_SUBST([ORTP_VERSION]) AC_SUBST([ORTP_DIR]) AC_ARG_ENABLE(tests_enabled, - [ --disable-tests Disable compilation of tests], + [AS_HELP_STRING([--disable-tests], [Disable compilation of tests])], [case "${enableval}" in yes) tests_enabled=true ;; no) tests_enabled=false ;; @@ -665,4 +664,3 @@ if test "$enable_tunnel" = "true" ; then fi echo "Now type 'make' to compile, and then 'make install' as root to install it." - From 7ccb5702beb76b1006535592a473632f3bea6a54 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 12 Dec 2012 14:20:32 +0100 Subject: [PATCH 757/769] Update ms2 submodule for Galaxy S3 mini hack. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e99ba7728..913ea76f5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e99ba7728ddf6a075a0804afebf86eb547a1f41b +Subproject commit 913ea76f50faa2f225a7b4c98657dbd6777594f7 From cfea850d520ea800de896a7e85cbe9f9f4a4a304 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 12 Dec 2012 15:11:42 +0100 Subject: [PATCH 758/769] Define HAVE_EXOSIP_GET_VERSION when compiling for Android. --- build/android/common.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/android/common.mk b/build/android/common.mk index c49d511bd..edc48d11c 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -57,8 +57,9 @@ endif LOCAL_CFLAGS += \ -D_BYTE_ORDER=_LITTLE_ENDIAN \ -DORTP_INET6 \ - -DINET6 \ - -DOSIP_MT \ + -DINET6 \ + -DOSIP_MT \ + -DHAVE_EXOSIP_GET_VERSION \ -DHAVE_EXOSIP_RESET_TRANSPORTS \ -DENABLE_TRACE \ -DLINPHONE_VERSION=\"$(LINPHONE_VERSION)\" \ From 2817a36f1dd129278489d88acd29c2ee1f5176ff Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 12 Dec 2012 16:50:26 +0100 Subject: [PATCH 759/769] Update ms2 submodule for the minFrameCount problem. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 913ea76f5..bd15866ce 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 913ea76f50faa2f225a7b4c98657dbd6777594f7 +Subproject commit bd15866cec3c7b74b359e7a22598c017baf7043e From 303b8e5d6c8f46ba3648773cfb3483f2ddd57757 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 13 Dec 2012 14:49:44 +0100 Subject: [PATCH 760/769] better proxy & route management. --- coreapi/proxy.c | 2 +- coreapi/sal_eXosip2.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 15f10b744..3b47af42c 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -119,7 +119,7 @@ int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char * if (addr==NULL) addr=linphone_address_new(server_addr); if (addr){ - obj->reg_proxy=linphone_address_as_string_uri_only(addr); + obj->reg_proxy=linphone_address_as_string(addr); linphone_address_destroy(addr); }else{ ms_warning("Could not parse %s",server_addr); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 8dbf0173b..325e495d3 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -2233,11 +2233,21 @@ static void register_set_contact(osip_message_t *msg, const char *contact){ } static void sal_register_add_route(osip_message_t *msg, const char *proxy){ - char tmp[256]={0}; - snprintf(tmp,sizeof(tmp)-1,"<%s;lr>",proxy); - + osip_route_t *route; + osip_list_special_free(&msg->routes,(void (*)(void*))osip_route_free); - osip_message_set_route(msg,tmp); + + osip_route_init(&route); + if (osip_route_parse(route,proxy)==0){ + osip_uri_param_t *lr_param = NULL; + osip_uri_uparam_get_byname(route->url, "lr", &lr_param); + if (lr_param == NULL){ + osip_uri_uparam_add(route->url,osip_strdup("lr"),NULL); + } + osip_list_add(&msg->routes,route,0); + return; + } + osip_route_free(route); } From 4c346156ce89230240b5e365c1ec9b1a4f10b65a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 13 Dec 2012 14:47:24 +0100 Subject: [PATCH 761/769] add missing -Define controlling tls certificate checking by eXosip --- build/android/common.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/android/common.mk b/build/android/common.mk index edc48d11c..99e1787a7 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -65,7 +65,8 @@ LOCAL_CFLAGS += \ -DLINPHONE_VERSION=\"$(LINPHONE_VERSION)\" \ -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ -DLOG_DOMAIN=$(MY_LOG_DOMAIN) \ - -DHAVE_EXOSIP_TRYLOCK=1 + -DHAVE_EXOSIP_TRYLOCK=1 \ + -DHAVE_EXOSIP_TLS_VERIFY_CERTIFICATE=1 LOCAL_CFLAGS += -DIN_LINPHONE From 148a0a91b5ca36a26a39dbe97ca8ee73f57dfca7 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 13 Dec 2012 16:07:41 +0100 Subject: [PATCH 762/769] Add XML2LPC lib/tool --- Makefile.am | 2 +- configure.ac | 32 ++++ coreapi/lpconfig.h | 2 + share/Makefile.am | 2 +- share/xml/Makefile.am | 1 + share/xml/lpconfig.xsd | 45 ++++++ tools/Makefile.am | 31 ++++ tools/xml2lpc.c | 341 +++++++++++++++++++++++++++++++++++++++++ tools/xml2lpc.h | 52 +++++++ tools/xml2lpc_test.c | 72 +++++++++ 10 files changed, 578 insertions(+), 2 deletions(-) create mode 100644 share/xml/Makefile.am create mode 100644 share/xml/lpconfig.xsd create mode 100644 tools/Makefile.am create mode 100644 tools/xml2lpc.c create mode 100644 tools/xml2lpc.h create mode 100644 tools/xml2lpc_test.c diff --git a/Makefile.am b/Makefile.am index 7a9d755b2..e15dae070 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ ACLOCAL_AMFLAGS = -I m4 $(ACLOCAL_MACOS_FLAGS) SUBDIRS = build m4 pixmaps po @ORTP_DIR@ @MS2_DIR@ \ - coreapi console gtk share scripts + coreapi console gtk share scripts tools diff --git a/configure.ac b/configure.ac index 97474be2e..1005ab2f5 100644 --- a/configure.ac +++ b/configure.ac @@ -140,6 +140,33 @@ AC_ARG_ENABLE(console_ui, *) AC_MSG_ERROR(bad value ${enableval} for --enable-console_ui) ;; esac],[console_ui=true]) +dnl conditionnal build of tools. +AC_ARG_ENABLE(tools, + [AS_HELP_STRING([--enable-tools=[yes/no]], [Turn on or off compilation of console interface (default=yes)])], + [case "${enableval}" in + yes) build_tools=true ;; + no) build_tools=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;; + esac],[build_tools=check]) + +dnl check libxml2 (needed for tools) +if test "$build_tools" != "false" ; then + PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],[], + [ + if test "$build_tools" = "true" ; then + AC_MSG_ERROR([Could not found libxml2, tools cannot be compiled.]) + else + build_tools=false + fi + ]) +fi + +AM_CONDITIONAL(BUILD_TOOLS, test x$build_tools != xfalse) +if test "$build_tools" != "false" ; then + build_tools=true + AC_DEFINE(BUILD_TOOLS, 1, [Define if tools enabled] ) +fi + dnl conditionnal build of gtk interface. AC_ARG_ENABLE(gtk_ui, [AS_HELP_STRING([--enable-gtk_ui=[yes/no]], [Turn on or off compilation of gtk interface (default=yes)])], @@ -418,8 +445,10 @@ AC_ARG_ENABLE(portaudio, dnl build console if required AM_CONDITIONAL(BUILD_CONSOLE, test x$console_ui = xtrue) + dnl special things for arm-linux cross compilation toolchain AM_CONDITIONAL(ARMBUILD, test x$use_arm_toolchain = xyes) + dnl compilation of gtk user interface AM_CONDITIONAL(BUILD_GTK_UI, [test x$gtk_ui = xtrue ] ) AM_CONDITIONAL(BUILD_WIN32, test x$mingw_found = xyes ) @@ -642,9 +671,11 @@ share/fr/Makefile share/it/Makefile share/ja/Makefile share/cs/Makefile +share/xml/Makefile share/linphone.pc share/linphone.desktop scripts/Makefile +tools/Makefile linphone.spec linphone.iss ]) @@ -657,6 +688,7 @@ printf "* Video support\t\t\t%s\n" $video printf "* GTK interface\t\t\t%s\n" $gtk_ui printf "* Account assistant\t\t%s\n" $build_wizard printf "* Console interface\t\t%s\n" $console_ui +printf "* Tools\t\t\t\t%s\n" $build_tools printf "* zRTP encryption (GPLv3)\t%s\n" $zrtp if test "$enable_tunnel" = "true" ; then diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index 8f3cae0a1..8e6f92128 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -25,6 +25,8 @@ #ifndef LPCONFIG_H #define LPCONFIG_H +#include + /** * The LpConfig object is used to manipulate a configuration file. * diff --git a/share/Makefile.am b/share/Makefile.am index 2f551f53d..83c3a934e 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS=C fr it ja cs +SUBDIRS=C fr it ja cs xml LINPHONE_SOUNDS=ringback.wav hello8000.wav hello16000.wav LINPHONE_RINGS=rings/orig.wav \ diff --git a/share/xml/Makefile.am b/share/xml/Makefile.am new file mode 100644 index 000000000..c553a5c76 --- /dev/null +++ b/share/xml/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST=lpconfig.xsd diff --git a/share/xml/lpconfig.xsd b/share/xml/lpconfig.xsd new file mode 100644 index 000000000..49bb56180 --- /dev/null +++ b/share/xml/lpconfig.xsd @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 000000000..0c9f7e53b --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,31 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS=\ + -I$(top_srcdir) \ + -I$(top_srcdir)/coreapi \ + -I$(top_srcdir)/exosip + +COMMON_CFLAGS=\ + -DIN_LINPHONE \ + $(LIBXML2_CFLAGS) \ + $(ORTP_CFLAGS) \ + $(STRICT_OPTIONS) + +if BUILD_TOOLS + +lib_LTLIBRARIES=libxml2lpc.la + +libxml2lpc_la_SOURCES=xml2lpc.c xml2lpc.h +libxml2lpc_la_CFLAGS=$(COMMON_CFLAGS) +libxml2lpc_la_LIBADD=\ + $(LIBXML2_LIBS) + +bin_PROGRAMS=xml2lpc_test + +xml2lpc_test_SOURCES=xml2lpc_test.c +xml2lpc_test_CFLAGS=$(COMMON_CFLAGS) +xml2lpc_test_LDADD=$(top_builddir)/coreapi/liblinphone.la libxml2lpc.la + +endif + + diff --git a/tools/xml2lpc.c b/tools/xml2lpc.c new file mode 100644 index 000000000..ce12eeb46 --- /dev/null +++ b/tools/xml2lpc.c @@ -0,0 +1,341 @@ +/* +linphone +Copyright (C) 2012 Belledonne Communications SARL +Yann DIORCET (yann.diorcet@linphone.org) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "xml2lpc.h" +#include +#include + + +#define XML2LPC_BZ 2048 + +struct _xml2lpc_context { + LpConfig *lpc; + xml2lpc_function cbf; + void *ctx; + + xmlDoc *doc; + xmlDoc *xsd; + char errorBuffer[XML2LPC_BZ]; + char warningBuffer[XML2LPC_BZ]; +}; + + +xml2lpc_context* xml2lpc_context_new(xml2lpc_function cbf, void *ctx) { + xml2lpc_context *xmlCtx = (xml2lpc_context*)malloc(sizeof(xml2lpc_context)); + if(xmlCtx != NULL) { + xmlCtx->lpc = NULL; + xmlCtx->cbf = cbf; + xmlCtx->ctx = ctx; + + xmlCtx->doc = NULL; + xmlCtx->xsd = NULL; + xmlCtx->errorBuffer[0]='\0'; + xmlCtx->warningBuffer[0]='\0'; + } + return xmlCtx; +} + +void xml2lpc_context_destroy(xml2lpc_context *ctx) { + if(ctx->doc != NULL) { + xmlFreeDoc(ctx->doc); + ctx->doc = NULL; + } + if(ctx->xsd != NULL) { + xmlFreeDoc(ctx->xsd); + ctx->xsd = NULL; + } + free(ctx); +} + +void xml2lpc_context_clear_logs(xml2lpc_context *ctx) { + ctx->errorBuffer[0]='\0'; + ctx->warningBuffer[0]='\0'; +} + +void xml2lpc_log(xml2lpc_context *xmlCtx, int level, const char *fmt, ...) { + va_list args; + va_start(args, fmt); + if(xmlCtx->cbf != NULL) { + xmlCtx->cbf((xmlCtx)->ctx, level, fmt, args); + } + va_end(args); +} + +void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) { + xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx; + int sl = strlen(xmlCtx->errorBuffer); + va_list args; + va_start(args, fmt); + vsnprintf(xmlCtx->errorBuffer + sl, XML2LPC_BZ-sl, fmt, args); + va_end(args); +} + +void xml2lpc_genericxml_warning(void *ctx, const char *fmt, ...) { + xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx; + int sl = strlen(xmlCtx->warningBuffer); + va_list args; + va_start(args, fmt); + vsnprintf(xmlCtx->warningBuffer + sl, XML2LPC_BZ-sl, fmt, args); + va_end(args); +} + +static void dumpNodes(int level, xmlNode * a_node, xml2lpc_context *ctx) { + xmlNode *cur_node = NULL; + + for (cur_node = a_node; cur_node; cur_node = cur_node->next) { + if (cur_node->type == XML_ELEMENT_NODE) { + xml2lpc_log(ctx, XML2LPC_DEBUG, "node level: %d type: Element, name: %s", level, cur_node->name); + } else { + xml2lpc_log(ctx, XML2LPC_DEBUG, "node level: %d type: %d, name: %s", level, cur_node->type, cur_node->name); + } + + dumpNodes(level + 1, cur_node->children, ctx); + } +} + + +static void dumpNode(xmlNode *node, xml2lpc_context *ctx) { + xml2lpc_log(ctx, XML2LPC_DEBUG, "node type: %d, name: %s", node->type, node->name); +} + +static void dumpAttr(xmlNode *node, xml2lpc_context *ctx) { + xml2lpc_log(ctx, XML2LPC_DEBUG, "attr name: %s value:%s", node->name, node->children->content); +} + +static void dumpContent(xmlNode *node, xml2lpc_context *ctx) { + xml2lpc_log(ctx, XML2LPC_DEBUG, "content: %s", node->children->content); +} + +static int processEntry(xmlElement *element, const char *sectionName, xml2lpc_context *ctx) { + xmlNode *cur_attr = NULL; + const char *name = NULL; + const char *value = NULL; + bool_t overwrite = FALSE; + + for (cur_attr = (xmlNode *)element->attributes; cur_attr; cur_attr = cur_attr->next) { + dumpAttr(cur_attr, ctx); + if(strcmp((const char*)cur_attr->name, "name") == 0) { + name = (const char*)cur_attr->children->content; + } else if(strcmp((const char*)cur_attr->name, "overwrite") == 0) { + if(strcmp((const char*)cur_attr->children->content, "true") == 0) { + overwrite = TRUE; + } + } + } + + value = (const char *)element->children->content; + dumpContent((xmlNode *)element, ctx); + + if(name != NULL) { + const char *str = lp_config_get_string(ctx->lpc, sectionName, name, NULL); + if(str == NULL || overwrite) { + xml2lpc_log(ctx, XML2LPC_MESSAGE, "Set %s|%s = %s",sectionName, name, value); + lp_config_set_string(ctx->lpc, sectionName, name, value); + } else { + xml2lpc_log(ctx, XML2LPC_MESSAGE, "Don't touch %s|%s = %s",sectionName, name, str); + } + } else { + xml2lpc_log(ctx, XML2LPC_WARNING, "ignored entry with no \"name\" attribute line:%d",xmlGetLineNo((xmlNode*)element)); + } + return 0; +} + +static int processSection(xmlElement *element, xml2lpc_context *ctx) { + xmlNode *cur_node = NULL; + xmlNode *cur_attr = NULL; + const char *name = NULL; + + for (cur_attr = (xmlNode *)element->attributes; cur_attr; cur_attr = cur_attr->next) { + dumpAttr(cur_attr, ctx); + if(strcmp((const char*)cur_attr->name, "name") == 0) { + name = (const char*)cur_attr->children->content; + } + } + + if(name != NULL) { + for (cur_node = element->children; cur_node; cur_node = cur_node->next) { + dumpNode(cur_node, ctx); + if (cur_node->type == XML_ELEMENT_NODE) { + if(strcmp((const char*)cur_node->name, "entry") == 0 ) { + processEntry((xmlElement*)cur_node, name, ctx); + } + } + + } + } else { + xml2lpc_log(ctx, XML2LPC_WARNING, "ignored section with no \"name\" attribute, line:%d", xmlGetLineNo((xmlNode*)element)); + } + + return 0; +} + +static int processConfig(xmlElement *element, xml2lpc_context *ctx) { + xmlNode *cur_node = NULL; + + for (cur_node = element->children; cur_node; cur_node = cur_node->next) { + dumpNode(cur_node, ctx); + if (cur_node->type == XML_ELEMENT_NODE && + strcmp((const char*)cur_node->name, "section") == 0 ) { + processSection((xmlElement*)cur_node, ctx); + } + + } + return 0; +} + +static int processDoc(xmlNode *node, xml2lpc_context *ctx) { + dumpNode(node, ctx); + + if (node->type == XML_ELEMENT_NODE && + strcmp((const char*)node->name, "config") == 0 ) { + processConfig((xmlElement*)node, ctx); + } else { + xml2lpc_log(ctx, XML2LPC_WARNING, "root element is not \"config\", line:%d", xmlGetLineNo(node)); + } + return 0; +} + +static int internal_convert_xml2lpc(xmlDoc *doc, xml2lpc_context *ctx) { + xml2lpc_log(ctx, XML2LPC_DEBUG, "Parse started"); + xmlNode *rootNode = xmlDocGetRootElement(doc); + //dumpNodes(0, rootNode, cbf, ctx); + int ret = processDoc(rootNode, ctx); + xml2lpc_log(ctx, XML2LPC_DEBUG, "Parse ended ret:%d", ret); + return ret; +} + +int xml2lpc_validate(xml2lpc_context *xmlCtx) { + xml2lpc_context_clear_logs(xmlCtx); + xmlSchemaValidCtxtPtr validCtx; + xmlSchemaParserCtxtPtr parserCtx = xmlSchemaNewDocParserCtxt(xmlCtx->xsd); + validCtx = xmlSchemaNewValidCtxt(xmlSchemaParse(parserCtx)); + xmlSchemaSetValidErrors(validCtx, xml2lpc_genericxml_error, xml2lpc_genericxml_warning, xmlCtx); + int ret = xmlSchemaValidateDoc(validCtx, xmlCtx->doc); + if(ret >0) { + xml2lpc_log(xmlCtx, XML2LPC_WARNING, "%s", xmlCtx->warningBuffer); + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "%s", xmlCtx->errorBuffer); + } else { + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "Internal error"); + } + xmlSchemaFreeValidCtxt(validCtx); + return ret; +} + +int xml2lpc_convert(xml2lpc_context *xmlCtx, LpConfig *lpc) { + xml2lpc_context_clear_logs(xmlCtx); + xmlCtx->lpc = lpc; + return internal_convert_xml2lpc(xmlCtx->doc, xmlCtx); +} + +int xml2lpc_set_xml_file(xml2lpc_context* xmlCtx, const char *filename) { + xml2lpc_context_clear_logs(xmlCtx); + xmlSetGenericErrorFunc(xmlCtx, xml2lpc_genericxml_error); + if(xmlCtx->doc != NULL) { + xmlFreeDoc(xmlCtx->doc); + xmlCtx->doc = NULL; + } + xmlCtx->doc = xmlReadFile(filename, NULL, 0); + if(xmlCtx->doc == NULL) { + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "Can't open/parse file \"%s\"", filename); + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "%s", xmlCtx->errorBuffer); + return -1; + } + return 0; +} + +int xml2lpc_set_xml_fd(xml2lpc_context* xmlCtx, int fd) { + xml2lpc_context_clear_logs(xmlCtx); + xmlSetGenericErrorFunc(xmlCtx, xml2lpc_genericxml_error); + if(xmlCtx->doc != NULL) { + xmlFreeDoc(xmlCtx->doc); + xmlCtx->doc = NULL; + } + xmlCtx->doc = xmlReadFd(fd, 0, NULL, 0); + if(xmlCtx->doc == NULL) { + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "Can't open/parse fd \"%d\"", fd); + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "%s", xmlCtx->errorBuffer); + return -1; + } + return 0; +} + +int xml2lpc_set_xml_string(xml2lpc_context* xmlCtx, const char *content) { + xml2lpc_context_clear_logs(xmlCtx); + xmlSetGenericErrorFunc(xmlCtx, xml2lpc_genericxml_error); + if(xmlCtx->doc != NULL) { + xmlFreeDoc(xmlCtx->doc); + xmlCtx->doc = NULL; + } + xmlCtx->doc = xmlReadDoc((const unsigned char*)content, 0, NULL, 0); + if(xmlCtx->doc == NULL) { + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "Can't parse string"); + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "%s", xmlCtx->errorBuffer); + return -1; + } + return 0; +} + +int xml2lpc_set_xsd_file(xml2lpc_context* xmlCtx, const char *filename) { + xml2lpc_context_clear_logs(xmlCtx); + xmlSetGenericErrorFunc(xmlCtx, xml2lpc_genericxml_error); + if(xmlCtx->xsd != NULL) { + xmlFreeDoc(xmlCtx->xsd); + xmlCtx->xsd = NULL; + } + xmlCtx->xsd = xmlReadFile(filename, NULL, 0); + if(xmlCtx->xsd == NULL) { + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "Can't open/parse file \"%s\"", filename); + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "%s", xmlCtx->errorBuffer); + return -1; + } + return 0; +} + +int xml2lpc_set_xsd_fd(xml2lpc_context* xmlCtx, int fd) { + xml2lpc_context_clear_logs(xmlCtx); + xmlSetGenericErrorFunc(xmlCtx, xml2lpc_genericxml_error); + if(xmlCtx->xsd != NULL) { + xmlFreeDoc(xmlCtx->xsd); + xmlCtx->xsd = NULL; + } + xmlCtx->xsd = xmlReadFd(fd, 0, NULL, 0); + if(xmlCtx->xsd == NULL) { + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "Can't open/parse fd \"%d\"", fd); + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "%s", xmlCtx->errorBuffer); + return -1; + } + return 0; +} + +int xml2lpc_set_xsd_string(xml2lpc_context* xmlCtx, const char *content) { + xml2lpc_context_clear_logs(xmlCtx); + xmlSetGenericErrorFunc(xmlCtx, xml2lpc_genericxml_error); + if(xmlCtx->xsd != NULL) { + xmlFreeDoc(xmlCtx->xsd); + xmlCtx->xsd = NULL; + } + xmlCtx->xsd = xmlReadDoc((const unsigned char*)content, 0, NULL, 0); + if(xmlCtx->xsd == NULL) { + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "Can't parse string"); + xml2lpc_log(xmlCtx, XML2LPC_ERROR, "%s", xmlCtx->errorBuffer); + return -1; + } + return 0; +} \ No newline at end of file diff --git a/tools/xml2lpc.h b/tools/xml2lpc.h new file mode 100644 index 000000000..746fb0200 --- /dev/null +++ b/tools/xml2lpc.h @@ -0,0 +1,52 @@ +/* +linphone +Copyright (C) 2012 Belledonne Communications SARL + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef XML2LPC_H_ +#define XML2LPC_H_ + +#include "lpconfig.h" + +typedef struct _xml2lpc_context xml2lpc_context; + +typedef enum _xml2lpc_log_level { + XML2LPC_DEBUG = 0, + XML2LPC_MESSAGE, + XML2LPC_WARNING, + XML2LPC_ERROR +} xml2lpc_log_level; + +typedef void(*xml2lpc_function)(void *ctx, xml2lpc_log_level level, const char *fmt, va_list list); + +xml2lpc_context* xml2lpc_context_new(xml2lpc_function cbf, void *ctx); +void xml2lpc_context_destroy(xml2lpc_context*); + +int xml2lpc_set_xml_file(xml2lpc_context* context, const char *filename); +int xml2lpc_set_xml_fd(xml2lpc_context* context, int fd); +int xml2lpc_set_xml_string(xml2lpc_context* context, const char *content); + +int xml2lpc_set_xsd_file(xml2lpc_context* context, const char *filename); +int xml2lpc_set_xsd_fd(xml2lpc_context* context, int fd); +int xml2lpc_set_xsd_string(xml2lpc_context* context, const char *content); + +int xml2lpc_validate(xml2lpc_context *context); +int xml2lpc_convert(xml2lpc_context *context, LpConfig *lpc); + + + +#endif //XML2LPC_H_ diff --git a/tools/xml2lpc_test.c b/tools/xml2lpc_test.c new file mode 100644 index 000000000..cac2965ef --- /dev/null +++ b/tools/xml2lpc_test.c @@ -0,0 +1,72 @@ +/* +linphone +Copyright (C) 2012 Belledonne Communications SARL + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include "xml2lpc.h" + +void cb_function(void *ctx, xml2lpc_log_level level, const char *msg, va_list list) { + const char *header; + switch(level) { + case XML2LPC_DEBUG: + header = "DEBUG"; + break; + case XML2LPC_MESSAGE: + header = "MESSAGE"; + break; + case XML2LPC_WARNING: + header = "WARNING"; + break; + case XML2LPC_ERROR: + header = "ERROR"; + break; + } + fprintf(stdout, "%s - ", header); + vfprintf(stdout, msg, list); + fprintf(stdout, "\n"); +} + +void show_usage(int argc, char *argv[]) { + fprintf(stderr, "usage %s convert \n" + " %s validate \n", + argv[0], argv[0]); +} + +int main(int argc, char *argv[]) { + if(argc != 4) { + show_usage(argc, argv); + return -1; + } + + xml2lpc_context *ctx = xml2lpc_context_new(cb_function, NULL); + xml2lpc_set_xml_file(ctx, argv[2]); + if(strcmp("convert", argv[1]) == 0) { + LpConfig *lpc = lp_config_new(argv[3]); + xml2lpc_convert(ctx, lpc); + lp_config_sync(lpc); + lp_config_destroy(lpc); + } else if(strcmp("validate", argv[1]) == 0) { + xml2lpc_set_xsd_file(ctx, argv[3]); + xml2lpc_validate(ctx); + } else { + show_usage(argc, argv); + } + xml2lpc_context_destroy(ctx); + return 0; +} + From 50279dcae15ea74a70e9c8d102cc7057ea7766d7 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 13 Dec 2012 16:08:15 +0100 Subject: [PATCH 763/769] Fix Windows lib deps --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index e15dae070..507e6f4dc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,7 +40,7 @@ GTK_THEME=Outcrop GTK_FILELIST=gtk+-2.22.1.filelist GTK_FILELIST_PATH=$(abs_top_srcdir)/$(GTK_FILELIST) LINPHONEDEPS_FILELIST=linphone-deps.filelist -WINBINDIST_FILES=`cat $(top_srcdir)/$(LINPHONEDEPS_FILELIST)` +WINBINDIST_FILES=`cat $(abs_top_srcdir)/$(LINPHONEDEPS_FILELIST)` ISS_SCRIPT=linphone.iss ISS_SCRIPT_PATH=$(abs_top_srcdir)/$(ISS_SCRIPT) #path to Inno Setup 5 compiler From cdc8c66fe19128c552d14ebf399b122fffb682a7 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 13 Dec 2012 17:54:55 +0100 Subject: [PATCH 764/769] Fix xml2lpc tool --- tools/xml2lpc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/xml2lpc.c b/tools/xml2lpc.c index ce12eeb46..d5e2160ab 100644 --- a/tools/xml2lpc.c +++ b/tools/xml2lpc.c @@ -64,12 +64,12 @@ void xml2lpc_context_destroy(xml2lpc_context *ctx) { free(ctx); } -void xml2lpc_context_clear_logs(xml2lpc_context *ctx) { +static void xml2lpc_context_clear_logs(xml2lpc_context *ctx) { ctx->errorBuffer[0]='\0'; ctx->warningBuffer[0]='\0'; } -void xml2lpc_log(xml2lpc_context *xmlCtx, int level, const char *fmt, ...) { +static void xml2lpc_log(xml2lpc_context *xmlCtx, int level, const char *fmt, ...) { va_list args; va_start(args, fmt); if(xmlCtx->cbf != NULL) { @@ -78,7 +78,7 @@ void xml2lpc_log(xml2lpc_context *xmlCtx, int level, const char *fmt, ...) { va_end(args); } -void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) { +static void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) { xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx; int sl = strlen(xmlCtx->errorBuffer); va_list args; @@ -87,7 +87,7 @@ void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) { va_end(args); } -void xml2lpc_genericxml_warning(void *ctx, const char *fmt, ...) { +static void xml2lpc_genericxml_warning(void *ctx, const char *fmt, ...) { xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx; int sl = strlen(xmlCtx->warningBuffer); va_list args; @@ -96,6 +96,7 @@ void xml2lpc_genericxml_warning(void *ctx, const char *fmt, ...) { va_end(args); } +#if 0 static void dumpNodes(int level, xmlNode * a_node, xml2lpc_context *ctx) { xmlNode *cur_node = NULL; @@ -109,6 +110,7 @@ static void dumpNodes(int level, xmlNode * a_node, xml2lpc_context *ctx) { dumpNodes(level + 1, cur_node->children, ctx); } } +#endif static void dumpNode(xmlNode *node, xml2lpc_context *ctx) { @@ -338,4 +340,4 @@ int xml2lpc_set_xsd_string(xml2lpc_context* xmlCtx, const char *content) { return -1; } return 0; -} \ No newline at end of file +} From c36c9b9e96083cdf0a09de3123694c1d70021880 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 13 Dec 2012 19:08:44 +0100 Subject: [PATCH 765/769] Fix uninitialized in xml2lpc_test --- tools/xml2lpc_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/xml2lpc_test.c b/tools/xml2lpc_test.c index cac2965ef..e99b90bd8 100644 --- a/tools/xml2lpc_test.c +++ b/tools/xml2lpc_test.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "xml2lpc.h" void cb_function(void *ctx, xml2lpc_log_level level, const char *msg, va_list list) { - const char *header; + const char *header = ""; switch(level) { case XML2LPC_DEBUG: header = "DEBUG"; From 30e8bf54b81adb7e99cd5bf012c4ab63fdb8a884 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 13 Dec 2012 23:08:50 +0100 Subject: [PATCH 766/769] Fix tools for windows --- tools/Makefile.am | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 0c9f7e53b..9e0c94550 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -15,16 +15,25 @@ if BUILD_TOOLS lib_LTLIBRARIES=libxml2lpc.la -libxml2lpc_la_SOURCES=xml2lpc.c xml2lpc.h +libxml2lpc_la_SOURCES=\ + xml2lpc.c \ + xml2lpc.h + libxml2lpc_la_CFLAGS=$(COMMON_CFLAGS) libxml2lpc_la_LIBADD=\ - $(LIBXML2_LIBS) + $(LIBXML2_LIBS) \ + $(top_builddir)/coreapi/liblinphone.la + +libxml2lpc_la_LDFLAGS=-no-undefined bin_PROGRAMS=xml2lpc_test -xml2lpc_test_SOURCES=xml2lpc_test.c +xml2lpc_test_SOURCES=\ + xml2lpc_test.c + xml2lpc_test_CFLAGS=$(COMMON_CFLAGS) -xml2lpc_test_LDADD=$(top_builddir)/coreapi/liblinphone.la libxml2lpc.la +xml2lpc_test_LDADD=\ + libxml2lpc.la endif From 320111b1a43e4831aa54f70208b2f8fef5a95a59 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 14 Dec 2012 16:29:03 +0100 Subject: [PATCH 767/769] Fix enable low bandwidth jni interface --- coreapi/linphonecore_jni.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 63d94411e..e83784b74 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -36,7 +36,7 @@ extern "C" { #ifdef ANDROID #include -extern "C" void libmsilbc_init(); +extern "C" void libmsilbc_init();enableca #ifdef HAVE_X264 extern "C" void libmsx264_init(); #endif @@ -1779,7 +1779,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv //CallParams -extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableLowBandwidth(JNIEnv *env, jobject thiz, jlong cp, jboolean enable) { +extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableLowBandwidth(JNIEnv *env, jobject thiz, jlong cp, jboolean enable) { linphone_call_params_enable_low_bandwidth((LinphoneCallParams *)cp, enable); } From d03b0d01bedf71d153371c58ea3259a3a1cafb11 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 14 Dec 2012 16:36:24 +0100 Subject: [PATCH 768/769] Remove typo error --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e83784b74..114d8165c 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -36,7 +36,7 @@ extern "C" { #ifdef ANDROID #include -extern "C" void libmsilbc_init();enableca +extern "C" void libmsilbc_init(); #ifdef HAVE_X264 extern "C" void libmsx264_init(); #endif From ebf0b1897ac114c998a59a3d344417603c25069b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 17 Dec 2012 16:32:05 +0100 Subject: [PATCH 769/769] Update ms2 submodule for ICE fix. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index bd15866ce..517ddc047 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bd15866cec3c7b74b359e7a22598c017baf7043e +Subproject commit 517ddc04728373f6f0844e45c2b7ade272d33016