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
diff --git a/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java b/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
index 0e555f9..e8a2fc1 100644
--- a/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
+++ b/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
@@ -223,7 +223,12 @@
   private native void ProvideCameraFrame(
       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) {
       return;
     }
@@ -270,12 +275,14 @@
     exchange(result, null);
   }
 
+  @Override
   public synchronized void surfaceChanged(
       SurfaceHolder holder, int format, int width, int height) {
     Log.d(TAG, "VideoCaptureAndroid::surfaceChanged ignored: " +
         format + ": " + width + "x" + height);
   }
 
+  @Override
   public synchronized void surfaceCreated(final SurfaceHolder holder) {
     Log.d(TAG, "VideoCaptureAndroid::surfaceCreated");
     if (camera == null || cameraThreadHandler == null) {
@@ -293,6 +300,7 @@
     }
   }
 
+  @Override
   public synchronized void surfaceDestroyed(SurfaceHolder holder) {
     Log.d(TAG, "VideoCaptureAndroid::surfaceDestroyed");
     if (camera == null || cameraThreadHandler == null) {