Merge branch 'video' of git.linphone.org:linphone-android-private into video
This commit is contained in:
commit
653050685e
7 changed files with 295 additions and 86 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_height="fill_parent" android:layout_width="fill_parent">
|
android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical">
|
||||||
<SurfaceView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/video_surface"></SurfaceView>
|
<SurfaceView android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/video_surface"></SurfaceView>
|
||||||
|
<SurfaceView android:layout_weight="100" android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/video_capture_surface"></SurfaceView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -20,17 +20,27 @@ package org.linphone;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.linphone.core.AndroidCameraRecord;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
|
|
||||||
public class VideoCallActivity extends Activity {
|
public class VideoCallActivity extends Activity {
|
||||||
SurfaceView mVideoView;
|
SurfaceView mVideoView;
|
||||||
|
SurfaceView mVideoCaptureView;
|
||||||
|
private Handler mHandler = new Handler() ;
|
||||||
|
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.videocall);
|
setContentView(R.layout.videocall);
|
||||||
mVideoView = (SurfaceView) findViewById(R.id.video_surface);
|
mVideoView = (SurfaceView) findViewById(R.id.video_surface);
|
||||||
LinphoneService.instance().getLinphoneCore().setVideoWindow((Object) mVideoView);
|
LinphoneService.instance().getLinphoneCore().setVideoWindow((Object) mVideoView);
|
||||||
|
|
||||||
|
// mVideoCaptureView = new SurfaceView(getApplicationContext());
|
||||||
|
mVideoCaptureView = (SurfaceView) findViewById(R.id.video_capture_surface);
|
||||||
|
AndroidCameraRecord.setSurfaceView(mVideoCaptureView, mHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,109 +19,211 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
package org.linphone.core;
|
package org.linphone.core;
|
||||||
|
|
||||||
import android.hardware.Camera;
|
import android.hardware.Camera;
|
||||||
|
import android.hardware.Camera.ErrorCallback;
|
||||||
import android.hardware.Camera.PreviewCallback;
|
import android.hardware.Camera.PreviewCallback;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
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 boolean visibilityChangeable = false;
|
||||||
|
private PreviewCallback storedPreviewCallback;
|
||||||
|
|
||||||
protected final SurfaceView getSurfaceView() {
|
private static AndroidCameraRecord instance;
|
||||||
return surfaceView;
|
private static Handler handler;
|
||||||
|
private static boolean previewStarted;
|
||||||
|
|
||||||
|
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) {
|
||||||
* AndroidCameraRecord.setSurfaceView() should be called first.
|
this.fps = Math.round(fps);
|
||||||
* @param rate
|
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=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();
|
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 {
|
try {
|
||||||
camera.setPreviewDisplay(holder);
|
camera.setPreviewDisplay(holder);
|
||||||
}
|
}
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
Log.e("PictureDemo-surfaceCallback", "Exception in setPreviewDisplay()", t);
|
Log.e("Linphone", "Exception in Video capture setPreviewDisplay()", t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
try {
|
||||||
|
|
||||||
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();
|
camera.startPreview();
|
||||||
|
previewStarted = true;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.e("Linphone", "Can't start camera preview");
|
||||||
|
}
|
||||||
|
|
||||||
|
previewStarted = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Register callback to get capture buffer
|
||||||
|
if (storedPreviewCallback != null) {
|
||||||
|
reallySetPreviewCallback(camera, storedPreviewCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
visibilityChangeable = true;
|
visibilityChangeable = true;
|
||||||
if (surfaceView.getVisibility() != visibility) {
|
if (surfaceView.getVisibility() != longTermVisibility) {
|
||||||
updateVisibility();
|
updateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCameraStarted(camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
reallySetPreviewCallback(camera, cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final void setSurfaceView(final SurfaceView sv, Handler mHandler) {
|
||||||
|
AndroidCameraRecord.handler = mHandler;
|
||||||
|
SurfaceHolder holder = sv.getHolder();
|
||||||
|
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
||||||
|
|
||||||
|
holder.addCallback(new Callback() {
|
||||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
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.stopPreview();
|
||||||
camera.release();
|
camera.release();
|
||||||
camera=null;
|
camera=null;
|
||||||
|
previewStarted = false;
|
||||||
|
Log.w("Linphone", "The video capture Surface view has been destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPreviewCallBack(PreviewCallback cb) {
|
public void surfaceCreated(SurfaceHolder holder) {
|
||||||
camera.setPreviewCallback(cb);
|
AndroidCameraRecord.surfaceView = sv;
|
||||||
|
|
||||||
|
if (instance != null) {
|
||||||
|
instance.startPreview();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void surfaceChanged(SurfaceHolder holder, int format, int width,
|
||||||
|
int height) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void updateVisibility() {
|
private void updateVisibility() {
|
||||||
if (!visibilityChangeable) {
|
if (!visibilityChangeable) {
|
||||||
throw new IllegalStateException("Visilibity not changeable now");
|
throw new IllegalStateException("Visilibity not changeable now");
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaceView.setVisibility(visibility);
|
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) {
|
public void setVisibility(int visibility) {
|
||||||
if (visibility == this.visibility) return;
|
if (visibility == this.longTermVisibility) return;
|
||||||
|
|
||||||
this.visibility = visibility;
|
this.longTermVisibility = visibility;
|
||||||
updateVisibility();
|
updateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void setSurfaceView(SurfaceView sv) {
|
|
||||||
AndroidCameraRecord.surfaceView = sv;
|
public void stopCaptureCallback() {
|
||||||
|
if (camera != null) {
|
||||||
|
reallySetPreviewCallback(camera, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void reallySetPreviewCallback(Camera camera, PreviewCallback cb) {
|
||||||
|
camera.setPreviewCallback(cb);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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) {}
|
|
||||||
}
|
|
||||||
|
|
64
src/org/linphone/core/AndroidCameraRecordBufferedImpl.java
Normal file
64
src/org/linphone/core/AndroidCameraRecordBufferedImpl.java
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
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 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
|
||||||
|
public void onPreviewFrame(byte[] data, Camera camera) {
|
||||||
|
super.onPreviewFrame(data, camera);
|
||||||
|
camera.addCallbackBuffer(data);
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ package org.linphone.core;
|
||||||
|
|
||||||
import android.hardware.Camera;
|
import android.hardware.Camera;
|
||||||
import android.hardware.Camera.PreviewCallback;
|
import android.hardware.Camera.PreviewCallback;
|
||||||
|
import android.hardware.Camera.Size;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,19 +32,58 @@ import android.util.Log;
|
||||||
public class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
|
public class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
|
||||||
|
|
||||||
private long filterCtxPtr;
|
private long filterCtxPtr;
|
||||||
|
private double timeElapsedBetweenFrames = 0;
|
||||||
|
private long lastFrameTime = 0;
|
||||||
|
|
||||||
public AndroidCameraRecordImpl(long filterCtxPtr, int rate) {
|
public AndroidCameraRecordImpl(long filterCtxPtr) {
|
||||||
super(rate);
|
super();
|
||||||
|
|
||||||
|
try {
|
||||||
this.filterCtxPtr = filterCtxPtr;
|
this.filterCtxPtr = filterCtxPtr;
|
||||||
setPreviewCallBack(this);
|
setOrStorePreviewCallBack(this);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.e("Linphone", "Error");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private native void putImage(long filterCtxPtr, byte[] buffer);
|
private native void putImage(long filterCtxPtr, byte[] buffer);
|
||||||
|
|
||||||
|
|
||||||
public void onPreviewFrame(byte[] data, Camera camera) {
|
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) {
|
||||||
|
Log.e("Linphone", "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);
|
||||||
|
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);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastFrameTime = curTime;
|
||||||
|
timeElapsedBetweenFrames = currentTimeElapsed;
|
||||||
|
|
||||||
|
// Log.d("onPreviewFrame: ", Integer.toString(data.length));
|
||||||
putImage(filterCtxPtr, data);
|
putImage(filterCtxPtr, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,21 +30,16 @@ public class JavaCameraRecordImpl extends AndroidCameraRecord implements Preview
|
||||||
private TextView debug;
|
private TextView debug;
|
||||||
private long count = 0;
|
private long count = 0;
|
||||||
private float averageCalledRate;
|
private float averageCalledRate;
|
||||||
private int averageWindowSize = 2 * rate;
|
|
||||||
|
|
||||||
private long startTime;
|
private long startTime;
|
||||||
private long endTime;
|
private long endTime;
|
||||||
|
|
||||||
|
|
||||||
public JavaCameraRecordImpl(int rate) {
|
public JavaCameraRecordImpl() {
|
||||||
super(rate);
|
super();
|
||||||
setPreviewCallBack(this);
|
setOrStorePreviewCallBack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaCameraRecordImpl(int rate, int visilibity) {
|
|
||||||
super(rate, visilibity);
|
|
||||||
setPreviewCallBack(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDebug(TextView debug) {
|
public void setDebug(TextView debug) {
|
||||||
this.debug = debug;
|
this.debug = debug;
|
||||||
|
@ -52,9 +47,9 @@ public class JavaCameraRecordImpl extends AndroidCameraRecord implements Preview
|
||||||
|
|
||||||
public void onPreviewFrame(byte[] data, Camera camera) {
|
public void onPreviewFrame(byte[] data, Camera camera) {
|
||||||
|
|
||||||
if ((count % averageWindowSize) == 0) {
|
if ((count % 2 * fps) == 0) {
|
||||||
endTime = System.currentTimeMillis();
|
endTime = System.currentTimeMillis();
|
||||||
averageCalledRate = (100000 * averageWindowSize) / (endTime - startTime);
|
averageCalledRate = (100000 * 2 * fps) / (endTime - startTime);
|
||||||
averageCalledRate /= 100f;
|
averageCalledRate /= 100f;
|
||||||
startTime = endTime;
|
startTime = endTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.linphone.core.AndroidCameraRecord;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.SurfaceHolder;
|
import android.os.Handler;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -36,10 +36,7 @@ import android.widget.TextView;
|
||||||
public class TestVideoActivity extends Activity {
|
public class TestVideoActivity extends Activity {
|
||||||
|
|
||||||
private SurfaceView surfaceView;
|
private SurfaceView surfaceView;
|
||||||
private static final int rate = 15;
|
private static final int rate = 7;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,14 +48,14 @@ public class TestVideoActivity extends Activity {
|
||||||
|
|
||||||
surfaceView=(SurfaceView)findViewById(R.id.videotest_surfaceView);
|
surfaceView=(SurfaceView)findViewById(R.id.videotest_surfaceView);
|
||||||
|
|
||||||
SurfaceHolder holder=surfaceView.getHolder();
|
// SurfaceHolder holder=surfaceView.getHolder();
|
||||||
holder.setFixedSize(320, 240);
|
// holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
||||||
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
|
||||||
|
|
||||||
AndroidCameraRecord.setSurfaceView(surfaceView);
|
AndroidCameraRecord.setSurfaceView(surfaceView, new Handler());
|
||||||
|
|
||||||
JavaCameraRecordImpl manager = new JavaCameraRecordImpl(rate, SurfaceView.VISIBLE);
|
JavaCameraRecordImpl recorder = new JavaCameraRecordImpl();
|
||||||
manager.setDebug((TextView) findViewById(R.id.videotest_debug));
|
recorder.setDebug((TextView) findViewById(R.id.videotest_debug));
|
||||||
|
recorder.setParameters(288, 352, rate, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue