OSDN Git Service

Wait for the previous MosaicPreviewRenderer to end
authorAngus Kong <shkong@google.com>
Tue, 12 Feb 2013 00:28:04 +0000 (16:28 -0800)
committerAngus Kong <shkong@google.com>
Tue, 12 Feb 2013 17:52:41 +0000 (09:52 -0800)
When changing orientations very fast, there might be 2 MosaicPreviewRenderer
instances accessing the SRI native library at the same time. The library is not
designed so.

bug:8151753
Change-Id: Ie7a381349feeb95b40bae3c093cfcb66acba9069

src/com/android/camera/MosaicFrameProcessor.java
src/com/android/camera/MosaicPreviewRenderer.java

index c59e6b9..efd4ad2 100644 (file)
@@ -92,7 +92,8 @@ public class MosaicFrameProcessor {
         mPreviewBufferSize = bufSize;
         setupMosaicer(mPreviewWidth, mPreviewHeight, mPreviewBufferSize);
         setStripType(Mosaic.STRIPTYPE_WIDE);
-        reset();
+        // no need to call reset() here. reset() should be called by the client
+        // after this initialization before calling other methods of this object.
     }
 
     public void clear() {
index e12fe43..26ce733 100644 (file)
@@ -90,6 +90,7 @@ public class MosaicPreviewRenderer {
                     break;
                 case MSG_RELEASE:
                     doRelease();
+                    mEglThreadBlockVar.open();
                     break;
             }
         }
@@ -203,7 +204,7 @@ public class MosaicPreviewRenderer {
     }
 
     public void release() {
-        mEglHandler.sendEmptyMessage(EGLHandler.MSG_RELEASE);
+        mEglHandler.sendMessageSync(EGLHandler.MSG_RELEASE);
     }
 
     public void showPreviewFrameSync() {