Closed kinetiknz closed 3 years ago
I've reviewed half of the patch. Will do the rest tomorrow.
The core IPC rework/macOS changes build on top this PR, so I've addressed the outstanding issues and review comments from earlier, and added several additional necessary changes.
Given the substantial changes since the first review, r? @ChunMinChang again please.
Sorry for the delay. I am working on the review right now. Will finish this ASAP.
This addresses https://github.com/mozilla/audioipc-2/issues/45 by configuring a single SharedMem per stream and using it for both directions of data transport. Handling this is simple on the server side, as access is sequenced to the SharedMem by the interaction with the client via IPC (copy to input, call and wait on client, copy to output). On the client side, an extra copy for the input is required for duplex streams to preserve cubeb data_callback's API requirements.
To allow Gecko to control the SharedMem region size via a pref, the SHM_AREA_SIZE constant is removed and a per-server configurable value is used. This value is passed to the client during SharedMem setup rather than assuming a fixed size. SharedMem setup between server and client is now handled via a new CallbackReq/CallbackResp message.
This also addresses https://github.com/mozilla/audioipc-2/issues/68 by reducing the file descriptor passing requirement to one per message. Framed becomes obsolete as all transports are now FramedWithPlatformHandles, so frame.rs is removed.
PlatformHandle is simplified into a owning only handle for internal use. RemoteHandle is introduced to message.rs to accurately represent the OS-specific serialized state of a remote handle.
SharedMem is simplified, removing the non-owning variant. new() now returns a single SharedMem, with handle access via make_handle() with clearer handle ownership.