diff --git a/res/drawable/startvideo_green.png b/res/drawable/startvideo_green.png
new file mode 100644
index 000000000..1cc2e3e4b
Binary files /dev/null and b/res/drawable/startvideo_green.png differ
diff --git a/res/layout-land/dialer.xml b/res/layout-land/dialer.xml
index 59acaaee3..2583a3c76 100644
--- a/res/layout-land/dialer.xml
+++ b/res/layout-land/dialer.xml
@@ -5,32 +5,42 @@
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
diff --git a/res/layout/dialer.xml b/res/layout/dialer.xml
index b9a3e91fd..2ac78e7b4 100644
--- a/res/layout/dialer.xml
+++ b/res/layout/dialer.xml
@@ -105,16 +105,15 @@
-
-
+
+
-
-
-
+
+
+
-
-
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5f2cedd30..8f2d27a54 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,7 +1,14 @@
- Enable video
- pref_escape_plus_key
+ Video settings
+ Share my camera
+ Initiate video calls
+ Enable Video
+ Automatically send videos from my camera
+ pref_video_automatically_share_my_video_key
+ pref_video_initiate_call_with_video_key
+ Initiate outgoing calls with video
+ pref_video_enable_key
Replace + by 00
pref_escape_plus_key
iLBC might be unavailable depending on ARM processor and Android OS version.
@@ -63,6 +70,8 @@
History
Cannot build destination address from [%s]
Clear
+Cannot get call parameters
+Cannot create default call parameters
Cannot invite destination address [%s]
registered to %s
fails to register to %s
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 4bd4c821c..0e7c08ed5 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -36,7 +36,10 @@
-
+
+
+
+
diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java
index 19e639648..321cef397 100644
--- a/src/org/linphone/DialerActivity.java
+++ b/src/org/linphone/DialerActivity.java
@@ -20,8 +20,10 @@ package org.linphone;
import org.linphone.component.ToggleImageButton;
import org.linphone.component.ToggleImageButton.OnCheckedChangeListener;
+import org.linphone.core.AndroidCameraRecord;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
+import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
@@ -59,7 +61,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
private TextView mAddress;
private TextView mDisplayNameView;
-
+
private TextView mStatus;
private ImageButton mCall;
private ImageButton mDecline;
@@ -93,6 +95,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
private AudioManager mAudioManager;
private PowerManager.WakeLock mWakeLock;
private SharedPreferences mPref;
+ private ImageButton mAddVideo;
static String PREF_CHECK_CONFIG = "pref_check_config";
private static String CURRENT_ADDRESS = "org.linphone.current-address";
@@ -148,9 +151,24 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
mAddress.getEditableText().clear();
return true;
}
-
});
+ mAddVideo = (ImageButton) findViewById(R.id.AddVideo);
+ mAddVideo.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
+ LinphoneCallParams params = lLinphoneCore.getCurrentCall().getCurrentParamsReadOnly();
+ String msg;
+ if (params.getVideoEnabled()) {
+ msg = "In video call; going back to video call activity";
+ startVideoView();
+ } else {
+ msg = "Not in video call; should go try to reinvite with video";
+ }
+ Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
+ }
+ });
+
mCall = (ImageButton) findViewById(R.id.Call);
mCall.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
@@ -203,23 +221,27 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
getIntent().setData(null);
}
if (LinphoneService.isready()) {
- LinphoneCore lLinphoenCore = LinphoneService.instance().getLinphoneCore();
- if (lLinphoenCore.isIncall()) {
- if(lLinphoenCore.isInComingInvitePending()) {
+ LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
+ if (lLinphoneCore.isIncall()) {
+ if(lLinphoneCore.isInComingInvitePending()) {
callPending();
} else {
mCall.setEnabled(false);
mHangup.setEnabled(!mCall.isEnabled());
+ boolean prefVideoEnabled = getPref(getApplicationContext().getString(R.string.pref_video_enable_key));
+ if (!prefVideoEnabled && !mCall.isEnabled()) {
+ mAddVideo.setEnabled(true);
+ }
mCallControlRow.setVisibility(View.GONE);
mInCallControlRow.setVisibility(View.VISIBLE);
mAddressLayout.setVisibility(View.GONE);
mInCallAddressLayout.setVisibility(View.VISIBLE);
- mMute.setChecked(!lLinphoenCore.isMicMuted());
- String DisplayName = lLinphoenCore.getRemoteAddress().getDisplayName();
+ mMute.setChecked(!lLinphoneCore.isMicMuted());
+ String DisplayName = lLinphoneCore.getRemoteAddress().getDisplayName();
if (DisplayName!=null) {
mDisplayNameView.setText(DisplayName);
} else {
- mDisplayNameView.setText(lLinphoenCore.getRemoteAddress().getUserName());
+ mDisplayNameView.setText(lLinphoneCore.getRemoteAddress().getUserName());
}
if ((Integer.parseInt(Build.VERSION.SDK) <=4 && mAudioManager.getMode() == AudioManager.MODE_NORMAL)
|| Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn()) {
@@ -394,6 +416,14 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
}
}
}
+ private void startVideoView() {
+ //start video view
+ Intent lIntent = new Intent();
+ lIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ lIntent.setClass(this, VideoCallActivity.class);
+ startActivityForResult(lIntent,VIDEO_VIEW_ACTIVITY);
+ }
+
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig cfg,final LinphoneCore.RegistrationState state,final String smessage) {/*nop*/};
public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) {
if (state == LinphoneCall.State.OutgoingInit) {
@@ -404,13 +434,6 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
callPending();
} else if (state == LinphoneCall.State.Connected) {
enterIncalMode(lc);
- if (LinphoneService.instance().getLinphoneCore().isVideoEnabled()) {
- //start video view
- Intent lIntent = new Intent();
- lIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- lIntent.setClass(this, VideoCallActivity.class);
- startActivityForResult(lIntent,VIDEO_VIEW_ACTIVITY);
- }
} else if (state == LinphoneCall.State.Error) {
if (mWakeLock.isHeld()) mWakeLock.release();
Toast toast = Toast.makeText(this
@@ -420,6 +443,10 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
exitCallMode();
} else if (state == LinphoneCall.State.CallEnd) {
exitCallMode();
+ } else if (state == LinphoneCall.State.StreamsRunning) {
+ if (LinphoneService.instance().getLinphoneCore().getCurrentCall().getCurrentParamsReadOnly().getVideoEnabled()) {
+ startVideoView();
+ }
}
}
@@ -491,10 +518,20 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
private void callPending() {
mDecline.setEnabled(true);
routeAudioToSpeaker();
+
+ // Privacy setting to not share the user camera by default
+ boolean prefVideoEnable = getPref(getApplicationContext().getString(R.string.pref_video_enable_key));
+ boolean prefAutomaticallyShareMyCamera = getPref(getApplicationContext().getString(R.string.pref_video_automatically_share_my_video_key));
+ AndroidCameraRecord.setMuteCamera(!(prefVideoEnable && prefAutomaticallyShareMyCamera));
}
public void newOutgoingCall(String aTo) {
newOutgoingCall(aTo,null);
}
+
+ private boolean getPref(String key) {
+ return PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean(key, false);
+ }
+
public synchronized void newOutgoingCall(String aTo, String displayName) {
String lto = aTo;
if (aTo.contains(OutgoingCallReceiver.TAG)) {
@@ -519,15 +556,26 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
return;
}
lAddress.setDisplayName(mDisplayName);
- try {
- lLinphoneCore.invite(lAddress);
- } catch (LinphoneCoreException e) {
- Toast toast = Toast.makeText(DialerActivity.this
- ,String.format(getString(R.string.error_cannot_invite_address),mAddress.getText().toString())
- , Toast.LENGTH_LONG);
- toast.show();
- return;
+
+ try {
+ LinphoneCallParams lParams = lLinphoneCore.createDefaultCallParameters().copy();
+ boolean prefVideoEnable = getPref(getApplicationContext().getString(R.string.pref_video_enable_key));
+ boolean prefInitiateWithVideo = getPref(getApplicationContext().getString(R.string.pref_video_initiate_call_with_video_key));
+
+ if (prefVideoEnable && prefInitiateWithVideo && lParams.getVideoEnabled()) {
+ lParams.setVideoEnalbled(true);
+ lLinphoneCore.inviteAddressWithParams(lAddress, lParams);
+ } else {
+ lParams.setVideoEnalbled(false);
+ lLinphoneCore.inviteAddressWithParams(lAddress, lParams);
}
+ } catch (LinphoneCoreException e) {
+ Toast toast = Toast.makeText(DialerActivity.this
+ ,String.format(getString(R.string.error_cannot_get_call_parameters),mAddress.getText().toString())
+ , Toast.LENGTH_LONG);
+ toast.show();
+ return;
+ }
}
private void setDigitListener(Button aButton,char dtmf) {
class DialKeyListener implements OnClickListener ,OnTouchListener {
diff --git a/src/org/linphone/VideoCallActivity.java b/src/org/linphone/VideoCallActivity.java
index 2aae9e032..9c5466b17 100644
--- a/src/org/linphone/VideoCallActivity.java
+++ b/src/org/linphone/VideoCallActivity.java
@@ -24,7 +24,6 @@ import org.linphone.core.AndroidCameraRecord;
import android.app.Activity;
import android.os.Bundle;
-import android.os.Handler;
import android.util.Log;
import android.view.SurfaceView;
import android.view.View;
@@ -33,9 +32,8 @@ import android.widget.FrameLayout;
public class VideoCallActivity extends Activity {
SurfaceView mVideoView;
SurfaceView mVideoCaptureView;
- private Handler mHandler = new Handler() ;
private static boolean firstLaunch = true;
-
+
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videocall);
@@ -49,8 +47,8 @@ public class VideoCallActivity extends Activity {
AndroidCameraRecord.setOrientationCode(rotation);
if (!firstLaunch) workaroundCapturePreviewHiddenOnSubsequentRotations();
-
- AndroidCameraRecord.setSurfaceView(mVideoCaptureView, mHandler);
+
+ AndroidCameraRecord.setSurfaceView(mVideoCaptureView);
firstLaunch = false;
}
diff --git a/src/org/linphone/core/AndroidCameraRecord.java b/src/org/linphone/core/AndroidCameraRecord.java
index 4137192ba..c16ef065d 100644
--- a/src/org/linphone/core/AndroidCameraRecord.java
+++ b/src/org/linphone/core/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/src/org/linphone/core/LinphoneCallImpl.java b/src/org/linphone/core/LinphoneCallImpl.java
index c71883b57..4c9a770c9 100644
--- a/src/org/linphone/core/LinphoneCallImpl.java
+++ b/src/org/linphone/core/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/src/org/linphone/core/LinphoneCallParamsImpl.java b/src/org/linphone/core/LinphoneCallParamsImpl.java
new file mode 100644
index 000000000..add724f21
--- /dev/null
+++ b/src/org/linphone/core/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/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java
index 1f389a608..91913e322 100644
--- a/src/org/linphone/core/LinphoneCoreImpl.java
+++ b/src/org/linphone/core/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/src/org/linphone/core/tutorials/TestVideoActivity.java b/src/org/linphone/core/tutorials/TestVideoActivity.java
index e016cad25..0623e34dc 100644
--- a/src/org/linphone/core/tutorials/TestVideoActivity.java
+++ b/src/org/linphone/core/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);
}