tree: f9e351c33ee9a8cc94337a5bfa5fcd7a79aab69e [path history] [tgz]
  1. codec_client/
  2. codec_server/
  3. daemon/
  4. dbus_permissions/
  5. dbus_service/
  6. init/
  7. metrics/
  8. minijail/
  9. mmc_interface/
  10. proto/
  11. test/
  12. tmpfiles.d/
  13. BUILD.gn
  14. main.cc
  15. OWNERS
  16. README.md
system/stack/mmc/README.md

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