21 Commits

Author SHA1 Message Date
Emilian Peev
2adf40392e media: Check window connect status in ImageWriter
ImageWriter clients could pass invalid or already
connected surface during initialization. Check the
status after trying to connect to the producer
interface and raise an exception if necessary.

Bug: 80086132
Test: Camera CTS
Change-Id: I46810885046a3b89ea18510574c22db27e812a9c
2018-06-06 09:57:15 +00:00
renn
be09219f61 Adds support for hardware buffers in ImageWriter Images.
This allows dequeuing private image buffers from ImageWriters,
and accessing their hardware buffers.

Bug: 79422702
Test: verified cts locally
Change-Id: Ia003ffa0af305fad8ca9407f5379a3c9c1ab07b5
2018-05-22 20:43:07 +00:00
Emilian Peev
750aec6f3b media: Populate Image scaling mode in reader and writer
"ImageReader" and "ImageWriter" must pass information about the
specific buffer scaling mode.

Bug: 76022384
Test: Manual using application,
Camera CTS

Change-Id: I116f00cbf3b1487d8e44661e8fd15e2aa16e6e0d
2018-04-06 13:01:45 +01:00
Emilian Peev
450a5ffdfd Camera: Populate Image tranformation in reader and writer
"ImageReader" and "ImageWriter" must pass information about the
specific buffer transformation.
Currently only the "ImageReader" implementation of the
"android.media.Image" abstract classs will populate the
corresponding transformation, the remaining implementations will
use the default identity tranformation.

Bug: 75316204
Test: Manual using test application,
Camera CTS

Change-Id: If5c12134fbbef8cc20c3d369986ba613bc4f2cec
2018-03-19 16:19:43 +00:00
Steven Moreland
5c091dc944 Merge "frameworks/base: use proper nativehelper headers"
am: 826eafd958

Change-Id: I36f10ff4d963284a313f1cc5b368f82549a4adb2
2017-07-20 02:50:53 +00:00
Steven Moreland
2279b25342 frameworks/base: use proper nativehelper headers
libnativehelper exports headers under nativehelper. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: modules using frameworks/base find headers
Bug: 63762847
Change-Id: I0f9f231acdebe460f279135462f43d3e32eff64d
2017-07-19 10:06:40 -07:00
Colin Cross
58d87e8ab7 Convert libmedia_jni to Android.bp
See build/soong/README.md for more information.

Test: m -j checkbuild
Change-Id: I1817c75ee45537ca0d5fc40a035f94a3dfeccc11
Merged-In: I1817c75ee45537ca0d5fc40a035f94a3dfeccc11
(cherry picked from commit 76de4f6b4d09423b3a5d3603527ce79acae4ed32)
2017-05-16 22:05:39 -07:00
Colin Cross
eb27d2798a Convert libmedia_jni to Android.bp
See build/soong/README.md for more information.

Test: m -j checkbuild
Change-Id: I1817c75ee45537ca0d5fc40a035f94a3dfeccc11
Merged-In: I1817c75ee45537ca0d5fc40a035f94a3dfeccc11
(cherry picked from commit 76de4f6b4d09423b3a5d3603527ce79acae4ed32)
2017-05-17 03:02:21 +00:00
Eino-Ville Talvala
07ad459c84 ImageWriter: Attach non-opaque Images as well.
With all the work under the hood of ImageReader/Writer in the last few
releases, this is much more straightforward to enable.

Only trick is to ensure that the Image detached from the ImageReader
correctly clears out its planes, if present.

Bug: 19962027
Test: Camera CTS still passes on angler, sailfish, ryu
Change-Id: Ic8a1f3e2f45cf15971d76e308a5af25eb2fd66f1
2017-05-04 11:04:56 -07:00
Zhijun He
916d8ac650 ImageReader/Writer: add usage flag support
Also add an ImageWriter ctor to take additional arugment (format)

