OSDN Git Service

Fixes for YuvToJpegEncoder::encode
authorLeon Scroggins III <scroggo@google.com>
Wed, 28 Feb 2018 18:23:32 +0000 (13:23 -0500)
committerLeon Scroggins III <scroggo@google.com>
Wed, 28 Feb 2018 18:30:40 +0000 (13:30 -0500)
commit1c3ded39f2ebd57286577a648d5a906752046386
tree7e5f0f08fc8c2d6e8cd9067a8446b6775ac9512c
parent04fe7e607e8b53c4653b22de4792588421c8a4c6
Fixes for YuvToJpegEncoder::encode

Bug: 70969260
Test: Existing CTS tests

Call jpeg_destroy_compress after compression (and failure), eliminating
a memory leak.

In addition, use a custom method for handling errors. skjpeg_error_exit
was previously used, but that method expects a skjpeg_error_mgr, which
isn't used here. skjpeg_error_mgr is more complex than necessary; it
allows for multiple methods to set their own jmp_bufs, even if they call
each other. The entire compression here is contained in one method. The
code for handling this single jmp_buf is simple, so no need to share
code.

This is a follow-on to If9a33ed10ea60131906a632a7030e0b69a21f4ea, which
removed skjpeg_error_mgr, but incorrectly left the skjpeg_error_exit.

Change-Id: Ib76e07ae0d29b093d3709f60e427b18e0e32bd9d
core/jni/android/graphics/YuvToJpegEncoder.cpp