Bluetooth: Audio: Fix initialization of not present module

Do not initialize the media control service if it is not configured.

This is a temporary fix, there is an issue to fix this properly:
https://github.com/zephyrproject-rtos/zephyr/issues/42965

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
This commit is contained in:
Asbjørn Sæbø 2022-03-02 17:25:48 +01:00 committed by Carles Cufí
commit 8e509b47a9

View file

@ -2694,16 +2694,23 @@ int media_proxy_pl_init(void)
} }
/* Set up the media control service */ /* Set up the media control service */
/* TODO: Fix initialization - who initializes what
* https://github.com/zephyrproject-rtos/zephyr/issues/42965
* Temporarily only initializing if service is present
*/
#ifdef CONFIG_BT_MCS
#ifdef CONFIG_BT_MPL_OBJECTS #ifdef CONFIG_BT_MPL_OBJECTS
ret = bt_mcs_init(&ots_cbs); ret = bt_mcs_init(&ots_cbs);
#else #else
ret = bt_mcs_init(NULL); ret = bt_mcs_init(NULL);
#endif /* CONFIG_BT_MPL_OBJECTS */ #endif /* CONFIG_BT_MPL_OBJECTS */
if (ret < 0) { if (ret < 0) {
BT_ERR("Could not init MCS: %d", ret); BT_ERR("Could not init MCS: %d", ret);
return ret; return ret;
} }
#else
BT_WARN("MCS not configured");
#endif /* CONFIG_BT_MCS */
/* Get a Content Control ID */ /* Get a Content Control ID */
pl.content_ctrl_id = bt_ccid_get_value(); pl.content_ctrl_id = bt_ccid_get_value();