VideoCaptureAndroid: don't synchronized on camera thread.

BUG=3421
R=glaznev@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/12669004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6295 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
fischman@webrtc.org 2014-05-30 23:17:38 +00:00
parent 0163674f99
commit 360507b12b

View File

@ -223,7 +223,12 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
private native void ProvideCameraFrame( private native void ProvideCameraFrame(
byte[] data, int length, long captureObject); byte[] data, int length, long captureObject);
public synchronized void onPreviewFrame(byte[] data, Camera callbackCamera) { // Called on cameraThread so must not "synchronized".
@Override
public void onPreviewFrame(byte[] data, Camera callbackCamera) {
if (Thread.currentThread() != cameraThread) {
throw new RuntimeException("Camera callback not on camera thread?!?");
}
if (camera == null) { if (camera == null) {
return; return;
} }
@ -270,12 +275,14 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
exchange(result, null); exchange(result, null);
} }
@Override
public synchronized void surfaceChanged( public synchronized void surfaceChanged(
SurfaceHolder holder, int format, int width, int height) { SurfaceHolder holder, int format, int width, int height) {
Log.d(TAG, "VideoCaptureAndroid::surfaceChanged ignored: " + Log.d(TAG, "VideoCaptureAndroid::surfaceChanged ignored: " +
format + ": " + width + "x" + height); format + ": " + width + "x" + height);
} }
@Override
public synchronized void surfaceCreated(final SurfaceHolder holder) { public synchronized void surfaceCreated(final SurfaceHolder holder) {
Log.d(TAG, "VideoCaptureAndroid::surfaceCreated"); Log.d(TAG, "VideoCaptureAndroid::surfaceCreated");
if (camera == null || cameraThreadHandler == null) { if (camera == null || cameraThreadHandler == null) {
@ -293,6 +300,7 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
} }
} }
@Override
public synchronized void surfaceDestroyed(SurfaceHolder holder) { public synchronized void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "VideoCaptureAndroid::surfaceDestroyed"); Log.d(TAG, "VideoCaptureAndroid::surfaceDestroyed");
if (camera == null || cameraThreadHandler == null) { if (camera == null || cameraThreadHandler == null) {