Test: ImageReader and Writer CTS tests
Bug: 32766711
Change-Id: I99e3862dd5b9a85c9df7879c14c84b68a35718ec
2017-04-10 23:38:32 +00:00
Mathias Agopian
845eef05ff Remove useless GraphicBuffer() constructor
Test: compiled & run
Bug: 36869708
Change-Id: Ie825979cd03874904b6f953ece4a05d4a0d52253
2017-04-03 17:51:15 -07:00
Zhijun He
0ab416269a ImageReader/Writer: refactor and cleanup
Below changes are included:
* Defer the buffer lock to Image#getPlanes call. This will save quite a bit
CPU cycles associated with lock buffer if the application doesn't really
want to access the data.
* Refactor the code: move some common code to some utility class, and use
one unified consumer (BufferItemConsumer) in ImageReader native implementation.
The code refactoring will also make it easier to support non-opaque image
attach/detach.

Bug: 22356918
Bug: 19962027
Change-Id: I4fb865b0ea3deb6650afc64c32a5906f30e8ccbd
2016-03-08 13:21:36 -08:00
Zhijun He
dc6bb24a3c media: improve ImageReader/Writer native memory management
* Hook up the native allocation registration with ImageWriter, such that GC
can get some hint when clean up the large memory object.
* Close all pending images when closing ImageReader. This could avoid native
mem leaks for some bad app practice. For example, some apps may hold images
in background service when activity is paused/destroyed, which could cause
huge native memory leaks even ImageReader is closed.
* make Image close thread safe: it is possible the clients close the image
in listener thread and the client main thread.
* Some minor code refactor to reduce the code duplication.

Bug: 25088440
Change-Id: I37d22b52aeb8d2521bf9c702b0f54c05905473e0
2015-12-07 14:38:37 -08:00
Chien-Yu Chen
e0ee63046a ImageWriter: Exception when Surface is abandoned
Throw IllegalStateException when queueing or dequeueing an
image if the input surface is already abandoned by the consumer.

Also fix a crash when planes are not initialized when closing
ImageWriter.

Bug: 22279111
Change-Id: I8301920d64a53c45b29e947e52ff323733abbf16
2015-07-06 18:26:28 -07:00
Chien-Yu Chen
0375cb042d ImageWriter: Remove exception for closing twice
because close() will be called again when GC kicks in.

Bug: 20945169
Change-Id: If3c5a13be241977ccf4692d5301c423b7ff38918
2015-06-18 11:55:18 -07:00
Dan Albert
1102e21b5d Fix format string mismatch. Clang build fix.
The gralloc usage flags are an enum, which is backed by an
implementation defined type. Both gcc and clang are making this a long
long. All the values are hard coded to fit within 8 hex characters
though, so just make the cast.

Change-Id: I4a9778a24c2cbf7fb663371d208e30c4921e170d
2015-06-10 23:05:53 +00:00
Dan Stoza
3316452ffa ImageWriter: Change detach to sp<GraphicBuffer>
Changes the call to IGBP::detachNextBuffer to return an
sp<GraphicBuffer> instead of an ANativeWindowBuffer*.

Bug: 20092217
Change-Id: I59d6acef7120de5040c6710aeecfa1633ec7f736
2015-04-27 11:31:12 -07:00
Zhijun He
a58271419e ImageWriter: fix and cleanup the closed Image Handling
Attempting to access an Image after it is closed will result in an ISE.

Also fixed some minor doc issues.

Bug: 19872785
Change-Id: I91f037b2b2f243fcbd905d5a646b505bc9c10638
2015-04-24 13:35:07 -07:00
Zhijun He
ce9d6f9c75 ImageReader/Writer: implement opaque format operations
Implement attach/detach for image reader and writer.

Bug: 19872821
Change-Id: Ib45a054c6be0b56b370fa8d709b47b0298ba5ea7
2015-04-08 10:39:29 -07:00
Zhijun He
d1cbc68405 media: fix build break
clang/llvm complains the timestamp print formating.

Change-Id: Ie4bff9cbec90994709097d087d1c1f2a7d1465cf
2015-03-23 10:10:04 -07:00
Zhijun He
f6a09e5106 ImageReader/Writer: Add ImageWriter and Opaque ImageReader
ImageWriter/Reader API change, including below changes
* Interface for Opaque ImageReader
* ImageWriter Interface and implementation
* Image class minor update to support ImageWriter opaque ImageReader

detach/attach interface are defined but yet to be implemented.

Change-Id: Ic7c0d2df73c80b1a81a7316d8c4556bf7703c309
2015-03-20 18:19:58 -07:00