• Home
Name Date Size #Lines LOC

..--

codec_client/06-Sep-2024-365238

codec_server/06-Sep-2024-741447

daemon/06-Sep-2024-460300

dbus_permissions/06-Sep-2024-4842

dbus_service/06-Sep-2024-2120

init/06-Sep-2024-4615

metrics/06-Sep-2024-13474

minijail/06-Sep-2024-3816

mmc_interface/06-Sep-2024-5315

proto/06-Sep-2024-184157

test/06-Sep-2024-662445

tmpfiles.d/06-Sep-2024-211

BUILD.gnD06-Sep-20244.3 KiB176163

OWNERSD06-Sep-202425 21

README.mdD06-Sep-20242.5 KiB4633

main.ccD06-Sep-20243.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