PixelBuffer API threading model?

Neil C Smith neil at codelerity.com
Tue Feb 18 13:09:54 UTC 2020


I'm working on a project at the moment that is integrating GStreamer
with the new JavaFX PixelBuffer API.  The threading behaviour of that
seems somewhat under documented.

Assuming an Image backed by an externally provided ByteBuffer, when is
it actually safe to free that native memory?

Using that Image in an ImageView with the following pseudo code on the
application thread -


will result in occasional access attempts and segfaults in texture upload.

Running the freeNativeMemory() part in an additional
Platform.runLater() appears to pass tests, but is that really the
right/robust option?  Have I missed an obvious way to mark the buffer
as no longer valid?

Incidentally, an extension to the API to allow swapping out the
underlying ByteBuffer for another one would be really useful!

Thanks and best wishes,


Neil C Smith
Codelerity Ltd.

Codelerity Ltd. is a company registered in England and Wales
Registered company number : 12063669
Registered office address : Office 4 219 Kensington High Street,
Kensington, London, England, W8 6BD

More information about the openjfx-dev mailing list