Package org.lwjgl.egl

Class NVStreamSocket

  • public final class NVStreamSocket
    extends java.lang.Object
    Native bindings to the NV_stream_socket extension.

    These extensions build on the framework for remote streams provided in NV_stream_remote to define a means for two EGLStream objects representing opposite ends of a single stream to establish communication using a socket. The application is expected to create and connnect both ends of the socket before creating the stream objects.

    The base EGL_NV_stream_socket extension defines most of the attributes required to initialize the stream objects. The EGL_NV_stream_socket_unix and EGL_NV_stream_socket_inet extensions indicate support for UNIX domain and internet protocol socket types, respectively. Additional extensions may provide support for other socket types. The type of socket is important, as certain operations are only available with certain types, which may influence how the streams are implemented. For instance, UNIX domain sockets allow file descriptors to be passed between processes, while internet protocol sockets do not. This ability may allow more efficient sharing of resources between the socket endpoints.

    An application using this extension will bear some similarity to the example code from the KHR_stream_cross_process_fd extension, which also uses sockets to establish the communication between two processes and then create a pair of EGLStream objects. The key difference is that in that case, the sockets are merely a temporary means to an end to pass a file descriptor between the processes. Once that is accomplished, the sockets are discarded.

    The file descriptor used by that extension may represent an underlying object such as shared memory which allows more efficient communication than the sockets themselves. However, there is nothing preventing an implementation of EGL_NV_stream_socket from creating and passing such a file descriptor as well, gaining the same efficiency. Therefore, a protocol based on sockets will work at least as well as one based on file descriptors, with the added benefit of being more portable.

    Requires NV_stream_remote.