Skip to content

Commit

Permalink
Update HACKING
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed May 7, 2024
1 parent d85ed57 commit ba0e8bf
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions HACKING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# Hacking guide

## General overview
## Design overview

Virtual device is implemented as a plugin, a.k.a. driver, for CoreAudio sound daemon.

The driver is running in a sandbox, isolated from filesystem, but with network access. The streaming part is integrated right into the driver. The command-line tool controls the driver via gRPC over a TCP socket on localhost.

To communicate with CoreAudio HAL, Roc VAD uses [libASPL](https://github.com/gavv/libASPL) (developed by the author of these lines). You can refer to its documentation to get familiar with CoreAudio HAL concepts, which affect Roc VAD design quite a lot.

For streaming, Roc VAD uses Roc Toolkit [C API](https://roc-streaming.org/toolkit/docs/api.html). Refer to its documentation for more details about interfaces, endpoints, protocols, and various sender and receiver options.
For streaming, Roc VAD uses [Roc Toolkit API](https://roc-streaming.org/toolkit/docs/api.html). Refer to its documentation for more details about interfaces, endpoints, protocols, and various sender and receiver options.

## Driver state

To keep things simple, there is no state outside the driver (no configuration files, no daemon, etc).

Since driver can be restarted at any point (because coreaudiod may restart), it should be able to restore its state. To achieve this, it stores serialized state in persistent storage provided by CoreAudio HAL. (There no access to filesystem, but there is a key-value storage that can be used by plugins.)

Implementation of saving and loading state is straightforward: since driver is entirely configurable via gRPC, we already have protobuf messages for everything needed to configure driver. Thus we can just store these serialized protobuf messages after each configuration update, and load them at driver start.

## Dependencies

Expand Down Expand Up @@ -92,7 +100,7 @@ make fmt

## Debugging commands

Stream driver logs from syslog (when RPC doesn't work):
Stream driver logs from syslog (when RPC doesn't work, or e.g. to get early initialization logs):

```
make syslog
Expand All @@ -107,7 +115,7 @@ make sysprof
Restart coreaudiod:

```
make kick
sudo make kick
```

## Documentation commands
Expand Down

0 comments on commit ba0e8bf

Please sign in to comment.