• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

codec_client/25-Apr-2025-360233

codec_server/25-Apr-2025-734440

daemon/25-Apr-2025-448288

dbus_permissions/25-Apr-2025-4842

dbus_service/25-Apr-2025-2120

init/25-Apr-2025-4615

metrics/25-Apr-2025-13777

minijail/25-Apr-2025-3816

mmc_interface/25-Apr-2025-5214

proto/25-Apr-2025-184157

test/25-Apr-2025-631414

tmpfiles.d/25-Apr-2025-211

BUILD.gnD25-Apr-20254.3 KiB176163

README.mdD25-Apr-20252.5 KiB4633

main.ccD25-Apr-20253.1 KiB10764

README.md

1# Minijailed Media Codec (MMC)
2
3MMC is a service running in minijail that isolates codec implementations from
4the Bluetooth process and system resources. It is an independent daemon that
5spawns codec servers on demand to communicate with their corresponding codec
6clients living in Floss.
7
8## Steps to Apply MMC to a New Codec
9
10### 1. Implement codec server
11
12  * Wraps third party library codes.
13  * Codec server should inherit [MMC Interface](https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/system/stack/mmc/mmc_interface/mmc_interface.h).
14    * public methods: `init`, `cleanup`, `transcode`.
15    * `init`: set up transcoder and return frame size accepted by the transcoder.
16    * `cleanup`: clear the transcoder context.
17    * `transcode`: transcode input data, store result in the given output buffer,
18                   and return the transcoded data length.
19
20### 2. Add codec proto message in [mmc_config.proto](https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/system/stack/mmc/proto/mmc_config.proto)
21
22  * Define a proto message for the new codec, generally, it may include:
23    * Init configuration.
24    * Transcode arguments or params.
25    * Library-specific enum mappings.
26  * Append an entry to [`ConfigParam`](https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/system/stack/mmc/proto/mmc_config.proto;drc=1e6b2d44402d18cce637f4b02d4da25133924662;l=99).
27
28### 3. Add codec support in MMC daemon
29
30  * Match the new `ConfigParam` to create its corresponding server in [`CodecInit`](https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/system/stack/mmc/daemon/service.cc;drc=e9fcc3a7897c6af3df4163534688290778e2333b;l=186).
31
32### 4. Access the interface via [`CodecClient`](https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/system/stack/mmc/codec_client/codec_client.h) from within the BT process
33
34  * BT process accesses codec implementations via `CodecClient`.
35    * `init`: set up `ConfigParam` and pass it to `CodecClient`.
36    * `transcode`: pass input and output buffer, and specify the input data size
37                   and the output buffer capacity. `transcode` returns transcoded
38                   data length on success, and negative error number otherwise.
39    * `cleanup`: when a session ends, `cleanup` should be called.
40
41## Related links
42
43* Design doc: go/floss-mmc
44* Slides: go/floss-mmc-presentation
45* Performance evaluation: go/floss-mmc-experiment
46