Minijailed Media Codec (MMC)

MMC is a service running in minijail that isolates codec implementations from the Bluetooth process and system resources. It is an independent daemon that spawns codec servers on demand to communicate with their corresponding codec clients living in Floss.

Steps to Apply MMC to a New Codec

1. Implement codec server

  • Wraps third party library codes.
  • Codec server should inherit MMC Interface.
    • public methods: init, cleanup, transcode.
    • init: set up transcoder and return frame size accepted by the transcoder.
    • cleanup: clear the transcoder context.
    • transcode: transcode input data, store result in the given output buffer, and return the transcoded data length.

2. Add codec proto message in mmc_config.proto

  • Define a proto message for the new codec, generally, it may include:
    • Init configuration.
    • Transcode arguments or params.
    • Library-specific enum mappings.
  • Append an entry to ConfigParam.

3. Add codec support in MMC daemon

  • Match the new ConfigParam to create its corresponding server in CodecInit.

4. Access the interface via CodecClient from within the BT process

  • BT process accesses codec implementations via CodecClient.
    • init: set up ConfigParam and pass it to CodecClient.
    • transcode: pass input and output buffer, and specify the input data size and the output buffer capacity. transcode returns transcoded data length on success, and negative error number otherwise.
    • cleanup: when a session ends, cleanup should be called.

Related links

  • Design doc: go/floss-mmc
  • Slides: go/floss-mmc-presentation
  • Performance evaluation: go/floss-mmc-experiment