Skip to content

Commit

Permalink
Fix native crash #495
Browse files Browse the repository at this point in the history
  • Loading branch information
act262 committed Jun 2, 2020
1 parent 2f01ae7 commit 113ebbb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,16 @@ public void onPreviewFrame(final byte[] data, final int width, final int height)
runOnDraw(new Runnable() {
@Override
public void run() {
if (imageWidth != width || imageHeight != height) {
glRgbBuffer = null;
glRgbBuffer = IntBuffer.allocate(width * height);
GLES20.glDeleteTextures(1, new int[]{glTextureId}, 0);
glTextureId = NO_IMAGE;
}
GPUImageNativeLibrary.YUVtoRBGA(data, width, height, glRgbBuffer.array());
glTextureId = OpenGlUtils.loadTexture(glRgbBuffer, width, height, glTextureId);

if (imageWidth != width) {
if (imageWidth != width || imageHeight != height) {
imageWidth = width;
imageHeight = height;
adjustImageScaling();
Expand Down

0 comments on commit 113ebbb

Please sign in to comment.