diff options
author | Mathias Agopian <mathias@google.com> | 2013-07-16 22:54:56 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-07-16 23:14:24 -0700 |
commit | e32632682ca9207bd247ca27012cf670b5c23f54 (patch) | |
tree | 0026abe147d61ef6d42d476606ea5712f0f35cd4 | |
parent | 5ab422bfa34f0fd64b6bef25287e7250f80de4ba (diff) | |
download | frameworks_base-e32632682ca9207bd247ca27012cf670b5c23f54.zip frameworks_base-e32632682ca9207bd247ca27012cf670b5c23f54.tar.gz frameworks_base-e32632682ca9207bd247ca27012cf670b5c23f54.tar.bz2 |
update to new Consumer APIs
Change-Id: I8649f3add40e0aeeeb0396b98e2cb93312e8e990
-rw-r--r-- | core/java/android/view/GLES20TextureLayer.java | 2 | ||||
-rw-r--r-- | core/jni/android/graphics/SurfaceTexture.cpp | 9 | ||||
-rw-r--r-- | core/jni/android_view_Surface.cpp | 6 | ||||
-rw-r--r-- | graphics/java/android/graphics/SurfaceTexture.java | 19 | ||||
-rw-r--r-- | media/jni/android_media_ImageReader.cpp | 2 |
5 files changed, 11 insertions, 27 deletions
diff --git a/core/java/android/view/GLES20TextureLayer.java b/core/java/android/view/GLES20TextureLayer.java index a4cc630..bb5a6eb 100644 --- a/core/java/android/view/GLES20TextureLayer.java +++ b/core/java/android/view/GLES20TextureLayer.java @@ -73,7 +73,7 @@ class GLES20TextureLayer extends GLES20Layer { SurfaceTexture getSurfaceTexture() { if (mSurface == null) { - mSurface = new SurfaceTexture(mTexture, false); + mSurface = new SurfaceTexture(mTexture); } return mSurface; } diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp index 3600b76..bf9177b 100644 --- a/core/jni/android/graphics/SurfaceTexture.cpp +++ b/core/jni/android/graphics/SurfaceTexture.cpp @@ -197,11 +197,10 @@ static void SurfaceTexture_classInit(JNIEnv* env, jclass clazz) } } -static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jint texName, - jobject weakThiz, jboolean allowSynchronous) +static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jint texName, jobject weakThiz) { - sp<BufferQueue> bq = new BufferQueue(allowSynchronous); - sp<GLConsumer> surfaceTexture(new GLConsumer(bq, texName)); + sp<BufferQueue> bq = new BufferQueue(); + sp<GLConsumer> surfaceTexture(new GLConsumer(bq, texName, GL_TEXTURE_EXTERNAL_OES, true, true)); if (surfaceTexture == 0) { jniThrowException(env, OutOfResourcesException, "Unable to create native SurfaceTexture"); @@ -286,7 +285,7 @@ static void SurfaceTexture_release(JNIEnv* env, jobject thiz) static JNINativeMethod gSurfaceTextureMethods[] = { {"nativeClassInit", "()V", (void*)SurfaceTexture_classInit }, - {"nativeInit", "(ILjava/lang/Object;Z)V", (void*)SurfaceTexture_init }, + {"nativeInit", "(ILjava/lang/Object;)V", (void*)SurfaceTexture_init }, {"nativeFinalize", "()V", (void*)SurfaceTexture_finalize }, {"nativeSetDefaultBufferSize", "(II)V", (void*)SurfaceTexture_setDefaultBufferSize }, {"nativeUpdateTexImage", "()V", (void*)SurfaceTexture_updateTexImage }, diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index 842a7f7..bf6753d 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -107,7 +107,7 @@ jobject android_view_Surface_createFromIGraphicBufferProducer(JNIEnv* env, return NULL; } - sp<Surface> surface(new Surface(bufferProducer)); + sp<Surface> surface(new Surface(bufferProducer, true)); if (surface == NULL) { return NULL; } @@ -143,7 +143,7 @@ static jint nativeCreateFromSurfaceTexture(JNIEnv* env, jclass clazz, } sp<IGraphicBufferProducer> bq = st->getBufferQueue(); - sp<Surface> surface(new Surface(bq)); + sp<Surface> surface(new Surface(bq, true)); if (surface == NULL) { jniThrowException(env, OutOfResourcesException, NULL); return 0; @@ -319,7 +319,7 @@ static jint nativeReadFromParcel(JNIEnv* env, jclass clazz, sp<IGraphicBufferProducer> gbp(interface_cast<IGraphicBufferProducer>(binder)); if (gbp != NULL) { // we have a new IGraphicBufferProducer, create a new Surface for it - sur = new Surface(gbp); + sur = new Surface(gbp, true); // and keep a reference before passing to java sur->incStrong(&sRefBaseOwner); } diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java index af1a447..aaed094 100644 --- a/graphics/java/android/graphics/SurfaceTexture.java +++ b/graphics/java/android/graphics/SurfaceTexture.java @@ -95,21 +95,6 @@ public class SurfaceTexture { * @param texName the OpenGL texture object name (e.g. generated via glGenTextures) */ public SurfaceTexture(int texName) { - this(texName, false); - } - - /** - * Construct a new SurfaceTexture to stream images to a given OpenGL texture. - * - * @param texName the OpenGL texture object name (e.g. generated via glGenTextures) - * @param allowSynchronousMode whether the SurfaceTexture can run in the synchronous mode. - * When the image stream comes from OpenGL, SurfaceTexture may run in the synchronous - * mode where the producer side may be blocked to avoid skipping frames. To avoid the - * thread block, set allowSynchronousMode to false. - * - * @hide - */ - public SurfaceTexture(int texName, boolean allowSynchronousMode) { Looper looper; if ((looper = Looper.myLooper()) != null) { mEventHandler = new EventHandler(looper); @@ -118,7 +103,7 @@ public class SurfaceTexture { } else { mEventHandler = null; } - nativeInit(texName, new WeakReference<SurfaceTexture>(this), allowSynchronousMode); + nativeInit(texName, new WeakReference<SurfaceTexture>(this)); } /** @@ -299,7 +284,7 @@ public class SurfaceTexture { } } - private native void nativeInit(int texName, Object weakSelf, boolean allowSynchronousMode); + private native void nativeInit(int texName, Object weakSelf); private native void nativeFinalize(); private native void nativeGetTransformMatrix(float[] mtx); private native long nativeGetTimestamp(); diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp index 5856057..d876bd2 100644 --- a/media/jni/android_media_ImageReader.cpp +++ b/media/jni/android_media_ImageReader.cpp @@ -542,7 +542,7 @@ static void ImageReader_init(JNIEnv* env, jobject thiz, jobject weakThiz, nativeFormat = Image_getPixelFormat(env, format); sp<BufferQueue> bq = new BufferQueue(); - sp<CpuConsumer> consumer = new CpuConsumer(bq, maxImages); + sp<CpuConsumer> consumer = new CpuConsumer(bq, true, maxImages); // TODO: throw dvm exOutOfMemoryError? if (consumer == NULL) { jniThrowRuntimeException(env, "Failed to allocate native CpuConsumer"); |