Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d84feebb authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "update to new Consumer APIs"

parents 4908d181 e3263268
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ class GLES20TextureLayer extends GLES20Layer {

    SurfaceTexture getSurfaceTexture() {
        if (mSurface == null) {
            mSurface = new SurfaceTexture(mTexture, false);
            mSurface = new SurfaceTexture(mTexture);
        }
        return mSurface;
    }
+4 −5
Original line number Diff line number Diff line
@@ -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 },
+3 −3
Original line number Diff line number Diff line
@@ -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);
    }
+2 −17
Original line number Diff line number Diff line
@@ -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();
+1 −1
Original line number Diff line number Diff line
@@ -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");