Loading media/jni/android_media_ImageWriter.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -735,10 +735,15 @@ static void ImageWriter_queueImage(JNIEnv* env, jobject thiz, jlong nativeCtx, j } static status_t attachAndQeueuGraphicBuffer(JNIEnv* env, JNIImageWriterContext *ctx, sp<Surface> surface, sp<GraphicBuffer> gb, jlong timestampNs, jint dataSpace, sp<GraphicBuffer> gb, jlong timestampNs, jint dataSpace, jint left, jint top, jint right, jint bottom, jint transform, jint scalingMode) { status_t res = OK; // Step 1. Attach Image sp<Surface> surface = ctx->getProducer(); if (surface == nullptr) { jniThrowException(env, "java/lang/IllegalStateException", "Producer surface is null, ImageWriter seems already closed"); } res = surface->attachBuffer(gb.get()); if (res != OK) { ALOGE("Attach image failed: %s (%d)", strerror(-res), res); Loading Loading @@ -835,7 +840,6 @@ static jint ImageWriter_attachAndQueueImage(JNIEnv* env, jobject thiz, jlong nat return -1; } sp<Surface> surface = ctx->getProducer(); if (isFormatOpaque(ctx->getBufferFormat()) != isFormatOpaque(nativeHalFormat)) { jniThrowException(env, "java/lang/IllegalStateException", "Trying to attach an opaque image into a non-opaque ImageWriter, or vice versa"); Loading @@ -851,7 +855,7 @@ static jint ImageWriter_attachAndQueueImage(JNIEnv* env, jobject thiz, jlong nat return -1; } return attachAndQeueuGraphicBuffer(env, ctx, surface, buffer->mGraphicBuffer, timestampNs, return attachAndQeueuGraphicBuffer(env, ctx, buffer->mGraphicBuffer, timestampNs, dataSpace, left, top, right, bottom, transform, scalingMode); } Loading @@ -866,7 +870,6 @@ static jint ImageWriter_attachAndQueueGraphicBuffer(JNIEnv* env, jobject thiz, j return -1; } sp<Surface> surface = ctx->getProducer(); if (isFormatOpaque(ctx->getBufferFormat()) != isFormatOpaque(nativeHalFormat)) { jniThrowException(env, "java/lang/IllegalStateException", "Trying to attach an opaque image into a non-opaque ImageWriter, or vice versa"); Loading @@ -880,7 +883,8 @@ static jint ImageWriter_attachAndQueueGraphicBuffer(JNIEnv* env, jobject thiz, j "Trying to attach an invalid graphic buffer"); return -1; } return attachAndQeueuGraphicBuffer(env, ctx, surface, graphicBuffer, timestampNs, return attachAndQeueuGraphicBuffer(env, ctx, graphicBuffer, timestampNs, dataSpace, left, top, right, bottom, transform, scalingMode); } Loading Loading
media/jni/android_media_ImageWriter.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -735,10 +735,15 @@ static void ImageWriter_queueImage(JNIEnv* env, jobject thiz, jlong nativeCtx, j } static status_t attachAndQeueuGraphicBuffer(JNIEnv* env, JNIImageWriterContext *ctx, sp<Surface> surface, sp<GraphicBuffer> gb, jlong timestampNs, jint dataSpace, sp<GraphicBuffer> gb, jlong timestampNs, jint dataSpace, jint left, jint top, jint right, jint bottom, jint transform, jint scalingMode) { status_t res = OK; // Step 1. Attach Image sp<Surface> surface = ctx->getProducer(); if (surface == nullptr) { jniThrowException(env, "java/lang/IllegalStateException", "Producer surface is null, ImageWriter seems already closed"); } res = surface->attachBuffer(gb.get()); if (res != OK) { ALOGE("Attach image failed: %s (%d)", strerror(-res), res); Loading Loading @@ -835,7 +840,6 @@ static jint ImageWriter_attachAndQueueImage(JNIEnv* env, jobject thiz, jlong nat return -1; } sp<Surface> surface = ctx->getProducer(); if (isFormatOpaque(ctx->getBufferFormat()) != isFormatOpaque(nativeHalFormat)) { jniThrowException(env, "java/lang/IllegalStateException", "Trying to attach an opaque image into a non-opaque ImageWriter, or vice versa"); Loading @@ -851,7 +855,7 @@ static jint ImageWriter_attachAndQueueImage(JNIEnv* env, jobject thiz, jlong nat return -1; } return attachAndQeueuGraphicBuffer(env, ctx, surface, buffer->mGraphicBuffer, timestampNs, return attachAndQeueuGraphicBuffer(env, ctx, buffer->mGraphicBuffer, timestampNs, dataSpace, left, top, right, bottom, transform, scalingMode); } Loading @@ -866,7 +870,6 @@ static jint ImageWriter_attachAndQueueGraphicBuffer(JNIEnv* env, jobject thiz, j return -1; } sp<Surface> surface = ctx->getProducer(); if (isFormatOpaque(ctx->getBufferFormat()) != isFormatOpaque(nativeHalFormat)) { jniThrowException(env, "java/lang/IllegalStateException", "Trying to attach an opaque image into a non-opaque ImageWriter, or vice versa"); Loading @@ -880,7 +883,8 @@ static jint ImageWriter_attachAndQueueGraphicBuffer(JNIEnv* env, jobject thiz, j "Trying to attach an invalid graphic buffer"); return -1; } return attachAndQeueuGraphicBuffer(env, ctx, surface, graphicBuffer, timestampNs, return attachAndQeueuGraphicBuffer(env, ctx, graphicBuffer, timestampNs, dataSpace, left, top, right, bottom, transform, scalingMode); } Loading