fix video deadlock and double instanciation of VideoActivity

This commit is contained in:
Simon Morlat 2010-11-15 19:19:32 +01:00
parent d047b7aabd
commit 97144546e2
2 changed files with 8 additions and 5 deletions

View file

@ -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 {
}
}
}

View file

@ -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;